/* ============================================================
   Church Portal — design system
   Palette
     --plum   #38233F  deep liturgical plum (sidebar / ink accents)
     --vest   #5C3A66  lighter vestment plum
     --paper  #FBF8F3  warm paper
     --ink    #2A2230  near-black plum ink
     --brass  #A87C2A  brass / candlelight accent
     --moss   #4F6F52  moss green (income / positive)
     --clay   #9C4435  clay red (expense / negative)
   Type: Fraunces (display) · Source Sans 3 (body)
   Signature: the arch — rounded-top forms echoing church windows
   ============================================================ */

:root {
  --plum:  #38233F;
  --vest:  #5C3A66;
  --paper: #FBF8F3;
  --card:  #FFFFFF;
  --ink:   #2A2230;
  --muted: #7A7080;
  --line:  #E8E1D8;
  --brass: #A87C2A;
  --brass-soft: #F3EAD7;
  --moss:  #4F6F52;
  --moss-soft: #E9F0E9;
  --clay:  #9C4435;
  --clay-soft: #F6E8E4;
  --c5: #4F86A0; --c6: #8A6BA3; --c7: #C58A3D; --c8: #6E8B5A; --c9: #A0556B; --c10: #5B7B8C;
  --arch: 999px 999px 12px 12px; /* the signature radius */
  --th-bg: #F4EFE7;
  --row-hover: #FAF6EF;
  --input-bg: #FFFFFF;
  --shadow: 0 1px 2px rgba(42,34,48,.05), 0 4px 14px rgba(42,34,48,.04);
}

