/* ============================================================
   Torok app mockups — shared design system
   Familiar chat-app chrome (Claude/ChatGPT register), light default,
   dark via [data-theme="dark"]. Brand carryover: emerald accent, the
   caret logo. One typeface throughout (Hanken Grotesk): hierarchy comes
   from size and weight, and data uses its tabular figures.
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-side: #f7f7f5;
  --bg-raise: #ffffff;
  --bg-hover: #efefec;
  --bg-user: #f1f1ee;
  --bg-inset: #fafaf8;
  --text: #1f1f1e;
  --text-dim: #6e6e69;
  --text-faint: #a0a09a;
  --border: #e6e6e2;
  --border-strong: #d4d4cf;
  --accent: #1e9e57;
  --accent-strong: #17864a;
  --accent-soft: rgba(30, 158, 87, 0.10);
  --amber: #b7791f;
  --amber-soft: rgba(183, 121, 31, 0.12);
  --red: #c0392b;
  --red-soft: rgba(192, 57, 43, 0.10);
  --shadow: 0 1px 3px rgba(20, 20, 18, 0.07), 0 8px 24px rgba(20, 20, 18, 0.05);
  --font-ui: 'Hanken Grotesk', -apple-system, 'Segoe UI', sans-serif;
  /* "Data" text: same face, tabular figures (see .mono below). The name is
     kept so every existing var(--font-mono) rule follows along. */
  --font-mono: 'Hanken Grotesk', -apple-system, 'Segoe UI', sans-serif;
  /* Chart series — validated (dataviz six checks) against the card surface.
     Fixed assignment order: 1 emerald, 2 blue, 3 orange. Never cycle past 3. */
  --viz-1: #1e9e57;
  --viz-2: #2a78d6;
  --viz-3: #eb6834;
}

[data-theme="dark"] {
  --bg: #232320;
  --bg-side: #1b1b19;
  --bg-raise: #2a2a27;
  --bg-hover: #32322e;
  --bg-user: #32322e;
  --bg-inset: #1f1f1d;
  --text: #ececea;
  --text-dim: #a3a39c;
  --text-faint: #6e6e67;
  --border: #3a3a35;
  --border-strong: #4a4a44;
  --accent: #2ec277;
  --accent-strong: #48d18c;
  --accent-soft: rgba(46, 194, 119, 0.14);
  --amber: #d99a3d;
  --amber-soft: rgba(217, 154, 61, 0.14);
  --red: #e06052;
  --red-soft: rgba(224, 96, 82, 0.14);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
  --viz-1: #22aa66;
  --viz-2: #3987e5;
  --viz-3: #d95926;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* `hidden` always wins, even over components that set their own display. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--font-mono); }
/* Columns of numbers line up without a monospace face. */
.mono, .nav-badge, .dtable, .approval__change, .balance__num, .pack__price,
.viz text, .tag, .fresh-cap, .working__body .ln, .src-stat b, .src-prog__pct {
  font-variant-numeric: tabular-nums;
}

/* ---------- Type scale: size and weight carry the hierarchy ---------- */
h1, h2, h3, h4 { font-family: var(--font-ui); line-height: 1.2; color: var(--text); }
h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.025em; }
h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.015em; }
h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.005em; }
h4 { font-size: 13px; font-weight: 600; }
.section-title { font-size: 20px; font-weight: 700; letter-spacing: -0.015em; margin: 34px 0 12px; }
.section-title:first-child { margin-top: 0; }
.section-sub { color: var(--text-dim); font-size: 14px; margin: -6px 0 14px; }
.eyebrow {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-faint);
}

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; font-size: inherit; cursor: pointer; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- Brand ---------- */

.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand img { width: 22px; height: 22px; border-radius: 5px; }
.brand__caret {
  width: 8px; height: 15px; background: var(--accent);
  animation: blink 1.2s steps(1) infinite;
}
@media (prefers-reduced-motion: reduce) { .brand__caret { animation: none; } }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 16px; border-radius: 9px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; text-decoration: none; color: var(--text);
  transition: background 0.12s, border-color 0.12s; white-space: nowrap;
}
.field--row > .btn, .field--row > a.btn { flex-shrink: 0; }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.help { font-size: 12.5px; color: var(--text-faint); }
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-strong); }
[data-theme="dark"] .btn--primary { color: #10241a; }
.btn--quiet { background: transparent; border-color: var(--border-strong); }
.btn--quiet:hover { background: var(--bg-hover); }
.btn--ghost { background: transparent; color: var(--text-dim); }
.btn--ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn--danger { background: transparent; border-color: var(--border-strong); color: var(--red); }
.btn--danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn--block { width: 100%; }
.btn--lg { padding: 11px 20px; font-size: 15px; }
.btn--sm { padding: 5px 12px; font-size: 13px; }

/* ---------- App shell ---------- */

.shell { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 264px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--bg-side); border-right: 1px solid var(--border);
}
.sidebar__top { padding: 16px 16px 10px; }
.sidebar__new { margin: 6px 16px 14px; }
.sidebar__nav { padding: 0 8px; }
.sidebar__nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px;
  color: var(--text-dim); font-weight: 500; font-size: 14px; text-decoration: none;
}
.sidebar__nav a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.sidebar__nav a.is-active { background: var(--bg-hover); color: var(--text); font-weight: 600; }
.sidebar__nav .ico { width: 18px; text-align: center; opacity: 0.75; }

