/* =========================================================================
   Wilmot Road Budget Tracker — style.css
   Palette: Farrow & Ball
     Railings    #45484B  — header / dark surfaces
     Inchyra Blue #586768 — primary accent, nav highlight
     Arsenic      #84B59C — success / positive
     Charlotte's Locks #D65F3D — danger / error (warm, not harsh)
     Babouche     #ECC363 — warning
     All White    #FBF8F4 — warm background
   ========================================================================= */

:root {
  /* Surfaces */
  --bg:         #F2EFEA;   /* warm off-white — All White territory */
  --surface:    #FFFFFF;
  --surface-2:  #F8F6F2;   /* slightly warm — for sidebar, table headers */
  --border:     #DDD9D3;   /* warm grey border */
  --border-dk:  #C8C3BB;   /* stronger border for table dividers */

  /* Text */
  --text:       #1A1714;   /* darker warm near-black for contrast */
  --text-muted: #201e1c;   /* darkened for WCAG AA contrast */
  --text-light: #1f1e1d;   /* darkened — still subtle but readable */

  /* Brand palette from F&B */
  --primary:    #586768;   /* Inchyra Blue */
  --primary-dk: #445253;   /* Inchyra darker */
  --primary-lt: #EAF0EF;   /* Inchyra very light tint */
  --header-bg:  #45484B;   /* Railings */
  --success:    #47715b;   /* Arsenic */
  --success-dk: #3c6e54;
  --danger:     #C57B67;   /* Red Earth — warm, readable */
  --danger-dk:  #A86554;
  --warning:    #ECC363;   /* Babouche */
  --warning-dk: #D4A940;

  /* Geometry — sharp and modern */
  --radius:     3px;        /* down from 8px — more modern, less bubbly */
  --radius-sm:  2px;
  --radius-lg:  4px;

  /* Shadow — very subtle, almost flat */
  --shadow:     0 1px 3px rgba(44,41,38,.06), 0 1px 2px rgba(44,41,38,.04);
  --shadow-md:  0 2px 8px rgba(44,41,38,.08), 0 1px 3px rgba(44,41,38,.05);

  /* Layout */
  --nav-width:  230px;
  --header-h:   52px;

  /* Typography */
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}


/* =========================================================================
   Dark mode — [data-theme="dark"] on <html>
   Palette kept warm: Railings family for surfaces, same F&B accents
   ========================================================================= */
[data-theme="dark"] {
  --bg:         #2A2826;   /* very dark warm — Railings deep */
  --surface:    #333130;   /* dark warm card surface */
  --surface-2:  #2E2C2A;   /* sidebar / table header — slightly darker */
  --border:     #4A4744;   /* visible but not harsh */
  --border-dk:  #5A5754;   /* stronger divider */

  --text:       #F0EDE8;   /* warm off-white — easy on the eyes */
  --text-muted: #B8B2AA;   /* readable muted — much lighter than light mode */
  --text-light: #8A8178;   /* labels — same as light mode (already good) */

  --primary-lt: rgba(88,103,104,.2);  /* tinted hover bg — dark-safe */
  --header-bg:  #1E1D1C;   /* even darker for the header bar */

  --shadow:     0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
  --shadow-md:  0 2px 8px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.3);
}

/* Dark mode: table row tints — rgba needs explicit overrides */
[data-theme="dark"] .tx-table tr:hover td {
  background: rgba(88,103,104,.08);
}
[data-theme="dark"] .tx-table tr.unassigned td {
  background: rgba(236,195,99,.08);
}
[data-theme="dark"] .tx-table tr.unassigned:hover td {
  background: rgba(236,195,99,.14);
}
[data-theme="dark"] .tx-table tr.auto-cat td {
  background: rgba(132,181,156,.07);
}
[data-theme="dark"] .tx-table tr.auto-cat:hover td {
  background: rgba(132,181,156,.12);
}

/* Dark mode: nav hover */
[data-theme="dark"] nav ul li button.nav-btn:hover {
  background: rgba(88,103,104,.12);
}

