/* WAG RAG · PT Solusi Daya Indonesia
   Tema mengikuti identitas SDI: ungu #2f1c5e + merah #e3173e, font Geist. */

@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Variable.woff2") format("woff2-variations"), url("/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/GeistMono-Variable.woff2") format("woff2-variations"), url("/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --font: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, Consolas, monospace;

  --brand: #2f1c5e;
  --brand-2: #45307f;
  --accent: #e3173e;

  --bg: #f4f3f7;
  --surface: #ffffff;
  --surface-2: #faf9fc;
  --tint: #f1eef8;
  --line: #e5e2eb;
  --line-strong: #cfcad9;
  --text: #1d1a26;
  --text-2: #4a4558;
  --muted: #6b6779;

  --primary: #45307f;
  --primary-hover: #2f1c5e;
  --on-primary: #ffffff;
  --primary-soft: #ece7f8;
  --primary-text: #45307f;

  --ok: #13683f;
  --ok-bg: #e5f3eb;
  --warn: #7f5200;
  --warn-bg: #fff3d6;
  --err: #b4232f;
  --err-bg: #fde8ea;
  --on-err: #ffffff;

  --side-bg: #2f1c5e;
  --side-text: #ddd6f0;
  --side-muted: #a99fcb;
  --side-hover: rgb(255 255 255 / 7%);
  --side-active: rgb(255 255 255 / 13%);
  --side-line: rgb(255 255 255 / 10%);

  /* Palet chart (tervalidasi CVD terhadap surface #fff) */
  --series-1: #5b3fb5;
  --series-2: #e3173e;
  --series-3: #eda100;
  --series-4: #1baf7a;
  --series-5: #2a78d6;
  --series-6: #e87ba4;
  --grid: #ebe8f0;
  --axis: #cfcad9;

  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgb(30 20 60 / 5%), 0 3px 10px -4px rgb(30 20 60 / 8%);
  --shadow-lg: 0 2px 6px rgb(30 20 60 / 6%), 0 18px 40px -12px rgb(30 20 60 / 22%);
  --focus: 0 0 0 3px rgb(69 48 127 / 28%);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #120e1b;
    --surface: #1b1626;
    --surface-2: #201a2d;
    --tint: #261f37;
    --line: #2f2840;
    --line-strong: #40375a;
    --text: #ece9f3;
    --text-2: #c4bdd6;
    --muted: #9c94b0;
    --primary: #8f78e8;
    --primary-hover: #a592f0;
    --on-primary: #120e1b;
    --primary-soft: #2a2245;
    --primary-text: #b8a9f5;
    --ok: #5fd197;
    --ok-bg: #12301f;
    --warn: #f0c060;
    --warn-bg: #36290c;
    --err: #ff8a92;
    --err-bg: #3a151b;
    --on-err: #2a0a0f;
    --side-bg: #0e0a16;
    --side-text: #d6cfea;
    --side-muted: #958cb2;
    --series-1: #8f78e8;
    --series-2: #e83a6e;
    --series-3: #bc8800;
    --series-4: #199e70;
    --series-5: #3987e5;
    --series-6: #d55181;
    --grid: #2a2439;
    --axis: #40375a;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 14px -6px rgb(0 0 0 / 40%);
    --shadow-lg: 0 2px 8px rgb(0 0 0 / 35%), 0 24px 48px -16px rgb(0 0 0 / 55%);
    --focus: 0 0 0 3px rgb(143 120 232 / 35%);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #120e1b;
  --surface: #1b1626;
  --surface-2: #201a2d;
  --tint: #261f37;
  --line: #2f2840;
  --line-strong: #40375a;
  --text: #ece9f3;
  --text-2: #c4bdd6;
  --muted: #9c94b0;
  --primary: #8f78e8;
  --primary-hover: #a592f0;
  --on-primary: #120e1b;
  --primary-soft: #2a2245;
  --primary-text: #b8a9f5;
  --ok: #5fd197;
  --ok-bg: #12301f;
  --warn: #f0c060;
  --warn-bg: #36290c;
  --err: #ff8a92;
  --err-bg: #3a151b;
  --on-err: #2a0a0f;
  --side-bg: #0e0a16;
  --side-text: #d6cfea;
  --side-muted: #958cb2;
  --series-1: #8f78e8;
  --series-2: #e83a6e;
  --series-3: #bc8800;
  --series-4: #199e70;
  --series-5: #3987e5;
  --series-6: #d55181;
  --grid: #2a2439;
  --axis: #40375a;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 14px -6px rgb(0 0 0 / 40%);
  --shadow-lg: 0 2px 8px rgb(0 0 0 / 35%), 0 24px 48px -16px rgb(0 0 0 / 55%);
  --focus: 0 0 0 3px rgb(143 120 232 / 35%);
}

