/* MySmartInvoice – components (SHSS UI, design system blue/turquoise). Uses only tokens from theme.css – no brand hex values here.
   Generic on purpose: the in-app shell, the platform admin app (/admin, .admin-shell) and every feature area use the same classes.
   docs/DESIGN-SYSTEM.md lists every component. */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body { font: var(--fs)/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11"; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); letter-spacing: -.015em; color: var(--text); line-height: 1.25; }
h1 { font-size: var(--fs-2xl); font-weight: 700; } h2 { font-size: var(--fs-xl); font-weight: 700; } h3 { font-size: var(--fs-lg); font-weight: 600; } h4 { font-size: var(--fs-md); font-weight: 600; }
p { margin: 0 0 8px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.muted { color: var(--text-3); } .small { font-size: var(--fs-sm); } .xs { font-size: var(--fs-xs); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; } .right { margin-left: auto; } .center { text-align: center; }
.grid { display: grid; gap: var(--space-4); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sr:focus { position: fixed; top: 8px; left: 8px; width: auto; height: auto; clip: auto; z-index: 300; padding: 8px 14px; background: var(--surface); color: var(--text); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.num, .amount { text-align: right; font-variant-numeric: tabular-nums; }
.text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning); }

/* ---------- focus: always visible (keyboard), WCAG ---------- */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn:focus-visible, .nav a:focus-visible, .nav-group summary:focus-visible, .tabs button:focus-visible, .seg button:focus-visible, .pill:focus-visible,
.quick a:focus-visible, .cards-sel button:focus-visible, .tbl tr.clickable:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: var(--focus-ring); }

/* ---------- buttons (radius 12, primary = solid blue, success = teal fill, errors = semantic red) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--ctrl-h); padding: 0 16px;
  border-radius: var(--radius-btn); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 600 var(--fs-sm)/1 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--disabled-bg); border-color: var(--disabled-border); color: var(--disabled-fg); cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); box-shadow: 0 1px 2px rgba(13, 25, 48, .08); }
.btn-primary:hover { background: var(--accent-600); border-color: var(--accent-600); }
.btn-soft { background: var(--accent-50); border-color: var(--accent-100); color: var(--accent-text); }
.btn-soft:hover { background: var(--accent-100); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { color: var(--err); }
.btn-danger:hover { background: var(--err-bg); }
.btn-sm { height: 32px; padding: 0 12px; font-size: var(--fs-sm); border-radius: calc(var(--radius-btn) - 2px); }
.btn-lg { height: 48px; padding: 0 22px; font-size: var(--fs); }
.btn-block { width: 100%; }
.btn-icon { width: var(--ctrl-h); padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn svg, .ico { width: 18px; height: 18px; flex: none; }
/* branding highlight (marketing / onboarding only – never on data screens) */
.btn-gradient { background: var(--brand-gradient); border: 0; color: #fff; }
.btn-gradient:hover { background: var(--brand-gradient); filter: brightness(1.05); }
.btn-coral { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }     /* legacy alias */
.btn-coral:hover { background: var(--accent-600); }
.text-gradient { background: var(--brand-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- forms (inputs radius 10, labels above, error text, 44 px tap targets) ---------- */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
label.field .req { color: var(--err); }
.hint { font-size: var(--fs-xs); color: var(--text-3); font-weight: 400; }
.field-error { font-size: var(--fs-xs); color: var(--err); font-weight: 500; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=tel], input[type=search],
input[type=time], input[type=date], input[type=month], select, textarea {
  height: var(--ctrl-h); width: 100%; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: 400 var(--fs)/1.4 var(--font);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: .8; }
textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
input:hover:not(:disabled):not(:focus), select:hover:not(:disabled):not(:focus), textarea:hover:not(:disabled):not(:focus) { border-color: color-mix(in srgb, var(--border-strong) 60%, var(--text-3)); }
input:focus, select:focus, textarea:focus { border-color: var(--focus); box-shadow: var(--focus-ring); outline: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid transparent; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--err); }
input:disabled, select:disabled, textarea:disabled { background: var(--disabled-bg); color: var(--disabled-fg); border-color: var(--disabled-border); cursor: not-allowed; }
input[type=color] { width: 48px; height: var(--ctrl-h); padding: 3px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
input[type=file] { font: var(--fs-sm) var(--font); color: var(--text-2); max-width: 100%; }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; font-size: var(--fs); color: var(--text); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; transition: background var(--dur-fast); margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: left var(--dur-fast); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { left: 18px; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.input-icon input { padding-left: 36px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
fieldset { min-width: 0; }

/* ---------- cards (radius 16, 1px border on data surfaces, subtle shadow) ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.card-pad { padding: calc(var(--pad) + 4px); }
.card-head { display: flex; align-items: center; gap: 12px; padding: var(--pad) calc(var(--pad) + 4px); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h3 { font-size: var(--fs-md); display: flex; align-items: center; gap: 8px; }
.card-head h3 .ico { color: var(--text-3); }
.card-body { padding: calc(var(--pad) + 4px); }
.card-foot { padding: 12px calc(var(--pad) + 4px); border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card.interactive { transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.card.interactive:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }

/* KPI cards (design-system sample dashboard: big figure, small label below) */
.kpi { padding: calc(var(--pad) + 4px); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi .label { color: var(--text-3); font-size: var(--fs-sm); display: flex; align-items: center; gap: 8px; }
.kpi .label .ico { width: 16px; height: 16px; }
.kpi .value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--text); overflow-wrap: anywhere; }
.kpi .delta { font-size: var(--fs-xs); font-weight: 600; }
.kpi.kpi-accent .value { color: var(--accent-text); }
.kpi.kpi-ok .value { color: var(--success); } .kpi.kpi-warn .value { color: var(--warning); } .kpi.kpi-err .value { color: var(--err); }
.delta.up { color: var(--ok); } .delta.down { color: var(--err); }

/* ---------- badges / status pills (always text + colour) ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); } .badge.info { background: var(--info-bg); color: var(--info); }
.badge.accent { background: var(--accent-50); color: var(--accent-text); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------- table (financial tables: right-aligned amounts, tabular figures; scroll safely on small screens) ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-table); }
.tbl th { text-align: left; font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 0 14px; height: var(--row-h); border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background-color var(--dur-fast) var(--ease); }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tr.clickable { cursor: pointer; }
.tbl .actions { text-align: right; white-space: nowrap; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px calc(var(--pad) + 4px); border-bottom: 1px solid var(--border); }
.toolbar .input-icon { min-width: 0; flex: 1 1 220px; max-width: 360px; }
.toolbar select { width: auto; max-width: 100%; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; padding: 10px calc(var(--pad) + 4px); border-top: 1px solid var(--border); color: var(--text-3); font-size: var(--fs-sm); }

/* ---------- tabs / segmented ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: thin; }
.tabs button { background: none; border: 0; padding: 12px 14px; font: 600 var(--fs-sm)/1 var(--font); color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color var(--dur-fast), border-color var(--dur-fast); }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.seg { display: inline-flex; flex-wrap: wrap; background: var(--surface-3); border-radius: var(--radius); padding: 3px; gap: 2px; max-width: 100%; }
.seg button { border: 0; background: none; padding: 7px 12px; border-radius: calc(var(--radius) - 3px); font: 600 var(--fs-sm)/1 var(--font); color: var(--text-2); cursor: pointer; white-space: nowrap; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- empty / alerts ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty .ico-wrap { width: 52px; height: 52px; border-radius: 14px; background: var(--accent-50); color: var(--accent-text); display: grid; place-items: center; margin: 0 auto 12px; }
.empty h3 { color: var(--text); margin-bottom: 6px; }
/* alerts (review round 1, Hassan #1): one look everywhere – soft tinted surface, thin tinted border, coloured icon, readable tinted text.
   The tone is a variable; alerts without their own icon get one by tone (CSS mask). Markup unchanged: <div class="alert warn">…</div> */
.alert { --tone: var(--info); --tone-bg: var(--info-bg); display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: calc(var(--radius) + 2px);
  font-size: var(--fs-sm); line-height: 1.45; background: var(--tone-bg); color: color-mix(in srgb, var(--tone) 38%, var(--text)); border: 1px solid color-mix(in srgb, var(--tone) 22%, transparent); }
.alert.info { --tone: var(--info); --tone-bg: var(--info-bg); }
.alert.warn { --tone: var(--warn); --tone-bg: var(--warn-bg); }
.alert.ok { --tone: var(--ok); --tone-bg: var(--ok-bg); }
.alert.err { --tone: var(--err); --tone-bg: var(--err-bg); }
.alert.accent { --tone: var(--accent-text); --tone-bg: var(--accent-50); border-color: var(--accent-100); }
.alert > .ico:first-child, .alert > svg:first-child { color: var(--tone); width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert b, .alert strong { color: color-mix(in srgb, var(--tone) 28%, var(--text)); font-weight: 600; }
.alert a:not(.btn) { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.alert:not(:has(> .ico, > svg))::before { content: ""; flex: none; width: 18px; height: 18px; margin-top: 1px; background: var(--tone);
  -webkit-mask: var(--alert-ico) center / contain no-repeat; mask: var(--alert-ico) center / contain no-repeat; }
.alert { --alert-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='M12 11v6M12 7.5h.01'/%3E%3C/svg%3E"); }
.alert.ok { --alert-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='m8 12.5 2.7 2.7L16.5 9.5'/%3E%3C/svg%3E"); }
.alert.warn { --alert-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0zM12 9v4M12 17h.01'/%3E%3C/svg%3E"); }
.alert.err { --alert-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='M12 7v6M12 16.5h.01'/%3E%3C/svg%3E"); }

/* ---------- progress / meter ---------- */
.meter { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.meter.ok > span { background: var(--success-fill); } .meter.warn > span { background: var(--warning-fill); } .meter.err > span { background: var(--danger-fill); }

/* ---------- avatar ---------- */
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--accent); flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }

/* ================= LOGO ================= */
.logo { display: inline-flex; align-items: center; gap: 10px; line-height: 1; color: var(--logo-word); }
.logo svg { display: block; flex: none; }
.logo .logo-word-1 { fill: var(--logo-word); } .logo .logo-word-2 { fill: var(--logo-word-2); }
.logo .logo-mark { display: block; flex: none; object-fit: contain; }
.logo-text { display: flex; flex-direction: column; line-height: 1; letter-spacing: -0.01em; }
.logo-text b { font-weight: 800; } .logo-text .logo-word-1 { color: var(--logo-word); } .logo-text .logo-word-2 { color: var(--logo-word-2); font-size: 1.22em; }
.logo.on-dark { --logo-word: #FFFFFF; --logo-word-2: #F7B500; }
/* arrow reveal: gentle upward reveal once on load (300–500 ms), never continuous; off with prefers-reduced-motion */
.logo .logo-arrow { animation: logo-arrow var(--dur-reveal) var(--ease) both; }
@keyframes logo-arrow { from { clip-path: inset(30% 100% 0 0); transform: translateY(4px); } to { clip-path: inset(0 0 0 0); transform: none; } }

/* ================= APP SHELL ================= */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border); display: flex; flex-direction: column; scrollbar-width: thin; }
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px; font-weight: 700; font-size: 16px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--brand-gradient); display: grid; place-items: center; color: #fff; }
.brand-mark svg { width: 18px; height: 18px; }
.workspace { margin: 0 12px 10px; padding: 8px 10px; border: 1px solid var(--sidebar-border); border-radius: var(--radius); display: flex; align-items: center; gap: 10px; background: var(--surface-2); color: var(--text); }
.workspace .name { font-weight: 600; font-size: var(--fs-sm); line-height: 1.2; }
.nav { padding: 4px 10px 16px; display: flex; flex-direction: column; gap: 2px; }
.nav .sec { font-size: 12px; color: var(--sidebar-fg-muted); font-weight: 600; padding: 16px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 8px 10px; border-radius: var(--radius); color: var(--sidebar-fg); font-weight: 500; font-size: var(--fs-sm);
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.nav a:hover { background: var(--sidebar-hover); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-fg); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.nav a .ico { color: var(--sidebar-fg-muted); } .nav a.active .ico { color: var(--accent); }
.nav a .count { margin-left: auto; font-size: 11px; color: var(--sidebar-fg-muted); }
.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--sidebar-border); }
.plan-box { padding: 12px; border-radius: var(--radius); background: var(--accent-50); border: 1px solid var(--accent-100); font-size: var(--fs-sm); }
.admin-zone { margin-top: 12px; padding-top: 4px; border-top: 1px dashed var(--border-strong); }
.admin-zone .sec { display: flex; align-items: center; gap: 6px; color: var(--accent-text); }
.admin-zone .sec svg { width: 14px; height: 14px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 24px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar .search { width: 380px; max-width: 40vw; justify-content: flex-start; color: var(--text-3); font-weight: 500; border-radius: var(--radius); }
.topbar .search input { background: var(--surface); }
.topbar .right { min-width: 0; }
.kbd { font: 11px ui-monospace, monospace; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; color: var(--text-3); background: var(--surface); }
.content { padding: var(--space-5); max-width: 1360px; width: 100%; margin: 0 auto; min-width: 0; }
.content:focus { outline: none; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: var(--space-5); flex-wrap: wrap; }
.page-head > div:first-child { min-width: 0; }
.page-head .sub { color: var(--text-3); margin-top: 4px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: var(--fs-sm); color: var(--text-3); margin-bottom: 6px; }
.crumbs a { color: var(--text-3); }
.menu-btn { display: none; }
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; width: min(290px, 86vw); transform: translateX(-100%); transition: transform var(--dur) var(--ease); box-shadow: var(--shadow-lg); visibility: hidden; }
  body.nav-open .sidebar { transform: none; visibility: visible; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: var(--overlay); z-index: 40; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 12px; } .topbar .search { display: none; }
  .content { padding: var(--space-4); }
}

/* ---------- platform admin variant: darker navy sidebar (used by area G's /admin app: <div class="shell admin-shell">) ---------- */
.admin-shell { --sidebar-bg: #0D1930; --sidebar-fg: #C8D3E3; --sidebar-fg-muted: #8A9AB3; --sidebar-hover: rgba(255, 255, 255, .07);
  --sidebar-active-bg: rgba(28, 184, 242, .16); --sidebar-active-fg: #FFFFFF; --sidebar-border: rgba(255, 255, 255, .08); }
.admin-shell .sidebar .brand, .admin-shell .sidebar .logo { --logo-word: #FFFFFF; --logo-word-2: #F7B500; color: #fff; }
.admin-shell .sidebar .workspace { background: rgba(255, 255, 255, .05); color: #fff; }
.admin-shell .sidebar .workspace .muted { color: var(--sidebar-fg-muted); }
.admin-shell .nav a.active { box-shadow: inset 3px 0 0 var(--brand-cyan); } .admin-shell .nav a.active .ico { color: var(--brand-cyan); }
.admin-shell .nav a:hover { color: #fff; }
.admin-shell .admin-zone { border-top-color: rgba(255, 255, 255, .14); } .admin-shell .admin-zone .sec { color: var(--brand-cyan); }
.admin-shell .topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--brand-gradient); opacity: .9; }
.env-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font: 700 11px/1 var(--font); letter-spacing: .02em; background: var(--accent-50); color: var(--accent-text); }

/* ---------- dropdown ---------- */
.dropdown { position: relative; }
.dd-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; animation: pop var(--dur-fast) var(--ease); }
.dd-menu a, .dd-menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); background: none; border: 0; color: var(--text); font: var(--fs-sm)/1.3 var(--font); cursor: pointer; text-align: left; }
.dd-menu a:hover, .dd-menu button:hover { background: var(--surface-3); text-decoration: none; }
.dd-menu .sep { height: 1px; background: var(--border); margin: 6px 0; }

/* ---------- modal / drawer / toast ---------- */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade var(--dur-fast) var(--ease); }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: 90vh; display: flex; flex-direction: column; animation: pop var(--dur) var(--ease); border: 1px solid var(--border); }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.overlay.drawer { justify-content: flex-end; padding: 0; }
.overlay.drawer .modal { height: 100vh; max-height: 100vh; border-radius: 0; width: min(640px, 100%); animation: slide var(--dur) var(--ease); }
@media (max-width: 560px) { .overlay { padding: 10px; } .modal-body { padding: 16px; } }
.toasts { position: fixed; bottom: 20px; right: 20px; left: auto; z-index: 200; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; max-width: calc(100vw - 40px); }
/* toasts: calm dark card (light mode) / raised surface (dark mode), coloured round icon by type; click dismisses */
.toast { --tone: var(--brand-teal); display: flex; gap: 10px; align-items: flex-start; min-width: 240px; max-width: 400px; padding: 12px 16px 12px 12px; border-radius: 12px;
  background: #0F172A; color: #F1F5F9; border: 1px solid rgba(255, 255, 255, .06); box-shadow: 0 12px 32px rgba(13, 25, 48, .24); font-size: var(--fs-sm); line-height: 1.4;
  cursor: pointer; animation: toast-in var(--dur) var(--ease); }
.toast::before { content: ""; flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--tone); margin-top: -1px;
  -webkit-mask: var(--toast-ico) center / 20px no-repeat; mask: var(--toast-ico) center / 20px no-repeat; }
.toast { --toast-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M10 0a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm4.3 6.3a1 1 0 0 0-1.4 0L8.8 10.4 7.1 8.7a1 1 0 1 0-1.4 1.4l2.4 2.4a1 1 0 0 0 1.4 0l4.8-4.8a1 1 0 0 0 0-1.4z'/%3E%3C/svg%3E"); }
.toast.err, .toast.warn, .toast.info { --toast-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M10 0a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm0 4.5a1.2 1.2 0 0 0-1.2 1.2v4.6a1.2 1.2 0 0 0 2.4 0V5.7A1.2 1.2 0 0 0 10 4.5zm0 8.6a1.3 1.3 0 1 0 0 2.6 1.3 1.3 0 0 0 0-2.6z'/%3E%3C/svg%3E"); }
.toast.err { --tone: #F87171; } .toast.warn { --tone: #FBBF24; } .toast.info { --tone: #7DB5FF; }
.toast.out { opacity: 0; transform: translateY(4px); transition: opacity .18s ease, transform .18s ease; }
[data-mode="dark"] .toast { background: #1E293B; border-color: #334155; box-shadow: 0 14px 36px rgba(0, 0, 0, .55); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@media (max-width: 900px) { .toasts { left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); max-width: none; align-items: stretch; } .toast { max-width: none; } }
@keyframes fade { from { opacity: 0; } } @keyframes pop { from { opacity: 0; transform: translateY(4px) scale(.98); } } @keyframes slide { from { transform: translateX(40px); opacity: 0; } }

/* ---------- command palette ---------- */
.palette { width: min(600px, 100%); align-self: flex-start; margin-top: 10vh; }
.palette input { height: 54px; border: 0; border-bottom: 1px solid var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; font-size: 16px; padding: 0 18px; box-shadow: none !important; }
.palette .list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.palette .item { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; }
.palette .item.sel, .palette .item:hover { background: var(--accent-50); }

/* ================= AUTH (login / register / …): split screen, restrained gradient accent ================= */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; background: var(--surface); }
.auth-hero { position: relative; overflow: hidden; padding: 40px 56px; display: flex; flex-direction: column; gap: 28px; color: var(--text);
  background: radial-gradient(900px 520px at 100% 0%, color-mix(in srgb, var(--brand-cyan) 14%, transparent), transparent 60%),
              radial-gradient(700px 520px at 0% 100%, color-mix(in srgb, var(--brand-teal) 12%, transparent), transparent 60%), var(--bg); border-right: 1px solid var(--border); }
.auth-hero::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--brand-gradient); }
.auth-hero-body { position: relative; margin: auto 0; max-width: 560px; }
.auth-hero h1 { margin: 0 0 12px; font-size: 36px; line-height: 1.15; letter-spacing: -.02em; max-width: 520px; }
.auth-hero .lead { color: var(--text-2); font-size: var(--fs); max-width: 500px; }
.auth-benefits { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; }
.auth-benefits li { display: flex; gap: 12px; align-items: flex-start; }
.auth-benefits b { display: block; font-size: var(--fs); margin-bottom: 2px; }
.auth-benefits li > div > span { font-size: var(--fs-sm); color: var(--text-3); line-height: 1.45; display: block; }
.b-ico { width: 38px; height: 38px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--accent); display: grid; place-items: center; flex: none; box-shadow: var(--shadow-sm); }
.b-ico svg { width: 18px; height: 18px; }
.auth-trust { position: relative; display: flex; gap: 22px; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--text-3); }
.auth-trust span { display: inline-flex; align-items: center; gap: 6px; }
.auth-trust svg { width: 16px; height: 16px; color: var(--success-fill); }
.auth-form { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-form .box { width: min(440px, 100%); display: flex; flex-direction: column; gap: 16px; margin: auto 0; }
.auth-form h2 { font-size: 26px; } .auth-form .sub { color: var(--text-2); margin-top: -8px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: var(--fs-sm); }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-top { position: absolute; top: 20px; right: 24px; display: flex; gap: 8px; }
.auth-mobile-logo { display: none; }
@media (max-width: 1100px) { .auth-benefits { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-hero { order: 2; padding: 32px 20px; border-right: 0; border-top: 1px solid var(--border); } .auth-hero > .auth-hero-logo { display: none; } .auth-hero h1 { font-size: 26px; }
  .auth-mobile-logo { display: block; margin-bottom: 4px; }
  .auth-form { padding: 72px 16px 32px; }
}

/* ---------- misc widgets ---------- */
.steps { display: flex; flex-direction: column; gap: 4px; }
.step { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: var(--radius); }
.step:hover { background: var(--surface-2); }
.step .num { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--text-3); flex: none; text-align: center; }
.step.done .num { background: var(--success-fill); border-color: var(--success-fill); color: #fff; }
.step.done .t { text-decoration: line-through; color: var(--text-3); }
.chart { width: 100%; height: 220px; display: block; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .area { fill: var(--accent-50); } .chart .line { fill: none; stroke: var(--accent); stroke-width: 2.4; }
.chart .bar { fill: var(--accent); } .chart text { fill: var(--text-3); font-size: 11px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.thumb { border: 2px solid var(--border); border-radius: var(--radius-lg); padding: 10px; cursor: pointer; background: var(--surface); color: var(--text); text-align: left; font: inherit; transition: border-color var(--dur-fast), box-shadow var(--dur-fast); }
.thumb:hover { border-color: var(--border-strong); } .thumb.active, .thumb[aria-checked="true"] { border-color: var(--accent); box-shadow: var(--focus-ring); }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; padding: 0; }
.swatch.active, .swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--text); }
.codebox { background: var(--surface-3); color: var(--text); border-radius: var(--radius); padding: 10px 12px; font: 12.5px/1.55 ui-monospace, monospace; white-space: pre-wrap; word-break: break-all; position: relative; }
.codebox .btn { position: absolute; top: 8px; right: 8px; }
.demo-banner { background: var(--accent); color: #fff; font-size: var(--fs-sm); padding: 7px 24px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.demo-banner a { color: #fff; text-decoration: underline; }
.demo-banner .demo-actions { display: flex; gap: 8px; flex: none; }
.pill-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 36px; text-align: center; color: var(--text-3); background: var(--surface-2); cursor: pointer; transition: border-color var(--dur-fast), background var(--dur-fast); }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-50); }
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.timeline .ev { position: relative; padding: 0 0 14px; }
.timeline .ev::before { content: ""; position: absolute; left: -17px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.price-card { display: flex; flex-direction: column; gap: 12px; padding: 22px; }
.price-card .price { font-size: 32px; font-weight: 700; letter-spacing: -.02em; }
.price-card ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: var(--fs-sm); }
.price-card li::before { content: "✓ "; color: var(--success); font-weight: 700; }
.price-card.featured { border: 2px solid var(--accent); box-shadow: 0 0 0 4px var(--accent-50); }
.frame-block { min-height: 100vh; display: grid; place-content: center; gap: 12px; text-align: center; padding: 24px; color: var(--text-2); }
.brand-bar { height: 4px; border-radius: 99px; background: var(--brand-gradient); }

