/* =====================================================================
   State House Booking — Staff Portal · design system v0.2
   ===================================================================== */

/* ---------- tokens: light ---------- */
:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --sunken: #eef1f4;
  --hover: #f2f5f7;
  --ink: #0f1a24;
  --ink-2: #33414e;
  --muted: #5f6d7a;
  --faint: #8d99a5;
  --line: #e3e8ec;
  --line-2: #eef1f4;

  --primary: #0d6b60;
  --primary-hover: #0a5a51;
  --primary-soft: #e5f2f0;
  --primary-ink: #0a5a51;
  --on-primary: #ffffff;
  --ring: rgba(13, 107, 96, .22);

  --green: #087443;  --green-bg: #e9f7ef;
  --blue: #1a5bc4;   --blue-bg: #ecf3fe;
  --amber: #a5560a;  --amber-bg: #fff6e6;
  --red: #b42318;    --red-bg: #fdeeec;
  --slate: #4a5867;  --slate-bg: #eff2f5;

  --shadow-xs: 0 1px 2px rgba(15, 26, 36, .05);
  --shadow-sm: 0 1px 3px rgba(15, 26, 36, .07), 0 1px 2px rgba(15, 26, 36, .04);
  --shadow-md: 0 6px 16px -4px rgba(15, 26, 36, .10), 0 2px 4px rgba(15, 26, 36, .04);
  --shadow-lg: 0 24px 48px -12px rgba(15, 26, 36, .22);
  --scrim: rgba(10, 18, 26, .42);

  --radius-lg: 14px;
  --radius: 11px;
  --radius-sm: 8px;
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 64px;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .5, 1);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---------- tokens: dark ---------- */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1015;
  --surface: #121921;
  --surface-2: #161f28;
  --sunken: #0e141a;
  --hover: #1a242e;
  --ink: #e8edf1;
  --ink-2: #c2ccd5;
  --muted: #8f9ca8;
  --faint: #6a7783;
  --line: #222d37;
  --line-2: #1b242d;

  --primary: #2fb5a3;
  --primary-hover: #42c6b4;
  --primary-soft: rgba(47, 181, 163, .13);
  --primary-ink: #6fd8c9;
  --on-primary: #04201c;
  --ring: rgba(47, 181, 163, .32);

  --green: #4fd08f;  --green-bg: rgba(79, 208, 143, .12);
  --blue: #7ab4ff;   --blue-bg: rgba(122, 180, 255, .12);
  --amber: #f3b54f;  --amber-bg: rgba(243, 181, 79, .12);
  --red: #ff8b80;    --red-bg: rgba(255, 139, 128, .12);
  --slate: #a7b3be;  --slate-bg: rgba(167, 179, 190, .12);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .35);
  --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, .5);
  --shadow-lg: 0 28px 56px -12px rgba(0, 0, 0, .65);
  --scrim: rgba(0, 0, 0, .6);
}

/* smooth theme switch (fallback when View Transitions are unavailable) */
html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
  transition: background-color .35s ease, border-color .35s ease, color .25s ease, fill .25s ease, box-shadow .35s ease !important;
}
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .38s; animation-timing-function: var(--ease); }

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { min-height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.55;
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.015em; font-weight: 600; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
::selection { background: var(--primary-soft); color: var(--ink); }

svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 16px; height: 16px; }
svg.i.lg { width: 22px; height: 22px; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* ---------- progress bar ---------- */
.progress { position: fixed; inset: 0 0 auto 0; height: 2.5px; z-index: 1000; pointer-events: none; }
.progress-bar { height: 100%; width: 0; opacity: 0; background: var(--primary); box-shadow: 0 0 10px var(--ring); transition: width .4s var(--ease), opacity .3s ease; border-radius: 0 2px 2px 0; }
.progress.active .progress-bar { opacity: 1; }

/* =====================================================================
   App shell
   ===================================================================== */
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 60; width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line);
  transition: width .3s var(--ease), transform .32s var(--ease);
}
.sb-head { height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 14px 0 18px; border-bottom: 1px solid var(--line-2); flex: none; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; flex: 1; overflow: hidden; color: inherit; text-decoration: none !important; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; color: var(--on-primary);
  background: linear-gradient(140deg, var(--primary) 0%, var(--primary-hover) 100%); box-shadow: 0 4px 10px -3px var(--ring); }
.brand-mark svg { width: 19px; height: 19px; stroke-width: 2; }
.brand-text { min-width: 0; transition: opacity .2s; }
.brand-text strong { display: block; font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; flex: none; transition: background .15s, color .15s, border-color .15s, transform .1s; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.bordered { border-color: var(--line); background: var(--surface); }
#collapse svg { transition: transform .3s var(--ease); }

.nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 12px; scrollbar-width: thin; }
.nav-section { margin: 16px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); white-space: nowrap; transition: opacity .2s; }
.nav-section:first-child { margin-top: 4px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; margin: 2px 0;
  border-radius: 9px; color: var(--ink-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-decoration: none !important;
  transition: background .15s, color .15s;
}
.nav a svg { color: var(--muted); transition: color .15s; }
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a.active { background: var(--primary-soft); color: var(--primary-ink); }
.nav a.active svg { color: var(--primary-ink); }
.nav a .label { transition: opacity .2s; }
.nav a .pill { margin-left: auto; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--red-bg); color: var(--red); }