/* ---------- Dasar ---------- */

*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  font-feature-settings: "ss01";
  -webkit-font-smoothing: antialiased;
  caret-color: var(--primary);
}

::selection { background: color-mix(in srgb, var(--primary) 24%, transparent); color: inherit; }

* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

[hidden] { display: none !important; }

h1, h2, h3, h4 { margin: 0; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 1.5rem; font-weight: 650; letter-spacing: -0.02em; }
h2 { font-size: 1.05rem; font-weight: 620; letter-spacing: -0.01em; }
h3 { font-size: 0.95rem; font-weight: 620; }
p { text-wrap: pretty; }

a { color: var(--primary-text); text-underline-offset: 3px; }
code, .mono { font-family: var(--mono); font-size: 0.86em; }
.num { font-variant-numeric: tabular-nums; }

.sprite { display: none; }

.ic {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ic-sm { width: 15px; height: 15px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---------- Kontrol ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 560;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.btn:hover { background: var(--tint); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.is-busy { cursor: progress; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--err); border-color: var(--err); color: var(--on-err); }
.btn-danger:hover { background: var(--err); filter: brightness(0.93); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--tint); color: var(--text); }
.btn-ghost.danger:hover { color: var(--err); background: var(--err-bg); }
.btn-block { width: 100%; }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 0.84rem; gap: 5px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--tint); color: var(--text); }

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > span:first-child, .label { font-size: 0.84rem; font-weight: 580; color: var(--text-2); }
.field-inline { margin: 0; }

input, select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.94rem;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
input:disabled, select:disabled { background: var(--surface-2); color: var(--muted); }
input[type="checkbox"] { width: auto; min-height: 0; accent-color: var(--primary); }
input[type="file"] { padding: 6px; }
input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--tint);
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
}

.hint { color: var(--muted); font-size: 0.8rem; line-height: 1.45; }

/* Field password / rahasia dengan tombol mata */
.pw-field { position: relative; display: block; }
.pw-field input { padding-right: 44px; }
.pw-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.pw-toggle:hover { color: var(--text); background: var(--tint); }

/* Switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.9rem; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative;
  width: 36px;
  height: 20px;
  flex: none;
  border-radius: 99px;
  background: var(--line-strong);
  transition: background 0.18s var(--ease);
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 25%);
  transition: transform 0.18s var(--ease);
}
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--focus); }
.switch input:disabled + .switch-track { opacity: 0.45; }

.form-msg { margin: 0 0 12px; font-size: 0.88rem; color: var(--err); }
.form-msg.ok { color: var(--ok); }
.form-msg:empty { display: none; }

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 18px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--ok-bg);
  color: var(--ok);
  font-size: 0.9rem;
}
.notice.error { background: var(--err-bg); color: var(--err); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.info { background: var(--primary-soft); color: var(--primary-text); }
.notice .ic { margin-top: 2px; }

.card {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head p { margin: 4px 0 0; color: var(--muted); font-size: 0.86rem; }
.muted { color: var(--muted); }
.err-text { color: var(--err); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; background: var(--tint); color: var(--text-2); font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.pill-brand { background: var(--primary-soft); color: var(--primary-text); }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-err { background: var(--err-bg); color: var(--err); }
.pill .ic { width: 13px; height: 13px; }

/* ---------- Login ---------- */

