/* =====================================================================
   LiveSupport AI — admin design system
   Tokens → base → layout → components → pages
   ===================================================================== */

:root {
  /* palette */
  --ground: #F2F4F1;
  --panel: #FFFFFF;
  --panel-sunk: #F7F8F6;
  --ink: #15201C;
  --ink-2: #3C4A44;
  --muted: #66736D;
  --faint: #95A09A;
  --line: #DCE1DB;
  --line-strong: #C5CCC4;

  --pine: #1E6B58;
  --pine-hover: #175645;
  --pine-soft: #E3EFEA;
  --pine-ink: #0F4436;

  --signal: #E3A81B;          /* live / recording only */
  --signal-soft: #FBF1D6;
  --signal-ink: #7A5608;

  --danger: #B3402E;
  --danger-soft: #F8E6E2;
  --warn: #B86E12;
  --warn-soft: #FAEEDC;
  --info: #2D5E8C;
  --info-soft: #E3ECF5;

  /* type */
  --font: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --fs-xs: .75rem;
  --fs-sm: .8125rem;
  --fs-base: .875rem;
  --fs-md: 1rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.625rem;
  --fs-2xl: 2.125rem;

  /* shape */
  --r-panel: 12px;
  --r-control: 8px;
  --r-pill: 999px;
  --shadow-pop: 0 12px 32px -8px rgba(21, 32, 28, .22), 0 2px 6px rgba(21, 32, 28, .08);

  --sidebar-w: 248px;
  --topbar-h: 64px;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
p { margin: 0; }
a { color: var(--pine); text-decoration: none; }
a:hover { text-decoration: underline; }
code, kbd, pre { font-family: var(--mono); font-size: .8125rem; }
img { max-width: 100%; }
[x-cloak], [hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--pine); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--pine-soft); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { }
svg.lock { width: 14px; height: 14px; vertical-align: -2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--ink);
  color: #C9D3CE;
  padding: 18px 14px;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--pine); display: grid; place-items: center; position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; top: 5px; right: 5px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 2px var(--pine);
}
.brand-name { font-weight: 650; font-size: 1rem; letter-spacing: -.01em; }
.brand-sub { font-size: var(--fs-xs); color: #8FA099; }

.ws-switch svg { width: 16px; height: 16px; }
.search svg { width: 16px; height: 16px; flex: none; }
.ws-switch {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08);
  color: #fff; border-radius: var(--r-control); padding: 8px 10px; margin-bottom: 18px;
  font: inherit; cursor: pointer; text-align: left;
}
.ws-avatar { width: 24px; height: 24px; border-radius: 6px; background: #3B5A50; display: grid; place-items: center; font-size: 11px; font-weight: 700; }

.nav-group { margin-bottom: 18px; }
.nav-label { font-size: var(--fs-xs); color: #7D8D86; padding: 0 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-control);
  color: #C9D3CE; font-weight: 500; text-decoration: none;
}
.nav a svg { width: 18px; height: 18px; opacity: .8; flex: none; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.nav a.active svg { opacity: 1; color: #8FD3BD; }
.nav .count { margin-left: auto; font-size: var(--fs-xs); background: rgba(255,255,255,.1); padding: 0 7px; border-radius: var(--r-pill); }
.nav .count.hot { background: var(--signal); color: var(--ink); font-weight: 650; }

.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.usage-mini { padding: 4px 10px 12px; font-size: var(--fs-xs); color: #8FA099; }
.usage-mini .bar { height: 5px; border-radius: 3px; background: rgba(255,255,255,.1); margin: 6px 0 4px; overflow: hidden; }
.usage-mini .bar i { display: block; height: 100%; background: #8FD3BD; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 10px; color: #fff; }
.me .avatar { background: #3B5A50; color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 16px;
  padding: 0 32px; border-bottom: 1px solid var(--line); background: var(--ground);
  position: sticky; top: 0; z-index: 20;
}
.search {
  display: flex; align-items: center; gap: 8px; flex: 0 1 360px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-control); padding: 7px 10px; color: var(--muted);
}
.search input { border: 0; outline: 0; font: inherit; width: 100%; background: transparent; color: var(--ink); }
.search kbd { font-size: 11px; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; color: var(--faint); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.live-now {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px;
  border-radius: var(--r-pill); background: var(--signal-soft); color: var(--signal-ink); font-weight: 600; font-size: var(--fs-sm);
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--signal); animation: pulse 1.6s ease-out infinite; }
.topbar .menu-toggle { display: none; }

.page { padding: 28px 32px 64px; max-width: 1360px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .lede { color: var(--muted); margin-top: 6px; max-width: 64ch; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: var(--fs-sm); color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.crumbs span[aria-hidden] { color: var(--faint); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--r-control);
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink);
  font: 600 var(--fs-base)/1 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--panel-sunk); text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--pine); border-color: var(--pine); color: #fff; }
.btn-primary:hover { background: var(--pine-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #963323; }
.btn-danger-ghost { color: var(--danger); border-color: transparent; background: transparent; }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: rgba(21,32,28,.05); }
.btn-sm { height: 30px; padding: 0 10px; font-size: var(--fs-sm); }
.btn-lg { height: 44px; padding: 0 20px; font-size: var(--fs-md); }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }
.btn[disabled], .btn.is-disabled { opacity: .45; cursor: not-allowed; }

/* ---------- panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-panel); }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-head h2, .panel-head h3 { font-size: var(--fs-md); }
.panel-head .sub { color: var(--muted); font-size: var(--fs-sm); }
.panel-head .end { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.panel-body { padding: 20px; }
.panel-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.panel-flush { padding: 0; }

.grid { display: grid; gap: 20px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main-side { grid-template-columns: minmax(0, 1fr) 340px; }
.stack > * + * { margin-top: 20px; }
.stack-sm > * + * { margin-top: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- metrics ---------- */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-panel); }
.metric { padding: 18px 20px; }
.metric + .metric { border-left: 1px solid var(--line); }
.metric .label { color: var(--muted); font-size: var(--fs-sm); }
.metric .value { font-size: var(--fs-2xl); font-weight: 650; letter-spacing: -.02em; margin-top: 4px; }
.metric .value small { font-size: var(--fs-md); color: var(--muted); font-weight: 500; }
.delta { font-size: var(--fs-sm); font-weight: 600; }
.delta.up { color: var(--pine); }
.delta.down { color: var(--danger); }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px;
  border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
  background: var(--panel-sunk); color: var(--ink-2); border: 1px solid var(--line);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-green { background: var(--pine-soft); color: var(--pine-ink); border-color: transparent; }
.badge-live { background: var(--signal-soft); color: var(--signal-ink); border-color: transparent; }
.badge-live .dot { background: var(--signal); animation: pulse 1.6s ease-out infinite; }
.badge-red { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-amber { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-blue { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge-grey { background: #ECEEEA; color: var(--muted); border-color: transparent; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(227,168,27,.6); } 100% { box-shadow: 0 0 0 7px rgba(227,168,27,0); } }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: var(--fs-xs); font-weight: 600; color: var(--muted);
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel-sunk); white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FAFBF9; }
.table .cell-main { font-weight: 600; color: var(--ink); }
.table .cell-sub { color: var(--muted); font-size: var(--fs-sm); }
.table td.actions { text-align: right; white-space: nowrap; }
.table a.row-link { color: inherit; }

/* ---------- forms ---------- */
.field { display: block; }
.field + .field { margin-top: 18px; }
.field > label, .label { display: block; font-weight: 600; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: var(--fs-sm); margin-top: 6px; }
.field .hint-top { color: var(--muted); font-size: var(--fs-sm); margin: -2px 0 8px; }
.input, .select, .textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line-strong); border-radius: var(--r-control); padding: 8px 11px; min-height: 38px;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--pine); box-shadow: 0 0 0 3px var(--pine-soft); }
.input-group { display: flex; }
.input-group .input { border-radius: var(--r-control) 0 0 var(--r-control); }
.input-group .btn { border-radius: 0 var(--r-control) var(--r-control) 0; border-left: 0; height: 38px; }
.counter { float: right; font-weight: 400; color: var(--faint); font-size: var(--fs-xs); }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-row + .field, .field + .form-row, .form-row + .form-row { margin-top: 18px; }
.section-title { font-size: var(--fs-md); font-weight: 650; }
.section-desc { color: var(--muted); margin-top: 4px; }
.form-section { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px; padding: 24px 0; border-top: 1px solid var(--line); }
.form-section:first-child { border-top: 0; padding-top: 0; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 10px; background: var(--line-strong); position: relative; cursor: pointer; transition: background .15s; margin: 0; flex: none; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--pine); }
.switch input:checked::after { transform: translateX(16px); }