.nav-badge {
  margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent-strong);
  border-radius: 20px; padding: 1px 7px;
}

.sidebar__label {
  padding: 18px 18px 6px; font-size: 11px; font-weight: 600;
  letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-faint);
}
/* The scrolling middle of the rail: starred chats, folders, recents. */
.sidebar__chats { flex: 1; overflow-y: auto; padding-bottom: 8px; }
.sidebar__convos { padding: 0 8px; }
.sidebar__convos a {
  display: flex; align-items: center; padding: 6px 10px; border-radius: 8px;
  color: var(--text-dim); font-size: 13.5px; text-decoration: none;
}
.sidebar__convos a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__convos a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.sidebar__convos a.is-active { background: var(--bg-hover); color: var(--text); }
.sidebar__convos a span { flex: 1; min-width: 0; }
.sidebar__convos .star {
  margin-left: 6px; font-weight: 400; font-style: normal; font-size: 12.5px;
  color: var(--text-faint); visibility: hidden; cursor: pointer; line-height: 1;
}
.sidebar__convos a:hover .star { visibility: visible; }
.sidebar__convos .star.is-on { visibility: visible; color: var(--amber); }
.sidebar__convos .star:hover { color: var(--amber); }

/* Chat folders (Claude-style collapsible groups) */
.folder summary {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  border-radius: 8px; color: var(--text-dim); font-size: 13.5px; font-weight: 500;
  cursor: pointer; list-style: none; user-select: none;
}
.folder summary::-webkit-details-marker { display: none; }
.folder summary::before {
  content: ""; width: 15px; height: 15px; flex-shrink: 0;
  background: currentColor; opacity: 0.75;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1 4c0-1.1.9-2 2-2h3.1l1.5 1.7H13c1.1 0 2 .9 2 2v5.8c0 1.1-.9 2-2 2H3c-1.1 0-2-.9-2-2z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1 4c0-1.1.9-2 2-2h3.1l1.5 1.7H13c1.1 0 2 .9 2 2v5.8c0 1.1-.9 2-2 2H3c-1.1 0-2-.9-2-2z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.folder[open] summary::before { opacity: 1; }
.folder summary:hover { background: var(--bg-hover); color: var(--text); }
.folder a { padding-left: 33px !important; }
.folder.is-drop summary { background: var(--accent-soft); color: var(--accent-strong); }

.sidebar__foot { border-top: 1px solid var(--border); padding: 12px 16px; }
/* Quiet utility rows under the plan chip: Settings, Sources */
.foot-links { display: flex; flex-direction: column; gap: 1px; margin-bottom: 8px; }
.foot-links a {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px;
  border-radius: 7px; font-size: 13px; color: var(--text-dim); text-decoration: none;
}
.foot-links a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.foot-links .status { margin-left: auto; font-size: 11.5px; }
/* Plan + usage chip (footer) — the one place plan state lives in the shell */
.plan-chip {
  display: block; padding: 8px 11px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--bg-raise); margin-bottom: 10px;
}
.plan-chip:hover { text-decoration: none; border-color: var(--border-strong); background: var(--bg-hover); }
.plan-chip__row { display: flex; align-items: baseline; justify-content: space-between; }
.plan-chip__row b { font-size: 13px; color: var(--text); }
.plan-chip__up { font-size: 12px; font-weight: 600; color: var(--accent-strong); }
.plan-chip__usage { display: block; font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.plan-chip__usage .mono { font-weight: 600; }
.sidebar__user {
  display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--text-dim);
}
.sidebar__user-actions { margin-left: auto; display: inline-flex; gap: 6px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 27px; height: 27px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: transparent; color: var(--text-dim); font-size: 13px; text-decoration: none;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.sidebar__user .avatar, .acct .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-strong);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.acct .avatar--lg { width: 34px; height: 34px; font-size: 13px; }
.theme-toggle {
  margin-left: auto; border: 1px solid var(--border-strong); background: transparent;
  border-radius: 8px; padding: 4px 9px; font-size: 13px; color: var(--text-dim);
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--text); }

