/* =============================================================
   Countava — design system & theming
   Themes are driven entirely by CSS variables on <html data-theme>.
   ============================================================= */

/* ---------- Base tokens (light) ---------- */
:root,
:root[data-theme="light"] {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-hover: #f0f3f9;
  --border: #e7ebf3;
  --border-strong: #d7deea;
  --text: #1b2333;
  --text-muted: #7a869c;
  --text-faint: #a7b0c2;

  --accent: #3b6ef5;
  --accent-hover: #2f5fe0;
  --accent-soft: #e9f0ff;
  --accent-contrast: #ffffff;

  --sidebar-bg: #ffffff;
  --sidebar-text: #5a6579;
  --sidebar-active-bg: var(--accent);
  --sidebar-active-text: #ffffff;
  --sidebar-border: #eef1f7;

  --success: #16b364; --success-soft: #e5f7ee;
  --danger:  #ef4444; --danger-soft:  #fdecec;
  --warning: #f59e0b; --warning-soft: #fef4e2;
  --info:    #0ea5e9; --info-soft:    #e5f5fd;

  --kpi-1: #fff8db; --kpi-1-ico:#d9a400;
  --kpi-2: #e6f7ee; --kpi-2-ico:#16b364;
  --kpi-3: #e9f0ff; --kpi-3-ico:#3b6ef5;
  --kpi-4: #f3ebff; --kpi-4-ico:#8b5cf6;

  --shadow-sm: 0 1px 2px rgba(20,30,60,.06);
  --shadow: 0 4px 20px rgba(20,30,60,.07);
  --shadow-lg: 0 18px 50px rgba(20,30,60,.16);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --sidebar-w: 248px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ---------- Dark ---------- */
:root[data-theme="dark"] {
  --bg: #0e1220;
  --surface: #161c2d;
  --surface-2: #1b2236;
  --surface-hover: #1f2740;
  --border: #262f47;
  --border-strong: #33405e;
  --text: #e8ecf5;
  --text-muted: #97a1ba;
  --text-faint: #6b7695;

  --accent: #5b82f7; --accent-hover: #6f92ff;
  --accent-soft: #1d2embed; --accent-soft: #1c2540;
  --accent-contrast: #ffffff;

  --sidebar-bg: #131829;
  --sidebar-text: #97a1ba;
  --sidebar-active-bg: var(--accent);
  --sidebar-active-text: #ffffff;
  --sidebar-border: #212a40;

  --success:#2dd48a; --success-soft:#13301f;
  --danger: #f87171; --danger-soft:#3a1d1d;
  --warning:#fbbf24; --warning-soft:#3a2c12;
  --info:   #38bdf8; --info-soft:#12293a;

  --kpi-1:#2a2410; --kpi-1-ico:#e0b53a;
  --kpi-2:#0f2a1c; --kpi-2-ico:#2dd48a;
  --kpi-3:#182140; --kpi-3-ico:#5b82f7;
  --kpi-4:#241a3d; --kpi-4-ico:#a78bfa;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 6px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.55);
}

/* ---------- Preset: Midnight (deep indigo) ---------- */
:root[data-theme="midnight"] {
  --bg:#0b1030; --surface:#151b45; --surface-2:#1a2152; --surface-hover:#212a63;
  --border:#252d5f; --border-strong:#33407a;
  --text:#e9ecff; --text-muted:#9aa4d8; --text-faint:#6d78b5;
  --accent:#7c8cff; --accent-hover:#8f9dff; --accent-soft:#1f2760; --accent-contrast:#fff;
  --sidebar-bg:#0e143a; --sidebar-text:#9aa4d8; --sidebar-active-bg:#7c8cff; --sidebar-active-text:#fff; --sidebar-border:#1d2456;
  --success:#41e0a3;--success-soft:#0f2f27;--danger:#ff7b8a;--danger-soft:#3a1830;
  --warning:#ffcf5c;--warning-soft:#33290f;--info:#5bc8ff;--info-soft:#122a3f;
  --kpi-1:#2b2550;--kpi-1-ico:#ffcf5c;--kpi-2:#12314a;--kpi-2-ico:#41e0a3;
  --kpi-3:#212a63;--kpi-3-ico:#7c8cff;--kpi-4:#2c2160;--kpi-4-ico:#c4a0ff;
  --shadow:0 8px 30px rgba(0,0,0,.4);--shadow-lg:0 24px 60px rgba(0,0,0,.6);
}

/* ---------- Preset: Ocean (teal/cyan on light) ---------- */
:root[data-theme="ocean"] {
  --bg:#eef6f7; --surface:#ffffff; --surface-2:#f2f9fa; --surface-hover:#e8f4f5;
  --border:#dcebed; --border-strong:#c6dde0;
  --text:#12333a; --text-muted:#5f8189; --text-faint:#9bb6bc;
  --accent:#0ea5a5; --accent-hover:#0c9090; --accent-soft:#d8f3f3; --accent-contrast:#fff;
  --sidebar-bg:linear-gradient(180deg,#0e7c86,#14b8a6); --sidebar-text:#d6f4f2;
  --sidebar-active-bg:rgba(255,255,255,.22); --sidebar-active-text:#fff; --sidebar-border:rgba(255,255,255,.12);
  --kpi-1:#fff4dc;--kpi-1-ico:#d9a400;--kpi-2:#d9f5ec;--kpi-2-ico:#0ea577;
  --kpi-3:#d8f3f3;--kpi-3-ico:#0ea5a5;--kpi-4:#e2eefb;--kpi-4-ico:#3b82f6;
}

/* ---------- Preset: Violet (purple gradient sidebar, light body) ---------- */
:root[data-theme="violet"] {
  --bg:#f6f4fd; --surface:#ffffff; --surface-2:#f8f6ff; --surface-hover:#f0ecfd;
  --border:#eae4fb; --border-strong:#dcd2f5;
  --text:#241a3d; --text-muted:#7c709c; --text-faint:#aaa0c4;
  --accent:#8b5cf6; --accent-hover:#7c46f0; --accent-soft:#efe8ff; --accent-contrast:#fff;
  --sidebar-bg:linear-gradient(180deg,#7c3aed,#a855f7); --sidebar-text:#ece4ff;
  --sidebar-active-bg:rgba(255,255,255,.24); --sidebar-active-text:#fff; --sidebar-border:rgba(255,255,255,.14);
  --kpi-1:#fdf0d8;--kpi-1-ico:#d9a400;--kpi-2:#e6f7ee;--kpi-2-ico:#16b364;
  --kpi-3:#efe8ff;--kpi-3-ico:#8b5cf6;--kpi-4:#fbe8f6;--kpi-4-ico:#ec4899;
}

/* ---------- Preset: Emerald ---------- */
:root[data-theme="emerald"] {
  --bg:#eef7f0; --surface:#ffffff; --surface-2:#f2faf4; --surface-hover:#e7f4ea;
  --border:#daece0; --border-strong:#c3e0cd;
  --text:#14321f; --text-muted:#5c7d68; --text-faint:#9bbaa6;
  --accent:#12a150; --accent-hover:#0e8a44; --accent-soft:#daf3e3; --accent-contrast:#fff;
  --sidebar-bg:#0f2d1c; --sidebar-text:#a7d3ba; --sidebar-active-bg:#12a150; --sidebar-active-text:#fff; --sidebar-border:#1a3d29;
  --kpi-1:#fdf3d8;--kpi-1-ico:#d9a400;--kpi-2:#daf3e3;--kpi-2-ico:#12a150;
  --kpi-3:#dcefe6;--kpi-3-ico:#0d9488;--kpi-4:#e6eefb;--kpi-4-ico:#3b82f6;
}

/* ---------- Preset: Sunset (warm) ---------- */
:root[data-theme="sunset"] {
  --bg:#fdf3ee; --surface:#ffffff; --surface-2:#fef6f1; --surface-hover:#fcece3;
  --border:#f6e0d4; --border-strong:#eecab5;
  --text:#3a2418; --text-muted:#9c7563; --text-faint:#c4a494;
  --accent:#f97316; --accent-hover:#ea6a0d; --accent-soft:#ffe8d6; --accent-contrast:#fff;
  --sidebar-bg:linear-gradient(180deg,#f97316,#fb7185); --sidebar-text:#fff1e8;
  --sidebar-active-bg:rgba(255,255,255,.26); --sidebar-active-text:#fff; --sidebar-border:rgba(255,255,255,.16);
  --kpi-1:#fff0d6;--kpi-1-ico:#d9820e;--kpi-2:#e9f7ee;--kpi-2-ico:#16b364;
  --kpi-3:#ffe8d6;--kpi-3-ico:#f97316;--kpi-4:#fde4ec;--kpi-4-ico:#f43f5e;
}

/* ============================================================= */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}
.hidden { display: none !important; }
a { color: var(--accent); text-decoration: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Login ---------- */
.login { position: fixed; inset: 0; display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 70% -10%, var(--accent-soft), transparent), var(--bg); }
.login-card { width: 360px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 34px 30px; box-shadow: var(--shadow-lg); }
.login-brand { font-size: 22px; display: flex; align-items: center; gap: 10px; }
.login-sub { color: var(--text-muted); margin: 6px 0 22px; }
.login-card label { display: block; font-size: 12px; color: var(--text-muted); margin: 14px 0 6px; font-weight: 600; }
.login-card input { width: 100%; }
.login-hint { text-align: center; color: var(--text-faint); font-size: 12px; margin-top: 16px; }
.login-forgot { text-align: center; font-size: 13px; margin: 14px 0 0; }
.login-forgot a { color: var(--accent, #3b6ef5); text-decoration: none; font-weight: 600; }
.login-forgot a:hover { text-decoration: underline; }

/* Callout — inline status note (theme-safe: themed surface + severity border). */
.callout { border-radius: 8px; padding: 10px 12px; font-size: 13px; line-height: 1.5;
           background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.callout.ok   { border-color: rgba(46,160,90,.55); }
.callout.warn { border-color: rgba(228,160,32,.6); }
.callout.err  { border-color: rgba(210,64,54,.55); }
.callout code { background: var(--surface); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ---------- Brand logo (Countava wordmark) ----------
   Two variants ship in the markup; CSS shows the one that reads on the current
   background. Default = the colour logo; the white logo appears only where the
   surface is dark: the login card on the dark/midnight themes, and the sidebar on
   every theme except the light one (all other sidebars are dark or saturated). */
.brand-logo { display: block; height: auto; width: auto; }
.login-brand { justify-content: center; }
.login-brand .brand-logo { width: 210px; max-width: 100%; }
.sidebar-brand .brand-logo { width: 100%; max-width: 188px; }
.logo-white { display: none; }
.logo-color { display: block; }
:root:is([data-theme="dark"],[data-theme="midnight"],[data-theme="ocean"],[data-theme="violet"],[data-theme="emerald"],[data-theme="sunset"]) .sidebar-brand .logo-color { display: none; }
:root:is([data-theme="dark"],[data-theme="midnight"],[data-theme="ocean"],[data-theme="violet"],[data-theme="emerald"],[data-theme="sunset"]) .sidebar-brand .logo-white { display: block; }
:root:is([data-theme="dark"],[data-theme="midnight"]) .login-brand .logo-color { display: none; }
:root:is([data-theme="dark"],[data-theme="midnight"]) .login-brand .logo-white { display: block; }

/* ---------- App layout ---------- */
.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.sidebar { width: var(--sidebar-w); flex-shrink: 0; background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border); display: flex; flex-direction: column;
  padding: 18px 14px; transition: margin .25s ease; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px;
  color: var(--sidebar-text); padding: 6px 10px 20px; }
.sidebar-brand .logo-mark { color: inherit; filter: brightness(1.4); }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-group { font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--sidebar-text); opacity: .6; padding: 16px 12px 6px; font-weight: 700; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px;
  color: var(--sidebar-text); cursor: pointer; font-weight: 600; font-size: 13.5px;
  transition: background .15s, color .15s; }
.nav-item:hover { background: color-mix(in srgb, var(--sidebar-text) 12%, transparent); }
.nav-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); box-shadow: var(--shadow-sm); }
.nav-item .ni-ico { width: 18px; text-align: center; font-size: 15px; }
.sidebar-foot { padding-top: 10px; border-top: 1px solid var(--sidebar-border); }
.theme-mini { display: flex; gap: 7px; flex-wrap: wrap; padding: 8px 6px 2px; }
.swatch { width: 20px; height: 20px; border-radius: 6px; cursor: pointer; border: 2px solid transparent; }
.swatch.active { border-color: var(--sidebar-text); }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { height: 66px; flex-shrink: 0; display: flex; align-items: center; gap: 14px;
  padding: 0 22px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar .menu-toggle { display: none; }
.search { flex: 1; max-width: 560px; position: relative; }
.search input { width: 100%; padding: 11px 14px 11px 40px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 12px; color: var(--text); }
.search-ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-faint); font-size: 17px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-weight: 700; cursor: pointer; }

.content { flex: 1; overflow-y: auto; padding: 24px; }

/* ---------- Buttons / inputs ---------- */
.btn { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  padding: 9px 16px; border-radius: 11px; font-weight: 600; cursor: pointer; font-size: 13.5px;
  display: inline-flex; align-items: center; gap: 7px; transition: .15s; font-family: inherit; }
.btn:hover { background: var(--surface-hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; justify-content: center; margin-top: 20px; }
.icon-btn { width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-muted); cursor: pointer; font-size: 17px;
  display: grid; place-items: center; transition: .15s; }
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
input, select, textarea { font-family: inherit; font-size: 13.5px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 12px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft); }
label.fld { display: block; font-size: 12px; color: var(--text-muted); font-weight: 600; margin: 0 0 6px; }
.form-error { color: var(--danger); font-size: 12.5px; margin-top: 10px; min-height: 16px; }

/* ---------- Cards / grid ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0 0 4px; }
.page-head .sub { color: var(--text-muted); margin: 0; }
.grid { display: grid; gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-head h3 { margin: 0; font-size: 15.5px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.kpi { border-radius: var(--radius); padding: 18px 18px 16px; border: 1px solid var(--border); position: relative; }
.kpi .kpi-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  font-size: 19px; position: absolute; top: 16px; right: 16px; background: rgba(255,255,255,.55); }
.kpi .kpi-label { color: var(--text-muted); font-size: 12.5px; font-weight: 600; }
.kpi .kpi-val { font-size: 26px; font-weight: 800; margin: 8px 0 6px; letter-spacing: -.5px; }
.kpi .kpi-foot { font-size: 12px; color: var(--text-muted); }
.kpi.k1 { background: var(--kpi-1); } .kpi.k1 .kpi-ico { color: var(--kpi-1-ico); }
.kpi.k2 { background: var(--kpi-2); } .kpi.k2 .kpi-ico { color: var(--kpi-2-ico); }
.kpi.k3 { background: var(--kpi-3); } .kpi.k3 .kpi-ico { color: var(--kpi-3-ico); }
.kpi.k4 { background: var(--kpi-4); } .kpi.k4 .kpi-ico { color: var(--kpi-4-ico); }
.dash-2col { display: grid; grid-template-columns: 1.7fr 1fr; gap: 18px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th { text-align: left; color: var(--text-muted); font-weight: 600; font-size: 12px;
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--border); }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr { cursor: default; }
table.tbl tbody tr.clickable:hover { background: var(--surface-hover); cursor: pointer; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.tree-toggle { display: inline-block; width: 16px; cursor: pointer; color: var(--text-faint); user-select: none; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700; }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.amber { background: var(--warning-soft); color: var(--warning); }
.badge.blue { background: var(--info-soft); color: var(--info); }
.badge.gray { background: var(--surface-2); color: var(--text-muted); }
.badge.violet { background: color-mix(in srgb, #8b5cf6 16%, var(--surface)); color: #8b5cf6; }

/* role permission grid */
.perm-grid td, .perm-grid th { text-align: center; }
.perm-grid td:first-child, .perm-grid th:first-child { text-align: left; }
.perm-w { color: var(--success); font-weight: 700; font-size: 12px; }
.perm-v { color: var(--info); font-size: 12px; }
.perm-n { color: var(--text-muted); }

/* pending-count badge on a nav item */
.nav-badge { margin-left: auto; background: var(--warning, #f97316); color: #fff; font-size: 11px;
  font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center; }
.pill-type { font-size: 11px; color: var(--text-muted); background: var(--surface-2); padding: 2px 9px; border-radius: 8px; }

/* ---------- Drawer ---------- */
.drawer-scrim { position: fixed; inset: 0; background: rgba(15,20,40,.42); opacity: 0;
  pointer-events: none; transition: opacity .25s; z-index: 40; backdrop-filter: blur(2px); }
.drawer-scrim.show { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; height: 100vh; height: 100dvh; width: 520px; max-width: 94vw;
  background: var(--surface); box-shadow: var(--shadow-lg); z-index: 50;
  transform: translateX(100%); transition: transform .28s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer.wide { width: 780px; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px;
  border-bottom: 1px solid var(--border); }
.drawer-head h2 { margin: 0; font-size: 18px; }
.drawer-body { padding: 22px 24px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.close-x { border: none; background: transparent; font-size: 22px; color: var(--text-muted); cursor: pointer; line-height: 1; }

/* ---------- Modal ---------- */
.modal-host { position: fixed; inset: 0; z-index: 60; display: none; place-items: center; }
.modal-host.show { display: grid; }
.modal-back { position: absolute; inset: 0; background: rgba(15,20,40,.45); backdrop-filter: blur(2px); }
.modal { position: relative; background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 440px; max-width: 92vw; padding: 26px; z-index: 1; }
.modal h3 { margin: 0 0 8px; }
.modal .modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ---------- Form rows ---------- */
.frow { margin-bottom: 16px; }
.frow-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.line-table { width: 100%; border-collapse: collapse; }
.line-table th { font-size: 11.5px; color: var(--text-muted); text-align: left; padding: 6px 8px; }
.line-table td { padding: 4px; }
.line-table input, .line-table select { width: 100%; padding: 8px 9px; }
.line-total { display: flex; justify-content: flex-end; gap: 26px; padding: 12px 8px 0; font-weight: 700; }
.line-total .bad { color: var(--danger); } .line-total .good { color: var(--success); }

/* tax multi-select checklist (invoices, bills, expenses, settings default) */
.tax-check-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.tax-check { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px;
  border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface);
  cursor: pointer; font-size: 13px; user-select: none; }
.tax-check:hover { border-color: var(--accent); }
.tax-check:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.tax-check input { margin: 0; }
.tax-switch { display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.tax-switch input { width: 18px; height: 18px; margin: 0; flex-shrink: 0; }
.tax-switch span { display: flex; flex-direction: column; gap: 1px; font-size: 13.5px; }
.tax-switch .muted { font-size: 12px; }

/* editable expense tax rows: checkbox + auto/override amount */
.tax-rows { display: flex; flex-direction: column; gap: 8px; }
.tax-erow { display: flex; align-items: center; gap: 12px; }
.tax-erow .tax-check { flex: 1; }
.tax-erow .tx-amt-wrap { display: inline-flex; align-items: center; gap: 4px; }
.tax-erow .tx-cur { color: var(--text-muted); font-size: 13px; }
.tax-erow .tx-amt { width: 110px; text-align: right; }
.tax-erow .tx-amt:disabled { opacity: .5; }

/* delivered/billed progress bars on sales orders */
.pctbar { display: inline-block; width: 68px; height: 6px; border-radius: 4px; background: var(--surface-3, var(--surface-2)); overflow: hidden; vertical-align: middle; margin-right: 6px; }
.pctbar span { display: block; height: 100%; border-radius: 4px; }

/* ---------- Toast ---------- */
.toast-host { position: fixed; bottom: 22px; right: 22px; z-index: 80; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  box-shadow: var(--shadow-lg); padding: 13px 18px; border-radius: 12px; min-width: 240px;
  animation: slideIn .25s ease; }
.toast.ok { border-left-color: var(--success); }
.toast.err { border-left-color: var(--danger); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

.empty { text-align: center; color: var(--text-faint); padding: 40px 20px; }

/* ---------- Dashboard: KPI trend chips ---------- */
.kpi-trend { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px; }
.kpi-trend.up { color: var(--success); background: var(--success-soft); }
.kpi-trend.down { color: var(--danger); background: var(--danger-soft); }
.kpi-trend.flat { color: var(--text-muted); background: var(--surface-2); }
.kpi .kpi-foot { display: flex; align-items: center; gap: 8px; }

/* ---------- Secondary stat strip ---------- */
.stat-strip { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 18px; }
.stat-mini { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow-sm); }
.stat-mini .sm-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; flex-shrink: 0; }
.stat-mini .sm-label { color: var(--text-muted); font-size: 12px; font-weight: 600; }
.stat-mini .sm-val { font-size: 19px; font-weight: 800; letter-spacing: -.3px; }

/* ---------- Donut + legend ---------- */
.donut-wrap { position: relative; height: 190px; margin: 4px 0 8px; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; text-align: center; }
.donut-center .dc-val { font-size: 21px; font-weight: 800; letter-spacing: -.5px; }
.donut-center .dc-lbl { font-size: 11px; color: var(--text-muted); }
.legend-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-top: 1px solid var(--border); font-size: 13px; }
.legend-row:first-child { border-top: none; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-row .lr-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-row .lr-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.legend-row .lr-pct { color: var(--text-muted); font-size: 11.5px; min-width: 38px; text-align: right; }

/* ---------- Activity feed ---------- */
.activity-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.activity-item:first-child { border-top: none; }
.activity-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 15px; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent); }
.activity-main { flex: 1; min-width: 0; }
.activity-main .am-ref { font-weight: 700; font-size: 13px; }
.activity-main .am-type { color: var(--text-muted); font-size: 11.5px; }
.activity-amt { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13px; }

/* ---------- Top customers ---------- */
.cust-row { padding: 10px 0; border-top: 1px solid var(--border); }
.cust-row:first-child { border-top: none; }
.cust-head { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 13px; }
.cust-head b { font-weight: 700; }
.cust-bar { height: 7px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.cust-bar span { display: block; height: 100%; background: var(--accent); border-radius: 5px; }

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: 1fr 380px; gap: 18px; height: calc(100vh - 66px - 48px); }
.pos-left { display: flex; flex-direction: column; min-height: 0; }
.pos-toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.pos-toolbar input, .pos-toolbar select { padding: 10px 12px; }
.pos-search { flex: 1; min-width: 180px; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 12px;
  overflow-y: auto; padding: 2px; align-content: start; }
.pos-item { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px;
  cursor: pointer; transition: .12s; box-shadow: var(--shadow-sm); user-select: none; }
.pos-item:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.pos-item:active { transform: translateY(0) scale(.98); }
.pos-item .pi-thumb { height: 56px; border-radius: 10px; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-size: 24px; font-weight: 800; margin-bottom: 10px; }
.pos-item .pi-name { font-weight: 700; font-size: 13px; line-height: 1.25; margin-bottom: 4px; }
.pos-item .pi-price { color: var(--accent); font-weight: 800; }
.pos-item .pi-stock { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.pos-item.out { opacity: .5; pointer-events: none; }

.pos-cart { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; box-shadow: var(--shadow-sm); min-height: 0; }
.pos-cart-head { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.pos-cart-head h3 { margin: 0; font-size: 16px; }
.pos-cart-lines { flex: 1; overflow-y: auto; padding: 8px 18px; }
.cart-line { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.cart-line:last-child { border-bottom: none; }
.cl-info { flex: 1; min-width: 0; }
.cl-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-rate { color: var(--text-muted); font-size: 12px; }
.qty-step { display: flex; align-items: center; gap: 0; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; }
.qty-step button { width: 28px; height: 30px; border: none; background: var(--surface-2); color: var(--text); cursor: pointer; font-size: 16px; }
.qty-step button:hover { background: var(--surface-hover); }
.qty-step .qv { min-width: 34px; text-align: center; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.cl-amt { font-weight: 700; min-width: 62px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
.cl-del { border: none; background: transparent; color: var(--text-faint); cursor: pointer; font-size: 15px; }
.cl-del:hover { color: var(--danger); }
.pos-cart-foot { padding: 16px 18px; border-top: 1px solid var(--border); }
.pos-total-row { display: flex; justify-content: space-between; padding: 4px 0; color: var(--text-muted); font-size: 13.5px; }
.pos-total-row.grand { color: var(--text); font-weight: 800; font-size: 20px; padding-top: 10px; }
.pos-charge { width: 100%; margin-top: 14px; padding: 15px; font-size: 16px; font-weight: 800; border-radius: 13px; justify-content: center; }
.pos-empty-cart { text-align: center; color: var(--text-faint); padding: 40px 16px; }
@media (max-width: 900px) {
  .pos { grid-template-columns: 1fr; height: auto; }
  .pos-grid { max-height: 46vh; }
}

/* ---------- Settings ---------- */
.set-section { margin-bottom: 18px; }
.set-section h3 { margin: 0 0 4px; font-size: 15.5px; }
.set-section .set-sub { color: var(--text-muted); font-size: 12.5px; margin: 0 0 16px; }
.inv-cfg { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(90px,1fr)); gap: 10px; }
.preset-opt { border: 2px solid var(--border); border-radius: 12px; padding: 10px 8px; cursor: pointer; text-align: center;
  font-size: 12.5px; font-weight: 600; transition: .12s; background: var(--surface-2); }
.preset-opt:hover { border-color: var(--border-strong); }
.preset-opt.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.preset-opt .pv { height: 34px; border-radius: 6px; margin-bottom: 7px; background: #fff; border: 1px solid var(--border);
  position: relative; overflow: hidden; }
.preset-opt .pv::before { content:''; position:absolute; left:0; right:0; top:0; height:10px; background: var(--pvacc,#3b6ef5); }
.preset-opt[data-p="modern"] .pv::before { height:100%; opacity:.9; }
.preset-opt[data-p="minimal"] .pv::before { background:#c7ccd6; height:2px; top:8px; }
.preset-opt[data-p="bold"] .pv::before { height:16px; }
.preset-opt[data-p="compact"] .pv::before { height:5px; }
.accent-swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.accent-sw { width: 28px; height: 28px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.accent-sw.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface); }
.logo-drop { border: 2px dashed var(--border-strong); border-radius: 12px; padding: 16px; text-align: center; cursor: pointer;
  color: var(--text-muted); transition: .12s; }
.logo-drop:hover { border-color: var(--accent); color: var(--accent); }
.logo-preview { display: flex; align-items: center; gap: 14px; }
.logo-preview img { max-height: 54px; max-width: 150px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; padding: 6px; background:#fff; }
.inv-preview-panel { background: repeating-conic-gradient(var(--surface-2) 0% 25%, var(--surface) 0% 50%) 50%/18px 18px;
  border: 1px solid var(--border); border-radius: 14px; padding: 14px; overflow: hidden; }
.inv-preview { overflow: hidden; background: transparent; }
.inv-preview .invdoc { box-shadow: 0 8px 30px rgba(20,30,60,.14); }
@media (max-width: 820px) { .inv-cfg { grid-template-columns: 1fr; } }

/* ---------- Gantt / timeline ---------- */
.gantt { --grh: 38px; --ghh: 46px; --lblw: 240px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.gantt-toolbar { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.gantt-body { display: flex; }
.gantt-labels { flex: 0 0 var(--lblw); width: var(--lblw); border-right: 1px solid var(--border); overflow: hidden; background: var(--surface); z-index: 2; }
.gantt-tl-scroll { flex: 1; overflow-x: auto; }
.g-head { height: var(--ghh); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.g-lbl-head { height: var(--ghh); display: flex; align-items: center; padding: 0 14px; font-weight: 700; font-size: 12px; color: var(--text-muted);
  background: var(--surface-2); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 3; }
.g-lbl { height: var(--grh); display: flex; align-items: center; gap: 8px; padding: 0 14px; border-bottom: 1px solid var(--border); font-size: 13px; white-space: nowrap; overflow: hidden; }
.g-lbl.group { font-weight: 800; background: var(--surface-2); }
.g-lbl .g-lbl-sub { color: var(--text-faint); font-size: 11px; margin-left: auto; }
.g-lbl-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.g-tl { position: relative; }
.g-month { position: absolute; top: 0; height: 22px; border-left: 1px solid var(--border); font-size: 11px; font-weight: 700; color: var(--text-muted); padding: 4px 0 0 6px; box-sizing: border-box; overflow: hidden; }
.g-tick { position: absolute; top: 22px; height: 24px; border-left: 1px solid var(--border); font-size: 10px; color: var(--text-faint); padding: 5px 0 0 3px; box-sizing: border-box; }
.g-grid { position: absolute; top: var(--ghh); bottom: 0; border-left: 1px solid var(--border); }
.g-grid.wk { border-left-color: var(--border-strong); }
.g-track { height: var(--grh); border-bottom: 1px solid var(--border); position: relative; }
.g-track.group { background: var(--surface-2); }
.g-bar { position: absolute; top: 7px; height: 22px; border-radius: 6px; cursor: grab; overflow: hidden; box-shadow: var(--shadow-sm);
  display: flex; align-items: center; user-select: none; touch-action: none; }
.g-bar:active { cursor: grabbing; }
.g-bar .g-fill { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255,255,255,.35); }
.g-bar .g-bar-lbl { position: relative; font-size: 11px; font-weight: 600; color: #fff; padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-bar.st-Open { background: #8a94a6; } .g-bar.st-Working { background: var(--accent); }
.g-bar.st-Pending.g-bar { background: #f59e0b; } .g-bar[data-st="Pending Review"] { background: #f59e0b; }
.g-bar.st-Completed { background: #16b364; }
.g-bar.summary { top: 12px; height: 12px; border-radius: 6px; background: linear-gradient(90deg,var(--accent),color-mix(in srgb,var(--accent) 55%,#000)); opacity: .85; cursor: default; }
.g-h { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; z-index: 3; }
.g-h-l { left: 0; } .g-h-r { right: 0; }
.g-bar:hover .g-h { background: rgba(255,255,255,.35); }
.g-deps { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 1; overflow: visible; }
.g-deps path.dep { stroke: var(--text-muted); stroke-width: 1.5; fill: none; opacity: .8; }
.g-deps path.dep.viol { stroke: var(--danger); stroke-width: 2; opacity: 1; }
.g-deps #gah path { fill: var(--text-muted); }
.g-deps #gahv path { fill: var(--danger); }
.g-today { position: absolute; top: var(--ghh); bottom: 0; width: 2px; background: var(--danger); z-index: 4; }
.g-today::after { content: 'Today'; position: absolute; top: -18px; left: -16px; font-size: 10px; color: var(--danger); font-weight: 700; }
.g-empty { padding: 40px; text-align: center; color: var(--text-faint); }

/* ---------- CRM pipeline board ---------- */
.pipeline { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.pipe-col { flex: 0 0 240px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 12px; }
.pipe-col h4 { margin: 0 0 4px; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.pipe-col .col-sum { font-size: 11.5px; color: var(--text-muted); margin-bottom: 10px; }
.pipe-card { background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 12px;
  margin-bottom: 9px; cursor: pointer; box-shadow: var(--shadow-sm); transition: .15s; }
.pipe-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.pipe-card .pc-title { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.pipe-card .pc-party { color: var(--text-muted); font-size: 12px; }
.pipe-card .pc-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 9px; }
.pipe-card .pc-amt { font-weight: 700; font-size: 13.5px; }
.prob-dot { width: 34px; height: 5px; border-radius: 3px; background: var(--border-strong); position: relative; overflow: hidden; }
.prob-dot span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); }

/* ---------- Global search results ---------- */
.search { position: relative; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 30;
  max-height: 60vh; overflow-y: auto; padding: 6px; }
.sr-item { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px; cursor: pointer; }
.sr-item:hover, .sr-item.active { background: var(--surface-hover); }
.sr-type { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint);
  background: var(--surface-2); padding: 2px 7px; border-radius: 6px; flex-shrink: 0; min-width: 92px; text-align: center; }
.sr-main { font-weight: 600; font-size: 13px; }
.sr-sub { color: var(--text-muted); font-size: 12px; }
.sr-empty { padding: 18px; text-align: center; color: var(--text-faint); font-size: 13px; }
.chart-box { position: relative; height: 300px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: none; background: transparent; padding: 6px 13px; border-radius: 8px; cursor: pointer;
  color: var(--text-muted); font-weight: 600; font-size: 12.5px; }
.seg button.active { background: var(--accent); color: #fff; }

/* ---------- Sidebar overlay (mobile) ---------- */
.sidebar-scrim { position: fixed; inset: 0; background: rgba(15,20,40,.42); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 44; }
.sidebar-scrim.show { opacity: 1; pointer-events: auto; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .dash-2col { grid-template-columns: 1fr; } .kpis { grid-template-columns: repeat(2,1fr); } }

@media (max-width: 820px) {
  .sidebar { position: fixed; z-index: 45; height: 100vh; height: 100dvh; width: 270px; left: 0; top: 0;
    transform: translateX(-100%); transition: none; box-shadow: var(--shadow-lg); margin-left: 0; }
  .sidebar.open { transform: translateX(0); }
  .topbar .menu-toggle { display: grid; }
  .topbar { height: 60px; padding: 0 14px; gap: 10px; }
  .topbar-actions { gap: 7px; }
  .search input { padding: 10px 12px 10px 38px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .content { padding: 16px; }
  .page-head h1 { font-size: 19px; }
  /* larger nav tap targets */
  .nav-item { padding: 12px 12px; font-size: 14px; }
  /* wide form tables scroll horizontally on their own, not the whole form */
  .line-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .line-table thead, .line-table tbody { display: table; width: 100%; min-width: 480px; }
}

@media (max-width: 620px) {
  .drawer, .drawer.wide { width: 100vw; max-width: 100vw; }
  .modal { width: calc(100vw - 28px); }
  .kpis { grid-template-columns: 1fr 1fr; }
  .search input::placeholder { color: transparent; } /* keep the field, drop long placeholder */
}

@media (max-width: 480px) {
  .kpis { grid-template-columns: 1fr; }
  .frow-2 { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: 1fr; }
  .page-head { gap: 10px; }
  .page-head .btn, .page-head > div:last-child { width: 100%; }
  .page-head .btn { justify-content: center; }
  #quickAdd { display: none; } /* quick-add duplicated by per-page New buttons */
  .content { padding: 12px; }
  .card { padding: 16px; }
  .drawer-head, .drawer-body, .drawer-foot { padding-left: 16px; padding-right: 16px; }
  .drawer-foot { flex-wrap: wrap; }
  .drawer-foot .btn { flex: 1; justify-content: center; }
}

/* ===================== Subscription: trial banner + paywall ===================== */
.trial-banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 9px 18px; background: var(--accent-soft); color: var(--text);
  border-bottom: 1px solid var(--border-strong); font-size: 13.5px;
}
.trial-banner.warn { background: var(--warning-soft); }
.trial-banner .tb-msg { flex: 1; min-width: 200px; }
.trial-banner .tb-actions { display: flex; align-items: center; gap: 8px; }
.trial-banner .tb-btn {
  background: var(--accent); color: var(--accent-contrast); border: none;
  padding: 7px 16px; border-radius: 8px; font-weight: 700; font-size: 13px; cursor: pointer;
}
.trial-banner .tb-btn:hover { background: var(--accent-hover); }
.trial-banner .tb-btn.tb-ghost {
  background: transparent; color: var(--accent); border: 1.5px solid var(--accent);
}
.trial-banner .tb-btn.tb-ghost:hover { background: var(--accent-soft); }

/* Upgrade (Bookkeeping → Full ERP) modal */
.up-feats { list-style: none; margin: 8px 0 18px; padding: 0; display: grid; gap: 8px; }
.up-feats li {
  position: relative; padding-left: 26px; font-size: 14px; line-height: 1.45;
}
.up-feats li::before {
  content: "✓"; position: absolute; left: 0; top: 0; font-weight: 800; color: var(--success);
  width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center;
}
.up-price {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 800; font-size: 26px;
  letter-spacing: -.01em; margin: 4px 0 8px;
}
.up-price .pw-per { color: var(--text-muted); font-weight: 500; font-size: 13px; }
.up-go { width: 100%; justify-content: center; padding: 13px; font-size: 15px; margin-top: 6px; }
.up-go[disabled] { opacity: .5; cursor: not-allowed; }
.trial-banner .tb-x {
  background: transparent; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 15px; line-height: 1; padding: 6px; border-radius: 6px;
}
.trial-banner .tb-x:hover { background: rgba(0,0,0,.06); color: var(--text); }

.paywall {
  position: fixed; inset: 0; z-index: 4000;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 24px; overflow-y: auto;
}
.paywall .pw-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: 0 30px 80px -24px rgba(15,20,40,.5);
  width: 100%; max-width: 460px; padding: 34px 34px 26px; text-align: center;
}
.paywall .pw-logo { height: 40px; margin-bottom: 18px; }
.paywall h2 { font-size: 22px; margin: 0 0 8px; letter-spacing: -.02em; }
.paywall .pw-lead { color: var(--text-muted); font-size: 14.5px; margin: 0 0 22px; }
.pw-chooser { text-align: left; }
.pw-cyc-toggle {
  display: flex; gap: 6px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 4px; margin: 0 0 16px;
}
.pw-cyc {
  flex: 1; border: none; background: transparent; color: var(--text-muted);
  padding: 8px 10px; border-radius: 7px; font-weight: 600; font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-family: inherit;
}
.pw-cyc.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(20,30,60,.12); }
.pw-save { font-size: 10.5px; font-weight: 700; color: var(--success); background: var(--success-soft); padding: 2px 6px; border-radius: 20px; }
.pw-plans { display: grid; gap: 10px; margin-bottom: 18px; }
.pw-plan {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1.5px solid var(--border); border-radius: 12px; padding: 14px 16px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.pw-plan:hover { border-color: var(--border-strong); }
.pw-plan.sel { border-color: var(--accent); background: var(--accent-soft); }
.pw-plan-name { font-weight: 700; font-size: 15px; }
.pw-plan-price { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 700; }
.pw-plan-price .pw-per { color: var(--text-muted); font-weight: 500; font-size: 12px; }
.pw-sub { width: 100%; justify-content: center; padding: 13px; font-size: 15px; }
.pw-sub[disabled] { opacity: .5; cursor: not-allowed; }
.pw-note { color: var(--warning); font-size: 12.5px; margin: 14px 0 0; }
.pw-signout {
  background: transparent; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 13px; margin-top: 16px; text-decoration: underline; font-family: inherit;
}

/* Print: drop the app chrome so a printed view (e.g. a statement) is clean. */
@media print {
  .sidebar, .topbar, .no-print, #drawer, #scrim, .drawer-scrim,
  .sidebar-scrim, .modal-host, .toast-host { display: none !important; }
  .main, .content, #view { margin: 0 !important; padding: 0 !important; }
  .card, .set-section { box-shadow: none !important; border: none !important; }
  body, .app { background: #fff !important; }
}
