/* BooksDash shared design system.
   Tokens and components used by every page outside the embedded reports.
   Load after the Inter font:
   <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap">
   <link rel="stylesheet" href="/assets/booksdash.css">
   Page-specific styles go in the page's own <style> block and use the tokens below. */

:root {
  --bd-forest: #0F2D1F;
  --bd-forest-2: #163A29;
  --bd-forest-hover: rgba(255, 255, 255, 0.06);
  --bd-mint: #34C38F;
  --bd-mint-soft: rgba(52, 195, 143, 0.16);
  --bd-green: #127A45;
  --bd-green-hover: #0E6639;
  --bd-green-ink: #0C5A32;
  --bd-green-soft: #E3F4EA;
  --bd-green-tint: #F0F9F4;
  --bd-yellow: #F5C518;
  --bd-yellow-soft: rgba(245, 197, 24, 0.18);

  --bd-ink: #14211A;
  --bd-ink-2: #3E4C44;
  --bd-muted: #5B6B62;
  --bd-faint: #6B7A72;
  --bd-placeholder: #8C9A92;
  --bd-line: #E3E8E5;
  --bd-line-2: #EEF2F0;
  --bd-line-strong: #D5DDD8;
  --bd-bg: #F4F6F5;
  --bd-surface: #FFFFFF;
  --bd-surface-2: #F8FAF9;

  --bd-side-text: #C9D8CF;
  --bd-side-muted: #8FA89A;
  --bd-side-line: rgba(255, 255, 255, 0.08);

  --bd-danger: #B42318;
  --bd-danger-hover: #912018;
  --bd-danger-soft: #FCE8E6;
  --bd-danger-line: #F4C7C1;
  --bd-warn-bg: #FFF4D1;
  --bd-warn-line: #F2D77A;
  --bd-warn-ink: #5C4300;
  --bd-info-bg: #E8F1FB;
  --bd-info-line: #BCD5F2;
  --bd-info-ink: #1C4A7A;

  --bd-radius-xs: 6px;
  --bd-radius-sm: 8px;
  --bd-radius: 12px;
  --bd-radius-lg: 14px;
  --bd-shadow-sm: 0 1px 2px rgba(15, 45, 31, 0.05);
  --bd-shadow-md: 0 8px 24px rgba(15, 45, 31, 0.10);
  --bd-shadow-lg: 0 24px 64px rgba(10, 25, 17, 0.28);

  --bd-sidebar-w: 260px;
  --bd-topbar-h: 60px;
  --bd-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --bd-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.bd {
  font-family: var(--bd-font);
  background: var(--bd-bg);
  color: var(--bd-ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* Base element rules use :where() so they carry zero specificity and never
   outrank component classes like .btn-primary or .side-link. */
:where(.bd) :where(h1, h2, h3, h4, p) { margin: 0; }
:where(.bd) :where(button, input, select, textarea) { font: inherit; color: inherit; }
:where(.bd) :where(button) { cursor: pointer; }
:where(.bd) :where(a) { color: var(--bd-green); }
:where(.bd) :where(a:hover) { color: var(--bd-green-ink); }
.btn, .btn:hover { text-decoration: none; }
.bd [hidden] { display: none !important; }
.bd :focus-visible { outline: 2px solid var(--bd-green); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Typography helpers ---------- */
.bd-h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.2; }
.bd-h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.2px; }
.bd-h3 { font-size: 16px; font-weight: 600; }
.bd-eyebrow { font-size: 12px; font-weight: 600; color: var(--bd-muted); text-transform: uppercase; letter-spacing: 0.6px; }
.bd-muted { color: var(--bd-muted); }
.bd-faint { color: var(--bd-faint); }
.bd-small { font-size: 13px; }
.bd-xs { font-size: 12px; }
.bd-mono { font-family: var(--bd-mono); font-size: 12.5px; }
.bd-num { font-variant-numeric: tabular-nums; }

/* ---------- Logo ---------- */
.bd-logo { display: inline-flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; letter-spacing: -0.2px; color: inherit; text-decoration: none; }
.bd-logo img { width: 30px; height: 30px; border-radius: 7px; background: #FFFFFF; flex-shrink: 0; }
.bd-badge-partner { padding: 2px 8px; border-radius: 999px; background: var(--bd-yellow-soft); color: var(--bd-yellow); font-size: 11px; font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--bd-radius-sm);
  border: 1px solid transparent; background: transparent;
  font-size: 14px; font-weight: 600; line-height: 1; white-space: nowrap;
  text-decoration: none; cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--bd-green); color: #FFFFFF; }
.btn-primary:hover:not(:disabled) { background: var(--bd-green-hover); color: #FFFFFF; }
.btn-secondary { background: var(--bd-surface); border-color: var(--bd-line-strong); color: var(--bd-ink); font-weight: 500; }
.btn-secondary:hover:not(:disabled) { background: var(--bd-surface-2); border-color: #C3CEC8; color: var(--bd-ink); }
.btn-ghost { color: var(--bd-ink-2); font-weight: 500; }
.btn-ghost:hover:not(:disabled) { background: var(--bd-line-2); color: var(--bd-ink); }
.btn-danger { background: var(--bd-danger); color: #FFFFFF; }
.btn-danger:hover:not(:disabled) { background: var(--bd-danger-hover); color: #FFFFFF; }
.btn-danger-outline { background: var(--bd-surface); border-color: var(--bd-danger-line); color: var(--bd-danger); }
.btn-danger-outline:hover:not(:disabled) { background: var(--bd-danger-soft); color: var(--bd-danger); }
.btn-qbo { background: #2CA01C; color: #FFFFFF; }
.btn-qbo:hover:not(:disabled) { background: #238016; color: #FFFFFF; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 15px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn-link { all: unset; cursor: pointer; color: var(--bd-green); font-weight: 600; font-size: 13px; }
.btn-link:hover { color: var(--bd-green-ink); text-decoration: underline; }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: bd-spin 0.7s linear infinite; display: inline-block; flex-shrink: 0;
}
.spinner-lg { width: 32px; height: 32px; border-width: 3px; color: var(--bd-green); }
@keyframes bd-spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--bd-ink); }
.field-label .optional { font-weight: 400; color: var(--bd-faint); }
.field-hint { font-size: 12px; color: var(--bd-muted); }
.field-error { font-size: 12px; color: var(--bd-danger); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--bd-line-strong); border-radius: var(--bd-radius-sm);
  background: var(--bd-surface); color: var(--bd-ink); font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--bd-placeholder); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--bd-green); box-shadow: 0 0 0 3px rgba(18, 122, 69, 0.15);
}
.input[aria-invalid="true"], .input.is-invalid { border-color: var(--bd-danger); }
.input:disabled, .select:disabled { background: var(--bd-surface-2); color: var(--bd-faint); }
.input-group { position: relative; }
.input-group .input { padding-left: 36px; }
.input-group > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--bd-faint); pointer-events: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: flex-start; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { accent-color: var(--bd-green); margin: 3px 0 0; width: 16px; height: 16px; }

/* Toggle switch: <label class="switch"><input type="checkbox"><span></span></label> */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--bd-line-strong); border-radius: 999px; transition: background 0.15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #FFFFFF; border-radius: 50%; transition: transform 0.15s; box-shadow: var(--bd-shadow-sm); }
.switch input:checked + span { background: var(--bd-green); }
.switch input:checked + span::before { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--bd-green); outline-offset: 2px; }

