@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Inter+Tight:wght@500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

* { box-sizing: border-box; }

:root {
  color-scheme: light;
  --font-display: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* brand accent — purple */
  --brand-50:  rgb(245,240,255);
  --brand-100: rgb(236,224,255);
  --brand-400: rgb(202,168,255);
  --brand-500: rgb(188,148,255);
  --brand-600: rgb(157,110,240);
  --brand-700: rgb(124,79,209);
  --text-brand: rgb(124,79,209);
  --text-on-brand: rgb(255,255,255);

  --text-primary:   rgb(15,23,42);
  --text-secondary: rgb(55,65,81);
  --text-tertiary:  rgb(107,114,128);
  --text-placeholder: rgb(156,163,175);

  --surface:        rgb(255,255,255);
  --surface-subtle: rgb(249,250,251);
  --surface-muted:  rgb(247,245,251);

  --border:         rgb(233,234,235);
  --border-strong:  rgb(209,213,219);

  --success:  rgb(34,197,94);
  --success-bg: rgb(220,252,231);
  --warning:  rgb(245,158,11);
  --warning-bg: rgb(254,243,199);
  --error:    rgb(239,68,68);
  --error-bg: rgb(254,226,226);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px rgba(10,13,18,0.05);
  --shadow-sm: 0 1px 3px rgba(10,13,18,0.10), 0 1px 2px rgba(10,13,18,0.06);
  --shadow-md: 0 4px 8px -2px rgba(10,13,18,0.10), 0 2px 4px -2px rgba(10,13,18,0.06);
  --shadow-lg: 0 12px 16px -4px rgba(10,13,18,0.08), 0 4px 6px -2px rgba(10,13,18,0.03);
  --shadow-focus: 0 0 0 4px rgba(188,148,255,0.16);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --text-primary: rgb(240,240,241);
  --text-secondary: rgb(206,207,210);
  --text-tertiary: rgb(148,151,156);
  --text-placeholder: rgb(97,101,108);
  --surface: rgb(28,31,38);
  --surface-subtle: rgb(22,24,30);
  --surface-muted: rgb(15,17,21);
  --border: rgb(55,58,65);
  --border-strong: rgb(83,88,98);
  --brand-50: rgba(188,148,255,0.14);
}

html, body { margin: 0; padding: 0; }
html { background: var(--surface-muted); }
html[data-theme="dark"], html[data-theme="dark"] body { background: rgb(15,17,21); }

body {
  font-family: var(--font-body);
  background: var(--surface-muted);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font-family: inherit; color: inherit; }
a { color: inherit; }
::placeholder { color: var(--text-placeholder); }

#app { display: flex; min-height: 100vh; background: var(--surface-muted); }

/* ── Sidebar ─────────────────────────────────────────────────────── */
.sidebar {
  width: 236px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width 0.18s ease;
  overflow: hidden;
}
.sidebar.collapsed { width: 68px; }
.sidebar-header {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 16px 16px; min-height: 34px;
}
.sidebar.collapsed .sidebar-header { justify-content: center; padding: 22px 10px 16px; }
.sidebar-header img { height: 26px; width: auto; display: block; }
.sidebar.collapsed .sidebar-header img { height: 28px; margin: 0 auto; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; }
.sidebar-spacer { flex: 1; }
.sidebar-collapse-row { padding: 8px 12px 8px; display: flex; }
.sidebar-footer { padding: 8px 12px 16px; border-top: 1px solid var(--border); }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; height: 40px; padding: 0 10px;
  border: none; background: transparent; border-radius: var(--radius-md);
  cursor: pointer; font-family: var(--font-body); font-size: 14px; font-weight: 500;
  color: var(--text-secondary); text-align: left; white-space: nowrap;
}
.nav-item:hover { background: var(--surface-subtle); }
.nav-item.active { background: var(--brand-50); color: var(--text-brand); }
.nav-item svg { flex-shrink: 0; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 0; }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600; font-family: var(--font-body);
  cursor: pointer; border: 1px solid transparent; white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13px; }