/* ============ color palettes (Settings → Appearance) ============ */
body[data-theme="forest"] {
  --plum: #1E3A2A; --vest: #38614A; --brass: #A8842A; --brass-soft: #EFE8D2;
  --paper: #F7F8F3; --ink: #20281F; --line: #DFE4D8; --th-bg: #ECF0E5; --row-hover: #F2F5EC;
  --moss: #3C7A55; --moss-soft: #E6F0E8; --clay: #A8503C; --clay-soft: #F5E7E2;
}
body[data-theme="indigo"] {
  --plum: #23305C; --vest: #45529B; --brass: #B98A33; --brass-soft: #EFE6D0;
  --paper: #F6F7FB; --ink: #1F2433; --line: #DEE1EC; --th-bg: #EBEDF5; --row-hover: #F1F3F9;
  --moss: #2F7E72; --moss-soft: #E4F1EF; --clay: #B0514A; --clay-soft: #F6E8E6;
}
body[data-theme="wine"] {
  --plum: #4A1F2B; --vest: #7A3B4D; --brass: #B08D3E; --brass-soft: #F3EAD7;
  --paper: #FBF7F4; --ink: #2E2024; --line: #EADFD9; --th-bg: #F4EBE5; --row-hover: #F8F1EC;
  --moss: #5E7A4E; --moss-soft: #EDF1E6; --clay: #9C3F46; --clay-soft: #F6E7E8;
}
body[data-theme="slate"] {
  --plum: #2A3138; --vest: #49545E; --brass: #B0703C; --brass-soft: #F1E4D6;
  --paper: #F6F7F8; --ink: #23282D; --line: #E0E3E6; --th-bg: #ECEFF1; --row-hover: #F1F4F6;
  --moss: #4E7A5C; --moss-soft: #E9F1EC; --clay: #A85A45; --clay-soft: #F5E9E4;
}
body[data-theme="midnight"] {
  --plum: #14101C; --vest: #6B5A82; --brass: #C79A45; --brass-soft: #3A2F1A;
  --paper: #1C1822; --card: #262031; --ink: #EDE6F0; --muted: #A99CB3; --line: #3A3346;
  --moss: #7FAE85; --moss-soft: #233427; --clay: #C97A66; --clay-soft: #3A2620;
  --th-bg: #2E2839; --row-hover: #2C2536; --input-bg: #1F1A29;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Source Sans 3", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.5;
}
h1, h2, h3 { font-family: "Fraunces", serif; font-weight: 600; color: var(--ink); margin: 0 0 .35em; letter-spacing: -.013em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }
a { color: var(--vest); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { color: var(--plum); }
html { scroll-behavior: smooth; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }
.content { flex: 1; padding: 28px 40px 60px; max-width: 1500px; width: 100%; margin: 0 auto; }

/* ---------- sidebar ---------- */
.sidebar {
  width: 232px; flex-shrink: 0;
  background: var(--plum);
  color: #EDE6F0;
  display: flex; flex-direction: column;
  padding: 22px 14px 16px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 11px; align-items: center; padding: 0 8px 18px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-arch {
  width: 38px; height: 46px;
  border-radius: var(--arch);
  background: linear-gradient(160deg, var(--brass), #C79A45);
  color: var(--plum);
  font-family: "Fraunces", serif; font-weight: 700; font-size: 1.25rem;
  display: flex; align-items: center; justify-content: center;
}
.brand-name { font-family: "Fraunces", serif; font-weight: 600; font-size: 1.02rem; line-height: 1.2; }
.brand-sub { font-size: .72rem; opacity: .65; letter-spacing: .04em; text-transform: uppercase; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 14px 0; flex: 1; }
.nav-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .12em;
  color: rgba(237,230,240,.5); padding: 12px 10px 4px;
}
.sidebar nav a {
  color: #EDE6F0; text-decoration: none;
  padding: 8px 10px; border-radius: 8px; font-weight: 500;
}
.sidebar nav a { transition: background .12s ease; }
.sidebar nav a:hover { background: rgba(255,255,255,.08); }
.sidebar nav a.active { background: var(--brass); color: #fff; font-weight: 700; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.12); padding: 12px 10px 0; font-size: .85rem; }
.sidebar-foot .who { opacity: .85; }
.sidebar-foot .logout { color: var(--brass-soft); font-size: .8rem; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 0; color: var(--muted); }

/* ---------- cards & stats ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; margin-bottom: 22px; box-shadow: var(--shadow); max-width: 100%; box-sizing: border-box; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px 14px 22px; text-align: left;
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 2px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.stat::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: var(--vest);
}
.stat:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(42,34,48,.10); }
.stat .num { font-family: "Fraunces", serif; font-size: 1.6rem; font-weight: 700; line-height: 1.15; }
.stat .lbl { font-size: .74rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 600; }
.stat.income::before  { background: var(--moss); }
.stat.expense::before { background: var(--clay); }
.stat.balance::before { background: var(--brass); }
.stat.income .num  { color: var(--moss); }
.stat.expense .num { color: var(--clay); }
.stat.balance .num { color: var(--brass); }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.card table { box-shadow: none; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--th-bg); font-size: .76rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--row-hover); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.amount-in  { color: var(--moss); font-weight: 600; }
.amount-out { color: var(--clay); font-weight: 600; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .74rem; font-weight: 600; }
.badge.Active   { background: var(--moss-soft); color: var(--moss); }
.badge.Inactive { background: #EEE9E2; color: var(--muted); }
.badge.Transferred { background: var(--brass-soft); color: var(--brass); }
.badge.Deceased { background: var(--clay-soft); color: var(--clay); }

/* ---------- forms ---------- */
form .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 18px; }
label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=date], input[type=email], input[type=number],
input[type=password], select, textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: var(--input-bg); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brass); outline-offset: 1px; border-color: var(--brass); }
textarea { min-height: 72px; resize: vertical; }
.form-actions { margin-top: 18px; display: flex; gap: 10px; align-items: center; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; padding: 9px 18px;
  border-radius: 999px; border: 0; cursor: pointer;
  font: inherit; font-weight: 600; text-decoration: none;
  background: var(--plum); color: #fff;
  box-shadow: 0 1px 2px rgba(42,34,48,.12);
  transition: background .12s ease, transform .12s ease, box-shadow .12s ease;
}
.btn:active { transform: scale(.98); }
.btn:hover { background: var(--vest); transform: translateY(-1px); box-shadow: 0 5px 14px rgba(42,34,48,.16); }
.btn.gold { background: var(--brass); color: var(--plum); }
.btn.gold:hover { background: #C79A45; }
.btn.ghost { background: transparent; color: var(--vest); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { background: var(--brass-soft); border-color: var(--brass-soft); box-shadow: none; }
.btn.sm { padding: 4px 12px; font-size: .82rem; }
.btn.danger { background: var(--clay); }
.link-danger { color: var(--clay); }

/* ---------- filter bar ---------- */
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.filters > div { min-width: 150px; }

/* ---------- flash ---------- */
.flash { padding: 11px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 600; }
.flash-ok  { background: var(--moss-soft); color: var(--moss); }
.flash-err { background: var(--clay-soft); color: var(--clay); }

/* ---------- dashboard chart (CSS bars) ---------- */
.bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; align-items: end; height: 170px; padding-top: 8px; }
.bar-col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; height: 100%; }
.bar-pair { display: flex; gap: 5px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.bar { width: 16px; border-radius: 99px 99px 3px 3px; min-height: 3px; }
.bar.in  { background: var(--moss); }
.bar.out { background: var(--clay); }
.bar-lbl { font-size: .72rem; color: var(--muted); }
.legend { display: flex; gap: 18px; font-size: .8rem; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--plum);
  background-image: radial-gradient(ellipse at 50% -10%, rgba(168,124,42,.28), transparent 55%);
}
.login-card {
  width: 360px; background: var(--paper);
  border-radius: var(--arch);
  padding: 52px 34px 30px; text-align: center;
}
.login-card h1 { font-size: 1.45rem; }
.login-card .sub { color: var(--muted); font-size: .88rem; margin-bottom: 22px; }
.login-card form { text-align: left; }
.login-card .btn { width: 100%; margin-top: 16px; }
.login-note { margin-top: 18px; font-size: .78rem; color: var(--muted); }

