/* ==========================================================================
   RTPS — Real-time Tax Provisioning System
   Design system
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  /* Neutrals — cool warm-grey */
  --bg:           oklch(0.985 0.003 230);
  --bg-elev:     oklch(0.975 0.004 230);
  --surface:     #ffffff;
  --surface-2:   oklch(0.98 0.004 230);
  --border:      oklch(0.92 0.005 230);
  --border-strong: oklch(0.86 0.006 230);
  --fg:          oklch(0.20 0.012 245);
  --fg-soft:     oklch(0.36 0.010 245);
  --muted:       oklch(0.54 0.010 245);
  --muted-2:     oklch(0.68 0.008 245);

  /* Brand accent — derived from the RTPS logo cyan */
  --brand:       oklch(0.70 0.135 220);
  --brand-ink:   oklch(0.40 0.12 225);
  --brand-soft:  oklch(0.95 0.035 220);
  --brand-line:  oklch(0.86 0.06 220);

  /* Status */
  --ok:          oklch(0.62 0.135 150);
  --ok-soft:     oklch(0.95 0.04 150);
  --warn:        oklch(0.78 0.13 75);
  --warn-soft:   oklch(0.96 0.05 80);
  --danger:      oklch(0.60 0.20 25);
  --danger-soft: oklch(0.96 0.04 25);

  /* Type scale */
  --t-xs:    11px;
  --t-sm:    12px;
  --t-base:  13px;
  --t-md:    14px;
  --t-lg:    16px;
  --t-xl:    20px;
  --t-2xl:   24px;
  --t-3xl:   28px;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  --shadow-card: 0 1px 0 oklch(0.94 0.005 230), 0 1px 2px rgb(15 23 42 / 0.04);
  --shadow-pop:  0 8px 28px rgb(15 23 42 / 0.10), 0 2px 6px rgb(15 23 42 / 0.06);

  --nav-w: 232px;
  --topbar-h: 60px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--t-base);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

button { font-family: inherit; }

/* ==========================================================================
   App shell — left nav + topbar + main
   ========================================================================== */

.app {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  min-height: 100vh;
}

/* ----- Nav ----- */

.nav {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border);
}

.nav-brand img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.nav-brand-text {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.nav-brand-text .top {
  color: var(--brand-ink);
  display: block;
}

.nav-brand-text .bottom {
  color: var(--fg);
  display: block;
}

.nav-section {
  padding: 16px 12px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  text-transform: uppercase;
}

.nav-links {
  list-style: none;
  margin: 0;
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--fg-soft);
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--fg);
}

.nav-item.active {
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-weight: 600;
}

.nav-item.active .nav-icon {
  color: var(--brand-ink);
}

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--muted);
}

.nav-footer {
  border-top: 1px solid var(--border);
  padding: 12px;
}

.nav-user {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  position: relative;
}

.nav-user:hover { background: var(--surface-2); }

.nav-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-ink);
  display: grid;
  place-items: center;
  font-size: var(--t-sm);
  font-weight: 600;
}

.nav-user-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.nav-user-name {
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-user-sub {
  font-size: var(--t-xs);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-user-caret {
  color: var(--muted);
  width: 14px;
  height: 14px;
}

/* User menu */
.user-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 8px;
  right: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: var(--shadow-pop);
  z-index: 50;
  display: none;
}

.user-menu.open { display: block; }

.user-menu a,
.user-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--fg-soft);
  text-decoration: none;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease;
}

.user-menu a:hover,
.user-menu button:hover {
  background: var(--surface-2);
  color: var(--fg);
}

.user-menu svg {
  width: 14px;
  height: 14px;
  color: var(--muted);
}

.user-menu .menu-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 2px;
}

/* ----- Main ----- */

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-title {
  margin: 0;
  font-size: var(--t-xl);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.page-subtitle {
  font-size: var(--t-sm);
  color: var(--muted);
  margin: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: var(--t-xs);
  font-weight: 500;
  color: var(--fg-soft);
  background: var(--surface);
  cursor: default;
}

.conn-pill .conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.conn-pill.ok .conn-dot { background: var(--ok); }
.conn-pill.off .conn-dot { background: var(--danger); }

.conn-pill .conn-count {
  font-weight: 600;
  color: var(--fg);
}

.content {
  padding: 24px 28px 40px;
  flex: 1;
  min-width: 0;
}

/* ==========================================================================
   Cards & primitives
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.card-pad { padding: 18px; }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
}

.card-title {
  margin: 0;
  font-size: var(--t-md);
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.005em;
}

.card-sub {
  margin: 2px 0 0;
  font-size: var(--t-xs);
  color: var(--muted);
}

.card-body { padding: 0 18px 18px; }

.card-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ----- Buttons ----- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg);
  font-family: inherit;
  font-size: var(--t-sm);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
  white-space: nowrap;
}

.btn:hover { background: var(--surface-2); }

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

.btn-primary:hover { background: oklch(0.34 0.13 225); }

.btn-ghost {
  border-color: transparent;
  background: transparent;
}

.btn-ghost:hover { background: var(--surface-2); }

.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: var(--t-xs);
}

.btn svg { width: 14px; height: 14px; }

/* ----- Form ----- */

.field { display: flex; flex-direction: column; gap: 6px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.label {
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--fg-soft);
}

.input,
.select,
.textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--t-sm);
  color: var(--fg);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.input::placeholder { color: var(--muted-2); }

