:root {
  --brand-50: #eef7fc;
  --brand-100: #d7eef9;
  --brand-200: #b5dff3;
  --brand-500: #5AA9E6;
  --brand-600: #5AA9E6;
  --brand-700: #3d92d4;
  --brand-800: #2b7bb8;
  --brand-900: #1a5a8a;
  --accent: #FF6392;
  --accent-dark: #e84d7c;
  --ink: #16324d;
  --muted: #5b6f80;
  --bg: #f3f8fc;
  --white: #ffffff;
  --font: "Figtree", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font-family: inherit; }

.home, .auth, .install-body {
  min-height: 100vh;
  background: linear-gradient(135deg, #5AA9E6 0%, #7ebcec 42%, #FF6392 100%);
  color: #fff;
}
.home {
  display: flex;
  flex-direction: column;
}
.home-inner {
  max-width: 64rem;
  margin: 0 auto;
  padding: 5rem 1.5rem 4rem;
  display: flex;
  flex: 1;
  width: 100%;
  flex-direction: column;
  justify-content: center;
}
.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
}
.home h1 { margin: 1rem 0 0; font-size: clamp(2.5rem, 6vw, 3.75rem); }
.lede { max-width: 36rem; color: rgba(255, 255, 255, 0.92); font-size: 1.125rem; line-height: 1.6; }
.pill {
  display: inline-flex;
  margin-top: 2.5rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 999px;
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(255, 99, 146, 0.35);
}
.pill:hover { background: var(--accent-dark); }
.site-footer {
  padding: 1.5rem 1.5rem 2rem;
  text-align: center;
  background: rgba(22, 50, 77, 0.18);
  backdrop-filter: blur(8px);
}
.site-footer p { margin: 0; font-size: 0.8rem; color: rgba(255, 255, 255, 0.92); }
.site-footer .disclaimer { margin-top: 0.45rem; max-width: 40rem; margin-left: auto; margin-right: auto; color: rgba(255, 255, 255, 0.78); line-height: 1.5; }

