@font-face { font-family: 'Vazirmatn'; src: url('/fonts/Vazirmatn[wght].woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: light;
  --canvas: #f3f5f9; --surface: #ffffff; --surface-2: #f8f9fc; --ink: #152036; --ink-2: #3b4559; --muted: #677189; --faint: #9aa2b4;
  --line: #e3e7ef; --line-2: #eef1f6;
  --brand: #1f4fb5; --brand-ink: #183f91; --brand-soft: #e9effb; --brand-line: #c9d6f2;
  --agent-bubble: #1f4fb5; --user-bubble: #ffffff;
  --note: #fff7df; --note-line: #f1dfa6; --note-ink: #6b5205;
  --good: #0ca30c; --good-soft: #e3f6e3; --warn: #b97a00; --warn-soft: #fff3d6; --crit: #d03b3b; --crit-soft: #fde8e8;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --surface-chart: #fcfcfb;
  --seq-1: #cde2fb; --seq-2: #9ec5f4; --seq-3: #6da7ec; --seq-4: #3987e5; --seq-5: #256abf; --seq-6: #184f95; --seq-7: #0d366b;
  --shadow: 0 1px 2px rgba(21, 32, 54, .06), 0 8px 24px -14px rgba(21, 32, 54, .25);
  --shadow-pop: 0 18px 50px -12px rgba(21, 32, 54, .35), 0 0 0 1px rgba(21, 32, 54, .06);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --canvas: #0f1420; --surface: #171d2b; --surface-2: #1c2333; --ink: #e8ecf4; --ink-2: #c3cad8; --muted: #98a1b6; --faint: #6c768c;
    --line: #262e40; --line-2: #212839; --brand: #5b8def; --brand-ink: #86abf5; --brand-soft: #1d2a47; --brand-line: #2c3f69;
    --agent-bubble: #2d5bc4; --user-bubble: #222a3c; --note: #2e2914; --note-line: #4a4120; --note-ink: #e9d48e;
    --good-soft: #13301a; --warn: #fab219; --warn-soft: #33290f; --crit-soft: #3a1b1d;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --surface-chart: #171d2b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -14px rgba(0, 0, 0, .6);
    --shadow-pop: 0 18px 50px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .06);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0f1420; --surface: #171d2b; --surface-2: #1c2333; --ink: #e8ecf4; --ink-2: #c3cad8; --muted: #98a1b6; --faint: #6c768c;
  --line: #262e40; --line-2: #212839; --brand: #5b8def; --brand-ink: #86abf5; --brand-soft: #1d2a47; --brand-line: #2c3f69;
  --agent-bubble: #2d5bc4; --user-bubble: #222a3c; --note: #2e2914; --note-line: #4a4120; --note-ink: #e9d48e;
  --good-soft: #13301a; --warn: #fab219; --warn-soft: #33290f; --crit-soft: #3a1b1d;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --surface-chart: #171d2b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -14px rgba(0, 0, 0, .6);
  --shadow-pop: 0 18px 50px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button, a, .citem, .tab { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
body { font-family: 'Vazirmatn', Tahoma, system-ui, sans-serif; font-size: 14px; line-height: 1.7; color: var(--ink); background: var(--canvas); -webkit-font-smoothing: antialiased; font-feature-settings: "ss01"; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 8px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ic { width: 20px; height: 20px; flex: none; display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[v-cloak] { display: none; }

/* ---------- Layout ---------- */
.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.rail { width: 72px; flex: none; background: var(--surface); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 14px 0; gap: 6px; }
.rail .logo { width: 40px; height: 40px; border-radius: 12px; background: var(--brand); color: #fff; display: grid; place-items: center; margin-bottom: 14px; }
.rail .logo .ic { width: 22px; height: 22px; }
.rail-btn { position: relative; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: var(--muted); transition: background .15s, color .15s; }
.rail-btn:hover { background: var(--surface-2); color: var(--ink); }
.rail-btn.on { background: var(--brand-soft); color: var(--brand-ink); }
.rail-btn .ic { width: 22px; height: 22px; }
.rail-btn .tip { position: absolute; inset-inline-start: calc(100% + 10px); top: 50%; transform: translateY(-50%); background: var(--ink); color: var(--surface); font-size: 12px; padding: 3px 10px; border-radius: 8px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 50; }
.rail-btn:hover .tip { opacity: 1; }
.rail-btn .dotc { position: absolute; top: 7px; inset-inline-end: 7px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--crit); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }
.rail .grow { flex: 1; }
.me-btn { position: relative; }
.me-btn .pres { position: absolute; bottom: 4px; inset-inline-end: 4px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); background: var(--faint); }
.me-btn .pres.online { background: var(--good); }
.main { flex: 1; min-width: 0; display: flex; }

/* ---------- Avatars, chips ---------- */
.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; flex: none; position: relative; }
.av.sm { width: 28px; height: 28px; font-size: 11px; }
.av.xs { width: 22px; height: 22px; font-size: 10px; }
.av.lg { width: 64px; height: 64px; font-size: 22px; }
.av .on { position: absolute; bottom: 0; inset-inline-end: 0; width: 11px; height: 11px; border-radius: 50%; background: var(--good); border: 2px solid var(--surface); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 20px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.chip .d { width: 8px; height: 8px; border-radius: 50%; }
.chip.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.crit { background: var(--crit-soft); color: var(--crit); border-color: transparent; }
.chip.brand { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }

/* ---------- Buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 10px; font-weight: 600; font-size: 13.5px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); transition: background .15s, border-color .15s, transform .1s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); border-color: var(--brand-line); }
.btn:active { transform: scale(.98); }
.btn .ic { width: 18px; height: 18px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); }
.btn.danger { color: var(--crit); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.ibtn { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); transition: background .15s, color .15s; flex: none; position: relative; }
.ibtn:hover { background: var(--surface-2); color: var(--ink); }
.ibtn.on { color: var(--brand-ink); background: var(--brand-soft); }
.ibtn[data-tip]:hover::after { content: attr(data-tip); position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface); font-size: 12px; padding: 2px 9px; border-radius: 7px; white-space: nowrap; z-index: 40; pointer-events: none; }
.input, .select, textarea.input { width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; }
.input:focus, .select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--muted); font-size: 12px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 11px; background: var(--line); position: relative; transition: background .2s; cursor: pointer; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(-16px); }
[dir="ltr"] .switch input:checked::after { transform: translateX(16px); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { height: 30px; padding: 0 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(21, 32, 54, .1); }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 500px at 50% -10%, var(--brand-soft), transparent), var(--canvas); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 20px; padding: 32px 28px; box-shadow: var(--shadow-pop); }
.login-card .logo { width: 52px; height: 52px; border-radius: 15px; background: var(--brand); color: #fff; display: grid; place-items: center; margin-bottom: 18px; }
.login-card h1 { font-size: 21px; font-weight: 800; }
.login-card p { color: var(--muted); margin-bottom: 22px; font-size: 13.5px; }
.login-card .btn { width: 100%; height: 44px; margin-top: 6px; }
.err-box { background: var(--crit-soft); color: var(--crit); border-radius: 10px; padding: 8px 12px; font-size: 13px; margin-bottom: 14px; }

/* ---------- Inbox list ---------- */
.list { width: 360px; flex: none; background: var(--surface); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.list-head { padding: 16px 16px 10px; border-bottom: 1px solid var(--line-2); }
.list-head h2 { font-size: 18px; font-weight: 800; display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.search { position: relative; }
.search .ic { position: absolute; top: 10px; inset-inline-start: 11px; width: 18px; height: 18px; color: var(--faint); }
.search input { padding-inline-start: 36px; height: 38px; background: var(--surface-2); border-color: transparent; }
.tabs { display: flex; gap: 2px; padding: 8px 10px 0; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.tab { height: 38px; padding: 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; display: flex; align-items: center; gap: 6px; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--brand-ink); border-color: var(--brand); }
.tab .n { min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px; background: var(--surface-2); font-size: 11px; display: grid; place-items: center; }
.tab.on .n { background: var(--brand-soft); }
.tab .n.hot { background: var(--crit); color: #fff; }
.list-body { flex: 1; overflow-y: auto; padding: 6px; }
.citem { display: flex; gap: 12px; width: 100%; text-align: start; padding: 12px 10px; border-radius: 12px; position: relative; transition: background .12s; }
.citem:hover { background: var(--surface-2); }
.citem.on { background: var(--brand-soft); }
.citem .txt { flex: 1; min-width: 0; }
.citem .r1 { display: flex; align-items: center; gap: 6px; }
.citem .nm { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.citem.unread .nm { color: var(--ink); }
.citem .tm { font-size: 11.5px; color: var(--faint); flex: none; }
.citem .pv { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.citem.unread .pv { color: var(--ink-2); font-weight: 600; }
.citem .r3 { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.citem .ub { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.typing-mini { color: var(--brand-ink) !important; font-weight: 600; }
/* The waiting ring: fills toward the SLA, then turns amber, then red. */
.wait { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.wait svg { width: 16px; height: 16px; transform: rotate(-90deg); }
.wait circle { fill: none; stroke-width: 3; }
.wait .bg { stroke: var(--line); }
.wait .fg { stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.wait.warn { color: var(--warn); } .wait.warn .fg { stroke: var(--warn); }
.wait.crit { color: var(--crit); } .wait.crit .fg { stroke: var(--crit); }
.wait.crit svg { animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; } }
.empty-state { text-align: center; padding: 50px 24px; color: var(--muted); }
.empty-state .ic { width: 44px; height: 44px; margin: 0 auto 12px; color: var(--faint); }
.empty-state b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.more-btn { width: 100%; padding: 10px; color: var(--brand-ink); font-weight: 600; font-size: 13px; }

/* ---------- Chat pane ---------- */
.chat { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--canvas); position: relative; }
.chat-head { height: 68px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.chat-head .who { flex: 1; min-width: 0; }
.chat-head .nm { font-weight: 800; font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.chat-head .sub { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; }
.chat-head .acts { display: flex; align-items: center; gap: 6px; }
.timeline { flex: 1; overflow-y: auto; padding: 18px 24px 10px; overscroll-behavior: contain; }
.tl-day { text-align: center; margin: 16px 0 10px; }
.tl-day span { font-size: 12px; color: var(--muted); background: var(--surface); padding: 3px 12px; border-radius: 20px; border: 1px solid var(--line); }
.tl-sys { text-align: center; font-size: 12.5px; color: var(--muted); margin: 10px 0; display: flex; align-items: center; justify-content: center; gap: 6px; }
.tl-sys .ic { width: 15px; height: 15px; }
.msg { display: flex; gap: 10px; margin-top: 3px; align-items: flex-end; animation: rise .25s cubic-bezier(.2, 1.2, .4, 1); }
.msg.first { margin-top: 14px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.msg.user { flex-direction: row-reverse; }
.msg.mine .avs { display: none; }
.msg .avs { width: 28px; flex: none; }
.msg .col { max-width: min(560px, 72%); display: flex; flex-direction: column; align-items: flex-start; }
.msg.user .col { align-items: flex-end; }
.msg .who { font-size: 12px; color: var(--muted); font-weight: 600; margin: 0 8px 3px; display: flex; gap: 6px; align-items: center; }
.bubble { padding: 9px 14px; border-radius: 16px; background: var(--user-bubble); box-shadow: 0 1px 1px rgba(21, 32, 54, .06); border: 1px solid var(--line-2); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.2px; line-height: 1.75; }
.msg.agent .bubble { background: var(--agent-bubble); color: #fff; border-color: transparent; }
.msg.user .bubble { border-bottom-left-radius: 5px; }
.msg.user:not(.first) .bubble { border-top-left-radius: 5px; }
.msg.agent .bubble { border-bottom-right-radius: 5px; }
.msg.agent:not(.first) .bubble { border-top-right-radius: 5px; }
.bubble a { color: inherit; text-decoration: underline; }
.bubble.media { padding: 4px; overflow: hidden; }
.bubble.media img { display: block; max-width: 300px; max-height: 320px; border-radius: 12px; cursor: zoom-in; }
.bubble.media .cap { padding: 6px 10px 4px; }
.msg .meta { display: flex; gap: 5px; align-items: center; font-size: 11px; color: var(--faint); margin: 3px 8px 0; }
.msg .meta .ic { width: 15px; height: 15px; }
.msg .meta .seen { color: var(--brand); }
.msg .meta .err { color: var(--crit); }
.msg .meta .via { display: inline-flex; align-items: center; gap: 3px; }
.note-card { margin: 12px auto; max-width: 560px; background: var(--note); border: 1px dashed var(--note-line); color: var(--note-ink); border-radius: 12px; padding: 10px 14px; font-size: 13.5px; white-space: pre-wrap; }
.note-card .h { font-size: 11.5px; font-weight: 700; display: flex; gap: 6px; align-items: center; margin-bottom: 2px; opacity: .85; }
.voice { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; min-width: 240px; }
.vplay { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.msg.agent .vplay { background: #fff; color: var(--brand); }
.vplay .ic { width: 15px; height: 15px; }
.wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 28px; cursor: pointer; direction: ltr; }
.wave i { flex: 1; min-width: 2px; border-radius: 2px; background: color-mix(in srgb, var(--ink) 25%, transparent); }
.wave i.p { background: var(--brand); }
.msg.agent .wave i { background: rgba(255, 255, 255, .4); } .msg.agent .wave i.p { background: #fff; }
.vt { font-size: 11.5px; min-width: 34px; text-align: center; opacity: .8; }
.typing-line { display: flex; flex-direction: row-reverse; gap: 10px; align-items: flex-end; margin-top: 14px; }
.typing-line .bubble { border-bottom-left-radius: 5px; }
.typing-line .bubble { color: var(--muted); font-style: normal; border-style: dashed; background: transparent; display: flex; gap: 8px; align-items: center; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: bounce 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: none; opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }
.jump { position: absolute; bottom: 150px; left: 50%; transform: translateX(-50%); }

/* Composer */
.composer { flex: none; background: var(--surface); border-top: 1px solid var(--line); padding: 10px 16px 14px; position: relative; }
.comp-modes { display: flex; gap: 4px; margin-bottom: 8px; align-items: center; }
.comp-modes button { font-size: 12.5px; font-weight: 700; padding: 4px 12px; border-radius: 8px; color: var(--muted); }
.comp-modes button.on { background: var(--brand-soft); color: var(--brand-ink); }
.comp-modes button.on.note { background: var(--note); color: var(--note-ink); }
.comp-modes .hint { margin-inline-start: auto; font-size: 11.5px; color: var(--faint); }
.comp-box { display: flex; align-items: flex-end; gap: 4px; border: 1.5px solid var(--line); border-radius: 14px; padding: 6px; transition: border-color .15s, background .15s; background: var(--surface); }
.comp-box:focus-within { border-color: var(--brand); }
.comp-box.note { background: var(--note); border-color: var(--note-line); }
.comp-box textarea { flex: 1; border: 0; background: none; resize: none; padding: 6px 8px; min-height: 36px; max-height: 180px; outline: none; line-height: 1.65; font-size: 14.2px; }
.send { width: 40px; height: 40px; border-radius: 11px; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; transition: transform .15s, opacity .15s; }
.send[disabled] { opacity: .35; }
.send .ic { transform: scaleX(-1); }
.comp-box.note .send { background: var(--note-ink); }
.canned-pop { position: absolute; bottom: calc(100% - 4px); inset-inline: 16px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-pop); max-height: 280px; overflow-y: auto; padding: 6px; z-index: 20; animation: rise .18s; }
.canned-pop button { display: block; width: 100%; text-align: start; padding: 8px 12px; border-radius: 10px; }
.canned-pop button.on, .canned-pop button:hover { background: var(--brand-soft); }
.canned-pop b { font-size: 13px; } .canned-pop span { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.canned-pop kbd { font-family: inherit; font-size: 11px; color: var(--brand-ink); background: var(--brand-soft); border-radius: 5px; padding: 0 6px; margin-inline-start: 6px; }
.rec { display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 6px; }
.rec .rd { width: 10px; height: 10px; border-radius: 50%; background: var(--crit); animation: breathe 1s infinite; }
.rec .lv { flex: 1; display: flex; gap: 2px; align-items: center; height: 26px; overflow: hidden; direction: ltr; justify-content: flex-end; }
.rec .lv i { width: 3px; border-radius: 2px; background: var(--brand); flex: none; }
.closed-bar { flex: none; background: var(--surface); border-top: 1px solid var(--line); padding: 14px 16px; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-size: 13.5px; flex-wrap: wrap; }
.drop-cover { position: absolute; inset: 0; background: color-mix(in srgb, var(--brand) 10%, transparent); border: 2px dashed var(--brand); z-index: 30; display: grid; place-items: center; font-weight: 800; color: var(--brand-ink); pointer-events: none; }
.no-chat { flex: 1; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 30px; }
.no-chat .big { width: 76px; height: 76px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; margin: 0 auto 16px; color: var(--brand); }
.no-chat .big .ic { width: 36px; height: 36px; }
.no-chat b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }

/* ---------- User panel ---------- */
.side { width: 310px; flex: none; background: var(--surface); border-inline-start: 1px solid var(--line); overflow-y: auto; }
.side-top { padding: 22px 18px 16px; text-align: center; border-bottom: 1px solid var(--line-2); }
.side-top .av { margin: 0 auto 10px; }
.side-top h3 { font-size: 16px; font-weight: 800; }
.side-top .u { color: var(--muted); font-size: 12.5px; }
.side-sec { padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.side-sec h4 { font-size: 12.5px; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.kv { display: flex; align-items: flex-start; gap: 10px; padding: 5px 0; font-size: 13px; }
.kv .ic { width: 17px; height: 17px; color: var(--faint); margin-top: 3px; }
.kv .v { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.kv .v small { display: block; color: var(--muted); font-size: 11.5px; }
.kv .copy { opacity: 0; transition: opacity .15s; }
.kv:hover .copy { opacity: 1; }
.hist-item { display: flex; gap: 8px; align-items: center; padding: 7px 8px; margin: 0 -8px; border-radius: 10px; font-size: 12.5px; width: calc(100% + 16px); text-align: start; }
.hist-item:hover { background: var(--surface-2); }
.hist-item .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.stars { display: inline-flex; gap: 1px; color: #f2a516; }
.stars .ic { width: 14px; height: 14px; fill: currentColor; stroke: none; }
.stars .off { color: var(--line); }
.course-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Pages (reports, monitor, settings) ---------- */
.page { flex: 1; overflow-y: auto; }
.page-in { max-width: 1280px; margin: 0 auto; padding: 24px 28px 60px; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 800; flex: 1; }
.page-head .sub { color: var(--muted); font-size: 13px; width: 100%; margin-top: -10px; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--surface); padding: 10px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; position: sticky; top: 0; z-index: 5; }
.filters .select { width: auto; height: 36px; min-width: 150px; }
.filters .range-in { display: flex; gap: 6px; align-items: center; }
.filters .range-in .input { width: 120px; height: 36px; direction: ltr; text-align: center; }
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; }
.panel-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-h h3 { font-size: 15px; font-weight: 800; }
.panel-h p { color: var(--muted); font-size: 12.5px; flex: 1; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; position: relative; }
.kpi .l { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi .v { font-size: 26px; font-weight: 800; line-height: 1.4; margin-top: 2px; }
.kpi .v small { font-size: 13px; font-weight: 600; color: var(--muted); margin-inline-start: 4px; }
.kpi .d { font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 3px; margin-top: 2px; }
.kpi .d.up { color: var(--good); } .kpi .d.down { color: var(--crit); } .kpi .d.flat { color: var(--muted); }
.kpi .d .ic { width: 14px; height: 14px; }
.kpi .d span { color: var(--muted); font-weight: 500; }
.kpi.hero { grid-column: span 1; }
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: start; font-weight: 700; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: default; }
.tbl th.sortable { cursor: pointer; } .tbl th.sortable:hover { color: var(--ink); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl .n { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-cell { display: flex; align-items: center; gap: 8px; }
.bar-cell .b { height: 8px; border-radius: 4px; background: var(--s1); min-width: 2px; }
.heat { display: grid; grid-template-columns: 70px repeat(24, minmax(0, 1fr)); gap: 3px; font-size: 11px; direction: rtl; }
.heat .hl { color: var(--muted); display: flex; align-items: center; font-size: 12px; }
.heat .hh { color: var(--faint); text-align: center; font-size: 10.5px; direction: ltr; }
.heat .c { aspect-ratio: 1.4; border-radius: 4px; background: var(--line-2); position: relative; }
.heat .c:hover { outline: 2px solid var(--ink); outline-offset: 1px; z-index: 2; }
.heat-scale { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); margin-top: 10px; justify-content: flex-end; }
.heat-scale i { width: 22px; height: 10px; border-radius: 3px; display: inline-block; }
.tooltip { position: fixed; z-index: 100; background: var(--ink); color: var(--surface); font-size: 12px; padding: 6px 10px; border-radius: 8px; pointer-events: none; white-space: nowrap; box-shadow: var(--shadow-pop); }
.comment { padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.comment:last-child { border-bottom: 0; }
.comment .h { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.view-toggle { margin-inline-start: auto; }
.loading-bar { position: fixed; top: 0; inset-inline: 0; height: 3px; background: var(--brand); z-index: 200; animation: load 1.2s ease-in-out infinite; transform-origin: right; }
@keyframes load { 0% { transform: scaleX(0); } 50% { transform: scaleX(.7); } 100% { transform: scaleX(1); opacity: 0; } }

/* Monitor */
.svc { display: flex; gap: 16px; align-items: flex-start; }
.svc .state { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; flex: none; }
.svc .state.ok { background: var(--good-soft); color: var(--good); }
.svc .state.down { background: var(--crit-soft); color: var(--crit); }
.svc .state.na { background: var(--surface-2); color: var(--faint); }
.svc .state .ic { width: 26px; height: 26px; }
.svc h3 { font-size: 16px; font-weight: 800; }
.svc .meta { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.svc .meta b { color: var(--ink); font-weight: 700; }
.uptime-bar { display: flex; gap: 2px; height: 34px; margin-top: 14px; }
.uptime-bar i { flex: 1; border-radius: 3px; background: var(--good); opacity: .85; min-width: 2px; }
.uptime-bar i.part { background: var(--warn); }
.uptime-bar i.down { background: var(--crit); }
.uptime-bar i.none { background: var(--line); }
.uptime-bar i:hover { opacity: 1; transform: scaleY(1.12); }
.uptime-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin-top: 4px; }
.pulse-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.pulse-dot.ok { background: var(--good); box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 60%, transparent); animation: pulse 2s infinite; }
.pulse-dot.down { background: var(--crit); }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* Settings */
.set-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.set-nav { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; position: sticky; top: 0; }
.set-nav button { display: flex; gap: 10px; align-items: center; width: 100%; padding: 10px 12px; border-radius: 10px; font-weight: 600; color: var(--ink-2); text-align: start; }
.set-nav button:hover { background: var(--surface-2); }
.set-nav button.on { background: var(--brand-soft); color: var(--brand-ink); }
.set-nav .ic { width: 18px; height: 18px; }
.row-card { display: flex; gap: 14px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--line-2); }
.row-card:last-child { border-bottom: 0; }
.row-card .txt { flex: 1; min-width: 0; }
.row-card .t1 { font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-card .t2 { color: var(--muted); font-size: 12.5px; }
.dept-sw { width: 14px; height: 14px; border-radius: 5px; flex: none; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; gap: 8px; align-items: center; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; font-size: 13px; user-select: none; }
.checks label.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.checks input { display: none; }
.colors { display: flex; gap: 8px; flex-wrap: wrap; }
.colors button { width: 28px; height: 28px; border-radius: 9px; border: 2px solid transparent; }
.colors button.on { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--surface); }
.code-box { font-family: ui-monospace, Menlo, monospace; font-size: 22px; letter-spacing: 4px; font-weight: 700; background: var(--surface-2); border: 1px dashed var(--brand-line); border-radius: 12px; padding: 12px; text-align: center; direction: ltr; user-select: all; }
.steps { padding-inline-start: 20px; color: var(--ink-2); font-size: 13.5px; }
.steps li { margin-bottom: 6px; }

/* Drawer / modal */
.scrim { position: fixed; inset: 0; background: rgba(10, 14, 24, .45); z-index: 90; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(460px, 100vw); background: var(--surface); z-index: 91; display: flex; flex-direction: column; box-shadow: var(--shadow-pop); animation: slide .28s cubic-bezier(.2, .9, .3, 1); }
@keyframes slide { from { transform: translateX(-40px); opacity: 0; } }
[dir="ltr"] .drawer { animation-name: slide-ltr; } @keyframes slide-ltr { from { transform: translateX(40px); opacity: 0; } }
.drawer-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-h h3 { flex: 1; font-size: 17px; font-weight: 800; }
.drawer-b { flex: 1; overflow-y: auto; padding: 18px 20px; }
.drawer-f { padding: 14px 20px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(440px, calc(100vw - 32px)); background: var(--surface); border-radius: 18px; z-index: 91; box-shadow: var(--shadow-pop); animation: pop .25s cubic-bezier(.2, 1.2, .4, 1); }
@keyframes pop { from { transform: translate(-50%, -46%) scale(.96); opacity: 0; } }
.modal-b { padding: 22px; }
.modal-b h3 { font-size: 17px; font-weight: 800; margin-bottom: 6px; }
.modal-b p { color: var(--muted); font-size: 13.5px; margin-bottom: 14px; }
.modal-f { padding: 0 22px 20px; display: flex; gap: 8px; justify-content: flex-end; }
.lightbox { position: fixed; inset: 0; background: rgba(8, 11, 18, .88); z-index: 120; display: grid; place-items: center; cursor: zoom-out; animation: fade .2s; }
.lightbox img { max-width: 92vw; max-height: 90vh; border-radius: 10px; }

/* Toasts */
.toasts { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); inset-inline-start: 50%; transform: translateX(50%); z-index: 150; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
[dir="ltr"] .toasts { transform: translateX(-50%); }
.toast { background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 12px; font-size: 13.5px; box-shadow: var(--shadow-pop); display: flex; gap: 10px; align-items: center; pointer-events: auto; animation: rise .3s cubic-bezier(.2, 1.3, .4, 1); max-width: 520px; }
.toast .ic { width: 18px; height: 18px; }
.toast.err { background: var(--crit); color: #fff; }
.toast.good .ic { color: #6be36b; }
.banner { display: flex; gap: 12px; align-items: center; padding: 10px 14px; background: var(--brand-soft); color: var(--brand-ink); font-size: 13px; border-radius: 12px; margin: 8px 8px 2px; }
.banner .ic { width: 18px; height: 18px; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner .grow { flex: 1; }

/* Responsive */
@media (max-width: 1280px) { .side { display: none; } .side.force { display: block; position: fixed; inset-block: 0; inset-inline-end: 0; z-index: 60; box-shadow: var(--shadow-pop); } .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .g2, .g3 { grid-template-columns: minmax(0, 1fr); } .set-layout { grid-template-columns: minmax(0, 1fr); } .set-nav { position: static; display: flex; overflow-x: auto; } .set-nav button { width: auto; white-space: nowrap; } }
@media (max-width: 820px) {
  .app { flex-direction: column-reverse; }
  /* Bottom bar clears the home indicator and rounded corners (iPhone, gesture Android). */
  .rail { width: 100%; height: auto; min-height: 62px; flex-direction: row; padding: 6px max(12px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); justify-content: space-around; border-inline-end: 0; border-top: 1px solid var(--line); }
  .app { padding-top: env(safe-area-inset-top, 0px); }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .rail .logo, .rail .grow, .rail-btn .tip { display: none; }
  .main { min-height: 0; }
  .list { width: 100%; }
  .list.hide-m, .chat.hide-m { display: none; }
  .timeline { padding: 14px 12px; }
  .page-in { padding: 16px 14px 40px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .v { font-size: 22px; }
  .chat-head .acts .btn span { display: none; }
  .chat-head { gap: 8px; padding: 0 10px; }
  .chat-head .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
  .chat-head .nm .num { display: none; }
  .chat-head .acts { gap: 2px; }
  .comp-modes .hint { display: none; }
  .comp-modes button { white-space: nowrap; }
  .composer { padding: 8px 10px 10px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* iOS: fields at 16px never trigger Safari's focus zoom. */
@media (pointer: coarse) {
  input, select, textarea, .input, .select, .comp-box textarea, .filters .select { font-size: 16px !important; }
}
