:root {
  --ink: #1a1919; --ink-2: #424242; --muted: #6f6c69; --faint: #a19d99;
  --bg: #faf9f8; --panel: #ffffff; --line: #ebe7e3; --line-2: #f3f0ed;
  --accent: #e30044; --accent-2: #ff4f86; --accent-soft: #fde7ee; --accent-dark: #c4003b;
  --green: #1f9d6b; --green-soft: #e5f6ee; --amber: #b7791f; --amber-soft: #fdf4dd;
  --red: #c62828; --red-soft: #fdeaea; --blue: #3a6df0; --blue-soft: #e9efff;
  --violet: #7a52d1; --violet-soft: #f0eafd;
  --radius: 12px; --shadow: 0 1px 2px rgba(26,25,25,.04), 0 4px 16px rgba(26,25,25,.05);
  --font: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--ink-2); font-size: 13.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { color: var(--ink); margin: 0; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; }
.hidden { display: none !important; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art { background: var(--ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art .rings { position: absolute; right: -160px; bottom: -160px; width: 560px; height: 560px; opacity: .9; }
.auth-art h2 { color: #fff; font-size: 34px; line-height: 1.15; max-width: 460px; font-weight: 700; letter-spacing: -.02em; }
.auth-art h2 em { font-style: normal; color: var(--accent); }
.auth-art p { color: #b3afab; max-width: 420px; font-size: 15px; }
.auth-art .feat { display: grid; gap: 10px; margin-top: 28px; position: relative; z-index: 1; }
.auth-art .feat div { display: flex; gap: 10px; align-items: center; color: #e2dedb; }
.auth-art .feat i { width: 26px; height: 26px; border-radius: 50%; background: rgba(227,0,68,.15); color: var(--accent); display: grid; place-items: center; font-style: normal; font-size: 13px; flex: none; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card form { display: grid; gap: 14px; margin-top: 26px; }
.auth-switch { margin-top: 18px; text-align: center; color: var(--muted); }
.auth-switch a { font-weight: 600; cursor: pointer; }
.logo { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; color: #fff; }
.logo img { height: 62px; width: auto; display: block; margin-left: -2px; }
.logo small { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: #8f8b87; padding-left: 4px; }


/* ---------- form controls ---------- */
label.f { display: grid; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
label.f span.hint { font-weight: 400; color: var(--faint); }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; outline: none; transition: border .15s, box-shadow .15s; font-size: 14px;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(227,0,68,.15); }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.55; }
.row { display: flex; gap: 12px; align-items: center; } .row.wrap { flex-wrap: wrap; } .row.end { justify-content: flex-end; } .row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stack { display: grid; gap: 14px; align-content: start; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; cursor: pointer; padding: 6px 10px; border: 1px solid var(--line); border-radius: 20px; background: #fff; }
.check input { accent-color: var(--accent); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: background .15s, border .15s, transform .05s; }
.btn:hover { background: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover { background: #2e2c2c; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.danger { color: var(--red); }
.btn.green { background: #25d366; border-color: #25d366; color: #fff; }
.btn.sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; padding: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; border: 0; background: transparent; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
svg.i { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #cfcbc7; padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.side nav { display: grid; gap: 2px; }
.side .nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #7a7672; padding: 12px 12px 6px; }
.side a { display: flex; gap: 11px; align-items: center; color: #cfcbc7; padding: 9px 12px; border-radius: 9px; font-weight: 500; font-size: 13.5px; }
.side a:hover { background: rgba(255,255,255,.05); color: #fff; }
.side a.on { background: rgba(227,0,68,.2); color: #fff; }
.side a.on svg { color: var(--accent); }
.side a .count { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 10px; }
.side .me { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 10px; background: rgba(255,255,255,.04); }
.side .me .who { min-width: 0; flex: 1; } .side .me .who b { color: #fff; display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .me .who span { font-size: 11.5px; color: #8f8b87; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.side .me .icon-btn { color: #8f8b87; } .side .me .icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: 11.5px; }
.avatar.c1 { background: #3a6df0; } .avatar.c2 { background: #1f9d6b; } .avatar.c3 { background: #7a52d1; } .avatar.c4 { background: #c98a12; } .avatar.c5 { background: #d64545; }

.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 18px 28px; border-bottom: 1px solid var(--line); background: rgba(250,249,248,.88); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5; }
.topbar h1 { flex: 1; }
.topbar .menu-btn { display: none; }
.content { padding: 24px 28px 60px; }

/* ---------- cards & KPIs ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 18px 20px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; }
.kpi .lbl { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi .val { font-size: 26px; font-weight: 700; color: var(--ink); letter-spacing: -.02em; margin-top: 2px; }
.kpi .sub { font-size: 12px; color: var(--faint); }
.kpi.hl { background: var(--ink); border-color: var(--ink); } .kpi.hl .lbl { color: #a8a4a0; } .kpi.hl .val { color: #fff; } .kpi.hl .sub { color: var(--accent-2); }
.dash { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; }
.dash .col { display: grid; gap: 18px; align-content: start; }

.funnel { display: grid; gap: 9px; padding: 18px 20px; }
.funnel .fr { display: grid; grid-template-columns: 110px 1fr 46px; gap: 12px; align-items: center; font-size: 13px; }
.funnel .bar { height: 10px; background: var(--line-2); border-radius: 6px; overflow: hidden; }
.funnel .bar i { display: block; height: 100%; border-radius: 6px; background: var(--accent); }
.funnel .num { text-align: right; font-weight: 700; color: var(--ink); }

.list { display: grid; }
.li { display: flex; gap: 12px; align-items: center; padding: 11px 20px; border-top: 1px solid var(--line-2); cursor: pointer; }
.li:first-child { border-top: 0; }
.li:hover { background: #fbf9f7; }
.li .grow { flex: 1; min-width: 0; }
.li .t { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .s { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 32px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; font-size: 15px; }

.feed { padding: 6px 20px 14px; }
.feed .ev { display: flex; gap: 11px; padding: 9px 0; border-bottom: 1px dashed var(--line-2); font-size: 13px; }
.feed .ev:last-child { border-bottom: 0; }
.feed .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--line-2); color: var(--muted); }
.feed .dot svg { width: 13px; height: 13px; }
.feed .dot.email_open, .feed .dot.email_click { background: var(--blue-soft); color: var(--blue); }
.feed .dot.email_reply, .feed .dot.wa_reply, .feed .dot.form { background: var(--green-soft); color: var(--green); }
.feed .dot.qualified { background: var(--accent-soft); color: var(--accent); }
.feed .dot.email_sent, .feed .dot.wa_sent, .feed .dot.wa_link { background: var(--violet-soft); color: var(--violet); }
.feed .when { font-size: 11.5px; color: var(--faint); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--line-2); color: var(--muted); }
.badge.s-New { background: #eef0f5; color: #556; }
.badge.s-Contacted { background: var(--violet-soft); color: var(--violet); }
.badge.s-Engaged { background: var(--blue-soft); color: var(--blue); }
.badge.s-Qualified { background: var(--accent-soft); color: var(--accent); }
.badge.s-Proposal { background: var(--amber-soft); color: var(--amber); }
.badge.s-Negotiation { background: var(--amber-soft); color: #a0680a; }
.badge.s-Won { background: var(--green-soft); color: var(--green); }
.badge.s-Lost { background: var(--red-soft); color: var(--red); }
.badge.ok { background: var(--green-soft); color: var(--green); } .badge.warn { background: var(--amber-soft); color: var(--amber); } .badge.err { background: var(--red-soft); color: var(--red); }
.badge.High { background: var(--red-soft); color: var(--red); } .badge.Medium { background: var(--amber-soft); color: var(--amber); } .badge.Low { background: #eef0f5; color: #667; }
.score { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.score i { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); overflow: hidden; display: inline-block; }
.score i b { display: block; height: 100%; background: var(--accent); }

/* ---------- table ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { position: relative; flex: 1; min-width: 220px; max-width: 360px; }
.toolbar .search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.toolbar .search input { padding-left: 34px; }
.toolbar select.input { width: auto; min-width: 140px; }
.bulkbar { display: flex; gap: 8px; align-items: center; padding: 10px 14px; background: var(--ink); color: #fff; border-radius: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.bulkbar .btn { background: rgba(255,255,255,.1); border-color: transparent; color: #fff; }
.bulkbar .btn:hover { background: rgba(255,255,255,.18); }
.bulkbar select { background: rgba(255,255,255,.1); border: 0; color: #fff; padding: 6px 8px; border-radius: 8px; }
.bulkbar select option { color: var(--ink); }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 11px 14px; border-bottom: 1px solid var(--line); background: #f8f6f4; white-space: nowrap; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: #fbf9f7; }
table.t td .nm { font-weight: 600; color: var(--ink); }
table.t td .sub { font-size: 12px; color: var(--muted); }
table.t input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }

/* ---------- pipeline ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.col-k { background: #f1eeeb; border-radius: 12px; padding: 10px; min-height: 200px; }
.col-k.over { background: #fde7ee; outline: 2px dashed var(--accent); }
.col-k .kh { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 10px; font-weight: 700; color: var(--ink); font-size: 13px; }
.col-k .kh span { color: var(--muted); font-weight: 500; font-size: 12px; }
.kcard { background: #fff; border-radius: 10px; padding: 11px 12px; margin-bottom: 8px; border: 1px solid var(--line); cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.kcard:hover { border-color: #d8d2cc; }
.kcard.drag { opacity: .4; }
.kcard .t { font-weight: 600; color: var(--ink); }
.kcard .s { font-size: 12px; color: var(--muted); }
.kcard .m { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12px; }

/* ---------- tasks ---------- */
.task-group { margin-bottom: 20px; }
.task-group h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 8px 4px; }
.task-group h3.red { color: var(--red); }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-top: 1px solid var(--line-2); }
.task:first-child { border-top: 0; }
.task .cb { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #d0cac4; cursor: pointer; flex: none; margin-top: 1px; display: grid; place-items: center; background: #fff; }
.task .cb:hover { border-color: var(--green); }
.task.done .cb { background: var(--green); border-color: var(--green); color: #fff; }
.task.done .tt { text-decoration: line-through; color: var(--faint); }
.task .tt { font-weight: 600; color: var(--ink); }
.task .grow { flex: 1; min-width: 0; }
.task .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; font-size: 12px; color: var(--muted); }

/* ---------- campaigns ---------- */
.camp { padding: 18px 20px; display: grid; gap: 14px; }
.camp-top { display: flex; gap: 14px; align-items: flex-start; }
.camp-top .grow { flex: 1; min-width: 0; }
.camp-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.camp-stats div { background: #f7f5f2; border-radius: 9px; padding: 10px 12px; }
.camp-stats b { display: block; font-size: 18px; color: var(--ink); }
.camp-stats span { font-size: 11.5px; color: var(--muted); }
.seq { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.seq .st { background: var(--line-2); padding: 3px 9px; border-radius: 6px; color: var(--ink-2); font-weight: 500; }
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d4cfca; border-radius: 22px; cursor: pointer; transition: .2s; }
.switch span::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(18px); }
.step-row { display: grid; grid-template-columns: 28px 1fr 150px 32px; gap: 10px; align-items: center; padding: 10px; background: #f7f5f2; border-radius: 10px; }
.step-row .n { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; }

/* ---------- templates ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.tpl { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; transition: border .15s, transform .15s; }
.tpl:hover { border-color: #d8d2cc; transform: translateY(-1px); }
.tpl .subj { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.tpl .prev { font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.wa-bubble { background: #dcf8c6; border-radius: 10px 10px 10px 2px; padding: 10px 12px; font-size: 13px; white-space: pre-line; color: #1d2b1f; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.wa-phone { background: #e9e1d6 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Ccircle cx='20' cy='20' r='1.2' fill='%23d6cbbb'/%3E%3C/svg%3E"); border-radius: 12px; padding: 16px; }
.vars { display: flex; gap: 6px; flex-wrap: wrap; }
.vars code { background: var(--line-2); padding: 2px 7px; border-radius: 5px; font-size: 12px; cursor: pointer; color: var(--ink-2); }
.vars code:hover { background: var(--accent-soft); color: var(--accent); }
.editor { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.preview-frame { width: 100%; height: 480px; border: 1px solid var(--line); border-radius: 10px; background: #f4f2ee; }

/* ---------- drawer & modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(26,25,25,.35); z-index: 40; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: var(--bg); z-index: 41; display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(26,25,25,.15); animation: slide .2s ease-out; }
.drawer-h { padding: 20px 24px; background: #fff; border-bottom: 1px solid var(--line); display: flex; gap: 14px; align-items: flex-start; }
.drawer-b { flex: 1; overflow-y: auto; padding: 20px 24px 40px; display: grid; gap: 16px; align-content: start; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.tabs button { background: none; border: 0; padding: 9px 12px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-color: var(--accent); }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.kv div span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.kv div b { font-weight: 600; color: var(--ink); word-break: break-word; }
.modal-wrap { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(26,25,25,.25); animation: pop .18s ease-out; max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal.wide { max-width: 980px; }
.modal-h { padding: 18px 22px; border-bottom: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: center; }
.modal-b { padding: 20px 22px; overflow-y: auto; display: grid; gap: 14px; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 10px; }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.2); font-weight: 500; animation: pop .2s; max-width: 90vw; }
.toast.err { background: var(--red); }
.alert { padding: 12px 14px; border-radius: 10px; font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.alert.warn { background: var(--amber-soft); color: #7d5608; } .alert.info { background: var(--blue-soft); color: #2a4fb0; } .alert.err { background: var(--red-soft); color: var(--red); } .alert.ok { background: var(--green-soft); color: #13704b; }
.alert svg { margin-top: 1px; }
.integ { display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line-2); }
.integ:first-of-type { border-top: 0; }
.integ .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--line-2); flex: none; }
.integ .grow { flex: 1; }
pre.code { background: var(--ink); color: #e5e7f0; padding: 14px; border-radius: 10px; font-size: 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; margin: 0; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 60px; }
.chart svg { display: block; width: 100%; height: auto; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .dash { grid-template-columns: 1fr; } .camp-stats { grid-template-columns: repeat(3, 1fr); } .editor { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; } .auth-art { display: none; }
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; z-index: 45; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .topbar { padding: 14px 16px; } .topbar .menu-btn { display: grid; }
  .topbar h1 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  #actions { gap: 6px; } #actions .btn { font-size: 0; gap: 0; padding: 9px 10px; } #actions .btn svg { width: 18px; height: 18px; }
  .card-h { flex-wrap: wrap; } .camp-stats { grid-template-columns: repeat(2, 1fr); }
  .toolbar .search { max-width: none; min-width: 100%; } .toolbar select.input { flex: 1; min-width: 0; }
  .content { padding: 16px 16px 60px; }
  .grid2, .grid3, .kv { grid-template-columns: 1fr; }
  .step-row { grid-template-columns: 28px 1fr 32px; } .step-row .delay { grid-column: 2; }
  .hide-sm { display: none; }
}

/* ---------- My Files ---------- */
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; margin-bottom: 16px; }
.crumbs a { color: var(--muted); cursor: pointer; font-weight: 500; } .crumbs a:hover { color: var(--accent); }
.crumbs b { color: var(--ink); font-weight: 600; } .crumbs span { color: var(--faint); }
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 22px; }
.folder { display: flex; gap: 12px; align-items: center; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: border .15s, background .15s; position: relative; }
.folder:hover { border-color: var(--accent); background: #fffafb; }
.folder.drop { border-color: var(--accent); background: var(--accent-soft); }
.folder .fi { width: 42px; height: 34px; flex: none; }
.folder .fn { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder .fm { font-size: 11.5px; color: var(--faint); }
.folder .more { position: absolute; top: 6px; right: 6px; opacity: 0; }
.folder:hover .more { opacity: 1; }
.file-ic { width: 34px; height: 40px; flex: none; }
.dropzone { border: 2px dashed #d8d2cc; border-radius: 14px; padding: 36px 20px; text-align: center; background: #fff; cursor: pointer; transition: border .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: #fffafb; }
.dropzone b { display: block; color: var(--ink); font-size: 15px; margin: 10px 0 4px; }
.dropzone .big { width: 46px; height: 46px; color: var(--accent); }
.menu { position: absolute; z-index: 65; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(26,25,25,.15); padding: 6px; min-width: 190px; }
.menu button { display: flex; gap: 10px; align-items: center; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 7px; cursor: pointer; font-size: 13px; text-align: left; color: var(--ink-2); }
.menu button:hover { background: var(--line-2); } .menu button.danger { color: var(--red); }
.menu hr { border: 0; border-top: 1px solid var(--line-2); margin: 4px 0; }

/* ---------- categoriser ---------- */
.steps { display: flex; gap: 8px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.steps .s { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--faint); font-weight: 500; }
.steps .s i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 700; background: var(--line-2); color: var(--muted); }
.steps .s.on { color: var(--ink); } .steps .s.on i { background: var(--accent); color: #fff; }
.steps .s.done i { background: var(--ink); color: #fff; }
.steps .line { width: 30px; height: 2px; background: var(--line); }
.cat-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.cat-chip { padding: 12px 14px; border-radius: 11px; background: #fff; border: 1px solid var(--line); cursor: pointer; transition: border .15s; }
.cat-chip:hover, .cat-chip.on { border-color: var(--accent); }
.cat-chip.on { background: #fffafb; }
.cat-chip .row { justify-content: space-between; }
.cat-chip b { color: var(--ink); font-size: 13.5px; }
.cat-chip .n { font-weight: 700; color: var(--accent); font-size: 18px; }
.cat-chip .bar { height: 4px; background: var(--line-2); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.cat-chip .bar i { display: block; height: 100%; background: var(--accent); }
.cat-chip.unc .n { color: var(--amber); } .cat-chip.unc .bar i { background: var(--amber); }
.conf { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.conf.high { background: var(--green); } .conf.medium { background: var(--amber); } .conf.none { background: var(--red); }
table.t select.input { padding: 5px 8px; font-size: 12.5px; min-width: 150px; }
.sheet-tabs { display: flex; gap: 2px; overflow-x: auto; border-top: 1px solid var(--line); background: #f3f0ed; padding: 0 8px; }
.sheet-tabs button { border: 0; background: none; padding: 8px 14px; font-size: 12.5px; cursor: pointer; color: var(--muted); white-space: nowrap; border-top: 2px solid transparent; font-weight: 500; }
.sheet-tabs button.on { background: #fff; color: var(--ink); border-top-color: var(--accent); font-weight: 600; }
.grid-prev { overflow: auto; max-height: 56vh; }
.grid-prev table { border-collapse: collapse; font-size: 12.5px; min-width: 100%; }
.grid-prev th, .grid-prev td { border: 1px solid var(--line-2); padding: 6px 10px; white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.grid-prev thead th { background: var(--accent); color: #fff; position: sticky; top: 0; font-weight: 600; border-color: var(--accent-dark); }
.grid-prev td.rn { color: var(--faint); background: #f8f6f4; text-align: right; }
.ind-bars { display: grid; gap: 8px; padding: 16px 20px; }
.ind-bars .fr { display: grid; grid-template-columns: 140px 1fr 40px; gap: 10px; align-items: center; font-size: 12.5px; cursor: pointer; }
.ind-bars .fr:hover span:first-child { color: var(--accent); }
.ind-bars .bar { height: 8px; background: var(--line-2); border-radius: 5px; overflow: hidden; }
.ind-bars .bar i { display: block; height: 100%; background: var(--ink-2); border-radius: 5px; }
.ind-bars .num { text-align: right; font-weight: 700; color: var(--ink); }
@media (max-width: 860px) { .folder-grid { grid-template-columns: 1fr 1fr; } .ind-bars .fr { grid-template-columns: 100px 1fr 34px; } }

/* ---------- browser edition ---------- */
.send-banner { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 70; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; display: flex; gap: 10px; align-items: center; font-size: 13px; box-shadow: 0 8px 30px rgba(0,0,0,.25); max-width: 92vw; }
details.setup { background: #f7f5f2; border-radius: 10px; padding: 12px 14px; }
details.setup summary { cursor: pointer; }
details.setup code, .muted code { background: #fff; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); font-size: 12px; }
#authRestore { color: var(--accent); }
.reach { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--green-soft); color: #13704b; }
.reach.none { background: var(--amber-soft); color: #7d5608; }
.reach:empty { display: none; }
.rec-box { padding: 14px; background: #f7f5f2; border-radius: 10px; }
.search { position: relative; }
.search > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