/* Account button + pop-up menu (footer, bottom-left) */
.acct { position: relative; }
.acct__btn {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 6px 8px; border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--text); font-size: 13.5px;
  text-align: left; cursor: pointer;
}
.acct__btn:hover { background: var(--bg-hover); }
.acct.is-open .acct__btn { background: var(--bg-hover); border-color: var(--border); }
.acct__name {
  flex: 1; min-width: 0; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.acct__caret { color: var(--text-faint); font-size: 12px; transition: transform 0.15s ease; }
.acct.is-open .acct__caret { transform: rotate(180deg); }

.acct-menu {
  position: absolute; bottom: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  padding: 6px; background: var(--bg-raise);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
}
.acct-menu__head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; }
.acct-menu__id { display: flex; flex-direction: column; min-width: 0; }
.acct-menu__id b {
  font-size: 13.5px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.acct-menu__sub {
  font-size: 12px; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.acct-menu__ws { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }
.acct-menu__ws:empty { display: none; }
.acct-menu__sep { height: 1px; background: var(--border); margin: 4px 0; }
.acct-menu__item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border: none; border-radius: 8px; background: transparent;
  font-size: 13.5px; color: var(--text-dim); text-align: left;
  cursor: pointer; text-decoration: none;
}
.acct-menu__item:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.acct-menu__item--danger { color: var(--red); }
.acct-menu__item--danger:hover { background: var(--red-soft); color: var(--red); }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.main__scroll { flex: 1; overflow-y: auto; }

/* Page (non-chat) content */
.page { max-width: 860px; margin: 0 auto; padding: 40px 32px 80px; }
.page__head { margin-bottom: 26px; }
.page__title { font-size: 30px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.15; }
.page__sub { color: var(--text-dim); margin-top: 6px; font-size: 15px; max-width: 640px; }

/* ---------- Chat ---------- */

.thread { max-width: 760px; margin: 0 auto; padding: 36px 28px 24px; }

.msg { margin-bottom: 28px; }
.msg--user { display: flex; justify-content: flex-end; }
.msg--user .msg__bubble {
  background: var(--bg-user); border-radius: 16px 16px 4px 16px;
  padding: 11px 16px; max-width: 78%;
}
.msg--assistant { max-width: 100%; }

.msg__meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-faint); margin-bottom: 8px;
}
.msg__meta .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

.working {
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-inset); margin: 10px 0 14px; font-size: 13px;
}
.working summary {
  padding: 8px 13px; color: var(--text-dim); cursor: pointer;
  list-style: none; display: flex; align-items: center; gap: 8px; font-weight: 500;
}
.working summary::before { content: "▸"; font-size: 11px; transition: transform 0.15s; }
.working[open] summary::before { transform: rotate(90deg); }
.working__body { padding: 2px 14px 10px; }
.working__body .ln {
  font-family: var(--font-mono); font-size: 12px; color: var(--text-dim);
  padding: 2px 0; display: block;
}
.working__body .ln b { color: var(--accent-strong); font-weight: 600; }

.msg__body p { margin-bottom: 12px; }
.msg__body p:last-child { margin-bottom: 0; }
.msg__body ul { margin: 0 0 12px 20px; }
.msg__body li { margin-bottom: 4px; }

/* Data tables */
.dtable-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; margin: 14px 0; }
.dtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.dtable th {
  text-align: left; font-family: var(--font-mono); font-weight: 600; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-faint);
  padding: 9px 13px; border-bottom: 1px solid var(--border); background: var(--bg-inset);
  white-space: nowrap;
}
.dtable td { padding: 8px 13px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.dtable tr:last-child td { border-bottom: none; }
.dtable .num { font-family: var(--font-mono); font-size: 12.5px; text-align: right; }
.dtable th.num { text-align: right; }
.dtable .good { color: var(--accent-strong); font-weight: 600; }
.dtable .bad { color: var(--red); font-weight: 600; }

.rows-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-dim); font-weight: 500;
  border: 1px solid var(--border); border-radius: 7px; padding: 4px 10px; background: none;
}
.rows-link:hover { background: var(--bg-hover); color: var(--text); }

/* Approval card — the one branded moment */
.approval {
  border: 1px solid var(--border-strong); border-left: 3px solid var(--accent);
  border-radius: 12px; background: var(--bg-raise); box-shadow: var(--shadow);
  margin: 16px 0; overflow: hidden;
}
.approval__head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 12px; color: var(--text-dim);
}
.approval__badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 20px; background: var(--accent-soft); color: var(--accent-strong);
}
.approval__badge--done { background: var(--bg-hover); color: var(--text-dim); }
.approval__body { padding: 14px 16px; }
.approval__change {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 15px; margin: 6px 0 10px;
}
.approval__change .from { color: var(--text-faint); text-decoration: line-through; }
.approval__change .arrow { color: var(--text-faint); }
.approval__change .to { color: var(--accent-strong); font-weight: 600; font-size: 17px; }
.approval__why { font-size: 13.5px; color: var(--text-dim); margin-bottom: 12px; }
.approval__actions { display: flex; gap: 10px; align-items: center; }
.approval__done {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; color: var(--text-dim);
}
.approval__done .check { color: var(--accent-strong); font-weight: 700; }

/* Composer */
.composer-wrap { padding: 10px 28px 22px; }
.composer {
  max-width: 760px; margin: 0 auto;
  border: 1px solid var(--border-strong); border-radius: 16px; background: var(--bg-raise);
  box-shadow: var(--shadow); padding: 12px 14px;
}
.composer textarea {
  width: 100%; border: none; background: none; resize: none;
  font-family: inherit; font-size: 15px; color: var(--text); outline: none;
}
.composer textarea::placeholder { color: var(--text-faint); }
.composer__bar { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.composer__hint { font-size: 12px; color: var(--text-faint); }
.composer__send { margin-left: auto; }
.composer-note {
  max-width: 760px; margin: 8px auto 0; text-align: center;
  font-size: 11.5px; color: var(--text-faint);
}

/* Member attribution chip */
.who {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  margin-right: 7px; font-style: normal; font-size: 9.5px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent-strong);
}
.who--alt { background: var(--amber-soft); color: var(--amber); }
.who--bot { background: var(--bg-hover); color: var(--text-dim); }

