/* ============================================================
   Forzza Collections — "Control Room" interface
   Palette: deep ink surfaces, gold signature accent, money
   signal colours (green up / red short / blue electronic).
   ============================================================ */
:root {
  --ink:        #0F1318;
  --surface:    #171C24;
  --surface-2:  #1E2530;
  --border:     #2A323D;
  --text:       #E8ECF1;
  --muted:      #929CAB;
  --faint:      #6B7585;

  --gold:       #E7B24C;   /* brand / signature accent */
  --gold-dim:   #8a6a26;
  --pos:        #35C28E;   /* healthy / over / matched   */
  --neg:        #EF5A5A;   /* shortage / danger          */
  --info:       #5B9DF0;   /* electronic / informational */

  --radius: 12px;
  --shadow: 0 1px 0 rgba(255,255,255,.03), 0 12px 32px rgba(0,0,0,.35);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, monospace;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bg-glow: radial-gradient(1100px 600px at 80% -10%, rgba(231,178,76,.06), transparent 60%);
}

/* Light theme */
[data-theme="light"] {
  --ink:        #F4F6F9;
  --surface:    #FFFFFF;
  --surface-2:  #EEF1F5;
  --border:     #E0E5EC;
  --text:       #1B2129;
  --muted:      #5A6473;
  --faint:      #8A93A2;
  --gold:       #B07D14;   /* deeper gold for legibility on white */
  --gold-dim:   #d8a93f;
  --pos:        #1B8F63;
  --neg:        #CE3B3B;
  --info:       #2C72D6;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 10px 28px rgba(16,24,40,.10);
  --bg-glow: radial-gradient(1100px 600px at 80% -10%, rgba(176,125,20,.07), transparent 60%);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--ui);
  background: var(--bg-glow), var(--ink);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
  transition: background-color .25s ease, color .25s ease;
}
a { color: var(--gold); }
button { font-family: inherit; }
.hidden { display: none !important; }

/* numeric / money figures: tabular + tight */
.fig { font-family: var(--mono); font-feature-settings: "tnum" 1; letter-spacing: -.01em; }

/* ---------- micro labels ---------- */
.eyebrow {
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--faint); font-weight: 600;
}

/* ============================================================
   Login
   ============================================================ */
.login-wrap {
  min-height: 100%; display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: 100%; max-width: 360px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px; padding: 32px 28px;
  box-shadow: var(--shadow);
}
.brand {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px;
}
.brand .mark {
  font-weight: 800; font-size: 26px; letter-spacing: -.02em;
}
.brand .mark b { color: var(--gold); }
.brand .sub { font-size: 12px; color: var(--muted); letter-spacing: .04em; }

label { display: block; font-size: 12px; color: var(--muted); margin: 14px 0 6px; }
input, select, textarea {
  width: 100%; background: var(--ink); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px; padding: 11px 12px;
  font-size: 14px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(231,178,76,.15); }