.textarea { height: auto; padding: 10px 12px; min-height: 90px; resize: vertical; }

.help { font-size: var(--t-xs); color: var(--muted); }

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--t-sm);
  color: var(--fg-soft);
  cursor: pointer;
}

.check input { width: 14px; height: 14px; accent-color: var(--brand-ink); }

/* ----- Badges ----- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: var(--t-xs);
  font-weight: 600;
  background: var(--surface-2);
  color: var(--fg-soft);
  border: 1px solid var(--border);
  line-height: 1.2;
  white-space: nowrap;
}

.badge.ok    { background: var(--ok-soft);     color: oklch(0.40 0.12 150); border-color: oklch(0.86 0.06 150); }
.badge.warn  { background: var(--warn-soft);   color: oklch(0.42 0.13 75);  border-color: oklch(0.86 0.08 75); }
.badge.danger{ background: var(--danger-soft); color: oklch(0.42 0.18 25);  border-color: oklch(0.84 0.10 25); }
.badge.brand { background: var(--brand-soft);  color: var(--brand-ink);     border-color: var(--brand-line); }

.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ----- Tables ----- */

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-sm);
}

.tbl th,
.tbl td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.tbl thead th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-top: 1px solid var(--border);
}

.tbl tbody tr:hover td { background: var(--surface-2); }

.tbl .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.tbl .strong { font-weight: 600; color: var(--fg); }

/* ==========================================================================
   Auth pages (sign-in, sign-up, forgot-password)
   ========================================================================== */

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--bg);
}

.auth-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
}

.auth-form {
  width: 100%;
  max-width: 400px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
}

.auth-brand img { width: 40px; height: 40px; }

.auth-brand-text {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.auth-brand-text .top { color: var(--brand-ink); display: block; }
.auth-brand-text .bottom { color: var(--fg); display: block; }

.auth-title {
  margin: 0 0 6px;
  font-size: var(--t-2xl);
  font-weight: 600;
  letter-spacing: -0.015em;
}

.auth-sub {
  margin: 0 0 28px;
  font-size: var(--t-sm);
  color: var(--muted);
}

.auth-actions {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-actions .btn-primary { height: 40px; }

.auth-alt {
  margin-top: 18px;
  font-size: var(--t-sm);
  color: var(--muted);
  text-align: center;
}

.auth-alt a {
  color: var(--brand-ink);
  font-weight: 600;
  text-decoration: none;
}

.auth-alt a:hover { text-decoration: underline; }

.auth-side {
  background: linear-gradient(160deg, oklch(0.96 0.025 220) 0%, oklch(0.98 0.01 230) 100%);
  border-left: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  position: relative;
  overflow: hidden;
}

.auth-side-inner {
  position: relative;
  z-index: 1;
  max-width: 460px;
}

.auth-side h2 {
  margin: 0 0 12px;
  font-size: var(--t-2xl);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--fg);
}

.auth-side p {
  margin: 0 0 28px;
  font-size: var(--t-md);
  color: var(--fg-soft);
  line-height: 1.55;
}

.stakeholders-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.stakeholder {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--fg);
}

.stakeholder-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.stakeholder small {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 1px;
}

@media (max-width: 880px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}

/* ==========================================================================
   Dashboard / tax pages — content shapes
   ========================================================================== */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-card);
}