.sb-foot { padding: 10px 12px 14px; border-top: 1px solid var(--line-2); display: grid; gap: 6px; flex: none; }
.sb-row { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 9px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; font-weight: 500; white-space: nowrap; overflow: hidden; width: 100%; text-align: left; text-decoration: none !important; transition: background .15s, color .15s; }
.sb-row svg { color: var(--muted); }
.sb-row:hover { background: var(--hover); color: var(--ink); }
.sb-row.danger:hover { background: var(--red-bg); color: var(--red); }
.sb-row.danger:hover svg { color: var(--red); }
.sb-row .label { transition: opacity .2s; flex: 1; }
.sb-user { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px; color: inherit; text-decoration: none !important; overflow: hidden; transition: background .15s; }
.sb-user:hover { background: var(--hover); }
.sb-user .who { min-width: 0; line-height: 1.25; transition: opacity .2s; }
.sb-user .who strong { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user .who span { font-size: 12px; color: var(--muted); text-transform: capitalize; }

.avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 650; font-size: 12.5px; color: var(--primary-ink); background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent); }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }

/* theme switch */
.switch { margin-left: auto; width: 36px; height: 21px; border-radius: 99px; background: var(--sunken); border: 1px solid var(--line); position: relative; flex: none; transition: background .25s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .3s var(--ease-spring); }
[data-theme="dark"] .switch { background: var(--primary); border-color: var(--primary); }
[data-theme="dark"] .switch::after { transform: translateX(15px); background: #fff; }

.main { min-width: 0; margin-left: var(--sidebar-w); transition: margin-left .3s var(--ease); min-height: 100vh; display: flex; flex-direction: column; }

/* collapsed (desktop) */
body.sb-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
body.sb-collapsed .main { margin-left: var(--sidebar-w-collapsed); }
body.sb-collapsed .brand-text, body.sb-collapsed .nav a .label, body.sb-collapsed .sb-row .label,
body.sb-collapsed .sb-user .who, body.sb-collapsed .nav-section, body.sb-collapsed .nav a .pill, body.sb-collapsed .sb-row .switch { opacity: 0; pointer-events: none; }
body.sb-collapsed .nav-section { height: 1px; margin: 12px 14px; background: var(--line); overflow: hidden; }
body.sb-collapsed .sb-head { padding: 0 0 0 21px; }
body.sb-collapsed .sb-head .brand { flex: 0 0 34px; }
body.sb-collapsed #collapse { position: absolute; left: calc(var(--sidebar-w-collapsed) - 14px); top: 18px; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); }
body.sb-collapsed #collapse svg { transform: rotate(180deg); width: 15px; height: 15px; }
body.sb-collapsed .nav a, body.sb-collapsed .sb-row { padding-left: 17px; }
body.sb-collapsed .sb-user { padding-left: 8px; }

/* topbar */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .2s, background .3s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .titles { min-width: 0; }
.topbar .crumbs { font-size: 12px; color: var(--faint); display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.topbar h1 { font-size: 16.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.topbar .mobile-only { display: none; }

.content { padding: 8px 28px 48px; width: 100%; max-width: 1320px; margin: 0 auto; flex: 1; }
.view-enter { animation: viewIn .38s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.stagger > * { animation: viewIn .42s var(--ease) both; }
.stagger > *:nth-child(2) { animation-delay: .04s; } .stagger > *:nth-child(3) { animation-delay: .08s; }
.stagger > *:nth-child(4) { animation-delay: .12s; } .stagger > *:nth-child(5) { animation-delay: .16s; }
.stagger > *:nth-child(n+6) { animation-delay: .2s; }

.scrim { position: fixed; inset: 0; z-index: 55; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .3s; }

@media (max-width: 1023px) {
  .sidebar { transform: translateX(-104%); width: min(86vw, 300px) !important; box-shadow: var(--shadow-lg); border-right: 0; }
  body.sb-open .sidebar { transform: none; }
  body.sb-open .scrim { opacity: 1; pointer-events: auto; }
  body.sb-open { overflow: hidden; }
  .main, body.sb-collapsed .main { margin-left: 0; }
  body.sb-collapsed .brand-text, body.sb-collapsed .nav a .label, body.sb-collapsed .sb-row .label,
  body.sb-collapsed .sb-user .who, body.sb-collapsed .nav-section, body.sb-collapsed .sb-row .switch { opacity: 1; pointer-events: auto; }
  body.sb-collapsed .nav-section { height: auto; margin: 16px 10px 6px; background: none; }
  #collapse { display: none; }
  #sb-close { display: inline-grid !important; }
  .topbar { padding: 0 16px; padding-top: env(safe-area-inset-top); height: calc(var(--topbar-h) + env(safe-area-inset-top)); }
  .topbar .mobile-only { display: inline-grid; }
  .topbar .desk-only { display: none !important; }
  .content { padding: 6px 16px calc(32px + env(safe-area-inset-bottom)); }
}
@media (min-width: 1024px) { #sb-close { display: none !important; } }

/* =====================================================================
   Components
   ===================================================================== */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin: 14px 0 22px; flex-wrap: wrap; }
.page-head h2 { font-size: 24px; font-weight: 650; letter-spacing: -.022em; }
.page-head p { margin-top: 5px; color: var(--muted); max-width: 640px; }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--primary-ink); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 6px; display: inline-flex; gap: 6px; align-items: center; }
@media (max-width: 640px) {
  .page-head { margin: 8px 0 18px; }
  .page-head h2 { font-size: 21px; }
  .page-head .actions { margin-left: 0; width: 100%; }
  .page-head .actions > .btn { flex: 1; }
}

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-weight: 550; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none !important;
  box-shadow: var(--shadow-xs); transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
}
.btn:hover { background: var(--hover); color: var(--ink); }
.btn:active { transform: scale(.985); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: 0 1px 2px rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }
.btn-soft { background: var(--primary-soft); border-color: transparent; color: var(--primary-ink); box-shadow: none; }
.btn-soft:hover { background: color-mix(in srgb, var(--primary-soft) 70%, var(--primary) 12%); color: var(--primary-ink); }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-bg); border-color: color-mix(in srgb, var(--red) 30%, transparent); color: var(--red); }
.btn-danger.solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--hover); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 8px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }

