/* Learn Chinese Perth — student manager
   One family (Geist), cool palette, indigo primary, cinnabar only for money owed. */

:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --ink: #172030;
  --ink-2: #3b475a;
  --muted: #697a90;
  --line: #d8dee6;
  --line-2: #e9edf2;

  --primary: #27467a;
  --primary-ink: #1b335c;
  --primary-tint: #e3eaf6;
  --primary-soft: #c9d6ec;

  --bad: #b8321f;
  --bad-tint: #fbe9e6;
  --good: #1f7a5c;
  --good-tint: #e0f2ea;
  --warn: #9a6306;
  --warn-tint: #fbf0d9;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(23, 32, 48, 0.06), 0 8px 24px -16px rgba(23, 32, 48, 0.25);
  --font: "Geist", -apple-system, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Segoe UI", sans-serif;
  --sidebar: 232px;
  --ribbon-h: 64px;
  --grid-h: 720px;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-feature-settings: "ss01", "cv11";
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 1.7rem; line-height: 1.2; }
h2 { font-size: 1.02rem; display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.8rem; }
p { margin: 0 0 0.6rem; }
.num, td.num, .table td.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.bad { color: var(--bad); font-weight: 500; }
.count { font-size: 0.85rem; color: var(--muted); font-weight: 500; padding: 0.05rem 0.5rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-2); }
.h-link { margin-left: auto; font-size: 0.85rem; font-weight: 500; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* ---- Shell ---- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 1.25rem 1rem;
}
.brand { display: flex; align-items: center; gap: 0.7rem; color: var(--ink); text-decoration: none; padding: 0.25rem 0.5rem; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 9px; flex: none;
  background: var(--primary); color: #fff; font-weight: 600; font-size: 1.15rem;
  display: grid; place-items: center;
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", var(--font);
}
.brand-text { font-weight: 600; line-height: 1.15; font-size: 0.9rem; white-space: nowrap; }
.brand-text small { display: block; font-weight: 400; color: var(--muted); font-size: 0.78rem; margin-top: 0.1rem; }
.brand-large .brand-mark { width: 48px; height: 48px; font-size: 1.4rem; }
.nav { display: flex; flex-direction: column; gap: 0.15rem; margin-top: 1.5rem; }
.nav a {
  color: var(--ink-2); padding: 0.55rem 0.75rem; border-radius: var(--radius-sm); font-weight: 500;
  transition: background 120ms ease, color 120ms ease;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav a[aria-current="page"] { background: var(--primary-tint); color: var(--primary-ink); }
.sidebar-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; padding: 0 0.5rem; font-size: 0.88rem; }
.link-button { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; cursor: pointer; }
.link-button:hover { color: var(--ink); text-decoration: underline; }

