/* Laporan Langsung — HD Console
   Dark is the default; [data-theme="light"] overrides. Every color is a token. */
:root {
  color-scheme: dark;
  --bg: #080b12;
  --bg-glow-1: rgba(99, 102, 241, 0.16);
  --bg-glow-2: rgba(20, 184, 166, 0.08);
  --panel: #0f1420;
  --panel-2: #141a28;
  --panel-3: #1a2233;
  --glass: rgba(15, 20, 32, 0.78);
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --ink: #eef1f8;
  --ink-2: #a9b2c6;
  --muted: #6f7890;
  --accent: #7c83ff;
  --accent-2: #a78bfa;
  --accent-ink: #ffffff;
  --accent-soft: rgba(124, 131, 255, 0.14);
  --brand: #ff3b4e;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.7);
  --shadow-sm: 0 6px 20px -10px rgba(0, 0, 0, 0.6);
  --hi: inset 0 1px 0 rgba(255, 255, 255, 0.04);

  /* status (always paired with a label) */
  --st-open: #f5b041;      --st-open-bg: rgba(245, 176, 65, 0.13);
  --st-prog: #38bdf8;      --st-prog-bg: rgba(56, 189, 248, 0.13);
  --st-wait: #c084fc;      --st-wait-bg: rgba(192, 132, 252, 0.13);
  --st-done: #34d399;      --st-done-bg: rgba(52, 211, 153, 0.12);
  --st-crit: #f87171;      --st-crit-bg: rgba(248, 113, 113, 0.13);
  --ffg: #f472b6;          --ffg-bg: rgba(244, 114, 182, 0.14);

  /* chart (validated: dataviz validate_palette.js, dark surface #121826) */
  --ch-1: #3987e5;
  --ch-2: #d95926;
  --ch-grid: #1f2738;
  --ch-axis: #2c3548;
  --ch-surface: #121826;

  --bubble-in: #172033;
  --bubble-bot: #121a2a;
  --bubble-hd: linear-gradient(135deg, #5b63f0, #7c5cf5);

  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
}
[data-theme='light'] {
  color-scheme: light;
  --bg: #f3f5fa;
  --bg-glow-1: rgba(99, 102, 241, 0.10);
  --bg-glow-2: rgba(20, 184, 166, 0.07);
  --panel: #ffffff;
  --panel-2: #f7f8fc;
  --panel-3: #eef1f7;
  --glass: rgba(255, 255, 255, 0.82);
  --line: rgba(15, 23, 42, 0.08);
  --line-2: rgba(15, 23, 42, 0.14);
  --ink: #0e1526;
  --ink-2: #4a5568;
  --muted: #6b7489;
  --accent: #4f55e6;
  --accent-2: #7c3aed;
  --accent-soft: rgba(79, 85, 230, 0.10);
  --shadow: 0 24px 50px -24px rgba(15, 23, 42, 0.25);
  --shadow-sm: 0 6px 18px -10px rgba(15, 23, 42, 0.22);
  --hi: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  --st-open: #b7791f;      --st-open-bg: rgba(245, 158, 11, 0.13);
  --st-prog: #0284c7;      --st-prog-bg: rgba(14, 165, 233, 0.11);
  --st-wait: #9333ea;      --st-wait-bg: rgba(168, 85, 247, 0.11);
  --st-done: #059669;      --st-done-bg: rgba(16, 185, 129, 0.11);
  --st-crit: #dc2626;      --st-crit-bg: rgba(239, 68, 68, 0.10);
  --ffg: #be185d;          --ffg-bg: rgba(219, 39, 119, 0.10);
  --ch-1: #2a78d6;
  --ch-2: #eb6834;
  --ch-grid: #eceef3;
  --ch-axis: #d5d9e2;
  --ch-surface: #ffffff;
  --bubble-in: #ffffff;
  --bubble-bot: #eef1f8;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* beats component display rules (nav buttons, badges) */
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.5 var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 500px at -10% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(700px 400px at 110% 0%, var(--bg-glow-2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
.mono { font-family: var(--mono); font-feature-settings: 'zero' 1; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; }
svg.i.lg { width: 22px; height: 22px; }

/* ---------------- shell ---------------- */
.app { display: grid; grid-template-columns: 76px 1fr; height: 100vh; }
.rail {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 0 16px;
  border-right: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(14px); z-index: 5;
}
.logo {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 18px;
  background: conic-gradient(from 210deg, var(--brand), #ff7a45, var(--accent), var(--brand));
  box-shadow: 0 10px 30px -8px rgba(255, 59, 78, 0.55); color: #fff; font-weight: 800; letter-spacing: -0.04em; font-size: 15px;
}
.nav-btn {
  position: relative; width: 48px; height: 48px; border: 0; border-radius: 14px; background: transparent; color: var(--muted);
  display: grid; place-items: center; transition: background .18s, color .18s;
}
.nav-btn:hover { background: var(--panel-3); color: var(--ink); }
.nav-btn.active { background: var(--accent-soft); color: var(--accent); }
.nav-btn.active::before { content: ''; position: absolute; left: -14px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-btn .badge { position: absolute; top: 5px; right: 4px; }
.nav-btn .tip {
  position: absolute; left: 60px; white-space: nowrap; background: var(--panel-3); color: var(--ink); border: 1px solid var(--line-2);
  font-size: 12px; font-weight: 600; padding: 5px 9px; border-radius: 8px; opacity: 0; pointer-events: none; transform: translateX(-4px); transition: .15s;
}
.nav-btn:hover .tip { opacity: 1; transform: none; }
.rail .spacer { flex: 1; }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 700;
  display: inline-grid; place-items: center; box-shadow: 0 0 0 2px var(--panel);
}

.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 26px; border-bottom: 1px solid var(--line);
  background: var(--glass); backdrop-filter: blur(14px); z-index: 4;
}
.topbar h1 { margin: 0; font-size: 18px; font-weight: 750; letter-spacing: -0.02em; white-space: nowrap; }
.topbar .sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.search {
  flex: 1; max-width: 460px; margin-left: 12px; display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 38px;
  border-radius: 11px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); transition: border-color .15s;
}
.search:focus-within { border-color: var(--accent); }
.search { min-width: 0; }
.search input { flex: 1; width: 100%; border: 0; background: transparent; outline: none; color: var(--ink); min-width: 0; }
.kbd { font: 11px var(--mono); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--muted); }
.chips { display: flex; gap: 6px; margin-left: auto; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink-2); white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--st-done); box-shadow: 0 0 0 3px var(--st-done-bg); animation: pulse 2.4s infinite; }
.dot.warn { background: var(--st-open); box-shadow: 0 0 0 3px var(--st-open-bg); }
.dot.bad { background: var(--st-crit); box-shadow: 0 0 0 3px var(--st-crit-bg); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px transparent; } }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink-2);
  display: grid; place-items: center; transition: .15s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); background: var(--panel-3); }