/* Similar-question nudge above the composer */
.dedup {
  max-width: 760px; margin: 0 auto 10px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border: 1px solid var(--border); border-left: 3px solid var(--amber);
  border-radius: 10px; background: var(--bg-inset);
  padding: 9px 14px; font-size: 13px; color: var(--text-dim);
}

/* Prompt chips (empty chat) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.chip {
  border: 1px solid var(--border-strong); background: var(--bg-raise);
  border-radius: 20px; padding: 7px 14px; font-size: 13.5px; color: var(--text-dim);
}
.chip:hover { background: var(--bg-hover); color: var(--text); }

/* ---------- Cards & lists (connections, billing, settings) ---------- */

.card {
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg-raise);
  padding: 18px 20px; margin-bottom: 14px;
}
.card--flush { padding: 0; overflow: hidden; }
.card__title { font-weight: 700; font-size: 16px; letter-spacing: -0.005em; margin-bottom: 3px; }
.card__sub { color: var(--text-dim); font-size: 13.5px; }

.source-row {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 20px; border-bottom: 1px solid var(--border);
}
.source-row:last-child { border-bottom: none; }
.source-row__name { font-family: var(--font-mono); font-weight: 600; font-size: 14px; }
.source-row__meta { font-size: 12.5px; color: var(--text-dim); }
.source-row__right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.status--live { color: var(--accent-strong); } .status--live::before { background: var(--accent); }
.status--syncing { color: var(--amber); } .status--syncing::before { background: var(--amber); }
.status--error { color: var(--red); } .status--error::before { background: var(--red); }
.status--off { color: var(--text-faint); } .status--off::before { background: var(--text-faint); }

/* Freshness ledger (connections) — 30-day sync history, uptime-bar style */
.fresh { display: flex; gap: 3px; margin: 10px 0 4px; }
.fresh i { flex: 1; height: 18px; border-radius: 2px; background: var(--accent); opacity: 0.8; }
.fresh i.p { background: var(--amber); }
.fresh i.f { background: var(--red); }
.fresh i.e { background: var(--bg-hover); }
.fresh-cap {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint);
}
.tbl-fresh { margin: 10px 0 2px; border-top: 1px solid var(--border); }
.tbl-fresh li {
  display: flex; justify-content: space-between; gap: 12px; list-style: none;
  padding: 7px 2px; border-bottom: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-dim);
}
.tbl-fresh li .mono { font-size: 12px; }
.src-note { font-size: 12px; color: var(--text-faint); margin-top: 8px; }

/* Progress bars */
.prog { height: 7px; border-radius: 4px; background: var(--bg-hover); overflow: hidden; }
.prog i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }

/* ---------- Forms ---------- */

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 5px; }
.field .help { font-size: 12.5px; color: var(--text-faint); margin-top: 4px; }
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field select, .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border-strong);
  border-radius: 9px; background: var(--bg-raise); color: var(--text);
  font-family: inherit; font-size: 14.5px;
}
/* Example bullets must read as empty, not as a password already typed. */
.field input[type="password"]::placeholder { color: var(--border-strong); opacity: 1; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field--row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.field--row label { margin-bottom: 2px; }

/* Toggle switch */
.switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute; inset: 0; border-radius: 22px;
  background: var(--border-strong); transition: background 0.15s; cursor: pointer;
}
.switch i::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform 0.15s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); }

/* ---------- Auth / onboarding (no shell) ---------- */

.auth-body {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 32px 20px; position: relative;
}
.auth-theme { position: absolute; top: 18px; right: 20px; }
.auth-card {
  width: 100%; max-width: 400px; border: 1px solid var(--border);
  border-radius: 16px; background: var(--bg-raise); box-shadow: var(--shadow);
  padding: 32px;
}
.auth-card--wide { max-width: 560px; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 22px; }
.auth-title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; text-align: center; margin-bottom: 6px; }
.auth-sub { text-align: center; color: var(--text-dim); font-size: 14px; margin-bottom: 22px; }
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-faint); font-size: 12px; margin: 16px 0;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-foot { text-align: center; font-size: 13px; color: var(--text-dim); margin-top: 18px; }
.stepper {
  display: flex; justify-content: center; gap: 6px; margin-bottom: 22px;
  font-size: 12px; color: var(--text-faint);
}
.stepper b { color: var(--accent-strong); }

/* ---------- Log table page ---------- */

.log-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.log-table th {
  text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-faint);
  padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--bg-inset);
}
.log-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.log-table tr:last-child td { border-bottom: none; }

/* ---------- Billing ---------- */

