/* ============================================================
   Dashboard backend — shell, conversations, knowledge, widget,
   analytics, team, billing, settings.
   Loads after styles.css + pages.css; only adds new rules.
   ============================================================ */

/* ===== shell layout ===== */
.dash--app { grid-template-columns: 264px 1fr; min-height: 100vh; }
@media (max-width: 1100px) { .dash--app { grid-template-columns: 220px 1fr; } }
@media (max-width: 880px)  { .dash--app { grid-template-columns: 1fr; } }

.dash--app .dash__side {
  padding: 18px 14px 14px;
  gap: 2px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.dash__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 14px;
  margin-bottom: 6px;
}
.dash__brand .nav__logo-mark { width: 26px; height: 26px; }
/* synthesise the wordmark beside the mark in the sidebar */
.dash__brand-word::before {
  content: "praat";
  font-family: "Geist", -apple-system, sans-serif;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.dash__brand-word::after {
  content: "box";
  font-family: var(--font-display);
  font-style: italic;
  font-size: 21px;
  color: var(--accent);
  letter-spacing: -0.02em;
}

/* workspace switcher button */
.dash__team {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  margin-bottom: 14px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  transition: background 0.12s;
}
.dash__team:hover { background: color-mix(in oklab, var(--ink) 4%, var(--paper)); }
.dash__team-avatar { width: 28px; height: 28px; border-radius: 7px; }
.dash__team-name { font-weight: 500; font-size: 13.5px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash__team-plan { font-size: 10px; color: var(--muted); font-family: var(--font-mono); letter-spacing: 0.06em; margin-top: 2px; }

.dash__nav { display: flex; flex-direction: column; gap: 1px; }
.dash__nav-group { padding: 14px 12px 6px; }
.dash__nav-item {
  text-decoration: none;
  font-size: 13.5px;
  padding: 8px 12px;
}
.dash__nav-dot { width: 7px; height: 7px; border-radius: 2px; flex-shrink: 0; }

.dash__side-foot {
  margin-top: auto;
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dash__trial {
  padding: 12px;
  border-radius: 10px;
  background: color-mix(in oklab, var(--accent) 8%, var(--paper));
  border: 1px solid color-mix(in oklab, var(--accent) 22%, transparent);
  margin-bottom: 8px;
}
.dash__trial-bar { height: 4px; border-radius: 2px; background: color-mix(in oklab, var(--accent) 18%, transparent); overflow: hidden; }
.dash__trial-bar > div { height: 100%; background: var(--accent); }
.dash__side-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
}
.dash__side-link:hover { color: var(--ink); background: color-mix(in oklab, var(--ink) 4%, transparent); }
.dash__chip {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 1px 6px;
  border-radius: 999px;
}

/* col + top bar */
.dash__col { display: flex; flex-direction: column; min-width: 0; }
.dash__top {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in oklab, var(--paper) 96%, transparent);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.dash__search {
  flex: 1;
  max-width: 540px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 9px;
  background: var(--paper-2);
  border: 1px solid transparent;
  color: var(--muted);
  transition: border-color 0.12s, background 0.12s;
}
.dash__search:focus-within { background: var(--paper); border-color: var(--accent); }
.dash__search input { flex: 1; background: none; border: none; outline: none; font: inherit; font-size: 13.5px; color: var(--ink); }
.dash__search input::placeholder { color: var(--muted); }
.dash__kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  color: var(--muted);
}

.dash__top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.dash__icon-btn {
  position: relative;
  width: 36px; height: 36px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  display: grid; place-items: center;
}
.dash__icon-btn:hover { background: var(--paper-2); color: var(--ink); }
.dash__icon-dot {
  position: absolute;
  top: 8px; right: 9px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--paper);
}
.dash__profile {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}
.dash__profile:hover { background: var(--paper-2); }
.dash__profile-av {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
}

/* main column padding override (replaces pages.css default for shell) */
.dash--app .dash__main { padding: 32px 40px; }
@media (max-width: 880px) { .dash--app .dash__main { padding: 24px; } }

