:root {
  --bg: #f4f5f2;
  --panel: #ffffff;
  --panel-2: #f9faf8;
  --line: #e3e6e0;
  --ink: #1d2420;
  --ink-2: #56605a;
  --ink-3: #8a938d;
  --brand: #0b5d4b;
  --brand-ink: #ffffff;
  --brand-soft: #e3f1ec;
  --out: #dcf3e8;
  --in: #ffffff;
  --warn: #9a5b00;
  --warn-soft: #fff3dc;
  --bad: #b3261e;
  --bad-soft: #fde8e6;
  --ok: #1f7a43;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s6: #008300; --s7: #6250d6; --crit: #d03b3b;
  --tint-blue: #e3eefb; --tint-yellow: #fdf2d6; --tint-green: #dff3e8; --tint-red: #fbe3e3; --tint-violet: #ebe8fb; --tint-aqua: #dcf4ee;
  --grid: #e8eae6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Sinhala", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111513; --panel: #1a1f1c; --panel-2: #151a17; --line: #2b322e;
    --ink: #e8ece9; --ink-2: #aab3ad; --ink-3: #78827c;
    --brand: #3fb995; --brand-ink: #06221a; --brand-soft: #173a30;
    --out: #1d3d31; --in: #222825;
    --warn: #f0b45a; --warn-soft: #3a2c12; --bad: #ff8a80; --bad-soft: #3d1f1c; --ok: #6fd39b;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s6: #2e9a2e; --s7: #9085e9; --crit: #e66767;
    --tint-blue: #1b2c42; --tint-yellow: #3a3016; --tint-green: #183527; --tint-red: #3d2020; --tint-violet: #2a2745; --tint-aqua: #163630;
    --grid: #2a302c;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.45 var(--font); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
.boot { display: grid; place-items: center; height: 100%; color: var(--ink-3); }
.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; }
.wrap { flex-wrap: wrap; }
.mono { font-variant-numeric: tabular-nums; }

/* Buttons & inputs */
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 12px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 8px 10px; }
.input:focus, .btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
label.field { display: grid; gap: 4px; font-size: 12px; color: var(--ink-2); }
label.check { display: flex; gap: 8px; align-items: center; }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 600; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-2); }
.chip.new { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.chip.open { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.chip.follow_up { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.waiting_customer { }
.chip.resolved, .chip.closed { color: var(--ink-3); }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge { min-width: 20px; height: 20px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; padding: 0 6px; }

/* Login */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login form { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.logo-lg { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); display: inline-block; }
.login h1 { margin: 0; font-size: 20px; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; }

/* Shell: left sidebar + content */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); height: 100%; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; padding: 16px 12px; min-height: 0; overflow-y: auto; }
.brand { font-weight: 700; display: flex; align-items: center; gap: 10px; padding: 0 6px; white-space: nowrap; font-size: 15px; }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); display: inline-grid; place-items: center; }
.me-card { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.me-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; vertical-align: middle; margin-right: 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-weight: 500; white-space: nowrap; }
.nav a:hover { background: var(--panel-2); color: var(--ink); }
.nav a.active { background: var(--brand); color: var(--brand-ink); }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 0 6px; }
.side-foot .btn { margin-left: auto; }
.live { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); display: inline-block; flex: none; }
.live.on { background: var(--ok); }
main { min-height: 0; overflow: auto; height: 100%; }
.ico { flex: none; }

