/* Black Leaf CRM — monochrome identity taken straight from the logo (black / white),
   tuned for dense operational screens instead of editorial ones. */
:root {
  --bg: #050505;
  --surface: #0C0C0C;
  --card: #111111;
  --card-2: #191919;
  --line: #262626;
  --line-gold: rgba(255,255,255,.18);
  --accent-soft: rgba(255,255,255,.08);
  --glow: rgba(255,255,255,.06);
  --hover: #1F1F1F;
  --fg: #F5F5F5;
  --fg-dim: #A6A6A6;
  --fg-faint: #707070;
  --gold: #FFFFFF;
  --gold-light: #D6D6D6;
  --gold-ink: #000000;      /* text that sits on an accent fill */
  --good: #4F9D69;
  --warn: #C9922E;
  --bad: #C2553F;
  --shadow: rgba(0,0,0,.55);
  --r: 10px;
  --side-w: 236px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Playfair Display', Georgia, serif;
  color-scheme: dark;
}

/* Light theme: the logo in black on white. The accent is black, so\n   anything sitting on an accent fill flips to white. */
:root[data-theme="light"] {
  --bg: #F3F3F3;
  --surface: #FFFFFF;
  --card: #FFFFFF;
  --card-2: #EDEDED;
  --line: #DDDDDD;
  --line-gold: rgba(0,0,0,.24);
  --accent-soft: rgba(0,0,0,.06);
  --glow: rgba(0,0,0,.04);
  --hover: #F0F0F0;
  --fg: #0A0A0A;
  --fg-dim: #555555;
  --fg-faint: #858585;
  --gold: #0A0A0A;
  --gold-light: #3A3A3A;
  --gold-ink: #FFFFFF;
  --good: #35774B;
  --warn: #946415;
  --bad: #A53D28;
  --shadow: rgba(0,0,0,.18);
  color-scheme: light;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

img { max-width: 100%; display: block; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
::selection { background: var(--gold); color: var(--gold-ink); }
[hidden] { display: none !important; }

/* ── AUTH / INSTALL ───────────────────────────────── */
.auth-body {
  min-height: 100vh; display: grid; place-items: center;
  padding: max(20px, env(safe-area-inset-left,0px)) 20px;
  background: radial-gradient(ellipse 70% 50% at 50% 0%, var(--glow), transparent 60%), var(--bg);
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: 34px 28px;
}
.auth-logo { height: 92px; width: auto; max-width: 100%; margin: 0 auto 10px; }
.auth-title { font-family: var(--serif); font-size: 1.6rem; text-align: center; }
.auth-sub {
  font-size: .68rem; letter-spacing: .3em; text-transform: uppercase;
  color: var(--gold); text-align: center; margin-bottom: 26px;
}
.auth-note { color: var(--fg-dim); font-size: .85rem; margin-bottom: 18px; }

/* ── LAYOUT ───────────────────────────────────────── */
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 60;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transition: transform .28s cubic-bezier(.22,1,.36,1);
}
.side-brand {
  display: flex; flex-direction: column; gap: 4px;
  padding: 20px 18px 16px; border-bottom: 1px solid var(--line);
}
.side-brand img { height: 52px; width: auto; max-width: 100%; align-self: flex-start; }
.side-brand span {
  font-size: .56rem; letter-spacing: .34em; text-transform: uppercase; color: var(--gold);
}
.side-nav { flex: 1; overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 8px;
  color: var(--fg-dim); font-size: .86rem; transition: background .2s, color .2s;
}
.side-link svg { width: 17px; height: 17px; flex-shrink: 0; }
.side-link:hover { background: var(--card); color: var(--fg); }
.side-link.is-on { background: var(--accent-soft); color: var(--gold); }
.side-foot { padding: 14px 16px; border-top: 1px solid var(--line); }
.side-user strong { display: block; font-size: .85rem; font-weight: 500; }
.side-user span { font-size: .7rem; color: var(--gold); letter-spacing: .08em; text-transform: uppercase; }
.side-out { display: inline-block; margin-top: 9px; font-size: .8rem; color: var(--fg-dim); }
.side-out:hover { color: var(--bad); }

.main { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: 12px max(16px, env(safe-area-inset-right,0px)) 12px max(16px, env(safe-area-inset-left,0px));
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.topbar-title { font-family: var(--serif); font-size: 1.15rem; font-weight: 500; flex: 1; min-width: 0; }
.topbar-menu { display: none; background: none; border: 0; color: var(--fg); padding: 6px; cursor: pointer; }
.topbar-menu svg { width: 22px; height: 22px; }

.content {
  flex: 1;
  padding: 20px max(16px, env(safe-area-inset-right,0px))
           calc(28px + env(safe-area-inset-bottom,0px)) max(16px, env(safe-area-inset-left,0px));
}

.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50; }

@media (max-width: 900px) {
  .side { transform: translateX(-100%); }
  .side.is-open { transform: none; }
  .main { margin-left: 0; }
  .topbar-menu { display: block; }
}

/* ── PRIMITIVES ───────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border-radius: 8px; border: 1px solid transparent;
  font-family: var(--font); font-size: .82rem; font-weight: 500;
  cursor: pointer; transition: all .22s; white-space: nowrap;
}
.btn-gold { background: var(--gold); color: var(--gold-ink); font-weight: 600; }
.btn-gold:hover { background: var(--gold-light); color: var(--gold-ink); }
.btn-ghost { background: var(--card); color: var(--fg); border-color: var(--line); }
.btn-ghost:hover { background: var(--card-2); border-color: var(--line-gold); color: var(--fg); }
.btn-bad { background: transparent; color: var(--bad); border-color: rgba(194,85,63,.4); }
.btn-bad:hover { background: rgba(194,85,63,.1); color: var(--bad); }
.btn-sm { padding: 7px 13px; font-size: .78rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block; font-size: .72rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--fg-faint); margin-bottom: 6px;
}
input, select, textarea {
  width: 100%; background: var(--bg); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font-family: var(--font); font-size: .9rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); }
textarea { resize: vertical; min-height: 70px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--fg-dim) 50%), linear-gradient(135deg, var(--fg-dim) 50%, transparent 50%); background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input[type=checkbox] { width: auto; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 18px;
}
.card + .card { margin-top: 14px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 14px;
}
.card-title { font-family: var(--serif); font-size: 1.02rem; font-weight: 500; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row-end { justify-content: flex-end; }
.spacer { flex: 1; }
.muted { color: var(--fg-dim); }
.faint { color: var(--fg-faint); }
.small { font-size: .8rem; }
.right { text-align: right; }
.nums { font-variant-numeric: tabular-nums; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }

/* ── STAT TILES ───────────────────────────────────── */
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.stat-label { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--fg-faint); }
.stat-value {
  font-family: var(--serif); font-size: 1.65rem; line-height: 1.15;
  margin-top: 6px; font-variant-numeric: tabular-nums;
}
.stat-foot { font-size: .76rem; color: var(--fg-dim); margin-top: 4px; }
.stat-gold .stat-value { color: var(--gold); }