/* Dark mode: coverage warning */
[data-theme="dark"] .coverage-warn {
  background: rgba(236,195,99,.08);
  border-color: rgba(236,195,99,.3);
}

/* Dark mode: drop zone */
[data-theme="dark"] .drop-zone {
  background: var(--surface-2);
}
[data-theme="dark"] .drop-zone.drag-over {
  background: var(--primary-lt);
}

/* Dark mode: inputs — prevent browser default white fill */
[data-theme="dark"] input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 40px var(--surface) inset !important;
  -webkit-text-fill-color: var(--text) !important;
}

/* Dark mode: scrollbar (Chromium) */
[data-theme="dark"] ::-webkit-scrollbar { width: 8px; height: 8px; }
[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--surface-2); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--border-dk); border-radius: 4px; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* Dark mode toggle button in header */
#btn-dark-mode {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  border-radius: var(--radius);
  padding: 5px 11px;
  font-size: 16px;   /* larger so emoji is clearly visible */
  line-height: 1;
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;    /* don't get squished in header flex */
}
#btn-dark-mode:hover {
  background: rgba(255,255,255,.22);
  border-color: rgba(255,255,255,.6);
}

/* -------------------------------------------------------------------------
   Reset / base
   ------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  font-size: 13.5px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dk); }
button { cursor: pointer; font: inherit; }

/* -------------------------------------------------------------------------
   Layout
   ------------------------------------------------------------------------- */
#app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--header-bg);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 14px;
  z-index: 100;
  /* Subtle bottom line instead of heavy shadow */
  border-bottom: 1px solid rgba(0,0,0,.2);
}

#app-header h1 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .02em;
  flex: 1;
  /* Road name in a lighter weight */
  color: #fff;
}

#app-header h1 span.brand-sub {
  font-weight: 400;
  opacity: .65;
  font-size: 13px;
  margin-left: 6px;
}

#burger {
  background: none; border: none; color: #fff;
  font-size: 20px; padding: 4px 6px; border-radius: var(--radius);
  display: none; opacity: .8;
}
#burger:hover { opacity: 1; }

#sidebar {
  position: fixed;
  top: var(--header-h); left: 0;
  width: var(--nav-width); bottom: 0;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 90;
  transition: transform .2s ease;
}

#main-content {
  margin-top: var(--header-h);
  margin-left: var(--nav-width);
  padding: 28px 28px 40px;
  min-height: calc(100vh - var(--header-h));
}

/* -------------------------------------------------------------------------
   Navigation
   ------------------------------------------------------------------------- */
nav ul { list-style: none; }

nav ul li button.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  color: var(--text-muted);
  font-size: 13px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  border-left: 2px solid transparent;
  transition: color .12s, background .12s, border-color .12s;
}
nav ul li button.nav-btn:hover {
  background: rgba(88,103,104,.06);
  color: var(--text);
}
nav ul li button.nav-btn.active {
  background: var(--primary-lt);
  color: var(--primary);
  font-weight: 600;
  border-left-color: var(--primary);
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
}

.nav-section {
  padding: 18px 16px 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-light);
}

#month-picker select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
}

/* -------------------------------------------------------------------------
   Cards
   ------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.card-header {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.card-header h2 {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
  color: var(--text);
  letter-spacing: .01em;
}
.card-body { padding: 18px; }

/* -------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  transition: all .12s;
  white-space: nowrap;
  letter-spacing: .01em;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-dk);
  border-color: var(--primary-dk);
}

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover {
  background: var(--success-dk);
  border-color: var(--success-dk);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger-dk);
  border-color: var(--danger-dk);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-dk);
}
.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-sm  { padding: 4px 9px;  font-size: 12px; }
.btn-xs  { padding: 2px 7px;  font-size: 11px; }

/* -------------------------------------------------------------------------
   Forms
   ------------------------------------------------------------------------- */