.content { margin-left: var(--sidebar); padding: 2rem 2.25rem 4rem; max-width: calc(var(--sidebar) + 1180px); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.hero-kicker { color: var(--muted); font-weight: 500; font-size: 0.9rem; margin: 0 0 0.15rem; }
.actions, .row-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  padding: 0.5rem 0.95rem; min-height: 2.3rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; font-size: 0.92rem;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease, box-shadow 120ms ease;
}
.btn:hover { background: var(--surface-2); border-color: #c5ced9; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-ink); border-color: var(--primary-ink); }
.btn-good { color: var(--good); border-color: #bfe0d1; background: var(--good-tint); }
.btn-good:hover { background: #cfeadd; border-color: #a7d3c0; }
.btn-danger { color: var(--bad); border-color: #efc4bd; background: var(--bad-tint); }
.btn-danger:hover { background: #f6d7d2; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn-quiet:hover { background: var(--surface-2); color: var(--ink); }
.btn-sm { padding: 0.28rem 0.65rem; min-height: 1.9rem; font-size: 0.84rem; }
.btn-block { width: 100%; }

/* ---- Cards, rows, tables ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card-flush { padding: 0; overflow: hidden; }
.card-title { padding: 1rem 1.25rem 0.25rem; }
.card-attention { border-color: var(--primary-soft); background: linear-gradient(0deg, var(--surface), var(--primary-tint) 160%); }
.columns-2 { display: grid; grid-template-columns: 1.1fr 1fr; gap: 1rem; }
.columns-wide-left { grid-template-columns: 1.4fr 1fr; align-items: start; }
.delta-up { color: var(--good); font-weight: 600; }
.delta-down { color: var(--muted); }
.table-ledger tr.ledger-bill td:first-child { box-shadow: inset 3px 0 0 var(--good); }
.table-ledger tr.ledger-adjustment td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.dash { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.9fr); gap: 1rem; align-items: start; }
.column { min-width: 0; }

.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; gap: 1rem; align-items: center; padding: 0.65rem 0; border-top: 1px solid var(--line-2); }
.row:first-child { border-top: 0; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.row-title { font-weight: 600; color: var(--ink); }
.row-meta { font-size: 0.86rem; color: var(--muted); }
.row.is-overdue .row-title::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); margin-left: 0.45rem; vertical-align: middle; }
.empty { color: var(--muted); margin: 0.25rem 0 0; padding: 0.4rem 0; }
.card-flush .empty { padding: 0.5rem 0; }

.table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.table th, .table td { text-align: left; padding: 0.7rem 1rem; border-top: 1px solid var(--line-2); vertical-align: middle; }
.table thead th { border-top: 0; background: var(--surface-2); color: var(--muted); font-weight: 500; font-size: 0.8rem; padding-top: 0.55rem; padding-bottom: 0.55rem; }
.table tbody tr { transition: background 100ms ease; }
.table tbody tr:hover { background: #fafbfc; }
.table tr.clickable { cursor: pointer; }
.table tr.is-unpaid td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.notes-cell { max-width: 320px; color: var(--ink-2); }
.table .row-actions { justify-content: flex-end; }

.pill { display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.82rem; font-weight: 500; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pill-bad { background: var(--bad-tint); border-color: #efc4bd; color: var(--bad); }
.pill-warn { background: var(--warn-tint); border-color: #ecd9a6; color: var(--warn); }
.pill-good { background: var(--good-tint); border-color: #bfe0d1; color: var(--good); }
.state { font-weight: 500; }
.state-completed { color: var(--good); }
.state-no_show, .state-cancelled_student { color: var(--bad); }
.state-cancelled_teacher, .state-scheduled { color: var(--muted); }

.details { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.25rem; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.notes { white-space: pre-wrap; margin-top: 0.9rem; padding-top: 0.9rem; border-top: 1px solid var(--line-2); color: var(--ink-2); }
.log { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; }

/* ---- Balance ---- */
.card-balance { border-color: var(--primary-soft); }
.card-balance.is-owed { border-color: #efc4bd; }
.balance-figure { display: flex; align-items: baseline; gap: 0.6rem; margin: 0.2rem 0 0.7rem; }
.balance-num { font-size: 2.6rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1; color: var(--primary-ink); font-variant-numeric: tabular-nums; }
.is-owed .balance-num { color: var(--bad); }
.balance-label { font-size: 1rem; color: var(--ink-2); }
.progress { height: 8px; border-radius: 999px; background: var(--primary-tint); overflow: hidden; margin: 0.4rem 0 0.5rem; }
.progress-bar { height: 100%; width: calc(var(--pct, 0) * 1%); background: var(--primary); border-radius: 999px; transition: width 400ms ease; }
.card-balance .actions { margin-top: 0.8rem; }

/* ---- Mark menu ---- */
.mark { display: inline-flex; gap: 0.3rem; align-items: center; position: relative; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { background: var(--surface-2); }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 170px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px -10px rgba(23, 32, 48, 0.35); padding: 0.3rem;
  display: flex; flex-direction: column;
  animation: pop 120ms ease-out;
}
.menu-list button { text-align: left; background: none; border: 0; padding: 0.45rem 0.6rem; border-radius: 5px; font: inherit; font-size: 0.88rem; color: var(--ink); cursor: pointer; }
.menu-list button:hover { background: var(--surface-2); }
@keyframes pop { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

/* ---- Hero + day ribbon ---- */
.hero { margin-bottom: 1.5rem; }
.hero-title { font-size: 2.1rem; letter-spacing: -0.025em; }
.hero-sub { color: var(--muted); margin: 0.2rem 0 1rem; }
.ribbon { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.7rem 1rem 0.9rem; }
.ribbon-hours { display: flex; justify-content: space-between; font-size: 0.74rem; color: var(--muted); font-variant-numeric: tabular-nums; margin-bottom: 0.35rem; }
.ribbon-hours span { width: 0; white-space: nowrap; }
.ribbon-hours span:first-child { transform: none; }
.ribbon-hours span:last-child { transform: translateX(-100%); }
.ribbon-track {
  position: relative; height: var(--ribbon-h); border-radius: 6px;
  background: repeating-linear-gradient(90deg, var(--line-2) 0 1px, transparent 1px calc(100% / 12));
  background-color: var(--surface-2); overflow: visible;
}
.ribbon .chip {
  --start: clamp(0, (var(--s) - var(--ds, 480)) / (var(--de, 1200) - var(--ds, 480)), 1);
  --len: clamp(0, var(--d) / (var(--de, 1200) - var(--ds, 480)), 1);
  position: absolute; top: 8px; bottom: 8px;
  left: min(calc(var(--start) * 100%), calc(100% - 108px)); width: max(calc(var(--len) * 100%), 108px);
  padding: 0.3rem 0.55rem; border-radius: 6px; overflow: hidden;
  background: var(--primary); color: #fff; border-left: 3px solid var(--primary-ink);
  display: flex; flex-direction: column; justify-content: center; line-height: 1.2;
  text-decoration: none; transition: transform 120ms ease, box-shadow 120ms ease;
}
.ribbon .chip:hover { transform: translateY(-2px); box-shadow: 0 8px 16px -8px rgba(39, 70, 122, 0.6); text-decoration: none; }
.chip-name { font-weight: 600; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-time { font-size: 0.76rem; opacity: 0.85; font-variant-numeric: tabular-nums; }
.chip.status-completed { background: var(--good); border-left-color: #145a43; }
.chip.status-cancelled_student, .chip.status-cancelled_teacher, .chip.status-no_show { background: #9aa6b7; border-left-color: #7b879a; }
.ribbon-now {
  --start: clamp(0, (var(--s) - var(--ds, 480)) / (var(--de, 1200) - var(--ds, 480)), 1);
  position: absolute; top: -6px; bottom: -6px; left: calc(var(--start) * 100%); width: 2px; background: var(--bad); border-radius: 2px; z-index: 2;
}
.ribbon-now::before { content: ""; position: absolute; top: -4px; left: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
.ribbon-now[hidden] { display: none; }

/* ---- Agenda (this week on the dashboard, mobile week) ---- */
.agenda { list-style: none; margin: 0; padding: 0; }
.agenda-day { display: grid; grid-template-columns: 3rem 1fr; gap: 0.75rem; padding: 0.55rem 0; border-top: 1px solid var(--line-2); }
.agenda-day:first-child { border-top: 0; }
.agenda-date { display: flex; flex-direction: column; align-items: center; line-height: 1.1; padding-top: 0.15rem; }
.agenda-dow { font-size: 0.72rem; color: var(--muted); font-weight: 500; }
.agenda-num { font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.agenda-day.is-today .agenda-date { color: var(--primary-ink); }
.agenda-day.is-today .agenda-num { background: var(--primary); color: #fff; border-radius: 8px; padding: 0 0.35rem; }
.agenda-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.agenda-item { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; min-height: 1.9rem; }
.agenda-item > a { font-weight: 500; color: var(--ink); }
.agenda-time { color: var(--muted); font-size: 0.88rem; width: 3rem; }
.agenda-state { font-size: 0.82rem; color: var(--muted); }
.agenda-item.status-completed .agenda-state { color: var(--good); }
.agenda-item.status-no_show .agenda-state, .agenda-item.status-cancelled_student .agenda-state { color: var(--bad); }
.agenda-item .mark { margin-left: auto; }
.agenda-empty { color: var(--line); }
.quiet-link { color: var(--muted); font-size: 0.85rem; opacity: 0.7; }
.quiet-link:hover { opacity: 1; }
.agenda-mobile { display: none; }

/* ---- Week time grid ---- */
.grid-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.75rem 1rem 1rem; overflow-x: auto; }
.grid { display: grid; grid-template-columns: 3.2rem repeat(7, minmax(120px, 1fr)); grid-template-rows: auto var(--grid-h); column-gap: 4px; min-width: 900px; }
.grid-head { display: flex; align-items: baseline; gap: 0.35rem; padding: 0.25rem 0.5rem 0.55rem; color: var(--ink); border-bottom: 1px solid var(--line); text-decoration: none; }
.grid-head:hover { color: var(--primary); text-decoration: none; }
.grid-dow { font-size: 0.78rem; color: var(--muted); font-weight: 500; }
.grid-num { font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.grid-head.is-today .grid-num { color: var(--primary-ink); }
.grid-head.is-today { border-bottom: 2px solid var(--primary); }
.grid-corner { border-bottom: 1px solid var(--line); }
.grid-hours { position: relative; font-size: 0.74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.grid-hours span { position: absolute; right: 0.5rem; transform: translateY(-50%); }
.grid-hours span:nth-child(1) { top: 0; } .grid-hours span:nth-child(2) { top: 8.333%; } .grid-hours span:nth-child(3) { top: 16.667%; }
.grid-hours span:nth-child(4) { top: 25%; } .grid-hours span:nth-child(5) { top: 33.333%; } .grid-hours span:nth-child(6) { top: 41.667%; }
.grid-hours span:nth-child(7) { top: 50%; } .grid-hours span:nth-child(8) { top: 58.333%; } .grid-hours span:nth-child(9) { top: 66.667%; }
.grid-hours span:nth-child(10) { top: 75%; } .grid-hours span:nth-child(11) { top: 83.333%; } .grid-hours span:nth-child(12) { top: 91.667%; }
.grid-hours span:nth-child(13) { top: 100%; }
.grid-day {
  position: relative; border-left: 1px solid var(--line-2);
  background: repeating-linear-gradient(180deg, var(--line-2) 0 1px, transparent 1px calc(100% / 12));
}
.grid-day.is-today { background-color: #f7f9fc; }
.grid-slots { position: absolute; inset: 0; display: flex; flex-direction: column; }
.slot { flex: 1; display: flex; align-items: center; justify-content: center; color: transparent; font-size: 0.74rem; font-weight: 500; text-decoration: none; border-radius: 4px; margin: 1px 4px; transition: background 100ms ease; }
.slot:hover, .slot:focus-visible { background: var(--primary-tint); color: var(--primary-ink); text-decoration: none; }
.slot span::before { content: "+ "; }
.block {
  --start: clamp(0, (var(--s) - var(--ds, 480)) / (var(--de, 1200) - var(--ds, 480)), 1);
  --len: clamp(0, var(--d) / (var(--de, 1200) - var(--ds, 480)), 1);
  position: absolute; left: 4px; right: 4px;
  top: calc(var(--start) * 100%); height: max(calc(var(--len) * 100%), 34px);
  border-radius: 6px; background: var(--primary-tint); border-left: 3px solid var(--primary);
  color: var(--primary-ink); overflow: hidden; display: flex; flex-direction: column;
  transition: box-shadow 120ms ease, transform 120ms ease;
}
.block:hover { box-shadow: 0 8px 18px -10px rgba(39, 70, 122, 0.5); transform: translateY(-1px); z-index: 3; }
.block-link { display: block; padding: 0.3rem 0.45rem; color: inherit; text-decoration: none; line-height: 1.25; flex: 1; min-height: 0; }
.block-link:hover { text-decoration: none; }
.block-time { display: block; font-size: 0.74rem; opacity: 0.8; }
.block-name { display: block; font-weight: 600; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.block-state { display: block; font-size: 0.76rem; }
.block-state.bad { color: var(--bad); }
.table-compact th, .table-compact td { padding: 0.4rem 0.5rem; }
.stats { margin-top: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }

/* ---- Invoice ---- */
.invoice { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 2.5rem 2.75rem; max-width: 760px; color: var(--ink); }
.invoice-head { display: flex; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.invoice-brand { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.3rem; }
.invoice-from { font-size: 0.92rem; color: var(--ink-2); }
.invoice-meta { text-align: right; }
.invoice-title { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; color: var(--primary-ink); margin-bottom: 0.5rem; }
.invoice-meta dl, .invoice-pay dl { display: grid; grid-template-columns: max-content max-content; gap: 0.2rem 1rem; margin: 0; font-size: 0.92rem; }
.invoice-meta dl { justify-content: end; }
.invoice-meta dt, .invoice-pay dt { color: var(--muted); }
.invoice-meta dd, .invoice-pay dd { margin: 0; }
.invoice-label { font-size: 0.8rem; font-weight: 500; color: var(--muted); margin-bottom: 0.25rem; }
.invoice-to { margin-bottom: 2rem; }
.invoice-lines { width: 100%; border-collapse: collapse; margin-bottom: 2rem; }
.invoice-lines th, .invoice-lines td { padding: 0.7rem 0.5rem; text-align: left; border-bottom: 1px solid var(--line-2); }
.invoice-lines thead th { font-size: 0.8rem; font-weight: 500; color: var(--muted); border-bottom: 1px solid var(--line); }
.invoice-lines th.num, .invoice-lines td.num { text-align: right; }
.invoice-lines tfoot th { border-bottom: 0; border-top: 2px solid var(--ink); font-size: 1.05rem; padding-top: 0.9rem; text-align: right; }
.invoice-pay { background: var(--surface-2); border-radius: var(--radius-sm); padding: 1rem 1.25rem; margin-bottom: 1.5rem; }
.invoice-paid-stamp { display: inline-block; color: var(--good); border: 2px solid var(--good); border-radius: 6px; padding: 0.3rem 0.8rem; font-weight: 600; margin-bottom: 1.5rem; }
.invoice-note { color: var(--muted); font-size: 0.88rem; margin: 0; }

@media print {
  body { background: #fff; }
  .sidebar, .no-print, .toasts { display: none !important; }
  .content { margin: 0; padding: 0; max-width: none; }
  .invoice { border: 0; box-shadow: none; padding: 0; max-width: none; }
  a { color: inherit; }
}
.block.status-completed { background: var(--good-tint); border-left-color: var(--good); color: var(--good); }
.block.status-cancelled_student, .block.status-cancelled_teacher, .block.status-no_show { background: var(--surface-2); border-left-color: #b4bdc9; color: var(--muted); }
.block.status-no_show, .block.status-cancelled_student { text-decoration: line-through; text-decoration-color: rgba(0,0,0,0.25); }
.block .mark { position: absolute; right: 4px; top: 4px; opacity: 0; transition: opacity 120ms ease; }
.block:hover .mark, .block:focus-within .mark { opacity: 1; }
.block .mark .btn-sm { padding: 0.1rem 0.45rem; min-height: 1.45rem; font-size: 0.74rem; }
.mark-compact .menu-list { right: 0; }

/* ---- Forms ---- */
.form-layout { display: grid; grid-template-columns: minmax(0, 580px) minmax(220px, 300px); gap: 1.25rem; align-items: start; }
.form-aside { color: var(--muted); font-size: 0.92rem; padding-top: 0.25rem; }
.form .field { margin: 0 0 1rem; }
.form label { display: block; font-weight: 500; margin-bottom: 0.3rem; font-size: 0.92rem; }
.form input:not([type="checkbox"]):not([type="radio"]), .form select, .form textarea {
  width: 100%; padding: 0.55rem 0.7rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; color: var(--ink); background: var(--surface);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.form textarea { resize: vertical; min-height: 4.5rem; }
.form .field-check { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.form .field-check label { margin: 0; }
.form .field-check .help { flex-basis: 100%; }
.form input[type="checkbox"] { width: 1.05rem; height: 1.05rem; accent-color: var(--primary); }
.form .help { display: block; color: var(--muted); font-size: 0.84rem; margin-top: 0.3rem; }
.form .error { display: block; color: var(--bad); font-size: 0.86rem; margin-top: 0.3rem; }
.form .has-error input, .form .has-error select { border-color: var(--bad); }
.form-error { color: var(--bad); background: var(--bad-tint); border: 1px solid #efc4bd; padding: 0.6rem 0.8rem; border-radius: var(--radius-sm); }
.form-actions { display: flex; gap: 0.5rem; align-items: center; margin-top: 1.25rem; }
.summary-line { font-size: 1rem; padding-bottom: 0.9rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line-2); }
.form.card { margin-bottom: 0; }

.choices { border: 0; padding: 0; margin: 0 0 1.25rem; display: grid; gap: 0.5rem; }
.choices legend { font-weight: 500; font-size: 0.92rem; margin-bottom: 0.4rem; padding: 0; }
.choice {
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "radio name price" "radio meta price";
  gap: 0 0.7rem; align-items: center; padding: 0.65rem 0.85rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer; transition: border-color 120ms ease, background 120ms ease; font-weight: 400;
}
.choice:hover { border-color: #c5ced9; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-tint); }
.choice input { grid-area: radio; accent-color: var(--primary); width: 1.05rem; height: 1.05rem; margin: 0; }
.choice-name { grid-area: name; font-weight: 500; }
.choice-meta { grid-area: meta; color: var(--muted); font-size: 0.84rem; }
.choice-price { grid-area: price; font-weight: 600; }
html.js [data-package-form] .field:has(#id_option) { display: none; }

/* ---- Login ---- */
.login-page { display: grid; place-items: center; padding: 1rem; }
.login-page .content { margin: 0; padding: 0; width: 100%; max-width: 380px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 1.75rem; }
.login-card .brand { padding: 0; margin-bottom: 1.5rem; }

/* ---- Toasts ---- */
.toasts { position: fixed; right: 1.25rem; top: 1.25rem; z-index: 50; display: flex; flex-direction: column; gap: 0.5rem; max-width: 360px; }
.toast {
  background: var(--ink); color: #fff; padding: 0.7rem 1rem; border-radius: var(--radius-sm); font-size: 0.92rem;
  box-shadow: 0 12px 30px -12px rgba(23, 32, 48, 0.6);
  animation: toast-in 220ms ease-out, toast-out 300ms ease-in 4.5s forwards;
}
.toast-error { background: var(--bad); }
.toast-info { background: var(--primary); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-6px); visibility: hidden; } }

/* ---- Responsive ---- */
@media (max-width: 1100px) {
  .dash, .columns-2, .form-layout { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { position: sticky; top: 0; inset: auto; width: auto; flex-direction: row; align-items: center; gap: 0.75rem; padding: 0.5rem 0.75rem; z-index: 30; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .brand-text small { display: none; }
  .nav { flex-direction: row; margin: 0; gap: 0.1rem; }
  .nav a { padding: 0.4rem 0.6rem; font-size: 0.9rem; }
  .sidebar-foot { margin-left: auto; padding: 0; gap: 0.5rem; }
  .sidebar-foot .muted { display: none; }
  .content { margin-left: 0; padding: 1rem; }
  .hero-title { font-size: 1.6rem; }
  .grid-wrap { display: none; }
  .agenda-mobile { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.5rem 1rem; }
  .row { flex-direction: column; align-items: stretch; gap: 0.5rem; }
  .table th:nth-child(n+4), .table td:nth-child(n+4) { display: none; }
  .table .row-actions { display: flex; }
  .page-head { align-items: flex-start; }
  .ribbon-hours span:not(:nth-child(4n+1)) { visibility: hidden; }
  .toasts { left: 1rem; right: 1rem; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .toast { animation: none; }
}