/* ---------- misc ---------- */
.muted { color: var(--muted); }
.right { text-align: right; }
.mt { margin-top: 18px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 24px; }
.detail-grid dt { font-size: .76rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.detail-grid dd { margin: 2px 0 10px; font-weight: 500; }

/* ---------- mobile layout: topbar + slide-down nav ---------- */
.topbar { display: none; }
@media (max-width: 860px) {
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--plum); color: #EDE6F0;
    padding: 10px 14px; position: sticky; top: 0; z-index: 50;
  }
  .topbar-brand { display: flex; align-items: center; gap: 10px; font-family: "Fraunces", serif; font-size: 1.05rem; }
  .topbar-brand img { width: 30px; height: 30px; object-fit: contain; border-radius: 7px; background: rgba(255,255,255,.92); padding: 2px; }
  .nav-toggle {
    background: var(--brass); color: var(--plum); border: 0; border-radius: 9px;
    width: 42px; height: 38px; font-size: 1.15rem; cursor: pointer; font-weight: 700;
  }
  .layout { flex-direction: column; }
  .sidebar {
    display: none;
    width: 100%; height: auto; max-height: calc(100vh - 58px);
    position: sticky; top: 58px; z-index: 40;
    box-shadow: 0 14px 24px rgba(0,0,0,.25);
  }
  .sidebar.open { display: flex; }
  .sidebar .brand { display: none; }            /* topbar already shows it */
  .sidebar nav a { padding: 12px 12px; }        /* comfortable tap targets */
  .content { padding: 16px 14px 48px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .btn { text-align: center; }
  h1 { font-size: 1.45rem; }
  /* wide tables scroll sideways instead of breaking the page */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table thead, table tbody { display: table; width: 100%; min-width: 560px; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1 1 auto; text-align: center; }
}
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- v2: autocomplete ---------- */
.ac-wrap { position: relative; }
.ac-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  margin-top: 4px; box-shadow: 0 8px 24px rgba(42,34,48,.12); overflow: hidden;
}
.ac-item {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 9px 13px; cursor: pointer; font: inherit; border-bottom: 1px solid var(--line);
}
.ac-item:last-child { border-bottom: 0; }
.ac-item span { display: block; font-size: .78rem; color: var(--muted); }
.ac-item { color: var(--ink); }
.ac-item:hover, .ac-item.active { background: var(--brass-soft); }

/* ---------- v2: tabs (segmented buttons) ---------- */
.tabs {
  display: inline-flex; gap: 4px; margin-bottom: 18px; flex-wrap: wrap;
  background: var(--th-bg); border: 1px solid var(--line);
  padding: 4px; border-radius: 999px;
}
.tab {
  padding: 8px 20px; border-radius: 999px; text-decoration: none;
  color: var(--vest); font-weight: 600; background: transparent;
  border: 1px solid transparent;
  transition: background .12s ease, color .12s ease, box-shadow .12s ease;
}
.tab:hover { background: var(--card); box-shadow: var(--shadow); }
.tab.active {
  background: var(--plum); color: #fff;
  box-shadow: 0 2px 8px rgba(42,34,48,.22);
}

/* ---------- v2: misc ---------- */
.role-tag {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  background: rgba(255,255,255,.14); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
}
.update-card .update-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.bs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .bs-grid { grid-template-columns: 1fr; } }