.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--pine); width: 16px; height: 16px; }

.choice-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.choice {
  display: block; border: 1px solid var(--line-strong); border-radius: 10px; padding: 14px; cursor: pointer; background: var(--panel);
}
.choice:hover { border-color: var(--ink-2); }
.choice.selected, .choice:has(input:checked) { border-color: var(--pine); box-shadow: 0 0 0 1px var(--pine); background: #FBFDFC; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice .title { font-weight: 650; }
.choice .desc { color: var(--muted); font-size: var(--fs-sm); margin-top: 4px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.tabs a, .tabs button {
  appearance: none; background: none; border: 0; font: 600 var(--fs-base) var(--font); color: var(--muted);
  padding: 10px 12px; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.tabs a:hover, .tabs button:hover { color: var(--ink); text-decoration: none; }
.tabs .active { color: var(--ink); border-bottom-color: var(--pine); }
.tabs .count { font-size: var(--fs-xs); background: #E6E9E4; color: var(--ink-2); padding: 0 6px; border-radius: var(--r-pill); }

.seg { display: inline-flex; background: #E6E9E4; border-radius: var(--r-control); padding: 3px; }
.seg button { appearance: none; border: 0; background: transparent; font: 600 var(--fs-sm) var(--font); color: var(--muted); padding: 5px 10px; border-radius: 6px; cursor: pointer; }
.seg button.active { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ---------- filter bar ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.filters .select, .filters .input { width: auto; min-height: 32px; padding: 4px 10px; font-size: var(--fs-sm); }
.filters .search { flex: 1 1 240px; padding: 5px 10px; }

/* ---------- avatars ---------- */
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--pine-soft); color: var(--pine-ink); flex: none; }
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }

/* ---------- alerts / callouts ---------- */
.callout { display: flex; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--panel-sunk); border: 1px solid var(--line); }
.callout svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.callout-warn { background: var(--warn-soft); border-color: #EFD6B0; color: #6E430A; }
.callout-danger { background: var(--danger-soft); border-color: #EDC6BE; color: #7C2A1D; }
.callout-info { background: var(--info-soft); border-color: #C9D8E8; color: #1F4467; }
.callout-green { background: var(--pine-soft); border-color: #C3DDD2; color: var(--pine-ink); }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(21,32,28,.45); z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--panel); border-radius: 14px; width: min(520px, 100%); box-shadow: var(--shadow-pop); max-height: calc(100vh - 32px); overflow: auto; }
.modal-lg { width: min(760px, 100%); }
.modal-head { padding: 20px 22px 0; display: flex; gap: 12px; align-items: flex-start; }
.modal-head .icon-wrap { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.modal-body { padding: 16px 22px; }
.modal-foot { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 8px; position: sticky; bottom: 0; background: var(--panel); border-radius: 0 0 14px 14px; z-index: 1; }
.modal-foot::before { content: ""; position: absolute; left: 0; right: 0; top: -12px; height: 12px; background: linear-gradient(transparent, var(--panel)); pointer-events: none; }

/* ---------- toast ---------- */
.toast-stack { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-pop); display: flex; gap: 10px; align-items: center; font-weight: 500; }
.toast svg { width: 16px; height: 16px; color: #8FD3BD; }
.toast-error { background: var(--danger); }
.toast-error svg { color: #fff; }
.toast > span { display: inline-flex; }

/* ---------- dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-pop); padding: 6px; z-index: 50; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 6px; color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; text-decoration: none; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--panel-sunk); text-decoration: none; }
.dropdown-menu svg { width: 16px; height: 16px; color: var(--muted); }
.dropdown-menu .danger { color: var(--danger); }
.dropdown-menu .danger svg { color: var(--danger); }
.dropdown-menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* ---------- empty state ---------- */
.empty { text-align: center; padding: 48px 24px; }
.empty h3 { margin-top: 12px; }
.empty p { color: var(--muted); margin: 6px auto 16px; max-width: 44ch; }

/* ---------- code ---------- */
.code { background: var(--ink); color: #D9E6E0; border-radius: 10px; padding: 14px 16px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.65; position: relative; }
.code .k { color: #8FD3BD; }
.code .s { color: #F0C868; }
.code .c { color: #7D8D86; }
.code-copy { position: absolute; top: 8px; right: 8px; }
.key-chip { font-family: var(--mono); font-size: 12px; background: var(--panel-sunk); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 12px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }

/* ---------- charts (inline svg) ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--faint); font-size: 11px; font-family: var(--font); }
.legend { display: flex; gap: 16px; font-size: var(--fs-sm); color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.hbar { display: grid; grid-template-columns: 140px 1fr 44px; gap: 12px; align-items: center; font-size: var(--fs-sm); }
.hbar + .hbar { margin-top: 10px; }
.hbar .track { height: 8px; background: #ECEEEA; border-radius: 4px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--pine); border-radius: 4px; }
.hbar .v { text-align: right; color: var(--ink-2); }

/* ---------- widget builder ---------- */
.builder { display: grid; grid-template-columns: 220px minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.builder-nav { position: sticky; top: calc(var(--topbar-h) + 20px); }
.builder-nav button {
  display: flex; align-items: center; gap: 10px; width: 100%; appearance: none; border: 0; background: none;
  padding: 9px 12px; border-radius: var(--r-control); font: 500 var(--fs-base) var(--font); color: var(--ink-2); cursor: pointer; text-align: left;
}
.builder-nav button svg { width: 17px; height: 17px; color: var(--muted); }
.builder-nav button:hover { background: rgba(21,32,28,.05); }
.builder-nav button.active { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: inset 0 0 0 1px var(--line); }
.builder-nav button.active svg { color: var(--pine); }
.builder-nav .state { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; }
.builder-nav .state.ok { background: var(--pine); }
.builder-nav .state.todo { background: var(--warn); }
.builder-preview { position: sticky; top: calc(var(--topbar-h) + 20px); }
.preview-stage {
  border-radius: var(--r-panel); border: 1px solid var(--line); overflow: hidden;
  background: repeating-linear-gradient(45deg, #EDF0EC 0 10px, #F2F4F1 10px 20px);
  height: 600px; position: relative; display: flex; align-items: flex-end; justify-content: flex-end; padding: 16px;
}

.level-card { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.level-card + .level-card { margin-top: 12px; }
.level-card header { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.level-card .grip { color: var(--faint); cursor: grab; }
.level-card .body { padding: 0 16px 16px; }
.level-meter { display: inline-flex; gap: 3px; }
.level-meter i { width: 5px; height: 14px; border-radius: 2px; background: var(--line-strong); }
.level-meter i.on { background: var(--pine); }

.rule { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-top: 1px solid var(--line); }
.rule:first-child { border-top: 0; }
.rule .rule-text { flex: 1; }
.rule .lock { color: var(--faint); width: 14px; height: 14px; }

/* ---------- widget cards ---------- */
.widget-card { display: flex; flex-direction: column; }
.widget-card .top { padding: 18px 20px 14px; display: flex; gap: 14px; align-items: flex-start; }
.widget-glyph { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; flex: none; color: #fff; }
.widget-glyph svg { width: 22px; height: 22px; }
.widget-card .stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); margin-top: auto; }
.widget-card .stats div { padding: 12px 16px; }
.widget-card .stats div + div { border-left: 1px solid var(--line); }
.widget-card .stats b { display: block; font-size: var(--fs-md); }
.widget-card .stats span { color: var(--muted); font-size: var(--fs-xs); }

.template-card { text-align: left; font: inherit; color: inherit; cursor: pointer; padding: 18px; border-radius: var(--r-panel); border: 1px solid var(--line); background: var(--panel); }
.template-card:hover { border-color: var(--ink-2); }
.template-card.selected { border-color: var(--pine); box-shadow: 0 0 0 1px var(--pine); }

/* ---------- knowledge ---------- */
.dropzone { border: 1.5px dashed var(--line-strong); border-radius: var(--r-panel); padding: 28px; text-align: center; background: var(--panel-sunk); }
.dropzone.drag { border-color: var(--pine); background: var(--pine-soft); }
.type-icon { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.type-icon svg { width: 17px; height: 17px; }
.t-article { background: #E3EFEA; color: var(--pine); }
.t-file { background: #E3ECF5; color: var(--info); }
.t-screenshot { background: #F1E6F3; color: #7A3F86; }
.t-url { background: #ECEEEA; color: var(--ink-2); }
.t-video { background: #F8E6E2; color: var(--danger); }
.t-faq { background: var(--warn-soft); color: var(--warn); }

.annotator { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #fff; cursor: crosshair; user-select: none; }
.hotspot { position: absolute; border: 2px solid var(--signal); background: rgba(227,168,27,.14); border-radius: 6px; }
.hotspot .tag { position: absolute; top: -11px; left: -11px; width: 22px; height: 22px; border-radius: 50%; background: var(--signal); color: var(--ink); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.hotspot.active { border-color: var(--pine); background: rgba(30,107,88,.14); }
.hotspot.active .tag { background: var(--pine); color: #fff; }

.editor-toolbar { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.editor-toolbar button { width: 32px; height: 32px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--ink-2); display: grid; place-items: center; font: 600 13px var(--font); }
.editor-toolbar button:hover { background: var(--panel-sunk); }
.editor-toolbar .sep { width: 1px; background: var(--line); margin: 4px 6px; }
.editor-area { width: 100%; min-height: 480px; border: 0; outline: 0; padding: 20px 24px; font: 400 15px/1.7 var(--font); color: var(--ink); resize: vertical; }

/* ---------- sessions: replay ---------- */
.session-head { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.session-head > div { padding: 14px 18px; }
.session-head > div + div { border-left: 1px solid var(--line); }
.session-head .k { color: var(--muted); font-size: var(--fs-xs); }
.session-head .v { font-weight: 600; margin-top: 2px; }

.waveline { position: relative; height: 72px; margin: 4px 0 0; }
.waveline svg { width: 100%; height: 100%; display: block; }
.waveline .marker { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); cursor: pointer; }
.waveline .marker::before { content: ""; position: absolute; top: -4px; left: -4px; width: 10px; height: 10px; border-radius: 50%; background: inherit; }
.waveline .marker.m-question { background: var(--info); }
.waveline .marker.m-unanswered { background: var(--danger); }
.waveline .marker.m-feature { background: #7A3F86; }
.waveline .marker.m-tool { background: var(--signal); }
.waveline .playhead { position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--pine); }
.timeline-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); }

.transcript { max-height: 640px; overflow-y: auto; }
.msg { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 12px 20px; }
.msg + .msg { border-top: 1px solid #EEF0EC; }
.msg .ts { font-size: var(--fs-xs); color: var(--faint); padding-top: 2px; }
.msg .who { font-size: var(--fs-xs); font-weight: 650; color: var(--muted); margin-bottom: 2px; }
.msg.ai .who { color: var(--pine); }
.msg.tool { background: #FDFAF0; }
.msg.tool .who { color: var(--signal-ink); }
.msg.flag { box-shadow: inset 3px 0 0 var(--danger); }
.msg .body { color: var(--ink); }
.msg .redacted { background: var(--ink); color: var(--ink); border-radius: 3px; padding: 0 4px; user-select: none; }
.snap { border-radius: 8px; overflow: hidden; border: 1px solid var(--line); margin-top: 8px; max-width: 360px; position: relative; }
.snap .snap-label { position: absolute; left: 8px; bottom: 8px; font-size: 11px; background: rgba(21,32,28,.8); color: #fff; padding: 2px 7px; border-radius: 4px; }

.qa-item { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.qa-item:first-child { border-top: 0; padding-top: 0; }
.qa-mark { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex: none; margin-top: 1px; }
.qa-mark svg { width: 12px; height: 12px; }
.qa-yes { background: var(--pine-soft); color: var(--pine); }
.qa-no { background: var(--danger-soft); color: var(--danger); }
.qa-feat { background: #F1E6F3; color: #7A3F86; }

.stars { display: inline-flex; gap: 1px; color: var(--signal); }
.stars svg { width: 14px; height: 14px; }
.stars .off { color: var(--line-strong); }

/* ---------- integrations ---------- */
.int-logo { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; font-size: 18px; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 6vw, 96px); background: var(--panel); }
.auth-form .inner { width: 100%; max-width: 380px; }
.auth-art { background: var(--ink); color: #E6EEEA; padding: 56px; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.auth-art h2 { font-size: 2.25rem; line-height: 1.12; max-width: 16ch; color: #fff; letter-spacing: -.02em; }
.auth-art p { color: #9FB0A8; max-width: 44ch; margin-top: 14px; font-size: var(--fs-md); }
.call-demo { margin-top: 40px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: 16px; padding: 18px; max-width: 460px; }
.call-demo .line { display: flex; gap: 10px; margin-top: 12px; font-size: var(--fs-sm); }
.call-demo .line b { color: #8FD3BD; font-weight: 600; min-width: 64px; }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .builder { grid-template-columns: 200px minmax(0, 1fr); }
  .builder-preview { display: none; }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .g-main-side { grid-template-columns: 1fr; }
  .session-head { grid-template-columns: repeat(3, 1fr); }
  .session-head > div:nth-child(4) { border-left: 0; }
  .session-head > div:nth-child(n+4) { border-top: 1px solid var(--line); }
  .form-section { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w); z-index: 90; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .topbar .menu-toggle { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .page { padding: 20px 16px 48px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(3) { border-left: 0; }
  .metric:nth-child(n+3) { border-top: 1px solid var(--line); }
  .g-2, .g-3, .g-4 { grid-template-columns: 1fr; }
  .builder { grid-template-columns: 1fr; }
  .builder-nav { position: static; display: flex; overflow-x: auto; gap: 4px; }
  .builder-nav button { width: auto; white-space: nowrap; }
  .form-row { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .search { display: none; }
  .hbar { grid-template-columns: 100px 1fr 36px; }
}

/* builder editor column is narrow: stack section intro above fields */
.builder .form-section { grid-template-columns: 1fr; gap: 14px; }

/* ---------- training ---------- */
.readiness { display: flex; gap: 24px; align-items: center; }
.readiness-dial {
  --pct: 0; --ok: var(--pine);
  width: 132px; height: 132px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--ok) calc(var(--pct) * 1%), #E6E9E4 0);
}
.readiness-dial > div { width: 104px; height: 104px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; align-content: center; text-align: center; }
.readiness-dial b { font-size: 1.75rem; letter-spacing: -.02em; line-height: 1; }
.readiness-dial span { font-size: var(--fs-xs); color: var(--muted); }

.matrix { border-collapse: separate; border-spacing: 4px; }
.matrix th { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); text-align: left; padding: 4px 6px; white-space: nowrap; }
.matrix th.col { writing-mode: vertical-rl; transform: rotate(180deg); height: 120px; vertical-align: bottom; padding: 6px 2px; }
.matrix td { padding: 0; }
.cell {
  display: grid; place-items: center; width: 46px; height: 38px; border-radius: 7px; font-size: 12px; font-weight: 650;
  text-decoration: none; color: var(--ink); background: #ECEEEA;
}
.cell:hover { outline: 2px solid var(--ink); text-decoration: none; }
.cell.pass { background: var(--pine-soft); color: var(--pine-ink); }
.cell.warn { background: var(--warn-soft); color: var(--warn); }
.cell.fail { background: var(--danger-soft); color: var(--danger); }
.cell.hard { background: var(--danger); color: #fff; }
.cell.pending { background: repeating-linear-gradient(45deg, #ECEEEA 0 6px, #F5F6F3 6px 12px); color: var(--faint); }

.chat { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.bubble { max-width: 80%; padding: 10px 14px; border-radius: 14px; }
.bubble.customer { background: var(--panel-sunk); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble.ai { align-self: flex-end; background: var(--pine-soft); border-bottom-right-radius: 4px; }
.bubble .who { font-size: var(--fs-xs); font-weight: 650; color: var(--muted); margin-bottom: 2px; display: flex; gap: 8px; align-items: center; }
.bubble .screen { font-size: var(--fs-xs); color: var(--muted); margin-top: 6px; padding: 6px 8px; background: #fff; border-radius: 6px; border: 1px dashed var(--line-strong); }
.bubble .tool { font-family: var(--mono); font-size: 11.5px; color: var(--signal-ink); background: #FDFAF0; border-radius: 6px; padding: 6px 8px; margin-bottom: 6px; white-space: pre-wrap; word-break: break-word; }
.crit + .crit { margin-top: 14px; }
.crit .bar { height: 8px; border-radius: 4px; background: #ECEEEA; overflow: hidden; margin: 6px 0 4px; }
.crit .bar i { display: block; height: 100%; }

/* ---- clients & apps ---- */
.field .error { color: var(--danger); font-size: var(--fs-sm); margin-top: 6px; }
.app-card { display: block; padding: 16px; color: inherit; transition: border-color .15s, box-shadow .15s; }
.app-card:hover { text-decoration: none; border-color: var(--pine); box-shadow: 0 2px 10px rgba(21,32,28,.06); }
.app-card.is-archived { opacity: .6; }
.app-card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.app-card-stats b { display: block; font-size: var(--fs-md); }
.app-card-stats span { font-size: var(--fs-xs); color: var(--muted); }
.app-switch-btn { display: inline-flex; align-items: center; gap: 8px; max-width: 260px; }
.app-switch-btn .dot-app { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.app-switch-menu { min-width: 260px; max-height: 60vh; overflow: auto; right: auto; left: 0; }
.app-switch-menu .grp { padding: 8px 12px 4px; font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.app-switch-menu button.on { background: var(--pine-soft); }
.surface-row { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--panel); }
.surface-row + .surface-row { margin-top: 12px; }
.surface-kind { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--info-soft); color: var(--info); }
.surface-kind svg { width: 13px; height: 13px; }
.surface-kind.link { background: var(--signal-soft); color: var(--signal-ink); }
.el-table td, .el-table th { padding: 6px 8px; font-size: var(--fs-sm); }
@media (max-width: 720px) { .app-switch-btn { max-width: 150px; } }

/* ---- session screen replay ---- */
.snap-view { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 16px; padding: 16px 20px; }
.snap-img { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #0F1714; }
.snap-img img { display: block; width: 100%; height: auto; }
.snap-box { position: absolute; border: 3px solid var(--signal); border-radius: 6px; box-shadow: 0 0 0 9999px rgba(21,32,28,.25); }
.snap-strip { display: flex; flex-direction: column; gap: 8px; max-height: 520px; overflow-y: auto; }
.snap-thumb { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 4px; cursor: pointer; text-align: left; font: inherit; }
.snap-thumb img { display: block; width: 100%; border-radius: 5px; aspect-ratio: 16/10; object-fit: cover; object-position: top; }
.snap-thumb span { display: block; font-size: var(--fs-xs); color: var(--muted); margin-top: 3px; }
.snap-thumb.on { border-color: var(--pine); box-shadow: 0 0 0 2px var(--pine-soft); }
@media (max-width: 860px) { .snap-view { grid-template-columns: 1fr; } .snap-strip { flex-direction: row; overflow-x: auto; } .snap-thumb { flex: 0 0 140px; } }
.client-mark { color: #fff; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; flex: none; }
.client-head h2 { white-space: normal; }
@media (max-width: 720px) {
  .client-head { flex-wrap: wrap; }
  .client-head > div:nth-child(2) { flex: 1 1 calc(100% - 50px); }
  .client-head .end { margin-left: 46px; }
}
.editor-toolbar .seg button { width: auto; height: auto; display: inline-block; padding: 5px 12px; }

/* ---- notifications ---- */
.notif .btn { position: relative; }
.notif-dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 2px var(--bg); }
.notif-menu { width: min(340px, calc(100vw - 32px)); padding: 6px; }
.notif-head { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 6px 10px 4px; }
.notif-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; color: inherit; text-decoration: none; }
.notif-item:hover { background: var(--panel-sunk); text-decoration: none; }
.notif-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--info-soft); color: var(--info); }
.notif-ic svg { width: 15px; height: 15px; }
.notif-ic.tone-warn { background: var(--warn-soft); color: var(--warn); }
.notif-ic.tone-danger { background: var(--danger-soft); color: var(--danger); }
.notif-text { display: block; font-size: var(--fs-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-sub { display: block; font-size: var(--fs-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