/* ===== shared building blocks ===== */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
}
.page-head__title {
  font-family: var(--font-display);
  font-size: clamp(32px, 3.4vw, 44px);
  letter-spacing: -0.02em;
  line-height: 1.02;
  margin: 0;
}
.page-head__title em { font-style: italic; color: var(--accent); }
.page-head__sub { color: var(--muted); margin-top: 8px; font-size: 14px; max-width: 60ch; }
.page-head__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 24px;
}
.tabs button {
  background: none;
  border: none;
  padding: 12px 16px;
  font: inherit;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.is-active { color: var(--ink); border-bottom-color: var(--ink); }

.seg {
  display: inline-flex;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  padding: 2px;
  background: var(--paper-2);
}
.seg button {
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.seg button.is-active { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.04); }

.empty {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 56px 24px;
  text-align: center;
  color: var(--muted);
  background: var(--paper);
}
.empty__title { color: var(--ink); font-family: var(--font-display); font-size: 22px; letter-spacing: -0.01em; margin-bottom: 6px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-2);
  border: 1px solid var(--line-soft);
}
.pill.is-ok    { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill.is-warn  { background: #fff3e0; color: #c4532b; border-color: transparent; }
.pill.is-error { background: #fde7e3; color: #b6422a; border-color: transparent; }
.pill.is-info  { background: #e8efff; color: #2f5dc1; border-color: transparent; }
[data-theme="dark"] .pill.is-warn  { background: #3a2a1c; color: #e9a37a; }
[data-theme="dark"] .pill.is-error { background: #3a1f1c; color: #e08272; }
[data-theme="dark"] .pill.is-info  { background: #1c2538; color: #8aa9e6; }
.pill__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ===== Conversations inbox (THE BEEF) ===== */
.inbox {
  display: grid;
  grid-template-columns: 320px 1fr 320px;
  gap: 0;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  overflow: hidden;
  height: calc(100vh - 60px - 64px - 60px); /* topbar + page-head + margin */
  min-height: 640px;
}
@media (max-width: 1280px) { .inbox { grid-template-columns: 280px 1fr 0; } .inbox__ctx { display: none; } }
@media (max-width: 980px)  { .inbox { grid-template-columns: 1fr; } .inbox__list { display: none; } }

.inbox__list {
  border-right: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper-2);
}
.inbox__filters {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.inbox__filter {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
}
.inbox__filter.is-active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.inbox__filter-count { margin-left: 6px; opacity: 0.7; }

.inbox__items { flex: 1; overflow-y: auto; }
.inbox__item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  background: var(--paper-2);
}
.inbox__item:hover { background: var(--paper); }
.inbox__item.is-active { background: var(--paper); }
.inbox__item.is-active::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
}
.inbox__item-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.inbox__item-name { font-weight: 500; font-size: 13.5px; }
.inbox__item-time { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.inbox__item-msg {
  font-size: 12.5px;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}
.inbox__item-meta { display: flex; gap: 6px; align-items: center; margin-top: 2px; }
.inbox__item.is-unread .inbox__item-name::after {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  margin-left: 8px;
  vertical-align: middle;
}

/* thread (middle column) */
.inbox__thread { display: flex; flex-direction: column; min-width: 0; }
.thread__head {
  padding: 16px 24px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.thread__head-name { font-family: var(--font-display); font-size: 22px; letter-spacing: -0.01em; }
.thread__head-meta { display: flex; gap: 10px; align-items: center; margin-top: 4px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.thread__head-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); }
.thread__head-actions { display: flex; gap: 6px; }

.thread__summary {
  margin: 16px 24px 0;
  padding: 14px 16px;
  background: color-mix(in oklab, var(--accent) 6%, var(--paper));
  border: 1px solid color-mix(in oklab, var(--accent) 18%, transparent);
  border-radius: 12px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.5;
}
.thread__summary-icon {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid; place-items: center;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}
.thread__summary strong { color: var(--ink); }

.thread__body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.thread__day {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  margin: 8px 0;
  position: relative;
}
.thread__day::before, .thread__day::after {
  content: ""; position: absolute; top: 50%; width: 38%; height: 1px; background: var(--line-soft);
}
.thread__day::before { left: 0; }
.thread__day::after { right: 0; }

.msg { display: flex; gap: 10px; max-width: 76%; }
.msg__av {
  width: 28px; height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--paper-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.msg__av.is-ai { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.msg__av.is-agent { background: var(--ink); color: var(--paper); border-color: transparent; }
.msg__bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  background: var(--paper-2);
  color: var(--ink);
  border-top-left-radius: 4px;
}
.msg__meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); margin-top: 4px; letter-spacing: 0.04em; }
.msg.is-out { margin-left: auto; flex-direction: row-reverse; }
.msg.is-out .msg__bubble { background: var(--ink); color: var(--paper); border-top-left-radius: 14px; border-top-right-radius: 4px; }
.msg.is-out .msg__meta { text-align: right; }
.msg.is-ai .msg__bubble { background: color-mix(in oklab, var(--accent) 10%, var(--paper)); border: 1px solid color-mix(in oklab, var(--accent) 24%, transparent); }
.msg__cite {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  padding: 1px 7px 1px 6px;
  border-radius: 999px;
  color: var(--accent);
  margin: 2px 4px 0 0;
  text-decoration: none;
}
.msg__cite::before { content: "📄"; filter: grayscale(1); }
.msg__voice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}
.msg__voice-play {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: grid; place-items: center;
  border: none;
  cursor: pointer;
}
.msg__voice-wave { display: flex; gap: 2px; align-items: center; }
.msg__voice-wave span { width: 2px; background: currentColor; border-radius: 1px; opacity: 0.7; }

/* internal note */
.msg.is-note .msg__bubble {
  background: #fffbe8;
  color: #5a4318;
  border: 1px solid #e8d574;
  font-size: 13px;
}
[data-theme="dark"] .msg.is-note .msg__bubble { background: #2a2412; color: #d8c483; border-color: #524014; }

.thread__compose {
  border-top: 1px solid var(--line-soft);
  padding: 14px 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--paper);
}
.thread__compose-tabs { display: flex; gap: 4px; }
.thread__compose-tabs button {
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.thread__compose-tabs button.is-active { background: var(--ink); color: var(--paper); }
.thread__compose-tabs button.is-note.is-active { background: #d4a015; color: #1f1804; }

.suggested-reply {
  border: 1px solid color-mix(in oklab, var(--accent) 26%, transparent);
  background: color-mix(in oklab, var(--accent) 7%, var(--paper));
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.suggested-reply__head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: uppercase;
}
.suggested-reply__text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}
.suggested-reply__actions { display: flex; gap: 6px; flex-wrap: wrap; }

.thread__editor {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  padding: 4px;
  display: flex;
  flex-direction: column;
}
.thread__editor textarea {
  border: none;
  background: none;
  outline: none;
  font: inherit;
  font-size: 14px;
  padding: 12px;
  resize: none;
  min-height: 64px;
  color: var(--ink);
}
.thread__editor-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px 6px 12px;
}
.thread__editor-tools { display: flex; gap: 2px; }
.thread__editor-tool {
  width: 30px; height: 30px;
  border-radius: 7px;
  display: grid; place-items: center;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.thread__editor-tool:hover { background: var(--paper-2); color: var(--ink); }

/* context panel (right) */
.inbox__ctx {
  border-left: 1px solid var(--line-soft);
  padding: 20px;
  overflow-y: auto;
  background: var(--paper);
}
.ctx-block { padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.ctx-block:first-child { padding-top: 0; }
.ctx-block:last-child { border-bottom: none; }
.ctx-block h4 {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}
.ctx-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; gap: 12px; }
.ctx-row span:first-child { color: var(--muted); }
.ctx-row span:last-child { color: var(--ink); text-align: right; max-width: 60%; word-break: break-word; }
.ctx-tag-list { display: flex; flex-wrap: wrap; gap: 6px; }

.ctx-customer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-bottom: 16px;
  text-align: center;
}
.ctx-customer__av {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 24px;
}
.ctx-customer__name { font-family: var(--font-display); font-size: 22px; letter-spacing: -0.01em; }
.ctx-customer__sub { font-size: 12.5px; color: var(--muted); font-family: var(--font-mono); }
.ctx-customer__buttons { display: flex; gap: 6px; margin-top: 4px; }

.ctx-history {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ctx-history__item {
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  font-size: 12.5px;
  color: var(--ink-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ctx-history__item-msg { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-history__item-time { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); }

/* ===== Knowledge ===== */
.kb__layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 1100px) { .kb__layout { grid-template-columns: 1fr; } }

.src-table {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  overflow: hidden;
}
.src-row {
  display: grid;
  grid-template-columns: 32px 1fr 110px 110px 90px 80px;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px;
}
.src-row:last-child { border-bottom: none; }
.src-row.is-head {
  background: var(--paper-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 16px;
}
.src-row__icon {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: var(--paper-2);
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-2);
  font-weight: 600;
}
.src-row__name { font-weight: 500; }
.src-row__url { color: var(--muted); font-family: var(--font-mono); font-size: 11.5px; margin-top: 2px; word-break: break-all; }
.src-row__pages { font-family: var(--font-mono); color: var(--muted); }
.src-row__synced { font-family: var(--font-mono); color: var(--muted); font-size: 12px; }
.src-row__actions { display: flex; gap: 4px; justify-content: flex-end; }

@media (max-width: 880px) {
  .src-row { grid-template-columns: 32px 1fr 80px; gap: 10px; }
  .src-row__pages, .src-row__synced, .src-row__actions { display: none; }
  .src-row.is-head { grid-template-columns: 32px 1fr 80px; }
}

/* test playground */
.kb-play {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.kb-play__title { font-family: var(--font-display); font-size: 22px; letter-spacing: -0.01em; margin: 0; }
.kb-play__sub { color: var(--muted); font-size: 13px; margin: -10px 0 0; }
.kb-play__input {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  overflow: hidden;
}
.kb-play__input input {
  flex: 1;
  border: none;
  outline: none;
  padding: 12px 14px;
  font: inherit;
  font-size: 14px;
  background: none;
  color: var(--ink);
}
.kb-play__input button {
  border: none;
  background: var(--ink);
  color: var(--paper);
  padding: 0 18px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.kb-play__answer {
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kb-play__cites { display: flex; flex-wrap: wrap; gap: 6px; }

/* gaps */
.gap-list { display: flex; flex-direction: column; gap: 8px; }
.gap {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  align-items: start;
}
.gap__q { font-size: 14px; font-weight: 500; }
.gap__meta { font-size: 12px; color: var(--muted); margin-top: 4px; font-family: var(--font-mono); }
.gap__act { display: flex; gap: 6px; }

/* ===== Widget configurator ===== */
.cfg__layout {
  display: grid;
  grid-template-columns: 1fr 580px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 1280px) { .cfg__layout { grid-template-columns: 1fr; } }

.cfg-section {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  margin-bottom: 16px;
  overflow: hidden;
}
.cfg-section__head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--paper-2);
}
.cfg-section__title { font-family: var(--font-display); font-size: 20px; letter-spacing: -0.01em; margin: 0; }
.cfg-section__sub { font-size: 12.5px; color: var(--muted); margin: 4px 0 0; }
.cfg-section__body { padding: 20px; display: flex; flex-direction: column; gap: 18px; }

.cfg-row { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: start; }
@media (max-width: 720px) { .cfg-row { grid-template-columns: 1fr; gap: 6px; } }
.cfg-row__lbl { font-size: 13.5px; padding-top: 10px; }
.cfg-row__hint { font-size: 12px; color: var(--muted); margin-top: 4px; max-width: 28ch; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
}
.swatch.is-active { border-color: var(--ink); box-shadow: 0 0 0 2px var(--paper) inset; }

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  gap: 16px;
}
.toggle-row:last-child { border-bottom: none; padding-bottom: 0; }
.toggle-row__lbl-title { font-size: 14px; font-weight: 500; }
.toggle-row__lbl-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; max-width: 42ch; }
.tog {
  width: 36px; height: 22px;
  background: var(--line);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.tog::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: white;
  transition: transform 0.18s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.tog.is-on { background: var(--accent); }
.tog.is-on::after { transform: translateX(14px); }

.snippet {
  background: var(--ink);
  color: var(--paper);
  border-radius: 12px;
  overflow: hidden;
}
.snippet__tabs {
  display: flex;
  gap: 0;
  padding: 0 8px;
  background: color-mix(in oklab, var(--ink) 80%, var(--paper-2));
  border-bottom: 1px solid color-mix(in oklab, white 12%, transparent);
}
.snippet__tabs button {
  background: none;
  border: none;
  font: inherit;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 10px 14px;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.snippet__tabs button.is-active { color: white; border-bottom-color: var(--accent); }
.snippet__body {
  padding: 18px 20px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre;
  overflow-x: auto;
}
.snippet__body .tok-tag    { color: #ff8c66; }
.snippet__body .tok-attr   { color: #f0c674; }
.snippet__body .tok-str    { color: #b6e88c; }
.snippet__body .tok-com    { color: rgba(255,255,255,0.45); font-style: italic; }
.snippet__copy {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid color-mix(in oklab, white 12%, transparent);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: rgba(255,255,255,0.55);
}
.snippet__copy button {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  color: white;
  font: inherit;
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}

/* live preview frame */
.cfg-preview {
  position: sticky;
  top: 76px;
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cfg-preview__chrome {
  border-radius: 12px;
  overflow: hidden;
  background: white;
  border: 1px solid var(--line);
  height: 540px;
  position: relative;
  background:
    repeating-linear-gradient(135deg, color-mix(in oklab, var(--ink) 4%, transparent) 0 1px, transparent 1px 14px),
    var(--paper);
}
.cfg-preview__chrome-bar {
  height: 28px;
  background: color-mix(in oklab, var(--paper) 92%, var(--ink) 4%);
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
}
.cfg-preview__chrome-bar i {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--line);
  display: block;
}
.cfg-preview__chrome-url {
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}
.cfg-preview__widget {
  position: absolute;
  bottom: 18px; right: 18px;
  width: 360px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 12px 40px -10px rgba(0,0,0,0.18), 0 4px 12px -4px rgba(0,0,0,0.06);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

/* ===== Analytics ===== */
.an-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}
.an-card {
  grid-column: span 6;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 20px;
}
.an-card.is-wide { grid-column: span 12; }
.an-card.is-third { grid-column: span 4; }
@media (max-width: 980px) { .an-card, .an-card.is-third, .an-card.is-wide { grid-column: span 12; } }

.an-card h3 { font-family: var(--font-display); font-size: 22px; letter-spacing: -0.01em; margin: 0; }
.an-card__sub { color: var(--muted); font-size: 13px; margin: 4px 0 18px; }

.line {
  height: 200px;
  position: relative;
  margin-top: 8px;
}
.line svg { width: 100%; height: 100%; display: block; }

.heatmap { display: grid; grid-template-columns: 60px repeat(24, 1fr); gap: 2px; align-items: center; }
.heatmap__lbl { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); padding-right: 6px; text-align: right; }
.heatmap__hr  { font-family: var(--font-mono); font-size: 9.5px; color: var(--muted); text-align: center; padding: 4px 0 0; }
.heatmap__cell { aspect-ratio: 1; border-radius: 2px; background: color-mix(in oklab, var(--accent) 6%, var(--paper-2)); }

.csat-bars { display: flex; align-items: end; gap: 12px; height: 160px; padding: 12px 0; }
.csat-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.csat-bar__b { width: 100%; background: var(--accent); border-radius: 6px 6px 0 0; min-height: 4px; }
.csat-bar__b.is-low { background: color-mix(in oklab, var(--accent) 30%, var(--paper-2)); color: var(--ink-2); }
.csat-bar__lbl { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); }

/* ===== Team ===== */
.team-table {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  overflow: hidden;
}
.team-row {
  display: grid;
  grid-template-columns: 36px 1fr 160px 130px 100px 40px;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.team-row:last-child { border-bottom: none; }
.team-row.is-head {
  background: var(--paper-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 16px;
}
.team-row__av {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--paper-2);
  color: var(--ink);
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  border: 1px solid var(--line);
}
.team-row__name { font-weight: 500; font-size: 14px; }
.team-row__email { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.role-pick {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}
@media (max-width: 880px) {
  .team-row { grid-template-columns: 36px 1fr 80px; }
  .team-row.is-head { grid-template-columns: 36px 1fr 80px; }
  .team-row > :nth-child(n+5) { display: none; }
}

/* ===== Billing ===== */
.bill-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 980px) { .bill-grid { grid-template-columns: 1fr; } }

.plan-card {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 24px;
}
.plan-card__name { font-family: var(--font-display); font-size: 28px; letter-spacing: -0.01em; }
.plan-card__name em { color: var(--accent); font-style: italic; }
.plan-card__price { font-family: var(--font-display); font-size: 44px; letter-spacing: -0.02em; line-height: 1; margin: 14px 0 4px; }
.plan-card__price-unit { font-size: 14px; color: var(--muted); font-family: var(--font-mono); }

.usage-bar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.usage-bar:last-child { border-bottom: none; }
.usage-bar__head { display: flex; justify-content: space-between; font-size: 13px; }
.usage-bar__head em { font-family: var(--font-display); font-style: italic; color: var(--accent); font-size: 17px; }
.usage-bar__bar {
  height: 6px;
  border-radius: 3px;
  background: var(--paper-2);
  overflow: hidden;
}
.usage-bar__fill { height: 100%; background: var(--accent); }
.usage-bar__fill.is-warn { background: #c4532b; }
.usage-bar__sub { font-size: 11.5px; color: var(--muted); font-family: var(--font-mono); }

.invoice-list {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  overflow: hidden;
}
.invoice {
  display: grid;
  grid-template-columns: 1fr 1fr 90px 90px 70px;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  align-items: center;
  font-size: 13.5px;
}
.invoice:last-child { border-bottom: none; }
.invoice.is-head { background: var(--paper-2); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 12px 16px; }
.invoice__num { font-family: var(--font-mono); }
.invoice__amt { text-align: right; font-family: var(--font-mono); }

.payment-card {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cc-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--paper-2);
  border-radius: 10px;
}
.cc-strip__brand {
  width: 42px; height: 28px;
  border-radius: 6px;
  background: linear-gradient(135deg, #1a1f71 0%, #0a378b 100%);
  color: white;
  display: grid; place-items: center;
  font-weight: 700;
  font-style: italic;
  font-size: 13px;
}
.cc-strip__num { font-family: var(--font-mono); font-size: 14px; letter-spacing: 0.04em; }
.cc-strip__exp { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }

/* ===== Settings ===== */
.settings__layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  align-items: start;
}
@media (max-width: 880px) { .settings__layout { grid-template-columns: 1fr; } }
.settings__nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 76px; }
.settings__nav button {
  text-align: left;
  background: none;
  border: none;
  padding: 8px 12px;
  font: inherit;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
}
.settings__nav button.is-active { background: var(--ink); color: var(--paper); }
.settings__nav button:hover:not(.is-active) { background: var(--paper-2); color: var(--ink); }

.settings-card {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 16px;
}
.settings-card h3 { font-family: var(--font-display); font-size: 22px; letter-spacing: -0.01em; margin: 0 0 4px; }
.settings-card .sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.settings-card.is-danger { border-color: #d97757; }
.settings-card.is-danger h3 { color: #d97757; }

/* api keys table */
.key-row {
  display: grid;
  grid-template-columns: 1fr 1fr 110px 110px 60px;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
  align-items: center;
  font-size: 13px;
}
.key-row:last-child { border-bottom: none; }
.key-row__name { font-weight: 500; }
.key-row__key { font-family: var(--font-mono); color: var(--muted); }


/* ============================================================
   Generic page primitives — used by Dashboard / Analytics /
   Billing / Team / Settings. Extends the dash shell.
   ============================================================ */

/* color tokens these pages reference */
:root {
  --ink-3: color-mix(in oklab, var(--ink) 35%, var(--paper));
  --ok:    #1b6e3b;
  --err:   #c4532b;
}
[data-theme="dark"] :root,
[data-theme="dark"] {
  --ink-3: color-mix(in oklab, var(--ink) 50%, var(--paper));
  --ok:    #4ea66c;
  --err:   #e08272;
}

/* btn--paper — for use on dark inverted callouts */
.btn--paper {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid transparent;
}
.btn--paper:hover {
  background: color-mix(in oklab, var(--paper) 92%, var(--ink) 6%);
}

/* Generic card wrapper */
.card {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
}

/* 2-col row of cards */
.row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 0;
}
.row-2col > .card { margin-bottom: 24px; }
@media (max-width: 1100px) { .row-2col { grid-template-columns: 1fr; } }

/* KPI strip */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .kpi-grid { grid-template-columns: 1fr; } }

.kpi-card {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.kpi-card__label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}
.kpi-card__value {
  font-family: var(--font-display);
  font-size: 36px;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-top: 4px;
}
.kpi-card__value em { font-style: italic; color: var(--accent); }
.kpi-card__delta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ok);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

/* Field input (used in Settings + Configurator) */
.field-input {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  outline: none;
  transition: border-color 0.12s;
}
.field-input:focus { border-color: var(--accent) !important; }

/* ============================================================
   Billing — hero panel + invoice table
   ============================================================ */
.bill-hero {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 0;
  background: var(--ink);
  color: var(--paper);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 24px;
}
@media (max-width: 980px) { .bill-hero { grid-template-columns: 1fr; } }

.bill-hero__plan {
  padding: 32px 36px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bill-hero__title {
  font-family: var(--font-display);
  font-size: 32px;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.bill-hero__sub {
  color: rgba(255,255,255,0.7);
  font-size: 13.5px;
  line-height: 1.5;
  max-width: 50ch;
}
.bill-hero__price {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-top: 12px;
}
.bill-hero__price-num {
  font-family: var(--font-display);
  font-size: 56px;
  letter-spacing: -0.03em;
  line-height: 1;
  color: white;
}
.bill-hero__price-suffix {
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.04em;
}

.bill-hero__usage {
  padding: 28px 32px;
  background: rgba(255,255,255,0.04);
  border-left: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
}
@media (max-width: 980px) {
  .bill-hero__usage { border-left: none; border-top: 1px solid rgba(255,255,255,0.08); }
}

/* usage-bar inside the hero (white/translucent on dark) */
.bill-hero__usage .usage-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  overflow: hidden;
  margin-top: 8px;
}
.bill-hero__usage .usage-bar__fill {
  height: 100%;
  background: white;
  border-radius: 999px;
}

/* invoice table */
.invoice-table {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  overflow: hidden;
}
.invoice-row {
  display: grid;
  grid-template-columns: 1fr 1fr 110px 110px 1fr;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  align-items: center;
  font-size: 13.5px;
}
.invoice-row:last-child { border-bottom: none; }
.invoice-row.is-head {
  background: var(--paper-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 16px;
}

@media (max-width: 880px) {
  .invoice-row { grid-template-columns: 1fr 1fr 90px; gap: 8px; font-size: 13px; }
  .invoice-row > :nth-child(n+4) { display: none; }
  .invoice-row.is-head { grid-template-columns: 1fr 1fr 90px; }
}

/* ============================================================
   Team — member cards
   ============================================================ */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.member {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.member__head {
  display: grid;
  grid-template-columns: 44px 1fr 28px;
  gap: 12px;
  align-items: center;
}
.member__av {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--paper-2);
  color: var(--ink);
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--line);
  position: relative;
}
.member__status {
  position: absolute;
  bottom: -1px; right: -1px;
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid var(--paper);
}
.member__status.is-online  { background: #16a34a; }
.member__status.is-away    { background: #f59e0b; }
.member__status.is-offline { background: #9ca3af; }

.member__name { font-weight: 500; font-size: 14.5px; line-height: 1.1; }
.member__email { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.member__meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.member__stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px;
  color: var(--ink-2);
}

/* ============================================================
   Settings — 2-col layout
   ============================================================ */
.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
  align-items: start;
}
@media (max-width: 880px) { .settings-layout { grid-template-columns: 1fr; } }

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 76px;
}
.settings-nav button {
  text-align: left;
  background: none;
  border: none;
  padding: 8px 12px;
  font: inherit;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
}
.settings-nav button.is-active {
  background: var(--ink);
  color: var(--paper);
}
.settings-nav button:hover:not(.is-active) {
  background: var(--paper-2);
  color: var(--ink);
}
