/* ───────────────────────── ImpactHive design system ─────────────────────────
   Palette: deep navy (trust) + teal (brand) + amber (attention) + coral (alert) + violet/blue (data accents).
   Light and dark themes; the sidebar is navy in both. Text on the brand colour always passes WCAG AA. */

:root {
  --bg: #f2f5fa; --surface: #ffffff; --surface2: #f7f9fc; --ink: #12203a; --mut: #5f6f89; --line: #e4eaf3; --line2: #d3dcea;
  --brand: #0f766e; --brand-hover: #115e59; --brand-soft: #d9f5f0; --brand-ink: #0b5b55; --brand-glow: #14b8a6;
  --ok: #15803d; --ok-soft: #dcfce7; --warn: #b45309; --warn-soft: #fef3c7; --bad: #b91c1c; --bad-soft: #fee2e2;
  --info: #1d4ed8; --info-soft: #dbeafe; --violet: #6d28d9; --violet-soft: #ede9fe;
  --shadow: 0 1px 2px rgba(18, 32, 58, .05), 0 12px 28px -16px rgba(18, 32, 58, .18);
  --shadow-lg: 0 24px 60px -20px rgba(18, 32, 58, .45);
  --nav-a: #ffffff; --nav-b: #eef7fa; --nav-ink: #3b4f72; --nav-mut: #8394b0; --nav-strong: #10203b; --nav-hover: color-mix(in srgb, var(--brand) 8%, transparent); --nav-card: color-mix(in srgb, var(--brand) 6%, transparent); --nav-line: rgba(16, 32, 59, .08);
  --nav-glow: color-mix(in srgb, var(--brand-glow) 16%, transparent); --nav-on-bg: linear-gradient(90deg, color-mix(in srgb, var(--brand-glow) 18%, transparent), color-mix(in srgb, var(--brand-glow) 5%, transparent)); --nav-on-ink: var(--brand-ink); --nav-on-icon: var(--brand); --nav-shadow: 10px 0 40px -28px rgba(16, 42, 76, .35);
  --radius: 14px; --radius-sm: 10px; --ring: 0 0 0 3px rgba(20, 184, 166, .28);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0a1220; --surface: #111c30; --surface2: #15223a; --ink: #e8eef9; --mut: #93a5c2; --line: #223250; --line2: #2d4066;
  --brand: #2dd4bf; --brand-hover: #5eead4; --brand-soft: rgba(45, 212, 191, .14); --brand-ink: #5eead4;
  --ok: #4ade80; --ok-soft: rgba(74, 222, 128, .14); --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .14); --bad: #f87171; --bad-soft: rgba(248, 113, 113, .15);
  --info: #60a5fa; --info-soft: rgba(96, 165, 250, .15); --violet: #a78bfa; --violet-soft: rgba(167, 139, 250, .16);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 14px 30px -16px rgba(0, 0, 0, .6); --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .8);
  --nav-a: #070e1c; --nav-b: #0c1b33; --nav-ink: #c6d3e8; --nav-mut: #7f93b3; --nav-strong: #ffffff; --nav-hover: rgba(255, 255, 255, .07); --nav-card: rgba(255, 255, 255, .06); --nav-line: rgba(255, 255, 255, .09);
    --nav-glow: color-mix(in srgb, var(--brand-glow) 22%, transparent); --nav-on-bg: linear-gradient(90deg, color-mix(in srgb, var(--brand-glow) 22%, transparent), color-mix(in srgb, var(--brand-glow) 6%, transparent)); --nav-on-ink: #ffffff; --nav-on-icon: var(--brand-glow); --nav-shadow: none; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1220; --surface: #111c30; --surface2: #15223a; --ink: #e8eef9; --mut: #93a5c2; --line: #223250; --line2: #2d4066;
    --brand: #2dd4bf; --brand-hover: #5eead4; --brand-soft: rgba(45, 212, 191, .14); --brand-ink: #5eead4;
    --ok: #4ade80; --ok-soft: rgba(74, 222, 128, .14); --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .14); --bad: #f87171; --bad-soft: rgba(248, 113, 113, .15);
    --info: #60a5fa; --info-soft: rgba(96, 165, 250, .15); --violet: #a78bfa; --violet-soft: rgba(167, 139, 250, .16);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 14px 30px -16px rgba(0, 0, 0, .6); --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .8);
    --nav-a: #070e1c; --nav-b: #0c1b33; --nav-ink: #c6d3e8; --nav-mut: #7f93b3; --nav-strong: #ffffff; --nav-hover: rgba(255, 255, 255, .07); --nav-card: rgba(255, 255, 255, .06); --nav-line: rgba(255, 255, 255, .09);
    --nav-glow: color-mix(in srgb, var(--brand-glow) 22%, transparent); --nav-on-bg: linear-gradient(90deg, color-mix(in srgb, var(--brand-glow) 22%, transparent), color-mix(in srgb, var(--brand-glow) 6%, transparent)); --nav-on-ink: #ffffff; --nav-on-icon: var(--brand-glow); --nav-shadow: none; color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  background-image: radial-gradient(900px 420px at 85% -80px, color-mix(in srgb, var(--brand-glow) 9%, transparent), transparent 70%), radial-gradient(700px 360px at -10% 110%, rgba(99, 102, 241, .06), transparent 70%);
  background-attachment: fixed;
}
h1, h2, h3, h4 { letter-spacing: -.01em; }
h3 { font-size: 15px; font-weight: 650; margin: 0 0 12px; }
h4 { font-size: 13px; font-weight: 650; margin: 14px 0 8px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
code { background: var(--surface2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font-size: 12px; }
::selection { background: color-mix(in srgb, var(--brand-glow) 28%, transparent); }
:focus-visible { outline: 0; box-shadow: var(--ring); border-radius: 8px; }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; } ::-webkit-scrollbar-track { background: transparent; }

/* ───── forms & buttons ───── */
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--surface); border: 1px solid var(--line2); border-radius: var(--radius-sm); padding: 8px 11px; max-width: 100%; min-height: 36px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--mut); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--brand-glow); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--mut); opacity: .7; }
input[type="checkbox"], input[type="radio"] { min-height: 0; width: 16px; height: 16px; accent-color: var(--brand); padding: 0; }
input[type="file"] { padding: 6px; }
select { cursor: pointer; }
input:disabled, select:disabled, textarea:disabled { background: var(--surface2); color: var(--mut); cursor: not-allowed; }
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 8px 16px; border: 0; border-radius: var(--radius-sm);
  background: var(--brand); color: #fff; font-weight: 600; cursor: pointer; letter-spacing: .005em;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .15) inset, 0 6px 14px -8px color-mix(in srgb, var(--brand) 70%, transparent); transition: transform .12s, box-shadow .15s, background .15s, opacity .15s;
}
:root[data-theme="dark"] button:not(.ghost):not(.bad) { color: #04201d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) button:not(.ghost):not(.bad) { color: #04201d; } }
button:hover:not(:disabled) { background: var(--brand-hover); transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255, 255, 255, .15) inset, 0 10px 18px -8px color-mix(in srgb, var(--brand) 75%, transparent); }
button:active:not(:disabled) { transform: translateY(0); }
button.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line2); box-shadow: none; font-weight: 550; }
button.ghost:hover:not(:disabled) { background: var(--surface2); border-color: var(--brand-glow); color: var(--brand-ink); transform: none; box-shadow: none; }
button.bad { background: var(--bad); color: #fff; box-shadow: none; }
button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }
a.l { color: var(--brand-ink); cursor: pointer; text-decoration: none; font-weight: 550; border-radius: 4px; }
a.l:hover { text-decoration: underline; text-underline-offset: 3px; }
.err { color: var(--bad); }
.mut { color: var(--mut); font-size: 12px; }
.form { display: flex; gap: 10px 12px; flex-wrap: wrap; align-items: end; }
.form label, label.f { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--mut); letter-spacing: .01em; }
.form label input, .form label select { color: var(--ink); font-weight: 400; font-size: 13.5px; }

