/* Acorn Valley winter system — calm, ledger-style UI in the school's winter blue. */
:root {
  --bg: #f3f5f9;
  --card: #ffffff;
  --ink: #142033;
  --ink-2: #3b4a60;
  --muted: #6a768a;
  --line: #e3e8ef;
  --line-strong: #cfd7e3;
  --brand: #1d5ba3;
  --brand-dark: #0f2f57;
  --brand-soft: #e8f0fa;
  --ok: #17784a; --ok-soft: #e7f5ee;
  --warn: #9a5b00; --warn-soft: #fff4dd;
  --bad: #b42318; --bad-soft: #fdecea;
  --profit: #17784a; --cash: #1d5ba3; --prepaid: #b26a00;
  --page: 1280px;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 32, 58, .06), 0 4px 14px rgba(16, 32, 58, .05);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 8px 18px;
  padding: 9px max(24px, calc((100% - var(--page)) / 2 + 24px));
  background: linear-gradient(120deg, var(--brand-dark), #17457e 60%, var(--brand));
  color: #fff;
  box-shadow: 0 2px 10px rgba(15, 47, 87, .25);
}
.top a { color: #fff; text-decoration: none; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; font-size: 16px; white-space: nowrap; flex: none; }
.brand::before {
  content: ""; width: 28px; height: 28px; border-radius: 8px; flex: none;
  background: rgba(255, 255, 255, .16) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M12 3v18M4.2 7.5l15.6 9M4.2 16.5l15.6-9M9.5 4.5 12 7l2.5-2.5M9.5 19.5 12 17l2.5 2.5'/%3E%3C/svg%3E") center / 18px no-repeat;
}
.brand small { font-weight: 400; opacity: .8; font-size: 13px; }
/* Both groups on one line when they fit; otherwise the second drops below as a whole. */
.top nav { display: flex; flex-flow: row wrap; gap: 2px; flex: 1 1 0; min-width: 0; }
.top nav .nav-row { display: flex; flex-wrap: wrap; gap: 2px; flex: 0 1 auto; }
.top nav a { padding: 7px 9px; border-radius: 8px; white-space: nowrap; font-size: 14px; opacity: .88; transition: background .15s, opacity .15s; }
.top nav a:hover { background: rgba(255, 255, 255, .12); opacity: 1; text-decoration: none; }
.top nav a.on { background: #fff; color: var(--brand-dark); opacity: 1; font-weight: 600; }
.who { display: flex; gap: 10px; align-items: center; font-size: 13px; opacity: .9; white-space: nowrap; flex: none; }
.who .link { color: #fff; }

/* ---------- page ---------- */
main { max-width: var(--page); margin: 0 auto; padding: 24px 24px 64px; }
h1 { font-size: 24px; font-weight: 700; margin: 4px 0 18px; letter-spacing: -.2px; }
h2 { font-size: 17px; font-weight: 650; margin: 30px 0 12px; display: flex; align-items: center; gap: 4px; }
h3 { font-size: 15px; font-weight: 650; margin: 0 0 12px; color: var(--ink); }
.muted { color: var(--muted); font-size: 13.5px; }
.hint { color: var(--muted); font-size: 13px; margin: 2px 0 0; line-height: 1.55; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card > h3:first-child { padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.grid > .card { margin-bottom: 0; }
.grid + * { margin-top: 16px; }

/* the three ledgers */
.ledgers > .card { border-top: 4px solid var(--brand); }
.ledgers > .card:nth-child(1) { border-top-color: var(--profit); }
.ledgers > .card:nth-child(2) { border-top-color: var(--cash); }
.ledgers > .card:nth-child(3) { border-top-color: var(--prepaid); }
.ledgers > .card:nth-child(1) .big { color: var(--profit); }
.ledgers > .card:nth-child(3) .big { color: var(--prepaid); }

.big { font-size: 30px; font-weight: 700; letter-spacing: -.5px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.big + .hint { margin-bottom: 12px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 7px 14px; margin: 0; font-size: 14px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kv .total { font-weight: 700; color: var(--ink); border-top: 1px solid var(--line); padding-top: 8px; margin-top: 2px; }
dd.bad { color: var(--bad); font-weight: 600; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f7f9fc; color: var(--ink-2); font-weight: 600; font-size: 13px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafcff; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.voided td { color: #9aa4b2; text-decoration: line-through; }
tr.voided td.keep { text-decoration: none; }
.card table th { background: transparent; }

/* ---------- forms ---------- */
form.stack, .stack { display: grid; gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.row > label { flex: 1 1 170px; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); }
input, select, textarea {
  font: inherit; font-size: 14.5px; padding: 9px 11px; min-height: 40px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--ink); width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
label > input, label > select, label > textarea { display: block; margin-top: 5px; }
textarea { min-height: 76px; resize: vertical; }
input::placeholder { color: #a2acba; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29, 91, 163, .18); }
input[type="hidden"] { display: none; }

button, .button {
  font: inherit; font-size: 14px; font-weight: 600; padding: 9px 18px; min-height: 40px; border-radius: 8px;
  border: 1px solid var(--brand); background: var(--brand); color: #fff; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .15s, box-shadow .15s, transform .05s;
}
button:hover, .button:hover { background: #174d8c; text-decoration: none; box-shadow: 0 2px 8px rgba(29, 91, 163, .25); }
button:active, .button:active { transform: translateY(1px); }
button.secondary, .button.secondary { background: #fff; color: var(--brand); border-color: #b9cce5; }
button.secondary:hover, .button.secondary:hover { background: var(--brand-soft); box-shadow: none; }
button.danger { background: var(--bad); border-color: var(--bad); }
button.danger:hover { background: #962018; }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: inherit; font-weight: 400; text-decoration: underline; box-shadow: none; }
.inline { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline input { width: auto; min-width: 220px; }
.inline label { display: flex; align-items: center; gap: 8px; }
.inline label > select { margin-top: 0; width: auto; }

/* ---------- messages ---------- */
.flash, .ok-box, .bad-box, .warnings {
  padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; border-left-width: 4px; font-size: 14px;
}
.flash, .ok-box { background: var(--ok-soft); color: #11603a; border-color: #bfe3cf; border-left-color: var(--ok); }
.flash.error, .bad-box { background: var(--bad-soft); color: #8f1c13; border-color: #f4c7c2; border-left-color: var(--bad); }
.warnings { background: var(--warn-soft); color: #7a4800; border-color: #f2d9a6; border-left-color: #d98a00; padding-left: 34px; }
.warnings li { margin: 3px 0; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.badge.void { background: #eef0f3; color: #6b7280; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }

.tip {
  display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-left: 4px;
  border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 700;
  cursor: help; position: relative; vertical-align: 1px; font-style: normal;
}
.tip:hover::after, .tip:focus::after {
  content: attr(data-tip); position: absolute; left: 50%; top: 150%; transform: translateX(-50%);
  width: max-content; max-width: 280px; white-space: normal; background: var(--ink); color: #fff;
  padding: 9px 11px; border-radius: 8px; font-size: 12.5px; line-height: 1.5; z-index: 40; font-weight: 400; text-align: left;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}

details.void summary, details.more summary { cursor: pointer; color: var(--muted); font-size: 13px; user-select: none; }
details.void summary:hover, details.more summary:hover { color: var(--bad); }
details.void form { display: grid; gap: 8px; margin-top: 8px; max-width: 360px; padding: 12px; background: var(--bad-soft); border-radius: 8px; }
details.more { margin: -6px 0 16px; }

.attendee { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; background: #fff; box-shadow: var(--shadow); }
.attendee > strong:first-child, .attendee .row > strong { font-size: 15px; }
.attendee div { margin-top: 2px; }
.pay-row { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: #fbfcfe; display: grid; gap: 12px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar > label { display: flex; align-items: center; gap: 8px; }
.toolbar > label > input { margin-top: 0; width: auto; }
.spacer { flex: 1; }
ul { padding-left: 20px; }

/* ---------- login / setup ---------- */
.login { max-width: 400px; margin: 48px auto; padding: 28px; }

@media (max-width: 720px) {
  main { padding: 16px 14px 48px; }
  .top { padding: 10px 14px; flex-wrap: wrap; }
  .top nav { order: 3; flex: 1 0 100%; overflow-x: auto; flex-direction: row; flex-wrap: nowrap; margin: 0 -4px; }
  .top nav .nav-row { display: contents; }
  .who { margin-left: auto; }
  h1 { font-size: 21px; }
  .big { font-size: 26px; }
  .card { padding: 16px; }
  .inline input { min-width: 0; }
}

/* ---------- admin nav count ---------- */
.nav-count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 5px; border-radius: 999px; background: #f59e0b; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
pre.mail { white-space: pre-wrap; font: inherit; font-size: 13px; background: #f7f9fc; padding: 10px; border-radius: 8px; max-width: 520px; }
.review-card .review-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; font-size: 15px; }
.return-box { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.return-box input { flex: 1 1 220px; }

/* ---------- coach / student / sales portals (phone first) ---------- */
body.portal { background: #eef2f7; min-height: 100vh; }
html:has(body.portal) { background: #eef2f7; }
.ptop { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: linear-gradient(120deg, var(--brand-dark), #17457e 60%, var(--brand)); color: #fff; }
.ptop .brand { color: #fff; }
.chip { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,.4);
  background: rgba(255,255,255,.1); color: #fff; font-size: 13px; font-weight: 500; text-decoration: none; cursor: pointer; }
.chip:hover { background: rgba(255,255,255,.2); text-decoration: none; box-shadow: none; }
.ptop form { margin: 0; }
.ptabs { position: sticky; top: 52px; z-index: 25; display: flex; gap: 4px; padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; }
.ptabs a { flex: 1 0 auto; text-align: center; padding: 9px 14px; border-radius: 10px; color: var(--ink-2); font-weight: 600; font-size: 14.5px; white-space: nowrap; }
.ptabs a.on { background: var(--brand-soft); color: var(--brand); }
.ptabs a:hover { text-decoration: none; background: #f3f6fb; }
.pmain { max-width: 720px; margin: 0 auto; padding: 18px 16px 120px; }
.pmain h1 { font-size: 22px; }
body.portal input, body.portal select, body.portal textarea { font-size: 16px; min-height: 46px; }
body.portal textarea { min-height: 64px; }
.big-btn { width: 100%; min-height: 50px; font-size: 16.5px; border-radius: 12px; }
.step { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.step-no { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 14px; }
fieldset.pills { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
fieldset.pills legend { font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; padding: 0; }
.pill { position: relative; }
.pill input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.pill span { display: inline-flex; align-items: center; justify-content: center; min-width: 58px; min-height: 44px; padding: 0 14px; border-radius: 10px;
  border: 1.5px solid var(--line-strong); background: #fff; font-weight: 600; font-size: 15px; color: var(--ink-2); cursor: pointer; user-select: none; }
.pill input:checked + span { border-color: var(--brand); background: var(--brand); color: #fff; }
.pill input:focus-visible + span { box-shadow: 0 0 0 3px rgba(29, 91, 163, .25); }
.pill-other { width: 96px !important; min-height: 44px !important; }
.attendee .att-name { font-size: 16px; margin-bottom: 8px; color: var(--ok); }
.attendee .att-name b { color: var(--ink); }
.attendee.missing { color: var(--bad); background: var(--bad-soft); border-color: #f4c7c2; }
.attendee label { margin-top: 8px; }
.sticky-actions { position: sticky; bottom: 0; z-index: 20; display: grid; gap: 8px; padding: 12px 0 max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(238,242,247,0), #eef2f7 30%); }
.sticky-actions .secondary { min-height: 44px; }
.lesson-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); display: grid; gap: 4px; }
.lesson-card.returned { border-left: 4px solid var(--bad); }
.lesson-card.draft { border-left: 4px solid var(--line-strong); }
.lesson-card.submitted { border-left: 4px solid #f59e0b; }
.lesson-card.confirmed { border-left: 4px solid var(--ok); }
.lc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 15.5px; }
.lc-actions { display: flex; align-items: center; gap: 14px; margin-top: 6px; flex-wrap: wrap; }
.lc-actions form { margin: 0; }
.lc-money { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.bad-box.small { padding: 8px 12px; margin: 4px 0 0; font-size: 13.5px; }
.card.attention { border-left: 4px solid var(--bad); }
.card.attention .lesson-card { box-shadow: none; margin-top: 8px; }
dl.fb { margin: 8px 0 0; display: grid; gap: 2px; }
dl.fb dt { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 6px; }
dl.fb dd { margin: 0; font-size: 15px; line-height: 1.55; }
.hours-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 8px; }
.hours-card { background: #fff; border-radius: 16px; padding: 18px 20px; box-shadow: var(--shadow); border: 1px solid var(--line); border-top: 5px solid var(--brand); }
.hours-card.low { border-top-color: #f59e0b; }
.hours-card.owed { border-top-color: var(--bad); }
.hc-type { font-weight: 700; color: var(--ink-2); letter-spacing: .3px; }
.hc-value { font-size: 44px; font-weight: 800; line-height: 1.1; letter-spacing: -1px; color: var(--ink); font-variant-numeric: tabular-nums; }
.hc-value small { font-size: 16px; font-weight: 600; margin-left: 4px; color: var(--muted); letter-spacing: 0; }
.hours-card.owed .hc-value { color: var(--bad); }
.hc-label { color: var(--muted); font-size: 13.5px; }
.hc-note { margin-top: 8px; font-size: 12.5px; color: var(--brand); background: var(--brand-soft); padding: 4px 8px; border-radius: 6px; display: inline-block; }
.stat-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 10px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat.accent { border-top: 4px solid var(--brand); }
.stat.warn { border-top: 4px solid #f59e0b; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.4px; }

/* students list: account invitations */
.invite-bar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; }
.invite-bar > div { flex: 1 1 360px; }
button[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.grid > .wide { grid-column: 1 / -1; }
.card table td { white-space: nowrap; }
.grid > .login { margin: 0; max-width: none; }
.subnav a.on { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }
.own-lessons { max-width: 760px; }
.own-lessons input, .own-lessons select, .own-lessons textarea { font-size: 16px; min-height: 46px; }
.own-lessons input[type=radio], .own-lessons input[type=checkbox] { min-height: 0; }
.own-lessons .sticky-actions { background: linear-gradient(to top, var(--bg) 70%, transparent); }
.seen { display: inline-block; padding: 1px 7px; margin-left: 5px; border-radius: 6px; font-size: 11px; line-height: 1.6; font-weight: 600; white-space: nowrap; vertical-align: 1px; border: 1px solid transparent; cursor: help; }
.seen-office, .seen-owner { background: #eef0f3; color: #4b5563; border-color: #d7dbe2; }
.seen-student, .seen-mail { background: #e0f0ff; color: #0b5cad; border-color: #b5d9ff; }
.seen-coach, .seen-thiscoach { background: #e2f6e9; color: #14713c; border-color: #b8e6c8; }
.seen-sales, .seen-partner { background: #f3e8ff; color: #6b21a8; border-color: #dcc4f7; }
h1 .seen { font-size: 12px; vertical-align: 5px; }
th .seen { margin-left: 0; display: table; margin-top: 3px; font-size: 10.5px; }
.seen-legend .seen { margin: 0 3px; }
.only-enrolled { margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); font-weight: 600; font-size: 14px; text-align: center; }
.guide { margin-top: 16px; background: #f7f9fc; }
.guide h2 { font-size: 17px; margin: 0 0 8px; }
.guide h3 { font-size: 15px; margin: 14px 0 4px; }
.guide p { margin: 0 0 8px; }
.guide-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.mail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
label.check { display: flex; gap: 8px; align-items: flex-start; }
label.check input { width: auto; min-height: 0; margin-top: 3px; }

/* Shared packages (拼课): 学号 added for the coach, and "did not come" */
.attendee .att-auto { display: inline-block; font-size: 13px; color: var(--warn); background: var(--warn-soft); border-radius: 999px; padding: 2px 10px; margin: 0 0 6px; }
.attendee .absent-box { margin: 6px 0 2px; font-size: 14px; color: var(--muted); }
.attendee:has(.absent-box input:checked) { background: #f7f7f5; }
.attendee:has(.absent-box input:checked) .fb-fields { display: none; }
.attendee .att-who { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.attendee .att-who .att-auto { margin: 0; }
.attendee .att-who .absent-box { margin: 0; }

/* Several students match a name: pick one */
.attendee.pick { background: var(--warn-soft); border-color: #f2d9a6; }
.attendee .pick-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.attendee .pick-list button { min-height: 40px; }

/* Owner previewing another role's pages */
.preview-bar { position: sticky; top: 0; z-index: 50; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px;
  padding: 8px 16px; background: #ffd666; color: #3d2a00; font-size: 14px; box-shadow: 0 1px 0 rgba(0,0,0,.08); }
.preview-bar form { margin: 0; }
.preview-bar button { min-height: 32px; padding: 4px 14px; background: #3d2a00; color: #fff; border: 0; border-radius: 999px; font-size: 14px; cursor: pointer; }
.preview-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 10px; }
td.date { white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .list-filter { width: 100%; }
  .list-filter input[name=q] { flex: 1 0 100%; min-width: 0; }
}
.transfer-target { border: 1px solid var(--line); border-radius: 10px; padding: 6px 14px 12px; margin: 0; min-width: 0; }
.transfer-target legend { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0 6px; }
.transfer-preview { background: var(--brand-soft); border-radius: 10px; padding: 10px 14px; }
.transfer-preview p { margin: 4px 0; }
.transfer-preview table { background: var(--card); }
.card-actions { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 14px; }
h2[id] { scroll-margin-top: 96px; }
.transfer-form > * { min-width: 0; }
.form-part { margin: 6px 0 -4px; font-size: 15px; }
.form-part .muted { font-weight: 400; font-size: 13px; margin-left: 6px; }
.person-row { border: 1px solid var(--line); border-radius: 10px; padding: 4px 14px 12px; margin: 0; min-width: 0; }
.person-row legend { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0 6px; }
.person-fb { border-left: 3px solid var(--brand-soft); padding-left: 12px; margin-top: 10px; }
.person-fb-name, .person-fb-view .person-fb-name { font-weight: 700; color: var(--brand); margin-top: 6px; }
.person-fb-view + .person-fb-view { margin-top: 8px; }
.pkg-lines { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 14px; display: grid; gap: 4px; }
.pkg-line { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.pkg-line a.small { margin-left: auto; font-size: 13px; }
.attendee .att-emergency { font-size: 14px; color: var(--ink-2); margin: -4px 0 6px; }
.attendee .att-emergency a { font-weight: 600; }
details.recon { margin: 4px 0 18px; font-size: 14px; color: var(--ok); }
details.recon summary { cursor: pointer; font-weight: 600; }
.more-pays summary { cursor: pointer; color: var(--brand); font-weight: 600; margin: 4px 0 10px; }
h2 .small { font-size: 13px; font-weight: 400; margin-left: 6px; }
.person-row[hidden] { display: none; }
.child-q { font-weight: 600; margin-top: 8px; }
.child-block { margin-top: 10px; }
.child-fields { border-left: 3px solid var(--brand-soft); padding-left: 12px; margin-top: 6px; }
.child-block:not(:has(.child-tick input:checked)) .child-fields { display: none; }
.audit-data div { max-width: 460px; white-space: normal; overflow-wrap: anywhere; font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* ---------- page furniture ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin: 4px 0 18px; }
.page-head h1 { margin: 0; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.page-actions .inline { gap: 8px; }
.quick-search { display: flex; gap: 8px; }
.quick-search input { width: 290px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 30px 0 12px; scroll-margin-top: 90px; }
.section-head h2 { margin: 0; }
.section-head form { margin: 0; }
.ledgers { align-items: stretch; }
.table-wrap + p.hint, .table-wrap + p.muted { margin: -6px 2px 18px; }
p.hint + .grid, p.muted + .grid { margin-top: 16px; }
tbody td:first-child > a { font-weight: 600; }
.todo-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-bottom: 8px; }
.todo { display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink-2); }
.todo:hover { text-decoration: none; border-color: #b9cce5; }
.todo-n { font-size: 28px; font-weight: 750; line-height: 1; min-width: 34px; text-align: center; color: #a2acba; font-variant-numeric: tabular-nums; }
.todo b { display: block; color: var(--ink); font-size: 15px; }
.todo small { color: var(--muted); font-size: 12.5px; }
.todo.on { border-color: #f2d9a6; background: linear-gradient(90deg, var(--warn-soft), #fff 60%); }
.todo.on .todo-n { color: #b26a00; }
.filter-bar { padding: 12px 16px; }
.filter-bar .inline { display: flex; }
.filter-bar input[name=q] { flex: 1 1 300px; }
.stats { display: grid; gap: 12px 24px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.stats > div { display: grid; gap: 2px; }
.stats span { font-size: 13px; color: var(--muted); }
.stats .tip { display: inline-flex; color: var(--brand); }
.stats b { font-size: 22px; font-weight: 700; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.stats b.bad { color: var(--bad); }
.stats + .hint { margin-top: 12px; }
.pkg-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); }
.pkg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-bottom: 12px; font-size: 14px; }
.subnav { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; margin: -10px 0 8px; background: var(--bg); }
.subnav a { padding: 5px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 13.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.subnav a:hover { text-decoration: none; background: var(--brand-soft); color: var(--brand); }
h2[id] { scroll-margin-top: 120px; }
.folds { display: grid; gap: 8px; margin-bottom: 8px; }
details.fold { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); scroll-margin-top: 90px; }
details.fold > summary { padding: 13px 18px; cursor: pointer; font-weight: 650; list-style: none; display: flex; align-items: center; gap: 10px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--brand); border-bottom: 2px solid var(--brand); transform: rotate(-45deg); flex: none; transition: transform .15s; }
details.fold[open] > summary::before { transform: rotate(45deg); }
details.fold > summary:hover { color: var(--brand); }
details.fold > summary .muted { font-weight: 400; }
details.fold > .fold-body { padding: 4px 18px 18px; border-top: 1px solid var(--line); padding-top: 16px; }
details.fold.slim { margin-bottom: 14px; }
details.fold.slim > summary { padding: 9px 16px; font-size: 14px; }
.att-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; margin-bottom: 10px; }
.att-head > label { display: flex; align-items: center; gap: 10px; flex: 0 1 380px; margin: 0; white-space: nowrap; }
.att-head > label > select { margin: 0; }
.att-head strong { font-size: 15px; }
.renew-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 14px 18px; margin-bottom: 14px; border-radius: var(--radius); background: var(--warn-soft); border: 1px solid #f2d9a6; color: #5e3a00; }
.renew-box form { margin: 0; }
.renew-form { margin: 14px 0 0; }
.renew-form .hint { margin-top: 6px; }
.renew-done { margin-top: 12px; padding: 9px 12px; border-radius: 10px; background: var(--ok-soft); color: #11603a; font-size: 14px; font-weight: 600; }
dialog.notice { border: 0; border-radius: 16px; padding: 22px 24px; width: min(600px, calc(100vw - 28px)); color: var(--ink); box-shadow: 0 20px 60px rgba(10, 30, 60, .35); }
dialog.notice::backdrop { background: rgba(15, 30, 55, .5); }
dialog.notice h2 { margin: 0 0 14px; font-size: 19px; }
.notice-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; max-height: 50vh; overflow: auto; }
.notice-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; }
.notice-list form, .notice-end { margin: 0; }
.notice-list button { white-space: nowrap; }
.notice-end { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.notice-end .hint { flex: 1 1 220px; }
@media (max-width: 720px) {
  .page-actions, .quick-search { width: 100%; }
  .quick-search input { width: auto; flex: 1; }
  .att-head > label { flex: 1 1 100%; }
  .filter-bar input[name=q] { flex: 1 0 100%; }
  .todo { padding: 12px 14px; }
}
.mini-save { display: flex; align-items: center; gap: 6px; }
select.mini { width: auto; min-width: 96px; min-height: 32px; padding: 4px 8px; font-size: 13.5px; }
.ok-text { color: var(--ok); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.bad-text { color: var(--bad); font-size: 12.5px; font-weight: 600; }
input:disabled { background: #f5f7fa; color: var(--ink-2); }
table.mid td { vertical-align: middle; }
.folds { grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.folds > details[open] { grid-column: 1 / -1; }
.link-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.link-list a { font-weight: 600; }
.link-list .hint { display: block; margin: 0; }
.pmain:has(> .login) > h1, .pmain:has(> form.login) > h1 { text-align: center; margin-top: 32px; }
.pmain > .login { margin: 20px auto; }
.card.attention.info { border-left-color: var(--brand); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 14px 18px; }
.card.attention.info p { margin: 0; flex: 1 1 220px; }
textarea[name="notes"] { min-height: 58px; }
table.mid td:nth-child(2) { min-width: 130px; }
@media (max-width: 720px) {
  details.fold > summary { flex-wrap: wrap; row-gap: 2px; }
  details.fold > summary .muted { flex: 1 0 100%; padding-left: 18px; }
}
.grid.four { grid-template-columns: repeat(auto-fit, minmax(min(100%, 262px), 1fr)); }