.balance { display: flex; align-items: baseline; gap: 10px; }
.balance__num { font-family: var(--font-mono); font-size: 34px; font-weight: 600; }
.packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 14px; }
.pack {
  border: 1px solid var(--border-strong); border-radius: 12px; padding: 16px;
  text-align: center; background: var(--bg-raise);
}
.pack--best { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); position: relative; }
.pack__tag {
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  white-space: nowrap;
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--accent); color: #fff; border-radius: 20px; padding: 2px 9px;
}
[data-theme="dark"] .pack__tag { color: #10241a; }
.pack__price { font-family: var(--font-mono); font-size: 22px; font-weight: 600; }
.pack__gets { font-size: 12.5px; color: var(--text-dim); margin: 4px 0 12px; }

/* ---------- Empty / error states ---------- */

.empty { text-align: center; padding: 70px 24px; max-width: 460px; margin: 0 auto; }
.empty__glyph { font-size: 34px; margin-bottom: 12px; opacity: 0.6; }
.empty h2 { font-size: 20px; margin-bottom: 6px; }
.empty p { color: var(--text-dim); font-size: 14px; margin-bottom: 18px; }

/* ---------- Reports library ---------- */

.rpt-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.rpt-filter {
  border: 1px solid var(--border-strong); background: var(--bg-raise);
  border-radius: 20px; padding: 5px 13px; font-size: 13px; font-weight: 500; color: var(--text-dim);
}
.rpt-filter:hover { background: var(--bg-hover); color: var(--text); }
.rpt-filter.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); font-weight: 600; }

.rpt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; perspective: 1200px; }
.rpt-card {
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg-raise);
  padding: 14px 16px 12px; display: flex; flex-direction: column;
  position: relative;
}
/* Card back: revealed by the ✎ flip — type what should change */
.rpt-back {
  position: absolute; inset: 0; z-index: 5; border-radius: 12px;
  background: var(--bg-raise); padding: 14px 16px 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.rpt-back[hidden] { display: none; }
.rpt-back textarea {
  flex: 1; resize: none; border: 1px solid var(--border-strong); border-radius: 9px;
  padding: 9px 11px; font-family: inherit; font-size: 13.5px;
  background: var(--bg-inset); color: var(--text);
}
.rpt-back textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rpt-back__bar { display: flex; align-items: center; gap: 8px; }
.rpt-back__hint { margin-left: auto; font-size: 11.5px; color: var(--text-faint); }
.rpt-card__edit {
  background: none; border: none; padding: 0 2px; line-height: 1;
  font-size: 14px; color: var(--text-faint);
}
.rpt-card__edit:hover { color: var(--accent-strong); }
.rpt-card__head { display: flex; align-items: flex-start; gap: 8px; }
.rpt-card__title { font-weight: 700; font-size: 14.5px; flex: 1; }
.rpt-card__title a { color: inherit; }
.rpt-card__star {
  background: none; border: none; padding: 0 2px; line-height: 1;
  font-size: 15px; color: var(--text-faint);
}
.rpt-card__star.is-on { color: var(--amber); }
.rpt-card__star:hover { color: var(--amber); }
.rpt-card__meta { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.rpt-card__foot {
  display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 10px;
}
.rpt-card__foot .when { font-size: 11.5px; color: var(--text-faint); margin-left: auto; font-family: var(--font-mono); }

/* Conversational chart edit — one box at the top of the Reports page */
.rpt-edit { margin-top: 10px; }
.rpt-edit--page { margin: 0 0 14px; }
.rpt-edit--page input {
  padding: 11px 14px; font-size: 14.5px;
  background: var(--bg-raise); border-color: var(--border-strong);
}
.rpt-edit input {
  width: 100%; padding: 7px 11px; border: 1px solid var(--border);
  border-radius: 9px; background: var(--bg-inset); color: var(--text);
  font-family: inherit; font-size: 13px;
}
.rpt-edit input::placeholder { color: var(--text-faint); }
.rpt-edit input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--bg-raise); }

/* Chart tiles */
.viz { margin: 12px 0 2px; }
.viz svg { display: block; width: 100%; height: auto; }
.viz text { font-family: var(--font-mono); font-size: 10px; fill: var(--text-faint); }
.viz .grid { stroke: var(--border); stroke-width: 1; }
.viz .ref { stroke: var(--text-faint); stroke-width: 1; stroke-dasharray: 3 4; }
.viz .lbl-strong { fill: var(--text-dim); font-weight: 600; }
.viz-legend {
  display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px;
  font-size: 11.5px; color: var(--text-dim);
}
.viz-legend i {
  display: inline-block; width: 10px; height: 10px; border-radius: 3px;
  margin-right: 5px; vertical-align: -1px;
}

/* ---------- Memory ---------- */

.tag {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-dim);
  background: var(--bg-inset); border: 1px solid var(--border);
  border-radius: 6px; padding: 1px 7px; white-space: nowrap;
}
.mem-row { display: flex; gap: 14px; padding: 15px 20px; border-bottom: 1px solid var(--border); }
.mem-row:last-child { border-bottom: none; }
.mem-row__body { flex: 1; min-width: 0; }
.mem-row__text { font-size: 14px; }
.mem-row__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  margin-top: 7px; font-size: 12px; color: var(--text-faint);
}
.mem-row__ctl { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }

/* Scope control: Everyone vs Just me */
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 7px; overflow: hidden; }
.seg button {
  border: none; background: transparent; font-size: 11px; font-weight: 500;
  padding: 3px 9px; color: var(--text-dim);
}
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button.is-on { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }

/* Ground rules — the always-on lens; visually the sibling of the approval card */
.card--ground { border-left: 3px solid var(--accent); }
.tag--always {
  background: var(--accent-soft); border-color: transparent; color: var(--accent-strong);
  font-family: var(--font-ui); font-weight: 600; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.tag--me {
  background: var(--amber-soft); border-color: transparent; color: var(--amber);
  font-family: var(--font-ui); font-weight: 600; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.05em;
}

/* ---------- Chats index ---------- */

.chats-search { margin-bottom: 16px; }
.chats-search input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border-strong);
  border-radius: 10px; background: var(--bg-raise); color: var(--text);
  font-family: inherit; font-size: 14.5px;
}
.chats-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chat-row { cursor: pointer; }
.chat-row:hover { background: var(--bg-inset); }
.chat-row .star { font-style: normal; font-size: 14px; color: var(--text-faint); visibility: hidden; }
.chat-row:hover .star { visibility: visible; }
.chat-row .star.is-on { visibility: visible; color: var(--amber); }

/* ---------- Actions page ---------- */

.actions-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 26px; }
.actions-head .page__head { margin-bottom: 0; flex: 1; }
.analyze-box { text-align: right; flex-shrink: 0; }
.analyze-note { font-size: 11.5px; color: var(--text-faint); margin-top: 6px; max-width: 240px; }
.section-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-faint); margin: 26px 0 10px;
}
.section-label:first-of-type { margin-top: 0; }
.section-label .nav-badge { margin-left: 0; }

/* ---------- Mockup-only chrome ---------- */

.mock-banner {
  position: fixed; bottom: 12px; right: 12px; z-index: 50;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.05em;
  color: var(--text-faint); background: var(--bg-raise); border: 1px solid var(--border);
  border-radius: 20px; padding: 3px 10px; opacity: 0.85;
}
.mock-banner a { color: var(--text-dim); }

/* ---------- Responsive ---------- */

@media (max-width: 800px) {
  .sidebar { display: none; }
  .thread, .composer { padding-left: 16px; padding-right: 16px; }
  .page { padding: 24px 18px 60px; }
}

/* ==================================================================
   UX revamp (2026-10-20): sidebar footer nav, mobile tab bar, chat row
   menu, new-chat layout, onboarding, Sources dashboard, uploads.
   ================================================================== */

/* ---------- Sidebar footer: Sources + Settings as a distinct nav ---------- */
.foot-nav { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.foot-nav__item {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg-raise);
  color: var(--text); font-size: 14px; font-weight: 600; text-decoration: none;
}
.foot-nav__item:hover { text-decoration: none; border-color: var(--border-strong); background: var(--bg-hover); }
.foot-nav__item.is-active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.foot-nav__item svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-dim); }
.foot-nav__item--sources svg { color: var(--accent-strong); }
.foot-nav__meta { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--text-dim); white-space: nowrap; }
.foot-nav__meta .dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); margin-right: 5px; vertical-align: 1px;
}
.foot-nav__meta--attn { color: var(--accent-strong); }
.foot-nav__meta--warn { color: var(--amber); }
.foot-nav__meta--warn .dot { background: var(--amber); }
.foot-nav__meta--err { color: var(--red); }
.foot-nav__meta--err .dot { background: var(--red); }

/* ---------- Mobile: bottom tab bar (the sidebar is hidden < 800px) ---------- */
.tabbar { display: none; }
@media (max-width: 800px) {
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: var(--bg-raise); border-top: 1px solid var(--border-strong);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 4px 0; font-size: 11px; font-weight: 600; color: var(--text-dim); text-decoration: none;
  }
  .tabbar a svg { width: 20px; height: 20px; }
  .tabbar a.is-active { color: var(--accent-strong); }
  .tabbar a.tabbar__sources { color: var(--accent-strong); }
  .shell { height: calc(100vh - 62px); }
}

/* ---------- Chat rail: rows with a ⋯ menu, pinned, projects ---------- */
.rail-row { position: relative; display: flex; align-items: center; }
.rail-row > a { flex: 1; min-width: 0; padding-right: 30px !important; }
.rail-row__more {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border: none; border-radius: 6px; background: transparent;
  color: var(--text-dim); font-size: 15px; line-height: 1; letter-spacing: 1px;
  opacity: 0; display: inline-flex; align-items: center; justify-content: center;
}
.rail-row:hover .rail-row__more, .rail-row__more:focus-visible,
.rail-row.is-menu-open .rail-row__more, .rail-row > a.is-active + .rail-row__more { opacity: 1; }
.rail-row__more:hover, .rail-row.is-menu-open .rail-row__more { background: var(--border); color: var(--text); }
@media (hover: none) { .rail-row__more { opacity: 1; } }
.rail-pin { margin-left: 6px; color: var(--text-faint); font-size: 11px; flex-shrink: 0; }