.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
  font-size: 12.5px;
  color: var(--text);
  letter-spacing: .01em;
}

input[type=text],
input[type=number],
input[type=date],
select,
textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 13.5px;
  background: var(--surface);
  color: var(--text);
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(88,103,104,.15);
}
textarea { resize: vertical; min-height: 70px; }

/* -------------------------------------------------------------------------
   Transactions table
   ------------------------------------------------------------------------- */
.tx-table-wrap { overflow-x: auto; }

table.tx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tx-table th {
  text-align: left;
  padding: 8px 10px;
  background: var(--surface-2);
  border-bottom: 2px solid var(--border-dk);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.tx-table th.sort-active { color: var(--primary); }
.tx-table th[data-col]:hover {
  background: var(--primary-lt);
  color: var(--primary);
  cursor: pointer;
}

.tx-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tx-table tr:last-child td { border-bottom: none; }
.tx-table tr:hover td { background: rgba(88,103,104,.03); }

/* Unassigned — warm amber tint */
.tx-table tr.unassigned td        { background: rgba(236,195,99,.12); }
.tx-table tr.unassigned:hover td  { background: rgba(236,195,99,.2); }

/* Auto-categorised — subtle green tint */
.tx-table tr.auto-cat td          { background: rgba(132,181,156,.08); }
.tx-table tr.auto-cat:hover td    { background: rgba(132,181,156,.15); }

.amount-out { color: var(--danger);  font-weight: 600; }
.amount-in  { color: var(--success); font-weight: 600; }

/* Category pill */
.cat-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  letter-spacing: .02em;
}

.auto-tag {
  display: inline-block;
  font-size: 10px;
  color: var(--text-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 4px;
  margin-left: 4px;
  vertical-align: middle;
}

.cat-total-badge {
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

/* Inline editable cells */
.cat-cell { white-space: nowrap; }

.inline-cat-select {
  width: auto;
  min-width: 110px;
  max-width: 180px;
  padding: 3px 6px;
  font-size: 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.inline-cat-select:hover { border-color: var(--border); background: var(--surface); }
.inline-cat-select:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 2px rgba(88,103,104,.15);
  outline: none;
}

.inline-notes {
  width: 150px;
  padding: 3px 6px;
  font-size: 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  transition: border-color .12s, background .12s;
  color: var(--text-muted);
}
.inline-notes:hover { border-color: var(--border); background: var(--surface); }
.inline-notes:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 2px rgba(88,103,104,.15);
  outline: none;
  color: var(--text);
}
.inline-notes::placeholder { color: var(--text-light); }

/* -------------------------------------------------------------------------
   Summary bar (tiles across top of transactions)
   ------------------------------------------------------------------------- */
.summary-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.summary-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  flex: 1;
  min-width: 120px;
  box-shadow: var(--shadow);
}
.summary-tile .label {
  font-size: 10.5px;
  color: var(--text-light);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.summary-tile .value {
  font-size: 21px;
  font-weight: 700;
  margin-top: 3px;
  letter-spacing: -.01em;
}
.summary-tile .value.danger  { color: var(--danger); }
.summary-tile .value.success { color: var(--success); }
.summary-tile .value.warning { color: var(--warning-dk); }

/* Filters bar */
.filters-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.filters-bar select, .filters-bar input {
  width: auto;
  min-width: 140px;
  padding: 6px 10px;
}

/* -------------------------------------------------------------------------
   Pot strip (compact pot balances above transactions)
   ------------------------------------------------------------------------- */
.pot-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.pot-strip-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  flex: 1;
  min-width: 130px;
  box-shadow: var(--shadow);
  border-top-width: 3px; /* coloured top set inline */
}
.pot-strip-name {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-light);
}
.pot-strip-carry  { font-size: 11px; color: var(--text-light); margin-top: 1px; }
.pot-strip-balance { font-size: 19px; font-weight: 700; margin-top: 2px; letter-spacing: -.01em; }
.pot-strip-detail { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

/* -------------------------------------------------------------------------
   Charts
   ------------------------------------------------------------------------- */
.chart-wrap { position: relative; height: 300px; }

.chart-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.chart-tabs button {
  padding: 6px 14px;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: -1px;
  transition: color .12s, border-color .12s;
}
.chart-tabs button:hover { color: var(--text); }
.chart-tabs button.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
}
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* -------------------------------------------------------------------------
   Categories — rules and subcategories
   ------------------------------------------------------------------------- */