/* ── TABLE ────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th {
  text-align: left; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--fg-faint); font-weight: 500; padding: 9px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--accent-soft); }
.t-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.pill {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: .7rem; letter-spacing: .04em;
  background: var(--card-2); color: var(--fg-dim); border: 1px solid var(--line);
}
.pill-good { background: rgba(79,157,105,.14); color: #7FBF95; border-color: rgba(79,157,105,.3); }
.pill-warn { background: rgba(201,146,46,.14); color: #D9AE5C; border-color: rgba(201,146,46,.3); }
.pill-bad  { background: rgba(194,85,63,.14); color: #D98571; border-color: rgba(194,85,63,.3); }
.pill-gold { background: var(--accent-soft); color: var(--gold); border-color: var(--line-gold); }

.alert { padding: 11px 14px; border-radius: 8px; font-size: .85rem; margin-bottom: 16px; }
.alert-good { background: rgba(79,157,105,.12); border: 1px solid rgba(79,157,105,.3); color: #8FCCA4; }
.alert-bad  { background: rgba(194,85,63,.12); border: 1px solid rgba(194,85,63,.3); color: #E09B86; }
.alert-warn { background: rgba(201,146,46,.12); border: 1px solid rgba(201,146,46,.3); color: #DFB96E; }

.empty { text-align: center; padding: 40px 20px; color: var(--fg-faint); }
.empty strong { display: block; color: var(--fg-dim); font-size: .95rem; margin-bottom: 5px; }

/* ── BILLING ──────────────────────────────────────── */
.bill-wrap { display: grid; grid-template-columns: 1fr 370px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .bill-wrap { grid-template-columns: 1fr; } }