/* Choice cards (radio/checkbox tiles) */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.choice {
  display: flex; gap: 10px; align-items: flex-start; padding: 14px;
  border: 2px solid var(--bd-line); border-radius: 10px; background: var(--bd-surface); cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.choice:hover { border-color: var(--bd-line-strong); }
.choice input { accent-color: var(--bd-green); margin: 2px 0 0; }
.choice.is-selected, .choice:has(input:checked) { border-color: var(--bd-green); background: var(--bd-green-tint); }
.choice-title { font-size: 14px; font-weight: 600; }
.choice-desc { font-size: 12px; color: var(--bd-muted); }

/* ---------- Segmented control and tabs ---------- */
.segmented { display: inline-flex; padding: 3px; gap: 3px; border-radius: 9px; background: var(--bd-line-2); font-size: 13px; }
.segmented > button, .segmented > label {
  all: unset; cursor: pointer; padding: 6px 12px; border-radius: 7px; color: var(--bd-ink-2); text-align: center;
}
.segmented > .is-active, .segmented > [aria-selected="true"], .segmented > label:has(input:checked) {
  background: var(--bd-surface); color: var(--bd-ink); font-weight: 600; box-shadow: var(--bd-shadow-sm);
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--bd-line); overflow-x: auto; }
.tab {
  all: unset; cursor: pointer; padding: 10px 14px; font-size: 14px; font-weight: 500; color: var(--bd-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--bd-ink); }