.btn-primary { background: var(--brand-600); color: var(--text-on-brand); }
.btn-primary:hover:not(:disabled) { background: var(--brand-700); }
.btn-secondary { background: var(--surface); color: var(--text-primary); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-subtle); }
.btn-tertiary { background: transparent; color: var(--text-secondary); }
.btn-tertiary:hover:not(:disabled) { background: var(--surface-subtle); }
.btn-destructive.btn-secondary { color: var(--error); border-color: var(--error-bg); }
.btn-destructive.btn-secondary:hover:not(:disabled) { background: var(--error-bg); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-md);
  border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--text-secondary);
}
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.secondary { border-color: var(--border-strong); background: var(--surface); }
.icon-btn.primary { background: var(--brand-600); color: #fff; }
.icon-btn.tertiary:hover { background: var(--surface-subtle); }
.icon-btn:hover:not(.primary) { background: var(--surface-subtle); }
.icon-btn:focus-visible, .btn:focus-visible, .nav-item:focus-visible, button:focus-visible, input:focus-visible, [contenteditable]:focus-visible, .settings-nav-btn:focus-visible {
  outline: none; box-shadow: var(--shadow-focus); border-radius: var(--radius-md);
}

/* ── Topbar ──────────────────────────────────────────────────────── */
.topbar {
  height: 68px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 28px;
  position: sticky; top: 0; z-index: 20;
}
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-tertiary); }
.breadcrumb a { text-decoration: none; color: var(--text-tertiary); cursor: pointer; }
.breadcrumb a:hover { color: var(--text-primary); }
.breadcrumb .current { color: var(--text-primary); font-weight: 500; }

/* ── Page shells ─────────────────────────────────────────────────── */
.page { padding: 28px; display: flex; flex-direction: column; gap: 24px; }
.page-title { font-family: var(--font-display); font-weight: 600; font-size: 28px; letter-spacing: -0.02em; margin: 0 0 4px; }
.page-sub { margin: 0; color: var(--text-tertiary); font-size: 14px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }

/* ── Dashboard ───────────────────────────────────────────────────── */
.status-card {
  padding: 20px 22px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.live-dot { width: 10px; height: 10px; border-radius: 9999px; background: var(--error); box-shadow: 0 0 0 4px var(--error-bg); flex-shrink: 0; animation: pulse-dot 1.6s ease-in-out infinite; }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.featured-icon { width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--surface-subtle); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--text-tertiary); flex-shrink: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; height: 110px; justify-content: center; }
.stat-card .row1 { display: flex; align-items: center; justify-content: space-between; }
.stat-card .label { font-size: 13px; color: var(--text-tertiary); font-weight: 500; }
.stat-card .value { font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: -0.01em; }
.stat-card .caption { font-size: 12px; color: var(--text-tertiary); }
.stat-card .icon-wrap { width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--brand-50); color: var(--text-brand); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ── Toolbar / filters ───────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search-input-wrap { position: relative; flex: 1 1 240px; max-width: 420px; }
.search-input-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-tertiary); pointer-events: none; }
.search-input {
  width: 100%; height: 40px; padding: 0 12px 0 38px; border-radius: var(--radius-md);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-primary);
  font-size: 14px; outline: none;
}
.search-input:focus { border-color: var(--brand-500); box-shadow: var(--shadow-focus); }

.segmented { display: inline-flex; align-items: center; background: var(--surface-subtle); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 2px; gap: 2px; }
.segmented button {
  border: none; background: transparent; height: 34px; padding: 0 14px; border-radius: 6px;
  font-size: 13px; font-weight: 500; color: var(--text-secondary); cursor: pointer; font-family: var(--font-body); white-space: nowrap;
}
.segmented button.active { background: var(--surface); color: var(--text-primary); box-shadow: var(--shadow-xs); font-weight: 600; }

.date-popover {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; width: 340px; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 16px;
}
.date-popover-mask { position: fixed; inset: 0; z-index: 39; }
.date-field { display: flex; flex-direction: column; gap: 5px; flex: 1 1 140px; min-width: 140px; }
.date-field label { font-size: 12px; font-weight: 500; color: var(--text-tertiary); }
.date-field input {
  height: 40px; padding: 0 10px; border-radius: var(--radius-md); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-primary); font-size: 13px; outline: none;
}
.date-field input:focus { border-color: var(--brand-500); box-shadow: var(--shadow-focus); }