.center-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.card {
  width: 100%;
  max-width: 28rem;
  background: #fff;
  color: var(--ink);
  border-radius: 1.5rem;
  padding: 2rem;
  box-shadow: 0 25px 50px rgba(22, 50, 77, 0.22);
}
.card h1 { margin: 0.5rem 0 0; font-size: 1.5rem; }
.card p.sub { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.9rem; }
label { display: block; margin-top: 1rem; }
label span { display: block; margin-bottom: 0.4rem; font-size: 0.875rem; font-weight: 500; }
input, textarea {
  width: 100%;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 0.75rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  background: #fff;
  box-shadow: 0 0 0 4px var(--brand-100);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0.75rem;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  background: var(--brand-600);
  color: #fff;
}
.btn:hover { background: var(--brand-700); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-wide { width: 100%; margin-top: 1.25rem; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f8fafc; }
.error { margin-top: 0.75rem; background: #fef2f2; color: #b91c1c; border-radius: 0.75rem; padding: 0.5rem 0.75rem; font-size: 0.875rem; }
.ok { margin-top: 0.75rem; background: #ecfdf5; color: #047857; border-radius: 0.75rem; padding: 0.5rem 0.75rem; font-size: 0.875rem; }
.checks { margin: 1rem 0 0; padding: 0; list-style: none; font-size: 0.875rem; }
.checks li { margin: 0.35rem 0; }
.checks .pass { color: #047857; }
.checks .fail { color: #b91c1c; }

body.admin {
  --bg: #eef3f8;
  --ink: #16324d;
  --muted: #5b6f80;
  --line: #e2e8f0;
  --radius: 12px;
  --sidebar: #16324d;
  --sidebar-w: 16.5rem;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
body.admin .btn {
  border-radius: 0.7rem;
  padding: 0.7rem 1.15rem;
  font-weight: 600;
  background: var(--ink);
}
body.admin .btn:hover { background: #11293f; }
body.admin .btn-ghost {
  background: transparent;
  color: var(--muted);
}
body.admin .btn-ghost:hover { background: #fff; color: var(--ink); }
body.admin .btn-danger {
  background: #b91c1c;
  color: #fff;
}
body.admin .btn-danger:hover { background: #991b1b; }
body.admin input,
body.admin textarea,
body.admin .search,
body.admin .select,
body.admin .gbp-field { border-radius: var(--radius); }

.sidebar {
  display: none;
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #16324d 0%, #1a5a8a 100%);
  color: #fff;
  padding: 1.35rem 0.9rem 1.1rem;
  flex-direction: column;
  z-index: 40;
}
.sidebar-brand {
  display: block;
  margin: 0 0.55rem 1.5rem;
  color: #fff;
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.8rem;
  border-radius: 0.75rem;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
}
.sidebar-nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.sidebar-nav a.active {
  background: var(--brand-500);
  color: #fff;
  font-weight: 600;
}
.nav-icon {
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1rem 0.8rem 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin-top: 1rem;
}
.sidebar-foot a {
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}
.sidebar-foot a:hover { color: #fff; }
.sidebar-public { font-size: 0.8rem !important; color: rgba(255, 255, 255, 0.58) !important; }
.sidebar-public::after { content: " ↗"; }
.live-clock {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.mobile-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.25rem;
  padding: 0 1rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.sidebar-toggle {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 0.6rem;
  padding: 0.4rem 0.7rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
}
.mobile-brand {
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}
.topbar-out {
  margin-left: auto;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}
.topbar-out:hover { color: var(--accent); }
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(22, 50, 77, 0.35);
  z-index: 35;
}
body.nav-open .sidebar { display: flex; }
.admin-main {
  flex: 1;
  min-width: 0;
  padding: 1.25rem 1.15rem 2.5rem;
}
.wrap { max-width: 72rem; margin: 0 auto; }
.wrap-narrow { max-width: 48rem; }
.page-head { margin-bottom: 1.35rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.page-head-actions { display: flex; gap: 0.65rem; flex-wrap: wrap; align-items: center; }
.settings-subhead { margin: 1.15rem 0 0.35rem; font-size: 1rem; }
.page-head h1 { margin: 0; font-size: 1.65rem; letter-spacing: -0.03em; }
.page-head p { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.95rem; }
.stats { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.stat, .panel {
  background: #fff;
  border: 1px solid #edf1f5;
  border-radius: 1rem;
  box-shadow: 0 1px 2px rgba(22, 50, 77, 0.04);
}
.stat { padding: 1.15rem 1.25rem 1.25rem; }
.stat .label { margin: 0; font-size: 0.8rem; font-weight: 500; }
.stat .value { font-size: 1.85rem; font-weight: 700; margin: 0.55rem 0 0; letter-spacing: -0.03em; color: var(--ink); }
.stat .label, .muted { color: var(--muted); font-size: 0.875rem; }
a.stat { text-decoration: none; color: inherit; }
a.stat:hover { border-color: var(--brand-200); }
.panel-h { display: flex; justify-content: space-between; align-items: center; padding: 1.1rem 1.25rem 0.85rem; border-bottom: 0; }
.panel-h h2 { margin: 0; font-size: 1.05rem; }
.panel-h a { color: var(--brand-700); text-decoration: none; font-size: 0.875rem; font-weight: 500; }
.panel-intro { padding: 1.25rem 1.25rem 0; }
.panel-intro h2 { margin: 0; font-size: 1.05rem; }
.panel-intro p { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.875rem; line-height: 1.5; }
.empty { padding: 1.5rem 1.25rem 1.75rem; color: var(--muted); font-size: 0.9rem; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 0.85rem; align-items: center; padding: 0.75rem 1.25rem; border-top: 1px solid #f1f5f9; }
.thumb, .thumb-lg {
  width: 2.75rem; height: 2.75rem; border-radius: 0.5rem; object-fit: cover;
  background: #f4f5f7; color: var(--muted); font-size: 0.65rem;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.grow { min-width: 0; flex: 1; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }

.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.tabs {
  display: flex;
  gap: 1.1rem;
  margin: 0 0 1.15rem;
  border-bottom: 1px solid var(--line);
}
.tabs .tab {
  border: 0;
  background: none;
  padding: 0.55rem 0;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.tabs .tab:hover { color: var(--ink); }
.tabs .tab.active {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--brand-600);
}
.notice {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1.1rem;
  border-radius: 0.85rem;
  background: #e7f5ee;
  color: #166534;
  font-size: 0.9rem;
  font-weight: 500;
}
.quick-links { padding: 0.25rem 1.25rem 1.25rem; display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; }
.quick-links a { color: var(--brand-700); font-weight: 600; text-decoration: none; font-size: 0.9rem; }
.quick-links a:hover { text-decoration: underline; }
.toolbar { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 0.75rem; }
.search, .select {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}
.search { flex: 1; min-width: 16rem; }
.select { min-width: 12rem; }
.product { display: flex; gap: 0.75rem; min-width: 14rem; max-width: 22rem; }
.product-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  max-width: 18rem;
}
.product-title.expanded { -webkit-line-clamp: unset; }
.product .muted a { color: var(--muted); text-decoration: none; }
.product .muted a:hover { color: var(--brand-700); }
.linkish {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 500;
  color: var(--brand-700);
  cursor: pointer;
}
.linkish:hover { text-decoration: underline; }
.mini-undo { background: #f8fafc; color: #475569; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
}
.chip.active { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }
a.chip { text-decoration: none; display: inline-flex; align-items: center; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; text-align: left; }
th {
  background: #f9fafb;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.55rem 0.9rem;
}
td { padding: 0.55rem 0.9rem; vertical-align: top; border-top: 1px solid var(--line); }
.notes {
  width: 100%;
  margin-top: 0.5rem;
  border: 1px solid transparent;
  background: transparent;
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0.25rem 0;
}
.notes:focus { border-color: var(--brand-200); background: #fff; padding: 0.25rem 0.5rem; }
.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-ordered { background: #fffbeb; color: #92400e; }
.badge-received { background: #eef2ff; color: #3730a3; }
.badge-reviewed { background: #f0f9ff; color: #075985; }
.badge-refunded { background: #ecfdf5; color: #047857; }
.badge-met { background: #ecfdf5; color: #047857; }
.badge-miss { background: #fff1f4; color: #9f1239; }
tr.daily-today td { background: #f8fbff; }
.daily-log { margin: 0.25rem 0 0; font-size: 0.75rem; color: var(--muted); line-height: 1.45; }
.actions { display: flex; flex-direction: column; gap: 0.35rem; }
.mini {
  border: 0;
  border-radius: 0.5rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
}
.mini-received { background: #eef2ff; color: #3730a3; }
.mini-reviewed { background: #f0f9ff; color: #075985; }
.mini-refunded { background: #ecfdf5; color: #047857; }
.mini-del { background: transparent; color: var(--muted); text-align: left; }
.mini-del:hover { background: #fef2f2; color: #b91c1c; }

.panel-body { padding: 1.5rem; }
.stack { display: flex; flex-direction: column; gap: 1.5rem; }

.modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(30, 27, 75, 0.4);
  z-index: 40;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.modal-bg.open { display: flex; }
.modal {
  width: 100%;
  max-width: 32rem;
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: var(--radius);
  padding: 1.5rem;
}
.preview { display: flex; gap: 0.75rem; margin-top: 1rem; padding: 0.75rem; border: 1px solid var(--line); background: #f9fafb; border-radius: var(--radius); }
.preview img, .thumb-lg { width: 5rem; height: 5rem; border-radius: 0.75rem; object-fit: cover; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.5rem; }

.nowrap { white-space: nowrap; }
.field-row { display: grid; gap: 0.75rem; margin-top: 0.25rem; }
.suggest { position: relative; }
.suggest-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 0.15rem);
  z-index: 6;
  max-height: 12rem;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.08);
}
.suggest-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: #fff;
  padding: 0.55rem 0.85rem;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--ink);
}
.suggest-item:hover,
.suggest-item.active { background: var(--brand-50); color: var(--brand-800); }
.suggest-empty { padding: 0.55rem 0.85rem; font-size: 0.8rem; color: var(--muted); }

.date-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.date-label { text-align: center; }
.date-label strong { display: block; }
.date-label a { font-size: 0.8rem; color: var(--brand-700); text-decoration: none; }
.checklist { list-style: none; margin: 0; padding: 0.25rem 0; }
.check-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.1rem;
  border-top: 1px solid var(--line);
}
.check-item label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  flex: 1;
  cursor: pointer;
  font-weight: 500;
}
.check-item input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  accent-color: var(--brand-600);
  flex: none;
}
.check-item.done span { color: var(--muted); text-decoration: line-through; }
.add-task {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem 1.1rem 1.1rem;
  border-top: 1px solid var(--line);
}
.add-task input { flex: 1; width: auto; margin: 0; }

.stats-3 { margin-bottom: 1.5rem; }
.value-sm { font-size: 1.25rem; }
.delta { font-weight: 700; font-size: 0.9rem; }
.delta.up { color: #047857; }
.delta.down { color: #b91c1c; }
.delta.flat { color: var(--muted); font-weight: 600; }
p.value .delta { font-size: 1.15rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.amount-input {
  width: 8.5rem;
  max-width: 100%;
  text-align: right;
  font-variant-numeric: tabular-nums;
  margin: 0;
}
.record-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.record-date label { margin: 0; }
.record-date span {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.record-date input[type="date"] { width: auto; margin: 0.2rem 0 0; }
.record-bar-actions { display: flex; gap: 0.5rem; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.record-hint { margin: 0 0 1rem; }
.record-foot { margin-top: 1rem; align-items: center; }
.gbp-field {
  display: inline-flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding-left: 0.7rem;
}
.gbp-field > span { color: var(--muted); font-weight: 600; }
.gbp-field .amount-input {
  border: 0;
  background: transparent;
  box-shadow: none;
  width: 7.25rem;
  padding: 0.55rem 0.7rem 0.55rem 0.25rem;
}
.gbp-field .amount-input:focus { outline: none; box-shadow: none; background: transparent; }
.gbp-field:focus-within {
  border-color: var(--brand-500);
  background: #fff;
  box-shadow: 0 0 0 4px var(--brand-100);
}
.fx-grid {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.fx-grid label { margin: 0; }
.fx-actions { margin: 0.85rem 0 0; }
.account-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
.note-toggle {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}
.note-toggle:hover { color: var(--brand-700); }
.muted-num { color: var(--muted); }
.extras-panel summary {
  cursor: pointer;
  list-style: none;
  padding: 1rem 1.25rem;
  font-weight: 600;
}
.extras-panel summary::-webkit-details-marker { display: none; }
.extras-panel summary::after {
  content: " +";
  color: var(--brand-700);
  font-weight: 700;
}
.extras-panel[open] summary::after { content: " −"; }
.savings-table td { vertical-align: middle; }
.section-row th {
  background: #f4f5f7;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.5rem 0.9rem;
}
.subtotal-row td {
  font-weight: 600;
  background: #f9fafb;
}
.savings-date-nav { align-items: flex-end; }
.savings-date-nav label { margin: 0; }
.savings-date-nav label span {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.savings-date-nav input[type="date"] { width: auto; margin: 0.2rem 0 0; }
.add-account, .add-loan {
  display: grid;
  gap: 0.75rem;
}
.add-account label, .add-loan label { margin: 0; }
.add-account .select, .add-loan .select { width: 100%; }
.wrap[data-page="record"][data-show-closed="0"] tr.is-closed { display: none; }
.person-row th {
  background: #fff;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.65rem 1rem 0.25rem;
}
.person-total td { background: #f8fafc; font-weight: 600; }
.note-input {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  padding: 0.35rem 0.5rem;
}
.note-prompt { border-color: #f59e0b; background: #fffbeb; }
.account-link { color: inherit; font-weight: 600; text-decoration: none; }
.account-link:hover { color: var(--brand-700); text-decoration: underline; }
.closed-tag {
  display: inline-flex;
  margin-left: 0.35rem;
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #f1f5f9;
  color: var(--muted);
  vertical-align: middle;
}
.change-extra { display: block; margin-top: 0.2rem; font-size: 0.7rem; color: var(--muted); font-weight: 500; }
.closed-toggle { text-align: right; margin: -0.25rem 0 0.75rem; }
.closed-toggle a { color: var(--brand-700); font-size: 0.8rem; text-decoration: none; }
.due-banner {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1.1rem;
  border-radius: 0.85rem;
  background: #e8f4fc;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 500;
}
.due-banner.overdue { background: #fff1f4; color: #9f1239; }
.due-banner a { color: inherit; font-weight: 700; }
.kind-heading { margin: 2rem 0 0.35rem; font-size: 1.05rem; }
.row-actions { white-space: nowrap; }
.growth-list { padding: 0.5rem 1.25rem 1.25rem; display: flex; flex-direction: column; gap: 0.85rem; }
.growth-row { display: grid; grid-template-columns: 11rem 1fr 7.5rem; gap: 0.75rem; align-items: center; }
.growth-meta { display: flex; flex-direction: column; gap: 0.15rem; }
.growth-bar-wrap { height: 0.55rem; background: #eef1f4; border-radius: 999px; overflow: hidden; }
.growth-bar { height: 100%; background: var(--brand-500); border-radius: 999px; }
.growth-total { margin: 0; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.loan-remaining { text-align: right; }
.loan-left { margin: 0.15rem 0 0.35rem; font-size: 1.25rem; font-weight: 700; color: var(--ink); }
.loan-left.settled { color: #047857; }
.repay-list { list-style: none; margin: 0; padding: 0; }
.repay-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
}
.add-repay {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.85rem 1.1rem 1.1rem;
  border-top: 1px solid var(--line);
}
.stock-form .gbp-field { margin-top: 0.2rem; }
.stock-form .select { width: 100%; }
td .gbp-field { margin: 0; width: 100%; justify-content: flex-end; }
.stat-hint { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.8rem; }
.stat-hint a { color: var(--brand-700); font-weight: 600; text-decoration: none; }
.stat-hint a:hover { text-decoration: underline; }
.stock-danger {
  margin: 0;
  padding: 1.1rem 1.25rem 1.25rem;
  border-top: 1px solid var(--line);
}
.stock-danger h3 { margin: 0; font-size: 0.95rem; }
.stock-danger p { margin: 0.35rem 0 0.85rem; color: var(--muted); font-size: 0.875rem; line-height: 1.5; }
.stock-wipe {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: end;
}
.stock-wipe label { margin: 0; }
.stock-wipe input[name="confirm"] { width: 10rem; text-transform: none; }

@media (min-width: 768px) {
  .admin-main { padding: 2rem 2rem 3rem; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .stats-3 { grid-template-columns: repeat(3, 1fr); }
  .stats-2 { grid-template-columns: repeat(2, 1fr); }
  .add-account { grid-template-columns: 1.4fr 0.8fr 0.8fr auto; align-items: end; }
  .add-loan { grid-template-columns: 1.1fr 0.9fr 0.7fr 0.8fr 1fr auto; align-items: end; }
  .card { max-width: 32rem; }
  .field-row { grid-template-columns: 1fr 1fr; }
  .fx-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 900px) {
  .mobile-bar { display: none; }
  .sidebar { display: flex; }
  .sidebar-backdrop { display: none !important; }
  .admin-main { margin-left: var(--sidebar-w); }
  body.nav-open { overflow: auto; }
}

@media (max-width: 899px) {
  body.nav-open { overflow: hidden; }
  .sidebar {
    display: flex;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }
  body.nav-open .sidebar { transform: translateX(0); }
}

@media (max-width: 800px) {
  .growth-row { grid-template-columns: 1fr auto; }
  .growth-bar-wrap { grid-column: 1 / -1; }
  .record-bar { grid-template-columns: 1fr; }
  .record-bar-actions { justify-content: flex-start; }
}