.svc-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 9px; }
.svc-btn {
  text-align: left; background: var(--card-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 11px 12px; cursor: pointer; color: var(--fg);
  font-family: var(--font); transition: all .2s;
}
.svc-btn:hover { border-color: var(--gold); background: var(--hover); }
.svc-btn b { display: block; font-size: .83rem; font-weight: 500; }
.svc-btn span { font-size: .78rem; color: var(--gold); font-variant-numeric: tabular-nums; }
.svc-btn.no-price span { color: var(--warn); }

.cart-row {
  display: grid; grid-template-columns: 1fr 86px 92px 30px;
  gap: 8px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line);
}
.cart-row:last-of-type { border-bottom: 0; }
.cart-name { font-size: .86rem; min-width: 0; }
.cart-name small { display: block; color: var(--fg-faint); font-size: .72rem; }
.cart-row input { padding: 7px 9px; font-size: .84rem; text-align: right; }
.cart-amt { text-align: right; font-variant-numeric: tabular-nums; font-size: .87rem; }
.cart-x {
  background: none; border: 0; color: var(--fg-faint); cursor: pointer;
  font-size: 1.2rem; line-height: 1; padding: 4px;
}
.cart-x:hover { color: var(--bad); }
@media (max-width: 560px) {
  .cart-row { grid-template-columns: 1fr 64px 80px 28px; gap: 6px; }
}

.sum-row { display: flex; justify-content: space-between; padding: 7px 0; font-size: .87rem; }
.sum-row span:last-child { font-variant-numeric: tabular-nums; }
.sum-total {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 13px 0 4px; margin-top: 8px; border-top: 1px solid var(--line-gold);
}
.sum-total b { font-family: var(--serif); font-size: 1.5rem; color: var(--gold); font-variant-numeric: tabular-nums; }

.gst-toggle {
  display: flex; align-items: center; gap: 9px; padding: 11px 12px;
  background: var(--card-2); border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.gst-toggle input { width: 17px; height: 17px; accent-color: var(--gold); cursor: pointer; }
.gst-toggle span { font-size: .85rem; }
.gst-toggle small { display: block; color: var(--fg-faint); font-size: .74rem; }

.cust-hits {
  border: 1px solid var(--line); border-radius: 8px; margin-top: 5px;
  background: var(--card-2); max-height: 190px; overflow-y: auto;
}
.cust-hit { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line); font-size: .85rem; }
.cust-hit:last-child { border-bottom: 0; }
.cust-hit:hover { background: var(--hover); }
.cust-hit span { color: var(--fg-faint); font-size: .78rem; }

/* ── SCORE BAR ────────────────────────────────────── */
.bar { height: 5px; background: var(--card-2); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--gold); border-radius: 3px; }
.bar-good i { background: var(--good); }
.bar-warn i { background: var(--warn); }
.bar-bad  i { background: var(--bad); }

/* ── TOAST ────────────────────────────────────────── */
.toast {
  position: fixed; z-index: 200;
  left: 50%; transform: translateX(-50%);
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  background: var(--card-2); border: 1px solid var(--line-gold);
  color: var(--fg); padding: 12px 20px; border-radius: 9px;
  font-size: .86rem; box-shadow: 0 12px 34px var(--shadow);
  max-width: calc(100vw - 32px);
}
.toast.is-bad { border-color: rgba(194,85,63,.5); }

/* ── SECTION HEADING INSIDE A FORM ────────────────── */
.sub-head {
  font-size: .7rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--gold); margin: 22px 0 10px;
  padding-top: 16px; border-top: 1px solid var(--line);
}

/* ── PERMISSION CHECKBOXES ────────────────────────── */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.perm {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card-2); cursor: pointer; transition: border-color .2s, background .2s;
}
.perm:hover { border-color: var(--line-gold); }
.perm input { width: 17px; height: 17px; margin-top: 1px; accent-color: var(--gold); cursor: pointer; flex-shrink: 0; }
.perm strong { display: block; font-size: .84rem; font-weight: 500; }
.perm small { display: block; color: var(--fg-faint); font-size: .74rem; line-height: 1.4; }
.perm:has(input:checked) { border-color: var(--line-gold); background: var(--card); }

/* ── THEME TOGGLE ─────────────────────────────────── */
.theme-btn {
  background: none; border: 1px solid var(--line); border-radius: 8px;
  color: var(--fg-dim); cursor: pointer; padding: 7px; line-height: 0;
  transition: color .2s, border-color .2s;
}
.theme-btn:hover { color: var(--gold); border-color: var(--line-gold); }
.theme-btn svg { width: 17px; height: 17px; }
:root[data-theme="light"] .theme-moon { display: none; }
:root:not([data-theme="light"]) .theme-sun { display: none; }