/* ── Meetings table ──────────────────────────────────────────────── */
.mtg-table { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.mtg-head, .mtg-row-main {
  display: grid; grid-template-columns: 2.3fr 0.95fr 0.75fr 0.85fr 1.5fr 40px; gap: 12px; align-items: center;
}
.mtg-head { padding: 11px 20px; background: var(--surface-subtle); border-bottom: 1px solid var(--border); }
.mtg-head button {
  display: flex; align-items: center; gap: 4px; background: none; border: none; padding: 0; cursor: pointer;
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--text-tertiary); font-family: var(--font-body);
}
.mtg-head button:hover { color: var(--text-primary); }
.mtg-row { border-bottom: 1px solid var(--border); }
.mtg-row:last-child { border-bottom: none; }
.mtg-row-main { padding: 14px 20px; cursor: pointer; }
.mtg-row-main:hover { background: var(--surface-subtle); }
.mtg-title { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.mtg-company { font-size: 12px; color: var(--text-tertiary); }
.mtg-cell { font-size: 13px; color: var(--text-secondary); }
.mtg-duration { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 13px; color: var(--text-secondary); }
.mtg-platform { display: flex; align-items: center; gap: 7px; }
.mtg-platform img { flex-shrink: 0; display: block; }
.mtg-interviewer { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mtg-interviewer .name { font-size: 13px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtg-interviewer .email { font-size: 12px; color: var(--text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
mark { background: rgba(188,148,255,0.34); color: inherit; border-radius: 3px; padding: 0 1px; }

.mtg-expanded { background: var(--surface-muted); border-top: 1px solid var(--border); padding: 22px 24px; display: flex; flex-direction: column; gap: 18px; }
.mtg-expanded-cols { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 28px; }
.col-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; color: var(--text-tertiary); }
.col-heading svg { flex-shrink: 0; }
.col-heading span.label { font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--text-primary); }
.highlights-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 9px; }
.highlights-list.bullet { padding-left: 18px; list-style: disc; }
.highlights-list li { font-size: 13.5px; line-height: 19px; color: var(--text-secondary); }

.action-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px; border-radius: 8px; }
.action-item:hover { background: var(--surface); }
.action-item .txt { flex: 1; min-width: 0; cursor: pointer; font-size: 13.5px; line-height: 19px; }
.action-item .txt.done { color: var(--text-placeholder); text-decoration: line-through; }
.action-item .txt:not(.done) { color: var(--text-secondary); }
.action-item-edit-row { flex: 1; display: flex; gap: 6px; }
.text-input {
  font-size: 13.5px; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--brand-500);
  outline: none; font-family: var(--font-body); background: var(--surface); color: var(--text-primary);
}
.new-item-row { display: flex; gap: 6px; margin-top: 4px; }
.new-item-row input {
  flex: 1; font-size: 13.5px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-strong);
  outline: none; font-family: var(--font-body); background: var(--surface); color: var(--text-primary);
}
.new-item-row input:focus, .text-input:focus { box-shadow: var(--shadow-focus); }

.fmt-toolbar { display: flex; gap: 4px; margin-bottom: 6px; }
.fmt-btn {
  width: 28px; height: 28px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 6px;
  cursor: pointer; font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; justify-content: center;
}
.fmt-btn:hover { background: var(--surface-subtle); }
.fmt-btn.b { font-weight: 700; }
.fmt-btn.i { font-style: italic; }

.comment-editor {
  width: 100%; min-height: 120px; overflow-y: auto; font-size: 13.5px; line-height: 19px;
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border-strong); outline: none;
  color: var(--text-secondary); background: var(--surface);
}
.comment-editor.modal-size { min-height: 100px; }
.comment-editor.detail-size { min-height: 140px; }
.comment-editor:empty:before { content: attr(data-placeholder); color: var(--text-placeholder); pointer-events: none; }
.comment-editor ul, .comment-editor ol { margin: 4px 0; padding-left: 22px; }
.comment-editor:focus { border-color: var(--brand-500); box-shadow: var(--shadow-focus); }

.view-details-row { display: flex; justify-content: flex-end; }