.menu {
  position: fixed; z-index: 80; min-width: 200px; padding: 6px;
  background: var(--bg-raise); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
}
.menu__item {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px;
  border: none; border-radius: 8px; background: transparent; color: var(--text);
  font-size: 13.5px; text-align: left;
}
.menu__item:hover, .menu__item:focus-visible { background: var(--bg-hover); outline: none; }
.menu__item svg { width: 16px; height: 16px; color: var(--text-dim); flex-shrink: 0; }
.menu__item--danger { color: var(--red); }
.menu__item--danger svg { color: var(--red); }
.menu__item--danger:hover { background: var(--red-soft); }
.menu__item .chev { margin-left: auto; color: var(--text-faint); }
.menu__item.is-current { font-weight: 600; }
.menu__item.is-current::after { content: "✓"; margin-left: auto; color: var(--accent-strong); }
.menu__sep { height: 1px; background: var(--border); margin: 4px 0; }
.menu__label { padding: 6px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); }
.menu input {
  width: 100%; padding: 7px 10px; margin: 2px 0 4px; border: 1px solid var(--border-strong);
  border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; font-size: 13.5px;
}

.project summary .count { margin-left: auto; font-size: 11.5px; color: var(--text-faint); }
.sidebar__label-btn {
  margin-left: auto; background: none; border: none; color: var(--text-faint);
  font-size: 12px; font-weight: 600; letter-spacing: normal; text-transform: none; padding: 0 2px;
}
.sidebar__label-btn:hover { color: var(--accent-strong); }

/* ---------- New chat: centered composer + example questions ---------- */
.newchat {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 28px 12vh; overflow-y: auto;
}
.newchat[hidden] { display: none; }
.newchat__title { font-size: 32px; font-weight: 800; letter-spacing: -0.025em; text-align: center; }
.newchat__sub { color: var(--text-dim); font-size: 15.5px; margin: 8px 0 26px; text-align: center; }
.newchat__slot { width: 100%; max-width: 720px; }
.newchat__slot .composer-wrap { padding: 0; }
.newchat__slot .composer textarea { min-height: 56px; font-size: 16px; }
.examples {
  width: 100%; max-width: 720px; margin-top: 18px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}
.example {
  display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg-raise); color: var(--text);
}
.example:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.example b { font-size: 14px; font-weight: 600; }
.example span { font-size: 13px; color: var(--text-dim); }
@media (max-width: 640px) { .examples { grid-template-columns: 1fr; } .newchat__title { font-size: 26px; } }

/* ---------- Onboarding (no sources connected yet) ---------- */
.onboard { flex: 1; overflow-y: auto; padding: 56px 28px 80px; }
.onboard[hidden] { display: none; }
.onboard__inner { max-width: 760px; margin: 0 auto; }
.onboard__title { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin: 10px 0 10px; }
.onboard__sub { font-size: 16px; color: var(--text-dim); max-width: 600px; }
.onboard__steps { display: flex; gap: 18px; margin: 22px 0 28px; flex-wrap: wrap; font-size: 13.5px; color: var(--text-dim); }
.onboard__steps b {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); font-size: 12px; margin-right: 7px;
}
.onboard__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.onboard__alt { margin-top: 22px; font-size: 14px; color: var(--text-dim); }
.onboard__later { margin-top: 30px; font-size: 13px; }
.onboard__later button { background: none; border: none; color: var(--text-faint); text-decoration: underline; padding: 0; }
@media (max-width: 720px) { .onboard__grid { grid-template-columns: 1fr; } .onboard__title { font-size: 28px; } }

/* ---------- Sources dashboard ---------- */
.page--wide { max-width: 1080px; }
.src-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.src-head .page__head { margin-bottom: 0; flex: 1; min-width: 260px; }
.src-summary { display: flex; gap: 10px; flex-wrap: wrap; margin: -10px 0 18px; }
.src-summary__pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 20px;
  background: var(--bg-inset); border: 1px solid var(--border); font-size: 13px; color: var(--text-dim);
}
.src-summary__pill b { color: var(--text); font-weight: 700; }

.src-panel {
  border: 1px solid var(--border); border-radius: 16px; background: var(--bg-side);
  padding: 16px; margin-bottom: 34px;
}
.src-panel__empty {
  border: 1.5px dashed var(--border-strong); border-radius: 12px; padding: 30px 20px;
  text-align: center; color: var(--text-dim); font-size: 14.5px;
}
.src-panel__empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }
.src-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 14px; }