.tab.is-active, .tab[aria-selected="true"] { color: var(--bd-green-ink); border-bottom-color: var(--bd-green); font-weight: 600; }

/* ---------- Cards, sections ---------- */
.card { background: var(--bd-surface); border: 1px solid var(--bd-line); border-radius: var(--bd-radius); box-shadow: var(--bd-shadow-sm); }
.card-pad { padding: 20px 24px; }
.card-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--bd-line-2); }
.card-header h2, .card-header h3 { font-size: 16px; font-weight: 600; flex: 1; }
.card-body { padding: 20px; }
.card-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; background: var(--bd-surface-2); border-top: 1px solid var(--bd-line-2); border-radius: 0 0 var(--bd-radius) var(--bd-radius); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--bd-line-2); border: 0; margin: 0; }

/* Key/value list in settings-style cards */
.kv { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 12px 20px; font-size: 14px; }
.kv dt { color: var(--bd-muted); }
.kv dd { margin: 0; font-weight: 500; }

/* Stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.stat { background: var(--bd-surface); border: 1px solid var(--bd-line); border-radius: var(--bd-radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.stat-label { font-size: 13px; color: var(--bd-muted); font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--bd-faint); }

/* ---------- Pills, chips ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap; background: var(--bd-line-2); color: var(--bd-ink-2); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.pill.no-dot::before { display: none; }
.pill-success { background: var(--bd-green-soft); color: var(--bd-green-ink); }
.pill-danger { background: var(--bd-danger-soft); color: var(--bd-danger); }
.pill-warn { background: var(--bd-warn-bg); color: var(--bd-warn-ink); }
.pill-info { background: var(--bd-info-bg); color: var(--bd-info-ink); }
.pill-neutral { background: var(--bd-line-2); color: var(--bd-muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--bd-line); background: var(--bd-surface); font-size: 12px; color: var(--bd-ink-2); }

/* ---------- Notices ---------- */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--bd-line); background: var(--bd-surface-2); font-size: 13px; color: var(--bd-ink-2); }
.notice svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.notice strong { color: inherit; }
.notice-success { background: var(--bd-green-tint); border-color: #CBE8D6; color: var(--bd-green-ink); }
.notice-danger { background: var(--bd-danger-soft); border-color: var(--bd-danger-line); color: var(--bd-danger); }
.notice-warn { background: var(--bd-warn-bg); border-color: var(--bd-warn-line); color: var(--bd-warn-ink); }
.notice-info { background: var(--bd-info-bg); border-color: var(--bd-info-line); color: var(--bd-info-ink); }

/* ---------- Data table ---------- */
.table-card { position: relative; background: var(--bd-surface); border: 1px solid var(--bd-line); border-radius: var(--bd-radius); box-shadow: var(--bd-shadow-sm); overflow: hidden; }
.table-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--bd-line-2); }
.table-toolbar h2, .table-toolbar h3 { font-size: 15px; font-weight: 600; }
.table-toolbar .count { font-size: 12px; color: var(--bd-muted); font-weight: 500; }
.table-toolbar .input-group { width: 260px; max-width: 100%; }
.table-toolbar .input, .table-toolbar .select { height: 34px; font-size: 13px; }
.table-toolbar .select { width: auto; }
.table-scroll { position: relative; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--bd-muted);
  padding: 10px 16px; background: var(--bd-surface-2); border-bottom: 1px solid var(--bd-line);
  white-space: nowrap;
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--bd-line-2); vertical-align: middle; color: var(--bd-ink); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: var(--bd-surface-2); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .cell-strong { font-weight: 600; }
.data-table .cell-sub { display: block; font-size: 12px; color: var(--bd-muted); font-weight: 400; }
.data-table .cell-actions { text-align: right; white-space: nowrap; }
.data-table .cell-actions .btn + .btn { margin-left: 4px; }
.table-empty { padding: 40px 16px; text-align: center; color: var(--bd-muted); font-size: 14px; }
.table-footer { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--bd-line-2); font-size: 12px; color: var(--bd-muted); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000; background: rgba(10, 25, 17, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-backdrop.hidden, .modal-backdrop[hidden] { display: none; }
.modal {
  width: 100%; max-width: 560px; max-height: calc(100vh - 32px); background: var(--bd-surface);
  border-radius: var(--bd-radius-lg); box-shadow: var(--bd-shadow-lg); display: flex; flex-direction: column; overflow: hidden;
}
.modal-lg { max-width: 760px; }
.modal-header { display: flex; align-items: flex-start; gap: 12px; padding: 20px 24px 12px; }
.modal-header h2 { font-size: 18px; font-weight: 700; flex: 1; }
.modal-header p { font-size: 13px; color: var(--bd-muted); margin-top: 4px; }
.modal-close { all: unset; cursor: pointer; width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--bd-muted); }
.modal-close:hover { background: var(--bd-line-2); color: var(--bd-ink); }
.modal-body { padding: 8px 24px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px; background: var(--bd-surface-2); border-top: 1px solid var(--bd-line-2); }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 1100; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: var(--bd-surface); border: 1px solid var(--bd-line); border-left: 4px solid var(--bd-green); border-radius: 10px; box-shadow: var(--bd-shadow-md); font-size: 13px; }
.toast-title { font-weight: 600; }
.toast-msg { color: var(--bd-muted); }
.toast-error { border-left-color: var(--bd-danger); }
.toast-warn { border-left-color: var(--bd-yellow); }

