/* FinPulse — clean professional, white with deep blue accents, light theme. */
:root {
  --navy: #0b2447;
  --navy-2: #133a6b;
  --blue: #2e6fd1;
  --blue-light: #5da9e9;
  --gold: #e9c46a;
  --ink: #10233f;
  --muted: #5b6b82;
  --line: #e3e8f0;
  --bg: #ffffff;
  --bg-alt: #f4f7fb;
  --ok: #1c8a53;
  --warn: #b5451a;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(11, 36, 71, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: var(--blue); text-decoration: none; }
.boot-loading { display: grid; place-items: center; height: 100vh; color: var(--muted); }

.money, .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.money.pos { color: var(--ok); }
.money.neg { color: var(--warn); }

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.topbar { position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,0.96); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.topbar-admin { background: linear-gradient(180deg, #0b2447 0%, #0e2c56 100%); border-bottom-color: #0b2447; }
.topbar-admin .brand-text, .topbar-admin .who { color: #fff; }
.topbar-admin .navlink { color: #cfe0f7; }
.topbar-admin .navlink.active, .topbar-admin .navlink:hover { color: #fff; background: rgba(255,255,255,0.12); }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: var(--navy); flex-shrink: 0; }
.brand-logo { height: 32px; width: auto; display: block; }
.brand-text { white-space: nowrap; }
.toplinks { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.navlink { padding: 10px 12px; min-height: 44px; display: flex; align-items: center; border-radius: 8px; color: var(--navy-2); font-weight: 600; font-size: 0.94rem; }
.navlink:hover { background: var(--bg-alt); }
.navlink.active { background: var(--navy); color: #fff; }
.auth-area { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.who { font-weight: 600; font-size: 0.9rem; color: var(--navy); }
.badge { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 8px; border-radius: 999px; font-weight: 700; }
.badge-admin { background: var(--gold); color: #4a3400; }
.badge-member { background: var(--bg-alt); color: var(--navy-2); border: 1px solid var(--line); }
.subnav { max-width: 1200px; margin: 0 auto; padding: 0 20px 8px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 9px; font-weight: 600; font-size: 0.95rem; cursor: pointer; border: 1px solid transparent; transition: transform 0.05s ease, background 0.15s ease, box-shadow 0.15s ease; white-space: nowrap; }
.btn:focus-visible { outline: 3px solid var(--blue-light); outline-offset: 2px; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-outline { background: #fff; color: var(--navy); border-color: var(--line); }
.btn-outline:hover { border-color: var(--navy); background: var(--bg-alt); }
.btn-ghost { background: transparent; color: var(--navy-2); }
.btn-ghost:hover { background: var(--bg-alt); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 0.85rem; }
.btn-lg { min-height: 52px; padding: 0 26px; font-size: 1.02rem; }
.btn-block { width: 100%; }

/* ── Layout helpers ──────────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 28px 20px 64px; }
.page { min-height: 60vh; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0 0 6px; font-size: 1.9rem; letter-spacing: -0.01em; }
.lede { color: var(--muted); margin: 0; max-width: 62ch; }

/* ── Hero ────────────────────────────────────────────────────────────────── */
.hero { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 40px; max-width: 1200px; margin: 0 auto; padding: 64px 20px 56px; align-items: center; }
.eyebrow { color: var(--blue); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.82rem; margin: 0 0 12px; }
.hero h1 { font-size: clamp(2.2rem, 4.2vw, 3.4rem); line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 18px; color: var(--navy); }
.hero-sub { font-size: 1.08rem; color: var(--muted); max-width: 56ch; margin: 0 0 28px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 36px; }
.hero-proof { display: flex; gap: 26px; flex-wrap: wrap; }
.hero-proof div { display: flex; flex-direction: column; gap: 2px; }
.hero-proof strong { color: var(--navy); font-size: 0.95rem; }
.hero-proof span { color: var(--muted); font-size: 0.82rem; }
.hero-art { position: relative; height: 320px; }
.art-card { position: absolute; border-radius: 20px; box-shadow: var(--shadow); }
.art-1 { width: 78%; height: 62%; top: 0; right: 0; background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 60%, var(--blue) 100%); }
.art-2 { width: 55%; height: 40%; bottom: 6%; left: 0; background: linear-gradient(135deg, #fff 0%, var(--bg-alt) 100%); border: 1px solid var(--line); }
.art-3 { width: 42%; height: 28%; bottom: 0; right: 12%; background: linear-gradient(135deg, var(--gold) 0%, #f6dfa0 100%); }

.section { max-width: 1200px; margin: 0 auto; padding: 56px 20px; }
.section h2 { font-size: clamp(1.5rem, 2.4vw, 2rem); text-align: center; margin: 0 0 8px; color: var(--navy); }
.section-sub { text-align: center; color: var(--muted); margin: 0 auto 36px; max-width: 52ch; }
.section.alt { background: var(--bg-alt); border-radius: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 32px; }
.feature-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.feature-card h3 { margin: 0 0 8px; color: var(--navy); font-size: 1.05rem; }
.feature-card p { margin: 0; color: var(--muted); font-size: 0.92rem; }

/* ── Pricing ─────────────────────────────────────────────────────────────── */
.pricing-grid { align-items: stretch; }
.price-card { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; height: 100%; }
.price-featured { border-color: var(--navy); box-shadow: var(--shadow); position: relative; }
.price-card-top { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; min-height: 84px; }
.price-card-top h3 { margin: 0; color: var(--navy); font-size: 1.1rem; }
.price { display: flex; align-items: baseline; gap: 6px; }
.price .amount { font-size: 1.9rem; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; white-space: nowrap; }
.price .period { color: var(--muted); font-size: 0.85rem; }
.price-desc { color: var(--muted); font-size: 0.9rem; margin: 0 0 16px; min-height: 42px; }
.price-list { list-style: none; padding: 0; margin: 0 0 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.price-list li { padding-left: 22px; position: relative; font-size: 0.92rem; color: var(--ink); }
.price-list li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }

.cta-band { text-align: center; background: var(--navy); color: #fff; border-radius: 24px; padding: 56px 20px; }
.cta-band h2 { color: #fff; }
.cta-band p { color: #d7e3f6; margin-bottom: 24px; }

.sitefooter { background: var(--bg-alt); border-top: 1px solid var(--line); padding: 40px 20px; }
.sitefooter-inner { max-width: 1200px; margin: 0 auto; }
.brand-footer { margin-bottom: 12px; }
.sitefooter p { color: var(--muted); max-width: 60ch; }
.trust { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 14px; font-size: 0.82rem; color: var(--navy-2); font-weight: 600; }
.trust span { background: #fff; border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; }

/* ── Auth ────────────────────────────────────────────────────────────────── */
.auth-wrap { display: grid; place-items: center; padding: 60px 20px; }
.auth-card { width: 100%; max-width: 440px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.auth-card h1 { margin: 0 0 8px; font-size: 1.6rem; color: var(--navy); }
.auth-hint { margin-top: 18px; background: var(--bg-alt); border-radius: 8px; padding: 12px 14px; font-size: 0.84rem; color: var(--muted); }
.auth-hint code { background: #fff; border: 1px solid var(--line); padding: 1px 6px; border-radius: 4px; }

/* ── Operator console sign-in — deliberately a DIFFERENT visual system (dark navy, not white)
   so /admin reads as a distinct application even before a session exists. ───────────────────── */
.admin-auth-wrap { min-height: 100vh; background: radial-gradient(circle at 20% 15%, #12386b 0%, #071a35 55%, #04101f 100%); padding: 60px 20px; }
.admin-auth-card { max-width: 480px; background: rgba(9, 26, 51, 0.72); border: 1px solid rgba(93, 169, 233, 0.35); box-shadow: 0 20px 60px rgba(0,0,0,0.45); backdrop-filter: blur(4px); }
.admin-auth-card h1 { color: #fff; }
.eyebrow-light { color: var(--gold); }
.lede-light { color: #b9cbe8; }
.admin-auth-card .form label { color: #cfe0f7; }
.admin-auth-card .form input { background: rgba(255,255,255,0.06); border-color: rgba(93,169,233,0.35); color: #fff; }
.admin-auth-card .form input::placeholder { color: #7d93b5; }
.admin-auth-hint { background: rgba(255,255,255,0.06); border: 1px solid rgba(93,169,233,0.25); color: #b9cbe8; }
.admin-auth-hint code { background: rgba(255,255,255,0.1); border-color: rgba(93,169,233,0.3); color: #fff; }
.admin-auth-hint a { color: var(--blue-light); }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; font-weight: 600; color: var(--navy-2); }
.form input, .form select, .form textarea {
  min-height: 44px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 0.95rem; font-family: inherit; color: var(--ink); background: #fff;
}
.form textarea { min-height: 110px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(46, 111, 209, 0.18); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid .form-actions { grid-column: 1 / -1; }
.form-tight { gap: 10px; }
.form-actions { display: flex; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.form-error { color: var(--warn); font-size: 0.88rem; margin-top: 10px; }
.form-hint { color: var(--navy-2); font-size: 0.88rem; margin-top: 10px; background: var(--bg-alt); padding: 8px 12px; border-radius: 8px; }

/* ── Cards & tables ──────────────────────────────────────────────────────── */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 22px; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); background: var(--bg-alt); }
.card-head h3 { margin: 0; font-size: 1.02rem; color: var(--navy); }
.card-body { padding: 20px; }
.table-wrap { overflow-x: auto; }
.datatable { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.datatable th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 2px solid var(--line); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
.datatable td { padding: 10px 10px; border-bottom: 1px solid var(--line); }
.datatable td.num, .datatable th.num { text-align: right; }
.datatable .empty { text-align: center; color: var(--muted); padding: 24px; }
.datatable tr:last-child td { border-bottom: none; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-grid-tight { margin-bottom: 16px; }
.stat-tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat-label { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.stat-value { font-size: 1.4rem; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.two-col-wide { grid-template-columns: 1.1fr 1.5fr; }

.kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 0.94rem; }
.kv.total { border-bottom: none; border-top: 2px solid var(--navy); margin-top: 4px; padding-top: 12px; font-weight: 700; }
.kv span { color: var(--muted); }

.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--bg-alt); border: 1px solid var(--line); font-size: 0.78rem; font-weight: 600; color: var(--navy-2); white-space: nowrap; }
.pill-ok { background: #e7f6ee; border-color: #bfe8d1; color: var(--ok); }
.pill-warn { background: #fbe9e2; border-color: #f3c4ab; color: var(--warn); }

/* ── Workspace / tabs ────────────────────────────────────────────────────── */
.workspace-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.workspace-head h1 { margin: 0 0 4px; font-size: 1.7rem; }
.tabbar { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 22px; padding-bottom: 2px; }
.tabbar-plain { border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab { min-height: 40px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 8px 8px 0 0; font-weight: 600; font-size: 0.88rem; color: var(--muted); border: none; background: transparent; cursor: pointer; }
.tab:hover { color: var(--navy); background: var(--bg-alt); }
.tab.active { color: var(--navy); background: var(--bg-alt); box-shadow: inset 0 -3px 0 var(--navy); }

.je-line { display: grid; grid-template-columns: 1.3fr 1.6fr 0.8fr 0.8fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.je-line input, .je-line select { min-height: 40px; }
.je-total { font-size: 0.86rem; color: var(--navy-2); font-weight: 600; margin: 6px 0 10px; }
.doc-raw { background: var(--bg-alt); border-radius: 8px; padding: 12px; white-space: pre-wrap; font-size: 0.82rem; max-height: 180px; overflow-y: auto; }
.detail { font-size: 0.78rem; }
.pack-toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.pack-toolbar label { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--navy-2); font-size: 0.9rem; }
.pack-toolbar input { min-height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; }

.loading { color: var(--muted); padding: 40px 0; text-align: center; }

/* ── Responsive: mobile-clean at 375px and up ───────────────────────────── */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 40px; }
  .hero-art { height: 220px; order: -1; }
  .grid-3 { grid-template-columns: 1fr; }
  .two-col, .two-col-wide { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar-inner { gap: 10px; }
  .toplinks { order: 3; width: 100%; justify-content: flex-start; overflow-x: auto; }
  .je-line { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .container { padding: 20px 14px 48px; }
  .section { padding: 40px 14px; }
}