/* ── EDIT BANNER ──────────────────────────────────── */
.editing {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; padding: 12px 15px; border-radius: var(--r);
  background: var(--accent-soft); border: 1px solid var(--line-gold); margin-bottom: 14px;
}
.editing strong { color: var(--gold); }

/* ── TABS ─────────────────────────────────────────── */
.tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); margin-bottom: 16px;
}
.tab {
  position: relative; padding: 10px 15px; color: var(--fg-dim);
  font-size: .86rem; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .2s, border-color .2s; white-space: nowrap;
}
.tab:hover { color: var(--fg); }
.tab.is-on { color: var(--gold); border-bottom-color: var(--gold); }
.tab-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--bad); margin-left: 5px; vertical-align: middle;
}

/* ── CALENDAR ─────────────────────────────────────── */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-dow {
  font-size: .64rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--fg-faint); text-align: center; padding-bottom: 5px;
}
.cal-pad { aspect-ratio: 1; }
.cal-day {
  aspect-ratio: 1; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px; display: flex; flex-direction: column; gap: 3px;
  background: var(--card-2); color: var(--fg); min-width: 0;
  transition: border-color .2s, background .2s;
}
a.cal-day:hover { border-color: var(--gold); color: var(--fg); }
.cal-day.is-today { border-color: var(--gold); }
.cal-day.is-sel { background: rgba(201,169,110,.16); border-color: var(--gold); }
.cal-num { font-size: .8rem; font-variant-numeric: tabular-nums; }
.cal-day.is-today .cal-num { color: var(--gold); font-weight: 600; }
.cal-dots { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; margin-top: auto; }
.cal-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.cal-dots i.is-done { background: var(--fg-faint); }
.cal-dots b { font-size: .62rem; color: var(--fg-faint); font-weight: 500; }

.cal-money .cal-day { aspect-ratio: auto; min-height: 76px; }
.cal-day.is-due { background: rgba(201,169,110,.14); border-color: var(--line-gold); }
.cal-day.is-late { background: rgba(194,85,63,.14); border-color: rgba(194,85,63,.45); }
.cal-amt {
  font-size: .76rem; font-weight: 600; color: var(--gold);
  font-variant-numeric: tabular-nums; margin-top: auto; line-height: 1.2;
}
.cal-day.is-late .cal-amt { color: var(--bad); }
.cal-sub { font-size: .6rem; color: var(--fg-faint); line-height: 1.2; }

@media (max-width: 560px) {
  .cal { gap: 3px; }
  .cal-day { padding: 4px; border-radius: 6px; }
  .cal-num { font-size: .7rem; }
  .cal-money .cal-day { min-height: 62px; }
  .cal-amt { font-size: .62rem; }
  .cal-sub { display: none; }
}

/* ── BOOKINGS ─────────────────────────────────────── */
.bk-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 14px; align-items: start; }
@media (max-width: 1000px) { .bk-layout { grid-template-columns: 1fr; } }

.bk-list { display: flex; flex-direction: column; gap: 8px; }
.bk-item {
  display: grid; grid-template-columns: 58px 1fr; gap: 12px;
  padding: 11px 12px; border: 1px solid var(--line);
  border-radius: var(--r); background: var(--card-2);
}
.bk-item.is-off { opacity: .5; }
.bk-time { text-align: center; border-right: 1px solid var(--line); padding-right: 10px; }
.bk-time strong { display: block; font-size: 1rem; font-variant-numeric: tabular-nums; }
.bk-time small { font-size: .64rem; color: var(--fg-faint); letter-spacing: .1em; }
.bk-who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bk-actions {
  grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap;
  padding-top: 9px; border-top: 1px solid var(--line);
}
.bk-next { display: flex; flex-direction: column; gap: 6px; }
.bk-chip {
  display: block; padding: 9px 12px; border-radius: 8px;
  background: var(--card-2); border: 1px solid var(--line); color: var(--fg);
}
.bk-chip:hover { border-color: var(--line-gold); color: var(--fg); }
.bk-chip strong { display: block; font-size: .82rem; color: var(--gold); }
.bk-chip span { font-size: .8rem; color: var(--fg-dim); }

/* ── DELIVERY ENTRY ───────────────────────────────── */
.buy-head, .buy-row {
  display: grid; gap: 8px; align-items: center;
  grid-template-columns: 1.6fr 1.3fr 76px 72px 96px 100px 32px;
}
.buy-head {
  font-size: .64rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--fg-faint); padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.buy-row { padding: 7px 0; border-bottom: 1px solid var(--line); }