/* Inbox */
.inbox { display: grid; grid-template-columns: 340px 1fr; height: 100%; min-height: 0; }
.list { border-right: 1px solid var(--line); background: var(--panel); display: grid; grid-template-rows: auto 1fr; min-height: 0; }
.list-head { padding: 10px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: transparent; padding: 4px 9px; border-radius: 6px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.tabs button.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.items { overflow-y: auto; min-height: 0; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.item:hover { background: var(--panel-2); }
.item.active { background: var(--brand-soft); }
.item .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .time { font-size: 11px; color: var(--ink-3); }
.item .preview { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.item .meta { display: flex; gap: 4px; align-items: center; justify-content: flex-end; }
.item.unread .name, .item.unread .preview { color: var(--ink); font-weight: 700; }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-3); }

.thread { display: grid; grid-template-columns: 1fr 300px; min-height: 0; height: 100%; }
.chat { display: grid; grid-template-rows: auto 1fr auto; min-height: 0; min-width: 0; }
.chat-head { padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.chat-head select.input { width: auto; max-width: 200px; }
.chat-head .title { font-weight: 700; font-size: 15px; }
.messages { overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.bubble { max-width: min(560px, 82%); padding: 7px 10px 5px; border-radius: 10px; box-shadow: 0 1px 0 rgba(0,0,0,.04); overflow-wrap: anywhere; }
.bubble .text { white-space: pre-wrap; }
.bubble.in { align-self: flex-start; background: var(--in); border: 1px solid var(--line); border-top-left-radius: 3px; }
.bubble.out { align-self: flex-end; background: var(--out); border-top-right-radius: 3px; }
.bubble .foot { display: flex; gap: 6px; justify-content: flex-end; font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.bubble .foot .failed { color: var(--bad); font-weight: 600; }
.bubble .errline { font-size: 12px; color: var(--bad); margin-top: 4px; }
.daysep { align-self: center; font-size: 11px; color: var(--ink-3); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; margin: 8px 0; }
.composer { border-top: 1px solid var(--line); background: var(--panel); padding: 10px; display: grid; gap: 8px; }
.composer textarea { resize: none; min-height: 42px; max-height: 160px; }
.window-note { font-size: 12px; background: var(--warn-soft); color: var(--warn); padding: 6px 10px; border-radius: 8px; }

.side { border-left: 1px solid var(--line); background: var(--panel); overflow-y: auto; padding: 14px; display: grid; gap: 18px; align-content: start; }
.side h3 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 13px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.note { background: var(--warn-soft); border-radius: 8px; padding: 8px 10px; font-size: 13px; white-space: pre-wrap; }
.note .by { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.history { font-size: 12px; color: var(--ink-2); display: grid; gap: 6px; }

/* Pages */
.page { padding: 20px; max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.page h2 { margin: 0; font-size: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card h3 { margin: 0 0 12px; font-size: 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.tile .label { font-size: 12px; color: var(--ink-3); }
.tile .value { font-size: 26px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile.alert .value { color: var(--bad); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--ink-3); font-weight: 600; font-size: 12px; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.inactive td { color: var(--ink-3); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; padding: 16px; z-index: 20; }
.modal { background: var(--panel); border-radius: 14px; padding: 20px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; display: grid; gap: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h3 { margin: 0; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 30; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; }
.toast.bad { background: var(--bad); color: #fff; }

.back { display: none; }
#details-btn, #close-side { display: none; }

/* Responsive */
@media (max-width: 1100px) {
  .thread { grid-template-columns: 1fr; }
  .side { display: none; }
  #details-btn, #close-side { display: inline-flex; }
  .side.open { display: grid; position: fixed; right: 0; top: 0; bottom: 0; width: min(340px, 100%); z-index: 15; box-shadow: -10px 0 40px rgba(0,0,0,.2); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .sidebar { flex-direction: row; align-items: center; gap: 8px; padding: 8px 10px; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .me-card, #live-text { display: none; }
  .nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
  .nav a { flex-direction: column; gap: 2px; padding: 6px 8px; font-size: 11px; }
  .side-foot { margin: 0; padding: 0; }
  .inbox { grid-template-columns: 1fr; }
  .inbox.has-conv .list { display: none; }
  .inbox:not(.has-conv) .thread-wrap { display: none; }
  .back { display: inline-flex; }
  .brand span { display: none; }
  .page { padding: 16px; }
  .who .name { display: none; }
}

.import-note { white-space: normal; display: grid; gap: 6px; }
.import-note p, .import-note ul { margin: 0; }
#lowner { width: auto; }

/* Dashboard */
.dash { max-width: 1320px; }
.page-head { display: flex; gap: 10px; align-items: center; }
.page-head h2 { font-size: 22px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--s1); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { border-color: var(--s1); }
.input.range { width: auto; min-width: 150px; }
#dash-body { display: grid; gap: 18px; }
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1560px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi { padding: 14px; gap: 10px; } .kpi-ico { width: 38px; height: 38px; } .kpi-val { font-size: 24px; } }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; gap: 14px; align-items: center; box-shadow: var(--shadow); min-width: 0; }
.kpi-ico { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.tone-blue { background: var(--tint-blue); color: var(--s1); }
.tone-yellow { background: var(--tint-yellow); color: var(--s4); }
.tone-green { background: var(--tint-green); color: var(--s6); }
.tone-red { background: var(--tint-red); color: var(--crit); }
.tone-violet { background: var(--tint-violet); color: var(--s7); }
.tone-aqua { background: var(--tint-aqua); color: var(--s3); }
.kpi-txt { min-width: 0; }
.kpi-val { font-size: 30px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-of { font-size: 18px; color: var(--ink-3); font-weight: 600; }
.kpi-extra { font-size: 14px; color: var(--ink-2); font-weight: 500; margin-left: 6px; }
.kpi-label { color: var(--ink-2); margin-top: 2px; }
.alert-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.alert-strip a { background: var(--bad-soft); color: var(--bad); text-decoration: none; padding: 7px 12px; border-radius: 999px; font-size: 13px; }
.charts-3 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.charts-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
#dash-body > *, .card { min-width: 0; }
@media (max-width: 1100px) { .charts-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .charts-3 > :first-child { grid-column: 1 / -1; } }
@media (max-width: 760px) { .charts-3, .charts-2 { grid-template-columns: minmax(0, 1fr); } .charts-3 > :first-child { grid-column: auto; } }
.card h3 { margin: 0 0 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 15px; }
.card-sub { margin: -2px 0 8px; font-size: 12px; color: var(--ink-3); }
.chart { width: 100%; max-width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .tick, .donut .tick { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.chart .line { fill: none; stroke-width: 2.5; }
.chart .line.s1 { stroke: var(--s1); }
.chart .area.s1 { fill: var(--s1); opacity: .1; }
.chart .dot { fill: var(--panel); stroke: var(--s1); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:hover { fill: var(--ink); opacity: .04; }
.bar.s1 { fill: var(--s1); }
.bar.crit { fill: var(--crit); }
.chart-empty { color: var(--ink-3); text-align: center; padding: 60px 10px; }
.donut-wrap { display: grid; gap: 14px; justify-items: center; }
.donut { width: 100%; max-width: 190px; height: auto; }
.donut .seg { stroke: var(--panel); stroke-width: 2; cursor: pointer; }
.donut .seg:hover { opacity: .85; }
.donut-num { fill: var(--ink); font-size: 24px; font-weight: 700; font-family: var(--font); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 18px; font-size: 13px; color: var(--ink-2); width: 100%; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend b { margin-left: auto; color: var(--ink); font-variant-numeric: tabular-nums; }
.sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.s1 { fill: var(--s1); } .sw.s1 { background: var(--s1); }
.s2 { fill: var(--s2); } .sw.s2 { background: var(--s2); }
.s3 { fill: var(--s3); } .sw.s3 { background: var(--s3); }
.s4 { fill: var(--s4); } .sw.s4 { background: var(--s4); }
.s6 { fill: var(--s6); } .sw.s6 { background: var(--s6); }
.s7 { fill: var(--s7); } .sw.s7 { background: var(--s7); }
.muted-fill { fill: var(--ink-3); } .sw.muted-fill { background: var(--ink-3); }
.chart .dot.s1 { fill: var(--panel); }
.peak { text-align: center; display: grid; margin: 4px 0 6px; }
.peak-time { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.peak-time.blue { color: var(--s1); } .peak-time.red { color: var(--crit); }
.peak span:last-child { font-weight: 600; }
.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); color: var(--ink-3); border: 1px solid var(--line); }
.pill.ok { color: var(--ok); background: var(--tint-green); border-color: transparent; }
.pill.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.bad-txt { color: var(--bad); font-weight: 600; }
.meter { display: block; width: 120px; max-width: 100%; height: 8px; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--s1); border-radius: 4px; }
.staff-tbl td { vertical-align: middle; }
.viz-tip { position: fixed; left: 0; top: 0; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12px; padding: 6px 9px; border-radius: 8px; opacity: 0; transition: opacity .1s; z-index: 40; max-width: 220px; }
.viz-tip.show { opacity: 1; }
.auto-tag { color: var(--s7); font-weight: 600; }
.settings-auto textarea { min-height: 80px; }
@media (prefers-reduced-motion: reduce) { .viz-tip, .toast { transition: none; } }
#auto-form { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
#auto-form > div:last-child { grid-column: 1 / -1; }
#auto-form input[type=time] { width: auto; }
#auto-form .field { gap: 8px; }

/* Call list */
.kpis.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .kpis.kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.calls .tabs button { display: inline-flex; gap: 6px; align-items: center; padding: 7px 12px; }
.tab-n:not(:empty) { background: var(--crit); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; font-weight: 700; }
#cl-q { width: 260px; max-width: 100%; }
.lead-list { display: grid; gap: 10px; }
.lead { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; gap: 16px; align-items: center; box-shadow: var(--shadow); }
.lead-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.lead-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lead-name { font-size: 15px; }
.lead-phone { display: flex; align-items: center; gap: 6px; }
.big-phone { font-size: 20px; font-weight: 700; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.lead-msg { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-note { color: var(--warn); }
.lead-side { display: grid; gap: 6px; justify-items: end; text-align: right; flex: none; }
@media (max-width: 640px) { .lead { flex-direction: column; align-items: stretch; } .lead-side { justify-items: stretch; text-align: left; } .lead-msg { white-space: normal; } }
.st { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line); }
.st-new { background: var(--tint-blue); color: var(--s1); border-color: transparent; }
.st-good { background: var(--tint-aqua); color: var(--s3); border-color: transparent; }
.st-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.st-win { background: var(--tint-green); color: var(--s6); border-color: transparent; }
.st-off { color: var(--ink-3); }
.call-number { display: grid; gap: 2px; padding: 10px 12px; background: var(--panel-2); border-radius: 10px; border: 1px solid var(--line); }
.outcomes { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.outcomes legend { margin-bottom: 6px; }
.outcome { cursor: pointer; }
.outcome input { position: absolute; opacity: 0; pointer-events: none; }
.outcome .st { font-size: 13px; padding: 7px 12px; border: 2px solid transparent; }
.outcome input:checked + .st { border-color: var(--ink); }
.outcome input:focus-visible + .st { outline: 2px solid var(--brand); outline-offset: 2px; }
/* Leads per staff */
.hbars { display: grid; gap: 8px; max-height: 300px; overflow-y: auto; }
.hbar { display: grid; grid-template-columns: minmax(0, 120px) 1fr 32px; gap: 8px; align-items: center; font-size: 13px; }
.hbar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.hbar-track { height: 10px; background: var(--panel-2); border-radius: 5px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--s1); border-radius: 5px; }
.hbar b { text-align: right; }
a.btn { text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.calls .tabs { min-width: 0; }
@media (max-width: 640px) { .calls .tabs { flex: 1 1 100%; } #cl-q { width: 100%; } }

.num-big { font-size: 22px; }
.num-mid { font-size: 20px; }
.steps { padding-left: 18px; display: grid; gap: 6px; color: var(--ink-2); margin: 10px 0 0; }
#num-form { display: grid; gap: 14px; }

/* Requirements pass: stages, returning, agent requests, media, availability */
.chip.st-new { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.st-open { background: var(--tint-blue); color: var(--s1); border-color: transparent; }
.chip.st-resolved, .chip.st-closed { color: var(--ink-3); }
.chip.returning { background: var(--tint-violet); color: var(--s7); border-color: transparent; }
.chip.asked { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.tags-row { grid-column: 1 / -1; display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.ask-banner, .returning-banner { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 14px; font-size: 13px; border-bottom: 1px solid var(--line); }
.ask-banner { background: var(--bad-soft); color: var(--ink); }
.ask-banner span:first-child { flex: 1; min-width: 200px; }
.returning-banner { background: var(--tint-violet); color: var(--s7); }
.chat { display: flex; flex-direction: column; }
.chat > .messages { flex: 1; }
.convsep { align-self: stretch; text-align: center; font-size: 11px; font-weight: 600; color: var(--s7); border-top: 1px dashed var(--s7); padding-top: 4px; margin: 12px 0 4px; }
.media-img { display: block; max-width: 260px; max-height: 320px; border-radius: 8px; margin-bottom: 4px; }
.media-audio { width: 240px; max-width: 100%; }
.media-video { max-width: 280px; border-radius: 8px; }
.media-doc { display: inline-block; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 4px; text-decoration: none; }
.media-missing { color: var(--ink-3); font-style: italic; }
.avail { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; font-size: 13px; color: var(--ink-2); }
.avail input { position: absolute; opacity: 0; pointer-events: none; }
.avail-dot { width: 30px; height: 18px; border-radius: 9px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.avail-dot::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--panel); transition: transform .15s; }
.avail.on { color: var(--ok); border-color: var(--ok); }
.avail.on .avail-dot { background: var(--ok); }
.avail.on .avail-dot::after { transform: translateX(12px); }
.avail input:focus-visible + .avail-dot { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (max-width: 760px) { .avail span:last-child { display: none; } .avail { padding: 6px; } }

/* Staff reports */
.page-head.wrap, .row.wrap { flex-wrap: wrap; }
.rep .input[type=date] { width: auto; }
.rep .input.search { width: 240px; max-width: 100%; }
.rep-tbl th.sortable { cursor: pointer; user-select: none; }
.rep-tbl th.sortable:hover, .rep-tbl th.on { color: var(--ink); }
.rep-tbl tr.total td { border-top: 2px solid var(--line); background: var(--panel-2); }
.rep-tbl td a { font-weight: 600; }
.defs summary { cursor: pointer; font-weight: 600; }
.defs dl { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 6px 16px; margin: 12px 0 0; font-size: 13px; }
.defs dt { font-weight: 600; } .defs dd { margin: 0; color: var(--ink-2); }
.rep [hidden] { display: none !important; }