.src-card {
  border: 1px solid var(--border); border-radius: 14px; background: var(--bg-raise);
  padding: 16px 18px 14px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow);
}
.src-card--importing { border-color: var(--accent); }
.src-card--error { border-color: var(--red); }
.src-card--paused { border-color: var(--amber); }
.src-card__head { display: flex; align-items: flex-start; gap: 12px; }
.src-logo {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 800; font-size: 15px;
  background: var(--accent-soft); color: var(--accent-strong); letter-spacing: -0.02em;
}
.src-logo--meta { background: rgba(42, 120, 214, 0.12); color: var(--viz-2); }
.src-logo--amazon { background: var(--amber-soft); color: var(--amber); }
.src-logo--muted { background: var(--bg-hover); color: var(--text-faint); }
.src-card__name { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.src-card__acct { font-size: 12.5px; color: var(--text-dim); margin-top: 1px; }
.src-card__head .pill { margin-left: auto; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 20px;
  background: var(--bg-hover); color: var(--text-dim);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill--live { background: var(--accent-soft); color: var(--accent-strong); }
.pill--importing { background: var(--accent-soft); color: var(--accent-strong); }
.pill--importing::before { animation: pulse 1.2s ease-in-out infinite; }
.pill--paused { background: var(--amber-soft); color: var(--amber); }
.pill--error { background: var(--red-soft); color: var(--red); }
.pill--soon::before { display: none; }
@keyframes pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .pill--importing::before { animation: none; } }

.src-prog { display: flex; flex-direction: column; gap: 6px; }
.src-prog__row { display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--text-dim); }
.src-prog__pct { font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.src-prog__eta { margin-left: auto; }
.src-prog .prog { height: 8px; }
.src-done {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent-strong); font-size: 13.5px; font-weight: 600;
}
.src-done svg { width: 18px; height: 18px; flex-shrink: 0; }
.src-alert {
  padding: 9px 12px; border-radius: 10px; font-size: 13px;
  background: var(--red-soft); color: var(--red);
}
.src-alert--warn { background: var(--amber-soft); color: var(--amber); }

.src-stats { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr) minmax(0, 0.8fr); gap: 8px; }
.src-stat { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.src-stat span { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); }
.src-stat b { font-size: 13.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.src-actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 12px; border-top: 1px solid var(--border); }
.src-actions .btn svg { width: 15px; height: 15px; }
.src-actions .btn--danger { margin-left: auto; }
.src-history { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.src-history[hidden] { display: none; }
.src-history select, .src-tile select, .src-picker select {
  padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--bg-raise); color: var(--text); font: inherit; font-size: 13px;
}
.src-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.src-picker select { flex: 1; min-width: 180px; }

.src-tile {
  border: 1px solid var(--border); border-radius: 14px; background: var(--bg-raise);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 10px;
}
.src-tile--soon { background: var(--bg-inset); }
.src-tile--soon .src-card__name { color: var(--text-dim); }
.src-tile__desc { font-size: 13px; color: var(--text-dim); flex: 1; }
.src-tile__foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.src-tile__foot .btn { margin-left: auto; }
.src-tile__foot select { flex: 1; min-width: 0; max-width: 220px; }
.src-tile label { font-size: 12px; color: var(--text-faint); font-weight: 600; }

/* ---------- Upload zone ---------- */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: 14px; background: var(--bg-inset);
  padding: 26px 22px; display: flex; gap: 20px; align-items: center; flex-wrap: wrap;
  transition: border-color 0.12s, background 0.12s;
}
.dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone__icon {
  width: 46px; height: 46px; border-radius: 12px; background: var(--bg-raise); border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; color: var(--accent-strong); flex-shrink: 0;
}
.dropzone__icon svg { width: 22px; height: 22px; }
.dropzone__text { flex: 1; min-width: 220px; }
.dropzone__text b { font-size: 15.5px; display: block; }
.dropzone__text span { font-size: 13.5px; color: var(--text-dim); }
.examples-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.examples-list > div { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--bg-raise); }
.examples-list b { font-size: 13.5px; display: block; margin-bottom: 3px; }
.examples-list p { font-size: 12.5px; color: var(--text-dim); }
.example-cols { margin-top: 12px; font-size: 12.5px; color: var(--text-dim); }
.example-cols .tag { margin: 2px 2px 0 0; font-family: var(--font-ui); }
@media (max-width: 760px) {
  .examples-list { grid-template-columns: 1fr; }
  .src-stats { grid-template-columns: 1fr 1fr; }
  .src-panel { padding: 8px; border-radius: 14px; }
  .src-card { padding: 14px; }
}

.upload-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.upload-row:first-child { border-top: none; }
.upload-row__name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-row__meta { font-size: 12.5px; color: var(--text-dim); }
.upload-row .pill { margin-left: auto; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow); max-width: calc(100vw - 32px);
}
@media (max-width: 800px) { .toast { bottom: 80px; } }

/* ---------- 2FA settings row ---------- */
.tfa-status { font-size: 13px; font-weight: 600; }

/* ---------- Staff console + staff view of a workspace ---------- */
.staff-tabs { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.staff-tabs .seg button { font-size: 13px; padding: 6px 14px; }
.staff-tabs .btn { margin-left: auto; }
.view-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 70; height: 38px;
  display: flex; align-items: center; justify-content: center; gap: 14px; padding: 0 16px;
  background: var(--amber); color: #1f1400; font-size: 13.5px;
}
.view-banner a { color: #1f1400; font-weight: 700; text-decoration: underline; }
.view-banner button {
  border: 1px solid rgba(0, 0, 0, 0.35); background: rgba(255, 255, 255, 0.35); color: #1f1400;
  border-radius: 7px; padding: 3px 10px; font-weight: 700; font-size: 12.5px;
}
body.has-view-banner { padding-top: 38px; }
body.has-view-banner .shell { height: calc(100vh - 38px); }
@media (max-width: 800px) {
  .view-banner { font-size: 12px; gap: 8px; }
  .view-banner > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.has-view-banner .shell { height: calc(100vh - 38px - 62px); }
}