/* ── Modal ───────────────────────────────────────────────────────── */
.modal-mask { position: fixed; inset: 0; background: rgba(15,17,21,0.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 24px; }
.modal-box { background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 24px 0; }
.modal-head-icon { width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--brand-50); color: var(--text-brand); display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-right: 4px; }
.modal-title { font-family: var(--font-display); font-weight: 600; font-size: 18px; margin: 0; }
.modal-desc { font-size: 13px; color: var(--text-tertiary); margin: 3px 0 0; }
.modal-close { flex-shrink: 0; }
.modal-body { padding: 18px 24px 24px; overflow-y: auto; }

/* ── Tabs ────────────────────────────────────────────────────────── */
.tabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--border); }
.tabs button {
  border: none; background: transparent; padding: 9px 4px; margin-right: 20px; font-size: 14px; font-weight: 500;
  color: var(--text-tertiary); cursor: pointer; font-family: var(--font-body); position: relative; top: 1px;
  border-bottom: 2px solid transparent;
}
.tabs button.active { color: var(--text-brand); border-bottom-color: var(--brand-600); font-weight: 600; }

/* ── Checkbox / Toggle ───────────────────────────────────────────── */
.checkbox-wrap { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox {
  width: 20px; height: 20px; border-radius: 5px; border: 1.5px solid var(--border-strong); background: var(--surface);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer;
}
.checkbox.checked { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.checkbox-label { font-size: 14px; color: var(--text-primary); }

.toggle { width: 44px; height: 24px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; border: none; flex-shrink: 0; transition: background 0.15s ease; }
.toggle.checked { background: var(--brand-600); }
.toggle .knob { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 999px; background: #fff; transition: left 0.15s ease; box-shadow: var(--shadow-xs); }
.toggle.checked .knob { left: 23px; }

/* ── Select ──────────────────────────────────────────────────────── */
.select-wrap { position: relative; }
.select-btn {
  width: 100%; min-width: 220px; height: 48px; padding: 0 14px; border-radius: var(--radius-md);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-primary);
  font-size: 13.5px; text-align: left; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.select-btn:hover { border-color: var(--text-tertiary); }
.select-menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50; max-height: 260px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 4px;
}
.select-menu button {
  width: 100%; text-align: left; border: none; background: transparent; padding: 9px 10px; border-radius: 6px;
  font-size: 13.5px; color: var(--text-primary); cursor: pointer; font-family: var(--font-body);
}
.select-menu button:hover { background: var(--surface-subtle); }
.select-menu button.active { color: var(--text-brand); font-weight: 600; background: var(--brand-50); }

/* ── Badge ───────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.badge.violet { background: var(--brand-100); color: var(--text-brand); }

/* ── Empty state ─────────────────────────────────────────────────── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 48px 24px; gap: 12px; color: var(--text-tertiary); min-height: 220px; }
.empty-state .icon-wrap { width: 48px; height: 48px; border-radius: 999px; background: var(--surface-subtle); display: flex; align-items: center; justify-content: center; color: var(--text-tertiary); }
.empty-state .title { font-weight: 600; font-size: 15px; color: var(--text-primary); }
.empty-state .desc { font-size: 13px; max-width: 320px; }

/* ── File upload ─────────────────────────────────────────────────── */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); min-height: 120px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  padding: 16px; cursor: pointer; color: var(--text-tertiary); background: var(--surface-subtle);
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand-500); background: var(--brand-50); }
.dropzone .main { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.dropzone .hint { font-size: 12px; }
.dropzone-file { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 14px; background: var(--surface-subtle); }
.dropzone-file .name { font-size: 13.5px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.form-field input[type="text"] {
  width: 100%; font-size: 14px; padding: 11px 13px; border-radius: 8px; border: 1px solid var(--border-strong);
  outline: none; color: var(--text-primary); background: var(--surface);
}
.form-field input:focus { border-color: var(--brand-500); box-shadow: var(--shadow-focus); }

/* ── Detail (old) page ───────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 24px; align-items: flex-start; }
.detail-panel { padding: 22px; }

/* ── Settings ────────────────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 200px 1fr; gap: 28px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 88px; }
.settings-nav-btn {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: none; border-radius: 8px;
  cursor: pointer; font-family: var(--font-body); font-size: 14px; font-weight: 500; text-align: left;
  background: transparent; color: var(--text-secondary);
}
.settings-nav-btn.active { background: var(--brand-50); color: var(--text-brand); }
.settings-nav-btn:hover:not(.active) { background: var(--surface-subtle); }
.settings-section { display: flex; flex-direction: column; gap: 20px; }
.settings-card { padding: 22px; }
.settings-card-title { font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.settings-card-desc { margin: 4px 0 0; font-size: 13px; color: var(--text-tertiary); }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-top: 1px solid var(--border); }
.settings-row:first-of-type { border-top: none; }
.settings-row .row-title { font-weight: 600; font-size: 14px; }
.settings-row .row-desc { font-size: 12.5px; color: var(--text-tertiary); margin-top: 2px; }
.settings-conn-row { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-top: 1px solid var(--border); }
.settings-conn-row:first-of-type { border-top: none; }
.conn-icon { width: 40px; height: 40px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-subtle); }
.lang-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.lang-row:first-of-type { border-top: none; }
.pin-btn { display: flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); background: transparent; border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: var(--font-body); color: var(--text-tertiary); }
.pin-btn.default { background: var(--brand-500); color: #fff; border-color: var(--brand-500); }
.checkbox-group { display: flex; flex-direction: column; gap: 12px; }
.storage-row { display: flex; gap: 8px; align-items: center; }
.storage-row input {
  flex: 1; font-family: var(--font-mono); font-size: 12.5px; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border-strong); outline: none; color: var(--text-secondary); background: var(--surface-subtle);
}

/* ── Pagination ──────────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 6px; }
.pagination button { height: 32px; min-width: 32px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); font-size: 13px; cursor: pointer; }
.pagination button.active { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: 1fr; }
  .mtg-expanded-cols { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}

/* ── Onboarding / Login / Sign-up ──────────────────────────────── */
@keyframes onb-fade-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes onb-scale-in {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes onb-check-pop {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}

.onboarding-shell {
  min-height: 100vh;
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-muted);
  padding: 24px;
  position: relative;
  box-sizing: border-box;
}
.onboarding-shell .theme-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
}
.onboarding-shell .back-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 10;
}