/* ---------- Auth / split layout (sign-in, invite, setup, partner apply) ---------- */
.auth-split { display: flex; flex-wrap: wrap; min-height: 100vh; background: var(--bd-surface); }
.auth-aside {
  flex: 1 1 380px; max-width: 480px; background: var(--bd-forest); color: var(--bd-side-text);
  padding: 40px 36px; display: flex; flex-direction: column; gap: 28px;
}
.auth-aside .bd-logo { color: #FFFFFF; font-size: 18px; }
.auth-aside h1 { font-size: 30px; line-height: 1.2; font-weight: 700; letter-spacing: -0.6px; color: #FFFFFF; }
.auth-aside p, .auth-aside li { font-size: 14px; }
.auth-aside ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 14px; }
.auth-aside li { display: flex; gap: 10px; align-items: flex-start; }
.auth-aside li svg { width: 18px; height: 18px; color: var(--bd-mint); flex-shrink: 0; margin-top: 1px; }
.auth-aside a { color: var(--bd-side-text); }
.auth-aside .aside-foot { margin-top: auto; font-size: 12px; color: var(--bd-side-muted); }
.auth-main { flex: 999 1 520px; min-width: 0; padding: 48px; display: flex; align-items: center; justify-content: center; }
.auth-panel { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 22px; }
.auth-panel-wide { max-width: 560px; }
.auth-panel h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.3px; }
.auth-panel .lede { font-size: 14px; color: var(--bd-muted); }

/* Single centered card page (callback, reauth, simple states) */
.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--bd-bg); }
.center-card { width: 100%; max-width: 460px; background: var(--bd-surface); border: 1px solid var(--bd-line); border-radius: var(--bd-radius-lg); box-shadow: var(--bd-shadow-md); padding: 32px; display: flex; flex-direction: column; gap: 18px; text-align: center; align-items: center; }
.state-icon { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--bd-green-soft); color: var(--bd-green); }
.state-icon svg { width: 28px; height: 28px; }
.state-icon.is-danger { background: var(--bd-danger-soft); color: var(--bd-danger); }
.state-icon.is-warn { background: var(--bd-warn-bg); color: var(--bd-warn-ink); }

