/* Trustees self-service: layout, components and motion. Colours come from tokens.css. */

@font-face { font-family: "Kawak"; font-weight: 300; font-style: normal; font-display: swap; src: url("../fonts/kawak/Kawak-Light.otf") format("opentype"); }
@font-face { font-family: "Kawak"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/kawak/Kawak-Regular.otf") format("opentype"); }
@font-face { font-family: "Kawak"; font-weight: 400; font-style: italic; font-display: swap; src: url("../fonts/kawak/Kawak-RegularItalic.otf") format("opentype"); }
@font-face { font-family: "Kawak"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/kawak/Kawak-Medium.otf") format("opentype"); }
@font-face { font-family: "Kawak"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/kawak/Kawak-Bold.otf") format("opentype"); }
@font-face { font-family: "Kawak"; font-weight: 900; font-style: normal; font-display: swap; src: url("../fonts/kawak/Kawak-Black.otf") format("opentype"); }

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { margin: 0; min-height: 100vh; font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--ink); }

body::before {
  content: ""; position: fixed; inset: -20vmax; z-index: -1; pointer-events: none;
  background:
    radial-gradient(42vmax 42vmax at 10% 14%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 60%),
    radial-gradient(34vmax 34vmax at 92% 6%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 62%),
    radial-gradient(46vmax 46vmax at 70% 96%, color-mix(in srgb, var(--brand-deep) 14%, transparent), transparent 66%);
}
@keyframes drift { to { transform: translate3d(-2vmax, 1.5vmax, 0) scale(1.05); } }

h1, h2, h3 { font-weight: 700; letter-spacing: -0.015em; line-height: 1.15; margin: 0 0 0.4em; }
h1 { font-size: clamp(2rem, 3.8vw, 3rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
em { font-style: italic; color: var(--brand); }
p { margin: 0 0 0.9em; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 85%, transparent); outline-offset: 3px; border-radius: 6px; }

.skip-link { position: absolute; left: -999px; top: 8px; z-index: 70; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip-link:focus { left: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--ink-muted); }
.small { font-size: 0.875rem; }
.eyebrow { display: block; margin: 0 0 0.35rem; font-size: 0.9rem; color: var(--brand); font-weight: 700; }
.lead { font-size: 1.05rem; color: var(--ink-muted); max-width: 62ch; }

/* ----- Logos: purple on light backgrounds, white on dark. The sidebar always uses the white logo. ----- */
.logo-purple, .logo-white { display: block; }
.logo-white { display: none; }
:root[data-theme="dark"] .logo-purple { display: none; }
:root[data-theme="dark"] .logo-white { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-purple { display: none; }
  :root:not([data-theme="light"]) .logo-white { display: block; }
}

/* ----- App shell: sidebar and content ----- */
.app { min-height: 100vh; }
.app.app-shell { display: grid; grid-template-columns: 276px minmax(0, 1fr); }
.app-main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.shell { width: 100%; max-width: 1200px; margin: 0 auto; padding: 36px 40px 64px; flex: 1; }
/* Blocks stacked directly in the page keep a clear gap. Where a block sets its own larger margin, that one wins. */
.shell > * + * { margin-top: 20px; }
.footer { display: flex; align-items: center; justify-content: center; padding: 0 20px 34px; }
.footer-logo { display: block; }
.footer-logo img { width: 96px; height: auto; opacity: 0.92; }

.sidebar {
  position: sticky; top: 0; height: 100vh; align-self: start;
  display: flex; flex-direction: column; gap: 6px; overflow-x: hidden; overflow-y: auto;
  padding: 24px 16px 18px; color: #F3E9F7;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(201, 162, 39, 0.18), transparent 60%),
    linear-gradient(180deg, #4A1456 0%, #2F0D3B 55%, #1D0A26 100%);
  box-shadow: 14px 0 40px -24px rgba(29, 10, 38, 0.7);
}
.sidebar::after {
  content: ""; position: absolute; right: -70px; bottom: -70px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 162, 39, 0.14), transparent 65%); pointer-events: none;
}
.sidebar-logo { display: block; padding: 6px 8px 4px; margin-bottom: 8px; }
.sidebar-logo img { display: block; width: 100%; height: auto; }
.sidebar-kicker { margin: 6px 6px 18px; font-size: 0.7rem; letter-spacing: 0.22em; text-transform: uppercase; color: rgba(243, 233, 247, 0.6); }
.side-nav { display: grid; gap: 4px; }
.side-link {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px;
  color: #E7D6F0; font-weight: 500; transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.side-link:hover { color: #fff; background: rgba(255, 255, 255, 0.08); transform: translateX(3px); }
.side-link[aria-current="page"] {
  color: #fff; background: linear-gradient(135deg, #9A4BC4 0%, #6B2D8B 100%);
  box-shadow: 0 12px 26px -10px rgba(154, 75, 196, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.side-link[aria-current="page"]::before {
  content: ""; position: absolute; left: -16px; top: 22%; bottom: 22%; width: 4px; border-radius: 4px; background: var(--accent);
}
.side-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-foot { margin-top: auto; padding: 16px; border-radius: 16px; background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.1); }
.sidebar-signed { margin: 0; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; color: rgba(243, 233, 247, 0.6); }
.sidebar-user { margin: 2px 0 12px; font-weight: 700; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-logout { width: 100%; padding: 10px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.22); background: transparent; color: #fff; font: inherit; font-weight: 700; cursor: pointer; transition: background 0.2s ease; }
.side-logout:hover { background: rgba(255, 255, 255, 0.12); }

.mobile-bar { display: none; }
.nav-scrim { display: none; }

/* ----- Heroes and elevated surfaces (purple) ----- */
.hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; align-items: end; margin: 6px 0 30px; }
.hero-compact { grid-template-columns: 1fr; margin-bottom: 22px; }
.hero-kpi, .statement-hero {
  position: relative; overflow: hidden; isolation: isolate; display: grid; gap: 6px;
  padding: 26px 28px; border-radius: 22px; color: #fff;
  background: linear-gradient(135deg, #7E2C9C 0%, #5B1F7E 45%, #3A1352 100%);
  box-shadow: 0 26px 60px -24px rgba(71, 29, 92, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.hero-kpi::before, .statement-hero::before {
  content: ""; position: absolute; z-index: -1; right: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 208, 50, 0.32), transparent 65%);
}
.hero-kpi::after, .statement-hero::after {
  content: ""; position: absolute; z-index: -1; left: -40px; bottom: -90px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.14), transparent 70%);
}
.hero-kpi .kpi-label, .hero-kpi .small, .statement-hero .kpi-label, .statement-hero .small, .hero-meta { color: rgba(255, 255, 255, 0.8); }
.hero-kpi .kpi-value, .statement-hero .kpi-value { color: #fff; font-size: clamp(1.9rem, 3.4vw, 2.6rem); }
.statement-hero { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: end; gap: 20px; }
.statement-hero-main h1 { color: #fff; font-size: clamp(1.8rem, 3vw, 2.4rem); }
.statement-hero-main .eyebrow, .statement-hero-main .lead { color: rgba(255, 255, 255, 0.84); }
.statement-hero-main .eyebrow::before { background: #F5D032; }
.statement-hero-figure { display: grid; gap: 4px; justify-items: end; text-align: right; }
.hero-logo { width: 190px; }
.hero-logo img { width: 190px; height: auto; }

/* ----- Buttons ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; font-size: 0.95rem;
  padding: 11px 20px; border-radius: 999px; border: 1.5px solid transparent; cursor: pointer; text-decoration: none;
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary { color: #fff; background: linear-gradient(135deg, #8A3BAE 0%, #5E1F80 100%); box-shadow: 0 12px 26px -10px rgba(107, 45, 139, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
.btn-primary:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 18px 34px -12px rgba(107, 45, 139, 0.85); }
.btn-gold { color: #3A1352; background: linear-gradient(135deg, #F7DA5A 0%, #E0B92C 100%); box-shadow: 0 12px 24px -12px rgba(201, 162, 39, 0.9); }
.btn-gold:hover { color: #3A1352; transform: translateY(-2px); }
.btn-outline { color: var(--brand); background: transparent; border-color: color-mix(in srgb, var(--brand) 38%, transparent); }
.btn-outline:hover { background: var(--brand-soft); }
.btn-ghost { color: var(--brand); background: color-mix(in srgb, var(--brand) 9%, transparent); }
.btn-ghost:hover { background: color-mix(in srgb, var(--brand) 16%, transparent); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 0.85rem; }

/* ----- Cards and metrics ----- */
.card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px;
  box-shadow: 0 1px 2px rgba(71, 29, 92, 0.06); transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { display: grid; gap: 6px; }
.kpi-label { font-size: 0.85rem; color: var(--ink-muted); font-weight: 600; }
.kpi-value { font-size: 1.7rem; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--brand-deep); }
.kpi-small { font-size: 1.15rem; }
.big-figure { font-size: 2rem; font-weight: 900; margin: 4px 0; font-variant-numeric: tabular-nums; color: var(--brand-deep); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.section-head { margin: 32px 0 14px; display: flex; align-items: center; gap: 12px; }
.section-head h2 { margin: 0; }
.section-head::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.chart-card { margin-bottom: 20px; }
.pill {
  display: inline-block; padding: 4px 11px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-deep);
  font-size: 0.76rem; font-weight: 700; white-space: nowrap; border: 1px solid color-mix(in srgb, var(--brand) 18%, transparent);
}
.scheme-card { overflow: hidden; }
.scheme-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--brand);
}

/* ----- Charts ----- */
.spark { width: 100%; height: auto; display: block; }
.spark-line {
  stroke: #6B2D8B; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round;
  stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: draw 1.6s ease forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }
.spark-labels { display: flex; justify-content: space-between; color: var(--ink-muted); font-size: 0.78rem; margin-top: 8px; }
.stack-chart { width: 100%; height: auto; display: block; }
.stack-seg { animation: grow 0.9s ease both; transform-box: fill-box; transform-origin: bottom; }
.stack-seg.seg-0 { fill: var(--chart-0); } .stack-seg.seg-1 { fill: var(--chart-1); } .stack-seg.seg-2 { fill: var(--chart-2); }
.stack-seg.seg-3 { fill: var(--chart-3); } .stack-seg.seg-4 { fill: var(--chart-4); } .stack-seg.seg-5 { fill: var(--chart-5); }
.swatch.seg-0 { background: var(--chart-0); } .swatch.seg-1 { background: var(--chart-1); } .swatch.seg-2 { background: var(--chart-2); }
.swatch.seg-3 { background: var(--chart-3); } .swatch.seg-4 { background: var(--chart-4); } .swatch.seg-5 { background: var(--chart-5); }
.stack-legend { display: flex; flex-wrap: wrap; gap: 14px; list-style: none; padding: 0; margin: 12px 0 0; color: var(--ink-muted); }
.stack-legend li { display: inline-flex; align-items: center; gap: 6px; }
.stack-legend .swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.bars { width: 100%; height: auto; display: block; }
.bar-a, .bar-b { transform-box: fill-box; transform-origin: bottom; animation: grow 0.9s ease both; }
.bar-a { fill: #6B2D8B; }
.bar-b { fill: #F5D032; animation-delay: 0.1s; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.bar-label { fill: var(--ink-muted); font-size: 11px; font-family: var(--font); }
.split { width: 100%; height: 8px; display: block; margin-top: 14px; }
.split-a { fill: #6B2D8B; }
.split-b { fill: #F5D032; }
.legend { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-muted); flex-wrap: wrap; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: middle; background: var(--brand); }
.dot-a { background: #6B2D8B; }
.dot-b { background: #F5D032; }
.seg-0 { stroke: #6B2D8B; background: #6B2D8B; }
.seg-1 { stroke: #F5D032; background: #F5D032; }
.seg-2 { stroke: #A55DCA; background: #A55DCA; }
.seg-3 { stroke: #471D5C; background: #471D5C; }
.seg-4 { stroke: #C393DC; background: #C393DC; }
.seg-5 { stroke: #C9A227; background: #C9A227; }

/* ----- Forms, tabs and toolbars ----- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; padding: 16px 20px; }
.toolbar .field { margin: 0; }
.inline-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 0; }
.field { display: grid; gap: 6px; font-weight: 500; margin-bottom: 14px; }
.field > span { font-size: 0.86rem; color: var(--ink-muted); }
.field-inline { display: inline-grid; margin: 0; }
.field-error { color: var(--danger); font-size: 0.85rem; }
input, select {
  font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 11px 14px; width: 100%; transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.input-wrap { position: relative; display: block; }
.input-wrap input { padding-right: 84px; }
.reveal-btn { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--brand); font: inherit; font-weight: 700; cursor: pointer; padding: 6px 8px; }
.search-form .grow { flex: 1; min-width: 200px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-muted); background: var(--surface); font-weight: 700; transition: all 0.2s ease; }
.tab:hover { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.tab.is-active { color: #fff; background: linear-gradient(135deg, #8A3BAE, #6B2D8B); border-color: transparent; box-shadow: 0 10px 22px -10px rgba(107, 45, 139, 0.8); }

/* ----- Tables ----- */
.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { padding: 13px 18px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table thead th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: #fff; background: linear-gradient(180deg, #7E2C9C, #5B1F7E); }
.table tbody tr { transition: background 0.2s ease; }
.table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--brand) 4%, transparent); }
.table tbody tr:hover { background: var(--brand-soft); }
.table tfoot th, .table tfoot td { font-weight: 800; border-bottom: 0; background: var(--brand-soft); color: var(--brand-deep); }
.table td.num, .table th.num { text-align: right; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 6px; gap: 12px; }

/* ----- Details lists ----- */
.facts { display: grid; grid-template-columns: minmax(120px, 0.9fr) 1.6fr; gap: 10px 16px; margin: 0; }
.facts dt { color: var(--ink-muted); font-size: 0.88rem; }
.facts dd { margin: 0; word-break: break-word; font-weight: 500; }
.facts-tight { gap: 6px 12px; }

/* ----- Certificates ----- */
.cert-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.cert-card {
  position: relative; overflow: hidden; display: flex; flex-direction: column; padding: 0; border-radius: 22px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.cert-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.cert-ribbon { position: relative; height: 92px; background: linear-gradient(135deg, #8A3BAE 0%, #5B1F7E 60%, #3A1352 100%); }
.cert-ribbon::after { content: ""; position: absolute; inset: 10px; border: 1px solid rgba(245, 208, 50, 0.55); border-radius: 14px; }
.cert-member-id { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 1.35rem; font-weight: 700; letter-spacing: 0.08em; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); word-break: break-all; padding: 0 28px; text-align: center; }
.cert-body { position: relative; padding: 0 24px 6px; }
.cert-seal {
  position: absolute; right: 22px; top: -34px; width: 74px; height: 74px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.6rem; color: #fff;
  background: radial-gradient(circle at 35% 30%, #F7DA5A, #C9A227 60%, #8C6D12 100%);
  box-shadow: 0 10px 20px -8px rgba(201, 162, 39, 0.8), inset 0 0 0 4px rgba(255, 255, 255, 0.35);
}
.cert-seal span { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.cert-body h2 { margin: 18px 0 8px; font-size: 1.25rem; padding-right: 90px; }
.cert-card .card-actions { padding: 0 24px 22px; margin-top: 14px; }
.cert-facts { margin-top: 16px; }

/* ----- Document previews ----- */
.statement-hero { margin-bottom: 26px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-top: 8px; }
.hero-actions .btn-ghost { color: #fff; background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.3); }
.hero-actions .btn-ghost:hover { color: #fff; background: rgba(255, 255, 255, 0.26); }
.preview-card { padding: 14px; margin-bottom: 20px; }
.preview-frame { display: block; width: 100%; height: min(80vh, 1000px); min-height: 520px; border: 0; border-radius: 14px; background: var(--surface-tint); }
.preview-fallback { margin: 12px 4px 4px; }

/* ----- Sign-in and activation pages ----- */
.page-auth .shell { max-width: 1100px; }
.auth { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 44px; align-items: center; min-height: 70vh; }
.auth-hero h1 { font-size: clamp(2.2rem, 4.6vw, 3.4rem); }
.brand-card { display: block; margin-bottom: 26px; }
.brand-card img { width: 200px; height: auto; }
.feature-list { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 12px; color: var(--ink-muted); }
.feature-list li { display: flex; gap: 10px; align-items: flex-start; }
.feature-list li::before { content: "✦"; color: var(--accent); margin-top: 1px; }
.auth-card { padding: 32px; border-radius: 24px; }
.auth-card h2 { margin-bottom: 16px; }
.glass { background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }

/* ----- Alerts and empty states ----- */
.alert { padding: 13px 16px; border-radius: 14px; margin: 12px 0; border: 1px solid transparent; }
.alert-error { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.alert-ok { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); font-weight: 600; }
.alert-warn { background: color-mix(in srgb, var(--warn) 14%, transparent); }
.empty { text-align: center; padding: 60px 20px; }
.empty .lead { margin: 0 auto 20px; }

/* ----- Beneficiaries ----- */
.benef-layout { align-items: start; }
.donut { width: 220px; height: 220px; display: block; margin: 6px auto 12px; }
.donut-track { stroke: var(--surface-tint); }
.donut-total { font-size: 16px; font-weight: 700; fill: var(--ink); }
.donut-caption { font-size: 9px; fill: var(--ink-muted); }
.legend-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; color: var(--ink-muted); }
.benef-group { display: grid; gap: 16px; }
.benef-group > .card-head { margin-bottom: 0; }
.benef-list { display: grid; gap: 16px; }
/* A beneficiary card sits inside its scheme card, so it is lighter: no shadow, no lift on hover. */
.benef-card { padding: 18px 20px; background: var(--surface-tint); box-shadow: none; }
.benef-card:hover { transform: none; box-shadow: none; }
.benef-card .card-head { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.benef-card .card-head h3 { font-size: 1.05rem; margin: 0; }

/* ----- Selfie capture ----- */
.camera { display: grid; gap: 10px; margin: 6px 0 16px; }
.camera-view { width: 100%; max-width: 320px; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-sm); background: #000; }

/* ----- Light and dark toggle, shown on every page ----- */
.theme-toggle {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--ink); font: inherit; font-weight: 700; font-size: 0.9rem; cursor: pointer;
  box-shadow: var(--shadow-sm); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.theme-toggle:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.theme-toggle-icon { font-size: 1.05rem; line-height: 1; color: var(--accent); }

/* ----- Motion: content rises in when JavaScript is available ----- */
.js [data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
.js [data-reveal].is-visible { opacity: 1; transform: none; }

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

@media (max-width: 960px) {
  .app.app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 40; width: 286px; height: 100vh;
    transform: translateX(-104%); transition: transform 0.32s cubic-bezier(0.2, 0.7, 0.2, 1);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(17, 7, 23, 0.5); backdrop-filter: blur(2px); }
  .mobile-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 30;
    padding: 12px 16px; background: color-mix(in srgb, var(--surface) 90%, transparent);
    backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
  }
  .mobile-bar img { height: 34px; width: auto; }
  .nav-toggle {
    display: inline-flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer;
  }
  .nav-toggle-bars { position: relative; display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--brand); }
  .nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; width: 18px; height: 2px; border-radius: 2px; background: var(--brand); }
  .nav-toggle-bars::before { top: -6px; }
  .nav-toggle-bars::after { top: 6px; }
  .hero, .statement-hero, .auth, .grid-2, .cert-grid { grid-template-columns: minmax(0, 1fr); }
  .statement-hero-figure { justify-items: start; text-align: left; }
  .shell { padding: 26px 20px 56px; }
}

@media (max-width: 640px) {
  .shell { padding: 22px 16px 56px; }
  .table th, .table td { padding: 8px 7px; font-size: 0.8rem; white-space: nowrap; }
  .table .opt { display: none; }
  .col-switch:checked ~ .table-wrap .opt { display: table-cell; }
  .col-switch { position: absolute; opacity: 0; pointer-events: none; }
  .col-toggle { display: inline-flex; margin: 10px 14px 0; font-size: 0.8rem; font-weight: 700; color: var(--brand); cursor: pointer; }
  .kpis, .stat-row { grid-template-columns: minmax(0, 1fr); }
  .kpi-value { font-size: 1.35rem; }
  .auth-card { padding: 22px; }
  .facts { grid-template-columns: 1fr; }
  .theme-toggle { right: 12px; bottom: 12px; padding: 10px 12px; }
  .theme-toggle [data-theme-label] { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
  .spark-line { stroke-dashoffset: 0; }
}

/* ----- Add employee ----- */
.add-employee { margin-bottom: 20px; padding: 16px 20px; }
.add-employee summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.add-employee summary::-webkit-details-marker { display: none; }
.add-employee[open] summary { margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 18px; }
.form-grid .field { display: flex; flex-direction: column; gap: 6px; }
.form-grid .field input, .form-grid .field select { width: 100%; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.stack-item:hover .stack-seg { filter: brightness(1.12); }

/* ----- Balance by account (savings tracker) ----- */
.account-chart { margin-bottom: 20px; }
.line-chart { width: 100%; height: auto; display: block; }
.line-path { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.line-path.seg-0 { stroke: var(--chart-0); } .line-path.seg-1 { stroke: var(--chart-1); } .line-path.seg-2 { stroke: var(--chart-2); }
.line-path.seg-3 { stroke: var(--chart-3); } .line-path.seg-4 { stroke: var(--chart-4); } .line-path.seg-5 { stroke: var(--chart-5); }
.line-dot { stroke: var(--surface); stroke-width: 1.5; }
.line-dot.seg-0 { fill: var(--chart-0); } .line-dot.seg-1 { fill: var(--chart-1); } .line-dot.seg-2 { fill: var(--chart-2); }
.line-dot.seg-3 { fill: var(--chart-3); } .line-dot.seg-4 { fill: var(--chart-4); } .line-dot.seg-5 { fill: var(--chart-5); }
.grid-line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.grid-line-x { opacity: .5; }
.grid-label { font-size: 10px; fill: var(--ink-muted); font-variant-numeric: tabular-nums; }
.line-dot { transition: r .15s ease; cursor: pointer; }
.line-dot:hover { r: 6; }

/* ----- Employees by age (employer overview) ----- */
.age-grid { display: grid; grid-template-columns: minmax(160px, 220px) 1fr; gap: 20px; align-items: center; }
@media (max-width: 639px) { .age-grid { grid-template-columns: 1fr; justify-items: center; } }
.pie-chart { width: 100%; max-width: 220px; height: auto; display: block; }
.pie-slice { stroke: var(--surface); stroke-width: 1.5; }
.pie-slice.seg-0 { fill: var(--chart-0); } .pie-slice.seg-1 { fill: var(--chart-1); } .pie-slice.seg-2 { fill: var(--chart-2); }
.pie-slice.seg-3 { fill: var(--chart-3); } .pie-slice.seg-4 { fill: var(--chart-4); } .pie-slice.seg-5 { fill: var(--chart-5); }
.age-legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; color: var(--ink-muted); }
.age-legend li { display: flex; align-items: center; gap: 8px; }
.age-legend .swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.age-legend .swatch.seg-0 { background: var(--chart-0); } .age-legend .swatch.seg-1 { background: var(--chart-1); }
.age-legend .swatch.seg-2 { background: var(--chart-2); } .age-legend .swatch.seg-3 { background: var(--chart-3); }
.age-legend .swatch.seg-4 { background: var(--chart-4); } .age-legend .swatch.seg-5 { background: var(--chart-5); }

/* ----- Phone layout cleanup ----- */
@media (max-width: 640px) {
  .card { padding: 16px; }
  .card-head { flex-wrap: wrap; align-items: flex-start; }
  .card-actions { flex-direction: column; align-items: stretch; }
  .card-actions .btn { width: 100%; justify-content: center; text-align: center; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; scrollbar-color: var(--brand) var(--line); }
  .tabs::-webkit-scrollbar { display: block; height: 6px; }
  .tabs::-webkit-scrollbar-track { background: var(--line); border-radius: 3px; }
  .tabs::-webkit-scrollbar-thumb { background: var(--brand); border-radius: 3px; }
  .tabs .tab { flex: 0 0 auto; white-space: nowrap; }
  .toolbar { padding: 14px 16px; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .inline-form .btn, .toolbar .btn { width: 100%; }
  .form-actions { justify-content: stretch; }
  .form-actions .btn { width: 100%; }
  .page-head h1, .hero h1 { font-size: 1.55rem; line-height: 1.2; }
  .spark-labels { font-size: 0.66rem; }
  .stat-row .kpi, .kpis .kpi { padding: 14px; }
}

/* ----- Payments filters: one row on desktop, stacked on phones ----- */
.filter-card { padding: 14px 18px; margin-bottom: 16px; }
.filter-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin: 0; }
.filter-row .field { flex: 1 1 170px; min-width: 0; margin: 0; }
.filter-row .field input, .filter-row .field select { width: 100%; }
.filter-row .form-actions { display: flex; gap: 8px; grid-column: auto; margin: 0; flex: 0 0 auto; }
@media (max-width: 640px) {
  .filter-row .field, .filter-row .form-actions { flex: 1 1 100%; }
  .filter-row .form-actions .btn { flex: 1 1 0; }
}

/* =====================================================================================
   Look and feel refresh. Same fonts (Kawak), same colour tokens, same sidebar position.
   What changed: a deep purple header panel with a gold edge, calmer cards, sharper KPI
   figures, sentence-case labels instead of capitals, solid (not gradient) table heads,
   and a clearer active state in the sidebar. Motion is limited to the page's first reveal.
   ===================================================================================== */

:root {
  --hero-bg: #3F1452;
  --hero-ink: #FBF7EE;
  --hero-muted: rgba(251, 247, 238, 0.78);
  --hero-edge: #F5D032;
  --radius-card: 16px;
  --radius-field: 10px;
  --card-shadow: 0 1px 2px rgba(63, 20, 82, 0.05), 0 12px 32px -18px rgba(63, 20, 82, 0.22);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --hero-bg: #241030; --hero-ink: #F8F3FB; --hero-muted: rgba(248, 243, 251, 0.74); --hero-edge: #F8DF76; --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 36px -18px rgba(0, 0, 0, 0.6); }
}
:root[data-theme="dark"] { --hero-bg: #241030; --hero-ink: #F8F3FB; --hero-muted: rgba(248, 243, 251, 0.74); --hero-edge: #F8DF76; --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 36px -18px rgba(0, 0, 0, 0.6); }

html { background: var(--bg); }
body { letter-spacing: 0.005em; }
h1 { font-size: clamp(2.1rem, 4vw, 3.1rem); letter-spacing: -0.02em; line-height: 1.05; }
h2 { font-size: 1.35rem; letter-spacing: -0.01em; }

/* Page header: one deep panel with a gold edge. The memorable element of the refresh. */
.page-head {
  position: relative; display: block; margin: 0 0 26px; padding: 30px 34px 28px; border-radius: 20px;
  background: var(--hero-bg); color: var(--hero-ink); overflow: hidden; isolation: isolate;
}
.page-head::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--hero-edge);
}
.page-head h1 { color: var(--hero-ink); margin: 0 0 6px; }
.page-head .lead { color: var(--hero-muted); margin: 0; }
.page-head .eyebrow { color: var(--hero-edge); }
.page-head > div { max-width: 62ch; }

/* Eyebrows read as small labels, not shouting headers. */
.eyebrow { font-size: 0.85rem; letter-spacing: 0.01em; }
.sidebar-kicker, .sidebar-signed { text-transform: none; letter-spacing: 0.02em; font-size: 0.8rem; }

/* Cards */
.card { border-radius: var(--radius-card); box-shadow: var(--card-shadow); padding: 24px 26px; }
.card-head h2, .card-head h3 { font-size: 1.12rem; }

/* KPIs: the figures carry the page */
.kpi { gap: 4px; }
.kpi-label { font-size: 0.82rem; color: var(--ink-muted); font-weight: 600; letter-spacing: 0.01em; }
.kpi-value { font-size: 2rem; font-weight: 900; letter-spacing: -0.02em; color: var(--ink); }
.kpi-small { font-size: 1.25rem; }
.kpi .small.muted { font-size: 0.82rem; }

/* Buttons: solid and confident, with a visible focus ring */
.btn { border-radius: 999px; font-weight: 700; letter-spacing: 0.01em; }
.btn-primary { box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--brand) 70%, transparent); }
.btn-primary:hover { transform: translateY(-1px); }

/* Tables: quiet headers, calm rows */
.table th, .table td { padding: 14px 18px; }
.table tbody tr:nth-child(even) { background: transparent; }
.table tbody tr:hover { background: var(--surface-tint); }

/* Pills and notices */
.pill { border-radius: 999px; padding: 4px 12px; font-weight: 700; letter-spacing: 0.01em; }
.notice { border-radius: var(--radius-card); border-left: 4px solid var(--brand); }

/* Sidebar: same width and position, clearer current page */
.side-link { border-radius: 12px; font-weight: 600; letter-spacing: 0.01em; }
.side-link:hover { transform: none; }

/* Fields */
input:not([type="checkbox"]):not([type="radio"]), select, textarea { border-radius: var(--radius-field); }

/* One considered reveal on load, and no motion for people who ask for less */
@media (prefers-reduced-motion: no-preference) {
  .page-head { animation: panel-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) both; }
  @keyframes panel-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}

@media (max-width: 640px) {
  .page-head { padding: 22px 20px 22px; border-radius: 16px; }
  .card { padding: 18px 18px; }
  .kpi-value { font-size: 1.7rem; }
}

/* ----- Account screen and spacing around shadowed elements ----- */
.hero.hero-compact {
  position: relative; padding: 30px 34px 30px; border-radius: 20px; background: var(--hero-bg); color: var(--hero-ink);
  overflow: hidden; isolation: isolate; margin-bottom: 26px;
}
.hero.hero-compact::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--hero-edge); }
.hero.hero-compact h1 { color: var(--hero-ink); margin: 0 0 6px; }
.hero.hero-compact .lead { color: var(--hero-muted); }
.hero.hero-compact .eyebrow { color: var(--hero-edge); }
.hero.hero-compact .btn-primary { background: var(--hero-edge); color: #3F1452; border-color: var(--hero-edge); }

.grid-2 > .card { padding: 26px 28px 30px; }
.grid-2 > .card .card-head { padding-bottom: 14px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.grid-2 > .card .card-head h2 { display: flex; align-items: center; gap: 10px; }
.grid-2 > .card .card-head h2::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
.grid-2 > .card:nth-child(2) .card-head h2::before { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.grid-2 > .card:nth-child(3) .card-head h2::before { background: var(--seg-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--seg-2) 18%, transparent); }
.facts { margin: 0; }
.facts dt { font-size: 0.82rem; color: var(--ink-muted); font-weight: 600; margin-top: 14px; }
.facts dd { margin: 3px 0 0; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 1.02rem; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.facts dd .pill { margin-top: 2px; }

/* Shadowed things need room below them, so they don't sit on the next element */
.btn-primary { margin-bottom: 8px; }
.card-actions { padding-bottom: 8px; }
.form-actions, form .btn { margin-bottom: 4px; }
.card { margin-bottom: 4px; }
@media (max-width: 640px) {
  .hero.hero-compact { padding: 22px 20px; border-radius: 16px; }
  .grid-2 > .card { padding: 20px 20px 24px; }
}

/* ----- Depth: cards lift off the page in both themes ----- */
:root {
  --bg: #EDE6F2;
  --surface: #FFFFFF;
  --surface-tint: #F5EEF9;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0A0410; --surface: #221233; --surface-tint: #2D1A44; }
}
:root[data-theme="dark"] { --bg: #0A0410; --surface: #221233; --surface-tint: #2D1A44; }
html { background: var(--bg); }
.card, .bubble, .file-list li, .tracker-card { background: var(--surface); }
.card { box-shadow: 0 1px 2px rgba(63, 20, 82, 0.08), 0 14px 30px -18px rgba(63, 20, 82, 0.28); }
:root[data-theme="dark"] .card, :root:not([data-theme="light"]) .card { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 18px 36px -20px rgba(0, 0, 0, 0.7); }

/* ===== Sign-in screen: a full-height brand panel beside a plain form panel, after the investment sign-in ===== */
.page-auth .shell { max-width: none; padding: 0; }
.page-auth .app-main { min-height: 100vh; }
.page-auth .auth { min-height: 100vh; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 0; align-items: stretch; }

.auth-hero {
  position: relative; overflow: hidden; isolation: isolate; display: flex; flex-direction: column; justify-content: center;
  padding: clamp(40px, 6vw, 84px); background: var(--hero-bg); color: var(--hero-ink);
}
.auth-hero::before, .auth-hero::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none; z-index: -1;
}
.auth-hero::before { width: 620px; height: 620px; right: -260px; top: -240px; background: rgba(255, 255, 255, 0.05); }
.auth-hero::after { width: 460px; height: 460px; left: -200px; bottom: -220px; background: var(--hero-edge); opacity: 0.08; }
.auth-hero .brand-card { margin-bottom: 44px; }
.auth-hero .brand-card img { width: 220px; }
.auth-hero .eyebrow { color: var(--hero-edge); }
.auth-hero h1 { color: var(--hero-ink); font-size: clamp(2.3rem, 4.4vw, 3.5rem); line-height: 1.08; letter-spacing: -0.025em; max-width: 14ch; }
.auth-hero h1 em { color: var(--hero-edge); font-style: normal; font-weight: 400; }
.auth-hero .lead { color: var(--hero-muted); max-width: 44ch; margin-top: 18px; }
.auth-hero .feature-list { color: var(--hero-muted); margin-top: 36px; gap: 14px; }
.auth-hero .feature-list li::before { color: var(--hero-edge); }

.page-auth .auth-card {
  display: flex; flex-direction: column; justify-content: center; min-height: 100vh; width: 100%; max-width: 420px;
  margin: 0 auto; padding: clamp(32px, 5vw, 56px) 32px; background: var(--surface); border: 0;
  border-left: 1px solid var(--line); border-radius: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
}
.page-auth .auth-card h2 { font-size: 1.7rem; letter-spacing: -0.02em; margin: 0 0 6px; }
.page-auth .auth-card > p.muted { margin-top: 22px; line-height: 1.6; }
.page-auth .auth-card form { display: grid; gap: 18px; margin-top: 26px; }
.page-auth .auth-card .field { gap: 8px; }
.page-auth .auth-card .field > span { font-size: 0.85rem; font-weight: 600; color: var(--ink-muted); }
.page-auth .auth-card input {
  width: 100%; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-tint);
  color: var(--ink); font: inherit; transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.page-auth .auth-card input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.page-auth .auth-card .input-wrap input { padding-right: 84px; }
.page-auth .auth-card .btn-primary {
  height: 50px; border-radius: 12px; font-size: 1rem; margin: 6px 0 4px; box-shadow: 0 14px 26px -14px color-mix(in srgb, var(--brand) 80%, transparent);
}
.page-auth .alert-error { border-radius: 12px; }

@media (max-width: 900px) {
  .page-auth .auth { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .auth-hero { padding: 36px 24px 40px; min-height: 0; }
  .auth-hero .brand-card { margin-bottom: 26px; }
  .auth-hero .brand-card img { width: 170px; }
  .auth-hero .feature-list { display: none; }
  .page-auth .auth-card { min-height: 0; max-width: none; padding: 32px 22px 44px; border-left: 0; }
}

/* ----- Sign-in refinement: white logo on the brand panel, logo at the top, form as on the investment sign-in ----- */
.page-auth .auth-hero { justify-content: space-between; }
.page-auth .auth-hero .brand-card { margin: 0; }
.page-auth .auth-hero .copy { margin-top: auto; }
.page-auth .auth-hero .logo-purple { display: none !important; }
.page-auth .auth-hero .logo-white { display: block !important; }
.page-auth .auth-hero .brand-card img { width: 200px; height: auto; }
.page-auth .auth-card h2 { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 4px; }
.page-auth .auth-card > p.muted { margin-top: 0; }
.page-auth .auth-card .field > span:first-child { font-size: 0.8rem; font-weight: 500; color: var(--ink-muted); }
.page-auth .auth-input { position: relative; display: block; }
.page-auth .auth-input input { padding-left: 40px; }
.page-auth .auth-input input::placeholder { color: color-mix(in srgb, var(--ink-muted) 60%, transparent); }
.page-auth .auth-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; fill: none; stroke: var(--ink-muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; z-index: 1; }
.page-auth .auth-input input { position: relative; z-index: 0; }
.page-auth .auth-card form { gap: 16px; }
.page-auth .auth-card .btn-primary { background: var(--brand); }
.page-auth .auth-card .btn-primary:hover { background: var(--brand-hover); }

/* Sign-in: the manual link and theme toggle float over the form panel, so the layout starts at the very top. */
.page-auth .app-main { position: relative; }
.page-auth .auth-tools { position: absolute; top: 18px; right: 22px; z-index: 10; display: flex; align-items: center; gap: 14px; margin: 0; padding: 0; background: transparent; border: 0; }
.page-auth .auth-tools .manual-link { font-size: 0.85rem; color: var(--ink-muted); }

/* Sign-in: the form panel is solid white edge to edge; only its content is kept to a readable width. */
.page-auth .auth-card {
  max-width: none; width: 100%; margin: 0; background: var(--surface);
  padding: clamp(40px, 6vw, 64px) clamp(28px, 7vw, 120px); justify-content: center;
}
.page-auth .auth-card > * { max-width: 380px; width: 100%; margin-left: auto; margin-right: auto; }
.page-auth .auth-card > h2 { margin-top: 0; }
@media (max-width: 900px) { .page-auth .auth-card { padding: 32px 22px 44px; } }

/* Sign-in heading: title and subtitle share one left edge and one width. */
.page-auth .auth-card .auth-head { width: 100%; max-width: 380px; margin: 0 auto 26px; text-align: left; }
.page-auth .auth-card .auth-head h2 { margin: 0 0 6px; text-align: left; }
.page-auth .auth-card .auth-head p { margin: 0; text-align: left; }

/* Sign-in: room below the Sign in button, and before the registration note under it. */
.page-auth .auth-card .btn-primary { margin: 8px 0 26px; }
.page-auth .auth-card form { padding-bottom: 4px; }
.page-auth .auth-card > p.muted.small { margin-top: 0; line-height: 1.6; }

/* ===== Sign-in on phones: a compact brand header, then the form at full width ===== */
@media (max-width: 900px) {
  .page-auth .app-main { min-height: 0; }
  .page-auth .auth-tools { position: static; justify-content: flex-end; padding: 12px 16px; background: var(--hero-bg); }
  .page-auth .auth-tools .manual-link { color: var(--hero-muted); }
  .page-auth .auth-hero { padding: 26px 22px 30px; min-height: 0; border-radius: 0; }
  .page-auth .auth-hero::before, .page-auth .auth-hero::after { display: none; }
  .page-auth .auth-hero .brand-card { margin-bottom: 18px; }
  .page-auth .auth-hero .brand-card img { width: 148px; }
  .page-auth .auth-hero h1 { font-size: 1.7rem; max-width: none; }
  .page-auth .auth-hero .lead { font-size: 0.95rem; margin-top: 10px; }
  .page-auth .auth-card { padding: 28px 20px 40px; min-height: 0; border-left: 0; }
  .page-auth .auth-card h2 { font-size: 1.45rem; }
  .page-auth .auth-card .auth-head { margin-bottom: 20px; }
  .page-auth .auth-card input { font-size: 16px; min-height: 48px; }
  .page-auth .auth-card .reveal-btn { min-height: 36px; }
  .page-auth .auth-card .btn-primary { height: 52px; font-size: 1.02rem; }
  .page-auth .auth-card .alert { font-size: 0.95rem; }
}

/* Sign-in on phones: the form starts near the top, with only a small logo above it. */
@media (max-width: 900px) {
  .page-auth .auth-tools { padding: 8px 16px; }
  .page-auth .auth-hero { padding: 14px 22px 16px; }
  .page-auth .auth-hero .copy { display: none; }
  .page-auth .auth-hero .brand-card { margin-bottom: 0; }
  .page-auth .auth-hero .brand-card img { width: 120px; }
  .page-auth .auth-card { padding: 22px 20px 32px; }
  .page-auth .auth-card .auth-head { margin-bottom: 16px; }
  .page-auth .auth-card form { gap: 14px; margin-top: 18px; }
  .page-auth .auth-card > p.muted.small { margin-top: 18px; }
}

/* Sign-in pages: white all the way down, so no lavender shows below the form on a phone. */
html:has(body.page-auth), body.page-auth { background: var(--surface); }
body.page-auth::before { display: none; }

/* Sign-in tools bar on phones is dark, so its links and toggle are light, with no white background behind them. */
@media (max-width: 900px) {
  .page-auth .auth-tools .manual-link,
  .page-auth .auth-tools .theme-toggle {
    background: transparent; color: var(--hero-ink); border-color: rgba(255, 255, 255, 0.35);
  }
  .page-auth .auth-tools .manual-link:hover,
  .page-auth .auth-tools .theme-toggle:hover { background: rgba(255, 255, 255, 0.12); }
  .page-auth .auth-tools .theme-toggle-icon { color: var(--hero-edge); }
}

/* The faded circles come back on phones too, scaled to the narrower banner. */
@media (max-width: 900px) {
  .page-auth .auth-hero::before, .page-auth .auth-hero::after { display: block; }
  .page-auth .auth-hero::before { width: 300px; height: 300px; right: -120px; top: -130px; background: rgba(255, 255, 255, 0.06); }
  .page-auth .auth-hero::after { width: 240px; height: 240px; left: -110px; bottom: -120px; opacity: 0.1; }
}

/* The brand panel fades from deep purple to a softer violet, so the faded circles blend into it instead of sitting on a flat block. */
.page-auth .auth-hero {
  background:
    radial-gradient(60vmax 60vmax at 100% 0%, rgba(255, 255, 255, 0.08), transparent 60%),
    linear-gradient(160deg, color-mix(in srgb, var(--hero-bg) 88%, #8A3BAE) 0%, var(--hero-bg) 70%);
}
.page-auth .auth-hero::before { background: rgba(255, 255, 255, 0.035); }
.page-auth .auth-hero::after { background: var(--hero-edge); opacity: 0.05; }

/* The captured selfie shows in a square box under the camera controls. */
.camera canvas { display: block; width: 100%; max-width: 280px; height: auto; aspect-ratio: 1 / 1; border-radius: 14px; margin: 10px 0; border: 1px solid var(--line); }

/* The camera area respects "hidden": no empty preview box before a photo, or while retaking one. */
.camera [hidden] { display: none !important; }

/* Phone or email switch on the first-time sign-in page. */
.contact-switch { display: flex; gap: 8px; margin: 0 0 16px; padding: 4px; border-radius: 999px; background: var(--surface-tint); border: 1px solid var(--line); }
.contact-switch label { flex: 1; text-align: center; padding: 9px 12px; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--ink-muted); }
.contact-switch input { position: absolute; opacity: 0; pointer-events: none; }
.contact-switch label:has(input:checked) { background: var(--brand); color: #fff; }

/* Account and scheme tabs wrap onto more lines on phones, so every choice is visible without sideways scrolling. */
@media (max-width: 640px) {
  .tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 8px; }
  .tabs .tab { flex: 0 0 auto; white-space: nowrap; }
}

/* Statement period: on phones, From and To sit side by side with a gap; the selectors and button take the full width. */
@media (max-width: 640px) {
  .period-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
  .period-form .field { min-width: 0; }
  .period-form .field:nth-of-type(-n+2) { grid-column: 1 / -1; }
  .period-form button { grid-column: 1 / -1; }
}

/* Busy buttons show a spinner next to their "Loading…" text, so a click visibly does something. */
/* While a button is busy, a purple horse gallops beside its "Loading…" text. */
button[aria-busy="true"]::after {
  content: ""; display: inline-block; width: 32px; height: 24px; margin-left: 0.4em; vertical-align: -0.35em;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 24"><g fill="none" stroke="%237c3aed" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 14 L5 21 M12 14 L13 21 M19 14 L17 21 M23 14 L26 21"/><path d="M7 9 Q2 8 3 13"/></g><path fill="%237c3aed" d="M7 10 C7 7 10 6 14 6 L21 6 C23 6 24 4 24 2 L26 2 C27 2 28 3 28 4.5 L27 9 C26 11 25 12 23 12 L22 14 C22 16 20 16 17 15 L12 15 C9 15 7 13 7 10 Z"/></svg>') center / contain no-repeat;
  animation: busy-gallop 0.45s ease-in-out infinite alternate;
}
@keyframes busy-gallop {
  from { transform: translate(-2px, 0) rotate(-4deg); }
  to   { transform: translate(2px, -3px) rotate(3deg); }
}
@media (prefers-reduced-motion: reduce) { button[aria-busy="true"]::after { animation-duration: 2.4s; } }

/* The live camera view is mirrored, the way people see themselves in a mirror. The saved photo is mirrored to match. */
.camera-view { transform: scaleX(-1); }

/* Notification prompt after sign-in. */
.notify-prompt { display: grid; gap: 10px; margin: 0 0 16px; padding: 16px 18px; border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--brand) 25%, var(--line)); background: var(--surface-tint); }
.notify-prompt[hidden] { display: none; }
.notify-prompt h2 { font-size: 1.02rem; margin: 0 0 4px; }
.notify-prompt p { margin: 0; }

/* Password strength bar and checklist on the create-sign-in step. */
.pw-meter { display: grid; gap: 8px; margin-top: 8px; }
.pw-bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.pw-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: #c0392b; transition: width .2s ease, background-color .2s ease; }
.pw-meter[data-level="2"] .pw-bar span { background: #d68910; }
.pw-meter[data-level="3"] .pw-bar span { background: #b7950b; }
.pw-meter[data-level="4"] .pw-bar span { background: #1e8449; }
.pw-rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .86rem; color: var(--muted, #6b6b6b); }
.pw-rules li::before { content: "○"; display: inline-block; width: 1.2em; }
.pw-rules li.is-met { color: #1e8449; }
.pw-rules li.is-met::before { content: "✓"; font-weight: 700; }

/* Page-loading bar (see busy.js): runs across the top while the next page loads. */
.nav-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 1000; pointer-events: none;
  background: var(--brand); opacity: 0; transition: opacity .2s ease; }
.nav-progress.is-running { opacity: 1; width: 85%; transition: width 8s cubic-bezier(.1, .6, .3, 1), opacity .2s ease; }
@media (prefers-reduced-motion: reduce) { .nav-progress.is-running { transition: opacity .2s ease; } }

/* The phone-only column switch is not used on wider screens. */
@media (min-width: 641px) { .col-toggle, .col-switch { display: none; } }

/* The column switch label changes with its state: "Show all columns" or "Show fewer columns". */
@media (max-width: 640px) {
  .col-toggle .when-on { display: none; }
  .col-switch:checked ~ .col-toggle .when-off { display: none; }
  .col-switch:checked ~ .col-toggle .when-on { display: inline; }
}