textarea { resize: vertical; min-height: 60px; font-family: inherit; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 9px; padding: 11px 16px;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: .15s;
}
.btn-primary { background: var(--gold); color: #1a1306; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--gold); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 7px 11px; font-size: 12px; }

.error-msg { color: var(--neg); font-size: 13px; margin-top: 12px; min-height: 16px; }
.hint { color: var(--faint); font-size: 12px; margin-top: 16px; line-height: 1.6; }

/* ============================================================
   App shell
   ============================================================ */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  border-right: 1px solid var(--border); padding: 20px 14px;
  display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh;
}
.side .brand { padding: 4px 8px 18px; }
.side .brand .mark { font-size: 20px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  border-radius: 9px; color: var(--muted); cursor: pointer; font-size: 14px;
  font-weight: 500; border: 1px solid transparent;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.nav-item.active .dot { background: var(--gold); }
.side .spacer { flex: 1; }
.who { padding: 10px 12px; border-top: 1px solid var(--border); margin-top: 8px; font-size: 13px; }
.who .name { font-weight: 600; }
.who .role { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }

.main { padding: 26px 30px 60px; max-width: 1180px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 4px 0 0; letter-spacing: -.01em; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; }

/* ---------- cards / grid ---------- */
.grid { display: grid; gap: 16px; }
.cards-4 { grid-template-columns: repeat(4, 1fr); }
.cards-3 { grid-template-columns: repeat(3, 1fr); }
.cards-2 { grid-template-columns: 1.6fr 1fr; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 14px; font-size: 13px; color: var(--muted); font-weight: 600; }

/* ---------- the signature: Daily Pulse ---------- */
.pulse {
  grid-column: 1 / -1; background:
    linear-gradient(180deg, rgba(231,178,76,.05), transparent 40%), var(--surface);
  border: 1px solid var(--border); border-radius: 16px; padding: 22px 24px;
  display: grid; grid-template-columns: 1fr 1.3fr; gap: 24px; align-items: center;
}
.pulse .net-figure { font-family: var(--mono); font-size: 46px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.pulse .gross-figure { color: var(--muted); font-size: 14px; margin-top: 8px; }
.pulse .chips { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px;
  padding: 6px 11px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--muted);
}
.chip b { color: var(--text); font-family: var(--mono); }
.chip.warn { border-color: rgba(239,90,90,.4); }
.chip.warn b { color: var(--neg); }
.sparkline { width: 100%; height: 110px; }

/* ---------- KPI tiles ---------- */
.kpi .label { font-size: 12px; color: var(--muted); }
.kpi .value { font-family: var(--mono); font-size: 28px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; }
.kpi .value.pos { color: var(--pos); }
.kpi .value.neg { color: var(--neg); }
.kpi .value.info { color: var(--info); }

/* ---------- table ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--faint); font-weight: 600; font-size: 11px;
     text-transform: uppercase; letter-spacing: .08em; padding: 0 12px 10px; }
td { padding: 12px; border-top: 1px solid var(--border); }
td.num, th.num { text-align: right; font-family: var(--mono); }
tbody tr:hover { background: rgba(255,255,255,.02); }
.row-click { cursor: pointer; }

/* status pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.submitted   { color: var(--gold); background: rgba(231,178,76,.12); }
.pill.reconciled  { color: var(--pos);  background: rgba(53,194,142,.12); }
.pill.flagged     { color: var(--neg);  background: rgba(239,90,90,.12); }
.pill.matched     { color: var(--pos);  background: rgba(53,194,142,.12); }
.pill.short       { color: var(--neg);  background: rgba(239,90,90,.12); }
.pill.over        { color: var(--info); background: rgba(91,157,240,.12); }
.pill.investigating { color: var(--gold); background: rgba(231,178,76,.12); }

.var-pos { color: var(--pos); }
.var-neg { color: var(--neg); }
.var-zero { color: var(--muted); }

/* type breakdown bars */
.typebar { display: grid; grid-template-columns: 60px 1fr 90px; align-items: center; gap: 12px; margin-bottom: 12px; }
.typebar .t { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.typebar .track { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.typebar .fill { height: 100%; background: var(--gold); border-radius: 999px; }
.typebar .v { text-align: right; font-family: var(--mono); font-size: 13px; }

/* expenses bar list */
.exp-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 13px; }
.exp-row:first-child { border-top: 0; }
.exp-row .amt { font-family: var(--mono); }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { margin-top: 0; }
.calc-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.calc-line { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; color: var(--muted); }
.calc-line.total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px; color: var(--text); font-weight: 600; }
.calc-line .fig { color: var(--text); }
.calc-line.variance .fig.var-neg { color: var(--neg); }
.calc-line.variance .fig.var-pos { color: var(--pos); }

.expense-line { display: grid; grid-template-columns: 1fr 1.3fr 110px 36px; gap: 8px; margin-bottom: 8px; }
.expense-line .x { background: transparent; border: 1px solid var(--border); color: var(--muted); border-radius: 8px; cursor: pointer; }
.expense-line .x:hover { border-color: var(--neg); color: var(--neg); }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 18px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow);
  z-index: 50; max-width: 90vw;
}
.toast.ok { border-color: rgba(53,194,142,.5); }
.toast.err { border-color: rgba(239,90,90,.5); }

