/* HOA Hub: big, friendly, easy to read. Colors live in the tokens below. */
:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --ink: #1d2433;
  --muted: #5d6b82;
  --line: #e2e8f0;
  --brand: #3b6cf6;
  --brand-ink: #ffffff;
  --brand-soft: #e8efff;
  --green: #1f9d55;  --green-soft: #e3f7ea;
  --red: #d64545;    --red-soft: #fde8e8;
  --blue: #2f6fde;   --blue-soft: #e6effd;
  --gray-soft: #eef1f5;
  --yellow-soft: #fff6d9;
  --shadow: 0 2px 10px rgba(20, 30, 60, .07);
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161f; --card: #1b2130; --ink: #eef2f8; --muted: #9aa7bd; --line: #2b3346;
    --brand: #6d93ff; --brand-ink: #0d1220; --brand-soft: #24305a;
    --green: #4cd486; --green-soft: #173827; --red: #ff7a7a; --red-soft: #45202a;
    --blue: #79a6ff; --blue-soft: #1f2d4f; --gray-soft: #262d3d; --yellow-soft: #3a3320;
    --shadow: 0 2px 10px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.8rem; margin: 0 0 .25rem; }
h2 { font-size: 1.2rem; margin: 0 0 .75rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.inline { display: inline; margin: 0; }

/* ---------- top bar */
.demo-bar { background: var(--yellow-soft); text-align: center; padding: .45rem 1rem; font-size: .95rem; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .6rem 1.5rem; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.15rem; color: var(--ink); }
.brand-icon { font-size: 1.6rem; }
.brand-wrap { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
/* who is signed in, colored by role so it's easy to tell at a glance */
.who { padding: .25rem .75rem; border-radius: 999px; font-size: .88rem; white-space: nowrap; border: 1px solid transparent; }
.who:hover { text-decoration: none; filter: brightness(.97); }
.who-admin { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.who-board { background: #efe7fb; color: #6a3fb8; border-color: #a98be0; }
.who-owner { background: var(--green-soft); color: var(--green); border-color: var(--green); }
@media (prefers-color-scheme: dark) { .who-board { background: #2e2448; color: #b79cff; border-color: #6a4fa8; } }
.nav { display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; }
.nav a, .nav-btn {
  display: flex; align-items: center; gap: .35rem; padding: .5rem .85rem; border-radius: 999px;
  color: var(--ink); font-weight: 600; font-size: .98rem; background: none; border: 0; cursor: pointer; font-family: inherit;
}
.nav a:hover, .nav-btn:hover { background: var(--brand-soft); text-decoration: none; }
.nav a.on { background: var(--brand); color: var(--brand-ink); }

/* ---------- page */
.page { max-width: 1150px; margin: 0 auto; padding: 1.5rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.back { font-weight: 600; font-size: .95rem; }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.3rem 1.4rem; margin-bottom: 1.2rem; border: 1px solid var(--line);
}
.card-highlight { border: 2px solid var(--brand); }
.form-card { max-width: 760px; }
.empty { color: var(--muted); padding: .5rem 0; margin: 0; }
.notes { white-space: pre-wrap; }

/* ---------- flash messages */
.flash { padding: .8rem 1.1rem; border-radius: 14px; margin-bottom: 1rem; font-weight: 600; }
.flash-good { background: var(--green-soft); color: var(--green); }
.flash-warn { background: var(--red-soft); color: var(--red); }

/* ---------- hello + score */
.hello { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.score { display: flex; align-items: center; gap: .9rem; background: var(--card); padding: .7rem 1.1rem; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.score-ring {
  --pct: 0; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--green) calc(var(--pct) * 1%), var(--gray-soft) 0);
}
.score-ring span { background: var(--card); width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .95rem; }

/* ---------- tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.tile {
  display: block; border-radius: var(--radius); padding: 1.1rem 1.2rem; color: var(--ink);
  background: var(--card); box-shadow: var(--shadow); border: 1px solid var(--line); border-top: 6px solid var(--line);
  transition: transform .12s ease, box-shadow .12s ease;
}
a.tile:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(20, 30, 60, .12); text-decoration: none; }
.tile-icon { font-size: 2rem; line-height: 1; margin-bottom: .4rem; }
.tile-label { font-weight: 600; color: var(--muted); }
.tile-value { font-size: 1.9rem; font-weight: 800; margin: .15rem 0; }
.tile-value.small-value { font-size: 1.25rem; }
.tile-help { font-size: .9rem; color: var(--muted); }
.tile-green { border-top-color: var(--green); }
.tile-green .tile-value { color: var(--green); }
.tile-red { border-top-color: var(--red); background: linear-gradient(var(--red-soft), var(--card) 60%); }
.tile-red .tile-value { color: var(--red); }
.tile-blue { border-top-color: var(--blue); }
.tile-soon { opacity: .6; border-style: dashed; border-top-style: solid; }
.tile-soon .tile-value { font-size: 1.2rem; color: var(--muted); }

/* ---------- columns + lists */
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.2rem; }
.columns .card { margin: 0; }
.list, .todo { list-style: none; padding: 0; margin: 0; }
.list li, .list li > a { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.list li { padding: .55rem 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list li > a { width: 100%; color: var(--ink); }
.list li > a:hover { text-decoration: none; color: var(--brand); }
.todo li a {
  display: flex; justify-content: space-between; padding: .7rem .9rem; margin-bottom: .5rem;
  background: var(--yellow-soft); border-radius: 12px; color: var(--ink); font-weight: 600;
}
.todo li a:hover { text-decoration: none; filter: brightness(.97); }
.arrow { color: var(--brand); }

/* ---------- pills + chips */
.pill { display: inline-block; padding: .15rem .65rem; border-radius: 999px; font-weight: 700; font-size: .88rem; white-space: nowrap; }
.pill-red { background: var(--red-soft); color: var(--red); }
.pill-green { background: var(--green-soft); color: var(--green); }
.pill-blue { background: var(--blue-soft); color: var(--blue); }
.pill-gray { background: var(--gray-soft); color: var(--muted); }
.chips { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.chip { padding: .4rem .9rem; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--ink); font-weight: 600; font-size: .95rem; }
.chip:hover { text-decoration: none; border-color: var(--brand); }
.chip.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* ---------- tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .65rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.num { text-align: right; white-space: nowrap; }
.click-row:hover { background: var(--brand-soft); }
tr.faded td { opacity: .5; }

/* ---------- forms */
label { display: block; font-weight: 600; margin-bottom: .9rem; }
label small { font-weight: 400; color: var(--muted); }
input, select, textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .7rem .85rem; font: inherit; color: var(--ink);
  background: var(--bg); border: 2px solid var(--line); border-radius: 12px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); background: var(--card); }
input:disabled { opacity: .7; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 1rem; }
.actions { display: flex; gap: .75rem; flex-wrap: wrap; }
.search { display: flex; gap: .6rem; margin-bottom: .8rem; }
.search input { margin: 0; }
.kind-pick { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.kind { margin: 0; }
.kind input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kind span {
  display: inline-block; padding: .65rem 1.1rem; border-radius: 14px; border: 2px solid var(--line);
  background: var(--bg); cursor: pointer; font-weight: 700;
}
.kind input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.kind input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }
.copy-row { display: flex; gap: .6rem; }
.copy-row input { margin: 0; }

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .7rem 1.2rem; border-radius: 14px; border: 0; cursor: pointer; font: inherit; font-weight: 700;
  background: var(--brand); color: var(--brand-ink); white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn-big { width: 100%; padding: .9rem; font-size: 1.1rem; }
.btn-soft { background: var(--brand-soft); color: var(--brand); }
.btn-small { padding: .35rem .8rem; font-size: .9rem; border-radius: 10px; }

/* ---------- sign-in cards */
.auth-card {
  max-width: 440px; margin: 2.5rem auto; background: var(--card); border-radius: 24px; box-shadow: var(--shadow);
  padding: 2rem; text-align: center; border: 1px solid var(--line);
}
.auth-card.wide { max-width: 520px; }
.auth-card form { text-align: left; margin-top: 1.2rem; }
.big-emoji { font-size: 3.2rem; }
.demo-logins { margin-top: 1.5rem; padding-top: 1rem; border-top: 2px dashed var(--line); }
.demo-logins form { margin: .5rem 0 0; }
.demo-logins .btn { width: 100%; }

/* ---------- dues pages */
.big-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.action-card {
  display: flex; flex-direction: column; gap: .3rem; padding: 1.1rem 1.2rem; border-radius: var(--radius);
  background: var(--brand-soft); color: var(--ink); border: 2px solid transparent; transition: transform .12s ease;
}
.action-card:hover { border-color: var(--brand); transform: translateY(-2px); text-decoration: none; }
.action-card strong { font-size: 1.1rem; color: var(--brand); }
.ac-icon { font-size: 2rem; line-height: 1; }
.switch { display: flex; align-items: center; gap: .6rem; padding: .7rem .9rem; border-radius: 12px; background: var(--bg); cursor: pointer; }
.switch input { width: 1.4rem; height: 1.4rem; margin: 0; flex: none; accent-color: var(--brand); }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; margin: 0; padding: .35rem 0; }
.check input { width: 1.2rem; height: 1.2rem; margin: 0; flex: none; }
td input[type=checkbox], th input[type=checkbox] { width: 1.2rem; height: 1.2rem; margin: 0; }
.hint { background: var(--yellow-soft); padding: .6rem .9rem; border-radius: 12px; font-size: .93rem; margin: 0 0 1rem; }
.preview { background: var(--blue-soft); padding: .8rem 1rem; border-radius: 12px; margin-bottom: 1rem; }
.facts { margin: 0; padding-left: 1.2rem; }
.pick-list { max-height: 320px; overflow-y: auto; border: 2px solid var(--line); border-radius: 12px; padding: .5rem .9rem; margin-bottom: 1rem; }
.age-b30 { color: #b7791f; font-weight: 700; }
.age-b60, .age-b90 { color: var(--red); font-weight: 700; }
tfoot th { color: var(--ink); font-size: .95rem; text-transform: none; border-top: 2px solid var(--line); }
table.batch input { margin: 0; min-width: 110px; }
input.bad { border-color: var(--red); background: var(--red-soft); }
.field-error { display: block; color: var(--red); font-weight: 600; font-size: .88rem; margin: .2rem 0 0; }
.running-total { align-self: end; margin-bottom: .9rem; padding: .7rem .9rem; border-radius: 12px; background: var(--green-soft); }
.fill-btn { border: 0; cursor: pointer; font-family: inherit; }
.sticky-actions { position: sticky; bottom: 0; background: var(--card); padding: .8rem 0 .2rem; margin-top: .5rem; }
.btn-big-inline { padding: .85rem 1.5rem; font-size: 1.05rem; }

/* ---------- notes, neighbors, welcome guide */
.field-title { font-weight: 600; margin: 0 0 .4rem; }
.small-pick .kind span { padding: .45rem .8rem; font-size: .93rem; border-radius: 12px; }
.note-form textarea { margin-bottom: .8rem; }
.notes-list { list-style: none; padding: 0; margin: 1rem 0 0; }
.notes-list li { border: 1px solid var(--line); border-radius: 14px; padding: .8rem 1rem; margin-bottom: .7rem; }
.note-top { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.notes-list .notes { margin: .5rem 0 .2rem; }
.note-filter { margin-top: 1rem; }
.note-filter .chip { cursor: pointer; font-family: inherit; }
.note-edit summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: .92rem; }
.note-edit form { margin-top: .6rem; }
.note-edit select, .note-edit input, .note-edit textarea { margin-bottom: .5rem; }
.btn-danger { background: var(--red-soft); color: var(--red); }
.dir-box { background: var(--bg); border-radius: 14px; padding: .8rem; margin-bottom: 1rem; }
.dir-box .switch { background: var(--card); }
.dir-more { margin-top: .8rem; }
.dir-more .check { margin-bottom: .2rem; }
.dir-more input[name=dir_phone] { margin-bottom: .9rem; }
.neighbor-grid, .welcome-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.neighbor, .welcome-item {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.neighbor { display: flex; gap: .9rem; align-items: flex-start; }
.neighbor h3, .welcome-item h3 { margin: 0 0 .2rem; }
.neighbor-avatar {
  flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: 1.3rem;
}
.neighbor-note { margin: .4rem 0; font-style: italic; }
.neighbor-links { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.welcome-item { box-shadow: none; background: var(--bg); }
.welcome-item .notes { margin: .3rem 0; color: var(--muted); }
.welcome-hero {
  display: flex; gap: 1.2rem; align-items: center; padding: 1.5rem; margin-bottom: 1.2rem; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand-soft), var(--green-soft));
}
.welcome-hero h1 { margin-bottom: .3rem; }
.welcome-hero p { margin: 0; }
.welcome-card { background: linear-gradient(135deg, var(--brand-soft), var(--green-soft)); }
.admin-box summary { cursor: pointer; padding: .2rem 0; }
.admin-box[open] summary { margin-bottom: 1rem; }
.section-jump { margin-bottom: 1rem; }

/* ---------- approvals */
.badge { display: inline-grid; place-items: center; min-width: 1.4rem; height: 1.4rem; padding: 0 .35rem; border-radius: 999px; background: var(--red); color: #fff; font-size: .8rem; font-weight: 800; }
.nav a.on .badge { background: #fff; color: var(--brand); }
.request { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.request:last-child { border-bottom: 0; }
.request h3 { margin: 0 0 .2rem; }
.request-info { flex: 1 1 320px; }
.request-note { margin: .4rem 0; font-style: italic; }
.request-actions { flex: 0 1 320px; display: flex; flex-direction: column; gap: .5rem; }
.request-actions label { margin-bottom: .5rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
details.card > summary { cursor: pointer; }
details.card[open] > summary { margin-bottom: .8rem; }

/* ---------- calendar */
.cat-hoa { --cat: #2f6fde; --cat-soft: #e6effd; }
.cat-meeting { --cat: #7c4dcc; --cat-soft: #efe7fb; }
.cat-school_early { --cat: #c76b0a; --cat-soft: #fff0dc; }
.cat-school_off { --cat: #9a7d00; --cat-soft: #fff6c7; }
.cat-holiday { --cat: #d64545; --cat-soft: #fde8e8; }
.cat-other { --cat: #5d6b82; --cat-soft: #eef1f5; }
@media (prefers-color-scheme: dark) {
  .cat-hoa { --cat: #79a6ff; --cat-soft: #1f2d4f; }
  .cat-meeting { --cat: #b79cff; --cat-soft: #2e2448; }
  .cat-school_early { --cat: #ffad5c; --cat-soft: #3d2a14; }
  .cat-school_off { --cat: #f0d24a; --cat-soft: #3a3320; }
  .cat-holiday { --cat: #ff7a7a; --cat-soft: #45202a; }
  .cat-other { --cat: #9aa7bd; --cat-soft: #262d3d; }
}
.coming-up {
  display: flex; gap: .5rem; align-items: center; overflow-x: auto; padding: .5rem 1.5rem;
  background: var(--card); border-bottom: 1px solid var(--line); white-space: nowrap; font-size: .92rem;
  scrollbar-width: thin;
}
.coming-up::-webkit-scrollbar { height: 4px; }
.coming-up::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.cu-title { font-weight: 800; color: var(--ink); margin-right: .2rem; }
.cu-item { display: inline-flex; gap: .35rem; align-items: center; padding: .25rem .7rem; border-radius: 999px; background: var(--cat-soft); color: var(--ink); border-left: 4px solid var(--cat); }
.cu-item:hover { text-decoration: none; filter: brightness(.97); }
.cu-when { color: var(--cat); }
.cu-date { color: var(--muted); font-weight: 600; }
.cal-head { display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; }
.cal-head h2 { margin: 0; flex: 1; text-align: center; font-size: 1.4rem; }
.cal-legend { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.cal-chip { padding: .2rem .6rem; border-radius: 999px; font-size: .85rem; font-weight: 600; background: var(--cat-soft); color: var(--cat); }
.cal-card { padding: .6rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { text-align: center; font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: .3rem 0; }
.cal-day { min-height: 92px; border-radius: 10px; background: var(--bg); padding: .3rem; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.other-month { opacity: .45; }
.cal-day.today { outline: 3px solid var(--brand); background: var(--brand-soft); }
.cal-num { font-weight: 700; font-size: .9rem; }
.cal-num a { color: var(--ink); }
.cal-ev {
  display: block; font-size: .75rem; line-height: 1.25; padding: .15rem .3rem; border-radius: 6px;
  background: var(--cat-soft); color: var(--ink); border-left: 3px solid var(--cat);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-ev:hover { text-decoration: none; filter: brightness(.96); }
.event-list { list-style: none; padding: 0; margin: 0; }
.event { display: flex; gap: 1rem; padding: .9rem 0; border-bottom: 1px solid var(--line); scroll-margin-top: 140px; }
.event:last-child { border-bottom: 0; }
.event:target { background: var(--cat-soft); border-radius: 12px; padding-left: .6rem; }
.event.past { opacity: .55; }
.event-date {
  flex: none; width: 64px; border-radius: 12px; text-align: center; padding: .35rem 0;
  background: var(--cat-soft); color: var(--cat); display: flex; flex-direction: column; line-height: 1.1;
}
.ev-month, .ev-dow { font-size: .75rem; font-weight: 700; text-transform: uppercase; }
.ev-day { font-size: 1.6rem; font-weight: 800; }
.event-body { flex: 1; min-width: 0; }
.event-body h3 { margin: 0 0 .15rem; }
.event-body .notes { margin: .3rem 0; }

/* ---------- bills, money, budget, bank */
.pill-yellow { background: var(--yellow-soft); color: #9a6b00; }
.status-needs_approval { background: var(--yellow-soft); color: #9a6b00; }
.status-approved { background: var(--blue-soft); color: var(--blue); }
.status-paid { background: var(--green-soft); color: var(--green); }
.status-void { background: var(--gray-soft); color: var(--muted); text-decoration: line-through; }
.late { color: var(--red); font-weight: 700; }
.steps { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.step { flex: 1 1 140px; padding: .6rem .9rem; border-radius: 12px; background: var(--card); border: 2px solid var(--line); font-weight: 700; color: var(--muted); }
.step.done { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.step.done-void { border-color: var(--line); background: var(--gray-soft); }
.facts-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .8rem 1.5rem; }
.facts-grid li { display: flex; flex-direction: column; }
.facts-grid li > span:first-child { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.pay-box-form { background: var(--bg); border-radius: 14px; padding: .9rem; margin-bottom: 1rem; }
.list li > .li-wrap { display: flex; justify-content: space-between; align-items: center; gap: .75rem; width: 100%; }
.budget-table input { margin: 0; max-width: 130px; margin-left: auto; text-align: right; padding: .45rem .6rem; }
.bar { position: relative; height: 12px; border-radius: 999px; background: var(--gray-soft); min-width: 120px; overflow: visible; }
.bar-fill { height: 100%; border-radius: 999px; }
.bar-green { background: var(--green); }
.bar-yellow { background: #e0a100; }
.bar-red { background: var(--red); }
.bar-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .5; }
.bank-line { padding: .9rem 0; border-bottom: 1px solid var(--line); scroll-margin-top: 140px; }
.bank-line:last-child { border-bottom: 0; }
.bank-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.bank-amt { font-size: 1.05rem; }
.bank-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-start; margin-top: .6rem; }
.bank-actions details { flex: 1 1 260px; }
.bank-actions select, .bank-actions input { margin-bottom: .4rem; }

/* ---------- reports */
.nav-sep { width: 1px; height: 1.6rem; background: var(--line); margin: 0 .25rem; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.2rem; }
.report-grid .card { margin: 0; display: flex; flex-direction: column; }
.report-card h2 { margin-top: .4rem; }
.report-card p { flex: 1; }
.highlight-card { border: 2px solid var(--brand); }
.report-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.report-form input, .report-form select { margin: 0; flex: 1 1 140px; }
.inline-form { display: inline-flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.inline-form input { margin: 0; width: auto; padding: .45rem .6rem; }
.chip-form { margin-left: .4rem; }
.report { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem 1.7rem; }
.report-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-bottom: 3px solid var(--brand); padding-bottom: .6rem; margin-bottom: 1.2rem; }
.report-head strong { font-size: 1.3rem; }
.report-head span { color: var(--muted); }
.report-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.report-table { width: 100%; border-collapse: collapse; margin-bottom: .5rem; }
.report-table td { padding: .45rem .3rem; border-bottom: 1px solid var(--line); }
.report-table tr.total td { font-weight: 800; border-top: 2px solid var(--ink); border-bottom: 0; }
.report-table tr.sub td { font-size: .8rem; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.report-table.narrow { max-width: 480px; }
.report-section { margin-top: 1.6rem; break-inside: avoid; }
.report-section h2 { font-size: 1.15rem; border-bottom: 1px solid var(--line); padding-bottom: .3rem; }
.net-box { display: flex; flex-direction: column; align-items: center; gap: .1rem; margin: 1.2rem 0 .6rem; padding: 1rem; border-radius: 14px; background: var(--green-soft); }
.net-box.neg { background: var(--red-soft); }
.net-box strong { font-size: 1.8rem; }
.net-box span, .net-box small { color: var(--muted); }
.packet-list { padding-left: 1.2rem; margin: 0; }
.packet-list li { margin-bottom: .3rem; }

/* ---------- stage 5: menu, news, violations, requests, documents */
.nav-more { position: relative; }
.nav-more summary {
  display: flex; align-items: center; gap: .35rem; padding: .5rem .85rem; border-radius: 999px; cursor: pointer;
  font-weight: 600; font-size: .98rem; list-style: none;
}
.nav-more summary::-webkit-details-marker { display: none; }
.nav-more summary:hover { background: var(--brand-soft); }
.nav-more summary.on { background: var(--brand); color: var(--brand-ink); }
.nav-menu {
  position: absolute; left: 0; top: calc(100% + .4rem); min-width: 220px; z-index: 20; padding: .4rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 30px rgba(20, 30, 60, .18);
  display: flex; flex-direction: column; gap: .15rem;
}
.nav-menu a { border-radius: 12px; }
.nav-menu.flip { left: auto; right: 0; }
.pinned-banner {
  display: flex; gap: .5rem; align-items: center; justify-content: center; flex-wrap: wrap; padding: .55rem 1.5rem;
  background: var(--yellow-soft); color: var(--ink); border-bottom: 1px solid var(--line); text-align: center;
}
.pinned-banner:hover { text-decoration: none; filter: brightness(.98); }
.news-item { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.news-item:last-child { border-bottom: 0; }
.news-item h3 { margin: 0 0 .2rem; }
.news-item .notes { margin: .5rem 0 0; }
.news-pinned { border: 2px solid #e0a100; }
.news-body { font-size: 1.05rem; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.v-open { background: var(--red-soft); color: var(--red); }
.v-fixed, .r-approved, .r-done, .r-conditions { background: var(--green-soft); color: var(--green); }
.v-closed, .r-withdrawn { background: var(--gray-soft); color: var(--muted); }
.r-submitted, .r-reviewing, .r-in_progress { background: var(--yellow-soft); color: #9a6b00; }
.r-denied { background: var(--red-soft); color: var(--red); }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 3px solid var(--line); padding-left: 1.1rem; }
.timeline li { position: relative; margin-bottom: 1rem; }
.timeline li::before {
  content: ""; position: absolute; left: calc(-1.1rem - 8px); top: .35rem; width: 13px; height: 13px; border-radius: 50%;
  background: var(--brand); border: 3px solid var(--card);
}
.timeline li.private::before { background: var(--muted); }
.timeline li.from-owner::before { background: var(--green); }
.timeline .notes { margin: .25rem 0 0; background: var(--bg); border-radius: 12px; padding: .55rem .8rem; }
.timeline li.private .notes { border: 2px dashed var(--line); }
.tl-top { display: flex; gap: .5rem; flex-wrap: wrap; align-items: baseline; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; margin-top: .6rem; }
.file-tile {
  display: flex; flex-direction: column; gap: .3rem; padding: .5rem; border-radius: 14px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font-size: .85rem; overflow: hidden;
}
.file-tile:hover { border-color: var(--brand); text-decoration: none; }
.file-tile img { width: 100%; height: 110px; object-fit: cover; border-radius: 10px; background: var(--card); }
.file-tile .big-icon { font-size: 2.6rem; text-align: center; padding: 1rem 0; }
.file-tile span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
input[type=file] { padding: .55rem; background: var(--card); border-style: dashed; cursor: pointer; }
.doc-list { list-style: none; padding: 0; margin: 0; }
.doc { display: flex; gap: .9rem; align-items: center; padding: .7rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.doc:last-child { border-bottom: 0; }
.doc-icon { font-size: 2rem; flex: none; }
.doc-info { flex: 1 1 260px; min-width: 0; }
.doc-info strong { font-size: 1.05rem; }
.doc-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.doc-edit { flex-basis: 100%; }
.folder-head { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.kind-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.kind-card { margin: 0; }
.kind-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kind-card span {
  display: flex; flex-direction: column; gap: .2rem; height: 100%; padding: 1rem; border-radius: 16px;
  border: 2px solid var(--line); background: var(--bg); cursor: pointer; font-weight: 400;
}
.kind-card span strong { font-size: 1.1rem; }
.kind-card .kc-icon { font-size: 2rem; }
.kind-card input:checked + span { border-color: var(--brand); background: var(--brand-soft); }
.kind-card input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }
.addr-box { background: var(--bg); border-radius: 12px; padding: .7rem; font-size: .85rem; }
.decision { padding: .9rem 1rem; border-radius: 14px; margin-bottom: 1rem; }
.letter-photos { display: flex; gap: .8rem; margin-top: 1rem; }
.letter-photos img { max-width: 48%; max-height: 220px; border-radius: 6px; border: 1px solid #e2e8f0; }

.alert-card {
  display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; margin-bottom: 1.2rem; border-radius: var(--radius);
  background: var(--yellow-soft); border: 2px solid #e0a100; color: var(--ink);
}
.alert-card > span:nth-child(2) { flex: 1; }
.alert-card:hover { text-decoration: none; filter: brightness(.98); }
.confirm-box {
  border: 0; border-radius: var(--radius); padding: 1.4rem 1.5rem; max-width: 420px; width: calc(100% - 2rem);
  background: var(--card); color: var(--ink); box-shadow: 0 20px 50px rgba(20, 30, 60, .3);
}
.confirm-box::backdrop { background: rgba(20, 30, 60, .45); }
.confirm-box p { font-size: 1.08rem; font-weight: 600; margin: 0 0 1.1rem; }

/* ---------- letters and statements (screen) */
.letter {
  background: #fff; color: #1d2433; max-width: 760px; margin: 0 auto 1.5rem; padding: 2.2rem 2.4rem;
  border-radius: 6px; box-shadow: var(--shadow); border: 1px solid var(--line); font-size: 1rem;
}
.letter-head { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 3px solid #3b6cf6; padding-bottom: .6rem; margin-bottom: 1.4rem; }
.letter-head strong { font-size: 1.3rem; }
.letter-to { margin-bottom: 1.4rem; }
.letter table { margin: 1rem 0; }
.letter th, .letter td { border-bottom: 1px solid #e2e8f0; color: #1d2433; }
.letter .pill-red { background: #fde8e8; color: #c53030; }
.letter .pill-green { background: #e3f7ea; color: #1f7a45; }
.pay-box { background: #f1f5ff; border-left: 4px solid #3b6cf6; padding: .7rem 1rem; border-radius: 6px; }
.statement-top { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.balance-box { display: flex; flex-direction: column; align-items: flex-end; padding: .8rem 1.1rem; border-radius: 10px; background: #e3f7ea; }
.balance-box.owes { background: #fde8e8; }
.balance-box strong { font-size: 1.8rem; }

@media print {
  .topbar, .demo-bar, .coming-up, .pinned-banner, .no-print, .flash, .letter form { display: none !important; }
  body { background: #fff; }
  .page { padding: 0; max-width: none; }
  .letter { box-shadow: none; border: 0; margin: 0; padding: 0; max-width: none; page-break-after: always; }
  .letter:last-child { page-break-after: auto; }
  .report { box-shadow: none; border: 0; padding: 0; background: #fff; color: #1d2433; }
  .report .muted, .report-head span { color: #5d6b82; }
  .report-table td { border-color: #ccc; }
  .net-box { border: 1px solid #ccc; background: #fff; }
  .packet .report-section h2 { break-after: avoid; }
  .hint { display: none; }
}

/* when the menu wraps onto several rows, let it scroll away instead of covering the page */
@media (max-width: 1250px) {
  .topbar { position: static; }
}

/* ---------- the ☰ Menu button (phones and small tablets) */
.menu-btn { display: none; }
@media (max-width: 760px) {
  /* the folded-up bar is small, so it can stay at the top again */
  .topbar { position: sticky; top: 0; padding: .5rem 1rem; gap: .5rem; }
  .brand-wrap { flex: 1; min-width: 0; gap: .4rem; }
  .brand { font-size: 1.02rem; min-width: 0; }
  .brand span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .who { font-size: .78rem; padding: .15rem .55rem; }
  .menu-btn {
    display: inline-flex; align-items: center; gap: .35rem; padding: .55rem .9rem; border-radius: 12px; border: 0;
    background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 700; cursor: pointer; flex: none;
  }
  .menu-icon { font-size: 1.15rem; line-height: 1; }
  .topbar.open .menu-icon { transform: rotate(90deg); }
  .nav { display: none; width: 100%; }
  .topbar.open .nav {
    display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; padding: .6rem 0 .3rem;
    max-height: calc(100vh - 70px); overflow-y: auto;
  }
  .topbar.open .nav a, .topbar.open .nav-btn, .topbar.open .nav-more summary {
    padding: .7rem .8rem; border-radius: 12px; background: var(--bg); font-size: .98rem;
  }
  .topbar.open .nav a.on, .topbar.open .nav-more summary.on { background: var(--brand); color: var(--brand-ink); }
  .nav-sep { display: none; }
  .nav .inline, .nav-more { grid-column: 1 / -1; }
  .nav-more summary { display: none; }
  .nav .inline .nav-btn { width: 100%; justify-content: center; }
  .nav-more .nav-menu {
    position: static; display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; min-width: 0;
    box-shadow: none; border: 0; padding: .35rem 0 0; background: none;
  }
}

/* ---------- tables become cards on phones */
@media (max-width: 640px) {
  .table-wrap { overflow: visible; }
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tfoot, table.stack tr { display: block; width: 100%; }
  table.stack tr {
    border: 1px solid var(--line); border-radius: 14px; padding: .55rem .85rem; margin-bottom: .7rem; background: var(--card);
  }
  table.stack tr.click-row:hover { background: var(--card); }
  table.stack td, table.stack tfoot th {
    display: block; border: 0; padding: .3rem 0; text-align: right; text-transform: none; letter-spacing: 0;
    overflow: hidden;   /* keeps the floated label inside the row */
  }
  table.stack td::before, table.stack tfoot th::before {
    content: attr(data-label); float: left; margin-right: 1rem; padding-top: .15rem; text-align: left;
    font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted);
  }
  table.stack td form.inline, table.stack td .btn { margin-left: .3rem; }
  table.stack td:not([data-label])::before, table.stack td[data-label=""]::before,
  table.stack tfoot th:not([data-label])::before { content: none; }
  /* the first cell is the card's title */
  table.stack td:first-child { display: block; text-align: left; font-size: 1.04rem; padding-bottom: .4rem;
    margin-bottom: .2rem; border-bottom: 1px solid var(--line); }
  table.stack td:first-child::before { content: none; }
  table.stack td:empty { display: none; }
  table.stack td input:not([type=checkbox]) { max-width: 60%; }
  table.stack tfoot tr { background: var(--brand-soft); }
}

/* ---------- phones */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .page { padding: 1rem; }
  h1 { font-size: 1.45rem; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1 1 auto; }
  /* long button labels wrap instead of pushing the page sideways */
  .btn { white-space: normal; text-align: center; }
  /* reports: tighter columns, and a sideways scroll inside the report only as a last resort */
  .report { overflow-x: auto; }
  .report-table td { padding: .35rem .2rem; font-size: .86rem; }
  .report-table tr.sub td { white-space: normal; font-size: .7rem; }
  /* letters and statements are made for printing; on a phone, squeeze them to fit */
  .letter { padding: 1.2rem 1rem; overflow-x: auto; }
  .letter th, .letter td { font-size: .78rem; padding: .4rem .2rem; }
  .letter th { white-space: normal; }
  .tile-value { font-size: 1.6rem; }
  .search, .copy-row { flex-direction: column; }
  .coming-up { padding: .5rem 1rem; }
  .pinned-banner { padding: .5rem 1rem; }
  .report { padding: 1rem; }
  .cal-day { min-height: 54px; padding: .2rem; }
  .cal-ev { padding: .1rem; text-align: center; border-left-width: 0; border-bottom: 3px solid var(--cat); }
  .cal-ev-text { display: none; }
  .cal-card { padding: .3rem; }
}

/* ---------- control panel */
.control-bar { background: #1f2a37; color: #fff; }
.backup-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 16px 0; }
.backup-codes code { background: #f1f5f9; border-radius: 8px; padding: 10px; text-align: center; font-size: 1.05rem; letter-spacing: .05em; }
.steps-list { text-align: left; padding-left: 20px; }
.steps-list li { margin-bottom: 12px; }
.slug-box { display: flex; align-items: center; gap: 6px; }
.slug-box input { flex: 1; min-width: 0; }