.avatar {
  width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; flex: none;
  background: linear-gradient(135deg, var(--c1, #6366f1), var(--c2, #a855f7));
}
.avatar.sm { width: 30px; height: 30px; border-radius: 10px; font-size: 11.5px; }
.avatar.lg { width: 48px; height: 48px; border-radius: 15px; font-size: 16px; }

.view { flex: 1; overflow: auto; padding: 24px 26px 40px; scroll-behavior: smooth; }
.view.full { padding: 0; overflow: hidden; display: flex; }

/* ---------------- buttons & inputs ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--ink); font-weight: 650; font-size: 13px; white-space: nowrap; transition: .15s;
}
.btn:hover { background: var(--panel-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { border-color: transparent; color: var(--accent-ink); background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 8px 22px -10px var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.success { border-color: transparent; color: #04130d; background: var(--st-done); }
.btn.danger { color: var(--st-crit); border-color: color-mix(in srgb, var(--st-crit) 40%, transparent); background: var(--st-crit-bg); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--panel-3); color: var(--ink); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 12px; font-weight: 650; color: var(--ink-2); }
.input, textarea.input, select.input {
  width: 100%; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--ink); padding: 9px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 80px; line-height: 1.5; }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--panel-2); border: 1px solid var(--line); gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--ink-2); height: 30px; padding: 0 12px; border-radius: 8px; font-size: 12.5px; font-weight: 650; display: inline-flex; align-items: center; gap: 7px; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.seg .n { font: 600 11px var(--mono); color: var(--muted); }

/* ---------------- cards ---------------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--hi); }
.card-h { display: flex; align-items: center; gap: 6px 10px; padding: 16px 18px 0; flex-wrap: wrap; }
.card-h h3 { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
.card-h .sub { color: var(--muted); font-size: 12px; }
.card-h .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card-b { padding: 14px 18px 18px; }

/* ---------------- overview ---------------- */
button.card { display: block; width: 100%; font: inherit; color: inherit; text-align: left; cursor: pointer; transition: border-color .15s, transform .15s; }
button.card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.hero h2 { margin: 0; font-size: 26px; font-weight: 780; letter-spacing: -0.035em; }
.hero p { margin: 4px 0 0; color: var(--ink-2); }
.hero .clock { text-align: right; }
.hero .clock b { display: block; font-size: 30px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.hero .clock span { color: var(--muted); font-size: 12.5px; }

.kpis { display: grid; grid-template-columns: 1.35fr repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi { position: relative; padding: 18px; overflow: hidden; }
.kpi .label { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 650; color: var(--ink-2); }
.kpi .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--panel-3); color: var(--ink-2); }
.kpi .val { font-size: 34px; font-weight: 780; letter-spacing: -0.04em; line-height: 1.1; margin-top: 14px; }
.kpi .val small { font-size: 14px; font-weight: 650; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.kpi .foot { margin-top: 6px; font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.kpi.hero-kpi { background: radial-gradient(120% 140% at 100% 0%, var(--accent-soft), transparent 55%), var(--panel); }
.kpi.hero-kpi .val { font-size: 52px; }
.kpi .bar { display: flex; height: 8px; border-radius: 6px; overflow: hidden; margin-top: 14px; gap: 2px; background: var(--panel-3); }
.kpi .bar i { display: block; height: 100%; border-radius: 4px; }
.kpi.alert { border-color: color-mix(in srgb, var(--st-crit) 45%, transparent); background: radial-gradient(120% 140% at 100% 0%, var(--st-crit-bg), transparent 60%), var(--panel); }
.kpi.alert .val { color: var(--st-crit); }
.legend-inline { display: inline-flex; align-items: center; gap: 5px; }
.legend-inline i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }

.grid-ov { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; }
.stack { display: grid; gap: 16px; align-content: start; }

.attn-list { display: grid; gap: 8px; }
.attn {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2);
  cursor: pointer; transition: .15s; text-align: left; width: 100%;
}
.attn:hover { border-color: var(--line-2); transform: translateY(-1px); }
.attn .tag { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.attn .tag.hd { background: var(--accent-soft); color: var(--accent); }
.attn .tag.route { background: var(--st-open-bg); color: var(--st-open); }
.attn .tag.sla { background: var(--st-crit-bg); color: var(--st-crit); }
.attn .t { font-weight: 650; font-size: 13px; }
.attn .d { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attn .body { min-width: 0; flex: 1; }
.attn .when { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.empty { display: grid; place-items: center; gap: 6px; text-align: center; padding: 26px 10px; color: var(--muted); font-size: 13px; }
.empty .big { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--st-done-bg); color: var(--st-done); }

.feed { display: grid; gap: 2px; max-height: 360px; overflow: auto; margin: 0 -6px; padding: 0 6px; }
.feed-item { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: start; padding: 8px 6px; border-radius: 10px; cursor: pointer; }
.feed-item:hover { background: var(--panel-2); }
.feed-item .fi { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--panel-3); color: var(--ink-2); }
.feed-item .ft { font-size: 12.5px; line-height: 1.45; }
.feed-item .ft b { font-weight: 650; }
.feed-item .fw { font-size: 11px; color: var(--muted); white-space: nowrap; padding-top: 2px; }
.fresh { animation: fresh 1.8s ease-out; }
@keyframes fresh { from { background: var(--accent-soft); } to { background: transparent; } }

/* SA bars */
.sa-rows { display: grid; gap: 14px; }
.sa-row { display: grid; grid-template-columns: 96px 1fr 44px; gap: 12px; align-items: center; cursor: pointer; }
.sa-row .nm { font-weight: 650; font-size: 13px; }
.sa-row .nm small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.sa-track { position: relative; height: 12px; border-radius: 4px; background: var(--panel-3); }
.sa-track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--ch-1); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.sa-row .v { text-align: right; font-weight: 700; font-size: 14px; }

/* chart */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .tt {
  position: absolute; pointer-events: none; background: var(--panel-3); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 10px;
  font-size: 12px; box-shadow: var(--shadow-sm); white-space: nowrap; transform: translate(-50%, calc(-100% - 12px)); opacity: 0; transition: opacity .12s; z-index: 2;
}
.chart .tt b { display: block; margin-bottom: 3px; }
.chart .tt .r { display: flex; align-items: center; gap: 7px; color: var(--ink-2); }
.chart .tt .r strong { color: var(--ink); margin-left: auto; padding-left: 12px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.table-toggle { font-size: 12px; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th, table.data td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--line); }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th { color: var(--muted); font-weight: 600; }

/* ---------------- status pills & chips ---------------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.open { color: var(--st-open); background: var(--st-open-bg); }
.pill.prog { color: var(--st-prog); background: var(--st-prog-bg); }
.pill.wait { color: var(--st-wait); background: var(--st-wait-bg); }
.pill.done { color: var(--st-done); background: var(--st-done-bg); }
.pill.crit { color: var(--st-crit); background: var(--st-crit-bg); }
.ffg-badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: 6px; font-size: 11px; font-weight: 800; letter-spacing: .03em; color: var(--ffg); background: var(--ffg-bg); border: 1px solid color-mix(in srgb, var(--ffg) 35%, transparent); white-space: nowrap; }
.ffg-badge small { font-weight: 600; letter-spacing: 0; opacity: .85; }
.trow .c-st { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.sa-chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .02em; background: var(--panel-3); color: var(--ink-2); white-space: nowrap; }
.sa-chip.none { color: var(--st-open); background: var(--st-open-bg); }
.seg-chip { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.seg-chip.biz { color: var(--accent); }

/* ---------------- tickets ---------------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.toolbar select.input { width: auto; height: 36px; padding: 0 30px 0 12px; font-size: 13px; font-weight: 600; }
.tlist { overflow: hidden; }
.trow {
  display: grid; grid-template-columns: 150px minmax(170px, 1.2fr) minmax(180px, 1.6fr) 110px 120px 92px 28px; gap: 14px; align-items: center;
  padding: 12px 18px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s;
}
.trow:hover { background: var(--panel-2); }
.trow.head { cursor: default; background: transparent; padding-top: 12px; padding-bottom: 10px; font-size: 11.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.trow.head:hover { background: transparent; }
.trow:last-child { border-bottom: 0; }
.trow .id { font: 600 12.5px var(--mono); }
.trow .when { font-size: 11.5px; color: var(--muted); }
.trow .cust { min-width: 0; }
.trow .cust b { display: block; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .cust span { font: 12px var(--mono); color: var(--muted); }
.trow .kel { min-width: 0; color: var(--ink-2); font-size: 13px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.trow .kel small { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.age { font: 600 12px var(--mono); color: var(--ink-2); }
.age.late { color: var(--st-crit); }
.trow .go { color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; color: var(--muted); font-size: 12.5px; }

/* ---------------- drawer ---------------- */
.scrim { position: fixed; inset: 0; background: rgba(3, 6, 12, 0.5); backdrop-filter: blur(2px); z-index: 20; opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(580px, 100vw); z-index: 21; background: var(--panel); border-left: 1px solid var(--line-2);
  box-shadow: var(--shadow); transform: translateX(104%); transition: transform .28s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column;
}
.drawer.on { transform: none; }
.drawer-h { padding: 20px 22px 16px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.drawer-h .top { display: flex; align-items: center; gap: 10px; }
.drawer-h .tid { font: 700 18px var(--mono); letter-spacing: -0.02em; }
.drawer-b { flex: 1; overflow: auto; padding: 18px 22px 30px; display: grid; gap: 18px; align-content: start; }
.kv { display: grid; grid-template-columns: 118px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.copy { border: 0; background: transparent; color: var(--muted); padding: 0 4px; vertical-align: middle; }
.copy:hover { color: var(--accent); }
.complaint { padding: 14px 16px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); font-size: 14px; }
.complaint .lbl { font-size: 11.5px; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.resolution { border-color: color-mix(in srgb, var(--st-done) 40%, transparent); background: var(--st-done-bg); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form { display: grid; gap: 10px; padding: 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-2); animation: rise .2s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.inline-form .row { display: flex; gap: 8px; justify-content: flex-end; }
.section-t { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 10px; }
.timeline { position: relative; display: grid; gap: 14px; padding-left: 4px; }
.timeline::before { content: ''; position: absolute; left: 17px; top: 8px; bottom: 8px; width: 2px; background: var(--line-2); border-radius: 2px; }
.tl { position: relative; display: grid; grid-template-columns: 28px 1fr; gap: 12px; }
.tl .ti { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-3); color: var(--ink-2); z-index: 1; box-shadow: 0 0 0 4px var(--panel); }
.tl .ti.created { background: var(--accent-soft); color: var(--accent); }
.tl .ti.dispatched, .tl .ti.assigned { background: var(--st-prog-bg); color: var(--st-prog); }
.tl .ti.closed { background: var(--st-done-bg); color: var(--st-done); }
.tl .ti.unrouted, .tl .ti.error { background: var(--st-open-bg); color: var(--st-open); }
.tl .ti.reopened { background: var(--st-wait-bg); color: var(--st-wait); }
.tl .ti.ffg { background: var(--ffg-bg); color: var(--ffg); }
.tl .tt2 { font-size: 13px; line-height: 1.45; }
.tl .tm { font-size: 11.5px; color: var(--muted); }

/* ---------------- inbox ---------------- */
.inbox { display: grid; grid-template-columns: 330px minmax(0, 1fr) 300px; flex: 1; min-height: 0; }
.clist { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: color-mix(in srgb, var(--panel) 55%, transparent); }
.clist-h { padding: 16px 16px 10px; display: grid; gap: 10px; }
.clist-h .seg button { padding: 0 6px; white-space: nowrap; font-size: 12px; }
.clist-b { flex: 1; overflow: auto; padding: 0 8px 12px; }
.citem { display: grid; grid-template-columns: 40px 1fr; gap: 11px; padding: 11px 10px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; transition: .12s; width: 100%; background: transparent; text-align: left; }
.citem:hover { background: var(--panel-2); }
.citem.on { background: var(--panel-2); border-color: var(--line-2); }
.citem .top { display: flex; align-items: center; gap: 6px; }
.citem .nm { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.citem .tm { font-size: 11px; color: var(--muted); white-space: nowrap; }
.citem .pv { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.citem .pv > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.citem .pv .badge { flex: none; }
.citem .flags { display: flex; gap: 5px; margin-top: 6px; }
.mini { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 10.5px; font-weight: 700; }
.mini.bot { background: var(--panel-3); color: var(--ink-2); }
.mini.hd { background: var(--accent-soft); color: var(--accent); }
.mini.req { background: var(--st-crit-bg); color: var(--st-crit); animation: blink 1.6s infinite; }
.mini.form { background: var(--st-open-bg); color: var(--st-open); }
@keyframes blink { 50% { opacity: .55; } }

.thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.thread-h { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--glass); }
.thread-h .who { min-width: 0; flex: 1; }
.thread-h .who b { display: block; font-size: 15px; }
.thread-h .who span { color: var(--muted); font-size: 12px; }
.mode-banner { display: flex; align-items: center; gap: 10px; padding: 9px 20px; font-size: 12.5px; border-bottom: 1px solid var(--line); }
.mode-banner.bot { background: var(--panel-2); color: var(--ink-2); }
.mode-banner.hd { background: var(--accent-soft); color: var(--accent); }
.mode-banner.req { background: var(--st-crit-bg); color: var(--st-crit); }
.mode-banner > span { flex: 1; min-width: 0; }
.mode-banner .btn { margin-left: auto; flex: none; }
.msgs {
  flex: 1; overflow: auto; padding: 22px 26px; display: flex; flex-direction: column; gap: 6px;
  background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 22px 22px;
}
.day-sep { align-self: center; margin: 12px 0 6px; font-size: 11px; font-weight: 650; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); padding: 3px 10px; border-radius: 999px; }
.msg { max-width: min(560px, 78%); display: grid; gap: 3px; animation: rise .2s ease-out; }
.msg .bub { padding: 9px 13px; border-radius: 16px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: var(--shadow-sm); }
.msg .meta { font-size: 10.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; padding: 0 6px; }
.msg.in { align-self: flex-start; }
.msg.in .bub { background: var(--bubble-in); border: 1px solid var(--line); border-top-left-radius: 5px; }
.msg.out { align-self: flex-end; }
.msg.out .meta { justify-content: flex-end; }
.msg.bot .bub { background: var(--bubble-bot); border: 1px solid var(--line-2); border-top-right-radius: 5px; }
.msg.hd .bub { background: var(--bubble-hd); color: #fff; border-top-right-radius: 5px; }
.msg.sys { align-self: center; max-width: 90%; }
.msg.sys .bub { background: transparent; box-shadow: none; color: var(--muted); font-size: 11.5px; padding: 2px 8px; text-align: center; }
.msg .failed { color: var(--st-crit); }
.msg img.media { display: block; max-width: 260px; border-radius: 10px; margin-bottom: 4px; cursor: zoom-in; }
.composer { border-top: 1px solid var(--line); padding: 12px 16px 14px; background: var(--glass); display: grid; gap: 8px; }
.quick { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.quick button { flex: none; height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--ink-2); font-size: 12px; }
.quick button:hover { color: var(--ink); border-color: var(--accent); }
.compose-row { display: flex; gap: 10px; align-items: flex-end; }
.compose-row textarea { flex: 1; min-height: 44px; max-height: 160px; resize: none; border-radius: 14px; padding: 11px 14px; }
.send { width: 44px; height: 44px; border-radius: 14px; border: 0; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: grid; place-items: center; box-shadow: 0 8px 20px -8px var(--accent); flex: none; }
.send:disabled { opacity: .45; }
.hint { font-size: 11px; color: var(--muted); }

.cside { border-left: 1px solid var(--line); overflow: auto; padding: 18px 16px; display: grid; gap: 16px; align-content: start; background: color-mix(in srgb, var(--panel) 55%, transparent); }
.profile { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 6px 0 4px; }
.profile b { font-size: 15px; }
.mini-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--panel-2); display: grid; gap: 8px; }
.mini-card h4 { margin: 0; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.draft-f { display: grid; grid-template-columns: 88px 1fr; gap: 4px 8px; font-size: 12.5px; }
.draft-f dt { color: var(--muted); }
.draft-f dd { margin: 0; overflow-wrap: anywhere; }
.draft-f dd.miss { color: var(--st-open); font-style: italic; }
.tk-link { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; width: 100%; text-align: left; }
.tk-link:hover { border-color: var(--line-2); }
.tk-link .mono { font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.no-thread { flex: 1; display: grid; place-items: center; color: var(--muted); text-align: center; }
.no-thread .art { width: 88px; height: 88px; border-radius: 28px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--accent-soft); color: var(--accent); }

/* ---------------- groups / telegram sim ---------------- */
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.gcard .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.gcard .stat { padding: 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.gcard .stat b { display: block; font-size: 20px; font-weight: 750; letter-spacing: -0.03em; }
.gcard .stat span { font-size: 11.5px; color: var(--muted); }
.tg { display: grid; grid-template-columns: 240px 1fr; min-height: 520px; overflow: hidden; }
.tg-list { border-right: 1px solid var(--line); padding: 10px; display: grid; gap: 4px; align-content: start; }
.tg-chat { display: flex; flex-direction: column; min-height: 0; max-height: 640px; }
.tg-msgs { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: color-mix(in srgb, #2aabee 5%, var(--panel)); }
.tgm { max-width: 80%; padding: 8px 12px; border-radius: 14px; font-size: 13px; white-space: pre-wrap; background: var(--panel-2); border: 1px solid var(--line); align-self: flex-start; }
.tgm.bot { border-color: color-mix(in srgb, #2aabee 40%, transparent); }
.tgm.me { align-self: flex-end; background: color-mix(in srgb, #2aabee 18%, var(--panel)); }
.tgm .from { font-size: 11.5px; font-weight: 700; color: #2aabee; margin-bottom: 2px; }
.tgm .rq { border-left: 3px solid #2aabee; padding: 2px 8px; margin-bottom: 4px; font-size: 11.5px; color: var(--muted); border-radius: 3px; background: var(--panel-3); }
.tgm button.reply { margin-top: 6px; }
.tg-comp { border-top: 1px solid var(--line); padding: 10px; display: grid; gap: 6px; }

/* ---------------- settings ---------------- */
.settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.svc { display: flex; align-items: center; gap: 12px; }
.svc .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--panel-3); }
.svc b { display: block; }
.qr { display: grid; place-items: center; gap: 10px; padding: 16px; border-radius: 14px; background: #fff; }
.qr img { width: 240px; height: 240px; image-rendering: pixelated; }
.routing-g { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.routing-g .r2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------------- toasts, modal, simulator ---------------- */
.toasts { position: fixed; top: 16px; right: 16px; display: grid; gap: 10px; z-index: 40; width: min(380px, calc(100vw - 32px)); }
.toast {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: start; padding: 13px 14px; border-radius: 14px; background: var(--panel-3);
  border: 1px solid var(--line-2); box-shadow: var(--shadow); animation: toastIn .3s cubic-bezier(.2,.8,.2,1); cursor: pointer;
}
.toast .ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.toast.req .ic { background: var(--st-crit-bg); color: var(--st-crit); }
.toast.ok .ic { background: var(--st-done-bg); color: var(--st-done); }
.toast.new .ic { background: var(--st-open-bg); color: var(--st-open); }
.toast b { display: block; font-size: 13px; }
.toast span { font-size: 12.5px; color: var(--ink-2); }
.toast .x { border: 0; background: transparent; color: var(--muted); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(.98); } }
.toast.out { opacity: 0; transform: translateX(20px); transition: .25s; }

.modal-wrap { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; background: rgba(3, 6, 12, 0.55); backdrop-filter: blur(3px); animation: fadeIn .15s; }
@keyframes fadeIn { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow); padding: 22px; display: grid; gap: 14px; animation: rise .2s; }
.modal h3 { margin: 0; font-size: 17px; }
.modal .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; }
.err { color: var(--st-crit); font-size: 12.5px; min-height: 1em; }

.sim-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 15; height: 48px; padding: 0 18px 0 14px; border-radius: 16px; border: 0; color: #04130d; font-weight: 750;
  background: linear-gradient(135deg, #25d366, #34e0a1); box-shadow: 0 14px 30px -10px rgba(37, 211, 102, .6); display: flex; align-items: center; gap: 9px;
}
.sim { position: fixed; right: 22px; bottom: 84px; z-index: 16; width: 360px; height: 560px; max-height: calc(100vh - 110px); border-radius: 26px; overflow: hidden; display: none; flex-direction: column; background: #0b141a; border: 6px solid #1f2c34; box-shadow: var(--shadow); color: #e9edef; }
.sim.on { display: flex; animation: rise .2s; }
.sim-h { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #1f2c34; }
.sim-h select, .sim-h input { background: #2a3942; border: 0; border-radius: 8px; color: #e9edef; padding: 6px 8px; font-size: 12px; }
.sim-msgs { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; background: #0b141a; }
.sim-m { max-width: 82%; padding: 7px 10px; border-radius: 10px; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.sim-m.me { align-self: flex-end; background: #005c4b; }
.sim-m.them { align-self: flex-start; background: #202c33; }
.sim-m .by { font-size: 10.5px; color: #53bdeb; font-weight: 700; margin-bottom: 2px; }
.sim-c { display: flex; gap: 8px; padding: 10px; background: #1f2c34; }
.sim-c input { flex: 1; background: #2a3942; border: 0; border-radius: 20px; color: #e9edef; padding: 10px 14px; outline: none; }
.sim-c button { width: 42px; height: 42px; border-radius: 50%; border: 0; background: #00a884; color: #fff; display: grid; place-items: center; }
.demo-ribbon { font-size: 11px; font-weight: 700; color: #04130d; background: #34e0a1; padding: 3px 8px; border-radius: 6px; letter-spacing: .04em; }

.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.85); display: grid; place-items: center; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 10px; }

/* ---------------- responsive ---------------- */
@media (max-width: 1320px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpi.hero-kpi { grid-column: span 3; }
  .inbox { grid-template-columns: 300px minmax(0, 1fr); }
  .cside { display: none; }
}
@media (max-width: 1100px) {
  .grid-ov { grid-template-columns: 1fr; }
  .trow { grid-template-columns: 130px minmax(140px, 1fr) minmax(150px, 1.2fr) 110px 90px 24px; }
  .trow .c-sa { display: none; }
  .chips .chip .lbl { display: none; }
}
@media (max-width: 760px) {
  body { overflow: auto; }
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .rail { order: 2; flex-direction: row; justify-content: space-around; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); position: fixed; left: 0; right: 0; bottom: 0; }
  .rail .logo, .rail .spacer, .nav-btn .tip { display: none; }
  .nav-btn.active::before { display: none; }
  .app { height: 100dvh; }
  .main { height: calc(100dvh - 62px); }
  .topbar { padding: 12px 16px; gap: 10px; }
  .topbar > div:first-child { min-width: 0; }
  .topbar h1 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34vw; }
  .search { padding: 0 10px; }
  .topbar .sub, .search .kbd, .chips { display: none; }
  .search { margin-left: 0; }
  .view { padding: 16px 16px 90px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi.hero-kpi { grid-column: span 2; }
  .kpi .val { font-size: 28px; }
  .kpi.hero-kpi .val { font-size: 42px; }
  .hero .clock { display: none; }
  .trow { grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 16px; }
  .trow.head { display: none; }
  .trow .c-sa, .trow .go { display: none; }
  .trow .kel { grid-column: 1 / -1; -webkit-line-clamp: 1; font-size: 12.5px; }
  .trow .kel small { display: none; }
  .toolbar .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .seg button { white-space: nowrap; flex: none; }
  .trow .c-id { grid-column: 1; }
  .trow .c-st { grid-column: 2; grid-row: 1; justify-self: end; }
  .trow .cust { grid-column: 1 / -1; }
  .trow .c-age { grid-column: 1 / -1; }
  .inbox { grid-template-columns: 1fr; }
  .inbox.has-thread .clist { display: none; }
  .inbox:not(.has-thread) .thread { display: none; }
  .msgs { padding: 16px 12px; }
  .msg { max-width: 88%; }
  .tg { grid-template-columns: 1fr; }
  .tg-list { grid-auto-flow: column; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .sim { right: 8px; left: 8px; width: auto; bottom: 76px; }
  .sim-fab { bottom: 76px; right: 12px; }
  .modal .grid2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