/* forms */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label, .label-text { font-size: 13px; font-weight: 550; color: var(--ink-2); display: flex; gap: 6px; align-items: center; }
.req { color: var(--red); font-weight: 600; }
.opt { font-size: 11.5px; font-weight: 500; color: var(--faint); background: var(--sunken); padding: 1px 7px; border-radius: 99px; }
.hint { font-size: 12.5px; color: var(--faint); }
.err-text { font-size: 12.5px; color: var(--red); display: none; }
.field.has-error .err-text { display: block; animation: viewIn .2s var(--ease); }
.input, .select {
  height: 42px; padding: 0 13px; width: 100%; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea.input { height: auto; min-height: 92px; padding: 11px 13px; resize: vertical; line-height: 1.5; }
.input::placeholder { color: var(--faint); }
.input:hover, .select:hover { border-color: color-mix(in srgb, var(--line) 60%, var(--muted)); }
.input:focus, .select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.input[readonly] { background: var(--sunken); color: var(--muted); box-shadow: none; }
.field.has-error .input, .field.has-error .select, .input.invalid { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-bg); }
.select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238d99a5' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
input[type="date"].input, input[type="time"].input { font-variant-numeric: tabular-nums; }
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(.8); }
.pw-wrap { position: relative; }
/* hide the browser's own show-password / clear buttons (Edge, IE) so only ours shows */
input::-ms-reveal, input::-ms-clear { display: none; }
.pw-wrap .input { padding-right: 46px; }
.pw-wrap .eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon .input { padding-left: 40px; }