/* ---------- print ---------- */
@media print {
  .sidebar, .filters, .tabs, .btn, .page-head button { display: none !important; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
  .card { border: 0; padding: 0; }
}

/* ---------- v3.1: theme picker swatches ---------- */
.theme-grid { display: flex; gap: 14px; flex-wrap: wrap; }
.theme-opt { cursor: pointer; text-align: center; }
.theme-opt input { position: absolute; opacity: 0; }
.theme-swatch {
  width: 84px; height: 56px; border-radius: 12px; overflow: hidden;
  display: flex; border: 2px solid var(--line);
  transition: border-color .12s ease, transform .12s ease, box-shadow .12s ease;
}
.theme-opt:hover .theme-swatch { transform: translateY(-2px); box-shadow: var(--shadow); }
.theme-opt input:checked + .theme-swatch { border-color: var(--brass); box-shadow: 0 0 0 3px var(--brass-soft); }
.theme-swatch i { display: block; height: 100%; }
.theme-name { display: block; font-size: .78rem; font-weight: 600; margin-top: 6px; color: var(--muted); }
.theme-opt input:checked ~ .theme-name { color: var(--ink); }

/* ---------- v3.1: SVG dashboard chart ---------- */
.chart-wrap { width: 100%; }
.chart-wrap svg { width: 100%; height: auto; display: block; }
.chart-bar { transition: opacity .12s ease; cursor: pointer; }
.chart-bar:hover { opacity: .78; }
.chart-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.chart-axis-label { font: 600 10px "Source Sans 3", sans-serif; fill: var(--muted); }
.chart-month-label { font: 600 11px "Source Sans 3", sans-serif; fill: var(--muted); }
.chart-value { font: 700 10px "Source Sans 3", sans-serif; fill: var(--ink); }

/* ---------- v3.2 ---------- */
.sidebar nav { overflow-y: auto; min-height: 0; scrollbar-width: thin; }
.brand-logo {
  width: 42px; height: 42px; object-fit: contain;
  border-radius: 10px; background: rgba(255,255,255,.92); padding: 3px;
}
.sidebar-foot a.who {
  display: block; color: #EDE6F0; text-decoration: none;
  padding: 4px 6px; margin: -4px -6px 2px; border-radius: 8px;
}
.sidebar-foot a.who:hover { background: rgba(255,255,255,.08); }

/* ---------- v3.4: getting-started checklist ---------- */
.getting-started { border-left: 4px solid var(--brass); }
.gs-list { list-style: none; margin: 8px 0 0; padding: 0; }
.gs-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-weight: 500; }
.gs-mark {
  width: 22px; height: 22px; flex-shrink: 0; border-radius: 999px;
  border: 2px solid var(--line); display: inline-flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; color: #fff;
}
.gs-list li.done { color: var(--muted); text-decoration: line-through; }
.gs-list li.done .gs-mark { background: var(--moss); border-color: var(--moss); }

/* ---------- v3.6: demographic chips + changelog ---------- */
.demo-chips { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 15px; border-radius: 999px; text-decoration: none;
  background: var(--card); border: 1px solid var(--line);
  color: var(--muted); font-size: .86rem; font-weight: 600;
  box-shadow: var(--shadow); transition: transform .12s ease, border-color .12s ease;
}
.chip strong { color: var(--ink); font-size: 1rem; }
.chip:hover { transform: translateY(-1px); border-color: var(--brass); }
.chip.on { border-color: var(--brass); background: var(--brass-soft); color: var(--ink); }
.cl-list { margin: 6px 0 0; padding-left: 20px; line-height: 1.7; }

/* ---------- v3.7.1: category donut ---------- */
.donut-wrap { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; }
.donut { width: 180px; height: 180px; flex-shrink: 0; }
.donut circle { transition: opacity .12s ease; }
.donut:hover circle { opacity: .55; }
.donut circle:hover { opacity: 1; }
.donut-total { font-family: "Fraunces", serif; font-weight: 700; font-size: 15px; fill: var(--ink); }
.donut-sub { font-size: 8.5px; fill: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.donut-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 220px; }
.donut-legend li { display: flex; align-items: center; gap: 9px; padding: 5px 0; font-size: .9rem; border-bottom: 1px solid var(--line); }
.donut-legend li:last-child { border-bottom: 0; }
.donut-legend .dot { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.donut-legend .lg-name { flex: 1; }
.donut-legend .lg-val { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }
@media (max-width: 600px) { .donut-wrap { justify-content: center; } .donut-legend { min-width: 100%; } }

/* ---------- v3.9: dashboard row, calendar, events ---------- */
a.brand { text-decoration: none; color: inherit; cursor: pointer; }
a.brand:hover .brand-name { color: var(--brass-soft); }
a.topbar-brand { text-decoration: none; color: inherit; }

.dash-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; align-items: start; }
.dash-row .card { margin-bottom: 0; }