.login {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  min-height: 100%;
}
.login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px 52px;
  background: var(--brand);
  color: #fff;
  overflow: hidden;
}
.login-brand::after {
  /* Bentuk tanda SDI sebagai elemen latar */
  content: "";
  position: absolute;
  right: -14%;
  bottom: -22%;
  width: 78%;
  aspect-ratio: 1;
  background: url("/img/mark.svg") center / contain no-repeat;
  opacity: 0.16;
  filter: saturate(1.3);
}
.login-logo { width: 150px; height: auto; position: relative; z-index: 1; }
.login-pitch { position: relative; z-index: 1; max-width: 420px; }
.login-pitch h1 { font-size: 2.15rem; line-height: 1.12; letter-spacing: -0.03em; font-weight: 640; }
.login-pitch h1 em { font-style: normal; color: #ff8fa3; }
.login-pitch p { margin: 14px 0 0; color: #cfc6ea; font-size: 1rem; max-width: 36ch; }
.login-foot { position: relative; z-index: 1; color: #a99fcb; font-size: 0.82rem; }
.login-main { display: grid; place-items: center; padding: 32px 20px; }
.login-card { width: min(380px, 100%); }
.login-card h2 { font-size: 1.35rem; letter-spacing: -0.02em; }
.login-lead { margin: 6px 0 26px; color: var(--muted); }
.login-mobile-logo { display: none; }

/* ---------- Shell ---------- */

.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100%; }

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding: 18px 12px 14px;
  background: var(--side-bg);
  color: var(--side-text);
  overflow-y: auto;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; }
.side-brand img { width: 84px; height: auto; }
.side-brand-text { padding-left: 10px; border-left: 1px solid var(--side-line); line-height: 1.25; }
.side-brand-title { color: #fff; font-weight: 640; font-size: 0.95rem; letter-spacing: -0.01em; }
.side-brand-sub { color: var(--side-muted); font-size: 0.74rem; }

.nav { display: grid; gap: 1px; }
.nav-group { margin: 18px 10px 6px; color: var(--side-muted); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.nav a, .side-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--side-text);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 520;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.nav a .ic, .side-link .ic { opacity: 0.8; }
.nav a:hover, .side-link:hover { background: var(--side-hover); color: #fff; }
.nav a.active, .side-link.active { background: var(--side-active); color: #fff; font-weight: 600; }
.nav a.active .ic, .side-link.active .ic { opacity: 1; color: #ff8fa3; }
.nav a:focus-visible, .side-link:focus-visible { box-shadow: 0 0 0 2px #ff8fa3; }

.dot { width: 7px; height: 7px; margin-left: auto; border-radius: 50%; background: var(--side-muted); opacity: 0.6; }
.dot.open { background: #4ade80; opacity: 1; }
.dot.qr, .dot.connecting { background: #fbbf24; opacity: 1; }
.dot.closed { background: #ff5c7a; opacity: 1; }

.account { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--side-line); display: grid; gap: 1px; }
.account-who { display: flex; align-items: center; gap: 10px; padding: 6px 10px 10px; }
.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
}
.account-text { min-width: 0; }
.account-name { color: #fff; font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-role { color: var(--side-muted); font-size: 0.76rem; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }

.page { width: 100%; max-width: 1080px; margin: 0 auto; padding: 34px 36px 56px; }
.page-head { margin-bottom: 24px; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }
.page-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- Tanya ---------- */

.page-ask {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 440px);
  gap: 20px;
  max-width: 1440px;
  height: 100vh;
  height: 100dvh;
  padding-top: 20px;
  padding-bottom: 18px;
}
.ask-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

/* Memori percakapan */
.conv-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 2px 10px; border-bottom: 1px solid var(--line); }
.conv-pick { position: relative; min-width: 0; flex: 1; }
.conv-current {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.conv-current:hover, .conv-current[aria-expanded="true"] { background: var(--tint); }
.conv-current span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-caret { transform: rotate(90deg); color: var(--muted); transition: transform 0.15s var(--ease); }
.conv-current[aria-expanded="true"] .conv-caret { transform: rotate(-90deg); }
.conv-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 25;
  width: min(380px, 86vw);
  max-height: min(460px, 70vh);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.conv-menu-head { padding: 10px 14px 6px; color: var(--muted); font-size: 0.74rem; font-weight: 620; letter-spacing: 0.04em; text-transform: uppercase; }
.conv-list { overflow-y: auto; padding: 0 6px 6px; }
.conv-item { display: flex; align-items: center; gap: 4px; border-radius: var(--radius-sm); }
.conv-item:hover, .conv-item.active { background: var(--tint); }
.conv-item.active .conv-open { color: var(--primary-text); }
.conv-open { flex: 1; min-width: 0; display: grid; gap: 1px; padding: 8px 8px; border: 0; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; border-radius: var(--radius-sm); }
.conv-open b { font-weight: 560; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-open span { color: var(--muted); font-size: 0.74rem; }
.conv-del { flex: none; opacity: 0; }
.conv-item:hover .conv-del, .conv-del:focus-visible { opacity: 1; }
.conv-empty { padding: 14px; color: var(--muted); font-size: 0.86rem; }
.cache-note { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cache-note .btn { min-height: 24px; padding: 0 8px; font-size: 0.74rem; }

/* Panel riwayat chat WAG */
.history {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 6px; }
.history-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.history-title h2 { font-size: 0.98rem; }
.history-title .muted { font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-close { display: none; }
.history-tools { display: flex; gap: 8px; padding: 6px 16px 12px; border-bottom: 1px solid var(--line); }
.history-tools select, .history-tools input { min-height: 32px; padding: 4px 8px; font-size: 0.84rem; }
.history-tools input { flex: 1; }
.history-tools select { flex: 1.4; }
.history-body { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 0 14px; background: var(--surface-2); outline: none; }
.history-body:focus-visible { box-shadow: inset var(--focus); }
.history-more { display: flex; justify-content: center; padding: 8px; }
.history-more .btn { font-size: 0.8rem; min-height: 28px; }
.history-day {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: center;
  padding: 8px 0 4px;
  pointer-events: none;
}
.history-day span {
  padding: 2px 10px;
  border-radius: 99px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text-2);
  font-size: 0.72rem;
  font-weight: 620;
}
.hmsg { display: grid; grid-template-columns: 40px 1fr; gap: 8px; padding: 4px 14px; font-size: 0.86rem; line-height: 1.48; scroll-margin: 60px; }
.hmsg .msg-time { font-size: 0.72rem; }
.hmsg.cont { padding-top: 0; }
.hmsg.cont .msg-sender { display: none; }
.hmsg .msg-sender { display: block; margin: 0 0 1px; font-size: 0.8rem; }
.hmsg.hl { background: var(--primary-soft); }
.hmsg.hl .msg-time { color: var(--primary-text); font-weight: 600; }
.hmsg .thumb { max-width: 200px; max-height: 160px; }
.history-empty { padding: 32px 20px; text-align: center; color: var(--muted); font-size: 0.88rem; }
.history-toggle { display: none; }
.src-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); align-items: center; }
.src-chips > span { color: var(--muted); font-size: 0.8rem; margin-right: 2px; }
.src-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--line-strong);
  border-radius: 99px;
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}
.src-chip b { display: inline-grid; place-items: center; min-width: 18px; height: 18px; border-radius: 99px; background: var(--primary-soft); color: var(--primary-text); font-size: 0.7rem; }
.src-chip:hover, .src-chip.on { border-color: var(--primary); color: var(--primary-text); }
.src-chip.on b { background: var(--primary); color: var(--on-primary); }
.thread { flex: 1; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 20px; padding: 6px 4px 20px; scroll-behavior: smooth; }

.empty-ask { margin: auto 0; padding: 28px 0; text-align: center; }
.empty-ask img { width: 56px; height: 56px; margin-bottom: 16px; }
.empty-ask h1 { font-size: 1.6rem; }
.empty-ask p { margin: 10px auto 22px; max-width: 52ch; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip {
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 99px;
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease), background 0.15s var(--ease);
}
.chip:hover { border-color: var(--primary); color: var(--primary-text); background: var(--primary-soft); }

.q-bubble {
  align-self: flex-end;
  max-width: 78%;
  padding: 10px 15px;
  border-radius: 16px 16px 4px 16px;
  background: var(--primary);
  color: var(--on-primary);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.q-filter { display: block; margin-top: 4px; font-size: 0.78rem; opacity: 0.8; }

.a-card {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 4px 16px 16px 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: rise 0.28s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
.a-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-bottom: 10px; color: var(--muted); font-size: 0.8rem; }
.a-meta > img { flex: none; }
.a-meta img { width: 18px; height: 18px; }
.a-error { color: var(--err); margin: 0; }
.a-notfound { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); }
.a-notfound .ic { color: var(--muted); margin-top: 3px; }

/* Status saat AI bekerja */
.ai-working { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; color: var(--text-2); font-size: 0.86rem; }
.ai-time { margin-left: auto; color: var(--muted); font-size: 0.76rem; }
.spinner {
  width: 16px;
  height: 16px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--primary-soft);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* Tombol kirim: ikon panah diganti lingkaran berputar selama memproses */
.btn-send.is-loading .ic { display: none; }
.btn-send.is-loading::after {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgb(255 255 255 / 35%);
  border-top-color: var(--on-primary);
  animation: spin 0.8s linear infinite;
}
.btn-send.is-loading:disabled { opacity: 1; cursor: progress; }
@media (prefers-reduced-motion: reduce) {
  /* Tanpa animasi: tetap tampilkan indikator & teks langkah */
  .spinner, .btn-send.is-loading::after { animation: none !important; border-top-color: var(--primary); }
}
.skeleton { display: grid; gap: 9px; }
.skeleton i {
  display: block;
  height: 11px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--tint) 0%, var(--line) 50%, var(--tint) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
.skeleton i:nth-child(1) { width: 62%; }
.skeleton i:nth-child(2) { width: 88%; }
.skeleton i:nth-child(3) { width: 74%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Isi jawaban (markdown) */
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md h3, .md h4 { margin: 16px 0 8px; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 20px; }
.md li { margin: 3px 0; padding-left: 2px; }
.md li::marker { color: var(--accent); }
.md ol li::marker { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.9em; }
.md ul ul, .md ol ul { margin: 4px 0 4px; }
.md strong { font-weight: 640; }
.md code { padding: 1px 5px; border-radius: 4px; background: var(--tint); }
.md pre { margin: 0 0 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--tint); overflow-x: auto; font: 0.84rem/1.5 var(--mono); }
.md .table-wrap { margin: 4px 0 14px; }
.cite {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin: 0 1px;
  padding: 0 4px;
  border: 0;
  border-radius: 5px;
  background: var(--primary-soft);
  color: var(--primary-text);
  font: 600 0.7rem/1 var(--font);
  vertical-align: 2px;
  cursor: pointer;
}
.cite:hover { background: var(--primary); color: var(--on-primary); }

.md-figure { margin: 6px 0 14px; }
.md-figure img {
  display: block;
  max-width: min(100%, 420px);
  max-height: 360px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--tint);
  cursor: zoom-in;
}
.md-figure figcaption { margin-top: 6px; color: var(--muted); font-size: 0.8rem; }

.sources { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.sources > summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-2);
  font-size: 0.86rem;
  font-weight: 580;
  cursor: pointer;
  list-style: none;
  border-radius: 5px;
}
.sources > summary::-webkit-details-marker { display: none; }
.sources > summary .ic { width: 15px; height: 15px; transition: transform 0.18s var(--ease); }
.sources[open] > summary .ic { transform: rotate(90deg); }
.sources-list { display: grid; gap: 10px; margin-top: 12px; }

.composer { padding-top: 10px; background: var(--bg); }
.composer-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 6px 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.composer-box:focus-within { border-color: var(--primary); box-shadow: var(--focus); }
.composer textarea {
  min-height: 42px;
  max-height: 200px;
  border: 0;
  box-shadow: none !important;
  resize: none;
  background: transparent;
}
.btn-send { width: 42px; min-height: 42px; padding: 0; border-radius: 10px; }
.composer-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; font-size: 0.78rem; color: var(--muted); }

.group-pick { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 0.84rem; }
.group-pick select { width: auto; max-width: 220px; min-height: 30px; padding: 3px 26px 3px 8px; font-size: 0.84rem; border-radius: 99px; }
.composer-foot { flex-wrap: wrap; }
.filter { font-size: 0.86rem; }
.filter > summary { width: fit-content; color: var(--text-2); cursor: pointer; border-radius: 4px; }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.filter-row .field { width: 170px; }

/* ---------- Potongan chat ---------- */

.chunk { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; scroll-margin: 16px; }
.chunk.flash { animation: flash 1.4s var(--ease); }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--primary); } 100% { box-shadow: 0 0 0 0 transparent; } }
.chunk-head {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  flex-wrap: wrap;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 0.8rem;
  color: var(--muted);
}
.chunk-no { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 5px; background: var(--primary-soft); color: var(--primary-text); font-weight: 650; font-size: 0.72rem; }
.chunk-range { font-weight: 600; color: var(--text); }
.score { margin-left: auto; color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.score-bar { display: inline-block; width: 38px; height: 4px; margin-left: 6px; border-radius: 99px; background: var(--line); overflow: hidden; vertical-align: middle; }
.score-bar > span { display: block; height: 100%; background: var(--primary); }
.chunk-body { max-height: 340px; overflow-y: auto; padding: 8px 0; }
.msg { display: grid; grid-template-columns: 48px 1fr; gap: 10px; padding: 4px 14px; font-size: 0.89rem; line-height: 1.5; }
.msg:hover { background: var(--surface-2); }
.msg-time { color: var(--muted); font-size: 0.76rem; font-variant-numeric: tabular-nums; padding-top: 2px; }
.msg-text { min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.msg-sender { font-weight: 620; margin-right: 5px; }
.msg-date { padding: 8px 14px 3px; color: var(--muted); font-size: 0.72rem; font-weight: 620; letter-spacing: 0.04em; text-transform: uppercase; }
.attach { display: inline-flex; align-items: center; gap: 5px; padding: 0 6px; border-radius: 5px; background: var(--tint); color: var(--text-2); font-size: 0.82rem; }
.attach .ic { width: 13px; height: 13px; }
a.attach-link { color: var(--primary-text); text-decoration: none; cursor: pointer; }
a.attach-link:hover { background: var(--primary-soft); text-decoration: underline; text-underline-offset: 2px; }

/* Teks di jawaban, bubble pertanyaan, dan riwayat chat selalu bisa diseleksi & disalin */
.thread, .q-bubble, .a-card, .md, .history-body, .chunk-body { user-select: text; -webkit-user-select: text; }
.q-bubble::selection, .q-bubble *::selection { background: rgb(255 255 255 / 38%); color: inherit; }
.a-copy { margin-left: auto; min-height: 26px; padding: 0 8px; font-size: 0.76rem; }
.thumb { display: block; margin: 6px 0 2px; max-width: 220px; max-height: 180px; border-radius: 6px; border: 1px solid var(--line); cursor: zoom-in; }

/* ---------- Tabel ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 0.89rem; }
.table th, .table td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { color: var(--muted); font-size: 0.74rem; font-weight: 620; letter-spacing: 0.04em; text-transform: uppercase; background: var(--surface-2); white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table td.r, .table th.r { text-align: right; font-variant-numeric: tabular-nums; }
.table td.num { white-space: nowrap; }
.table td.actions { text-align: right; white-space: nowrap; }
.table .sub { display: block; color: var(--muted); font-size: 0.8rem; }
.table-empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.you { color: var(--muted); font-size: 0.78rem; margin-left: 4px; }

/* ---------- Chart ---------- */

.chart { margin: 6px 0 14px; padding: 14px 16px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.chart-title { margin: 0 0 2px; font-size: 0.92rem; font-weight: 620; }
.chart-sub { margin: 0 0 8px; color: var(--muted); font-size: 0.78rem; }
.chart svg { display: block; width: 100%; height: auto; max-height: 280px; overflow: visible; }
.chart svg.pie { width: min(100%, 240px); margin: 0 auto; }
.chart text { fill: var(--muted); font: 11px var(--font); font-variant-numeric: tabular-nums; }
.chart .val { fill: var(--text-2); font-weight: 600; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .mark { transition: opacity 0.15s var(--ease); }
.chart svg:hover .mark { opacity: 0.55; }
.chart svg .mark:hover, .chart svg .mark.on { opacity: 1; }
.chart .hit { fill: transparent; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dotm { stroke: var(--surface); stroke-width: 2; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 4px 0 8px; font-size: 0.8rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.chart-foot { display: flex; justify-content: flex-end; margin-top: 4px; }
.chart-foot button { border: 0; background: none; color: var(--primary-text); font: inherit; font-size: 0.78rem; cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.chart .table-wrap { margin-top: 8px; }
.s1 { fill: var(--series-1); stroke: var(--series-1); background: var(--series-1); }
.s2 { fill: var(--series-2); stroke: var(--series-2); background: var(--series-2); }
.s3 { fill: var(--series-3); stroke: var(--series-3); background: var(--series-3); }
.s4 { fill: var(--series-4); stroke: var(--series-4); background: var(--series-4); }
.s5 { fill: var(--series-5); stroke: var(--series-5); background: var(--series-5); }
.s6 { fill: var(--series-6); stroke: var(--series-6); background: var(--series-6); }
.s0 { fill: var(--line-strong); stroke: var(--line-strong); background: var(--line-strong); }
.line.s1, .line.s2, .line.s3 { fill: none; }
.dotm.s1, .dotm.s2, .dotm.s3 { stroke: var(--surface); }

.tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.8rem;
  line-height: 1.4;
  box-shadow: var(--shadow-lg);
  max-width: 260px;
  transform: translate(-50%, calc(-100% - 10px));
}
.tooltip b { font-weight: 650; }
.tooltip .tt-row { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.tooltip .tt-row i { width: 8px; height: 8px; border-radius: 2px; }

/* ---------- Cari ---------- */

.search-form {
  display: grid;
  grid-template-columns: 1fr 150px 150px 96px auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 20px;
}
.search-form .field > span:first-child { font-size: 0.76rem; }
.search-box { position: relative; }
.search-box .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box input { padding-left: 38px; min-height: 42px; }
.result-meta { margin: 0 0 12px; color: var(--muted); font-size: 0.88rem; }
.result-meta:empty { display: none; }
.results { display: grid; gap: 14px; }
.empty-state { padding: 44px 24px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty-state h2, .empty-state h3 { color: var(--text); font-size: 0.95rem; margin-bottom: 6px; }
.empty-state p { margin: 0 auto; max-width: 48ch; }

/* ---------- Gateway ---------- */

.gw-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; margin-bottom: 16px; align-items: start; }
.gw-grid .card + .card { margin-top: 0; }
.status-line { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 99px; font-size: 0.84rem; font-weight: 620; }
.status-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.st-open { background: var(--ok-bg); color: var(--ok); }
.st-qr, .st-connecting { background: var(--warn-bg); color: var(--warn); }
.st-closed { background: var(--err-bg); color: var(--err); }
.st-off { background: var(--tint); color: var(--muted); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 9px 20px; margin: 0; font-size: 0.9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.qr-box { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; padding: 16px; border-radius: var(--radius); background: var(--tint); }
.qr-box img { width: 200px; height: 200px; border-radius: 8px; background: #fff; padding: 8px; }
.qr-box ol { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 0.9rem; }
.qr-box li { margin: 4px 0; }

.meter { height: 6px; margin-top: 7px; border-radius: 99px; background: var(--primary-soft); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 99px; background: var(--primary); }
.meter.warn > span { background: var(--warn); }
.meter.err > span { background: var(--err); }

.source-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.source-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.9rem; }

.recent .msg { grid-template-columns: 132px 1fr; padding: 8px 0; border-bottom: 1px solid var(--line); }
.recent .msg:last-child { border-bottom: 0; }
.recent .msg:hover { background: transparent; }

/* ---------- Statistik ---------- */

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.stat-label { color: var(--muted); font-size: 0.8rem; font-weight: 560; }
.stat-value { margin-top: 6px; font-size: 1.55rem; font-weight: 640; letter-spacing: -0.02em; line-height: 1.1; }
.stat-sub { margin-top: 6px; color: var(--muted); font-size: 0.78rem; }
.stat.hero { background: var(--brand); border-color: var(--brand); color: #fff; }
.stat.hero .stat-label, .stat.hero .stat-sub { color: #cfc6ea; }
.stat.hero .meter { background: rgb(255 255 255 / 16%); }
.stat.hero .meter > span { background: #ff8fa3; }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.two-col .card + .card { margin-top: 0; }

/* ---------- Form & seksi pengaturan ---------- */

.form-card { max-width: 460px; }
.settings { display: grid; gap: 16px; max-width: 760px; }
.settings .card + .card { margin-top: 0; }
.settings .card h2 { margin-bottom: 4px; }
.settings .card > p.muted { margin: 0 0 18px; font-size: 0.88rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.key-state { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; font-size: 0.86rem; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.test-results { display: grid; gap: 6px; margin-top: 14px; font-size: 0.88rem; }
.test-results div { display: flex; gap: 8px; align-items: center; }

.toolbar { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .field { margin: 0; }
.toolbar .field > span:first-child { font-size: 0.76rem; }
.toolbar select, .toolbar input { min-height: 38px; }

.add-source { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.add-source .field { margin: 0; }
.progress { display: grid; gap: 6px; margin-top: 10px; font-size: 0.86rem; }
.progress .meter { height: 8px; margin: 0; }
.job { padding: 12px 0; border-bottom: 1px solid var(--line); }
.job:last-child { border-bottom: 0; }
.job-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 0.88rem; }

.act { display: inline-flex; align-items: center; gap: 6px; font-weight: 580; }
.act .ic { width: 15px; height: 15px; color: var(--muted); }
.act.sec .ic { color: var(--err); }
.detail { color: var(--text-2); font-size: 0.84rem; max-width: 46ch; overflow-wrap: anywhere; }

/* ---------- Dialog & lightbox ---------- */

.dialog {
  width: min(460px, calc(100% - 32px));
  padding: 24px;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: rgb(18 12 34 / 50%); backdrop-filter: blur(2px); }
.dialog[open] { animation: pop 0.22s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.985); } }
.dialog-sm { width: min(400px, calc(100% - 32px)); }
.dialog h2 { margin-bottom: 14px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dialog-head h2 { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
#confirm-text { margin: 0 0 20px; color: var(--text-2); }

.lightbox { padding: 0; border: 0; background: transparent; max-width: 92vw; max-height: 92vh; }
.lightbox::backdrop { background: rgb(10 6 20 / 82%); }
.lightbox img { display: block; max-width: 92vw; max-height: 86vh; border-radius: 8px; }
.lightbox p { margin: 8px 0 0; color: #ddd6f0; text-align: center; font-size: 0.86rem; }

/* ---------- Responsif ---------- */

@media (max-width: 1180px) {
  .search-form { grid-template-columns: 1fr 1fr 96px auto; }
  .search-form .search-box { grid-column: 1 / -1; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Layar sempit: riwayat chat jadi panel geser dari kanan */
@media (max-width: 1100px) {
  .page-ask { grid-template-columns: minmax(0, 1fr); max-width: 900px; }
  .history {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 40;
    width: min(440px, 100vw);
    border-radius: 0;
    border-width: 0 0 0 1px;
    transform: translateX(100%);
    transition: transform 0.22s var(--ease);
    box-shadow: var(--shadow-lg);
    padding-top: env(safe-area-inset-top);
  }
  .history.open { transform: none; }
  .history-close { display: inline-grid; }
  .history-toggle { display: inline-flex; }
  .composer-hint { display: none; }
}

@media (max-width: 980px) {
  .gw-grid, .two-col { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-mobile-logo { display: block; width: 120px; margin-bottom: 28px; }
  .add-source { grid-template-columns: 1fr; }
  .table .hide-md { display: none; }
}

@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: 272px;
    transform: translateX(-100%);
    transition: transform 0.22s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 20; background: rgb(18 12 34 / 45%); }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 54px;
    padding: 0 8px;
    padding-top: env(safe-area-inset-top);
    background: var(--side-bg);
    color: #fff;
  }
  .topbar .icon-btn { color: #fff; }
  .topbar .icon-btn:hover { background: var(--side-hover); }
  .topbar img { width: 22px; height: 22px; }
  .topbar-title { font-weight: 620; }
  .page { padding: 22px 16px 40px; }
  .page-ask { height: calc(100dvh - 54px); padding-top: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .q-bubble { max-width: 92%; }
  .search-form { grid-template-columns: 1fr 1fr; }
  .search-form .btn { grid-column: 1 / -1; }
  .stats { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .recent .msg { grid-template-columns: 1fr; gap: 0; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .table .hide-sm { display: none; }
  .composer-foot .hide-sm { display: none; }
  .card { padding: 18px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media (forced-colors: active) {
  .chart .mark { forced-color-adjust: none; }
}

@media (hover: none) { .conv-del { opacity: 1; } }
