:root {
  --brand: #0f766e;
  --brand-ink: color-mix(in srgb, var(--brand) 82%, #000);
  --brand-soft: color-mix(in srgb, var(--brand) 10%, #fff);
  --brand-line: color-mix(in srgb, var(--brand) 25%, #fff);
  --ink: #111827; --ink-2: #374151; --muted: #6b7280; --line: #e5e7eb; --line-2: #f0f1f3;
  --bg: #f5f6f8; --card: #fff; --side: #0e1726; --side-2: #172235; --side-ink: #a9b4c6;
  --ok: #15803d; --warn: #b45309; --bad: #b91c1c; --info: #1d4ed8;
  --wa: #128c7e; --wa-bubble: #e7f7ee; --note: #fff8db;
  --r: 10px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { font-family: Inter, "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; color: var(--ink); background: var(--bg); }
a { color: var(--brand-ink); }
.text-muted { color: var(--muted) !important; }
.btn-brand { background: var(--brand); color: #fff; border: 0; font-weight: 500; }
.btn-brand:hover, .btn-brand:focus { background: var(--brand-ink); color: #fff; }
.btn-soft { background: #fff; border: 1px solid var(--line); color: var(--ink-2); font-weight: 500; }
.btn-soft:hover { background: var(--line-2); border-color: #d1d5db; }
.btn-icon { border: 0; background: transparent; font-size: 22px; padding: 2px 8px; }
.form-control, .form-select { border-color: #d6d9de; font-size: 14px; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-line); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-label { font-weight: 500; color: var(--ink-2); margin-bottom: 4px; font-size: 13px; }
.form-text { font-size: 12px; }

/* shell */
.shell { display: flex; min-height: 100vh; }
@media (min-width: 992px) { .shell { background: linear-gradient(to right, var(--side) 244px, var(--bg) 244px); } }
.sidebar { width: 244px; flex: 0 0 244px; background: var(--side); color: var(--side-ink); position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 14px 10px 24px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; text-decoration: none; color: #fff; }
.brand img { max-height: 34px; max-width: 120px; border-radius: 6px; background: #fff; padding: 2px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; color: #fff; font-size: 17px; flex: none; }
.brand-mark.lg { width: 52px; height: 52px; font-size: 26px; border-radius: 14px; }
.brand-name { font-weight: 600; line-height: 1.15; font-size: 15px; overflow: hidden; }
.brand-name small { display: block; font-weight: 400; color: var(--side-ink); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.nav-label { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #64748b; padding: 16px 12px 6px; font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 8px; color: var(--side-ink); text-decoration: none; font-weight: 500; margin-bottom: 1px; }
.nav-item i { font-size: 16px; width: 18px; text-align: center; }
.nav-item:hover { background: var(--side-2); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-badge { margin-left: auto; font-size: 11px; font-weight: 600; background: rgba(255,255,255,.1); color: #fff; padding: 1px 7px; border-radius: 99px; display: none; }
.nav-badge.show { display: inline-block; }
.nav-badge.hot { background: #ef4444; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 60px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 22px; position: sticky; top: 0; z-index: 20; }
.top-search { position: relative; flex: 0 1 420px; }
.top-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.top-search input { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 8px 12px 8px 34px; font-size: 13.5px; }
.top-search input:focus { outline: none; border-color: var(--brand); background: #fff; }
.avail { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 5px 12px; font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 7px; color: var(--muted); }
.avail .dot { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; }
.avail.on { color: var(--ok); border-color: #bbf7d0; background: #f0fdf4; }
.avail.on .dot { background: #22c55e; box-shadow: 0 0 0 3px #dcfce7; }
.user-chip { border: 0; background: transparent; display: flex; align-items: center; gap: 9px; font-weight: 500; text-align: left; line-height: 1.15; }
.user-chip small { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-weight: 600; flex: none; }
.content { padding: 22px 24px 40px; }
@media (max-width: 991px) {
  .sidebar { position: fixed; left: -260px; z-index: 50; transition: left .2s; }
  .sidebar.open { left: 0; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .content { padding: 16px; }
  .topbar { padding: 0 12px; }
}

/* page bits */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
.page-head .sub { color: var(--muted); font-size: 13px; }
.card-x { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.card-x + .card-x { margin-top: 16px; }
.card-x h2, .card-title-x { font-size: 14.5px; font-weight: 600; margin: 0 0 12px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; text-decoration: none; color: inherit; display: block; }
.kpi:hover { border-color: var(--brand-line); }
.kpi .lbl { color: var(--muted); font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 26px; font-weight: 650; margin-top: 4px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi.warn .val { color: var(--warn); } .kpi.bad .val { color: var(--bad); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state i { font-size: 40px; display: block; margin-bottom: 8px; color: #cbd5e1; }
.empty-state h2 { font-size: 18px; color: var(--ink); }

/* tables */
.table-x { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; }
.table-x th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
.table-x td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table-x tr:last-child td { border-bottom: 0; }
.table-x tbody tr:hover td { background: #fafbfc; }
.table-wrap { border: 1px solid var(--line); border-radius: var(--r); overflow: auto; background: #fff; }
.tno { font-weight: 600; color: var(--ink); text-decoration: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tno:hover { color: var(--brand-ink); }
.row-unread td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.row-unread .subj { font-weight: 600; }
.subj { color: var(--ink-2); max-width: 380px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.cust { line-height: 1.2; }
.cust small { color: var(--muted); display: block; font-size: 12px; }
.unread-pill { background: var(--brand); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 600; padding: 1px 7px; margin-left: 6px; }
.due-bad { color: var(--bad); font-weight: 600; } .due-soon { color: var(--warn); font-weight: 500; }

/* badges */
.badge-status, .badge-prio { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 99px; white-space: nowrap; border: 1px solid transparent; }
.badge-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.s-open { background: #eff6ff; color: #1d4ed8; } .s-in_progress { background: #fef9c3; color: #854d0e; }
.s-pending { background: #f3e8ff; color: #7e22ce; } .s-resolved { background: #dcfce7; color: #166534; }
.s-closed { background: #f1f5f9; color: #475569; } .s-invalid { background: #fee2e2; color: #991b1b; }
.p-low { color: #64748b; background: #f8fafc; border-color: #e2e8f0; } .p-medium { color: #1e40af; background: #fff; border-color: #dbeafe; }
.p-high { color: #c2410c; background: #fff7ed; border-color: #fed7aa; } .p-urgent { color: #fff; background: #dc2626; }
.src-whatsapp { color: var(--wa); } .src-ivr { color: #7c3aed; } .src-portal { color: #0369a1; } .src-sms { color: #b45309; } .src-email { color: #be185d; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters .form-select, .filters .form-control { width: auto; min-width: 130px; font-size: 13px; padding-top: 6px; padding-bottom: 6px; }
.tabs-x { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs-x a { padding: 9px 14px; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.tabs-x a.active { color: var(--brand-ink); border-color: var(--brand); }
.tabs-x a:hover { color: var(--ink); }
.bulkbar { display: none; align-items: center; gap: 8px; background: var(--brand-soft); border: 1px solid var(--brand-line); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; }
.bulkbar.show { display: flex; }

/* ticket view */
.tv { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
@media (max-width: 1199px) { .tv { grid-template-columns: 1fr; } }
.tv-head { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 18px; margin-bottom: 14px; }
.tv-head h1 { font-size: 17px; font-weight: 600; margin: 4px 0 0; }
.tv-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--muted); font-size: 12.5px; align-items: center; }
.thread-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; }
.thread { padding: 18px; min-height: 260px; max-height: calc(100vh - 360px); overflow-y: auto; background: #f7f8f6;
  background-image: radial-gradient(rgba(0,0,0,.025) 1px, transparent 1px); background-size: 14px 14px; border-radius: var(--r) var(--r) 0 0; }
.msg { display: flex; margin-bottom: 12px; }
.msg .bubble { max-width: min(560px, 82%); border-radius: 12px; padding: 9px 12px 6px; box-shadow: 0 1px 1px rgba(0,0,0,.06); position: relative; word-wrap: break-word; }
.msg .who { font-size: 11.5px; font-weight: 600; margin-bottom: 2px; color: var(--ink-2); display: flex; gap: 6px; align-items: center; }
.msg .txt { white-space: pre-wrap; line-height: 1.45; }
.msg .meta { font-size: 11px; color: var(--muted); text-align: right; margin-top: 3px; display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.msg.in .bubble { background: #fff; border-top-left-radius: 3px; }
.msg.out { justify-content: flex-end; }
.msg.out .bubble { background: var(--wa-bubble); border-top-right-radius: 3px; }
.msg.out.ch-sms .bubble { background: #fff4e5; } .msg.out.ch-email .bubble { background: #fdf2f8; }
.msg.out.by-bot .bubble, .msg.out.by-system .bubble { background: #eef2f7; }
.msg.note { justify-content: flex-end; }
.msg.note .bubble { background: var(--note); border: 1px dashed #e9c46a; border-top-right-radius: 3px; }
.msg.system { justify-content: center; }
.msg.system .bubble { background: rgba(255,255,255,.8); box-shadow: none; border: 1px solid var(--line); font-size: 12px; color: var(--muted); padding: 3px 12px; border-radius: 99px; }
.ticks { font-size: 14px; } .ticks.read { color: #0ea5e9; } .ticks.failed { color: var(--bad); }
.msg-error { font-size: 11.5px; color: var(--bad); margin-top: 3px; }
.att-grid { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.att-img { width: 150px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; background: #fff; }
.att-file { display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px; background: rgba(255,255,255,.75); border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink); font-size: 12.5px; max-width: 260px; }
.att-file i { font-size: 20px; color: var(--brand-ink); }
.att-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
audio.att-audio { height: 36px; max-width: 260px; }
.composer { border-top: 1px solid var(--line); padding: 12px 14px; }
.composer textarea { resize: vertical; min-height: 84px; border: 0; padding: 4px 2px; box-shadow: none !important; }
.ch-tabs { display: flex; gap: 4px; margin-bottom: 8px; flex-wrap: wrap; }
.ch-tabs button { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 4px 12px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
.ch-tabs button.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.ch-tabs button[data-ch=note].active { border-color: #e9c46a; background: var(--note); color: #854d0e; }
.ch-tabs button:disabled { opacity: .45; }
.composer-box { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; background: #fff; }
.composer-box.note { background: var(--note); border-color: #ecd99a; }
.composer-tools { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.file-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.file-chips span { background: var(--line-2); border-radius: 6px; padding: 2px 8px; font-size: 12px; }
.window-note { font-size: 12px; padding: 6px 10px; border-radius: 6px; margin-bottom: 8px; display: flex; gap: 8px; align-items: flex-start; }
.window-note.open { background: #ecfdf5; color: #065f46; } .window-note.closed { background: #fff7ed; color: #9a3412; }
.side-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-bottom: 14px; }
.side-card h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin: 0 0 10px; }
.kv { display: grid; grid-template-columns: 105px 1fr; gap: 7px 10px; font-size: 13px; }
.kv dt { color: var(--muted); font-weight: 400; } .kv dd { margin: 0; word-break: break-word; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: 12.5px; max-height: 320px; overflow: auto; }
.timeline li { padding: 0 0 10px 16px; position: relative; color: var(--ink-2); }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--brand-line); }
.timeline li small { color: var(--muted); display: block; }
.sla-bar { height: 6px; border-radius: 99px; background: var(--line-2); overflow: hidden; margin-top: 4px; }
.sla-bar > span { display: block; height: 100%; background: var(--ok); }
.sla-bar.warn > span { background: #f59e0b; } .sla-bar.bad > span { background: #ef4444; }

/* auth */
.auth-body { background: var(--side); min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { color: #dbe3ee; padding: 64px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(1200px 600px at -10% -20%, color-mix(in srgb, var(--brand) 55%, transparent), transparent 60%), var(--side); }
.auth-side h1 { color: #fff; font-size: 30px; font-weight: 650; margin: 22px 0 10px; letter-spacing: -.02em; }
.auth-side p { color: var(--side-ink); font-size: 15px; max-width: 420px; }
.auth-logo { max-height: 60px; background: #fff; border-radius: 10px; padding: 6px; }
.auth-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; color: var(--side-ink); }
.auth-points i { color: #fff; margin-right: 10px; }
.auth-card { background: #fff; display: flex; flex-direction: column; justify-content: center; padding: 64px clamp(24px, 6vw, 96px); }
.auth-card h2 { font-weight: 650; font-size: 24px; }
@media (max-width: 860px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { padding: 32px 24px; } .auth-points { display: none; } .auth-card { padding: 32px 24px; } }

/* misc */
.toast-zone { position: fixed; right: 18px; bottom: 18px; z-index: 1100; display: grid; gap: 8px; }
.toast-x { background: #111827; color: #fff; padding: 10px 14px; border-radius: 8px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.18); max-width: 380px; }
.toast-x.err { background: #991b1b; } .toast-x.warn { background: #92400e; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--line-2); color: var(--ink-2); border-radius: 6px; padding: 1px 7px; font-size: 12px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--line-2); padding: 2px 6px; border-radius: 5px; word-break: break-all; }
.settings-nav a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.settings-nav a.active { background: var(--brand-soft); color: var(--brand-ink); }
.tpl-event { scroll-margin-top: 80px; }
.tpl-row { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 10px; background: #fff; }
.tpl-row.off { background: #fafafa; } .tpl-row.off textarea { color: var(--muted); }
.ph { font-size: 11.5px; color: var(--muted); }
.ph code { color: var(--brand-ink); background: var(--brand-soft); padding: 0 4px; border-radius: 3px; }
.bar-mini { height: 8px; background: var(--brand-line); border-radius: 99px; overflow: hidden; }
.bar-mini span { display: block; height: 100%; background: var(--brand); }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: none; place-items: center; z-index: 2000; cursor: zoom-out; }
.lightbox.show { display: grid; } .lightbox img { max-width: 92vw; max-height: 90vh; border-radius: 6px; }

/* ---------------- v4 additions ---------------- */
.skip-link { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; z-index: 3000; border-radius: 6px; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.s-on_hold { background: #f1f5f9; color: #334155; }
.src-telegram { color: #229ed9; } .src-messenger { color: #0866ff; } .src-instagram { color: #d62976; } .src-chat { color: #0f766e; }
.src-app { color: #4338ca; } .src-qr { color: #111827; } .src-missed_call { color: #b91c1c; }

/* bell */
.btn-bell { position: relative; border: 1px solid var(--line); background: #fff; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); }
.btn-bell b { position: absolute; top: -4px; right: -4px; background: #ef4444; color: #fff; font-size: 10px; min-width: 18px; height: 18px; border-radius: 99px; display: none; place-items: center; padding: 0 4px; }
.btn-bell b.show { display: grid; }
.bell-menu { width: 360px; max-width: 92vw; padding: 0; }
.bell-head { display: flex; padding: 10px 14px; border-bottom: 1px solid var(--line); align-items: center; }
.bell-list { max-height: 420px; overflow-y: auto; }
.bell-item { display: flex; gap: 10px; padding: 10px 14px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line-2); }
.bell-item:hover { background: var(--bg); }
.bell-item.unread { background: var(--brand-soft); }
.bell-item i { font-size: 17px; margin-top: 2px; color: var(--brand-ink); } .bell-item i.t-urgent, .bell-item i.t-sla { color: var(--bad); }
.bell-item span { display: flex; flex-direction: column; font-size: 13px; line-height: 1.3; min-width: 0; }
.bell-item small { color: var(--ink-2); } .bell-item em { color: var(--muted); font-style: normal; font-size: 11.5px; margin-top: 2px; }

/* tags & chips */
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 500; padding: 1px 8px; border-radius: 99px; background: color-mix(in srgb, var(--c, #64748b) 12%, #fff); color: var(--c, #475569); border: 1px solid color-mix(in srgb, var(--c, #64748b) 30%, #fff); white-space: nowrap; }
.tag-input { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; border: 1px solid #d6d9de; border-radius: 8px; padding: 4px 6px; min-height: 36px; background: #fff; }
.tag-input input { border: 0; outline: 0; flex: 1; min-width: 90px; font-size: 13px; }
.tag-input .tag button { border: 0; background: none; padding: 0; line-height: 1; color: inherit; }
.loc-line { font-size: 12.5px; color: var(--ink-2); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.loc-line .hw { font-weight: 600; background: #fef3c7; color: #92400e; padding: 0 6px; border-radius: 4px; font-size: 11.5px; }

/* kanban */
.board { display: grid; grid-template-columns: repeat(5, minmax(240px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.board-col { background: #eef0f3; border-radius: 10px; padding: 10px; min-height: 60vh; display: flex; flex-direction: column; }
.board-col h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); display: flex; justify-content: space-between; margin: 2px 4px 10px; }
.board-col.drop { outline: 2px dashed var(--brand); background: var(--brand-soft); }
.card-t { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; margin-bottom: 8px; cursor: grab; font-size: 13px; box-shadow: 0 1px 1px rgba(0,0,0,.03); }
.card-t:hover { border-color: var(--brand-line); }
.card-t.dragging { opacity: .5; }
.card-t .top { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.card-t .no { font-weight: 600; font-size: 12px; color: var(--ink); text-decoration: none; }
.card-t .s { color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; }
.card-t .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 11.5px; color: var(--muted); gap: 6px; }
.card-t.p-urgent-b { border-left: 3px solid #dc2626; } .card-t.p-high-b { border-left: 3px solid #f97316; }

/* map */
.map-box { height: calc(100vh - 230px); min-height: 420px; border-radius: var(--r); border: 1px solid var(--line); }
.map-mini { height: 220px; border-radius: 8px; border: 1px solid var(--line); }
.map-pick { height: 300px; border-radius: 8px; border: 1px solid var(--line); }
.leaflet-container { font: inherit; }
.mk { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }

/* ticket view v4 */
.presence { font-size: 12px; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px; padding: 4px 10px; margin: 0 14px 0; display: none; }
.presence.show { display: block; }
.fields-grid { display: grid; grid-template-columns: 1fr; gap: 6px; }
.approval-box { border: 1px solid #fde68a; background: #fffbeb; border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; font-size: 13px; }
.msg .split-btn { position: absolute; top: 4px; right: 6px; opacity: 0; border: 0; background: rgba(255,255,255,.9); border-radius: 4px; font-size: 11px; padding: 1px 6px; color: var(--muted); }
.msg .bubble:hover .split-btn { opacity: 1; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.rule-row { display: grid; grid-template-columns: 1fr 1fr 1.4fr auto; gap: 8px; margin-bottom: 8px; }
@media (max-width: 767px) { .rule-row { grid-template-columns: 1fr; } }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 16px; }
.tree-indent { display: inline-block; width: calc(var(--d, 0) * 18px); }
.embed-code { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 8px; white-space: pre-wrap; word-break: break-all; }
.kb-body h3, .kb-body h4, .kb-body h5 { font-size: 16px; font-weight: 600; margin-top: 14px; }
.kb-body ul { padding-left: 20px; }
.more-filters { position: relative; }
.more-filters > summary { list-style: none; cursor: pointer; }
.more-filters > summary::-webkit-details-marker { display: none; }
.more-box { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-wrap: wrap; gap: 8px; width: min(560px, 90vw); box-shadow: 0 12px 32px rgba(15,23,42,.12); }

/* ---- v4 admin extras ---- */
.rule-row{display:grid;grid-template-columns:1fr 1fr 2fr auto;gap:.5rem;align-items:start;margin-bottom:.5rem}
@media (max-width:640px){.rule-row{grid-template-columns:1fr!important}}
.settings-nav a{display:flex;align-items:center}
.settings-nav .dot{width:8px;height:8px;border-radius:50%;background:#cbd5e1}
.settings-nav .dot.on{background:#16a34a}
.copy-line{display:flex;gap:.5rem;align-items:center;flex-wrap:wrap;margin:.35rem 0}
.copy-line .code{word-break:break-all}
.daychart{display:flex;align-items:flex-end;gap:2px;height:160px;border-bottom:1px solid var(--line)}
.daychart .dc{flex:1;max-width:36px;display:flex;align-items:flex-end;gap:1px;height:100%;min-width:3px}
.daychart .dc span{flex:1;border-radius:2px 2px 0 0;min-height:1px}
.daychart .c,.lg.c{background:var(--brand)}
.daychart .r,.lg.r{background:#94a3b8}
.lg{display:inline-block;width:10px;height:10px;border-radius:2px;vertical-align:middle}
tr.row-link{cursor:pointer}