/* ───── cards, grid, tables ───── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 16px; }
.grid > .card { margin-bottom: 0; }
.top { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; }
.kpi { font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; border-radius: 12px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th { text-align: left; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--mut); padding: 9px 10px; background: var(--surface2); border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child { border-top-left-radius: 10px; } th:last-child { border-top-right-radius: 10px; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr { transition: background .12s; } tbody tr:hover > td { background: color-mix(in srgb, var(--brand-soft) 55%, transparent); }
tr:last-child > td { border-bottom: 0; }
.nw { white-space: nowrap; }
.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td input, td select { min-height: 30px; padding: 4px 8px; border-radius: 8px; font-size: 13px; }
td input[type="date"] { padding: 3px 6px; }
.kv td { padding: 6px 4px; border-bottom: 1px dashed var(--line); } .kv td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.kv tr.sub td { font-weight: 700; border-top: 1px solid var(--line2); border-bottom: 0; }

/* ───── status language ───── */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--surface2); color: var(--mut); border: 1px solid var(--line); white-space: nowrap; }
.pill.posted, .pill.active { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.submitted { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.draft { background: var(--info-soft); color: var(--info); border-color: transparent; }
.pill.rejected, .pill.reversed { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 11px; border-radius: 99px; font-weight: 650; font-size: 12px; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.no { background: var(--bad-soft); color: var(--bad); }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--brand-soft); color: var(--brand-ink); border-radius: 99px; padding: 4px 12px; margin: 0 6px 6px 0; font-weight: 550; }
.chip a { cursor: pointer; color: var(--bad); }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; min-width: 90px; flex: 1; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand-glow), var(--brand)); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.bar.warn > i { background: linear-gradient(90deg, #fbbf24, #d97706); } .bar.over > i { background: linear-gradient(90deg, #fb7185, #dc2626); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; background: var(--surface2); padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.tabs button { background: transparent; color: var(--mut); border: 0; box-shadow: none; min-height: 32px; padding: 6px 14px; border-radius: 9px; font-weight: 600; }
.tabs button:hover:not(:disabled) { background: var(--surface); color: var(--ink); transform: none; box-shadow: none; }
.tabs button.on { background: var(--surface); color: var(--brand-ink); box-shadow: 0 1px 3px rgba(18, 32, 58, .14); }
.sigs { display: flex; gap: 28px; margin-top: 40px; } .sigs div { flex: 1; border-top: 1.5px solid var(--ink); padding-top: 5px; font-size: 12px; color: var(--mut); }
.live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; margin-right: 6px; box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: pulse 2.2s infinite; }

/* ───── app shell ───── */
#app { display: flex; min-height: 100vh; }
nav.side {
  width: 256px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 14px 14px; overflow: hidden;
  background: radial-gradient(420px 260px at 0% 0%, var(--nav-glow), transparent 70%), linear-gradient(180deg, var(--nav-a), var(--nav-b)); color: var(--nav-ink);
  border-right: 1px solid var(--nav-line); box-shadow: var(--nav-shadow); z-index: 8;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px 16px; }
.brand .logo { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand-glow), var(--brand) 55%, #f59e0b 130%); box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--brand-glow) 70%, transparent); }
.brand .logo svg { width: 22px; height: 22px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.brand b { display: block; color: var(--nav-strong); font-size: 17px; letter-spacing: -.02em; line-height: 1.1; } .brand small { color: var(--nav-mut); font-size: 11px; }
.orgbox { background: var(--nav-card); border: 1px solid var(--nav-line); border-radius: 12px; padding: 9px 10px; margin-bottom: 14px; }
.orgbox small { display: block; color: var(--nav-mut); font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }
.orgbox select { width: 100%; background: transparent; color: var(--nav-strong); border: 0; padding: 2px 0; min-height: 0; font-weight: 600; font-size: 13.5px; box-shadow: none; }
.orgbox select option { color: #12203a; background: #fff; } .orgbox select:focus { box-shadow: none; }
.navwrap { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; scrollbar-color: var(--nav-line) transparent; }
.navgroup { margin-bottom: 10px; }
.navgroup > small { display: block; padding: 6px 10px 4px; color: var(--nav-mut); font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .09em; }
nav.side a.nav { display: flex; align-items: center; gap: 11px; padding: 8px 10px; margin-bottom: 2px; border-radius: 10px; color: var(--nav-ink); text-decoration: none; font-weight: 550; position: relative; transition: background .15s, color .15s; }
nav.side a.nav svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
nav.side a.nav:hover { background: var(--nav-hover); color: var(--nav-strong); }
nav.side a.nav.on { background: var(--nav-on-bg); color: var(--nav-on-ink); font-weight: 650; }
nav.side a.nav.on::before { content: ""; position: absolute; left: -14px; top: 7px; bottom: 7px; width: 4px; border-radius: 0 4px 4px 0; background: linear-gradient(180deg, var(--brand-glow), #f59e0b); }
nav.side a.nav.on svg { stroke: var(--nav-on-icon); opacity: 1; }
.userbox { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--nav-line); }
.userrow { display: flex; align-items: center; gap: 10px; padding: 6px; flex-wrap: wrap; }
.userrow .who { flex: 1 1 calc(100% - 46px); min-width: 0; }
.userrow .iconbtn { flex: 0 0 32px; }
.userrow #prefs { margin-left: auto; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, #6366f1, var(--brand-glow)); flex: none; font-size: 13px; }
.userrow b { color: var(--nav-strong); display: block; line-height: 1.2; font-size: 13px; } .userrow small { color: var(--nav-mut); font-size: 11px; text-transform: capitalize; }
.iconbtn { background: transparent; border: 0; box-shadow: none; color: var(--nav-ink); min-height: 32px; width: 32px; padding: 0; border-radius: 9px; }
.iconbtn:hover:not(:disabled) { background: var(--nav-hover); color: var(--nav-strong); transform: none; box-shadow: none; }
.iconbtn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.syncrow { display: flex; align-items: center; justify-content: space-between; color: var(--nav-mut); font-size: 11.5px; padding: 4px 8px 0; }
main { flex: 1; min-width: 0; padding: 26px 32px 60px; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.pagehead h2 { margin: 0; font-size: 26px; font-weight: 750; letter-spacing: -.03em; }
.pagehead .sub { color: var(--mut); margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
#who { color: var(--mut); font-size: 12.5px; background: var(--surface); border: 1px solid var(--line); padding: 5px 12px; border-radius: 99px; } #who:empty { display: none; }
#view { animation: rise .35s cubic-bezier(.2, .8, .2, 1) both; }
.skeleton { height: 120px; border-radius: var(--radius); margin-bottom: 14px; background: linear-gradient(100deg, var(--surface) 30%, var(--surface2) 50%, var(--surface) 70%); background-size: 300% 100%; animation: shimmer 1.3s infinite; border: 1px solid var(--line); }

/* ───── dashboard ───── */
.hello { margin-bottom: 18px; }
.hello h2 { margin: 0; font-size: 26px; font-weight: 750; letter-spacing: -.03em; } .hello p { margin: 3px 0 0; color: var(--mut); }
.stat { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 4px; }
.stat::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: var(--tint, var(--brand-soft)); opacity: .7; }
.stat .ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--tint, var(--brand-soft)); color: var(--tc, var(--brand)); position: relative; z-index: 1; margin-bottom: 6px; }
.stat .ico svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.stat .lbl { color: var(--mut); font-size: 12.5px; font-weight: 600; position: relative; z-index: 1; } .stat .kpi { position: relative; z-index: 1; } .stat .sub { color: var(--mut); font-size: 12px; position: relative; z-index: 1; }
.stat.income { --tint: var(--ok-soft); --tc: var(--ok); } .stat.expense { --tint: var(--bad-soft); --tc: var(--bad); } .stat.net { --tint: var(--brand-soft); --tc: var(--brand); }
.stat.recv { --tint: var(--info-soft); --tc: var(--info); } .stat.pay { --tint: var(--violet-soft); --tc: var(--violet); }
.neg { color: var(--bad); } .pos { color: var(--ok); }
.acct-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--line); } .acct-row:last-child { border: 0; }
.acct-row .code { background: var(--surface2); border: 1px solid var(--line); border-radius: 8px; padding: 1px 7px; font-size: 11.5px; color: var(--mut); margin-right: 8px; font-variant-numeric: tabular-nums; }
.todo { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; background: var(--surface2); border: 1px solid var(--line); margin-bottom: 8px; text-decoration: none; color: inherit; transition: transform .12s, border-color .15s; }
.todo:hover { transform: translateX(3px); border-color: var(--brand-glow); }
.todo .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); } .todo.good .dot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }

/* ───── toasts, dialogs ───── */
#toast { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 50; max-width: min(420px, calc(100vw - 40px)); }
.t { display: flex; gap: 11px; align-items: flex-start; background: var(--surface); color: var(--ink); padding: 12px 16px 12px 14px; border-radius: 14px; border: 1px solid var(--line); border-left: 4px solid var(--brand-glow); box-shadow: var(--shadow-lg); animation: slidein .3s cubic-bezier(.2, .8, .2, 1) both; font-weight: 550; }
.t svg { width: 18px; height: 18px; flex: none; margin-top: 1px; stroke: var(--brand); fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.t.error { border-left-color: var(--bad); } .t.error svg { stroke: var(--bad); }
dialog { border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink); width: min(760px, 94vw); padding: 24px; box-shadow: var(--shadow-lg); }
dialog[open] { animation: pop .22s cubic-bezier(.2, .9, .3, 1.1) both; }
dialog::backdrop { background: rgba(7, 14, 28, .55); backdrop-filter: blur(5px); }
dialog h3 { font-size: 18px; letter-spacing: -.02em; }

/* ───── personal colour themes ───── */
:root[data-theme="light"][data-palette="ocean"] { --bg: #eef6fb; --surface2: #f4f9fd; --line: #d7e7f3; --line2: #bfd9ec; --nav-b: #e8f4fb; }
:root[data-theme="light"][data-palette="violet"] { --bg: #f5f1fb; --surface2: #faf7ff; --line: #e5dcf5; --line2: #d3c2ef; --nav-b: #f1eafd; }
:root[data-theme="light"][data-palette="sunset"] { --bg: #fdf6ec; --surface2: #fffaf2; --line: #f0dfc8; --line2: #e5cba3; --nav-b: #fbf0dd; }
:root[data-theme="light"][data-palette="forest"] { --bg: #eff8f1; --surface2: #f5fbf6; --line: #d8ecdd; --line2: #bfe0c8; --nav-b: #e9f6ec; }
:root[data-theme="light"][data-palette="rose"] { --bg: #fdf1f4; --surface2: #fff7f9; --line: #f3d7de; --line2: #e9bcc8; --nav-b: #fbe9ee; }
:root[data-theme="light"][data-palette="slate"] { --bg: #f1f5f9; --surface2: #f8fafc; --line: #dbe4ee; --line2: #c3d2e2; --nav-b: #e8eef5; }
:root[data-theme="dark"][data-palette="ocean"] { --bg: #071626; --surface: #0d2138; --surface2: #122a46; --line: #1d3d5f; --line2: #2a4f78; --nav-a: #050f1d; --nav-b: #0a2138; }
:root[data-theme="dark"][data-palette="violet"] { --bg: #140d24; --surface: #1e1533; --surface2: #281c43; --line: #37265c; --line2: #483475; --nav-a: #0d0819; --nav-b: #1b1230; }
:root[data-theme="dark"][data-palette="sunset"] { --bg: #1d1207; --surface: #2a1b0d; --surface2: #372412; --line: #4a3118; --line2: #5f4020; --nav-a: #140b04; --nav-b: #241407; }
:root[data-theme="dark"][data-palette="forest"] { --bg: #07180d; --surface: #0d2414; --surface2: #12301b; --line: #1d4528; --line2: #2a5a36; --nav-a: #04100a; --nav-b: #0a1f11; }
:root[data-theme="dark"][data-palette="rose"] { --bg: #1d0a10; --surface: #2a1018; --surface2: #371622; --line: #4d2130; --line2: #632c40; --nav-a: #14060b; --nav-b: #240d15; }
:root[data-theme="dark"][data-palette="slate"] { --bg: #0b1220; --surface: #121c2e; --surface2: #18253c; --line: #24344f; --line2: #314664; --nav-a: #070d18; --nav-b: #0d1828; }
.themepick { display: flex; flex-direction: column; gap: 14px; min-width: min(560px, 88vw); }
.thememodes { display: flex; gap: 8px; flex-wrap: wrap; }
.thememodes button.on { border-color: var(--brand-glow); color: var(--brand-ink); background: var(--brand-soft); }
.thememodes svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.themegrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.themecard { align-items: flex-start; justify-content: flex-start; flex-direction: column; gap: 5px; text-align: left; background: var(--surface); color: var(--ink); border: 1px solid var(--line2); box-shadow: none; padding: 12px; min-height: 104px; }
.themecard:hover:not(:disabled) { background: var(--surface2); border-color: var(--brand-glow); transform: none; box-shadow: none; }
.themecard.on { border-color: var(--brand); box-shadow: var(--ring); background: var(--brand-soft); }
.themecard b { font-size: 14px; } .themecard small { color: var(--mut); font-size: 12px; line-height: 1.35; }
.themeswatches { display: flex; gap: 6px; margin-bottom: 4px; } .themeswatches i { width: 26px; height: 26px; border-radius: 9px; border: 1px solid rgba(0, 0, 0, .08); display: block; }
.themepresets { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 2px; } .themepresets button { min-height: 30px; padding: 5px 10px; font-size: 12px; }

/* ───── sign-in ───── */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.hero {
  position: relative; overflow: hidden; color: #e6f3ff; padding: 56px 60px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(600px 380px at 15% 10%, color-mix(in srgb, var(--brand-glow) 35%, transparent), transparent 65%), radial-gradient(520px 420px at 95% 95%, rgba(245, 158, 11, .28), transparent 65%), linear-gradient(145deg, #0a1730, #10305a);
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .08); }
.hero::before { width: 520px; height: 520px; right: -160px; top: -160px; } .hero::after { width: 340px; height: 340px; left: -120px; bottom: -100px; }
.hero .brand b { font-size: 21px; } .hero h1 { font-size: clamp(30px, 3.4vw, 46px); line-height: 1.08; letter-spacing: -.035em; margin: 0 0 14px; color: #fff; max-width: 15ch; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--brand-glow), #fcd34d); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 16px; color: #b6c8e2; max-width: 46ch; margin: 0 0 28px; }
.feats { display: grid; gap: 12px; position: relative; z-index: 1; } .feat { display: flex; gap: 12px; align-items: center; color: #d5e2f5; }
.feat i { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .1); flex: none; }
.feat svg { width: 16px; height: 16px; stroke: var(--brand-glow); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hero .glass { position: relative; z-index: 1; margin-top: 30px; padding: 16px 18px; border-radius: 16px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); backdrop-filter: blur(8px); max-width: 420px; }
.glass .row { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; padding: 3px 0; color: #b6c8e2; } .glass .row b { color: #fff; } .glass .ok { color: #86efac; }
.authform { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.authcard { width: min(400px, 100%); } .authcard h2 { font-size: 28px; letter-spacing: -.03em; margin: 0 0 4px; } .authcard .mut { font-size: 13.5px; }
.authcard form { display: flex; flex-direction: column; gap: 14px; margin: 22px 0 14px; } .authcard label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--mut); }
.authcard input { min-height: 44px; font-size: 15px; } .authcard button { min-height: 46px; font-size: 15px; }
.demo { margin-top: 18px; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px dashed var(--line2); font-size: 12.5px; color: var(--mut); }
.demo b { color: var(--ink); } .demo button { min-height: 28px; padding: 3px 10px; font-size: 12px; margin: 4px 6px 0 0; }

/* ───── motion ───── */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes slidein { from { opacity: 0; transform: translateX(24px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
@keyframes shimmer { to { background-position: -150% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ───── responsive ───── */
@media (max-width: 1000px) {
  .auth { grid-template-columns: 1fr; } .hero { padding: 36px 28px; } .hero .glass, .feats { display: none; }
}
@media (max-width: 900px) {
  #app { flex-direction: column; }
  nav.side { width: 100%; height: auto; position: relative; flex-direction: column; padding: 12px; gap: 8px; overflow: visible; }
  nav.side .brand { padding-bottom: 4px; } .orgbox { margin-bottom: 4px; }
  nav.side { overflow: visible; } .navwrap { display: flex; flex: none; overflow-x: auto; overflow-y: hidden; gap: 4px; padding-bottom: 4px; margin: 0; } .navgroup { display: flex; margin: 0; gap: 4px; } .navgroup > small { display: none; }
  nav.side a.nav { white-space: nowrap; margin: 0; padding: 8px 12px; } nav.side a.nav.on::before { display: none; } .userbox { margin: 0; }
  main { padding: 18px 14px 50px; } .pagehead h2, .hello h2 { font-size: 22px; } .card { padding: 14px; } .sigs { flex-direction: column; }
}

@media (max-width: 560px) {
  .statgrid { grid-template-columns: 1fr 1fr; gap: 10px; } .statgrid .stat { padding: 12px; } .statgrid .stat::after { display: none; } .statgrid .stat:last-child { grid-column: 1 / -1; } .statgrid .kpi { font-size: 18px; }
  .statgrid .stat .ico { width: 30px; height: 30px; border-radius: 9px; margin-bottom: 2px; } .statgrid .stat .ico svg { width: 16px; height: 16px; } .statgrid .stat .lbl { font-size: 11.5px; }
  .pagehead h2, .hello h2 { font-size: 21px; } dialog { padding: 16px; border-radius: 16px; } #toast { left: 14px; right: 14px; bottom: 14px; max-width: none; }
}
/* ───── print: clean paper output ───── */
@media print {
  nav.side, .noprint, .form button, dialog, #toast, .pagehead #who { display: none !important; } #app { display: block; } main { padding: 0; }
  body { background: #fff !important; color: #000; } .card { border: 0; box-shadow: none; padding: 0; } .scroll { overflow: visible; }
  th { background: #f1f5f9 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; } #view { animation: none; } tbody tr:hover > td { background: none; }
}