/* mobile topbar: icons only, compact banners */
@media (max-width: 700px) {
  .topbar { gap: 4px; height: 58px; } .topbar .right { gap: 2px !important; flex-wrap: nowrap; }
  .topbar [data-lang] b { display: none; } .topbar a[href="#/help"] { display: none; }
  .demo-banner { padding: 6px 12px; font-size: 12px; gap: 6px; } .demo-banner span { flex: 1; min-width: 0; }
  .page-head h1 { font-size: 24px; }
}

/* environment banner (DEV / TEST) – never shown in production */
.env-banner { display: flex; align-items: center; gap: 10px; padding: 6px 24px; background: #8A4B06; color: #fff; font-size: var(--fs-sm); letter-spacing: .01em; }
.env-banner b { letter-spacing: .08em; } .env-banner svg { width: 16px; height: 16px; }
@media (max-width: 700px) { .env-banner { padding: 5px 12px; font-size: 12px; } .env-banner span { display: none; } }

/* ---------- toggle standard (BlogPoster): pill with ON/OFF text inside, role=switch ---------- */
.tgl { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; position: relative; }
.tgl input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tgl-track { position: relative; display: inline-flex; align-items: center; width: 62px; height: 30px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); transition: background var(--dur-fast), border-color var(--dur-fast); flex: none; }
.tgl-knob { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(13, 25, 48, .3); transition: left var(--dur-fast) var(--ease); }
.tgl-on, .tgl-off { position: absolute; font-size: 10.5px; font-weight: 700; transition: opacity var(--dur-fast); }
.tgl-on { left: 9px; color: #fff; opacity: 0; } .tgl-off { right: 8px; color: var(--text-3); }
.tgl input:checked + .tgl-track { background: var(--accent); border-color: var(--accent); }
.tgl input:checked + .tgl-track .tgl-knob { left: 35px; }
.tgl input:checked + .tgl-track .tgl-on { opacity: 1; } .tgl input:checked + .tgl-track .tgl-off { opacity: 0; }
.tgl input:focus-visible + .tgl-track { outline: 2px solid var(--focus); outline-offset: 2px; }
.tgl.is-disabled { opacity: .55; cursor: not-allowed; }
.tgl-label { font-size: var(--fs-sm); color: var(--text); }

/* ---------- language switch (flags): trigger = current flag only, popover = flag + language name (ui.js → langSwitch) ---------- */
.flag { display: block; width: 22px; height: 16.5px; flex: none; border-radius: 3px; box-shadow: 0 0 0 1px rgba(13, 25, 48, .14); }
[data-mode="dark"] .flag { box-shadow: 0 0 0 1px rgba(255, 255, 255, .22); }
.lang-sw { position: relative; display: inline-flex; }
.lang-sw-btn { display: inline-grid; place-items: center; width: 40px; height: 38px; padding: 0; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; cursor: pointer; transition: background var(--dur-fast), border-color var(--dur-fast); }
.lang-sw-btn:hover, .lang-sw-btn[aria-expanded="true"] { background: var(--surface-3); }
.lang-sw-btn:focus-visible, .lang-sw-pop button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.auth-top .lang-sw-btn { border-color: var(--border); background: var(--surface); }
.lang-sw-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 180px; padding: 6px; z-index: 60; display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.lang-sw-pop[hidden] { display: none; }
.lang-sw-pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: none;
  color: var(--text); font: var(--fs-sm)/1.3 var(--font); text-align: left; cursor: pointer; }
.lang-sw-pop button:hover, .lang-sw-pop button:focus-visible { background: var(--surface-3); }
.lang-sw-pop button[aria-checked="true"] { font-weight: 600; color: var(--accent-text); background: var(--accent-50); }
.lang-sw-pop button .ico { width: 16px; height: 16px; margin-left: auto; }
.seg .lang-tab { display: inline-flex; align-items: center; gap: 8px; } .seg .lang-tab .flag { width: 18px; height: 13.5px; }
select option .flag { width: 20px; height: 15px; }
.page-head .actions:empty { display: none; }