.ev-list { list-style: none; margin: 6px 0 0; padding: 0; }
.ev-list li { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ev-list li:last-child { border-bottom: 0; }
.ev-date { flex-shrink: 0; width: 46px; text-align: center; background: var(--brass-soft); border-radius: 9px; padding: 5px 0; }
.ev-d { display: block; font-family: "Fraunces", serif; font-weight: 700; font-size: 1.15rem; color: var(--ink); line-height: 1; }
.ev-m { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--brass); }
.ev-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ev-body .muted { font-size: .82rem; }
.ev-edit { font-size: .76rem; }

.cal-layout { display: grid; grid-template-columns: 2.2fr 1fr; gap: 18px; align-items: start; }
.cal-main { margin-bottom: 0; }
.cal-side { display: flex; flex-direction: column; gap: 18px; }
.cal-side .card { margin-bottom: 0; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 4px 0; }
.cal-cell { min-height: 78px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: var(--card); overflow: hidden; }
.cal-cell.empty { background: transparent; border: 0; }
.cal-cell.today { border-color: var(--brass); box-shadow: 0 0 0 1px var(--brass) inset; }
.cal-daynum { font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.cal-cell.today .cal-daynum { color: var(--brass); }
.cal-ev { display: block; font-size: .72rem; line-height: 1.25; padding: 2px 5px; margin-bottom: 2px; border-radius: 5px;
  background: var(--vest); color: #fff; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.cal-ev:hover { background: var(--plum); }
@media (max-width: 860px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-cell { min-height: 56px; }
  .cal-ev { font-size: .64rem; }
}

/* ---------- v3.10: calendar redesign + payee autocomplete ---------- */
.ev-list-wide li { padding: 12px 0; }
.ev-list-wide .ev-body { gap: 3px; }
.ev-desc { font-size: .85rem; color: var(--ink); opacity: .8; margin-top: 2px; }
.cal-main { margin-bottom: 22px; }

/* ---------- two-step delete control (v3.11) ---------- */
.confirm-del { display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; }
.confirm-del .cd-panel { display: none; align-items: center; gap: 8px; flex-wrap: wrap; }
.confirm-del .cd-msg { font-size: .8rem; font-weight: 600; color: var(--clay); }
.confirm-del.open .cd-panel { display: inline-flex; }
.confirm-del.open .cd-start { display: none; }

/* ---------- inline row edit toggle (v3.11) ---------- */
tr.row-edit .re { display: none; }
tr.row-edit .re-input { display: none; }
tr.row-edit.editing .rv { display: none; }
tr.row-edit.editing .re { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
tr.row-edit.editing .re-input { display: inline-block; }
tr.row-edit.editing { background: var(--brass-soft); }
.re-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- dashboard FD maturity panel (v3.11) ---------- */
.fd-list { list-style: none; margin: 6px 0 0; padding: 0; }
.fd-list li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.fd-list li:last-child { border-bottom: 0; }
.fd-when { min-width: 92px; font-weight: 700; }
.fd-when.soon { color: var(--clay); }
.fd-when.due { color: #fff; background: var(--clay); border-radius: 6px; padding: 2px 8px; }
.fd-body { flex: 1; }
.fd-amt { font-weight: 700; white-space: nowrap; }

/* ---------- expense → asset fields (v3.12) ---------- */
.asset-fields { margin-top: 14px; padding: 14px 16px; border: 1px dashed var(--brass); border-radius: 10px; background: var(--brass-soft); }
.asset-fields h3 { color: var(--brass); }
.badge.FromExpense { background: #e8eef7; color: #2f5597; }

/* ---------- reports & statements hub (v3.12) ---------- */
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.hub-tile { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; transition: border-color .15s, background .15s; }
.hub-tile:hover { border-color: var(--brass); background: var(--brass-soft); }
.hub-tile strong { display: block; color: var(--ink); margin-bottom: 3px; }
.hub-tile .muted { font-size: .82rem; line-height: 1.35; }

/* dashboard budget progress bars */
.bgt-row{margin:12px 0}
.bgt-head{display:flex;justify-content:space-between;align-items:baseline;font-size:.88rem;margin-bottom:5px}
.bgt-track{position:relative;height:14px;background:var(--line);border-radius:7px}
.bgt-fill{position:absolute;left:0;top:0;height:100%;border-radius:7px;transition:width .3s ease}
.bgt-pace{position:absolute;top:-3px;bottom:-3px;width:2px;background:var(--ink);opacity:.45}

/* ---------- v3.21: polish pass ---------- */
tbody tr { transition: background .12s ease; }
td, th { padding: 11px 14px; }                 /* a touch more breathing room */
.card.accent { border-left: 3px solid var(--brass); }   /* highlighted cards (replaces ad-hoc inline borders) */
.stat .num { letter-spacing: -.01em; }
.page-head p { color: var(--muted); margin: .15rem 0 0; }
/* gentle lift on interactive hub cards if present */
.hub-grid a { transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease; }
.hub-grid a:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(42,34,48,.10); }

/* labelled fields inside inline row editors (e.g. asset edit) */
.efield { display: block; margin-top: 7px; }
.efield > span.lbl { display: block; font-size: .7rem; font-weight: 700; color: var(--muted); margin-bottom: 2px; }

/* key/value summary table (view pages) */
table.kv td { padding: 9px 14px; vertical-align: top; }
table.kv tr td:first-child { color: var(--muted); width: 38%; max-width: 260px; }
table.kv tr.kv-strong td { font-weight: 700; }
table.kv tr.kv-strong td:first-child { color: var(--ink); }

/* dashboard: section separator + "this month" columns */
.dash-sep { margin: 26px 0 8px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.month-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 20px; }
.month-cols h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; }
.mc-list { list-style: none; padding: 0; margin: 0; }
.mc-list li { padding: 4px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.mc-list li:last-child { border-bottom: 0; }
.mc-day { display: inline-block; min-width: 3.8em; font-weight: 700; color: var(--vest); }

/* compact metric cards (dashboard top row) */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.metric { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.metric-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.metric-lbl { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.metric-val { font-family: "Fraunces", serif; font-size: 1.5rem; font-weight: 700; line-height: 1.1; margin-top: 5px; }
.metric-ico { flex: none; width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.05); }
.metric-ico svg { width: 18px; height: 18px; }
.metric-delta { font-size: .74rem; font-weight: 600; margin-top: 4px; }
.metric-delta.up { color: var(--moss); } .metric-delta.down { color: var(--clay); } .metric-delta.flat { color: var(--muted); }
.metric .spark { margin-top: 8px; display: block; width: 100%; height: 28px; }
.dash-row { gap: 14px; }
.stat-grid { margin-bottom: 16px; }

/* small icon beside card headings */
.h-ico { display: inline-flex; vertical-align: -3px; margin-right: 7px; color: var(--brass); }
.h-ico svg { width: 17px; height: 17px; }

/* dashboard top: small stat cards + larger donut charts in one row */
.dash-top { display: grid; grid-template-columns: 0.7fr 0.7fr 1.3fr 1.3fr; gap: 14px; margin-bottom: 16px; align-items: stretch; }
.dash-top .metric { display: flex; flex-direction: column; justify-content: center; }
.dash-top .donut-card { padding: 14px 18px; margin: 0; }
.dash-top .donut-card h2 { margin: 0 0 8px; font-size: 1.02rem; }
.donut-mini .donut-wrap { gap: 18px; align-items: center; }
.donut-mini .donut { width: 124px; height: 124px; }
.donut-mini .donut-legend { min-width: 0; flex: 1; }
.donut-mini .donut-legend li { font-size: .82rem; padding: 4px 0; gap: 8px; }
@media (max-width: 920px) {
  .dash-top { grid-template-columns: 1fr 1fr; }
  .dash-top .donut-card { grid-column: 1 / -1; }
}

/* three-up row (This month / events / updates) */
.dash-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-row-3 .month-cols { grid-template-columns: 1fr; gap: 10px; }
@media (max-width: 1000px) { .dash-row-3 { grid-template-columns: 1fr; } }

/* v4.0 — compact audit grid (many monthly columns) */
.audit-grid { font-size: .82rem; }
.audit-grid th, .audit-grid td { padding: 4px 6px; white-space: nowrap; }