.kpi-label {
  font-size: var(--t-xs);
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.kpi-value {
  font-size: var(--t-2xl);
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}

.kpi-meta {
  font-size: var(--t-xs);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.kpi-meta .delta-up { color: oklch(0.40 0.12 150); font-weight: 600; }
.kpi-meta .delta-down { color: oklch(0.42 0.18 25); font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-12 { display: grid; grid-template-columns: 7fr 5fr; gap: 14px; }

.chart-wrap {
  position: relative;
  height: 240px;
  padding: 8px 0 0;
}

.chart-wrap.tall { height: 280px; }
.chart-wrap.short { height: 180px; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: var(--t-xs);
  color: var(--muted);
  margin-top: 8px;
}

.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--muted-2);
}

/* Compliance status banner — replaces the gauge */
.compliance-status {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 20px;
}

.compliance-orb {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid oklch(0.86 0.06 150);
}

.compliance-orb svg { width: 30px; height: 30px; }

.compliance-orb.warn { background: var(--warn-soft); color: var(--warn); border-color: oklch(0.86 0.08 75); }
.compliance-orb.danger { background: var(--danger-soft); color: var(--danger); border-color: oklch(0.84 0.10 25); }

.compliance-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.compliance-text .label {
  font-size: var(--t-xs);
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin: 0;
}

.compliance-text .value {
  font-size: var(--t-xl);
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.015em;
}

.compliance-text .source {
  font-size: var(--t-xs);
  color: var(--muted);
}

/* Transaction status card */
.tx-status {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tx-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.tx-row.alert {
  background: oklch(0.97 0.025 25);
  border-color: oklch(0.88 0.08 25);
}

.tx-row-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tx-row-left .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.tx-row.ok .dot   { background: var(--ok); }
.tx-row.alert .dot { background: var(--danger); }

.tx-row .meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.tx-row .title {
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--fg);
}

.tx-row .desc {
  font-size: var(--t-xs);
  color: var(--muted);
}

.tx-row a {
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--brand-ink);
  text-decoration: none;
}

.tx-row a:hover { text-decoration: underline; }

/* Upcoming returns list */
.returns-list {
  display: flex;
  flex-direction: column;
}

.returns-list .row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
}

.returns-list .row:last-child { border-bottom: 0; }

.returns-list .row.head {
  padding: 10px 16px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--t-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.returns-list .name {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.returns-list .name strong {
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--fg);
}

.returns-list .name span {
  font-size: var(--t-xs);
  color: var(--muted);
}

.returns-list .date {
  font-size: var(--t-sm);
  color: var(--fg-soft);
  font-variant-numeric: tabular-nums;
}

/* ----- Calendar ----- */

.calendar {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.calendar-head h4 {
  margin: 0;
  font-size: var(--t-sm);
  font-weight: 600;
}

.calendar-head button {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  color: var(--fg-soft);
}

.calendar-head button:hover { background: var(--surface-2); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  font-size: var(--t-xs);
}

.calendar-grid .dow {
  padding: 8px 4px;
  text-align: center;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.calendar-grid .day {
  padding: 8px 0;
  text-align: center;
  color: var(--fg-soft);
  position: relative;
}

.calendar-grid .day.muted { color: var(--muted-2); }

.calendar-grid .day.today {
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-weight: 600;
}

.calendar-grid .day.due {
  font-weight: 700;
  color: oklch(0.40 0.18 25);
}

.calendar-grid .day.due::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--danger);
}

/* Generate reports block */
.report-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.report-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
  text-decoration: none;
  font-size: var(--t-sm);
  font-weight: 500;
  transition: background 120ms ease, border-color 120ms ease;
}

.report-link:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.report-link svg { width: 14px; height: 14px; color: var(--muted); }

/* Funds table mini */
.funds {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.funds-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.funds-row:last-child { border-bottom: 0; }

.funds-row .lbl {
  font-size: var(--t-sm);
  color: var(--fg-soft);
}

.funds-row .val {
  font-size: var(--t-md);
  font-weight: 600;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.funds-row.shortfall .lbl { color: var(--danger); font-weight: 600; }
.funds-row.shortfall .val { color: var(--danger); }
.funds-row.surplus .lbl { color: oklch(0.40 0.12 150); font-weight: 600; }
.funds-row.surplus .val { color: oklch(0.40 0.12 150); }

/* Connection status (footer chips) */
.conn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.conn-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.conn-card .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.conn-card.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.conn-card.off .dot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.conn-card .label-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.conn-card .label-text .n {
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--fg);
}

.conn-card .label-text .s {
  font-size: var(--t-xs);
  color: var(--muted);
}

/* ==========================================================================
   Misc helpers
   ========================================================================== */

.row-flex { display: flex; align-items: center; gap: 12px; }
.row-flex.between { justify-content: space-between; }
.row-flex.wrap { flex-wrap: wrap; }

.spacer { flex: 1; }

.muted { color: var(--muted); }
.fg-soft { color: var(--fg-soft); }
.tnum { font-variant-numeric: tabular-nums; }

.section-title {
  margin: 24px 0 12px;
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* responsive collapse */
@media (max-width: 1100px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .grid-12 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 840px) {
  :root { --nav-w: 64px; }
  .nav-brand-text,
  .nav-section,
  .nav-item span,
  .nav-user-meta,
  .nav-user-caret { display: none; }
  .nav-brand { justify-content: center; padding: 14px 8px; }
  .nav-item { justify-content: center; }
  .grid-3 { grid-template-columns: 1fr; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
}