/* drawer for report detail / reconcile */
.drawer-back { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 440px; max-width: 92vw;
  background: var(--surface); border-left: 1px solid var(--border); z-index: 41;
  padding: 24px; overflow-y: auto; box-shadow: -20px 0 50px rgba(0,0,0,.4);
}
.drawer h2 { margin: 0 0 2px; font-size: 18px; }
.drawer .meta { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.kv { display: flex; justify-content: space-between; padding: 9px 0; border-top: 1px solid var(--border); font-size: 13px; }
.kv:first-of-type { border-top: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-family: var(--mono); }

.empty { color: var(--faint); text-align: center; padding: 40px 0; font-size: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 30; height: auto; flex-direction: row; align-items: center; gap: 8px;
          overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 10px 14px; background: var(--ink); }
  .side .logo, .side .spacer, .who { display: none; }
  .side nav { display: flex; gap: 4px; }
  .side .controls { margin-left: auto; padding: 0 !important; }
  .nav-item { white-space: nowrap; padding: 8px 12px; }
  .cards-4 { grid-template-columns: repeat(2, 1fr); }
  .cards-3, .cards-2 { grid-template-columns: 1fr; }
  .pulse { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .main { padding: 18px; }
  .drawer { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- logo ---------- */
.logo svg { display: block; height: 34px; width: auto; }
.login-card .logo { display: flex; justify-content: center; margin-bottom: 6px; }
.login-card .logo svg { height: 52px; }
.side .logo svg { height: 26px; }

/* ---------- segmented toggles (theme + language) ---------- */
.controls { display: flex; gap: 8px; align-items: center; }
.seg {
  display: inline-flex; border: 1px solid var(--border); border-radius: 999px;
  overflow: hidden; background: var(--surface);
}
.seg button {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 6px 11px; font-size: 12px; font-weight: 600; transition: .15s;
}
.seg button.on { background: var(--gold); color: #1a1306; }
[data-theme="light"] .seg button.on { color: #fff; }
.seg button:not(.on):hover { color: var(--text); }
.login-controls { display: flex; justify-content: center; margin-top: 18px; }

/* ---------- audit trail ---------- */
.audit-item { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.audit-item:first-child { border-top: 0; }
.audit-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin-top: 6px; flex: none; }
.audit-body { flex: 1; }
.audit-text { font-size: 14px; }
.audit-toggle { margin-top: 6px; background: transparent; border: 0; color: var(--muted); font-size: 12px; cursor: pointer; padding: 0; text-decoration: underline; }
.audit-detail { margin-top: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.audit-kv { display: flex; gap: 10px; font-size: 12px; margin: 3px 0; }
.audit-kv span { color: var(--faint); min-width: 64px; }
.audit-kv code { font-family: var(--mono); white-space: pre-wrap; color: var(--text); }

/* ============================================================
   Elegance polish
   ============================================================ */
/* gold-tinted form controls + native date pickers that match the theme */
input, select, textarea, button { accent-color: var(--gold); }
input[type="date"], input[type="number"] { color-scheme: dark; }
[data-theme="light"] input[type="date"], [data-theme="light"] input[type="number"] { color-scheme: light; }

/* links styled as buttons shouldn't underline */
.btn { text-decoration: none; }

/* a quiet divider under every page header gives the app rhythm */
.page-head { border-bottom: 1px solid var(--border); padding-bottom: 16px; }

/* cards and rows respond gently to the pointer */
.card { transition: border-color .2s ease, box-shadow .2s ease; }
.nav-item { transition: background .15s ease, color .15s ease, box-shadow .15s ease; }
.nav-item.active { box-shadow: inset 2px 0 0 var(--gold); }

/* refined keyboard focus */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* slimmer, on-theme scrollbars */
.drawer::-webkit-scrollbar, .side::-webkit-scrollbar, .main::-webkit-scrollbar { width: 9px; height: 9px; }
.drawer::-webkit-scrollbar-thumb, .side::-webkit-scrollbar-thumb, .main::-webkit-scrollbar-thumb { background: var(--border); border-radius: 9px; }
.drawer::-webkit-scrollbar-track, .side::-webkit-scrollbar-track, .main::-webkit-scrollbar-track { background: transparent; }

/* the headline number gets a touch more presence */
.pulse .net-figure { text-shadow: 0 1px 0 rgba(0,0,0,.15); }
.page-head h1 { font-weight: 700; }

/* drawer slides in rather than snapping */
.drawer { animation: drawerIn .22s ease; }
@keyframes drawerIn { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }

/* ---------- personalization (time / weather / greeting) ---------- */
.login-meta { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted); margin: -6px 0 18px; }
.login-meta .lm-date { text-transform: capitalize; }
.login-meta .lm-dot { color: var(--faint); }
.wx { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.toolbar .clock { color: var(--muted); font-size: 13px; }
.greet { font-size: 13px; color: var(--muted); }
.greet b { color: var(--gold); font-weight: 600; }

/* commission totals row */
tfoot td { border-top: 2px solid var(--border); font-weight: 600; padding-top: 10px; }