.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 14px; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; cursor: pointer; }
.toggle-card { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.toggle-card:hover { border-color: color-mix(in srgb, var(--line) 50%, var(--primary)); }
.toggle-card input { width: 18px; height: 18px; accent-color: var(--primary); }
.toggle-card strong { display: block; font-size: 14px; font-weight: 600; }
.toggle-card span { font-size: 12.5px; color: var(--muted); }

.grid { display: grid; gap: 16px 18px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
@media (max-width: 1100px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .g-2, .g-3 { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.card-head h3 { font-size: 15px; font-weight: 620; }
.card-head .sub { font-size: 12.5px; color: var(--muted); }
.card-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line-2); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.stack { display: grid; gap: 18px; align-content: start; min-width: 0; }
@media (max-width: 640px) { .card-body { padding: 16px; } .card-head { padding: 14px 16px; } .card-foot { padding: 12px 16px; } }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .stats { gap: 10px; } }
.stat { padding: 18px 20px; position: relative; overflow: hidden; text-decoration: none !important; color: inherit; transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; }
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--line) 50%, var(--primary)); }
.stat .k { font-size: 13px; color: var(--muted); font-weight: 550; display: flex; align-items: center; gap: 9px; }
.stat .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; }
.stat .ic svg { width: 16px; height: 16px; }
.stat .v { font-size: 28px; font-weight: 680; margin-top: 12px; letter-spacing: -.03em; line-height: 1.1; }
.stat .v small { font-size: 15px; font-weight: 550; color: var(--faint); letter-spacing: 0; }
.stat .s { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
@media (max-width: 420px) { .stat { padding: 14px; } .stat .v { font-size: 23px; margin-top: 10px; } .stat .k { font-size: 12px; gap: 7px; } .stat .ic { width: 26px; height: 26px; } }
.tone-green { background: var(--green-bg); color: var(--green); }
.tone-blue { background: var(--blue-bg); color: var(--blue); }
.tone-amber { background: var(--amber-bg); color: var(--amber); }
.tone-red { background: var(--red-bg); color: var(--red); }
.tone-slate { background: var(--slate-bg); color: var(--slate); }
.tone-primary { background: var(--primary-soft); color: var(--primary-ink); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; letter-spacing: .005em; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.b-available, .b-paid { background: var(--green-bg); color: var(--green); }
.b-booked, .b-active { background: var(--blue-bg); color: var(--blue); }
.b-maintenance, .b-partial { background: var(--amber-bg); color: var(--amber); }
.b-unpaid, .b-danger { background: var(--red-bg); color: var(--red); }
.b-completed, .b-member, .b-neutral { background: var(--slate-bg); color: var(--slate); }
.b-cancelled { background: var(--sunken); color: var(--faint); }
.b-admin { background: var(--primary-soft); color: var(--primary-ink); }

/* tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 11px 20px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 13px 20px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; }
.cell-main { font-weight: 580; color: var(--ink); }
.cell-sub { font-size: 12.5px; color: var(--muted); }
@media (max-width: 760px) {
  table.table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
  .table.responsive tr:last-child { border-bottom: 0; }
  .table.responsive td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; align-items: center; gap: 14px; text-align: right; }
  .table.responsive td::before { content: attr(data-l); color: var(--muted); font-size: 12.5px; font-weight: 500; text-align: left; flex: none; }
  .table.responsive td[data-l=""]::before { display: none; }
  .table.responsive td.hide-sm { display: none; }
  .table.responsive td.lead { display: block; text-align: left; padding-bottom: 8px; }
  .table.responsive td.lead::before { display: none; }
}

.toolbar { display: flex; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; align-items: center; }
.toolbar .search { flex: 1 1 240px; }
.toolbar .select { width: auto; min-width: 150px; height: 40px; }
@media (max-width: 640px) { .toolbar .select { flex: 1 1 calc(50% - 5px); min-width: 0; } }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 13px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 550; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: all .18s var(--ease); }
.chip:hover { border-color: color-mix(in srgb, var(--line) 40%, var(--primary)); color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chip .count { font-size: 11.5px; opacity: .7; }

.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--muted); }

.empty { text-align: center; padding: 52px 20px; color: var(--muted); }
.empty .ic { width: 52px; height: 52px; border-radius: 16px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--sunken); color: var(--faint); }
.empty .ic svg { width: 24px; height: 24px; }
.empty strong { display: block; color: var(--ink); font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.empty .btn { margin-top: 16px; }

/* tabs (segmented, sliding indicator) */
.tabs { position: relative; display: inline-flex; padding: 4px; gap: 2px; background: var(--sunken); border-radius: 11px; border: 1px solid var(--line-2); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { position: relative; z-index: 1; height: 34px; padding: 0 15px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-weight: 550; font-size: 13.5px; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; transition: color .2s; }
.tabs button.on { color: var(--ink); }
.tabs .ind { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .32s var(--ease), width .32s var(--ease); }
.tabs .count { font-size: 11px; padding: 0 6px; border-radius: 99px; background: var(--line); color: var(--muted); }
.tab-panel { animation: viewIn .3s var(--ease) both; }

/* key/value */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 550; word-break: break-word; }
@media (max-width: 520px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 10px; } }

.summary-row { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 7px 0; font-size: 14px; }
.summary-row .l { color: var(--muted); }
.summary-row.total { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 14px; font-weight: 650; font-size: 17px; }
.summary-row.total .l { color: var(--ink); }
.divider { height: 1px; background: var(--line-2); margin: 14px 0; }

.note { font-size: 13px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-2); padding: 11px 13px; border-radius: 10px; display: flex; gap: 10px; align-items: flex-start; }
.note svg { color: var(--primary-ink); margin-top: 1px; }
.note.warn { background: var(--amber-bg); border-color: transparent; color: var(--amber); }
.note.warn svg { color: var(--amber); }
.note.err { background: var(--red-bg); border-color: transparent; color: var(--red); }
.note.err svg { color: var(--red); }

.diff { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--sunken); border: 1px solid var(--line-2); border-radius: 9px; padding: 11px 13px; line-height: 1.7; overflow-x: auto; }
.diff .from { color: var(--red); text-decoration: line-through; text-decoration-thickness: 1px; }
.diff .to { color: var(--green); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--sunken); padding: 2px 6px; border-radius: 5px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { position: relative; padding: 0 0 20px 26px; }
.timeline > li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); }
.timeline > li.done::before { background: var(--primary); }
.timeline > li.todo::before { border-color: var(--line); }
.timeline > li::after { content: ""; position: absolute; left: 8px; top: 20px; bottom: 2px; width: 2px; background: var(--line-2); border-radius: 2px; }
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li:last-child::after { display: none; }
.timeline strong { font-weight: 600; font-size: 14px; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.nowrap { flex-wrap: nowrap; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mb-16 { margin-bottom: 16px; }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 20px; align-items: start; }
.sticky { position: sticky; top: calc(var(--topbar-h) + 16px); }
@media (max-width: 1100px) { .two-col { grid-template-columns: minmax(0, 1fr); } .sticky { position: static; } }

/* list rows (dashboard lists) */
.list-row { display: flex; align-items: center; gap: 14px; padding: 13px 20px; border-bottom: 1px solid var(--line-2); color: inherit; text-decoration: none !important; transition: background .12s; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--hover); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow .cell-main { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .end { text-align: right; flex: none; }
@media (max-width: 640px) { .list-row { padding: 12px 16px; } }
.time-pill { flex: none; width: 52px; text-align: center; padding: 6px 0; border-radius: 9px; background: var(--sunken); font-weight: 650; font-size: 13px; }
.time-pill small { display: block; font-size: 10.5px; color: var(--muted); font-weight: 550; text-transform: uppercase; letter-spacing: .04em; }

/* quick actions */
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
@media (max-width: 860px) { .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.quick a { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-weight: 580; text-decoration: none !important; transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; }
.quick a:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--line) 50%, var(--primary)); }
.quick a .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.quick a small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }

/* rooms board */
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.room {
  position: relative; display: flex; flex-direction: column; gap: 6px; min-height: 140px; padding: 16px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-xs);
  transition: transform .22s var(--ease), box-shadow .22s, border-color .22s; overflow: hidden;
}
.room:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.room .bar { position: absolute; inset: 0 0 auto 0; height: 3px; }
.room.s-available .bar { background: var(--green); }
.room.s-booked .bar { background: var(--blue); }
.room.s-maintenance .bar { background: var(--amber); }
.room .no { font-size: 22px; font-weight: 680; letter-spacing: -.03em; line-height: 1.1; }
.room .type { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.room .occ { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px; }
.room .foot { margin-top: auto; padding-top: 6px; display: flex; gap: 8px; }
.room.wide { grid-column: span 2; }
.room.inactive { opacity: .55; }
@media (max-width: 480px) { .room-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .room { padding: 13px; min-height: 128px; } .room .no { font-size: 19px; } }

/* =====================================================================
   Booking wizard
   ===================================================================== */
.steps { display: flex; gap: 0; margin: 0 0 22px; padding: 0; list-style: none; counter-reset: step; }
.steps li { flex: 1; position: relative; display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 550; color: var(--faint); cursor: default; }
.steps li + li { padding-left: 12px; }
.steps li + li::before { content: ""; height: 2px; flex: 0 0 28px; border-radius: 2px; background: var(--line); margin-right: 2px; transition: background .4s var(--ease); }
.steps li .dot { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 650; background: var(--surface); border: 1.5px solid var(--line); color: var(--muted); transition: all .35s var(--ease); }
.steps li.on { color: var(--ink); }
.steps li.on .dot { border-color: var(--primary); color: var(--primary-ink); box-shadow: 0 0 0 4px var(--ring); }
.steps li.done { color: var(--ink-2); cursor: pointer; }
.steps li.done .dot { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.steps li.done + li::before, .steps li.on::before { background: var(--primary); }
@media (max-width: 760px) {
  .steps li .lbl { display: none; }
  .steps li.on .lbl { display: inline; }
  .steps li + li::before { flex: 1 1 auto; min-width: 14px; }
  .steps li { flex: 0 1 auto; }
  .steps li.on { flex: 1 1 auto; }
}
.step-pane { animation: stepIn .38s var(--ease) both; }
.step-pane.back { animation-name: stepBack; }
@keyframes stepIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes stepBack { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
.wizard-foot { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-top: 18px; }
@media (max-width: 1023px) {
  .wizard-foot { position: sticky; bottom: 0; z-index: 30; margin: 18px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .wizard-foot .btn { flex: 1; }
}

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.cat { position: relative; text-align: left; padding: 14px 15px; border-radius: var(--radius); border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color .18s, background .18s, box-shadow .18s, transform .15s; }
.cat:hover { border-color: color-mix(in srgb, var(--line) 40%, var(--primary)); }
.cat:active { transform: scale(.985); }
.cat strong { display: block; font-size: 14.5px; font-weight: 620; }
.cat span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.cat.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--ring); }
.cat.on::after, .pick.on::after { content: ""; position: absolute; top: 11px; right: 11px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center/11px no-repeat;
  animation: pop .3s var(--ease-spring); }

/* date-time blocks */
.dt-wrap { container-type: inline-size; }
.dt-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: stretch; }
@container (max-width: 820px) {
  .dt-grid { grid-template-columns: 1fr 1fr; }
  .dt-mid { grid-column: 1 / -1; order: 3; }
  .nights-pill { flex-direction: row; gap: 8px; width: 100%; justify-content: center; padding: 8px; }
  .nights-pill strong { font-size: 17px; }
}
@container (max-width: 560px) { .dt-grid { grid-template-columns: 1fr; } }
.dt-block { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface-2); position: relative; }
.dt-block.in { border-left: 3px solid var(--green); }
.dt-block.out { border-left: 3px solid var(--blue); }
.dt-title { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 14.5px; margin-bottom: 12px; }
.dt-title .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; }
.dt-title .ic svg { width: 15px; height: 15px; }
.dt-title .right { margin-left: auto; }
.dt-fields { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(132px, 1fr); gap: 10px; }
.dt-fields .field > label { font-size: 12px; color: var(--muted); font-weight: 550; text-transform: uppercase; letter-spacing: .05em; }
.dt-quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.dt-quick .chip { height: 28px; font-size: 12.5px; padding: 0 11px; }
.dt-mid { display: grid; place-items: center; }
.nights-pill { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); min-width: 82px; text-align: center; }
.nights-pill strong { font-size: 22px; font-weight: 700; line-height: 1; letter-spacing: -.03em; }
.nights-pill span { font-size: 11.5px; color: var(--muted); font-weight: 550; }
@media (max-width: 860px) {
  .dt-grid { grid-template-columns: 1fr; }
  .dt-mid { order: 3; }
  .nights-pill { flex-direction: row; gap: 8px; width: 100%; justify-content: center; padding: 8px; }
  .nights-pill strong { font-size: 17px; }
}
@media (max-width: 400px) { .dt-fields { grid-template-columns: minmax(0, 1.2fr) minmax(118px, 1fr); } .dt-block { padding: 13px; } }