.cat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.cat-card-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.cat-card-body { padding: 12px 14px; }

.drag-handle { color: var(--text-light); cursor: grab; font-size: 14px; user-select: none; }
.drag-handle:active { cursor: grabbing; }

/* Rule chips */
.rule-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 12px;
  cursor: grab;
  user-select: none;
  transition: border-color .12s, background .12s;
}
.rule-chip:hover    { border-color: var(--primary); background: var(--primary-lt); }
.rule-chip.dragging { opacity: .4; }

.rule-type-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-light);
  letter-spacing: .04em;
  background: var(--border);
  border-radius: 2px;
  padding: 1px 4px;
}

.rule-drop-zone {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 32px;
  padding: 5px;
  border: 1px dashed transparent;
  border-radius: var(--radius);
  transition: border-color .12s, background .12s;
  align-items: center;
}
.rule-drop-zone.drop-over {
  border-color: var(--primary);
  background: var(--primary-lt);
}
.rule-drop-hint { font-size: 11px; color: var(--text-light); }

.rules-section { margin-bottom: 10px; }
.rules-section-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.add-rule-btn-wrap { margin-left: auto; }

.subcat-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-dk);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 6px 0 6px 16px;
  overflow: hidden;
}
.subcat-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.subcat-indent { color: var(--text-light); font-size: 13px; flex-shrink: 0; }
.subcat-rules  { padding: 6px 10px; }

/* Drag reorder */
.cat-card.dragging       { opacity: .5; box-shadow: 0 4px 16px rgba(44,41,38,.12); }
.cat-card.drag-over-card { outline: 2px dashed var(--primary); outline-offset: 2px; }
.pot-card.dragging       { opacity: .5; }
.pot-card.drag-over-card { outline: 2px dashed var(--primary); outline-offset: 2px; }

/* -------------------------------------------------------------------------
   Pots
   ------------------------------------------------------------------------- */
.pot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.pot-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.pot-card-header {
  padding: 11px 14px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
}
.pot-card-body { padding: 12px 14px; }

.pot-cat-drop {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 30px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
  align-items: center;
}
.pot-cat-drop.drop-over { background: var(--primary-lt); }
.pot-drop-hint { font-size: 11px; color: var(--text-light); }

.pot-cat-chip {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-size: 12px;
  cursor: grab;
  transition: background .12s;
}
.pot-cat-chip:hover    { background: var(--primary-lt); border-color: var(--primary); }
.pot-cat-chip.dragging { opacity: .4; }

.pot-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--bg);
}
.pot-row:last-child { border-bottom: none; }
.pot-row .label { color: var(--text-muted); }

.pot-balance {
  font-size: 18px;
  font-weight: 700;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  letter-spacing: -.01em;
}

/* Coverage warning */
.coverage-warn {
  background: rgba(236,195,99,.15);
  border: 1px solid rgba(236,195,99,.6);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
}
.unassigned-cat-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 4px;
}

/* -------------------------------------------------------------------------
   Import drop zone
   ------------------------------------------------------------------------- */
.drop-zone {
  border: 2px dashed var(--border-dk);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  transition: all .15s;
  cursor: pointer;
  background: var(--surface-2);
}
.drop-zone:hover { border-color: var(--primary); color: var(--primary); }
.drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-lt);
  color: var(--primary);
}
.drop-zone input[type=file] { display: none; }