.buy-row input, .buy-row select { padding: 7px 9px; font-size: .84rem; }
.buy-row .amt { text-align: right; font-variant-numeric: tabular-nums; font-size: .86rem; }
.buy-x { background: none; border: 0; color: var(--fg-faint); cursor: pointer; font-size: 1.2rem; padding: 4px; }
.buy-x:hover { color: var(--bad); }
.buy-total {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-top: 13px; margin-top: 10px; border-top: 1px solid var(--line-gold);
}
.buy-total b { font-family: var(--serif); font-size: 1.45rem; color: var(--gold); font-variant-numeric: tabular-nums; }

@media (max-width: 820px) {
  .buy-head { display: none; }
  .buy-row {
    grid-template-columns: 1fr 1fr; gap: 7px;
    padding: 11px; border: 1px solid var(--line); border-radius: var(--r);
    background: var(--card-2); margin-bottom: 9px;
  }
  .buy-row .f-name, .buy-row .f-link { grid-column: 1 / -1; }
  .buy-row .amt { grid-column: 1 / -1; text-align: right; }
  .buy-x { grid-column: 1 / -1; justify-self: end; }
}

/* ── MONEY OWED TO A SUPPLIER ─────────────────────── */
.owe {
  border: 1px solid var(--line); border-left: 3px solid var(--gold);
  border-radius: var(--r); padding: 14px; margin-bottom: 12px; background: var(--card-2);
}
.owe.is-late { border-left-color: var(--bad); }
.owe-top { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 9px; }
.owe-money { text-align: right; display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
.owe-money b { font-family: var(--serif); font-size: 1.3rem; color: var(--gold); font-variant-numeric: tabular-nums; }
.owe.is-late .owe-money b { color: var(--bad); }
.owe-more { margin-top: 10px; }
.owe-more summary { cursor: pointer; font-size: .82rem; color: var(--fg-dim); padding: 5px 0; }
.owe-more summary:hover { color: var(--gold); }
.owe-pay { margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--line); }
.pay-line {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .83rem;
}
.pay-line:last-child { border-bottom: 0; }
.pay-line strong { margin-left: auto; }

/* ── INLINE FIELDS INSIDE A TABLE ROW ─────────────── */
.cell-input {
  padding: 7px 9px; font-size: .86rem; text-align: right;
  font-variant-numeric: tabular-nums; background: var(--bg);
}
.cell-input:placeholder-shown { border-color: var(--warn); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* ── TABLES THAT BECOME CARDS ON A PHONE ──────────── */
@media (max-width: 720px) {
  .tbl-cards table, .tbl-cards tbody, .tbl-cards tr, .tbl-cards td { display: block; width: 100%; }
  .tbl-cards thead { display: none; }
  .tbl-cards tr {
    border: 1px solid var(--line); border-radius: var(--r);
    padding: 12px 14px; margin-bottom: 10px; background: var(--card-2);
  }
  .tbl-cards tr:hover { background: var(--card-2); }
  .tbl-cards td {
    border: 0; padding: 6px 0;
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    text-align: left;
  }
  .tbl-cards td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--fg-faint); font-size: .68rem;
    letter-spacing: .12em; text-transform: uppercase;
  }
  .tbl-cards td:not([data-label])::before { content: none; }
  .tbl-cards td[data-label=""] { justify-content: flex-end; padding-top: 10px; }
  .tbl-cards td[data-label=""]::before { content: none; }
  .tbl-cards .cell-input { max-width: 130px; }
  .tbl-cards .t-num { text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ── LOGO: white mark on dark, black mark on light ─── */
.lg-light { display: none; }
:root[data-theme="light"] .lg-dark { display: none; }
:root[data-theme="light"] .lg-light { display: block; }

.auth-theme { position: fixed; top: max(14px, env(safe-area-inset-top, 0px)); right: 14px; }

/* Status colours need a darker tone on a light page to stay readable. */
:root[data-theme="light"] .pill-good { color: #2B6B40; }
:root[data-theme="light"] .pill-warn { color: #8A5E10; }
:root[data-theme="light"] .pill-bad  { color: #9C3A26; }
:root[data-theme="light"] .alert-good { color: #2B6B40; }
:root[data-theme="light"] .alert-bad  { color: #9C3A26; }
:root[data-theme="light"] .alert-warn { color: #8A5E10; }

/* Charts in Reports read these instead of fixed hex values. */
.chart-grid { stroke: var(--line); }
.chart-bar  { fill: var(--gold); }
.chart-axis { fill: var(--fg-faint); }
.chart-lbl  { fill: var(--fg-dim); }