.onboarding-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: onb-fade-in 0.45s ease both;
}
.onboarding-card.wide { max-width: 520px; }
.onboarding-card.welcome {
  max-width: 440px;
  text-align: center;
  align-items: center;
  background: transparent;
  border: none;
  box-shadow: none;
  gap: 32px;
}
.onboarding-card.ready {
  max-width: 480px;
  text-align: center;
  align-items: center;
}

.onboarding-logo { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 8px; }
.onboarding-logo img.mark { height: 72px; width: auto; display: block; animation: onb-scale-in 0.5s ease both; }
.onboarding-logo img.wordmark { height: 39px; width: auto; display: block; }

.onboarding-header { display: flex; flex-direction: column; gap: 6px; }
.onboarding-header.center { text-align: center; align-items: center; }
.onboarding-mark { width: 48px; height: 48px; display: block; margin: 0 auto 4px; }
.onboarding-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text-primary);
}
.onboarding-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}
.onboarding-tagline {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.onboarding-form { display: flex; flex-direction: column; gap: 16px; }
.onboarding-form .form-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.onboarding-form .form-field label .forgot-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-brand);
  cursor: pointer;
  text-decoration: none;
}
.onboarding-form .form-field label .forgot-link:hover { text-decoration: underline; }
.onboarding-form .form-field input[type="text"],
.onboarding-form .form-field input[type="email"],
.onboarding-form .form-field input[type="password"] {
  width: 100%;
  font-size: 14px;
  padding: 11px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  outline: none;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.onboarding-form .form-field input:focus {
  border-color: var(--brand-500);
  box-shadow: var(--shadow-focus);
}
.onboarding-form .form-field .input-icon-wrap {
  position: relative;
}
.onboarding-form .form-field .input-icon-wrap > svg.field-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
  z-index: 2;
}
.onboarding-form .form-field .input-icon-wrap > input,
.onboarding-form .form-field .input-icon-wrap .password-wrap input {
  padding-left: 40px;
}