/* -------------------------------------------------------------------------
   Modal
   ------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44,41,38,.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(44,41,38,.18), 0 4px 12px rgba(44,41,38,.1);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp .18s ease;
  border: 1px solid var(--border);
}
@keyframes slideUp {
  from { transform: translateY(16px); opacity:0; }
  to   { transform: translateY(0);    opacity:1; }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-header h3 {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .01em;
}
.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-light);
  padding: 0 4px;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

.modal-body   { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* -------------------------------------------------------------------------
   Toasts
   ------------------------------------------------------------------------- */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 11px 16px;
  border-radius: var(--radius);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 14px rgba(44,41,38,.16);
  animation: slideIn .18s ease;
  max-width: 340px;
  letter-spacing: .01em;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger);  }
.toast.info    { background: var(--primary); }

.toast-undo { background: var(--primary); cursor: default; display: flex; align-items: center; gap: 10px; }
.toast-undo button:hover { background: rgba(255,255,255,.35) !important; }

@keyframes slideIn {
  from { transform: translateX(30px); opacity:0; }
  to   { transform: translateX(0);    opacity:1; }
}

/* -------------------------------------------------------------------------
   Spinner / empty state
   ------------------------------------------------------------------------- */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-light);
}

/* -------------------------------------------------------------------------
   F&B Colour picker
   ------------------------------------------------------------------------- */
.fb-picker { margin-top: 6px; }
.fb-picker-swatches {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  margin-bottom: 8px;
}
.fb-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  transition: transform .1s, border-color .1s;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
}
.fb-swatch:hover    { transform: scale(1.18); border-color: rgba(0,0,0,.35); z-index: 1; position: relative; }
.fb-swatch.selected { border-color: #000 !important; box-shadow: 0 0 0 2px #fff inset; }

.fb-picker-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.fb-colour-name {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  flex: 1;
  min-width: 100px;
}

/* -------------------------------------------------------------------------
   Login / password screen
   ------------------------------------------------------------------------- */
#login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 44px 40px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}

/* -------------------------------------------------------------------------
   Drag reorder insert indicator
   ------------------------------------------------------------------------- */
.reorder-indicator {
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
  margin: 2px 0;
  pointer-events: none;
  box-shadow: 0 0 4px rgba(88,103,104,.4);
}
.reorder-indicator--horiz {
  width: 2px;
  height: auto;
  min-height: 200px;
  align-self: stretch;
  margin: 0 2px;
}

/* Drag cursors */
[draggable=true] { cursor: grab; }
[draggable=true]:active { cursor: grabbing; }
.drag-handle { cursor: grab; }
.drag-handle:active { cursor: grabbing; }

/* -------------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------------- */
@media (max-width: 768px) {
  #burger { display: block; }
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(44,41,38,.14); }
  #main-content { margin-left: 0; padding: 16px; }
  .summary-bar  { gap: 8px; }
  .summary-tile { min-width: 110px; }
  .pot-strip    { gap: 8px; }
  .inline-notes { width: 100px; }
}

/* -------------------------------------------------------------------------
   Pot strip — detailed monthly breakdown table
   ------------------------------------------------------------------------- */
.pot-strip-table {
  display: table;
  width: 100%;
  margin: 5px 0 4px;
  font-size: 11.5px;
}
.pot-strip-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 1px 0;
  color: var(--text-muted);
}
.pot-strip-row span:first-child { flex: 1; }
.pot-strip-row .pos { color: var(--success); font-weight: 600; }
.pot-strip-row .neg { color: var(--danger);  font-weight: 600; }

/* -------------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------------- */
#app-footer {
  position: fixed;
  bottom: 0;
  left: var(--nav-width);
  right: 0;
  height: 28px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-light);
  z-index: 80;
  letter-spacing: .02em;
}
#app-footer a {
  color: var(--text-light);
  text-decoration: none;
}
#app-footer a:hover { color: var(--primary); }
.footer-sep { opacity: .4; }

/* Push main content up so footer doesn't obscure it */
#main-content { padding-bottom: 48px; }

@media (max-width: 768px) {
  #app-footer { left: 0; }
}