/* ---------- App shell (sidebar + topbar) for non-dashboard app pages ---------- */
.app-shell { min-height: 100vh; display: flex; }
.app-sidebar {
  position: sticky; top: 0; height: 100vh; width: var(--bd-sidebar-w); flex-shrink: 0;
  background: var(--bd-forest); color: var(--bd-side-text); display: flex; flex-direction: column; overflow-y: auto;
}
.app-sidebar .side-head { padding: 20px 20px 12px; }
.app-sidebar .bd-logo { color: #FFFFFF; }
.side-section { padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.side-label { padding: 12px 10px 6px; font-size: 11px; font-weight: 600; color: var(--bd-side-muted); text-transform: uppercase; letter-spacing: 0.7px; }
.side-link {
  all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 8px; font-size: 14px; color: var(--bd-side-text); text-decoration: none;
}
.side-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.side-link:hover { background: var(--bd-forest-hover); color: #FFFFFF; }
.side-link.is-active, .side-link[aria-current="page"], .side-link.active { background: var(--bd-mint-soft); color: #FFFFFF; font-weight: 600; }
.side-link.is-active svg, .side-link.active svg { color: var(--bd-mint); opacity: 1; }
.side-link .side-count { margin-left: auto; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,0.1); }
.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--bd-side-line); display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--bd-mint-soft); color: var(--bd-mint); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.side-user { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.side-user strong { font-size: 13px; color: #FFFFFF; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user span { font-size: 12px; color: var(--bd-side-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-icon-btn { all: unset; cursor: pointer; width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--bd-side-muted); }
.side-icon-btn:hover { background: var(--bd-forest-hover); color: #FFFFFF; }
.side-icon-btn svg { width: 18px; height: 18px; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
  position: sticky; top: 0; z-index: 50; height: var(--bd-topbar-h); background: var(--bd-surface);
  border-bottom: 1px solid var(--bd-line); display: flex; align-items: center; gap: 12px; padding: 0 28px;
}
.app-topbar .crumb { font-size: 13px; color: var(--bd-muted); }
.app-topbar .crumb strong { color: var(--bd-ink); font-weight: 600; }
.app-topbar .menu-btn { display: none; }
.app-content { padding: 28px 32px 48px; display: flex; flex-direction: column; gap: 24px; width: 100%; max-width: 1280px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.page-head > div { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 4px; }
.page-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.4px; }
.page-head p { font-size: 14px; color: var(--bd-muted); }
.app-backdrop { display: none; }

/* ---------- Stepper (setup rail) ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.step { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; }
.step-dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--bd-side-muted); flex-shrink: 0; }
.step-dot svg { width: 14px; height: 14px; }
.step-name { font-size: 14px; font-weight: 600; color: var(--bd-side-muted); }
.step-desc { font-size: 12px; color: var(--bd-side-muted); opacity: 0.85; }
.step.is-current .step-dot { border-color: var(--bd-mint); color: var(--bd-mint); }
.step.is-current .step-name { color: #FFFFFF; }
.step.is-done .step-dot { background: var(--bd-mint); border-color: var(--bd-mint); color: var(--bd-forest); }
.step.is-done .step-name { color: var(--bd-side-text); }
.progress-bars { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; }
.progress-bars li { flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--bd-faint); font-weight: 500; }
.progress-bars li::before { content: ""; height: 4px; border-radius: 2px; background: var(--bd-line); }
.progress-bars li.is-done::before, .progress-bars li.is-current::before { background: var(--bd-green); }
.progress-bars li.is-current { color: var(--bd-ink); font-weight: 600; }
.progress { height: 8px; border-radius: 999px; background: var(--bd-line-2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--bd-green); border-radius: inherit; transition: width 0.3s ease; }

/* ---------- Public site ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--bd-line); }
.site-wrap { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.site-nav { display: flex; align-items: center; gap: 24px; height: 68px; }
.site-nav .links { display: flex; gap: 22px; flex: 1; justify-content: center; }
.site-nav .links a { color: var(--bd-ink-2); text-decoration: none; font-size: 14px; font-weight: 500; }
.site-nav .links a:hover { color: var(--bd-green); }
.site-footer { background: var(--bd-forest); color: var(--bd-side-text); padding: 40px 0; font-size: 13px; }
.site-footer a { color: var(--bd-side-text); text-decoration: none; }
.site-footer a:hover { color: #FFFFFF; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .app-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 200; transform: translateX(-100%); transition: transform 0.2s ease; }
  .app-shell.nav-open .app-sidebar { transform: translateX(0); }
  .app-shell.nav-open .app-backdrop { display: block; position: fixed; inset: 0; z-index: 150; background: rgba(10,25,17,0.45); }
  .app-topbar { padding: 0 16px; }
  .app-topbar .menu-btn { display: inline-flex; }
  .app-content { padding: 20px 16px 40px; }
  .site-nav .links { display: none; }
}
@media (max-width: 768px) {
  .auth-aside { max-width: none; padding: 28px 20px; gap: 18px; }
  .auth-aside h1 { font-size: 22px; }
  .auth-aside ul { display: none; }
  .auth-main { padding: 28px 16px; align-items: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 10px; }
  .center-card { padding: 24px 20px; }
  .modal-header, .modal-body, .modal-footer { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