.password-wrap { position: relative; width: 100%; }
.password-wrap input { width: 100%; padding-right: 44px !important; }
.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-tertiary);
  transition: color 0.12s ease;
}
.password-toggle:hover { color: var(--text-primary); }

.onboarding-form .btn-primary {
  width: 100%;
  height: 44px;
  font-size: 15px;
}

.onboarding-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
}
.onboarding-divider::before,
.onboarding-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.onboarding-social-row { display: flex; gap: 10px; }
.social-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.social-btn:hover { background: var(--surface-subtle); border-color: var(--text-tertiary); }
.social-btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.social-btn svg.social-logo { width: 18px; height: 18px; flex-shrink: 0; }

.onboarding-footer {
  font-size: 13px;
  color: var(--text-tertiary);
  text-align: center;
}
.onboarding-footer .link {
  color: var(--text-brand);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.onboarding-footer .link:hover { text-decoration: underline; }

.onboarding-buttons { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 340px; }
.onboarding-buttons .btn { width: 100%; height: 44px; font-size: 15px; }

/* Platform connect */
.onboarding-connectors { display: flex; flex-direction: column; gap: 0; width: 100%; }
.onboarding-conn-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}
.onboarding-conn-row:first-child { border-top: none; }
.onboarding-conn-icon {
  width: 44px; height: 44px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-subtle);
}
.onboarding-conn-icon img { width: 24px; height: 24px; display: block; }
.onboarding-conn-info { flex: 1; min-width: 0; }
.onboarding-conn-name { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.onboarding-conn-status { font-size: 12.5px; color: var(--text-tertiary); margin-top: 1px; }

/* Ready screen */
.onboarding-check-circle {
  width: 64px; height: 64px;
  border-radius: 9999px;
  background: var(--brand-50);
  color: var(--brand-600);
  display: flex; align-items: center; justify-content: center;
  animation: onb-check-pop 0.5s ease both 0.15s;
}
.onboarding-features { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 340px; }
.onboarding-feature-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: left;
  animation: onb-fade-in 0.4s ease both;
}
.onboarding-feature-pill:nth-child(1) { animation-delay: 0.2s; }
.onboarding-feature-pill:nth-child(2) { animation-delay: 0.35s; }
.onboarding-feature-pill:nth-child(3) { animation-delay: 0.5s; }
.onboarding-feature-pill .pill-icon { flex-shrink: 0; display: flex; color: var(--brand-600); }

.onboarding-skip {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  padding: 8px 16px;
}
.onboarding-skip:hover { color: var(--text-secondary); text-decoration: underline; }

/* ── Responsive: Tablets ─────────────────────────────────────── */
@media (max-width: 768px) {
  .onboarding-shell { padding: 20px 16px; }
  .onboarding-card { max-width: 100%; }
  .onboarding-card.wide { max-width: 100%; }
  .onboarding-card.welcome { max-width: 100%; }
  .onboarding-card.ready { max-width: 100%; }
  .onboarding-buttons { max-width: 100%; }
  .onboarding-features { max-width: 100%; }
}

/* ── Responsive: Small phones ────────────────────────────────── */
@media (max-width: 480px) {
  .onboarding-shell { padding: 16px 12px; }
  .onboarding-card { padding: 28px 20px; gap: 20px; }
  .onboarding-title { font-size: 21px; }
  .onboarding-tagline { font-size: 16px; }
  .onboarding-social-row { flex-direction: column; }
  .social-btn { width: 100%; }
  .onboarding-logo img.mark { height: 56px; }
  .onboarding-logo img.wordmark { height: 24px; }
  .onboarding-shell .theme-toggle { top: 12px; right: 12px; }
  .onboarding-shell .back-btn { top: 12px; left: 12px; }
  .onboarding-conn-row { gap: 10px; }
  .onboarding-feature-pill { padding: 12px 14px; font-size: 13px; }
}

/* ── Responsive: Very small ──────────────────────────────────── */
@media (max-width: 360px) {
  .onboarding-card { padding: 24px 16px; gap: 18px; }
  .onboarding-title { font-size: 19px; }
  .onboarding-subtitle { font-size: 13px; }
  .social-btn { height: 40px; font-size: 12px; }
  .onboarding-conn-icon { width: 38px; height: 38px; }
}
