/* Vuka design system. Lifted from vuka-dashboard.html — the visual source
   of truth — with additions for: form sections, login screen, flash toasts,
   the new Owner-net mini, the Fuliza-as-mini variant, and the cash-sanity
   reconciliation panel. The base palette and component classes are
   unchanged. Future dashboards reuse these classes. */

:root {
  --orange: #E89A1F;
  --orange-soft: #F5BE5A;
  --orange-tint: #FCEFD3;
  --green: #225E2D;
  --green-soft: #4A8557;
  --green-tint: #E2EDDF;
  --cream: #FAF6EC;
  --cream-2: #F2EBD8;
  --paper: #FEFCF7;
  --ink: #1F1B16;
  --ink-soft: #6B6258;
  --ink-faint: #A39A8B;
  --pos: #225E2D;
  --neg: #B33A3A;
  --neg-tint: #F5DCDC;
  --warn: #C77A1F;
  --warn-tint: #FBE8CC;
  --divider: #E8E2D2;
  --divider-soft: #F0EBDB;
  --shadow: 0 1px 2px rgba(31,27,22,0.04), 0 4px 14px rgba(31,27,22,0.04);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--cream); }
body {
  font-family: 'DM Sans', -apple-system, system-ui, sans-serif;
  color: var(--ink);
  line-height: 1.45;
  font-size: 14px;
  background-image:
    radial-gradient(circle at 0% 0%, rgba(232,154,31,0.03), transparent 35%),
    radial-gradient(circle at 100% 60%, rgba(34,94,45,0.025), transparent 40%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
.app {
  max-width: 440px;
  margin: 0 auto;
  padding: 0 16px 80px;
  position: relative;
}

/* ---------- HEADER ---------- */
header {
  position: sticky; top: 0;
  background: rgba(250,246,236,0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  margin: 0 -16px 16px;
  padding: 14px 16px 12px;
  z-index: 50;
  border-bottom: 1px solid var(--divider);
}
.head-top { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--orange);
  display: grid; place-items: center;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(31,27,22,0.06);
}
.logo svg { width: 20px; height: 20px; }
.head-text { flex: 1; }
.brand {
  font-family: 'Fraunces', serif; font-weight: 500;
  font-size: 18px; line-height: 1; letter-spacing: -0.01em;
  color: var(--ink);
}
.head-sub {
  font-size: 11px; color: var(--ink-soft);
  margin-top: 2px; letter-spacing: 0.02em;
}
.head-sub strong { color: var(--ink); font-weight: 600; }

.head-actions {
  display: flex; gap: 8px; margin-left: auto;
  align-items: center;
}
.head-actions a, .head-actions button {
  font-size: 12px; color: var(--ink-soft);
  text-decoration: none;
  background: var(--cream-2);
  border: none; padding: 6px 10px; border-radius: 8px;
  cursor: pointer;
}

.toggle {
  display: flex; gap: 0; margin-top: 10px;
  background: var(--cream-2); padding: 3px;
  border-radius: 999px; width: fit-content;
}
.toggle button {
  border: none; background: transparent;
  padding: 5px 14px; font-family: inherit;
  font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-soft); cursor: pointer;
  border-radius: 999px;
  transition: all 0.18s ease;
}
.toggle button.on {
  background: var(--ink); color: var(--paper);
}

/* ---------- TOP NAV ---------- */
.topnav {
  margin: 0 -16px 14px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.topnav::-webkit-scrollbar { display: none; }
.topnav ul {
  list-style: none;
  display: flex;
  gap: 8px;
  min-width: max-content;
  padding: 0 16px 2px;
}
.topnav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.topnav-item a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.topnav-item a[aria-current="page"] {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}
/* ---------- HOME ---------- */
.home {
  padding-top: 6px;
}
.home-intro {
  padding: 18px 2px 16px;
}
.home-kicker {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 5px;
}
.home-title {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 34px;
  line-height: 1.05;
  color: var(--ink);
}
.home-copy {
  color: var(--ink-soft);
  font-size: 14px;
  max-width: 31rem;
  margin-top: 8px;
}
.dashboard-list {
  display: grid;
  gap: 10px;
}
.dashboard-tile {
  background: var(--paper);
  border: 1px solid var(--divider-soft);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.dashboard-main-link {
  display: grid;
  gap: 5px;
  padding: 16px;
  color: inherit;
  text-decoration: none;
  min-height: 112px;
}
.dashboard-label {
  font-family: 'Fraunces', serif;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.1;
}
.dashboard-description {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.4;
  max-width: 34rem;
}
.dashboard-open {
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  margin-top: 6px;
}
.dashboard-write-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border-top: 1px solid var(--divider-soft);
  background: var(--orange-tint);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}
.dashboard-empty {
  background: var(--paper);
  border: 1px solid var(--divider-soft);
  border-radius: 14px;
  padding: 18px;
  color: var(--ink-soft);
}
.dashboard-empty h2 {
  color: var(--ink);
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 500;
  margin-bottom: 4px;
}

/* ---------- SECTIONS ---------- */
.section-label {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-faint);
  margin: 22px 4px 10px;
  display: flex; align-items: center; gap: 8px;
}
.section-label::after {
  content: ''; flex: 1;
  height: 1px; background: var(--divider);
}

/* ---------- CARDS ---------- */
.card {
  background: var(--paper);
  border-radius: 16px;
  padding: 18px 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--divider-soft);
  margin-bottom: 12px;
}
.card-title {
  font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- HERO (Working Capital) ---------- */
.hero {
  background: linear-gradient(135deg, var(--paper) 0%, #FBF7E8 100%);
  border: 1px solid var(--divider);
  padding: 20px 20px 16px;
}
.hero-label {
  font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-soft); display: flex; align-items: center; gap: 6px;
}
.hero-num {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 44px; line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 6px 0 4px;
  font-variant-numeric: tabular-nums;
}
.hero-num .ksh {
  font-size: 18px; color: var(--ink-soft);
  font-weight: 400; margin-right: 6px;
  letter-spacing: 0.02em;
}
.chips { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.chip {
  font-size: 12px; font-weight: 500;
  padding: 4px 10px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 4px;
  font-variant-numeric: tabular-nums;
}
.chip.pos { background: var(--green-tint); color: var(--green); }
.chip.neg { background: var(--neg-tint); color: var(--neg); }
.chip-label {
  color: var(--ink-faint); font-weight: 400;
  margin-left: 2px; font-size: 11px;
}
.spark {
  margin-top: 14px; height: 36px;
  position: relative;
}

/* ---------- WC COMPONENTS GRID (now 2x3 — Fuliza + Owner-net added) ---------- */
.grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mini {
  background: var(--paper);
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--divider-soft);
  box-shadow: var(--shadow);
}
.mini-label {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-soft);
  display: flex; align-items: center; gap: 5px;
}
.mini-dot {
  width: 6px; height: 6px; border-radius: 50%;
  display: inline-block;
}
.mini-num {
  font-family: 'Fraunces', serif;
  font-weight: 400; font-size: 22px;
  line-height: 1.1; letter-spacing: -0.01em;
  margin: 6px 0 3px;
  font-variant-numeric: tabular-nums;
}
.mini-delta {
  font-size: 11.5px; font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.mini-delta.pos { color: var(--pos); }
.mini-delta.neg { color: var(--neg); }
.mini-delta.neutral { color: var(--ink-soft); }

/* ---------- CASH STACK ---------- */
.cash-card .cash-bar {
  height: 28px; border-radius: 8px;
  overflow: hidden; display: flex;
  margin: 14px 0 12px;
  background: var(--cream-2);
}
.cash-bar > div { transition: width 0.3s; }
.cash-legend {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
}
.cash-row {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px;
}
.cash-row .dot {
  width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0;
}
.cash-row .name { color: var(--ink-soft); flex: 1; }
.cash-row .val {
  color: var(--ink); font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.fuliza-line {
  margin-top: 10px;
  font-size: 12px;
  color: var(--neg);
  font-weight: 500;
  padding: 8px 10px;
  background: var(--neg-tint);
  border-radius: 8px;
}

/* ---------- YESTERDAY'S TRADING ---------- */
.pl-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0; margin-top: 10px;
}
.pl-row {
  padding: 12px 0;
  border-bottom: 1px dashed var(--divider);
}
.pl-row:nth-child(odd) { padding-right: 14px; border-right: 1px dashed var(--divider); }
.pl-row:nth-child(even) { padding-left: 14px; }
.pl-row:nth-last-child(-n+2) { border-bottom: none; }
.pl-label {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-soft);
}
.pl-num {
  font-family: 'Fraunces', serif;
  font-weight: 400; font-size: 20px;
  line-height: 1.15;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.pl-sub {
  font-size: 11px; color: var(--ink-faint);
  margin-top: 2px;
}

.profit-banner {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.profit-banner.pos { background: var(--green-tint); }
.profit-banner.neg { background: var(--neg-tint); }
.profit-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.profit-banner.pos .profit-label { color: var(--green); }
.profit-banner.neg .profit-label { color: var(--neg); }
.profit-num {
  font-family: 'Fraunces', serif;
  font-weight: 500; font-size: 22px;
  font-variant-numeric: tabular-nums;
}
.profit-banner.pos .profit-num { color: var(--green); }
.profit-banner.neg .profit-num { color: var(--neg); }

/* ---------- CHARTS ---------- */
.chart-wrap { position: relative; height: 130px; margin-top: 10px; }
.chart-wrap.tall { height: 150px; }
canvas { max-width: 100%; }

/* ---------- RECONCILIATION ---------- */
.recon {
  background: var(--paper);
  border: 1px solid var(--divider);
  border-radius: 16px; padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.recon-title {
  font-family: 'Fraunces', serif;
  font-weight: 500; font-size: 17px;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.recon-sub {
  font-size: 12px; color: var(--ink-soft);
  margin-bottom: 12px;
}
.recon-line {
  display: flex; justify-content: space-between;
  padding: 8px 0; font-size: 13px;
  border-bottom: 1px dashed var(--divider);
  font-variant-numeric: tabular-nums;
}
.recon-line:last-of-type { border-bottom: none; padding-bottom: 4px; }
.recon-line.total {
  border-top: 1px solid var(--ink);
  border-bottom: none;
  padding-top: 12px; margin-top: 4px;
  font-weight: 600;
}
.recon-line .lbl { color: var(--ink-soft); }
.recon-line .val { color: var(--ink); font-weight: 500; }
.recon-line.total .lbl,
.recon-line.total .val { color: var(--ink); font-weight: 700; }
.recon-narrative {
  margin-top: 14px; padding: 12px;
  border-radius: 10px;
  font-size: 12.5px; line-height: 1.55;
  color: var(--ink);
  border-left: 3px solid var(--orange);
  background: var(--orange-tint);
}
.recon-narrative.green { border-left-color: var(--green); background: var(--green-tint); }
.recon-narrative.amber { border-left-color: var(--orange); background: var(--orange-tint); }
.recon-narrative.red { border-left-color: var(--neg); background: var(--neg-tint); }
.recon-narrative strong { color: var(--ink); font-weight: 600; }

/* ---------- WASTE ---------- */
.waste-summary {
  display: flex; gap: 14px; margin-bottom: 4px;
}
.waste-summary > div { flex: 1; }
.waste-num {
  font-family: 'Fraunces', serif; font-weight: 400;
  font-size: 22px; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.waste-sub {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-soft); margin-top: 2px;
}

/* ---------- FLASHES ---------- */
.flash-stack { margin: 10px 0 12px; display: flex; flex-direction: column; gap: 6px; }
.flash {
  padding: 10px 12px; border-radius: 10px;
  font-size: 13px; line-height: 1.4;
  border: 1px solid var(--divider);
}
.flash-success { background: var(--green-tint); color: var(--green); border-color: #C2D9C7; }
.flash-error,
.flash-warning { background: var(--neg-tint); color: var(--neg); border-color: #ECBFC0; }
.flash-info { background: var(--cream-2); color: var(--ink); }

/* ---------- AUTH (login + reset) ---------- */
.auth-card { max-width: 360px; margin: 60px auto; padding: 28px 24px; }
.auth-h1 {
  font-family: 'Fraunces', serif; font-weight: 500;
  font-size: 28px; margin-bottom: 6px; letter-spacing: -0.01em;
}
.auth-sub { color: var(--ink-soft); font-size: 14px; margin-bottom: 16px; }
.auth-meta { font-size: 12px; color: var(--ink-soft); margin-top: 14px; text-align: center; }
.auth-meta a { color: var(--orange); text-decoration: none; }
.field { display: block; margin-bottom: 14px; }
.field-label {
  display: block; font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 6px;
}
.field input, .field textarea {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--divider);
  border-radius: 10px; font: inherit;
  background: var(--paper); min-height: 44px;
}
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-tint);
}
.form-errors {
  background: var(--neg-tint); color: var(--neg);
  padding: 10px 12px; border-radius: 10px;
  font-size: 13px; margin-bottom: 12px;
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-block; border: none; padding: 12px 20px;
  border-radius: 999px; font: inherit; font-weight: 600;
  font-size: 14px; cursor: pointer;
  text-decoration: none; min-height: 44px;
  text-align: center;
}
.btn-primary { background: var(--orange); color: var(--paper); }
.btn-secondary { background: var(--cream-2); color: var(--ink); }
.btn-link { background: transparent; color: var(--ink-soft); padding: 8px; }
.btn-block { width: 100%; }

/* ---------- INPUT FORM ---------- */
.entry-form fieldset {
  border: none;
  background: var(--paper);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--divider-soft);
}
.entry-form legend {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-faint);
  padding: 0 6px;
}
.entry-form .field { margin-bottom: 10px; }
.entry-form .help {
  font-size: 11px; color: var(--ink-faint);
  margin-top: 4px; line-height: 1.4;
}
.calc-box {
  background: var(--cream-2); border-radius: 10px;
  padding: 10px 12px; margin-top: 10px;
  font-size: 12.5px; line-height: 1.4;
}
.calc-box .calc-num {
  font-family: 'Fraunces', serif;
  font-size: 18px; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.calc-box .calc-detail { color: var(--ink-soft); font-size: 11px; }
.soft-warning {
  background: var(--warn-tint); color: var(--ink);
  border-radius: 10px; padding: 8px 12px;
  font-size: 12px; margin-top: 6px;
}
.yesterday-compare {
  background: var(--cream-2);
  border-radius: 12px; padding: 14px;
  margin-bottom: 16px;
  font-size: 12.5px;
}
.yesterday-compare h3 {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 8px;
}
.yesterday-compare dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.yesterday-compare dt { color: var(--ink-soft); }
.yesterday-compare dd { font-variant-numeric: tabular-nums; }

/* ---------- ENTRY LIST ---------- */
.entry-list table {
  width: 100%; border-collapse: collapse;
  font-size: 12.5px;
}
.entry-list th, .entry-list td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--divider);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.entry-list th { color: var(--ink-soft); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; }
.entry-list th:first-child, .entry-list td:first-child { text-align: left; }

/* ---------- FOOTER ---------- */
footer {
  text-align: center; margin-top: 32px;
  font-size: 11px; color: var(--ink-faint);
  line-height: 1.6;
}
footer a {
  color: var(--ink-soft); text-decoration: none;
  border-bottom: 1px dotted var(--ink-faint);
}

/* ---------- DESKTOP REFINEMENT ---------- */
@media (min-width: 700px) {
  body::before {
    content: ''; position: fixed; inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, transparent 0%, rgba(31,27,22,0.015) 100%);
    z-index: -1;
  }
  .app { padding-top: 8px; max-width: 760px; }
  .grid { grid-template-columns: repeat(3, 1fr); }
  .home-intro { padding-top: 28px; }
  .home-title { font-size: 42px; }
  .dashboard-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entry-form .form-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
}

/* ---------- BRAND HEADER (logo + name) ---------- */
.brand-header {
  display: flex; align-items: center;
  padding: 16px 0 12px;
}
.brand-link {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: inherit;
}
.brand-logo {
  width: 40px; height: 40px; border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 1px 2px rgba(31,27,22,0.08);
  background: var(--paper);
}