/* room picker */
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.pick { position: relative; text-align: left; padding: 12px 13px; min-height: 84px; border-radius: var(--radius); border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color .18s, background .18s, box-shadow .18s, transform .15s; }
.pick:hover:not(.off) { border-color: color-mix(in srgb, var(--line) 40%, var(--primary)); }
.pick:active:not(.off) { transform: scale(.98); }
.pick .no { font-weight: 680; font-size: 16px; letter-spacing: -.02em; }
.pick .t { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.pick .p { font-size: 12.5px; color: var(--ink-2); margin-top: 6px; font-weight: 550; }
.pick .why { font-size: 11.5px; color: var(--amber); margin-top: 6px; font-weight: 550; }
.pick.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--ring); }
.pick.off { cursor: not-allowed; background: var(--sunken); border-style: dashed; }
.pick.off .no, .pick.off .t { color: var(--faint); }
.pick.wide { grid-column: span 2; }
@media (max-width: 420px) { .picker { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; } .pick { padding: 10px; min-height: 76px; } .pick .p { font-size: 12px; } .pick .cur { display: none; } }

.review-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .review-grid { grid-template-columns: 1fr; } }
.review-block { border: 1px solid var(--line-2); border-radius: var(--radius); padding: 16px; background: var(--surface-2); }
.review-block h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.review-block h4 button { font-size: 12.5px; text-transform: none; letter-spacing: 0; }

/* balance hero */
.balance { padding: 20px; }
.balance .lbl { font-size: 13px; color: var(--muted); font-weight: 550; }
.balance .amt { font-size: 34px; font-weight: 700; letter-spacing: -.035em; line-height: 1.15; margin-top: 4px; }
.meter { height: 8px; border-radius: 99px; background: var(--sunken); overflow: hidden; margin: 16px 0 6px; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--green); transition: width .8s var(--ease); }

/* payment methods */
.methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.method { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; font-weight: 580; font-size: 13.5px; color: var(--ink-2); transition: all .18s var(--ease); }
.method svg { width: 20px; height: 20px; color: var(--muted); }
.method.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); box-shadow: 0 0 0 3px var(--ring); }
.method.on svg { color: var(--primary-ink); }
.reveal { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s var(--ease), opacity .3s; opacity: 0; }
.reveal.open { grid-template-rows: 1fr; opacity: 1; }
.reveal > div { overflow: hidden; }

/* =====================================================================
   Overlays
   ===================================================================== */
.modal-wrap { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; background: var(--scrim); animation: fade .2s ease both; }
.modal-wrap.closing { animation: fadeOut .18s ease both; }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); animation: pop .32s var(--ease) both; }
.modal-wrap.closing .modal { animation: popOut .18s ease both; }
.modal.lg { max-width: 780px; }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 4px; }
.modal-head h3 { font-size: 17.5px; font-weight: 650; flex: 1; padding-top: 4px; }
.modal-body { padding: 14px 22px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 18px; border-top: 1px solid var(--line-2); }
@keyframes fade { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes popOut { to { opacity: 0; transform: translateY(6px) scale(.98); } }
@media (max-width: 640px) {
  .modal-wrap { place-items: end stretch; padding: 0; }
  .modal { max-width: none; border-radius: 20px 20px 0 0; max-height: 92vh; border-bottom: 0; animation: sheet .36s var(--ease) both; padding-bottom: env(safe-area-inset-bottom); }
  .modal-wrap.closing .modal { animation: sheetOut .2s ease both; }
  .modal::before { content: ""; width: 38px; height: 4px; border-radius: 4px; background: var(--line); margin: 9px auto 0; flex: none; }
  .modal-foot .btn { flex: 1; }
  @keyframes sheet { from { transform: translateY(100%); } }
  @keyframes sheetOut { to { transform: translateY(100%); } }
}

.toasts { position: fixed; z-index: 300; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 11px; align-items: flex-start; min-width: 260px; max-width: 420px; padding: 13px 16px; border-radius: 12px; background: var(--ink); color: var(--surface); box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; animation: toastIn .4s var(--ease-spring) both; }
.toast svg { margin-top: 1px; }
.toast.ok svg { color: #5ee0a6; }
[data-theme="dark"] .toast.ok svg { color: var(--green); }
.toast.err { background: var(--red); color: #fff; }
.toast.err svg { color: #fff; }
.toast.leaving { animation: toastOut .25s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.97); } }
@media (max-width: 1023px) { .toasts { left: 14px; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); align-items: stretch; } .toast { max-width: none; } }


.menu { position: absolute; z-index: 80; min-width: 210px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); animation: pop .2s var(--ease) both; }
.menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 8px; background: none; cursor: pointer; text-align: left; font-size: 14px; color: var(--ink-2); }
.menu button:hover { background: var(--hover); color: var(--ink); }
.menu button.danger { color: var(--red); }
.menu button.danger:hover { background: var(--red-bg); }
.menu hr { border: 0; border-top: 1px solid var(--line-2); margin: 5px 0; }

/* =====================================================================
   Login
   ===================================================================== */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.auth-art { position: relative; overflow: hidden; padding: 44px 52px; display: flex; flex-direction: column; justify-content: space-between; color: #e3f1ee;
  background: radial-gradient(120% 80% at 0% 100%, #127a6c 0%, transparent 60%), radial-gradient(90% 70% at 100% 0%, #0f5c53 0%, transparent 65%), #0a2e2a; }
.auth-art::before { content: ""; position: absolute; inset: 0; opacity: .14;
  background-image: linear-gradient(rgba(255,255,255,.4) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.4) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(ellipse at 30% 40%, #000 10%, transparent 70%); -webkit-mask-image: radial-gradient(ellipse at 30% 40%, #000 10%, transparent 70%); }
.auth-art > * { position: relative; }
.auth-art .brand-mark { background: rgba(255,255,255,.12); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); color: #fff; }
.auth-art h2 { color: #fff; font-size: 34px; font-weight: 650; line-height: 1.18; letter-spacing: -.03em; max-width: 470px; }
.auth-art p { color: #a9cbc5; max-width: 440px; margin-top: 14px; font-size: 15px; }
.auth-feats { display: grid; gap: 12px; margin-top: 30px; }
.auth-feats div { display: flex; align-items: center; gap: 12px; color: #d3e7e3; font-size: 14.5px; }
.auth-feats svg { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.08); color: #7fe0cf; }
.auth-main { display: grid; place-items: center; padding: 32px 22px; position: relative; }
.auth-box { width: 100%; max-width: 380px; animation: viewIn .5s var(--ease) both; }
.auth-box h1 { font-size: 26px; font-weight: 680; letter-spacing: -.03em; }
.auth-box .sub { color: var(--muted); margin: 8px 0 28px; }
.auth-corner { position: absolute; top: 18px; right: 18px; display: flex; gap: 6px; }
.auth-mobile-brand { display: none; align-items: center; gap: 11px; margin-bottom: 30px; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-mobile-brand { display: flex; }
  .auth-main { place-items: start center; padding-top: max(64px, env(safe-area-inset-top)); }
}
.shake { animation: shake .4s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* boot / setup */
.boot { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.spinner { width: 18px; height: 18px; border: 2px solid color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--sunken) 0%, var(--hover) 50%, var(--sunken) 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 7px; height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.banner { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px 12px; padding: 12px 16px; border-radius: var(--radius); background: var(--amber-bg); color: var(--amber); font-weight: 550; margin: 10px 0 4px; }
@media (max-width: 640px) { .banner { grid-template-columns: auto 1fr; } .banner .btn { grid-column: 1 / -1; } }

.strength { height: 4px; border-radius: 4px; background: var(--sunken); overflow: hidden; margin-top: 2px; }
.strength i { display: block; height: 100%; width: 0; transition: width .3s var(--ease), background .3s; }


/* release notes */
.release + .release { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.release ul { margin: 8px 0 0; padding-left: 18px; color: var(--ink-2); display: grid; gap: 4px; font-size: 13.5px; }

/* global search */
.global-search { position: relative; display: flex; align-items: center; width: min(360px, 32vw); height: 38px; margin-right: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s, width .3s var(--ease); }
.global-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); width: min(440px, 38vw); }
.global-search > svg { position: absolute; left: 11px; color: var(--faint); width: 16px; height: 16px; }
.global-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; padding: 0 8px 0 34px; outline: none; font-size: 14px; }
.global-search input::placeholder { color: var(--faint); }
.global-search kbd { margin-right: 8px; font-family: var(--font); font-size: 11px; color: var(--faint); border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; line-height: 18px; }
.global-search:focus-within kbd { display: none; }
.filter-empty { padding: 36px 20px; }

/* history: month picker (no sideways scrolling) */
.month-picker { padding: 14px 16px 6px; border-bottom: 1px solid var(--line-2); }
.mp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.mp-head strong { font-size: 15px; font-weight: 680; min-width: 44px; text-align: center; }
.mp-head .mp-all { margin-left: auto; }
.mp-head .mp-all.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.mp-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; padding-bottom: 8px; }
.mp-grid button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; transition: all .18s var(--ease); }
.mp-grid button:hover:not(:disabled) { border-color: color-mix(in srgb, var(--line) 40%, var(--primary)); transform: translateY(-1px); }
.mp-grid .mn { font-weight: 620; font-size: 13.5px; color: var(--ink); }
.mp-grid .mc { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mp-grid .mf { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.mp-grid button.on { background: var(--primary); border-color: var(--primary); box-shadow: 0 4px 12px -4px var(--ring); }
.mp-grid button.on .mn, .mp-grid button.on .mc { color: var(--on-primary); }
.mp-grid button:disabled { cursor: default; background: var(--surface-2); border-style: dashed; }
.mp-grid button:disabled .mn { color: var(--faint); }
@media (max-width: 900px) { .mp-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 420px) { .mp-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* history: Excel-style registers */
.sheet-tabs { display: flex; gap: 2px; padding: 8px 10px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; background: var(--surface-2); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.sheet-tabs button { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border: 1px solid transparent; border-bottom: 0; border-radius: 9px 9px 0 0; background: transparent; color: var(--muted); font-weight: 580; font-size: 13.5px; cursor: pointer; position: relative; top: 1px; transition: background .15s, color .15s; }
.sheet-tabs button:hover { color: var(--ink); background: var(--hover); }
.sheet-tabs button.on { background: var(--surface); color: var(--primary-ink); border-color: var(--line); box-shadow: inset 0 2px 0 var(--primary); }
.sheet-tabs .yr { color: var(--faint); font-weight: 500; }
.sheet-tabs .count { font-size: 11px; padding: 0 6px; border-radius: 99px; background: var(--line); color: var(--muted); }
.sheet-tabs button.on .count { background: var(--primary-soft); color: var(--primary-ink); }
.month-block + .month-block { margin-top: 28px; }
.month-block { animation: viewIn .35s var(--ease) both; }
.month-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin: 0 2px 12px; }
.month-head h3 { font-size: 18px; font-weight: 680; letter-spacing: -.02em; }
.month-tots { display: flex; gap: 8px 18px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.month-tots strong { color: var(--ink); font-weight: 650; margin-left: 4px; }
.table.register td, .table.register th { padding-left: 14px; padding-right: 14px; }
.table.register .reg-name { min-width: 220px; }
.table.register td.r { white-space: nowrap; }
.table tr.total-row td { background: var(--surface-2); font-weight: 700; border-top: 1px solid var(--line); }
.table tr.total-row td:first-child { letter-spacing: .05em; font-size: 12.5px; color: var(--muted); }
@media (max-width: 760px) { .table.responsive td.lead-sm { display: block; text-align: left; } .table.responsive td.lead-sm::before { display: none; } .table.responsive tr.total-row td::before { font-weight: 600; } }

.table tr.month-sep td { background: var(--surface-2); font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 9px 20px; }
.table tr.row-flag td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.issues { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.issues span { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 550; color: var(--amber); background: var(--amber-bg); padding: 2px 8px; border-radius: 99px; }
.issues svg { width: 12px; height: 12px; }
.flag-banner { display: flex; gap: 14px 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 16px 18px; margin-bottom: 18px; border-radius: var(--radius-lg); border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent); background: color-mix(in srgb, var(--amber-bg) 70%, var(--surface)); animation: viewIn .4s var(--ease) both; }
@media (max-width: 760px) { .table.responsive tr.month-sep { padding: 0; } .table.responsive tr.month-sep td { display: block; text-align: left; } .table.responsive tr.month-sep td::before { display: none; } .table.responsive tr.row-flag { box-shadow: inset 3px 0 0 var(--amber); } .table.responsive tr.row-flag td:first-child { box-shadow: none; } .flag-banner .row .btn { flex: 1; } }

/* =====================================================================
   Reports & charts
   ===================================================================== */
.chart-wrap { overflow: hidden; padding: 16px 20px 12px; }
.chart { display: block; max-width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--line-2); stroke-width: 1; }
.chart .axis { fill: var(--faint); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; }
.chart .col.hover .hit { fill: var(--hover); }
.chart .bar { transform-box: fill-box; transform-origin: bottom; transform: scaleY(0); transition: transform .7s var(--ease) var(--d, 0ms), opacity .2s; }
.chart.in .bar { transform: scaleY(1); }
.chart .b-soft { fill: var(--primary-soft); stroke: color-mix(in srgb, var(--primary) 45%, transparent); stroke-width: 1; }
.chart .b-main { fill: var(--primary); }
.chart .b-blue { fill: var(--blue); opacity: .85; }
.chart .col.hover .bar { opacity: 1; filter: brightness(1.08); }
.chart-tip { position: fixed; left: 0; top: 0; z-index: 400; pointer-events: none; padding: 9px 12px; border-radius: 10px; background: var(--ink); color: var(--surface); font-size: 12.5px; line-height: 1.5; box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .15s; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart-tip.on { opacity: 1; }
.chart-tip strong { display: block; font-weight: 650; margin-bottom: 2px; }

.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(70px, 130px) 1fr 128px; align-items: center; gap: 12px; font-size: 13.5px; }
.hb-l { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-track { height: 10px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.hb-track i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--primary); transition: width .8s var(--ease) var(--d, 0ms); }
.hb-track i.blue { background: var(--blue); } .hb-track i.green { background: var(--green); }
.hbars.in .hb-track i { width: var(--w); }
.hb-v { font-weight: 600; text-align: right; min-width: 70px; }
.hb-v small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }
@media (max-width: 480px) { .hbar { grid-template-columns: 84px 1fr 104px; gap: 8px; } .hb-v { min-width: 0; } }

.stackbar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--sunken); gap: 2px; }
.stackbar i { display: block; min-width: 0; transform: scaleX(0); transform-origin: left; transition: transform .8s var(--ease); }
.stackbar.in i { transform: scaleX(1); }
.sb-paid { background: var(--green); } .sb-partial { background: var(--amber); } .sb-unpaid { background: var(--red); }
.legend i.sb-paid, .legend i.sb-partial, .legend i.sb-unpaid { width: 9px; height: 9px; border-radius: 3px; }
@media print { .chart .bar, .hb-track i, .stackbar i { transform: none !important; transition: none !important; } .hbars .hb-track i { width: var(--w) !important; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; }
}

@media print {
  .sidebar, .topbar, .tabbar, .no-print, .toasts { display: none !important; }
  .main { margin: 0 !important; } .content { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}
