/* Beyond Stage bookings. Colours are tokens; dark mode redefines them. */
:root {
  color-scheme: light;
  --bg: #f4f1ee;
  --surface: #ffffff;
  --surface-2: #faf8f6;
  --surface-3: #f1ece8;
  --ink: #1c1716;
  --ink-2: #5a524e;
  --ink-3: #857c77;
  --line: #e6dfda;
  --line-2: #d6cdc7;
  --brand: #a61e28;
  --brand-hover: #8c1820;
  --brand-ink: #ffffff;
  --brand-soft: #f8e7e8;
  --gold: #8a610a;
  --gold-soft: #fbf1db;
  --gold-line: #e3c27a;
  --ok: #1b7343;
  --ok-soft: #e2f2e8;
  --danger: #b42318;
  --danger-soft: #fdeceb;
  --done: #5b6470;
  --done-soft: #eceef1;
  --wa: #1d7f4d;
  --series-collected: #9e1c26;
  --series-pending: #d29a1e;
  --shadow: 0 1px 2px rgba(40, 20, 15, .05), 0 6px 20px rgba(40, 20, 15, .05);
  --radius: 14px;
  --radius-sm: 9px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e0b0b;
    --surface: #181313;
    --surface-2: #1e1818;
    --surface-3: #261f1f;
    --ink: #f4eeea;
    --ink-2: #c2b8b2;
    --ink-3: #938983;
    --line: #2d2524;
    --line-2: #3d3332;
    --brand: #d33c45;
    --brand-hover: #e14f58;
    --brand-ink: #ffffff;
    --brand-soft: #3a1a1d;
    --gold: #e0b452;
    --gold-soft: #33280f;
    --gold-line: #7a5d1f;
    --ok: #5cc98b;
    --ok-soft: #14301f;
    --danger: #ff7a70;
    --danger-soft: #3b1a18;
    --done: #a3acb8;
    --done-soft: #252a31;
    --wa: #3fbf7a;
    --series-collected: #c4323b;
    --series-pending: #c98500;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0b0b;
  --surface: #181313;
  --surface-2: #1e1818;
  --surface-3: #261f1f;
  --ink: #f4eeea;
  --ink-2: #c2b8b2;
  --ink-3: #938983;
  --line: #2d2524;
  --line-2: #3d3332;
  --brand: #d33c45;
  --brand-hover: #e14f58;
  --brand-ink: #ffffff;
  --brand-soft: #3a1a1d;
  --gold: #e0b452;
  --gold-soft: #33280f;
  --gold-line: #7a5d1f;
  --ok: #5cc98b;
  --ok-soft: #14301f;
  --danger: #ff7a70;
  --danger-soft: #3b1a18;
  --done: #a3acb8;
  --done-soft: #252a31;
  --wa: #3fbf7a;
  --series-collected: #c4323b;
  --series-pending: #c98500;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .25);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0; }
small { font-size: 12.5px; }
[hidden] { display: none !important; }
.muted { color: var(--ink-2); }
.block { display: block; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.text-overdue { color: var(--danger); font-weight: 600; }
.text-pending { color: var(--gold); font-weight: 600; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 14px; height: 14px; }

/* ---------- boot and login */

.boot { min-height: 100vh; display: grid; place-items: center; }
.boot img { border-radius: 14px; animation: pulse 1.2s ease-in-out infinite alternate; }
.boot-error { padding: 40px 16px; text-align: center; }
@keyframes pulse { from { opacity: .45; } to { opacity: 1; } }

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(ellipse at 20% 0%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 60%),
    radial-gradient(ellipse at 100% 100%, color-mix(in srgb, var(--gold) 14%, transparent), transparent 55%),
    var(--bg);
}
.login-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 32px 28px;
  display: grid;
  gap: 14px;
}
.login-card h1 { font-size: 22px; margin-top: 6px; }
.login-logo img { height: 20px; width: auto; }

.brand { display: inline-flex; }
.brand img { display: block; }
.logo-dark { display: none !important; }
:root[data-theme="dark"] .logo-light { display: none !important; }
:root[data-theme="dark"] .logo-dark { display: block !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none !important; }
  :root:not([data-theme="light"]) .logo-dark { display: block !important; }
}

/* ---------- shell */

.shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 16px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.sidebar-brand { display: grid; gap: 6px; text-decoration: none; padding: 2px 6px 4px; }
.sidebar-logo img { height: 15px; width: auto; }
.sidebar-app { font-size: 11px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }
.sidebar-nav { display: grid; gap: 2px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink-2);
  font-weight: 550;
}
.sidebar-nav a:hover { background: var(--surface-3); color: var(--ink); }
.sidebar-nav a.active { background: var(--brand-soft); color: var(--brand); }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.who { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.who > span:last-child { display: grid; min-width: 0; line-height: 1.25; }
.who strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { color: var(--ink-3); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand), #5e0f15);
  color: #fff; font-weight: 700; font-size: 14px;
}

main { min-width: 0; }
.page { max-width: 1040px; margin: 0 auto; padding: 32px 32px 64px; }
.page-wide { max-width: 1280px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.block + .block, .hero + .block, .block + .two-col, .two-col + .block { margin-top: 20px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-bottom: 10px; font-weight: 650; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); text-decoration: none; font-weight: 550; margin-bottom: 14px; }
.back:hover { color: var(--ink); }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 120px 16px; color: var(--ink-3); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line-2); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.tabbar { display: none; }

/* ---------- buttons, pills, cards */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn-icon { width: 38px; min-height: 38px; padding: 0; }
.btn-block { width: 100%; }
.btn-wa { margin-top: 16px; color: var(--wa); border-color: color-mix(in srgb, var(--wa) 45%, transparent); }
.btn-wa:hover { background: color-mix(in srgb, var(--wa) 10%, transparent); }
.link { color: var(--brand); font-weight: 600; text-decoration: none; font-size: 13.5px; }
.link:hover { text-decoration: underline; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-sub { margin: -6px 0 12px; font-size: 13.5px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.empty { padding: 18px 4px; text-align: center; color: var(--ink-2); display: grid; gap: 12px; justify-items: center; }
.card.empty { padding: 40px 20px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.6;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill-confirmed { background: var(--brand-soft); color: var(--brand); }
.pill-tentative { background: var(--gold-soft); color: var(--gold); border-color: var(--gold-line); border-style: dashed; }
.pill-completed { background: var(--done-soft); color: var(--done); }
.pill-cancelled { background: var(--surface-3); color: var(--ink-3); text-decoration: line-through; }
.pill-booked { background: var(--brand-soft); color: var(--brand); }
.pill-free { background: var(--ok-soft); color: var(--ok); }
.pill-type { background: var(--surface-3); color: var(--ink-2); }
.count-badge { font-weight: 700; color: var(--danger); font-size: 14px; }

.due { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 650; color: var(--gold); white-space: nowrap; font-variant-numeric: tabular-nums; }
.due-overdue { color: var(--danger); }
.due-paid { color: var(--ok); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 50;
  max-width: calc(100% - 32px);
  padding: 11px 18px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  animation: toast-in .2s ease-out;
  transition: opacity .3s, transform .3s;
}
.toast-error { background: var(--danger); color: #fff; }
.toast-out { opacity: 0; transform: translate(-50%, 8px); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- dashboard */

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 26px 28px;
  background:
    radial-gradient(ellipse at 0% 0%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 70%),
    var(--surface);
}
.hero-label { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); }
.hero-value { font-size: 52px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; margin-top: 6px; }
.hero-split { display: grid; grid-template-columns: repeat(2, minmax(170px, auto)); gap: 12px; }
.hero-split > div { display: grid; gap: 2px; padding: 12px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.hero-split strong { font-size: 20px; }
.hero-split small, .hero-sub-label { color: var(--ink-2); }
.hero-sub-label { font-size: 12.5px; font-weight: 600; }
.hero-split .is-overdue strong { color: var(--danger); }

.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.stat-label { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.stat-value { font-size: 22px; font-weight: 700; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-hint { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

.erows { display: grid; }
.erow {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 11px 8px;
  margin: 0 -8px;
  border-radius: 10px;
  text-decoration: none;
}
.erow + .erow { border-top: 1px solid var(--line); }
.erow:hover { background: var(--surface-2); }
.erow-main { display: grid; min-width: 0; }
.erow-title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.erow-meta { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.erow-side { display: grid; justify-items: end; gap: 4px; }
.erow-cancelled .erow-title { text-decoration: line-through; color: var(--ink-3); }
.datebox {
  width: 50px;
  display: grid;
  justify-items: center;
  line-height: 1.1;
  padding: 6px 0;
  border-radius: 10px;
  background: var(--surface-3);
}
.erow-confirmed .datebox { background: var(--brand-soft); color: var(--brand); }
.erow-tentative .datebox { background: var(--gold-soft); color: var(--gold); }
.datebox-m { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.datebox-d { font-size: 20px; font-weight: 750; }
.datebox-w { font-size: 11px; opacity: .8; }

.year-nav { display: flex; align-items: center; gap: 2px; font-weight: 650; }
.chart { margin: 0; }
.legend { display: flex; align-items: center; gap: 18px; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend .btn { margin-left: auto; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.swatch-collected { background: var(--series-collected); }
.swatch-pending { background: var(--series-pending); }
.chart-plot { position: relative; min-height: 230px; }
.chart-svg { display: block; overflow: visible; }
.chart-svg .grid { stroke: var(--line); stroke-width: 1; }
.chart-svg .axis { stroke: var(--line-2); stroke-width: 1; }
.chart-svg .tick { fill: var(--ink-3); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.chart-svg .bar-collected { fill: var(--series-collected); }
.chart-svg .bar-pending { fill: var(--series-pending); }
.chart-svg .band-hl { fill: var(--surface-3); opacity: 0; transition: opacity .12s; }
.chart-svg .band-hl.on { opacity: 1; }
.chart-svg .hit { fill: transparent; cursor: default; outline: none; }
.chart-tip {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  min-width: 190px;
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
  font-size: 13px;
}
.tip-row { display: flex; justify-content: space-between; gap: 16px; color: var(--ink-2); }
.tip-row span { display: inline-flex; align-items: center; gap: 6px; }
.tip-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
.tip-total { border-top: 1px solid var(--line); padding-top: 4px; margin-top: 2px; }

/* ---------- tables */

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left;
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-3);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.table th.num { text-align: right; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table-card { padding: 4px 8px; overflow-x: auto; }
.strong-link { font-weight: 650; text-decoration: none; }
.strong-link:hover { text-decoration: underline; }
.chart-table td, .chart-table th { padding: 8px 10px; }

/* ---------- filters and segmented controls */

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.segmented { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-3); border: 1px solid var(--line); gap: 2px; }
.segmented > button, .segmented > a, .segmented > label > span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.segmented > label { display: inline-flex; cursor: pointer; }
.segmented > label > input { position: absolute; opacity: 0; pointer-events: none; }
.segmented > .on, .segmented > label > input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.segmented > label > input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 1px; }
.segmented-status .seg-confirmed input:checked + span { color: var(--brand); }
.segmented-status .seg-tentative input:checked + span { color: var(--gold); }
.segmented-status .seg-cancelled input:checked + span { color: var(--ink-3); text-decoration: line-through; }

.search { position: relative; flex: 1; min-width: 220px; max-width: 380px; display: flex; align-items: center; }
.search .icon { position: absolute; left: 12px; color: var(--ink-3); }
.search input { padding-left: 38px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 550; color: var(--ink-2); cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }

.totals { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0 2px 12px; font-size: 14px; color: var(--ink-2); }
.totals strong { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- forms */

input, select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}
textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; }
.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field-hint { font-size: 12.5px; color: var(--ink-3); min-height: 1em; }
.form { display: grid; gap: 16px; }
.form-card { display: grid; gap: 16px; }
.field > .segmented { justify-self: start; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.advance { display: grid; gap: 12px; padding: 16px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line-2); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.form-error { color: var(--danger); font-weight: 600; font-size: 14px; }
.inline-form { display: grid; gap: 12px; padding-top: 14px; margin-top: 12px; border-top: 1px dashed var(--line-2); }
.clash {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--gold-soft);
  border: 1px solid var(--gold-line);
  color: var(--ink);
  font-size: 14px;
}
.clash .icon { color: var(--gold); margin-top: 2px; }
.clash ul { margin: 4px 0 0; padding-left: 18px; }
.clash a { font-weight: 600; }

/* ---------- calendar */

.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-nav, .cal-tools { display: flex; align-items: center; gap: 6px; }
.cal-nav h1 { min-width: 200px; text-align: center; font-size: 24px; }
.cal-tools { gap: 10px; }
.cal-summary { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0 2px 14px; font-size: 14px; color: var(--ink-2); align-items: center; }
.cal-summary span { display: inline-flex; align-items: center; gap: 6px; }
.cal-summary strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.cal-card { padding: 12px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { text-align: center; font-size: 12px; font-weight: 650; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; padding: 6px 0; }
.dow-short { display: none; }
.cal-day {
  position: relative;
  min-height: 108px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  transition: border-color .12s, background .12s;
}
.cal-day:hover { border-color: var(--line-2); background: var(--surface-2); }
.cal-day.is-other { background: transparent; border-color: transparent; }
.cal-day.is-other .cal-num { color: var(--ink-3); opacity: .6; }
.cal-day.is-booked { background: color-mix(in srgb, var(--brand) 7%, var(--surface)); border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); }
.cal-day.is-hold { background: color-mix(in srgb, var(--gold) 8%, var(--surface)); border-color: var(--gold-line); border-style: dashed; }
.cal-day.is-past:not(.is-booked):not(.is-hold) .cal-num { color: var(--ink-3); }
.cal-day.is-selected { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.cal-num { font-size: 13px; font-weight: 650; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.is-today .cal-num { background: var(--brand); color: #fff; }
.cal-chips { display: grid; gap: 3px; min-width: 0; }
.chip {
  display: block;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid transparent;
}
.chip b { font-weight: 700; margin-right: 4px; opacity: .85; }
.chip-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid transparent; }
.chip-confirmed { background: var(--brand); color: #fff; }
.chip-tentative { background: var(--gold-soft); color: var(--gold); border-color: var(--gold-line); border-style: dashed; }
.chip-completed { background: var(--done-soft); color: var(--done); }
.chip-cancelled { background: transparent; color: var(--ink-3); text-decoration: line-through; border-color: var(--line); }
.chip-more { font-size: 11.5px; color: var(--ink-2); font-weight: 600; padding-left: 4px; }
.cal-dots { display: none; }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; border: 0; }
.dot.chip-cancelled { background: var(--line-2); }
.dot.chip-tentative { background: var(--gold); }
.dot.chip-completed { background: var(--done); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 12px 6px 4px; font-size: 13px; color: var(--ink-2); }
.cal-legend span { display: inline-flex; align-items: center; gap: 7px; }
.chip-swatch.chip-cancelled { background: var(--surface-3); border-color: var(--line-2); }
.agenda { position: sticky; top: 20px; display: grid; gap: 14px; }
.agenda .card-head { margin-bottom: 0; align-items: flex-start; }
.agenda-hint { padding: 24px 4px; text-align: center; }
.agenda-free { padding: 6px 0; }

.year-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.mini { padding: 14px; }
.mini-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; text-decoration: none; font-weight: 700; margin-bottom: 8px; }
.mini-title small { color: var(--ink-3); font-weight: 600; }
.mini-title:hover span { color: var(--brand); }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.mini-dow { font-size: 10.5px; font-weight: 700; color: var(--ink-3); padding-bottom: 2px; }
.mini-day {
  font-size: 12px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 6px;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid transparent;
  font-variant-numeric: tabular-nums;
}
.mini-day:hover { background: var(--surface-3); }
.mini-day.is-past { color: var(--ink-3); }
.mini-booked, .mini-day.mini-booked { background: var(--brand); color: #fff; font-weight: 650; }
.mini-day.mini-booked.is-past { background: color-mix(in srgb, var(--brand) 55%, var(--surface)); color: #fff; }
.mini-hold, .mini-day.mini-hold { background: var(--gold-soft); color: var(--gold); border-color: var(--gold-line); border-style: dashed; font-weight: 650; }
.mini-day.is-today { box-shadow: inset 0 0 0 2px var(--ink); }

/* ---------- event page */

.event-head h1 { margin-top: 8px; }
.event-pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.event-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.event-main, .event-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.money-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.money-figs > div { display: grid; gap: 2px; }
.money-figs span { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.money-figs strong { font-size: 26px; font-weight: 700; white-space: nowrap; }
.money-figs .is-pending strong { color: var(--gold); }
.money-figs .is-overdue strong, .money-figs .is-overdue span { color: var(--danger); }
.money-figs .is-paid strong { color: var(--ok); }
.meter { height: 10px; border-radius: 999px; background: color-mix(in srgb, var(--series-collected) 16%, var(--surface-3)); overflow: hidden; margin-top: 18px; }
.meter span { display: block; height: 100%; border-radius: 999px; background: var(--series-collected); }
.meter-label { font-size: 13px; margin-top: 8px; }

.ledger .card-head h2 { flex: 1; }
.ledger-total { font-weight: 700; font-variant-numeric: tabular-nums; }
.ledger-rows { list-style: none; margin: 0; padding: 0; }
.ledger-rows li { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; }
.ledger-rows li + li { border-top: 1px solid var(--line); }
.ledger-date { display: grid; font-weight: 650; font-size: 13.5px; line-height: 1.2; }
.ledger-date small { color: var(--ink-3); font-weight: 500; }
.ledger-main { display: grid; min-width: 0; }
.ledger-main small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profit { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; }

.details dl { margin: 12px 0 0; display: grid; gap: 12px; }
.detail { display: grid; grid-template-columns: 20px 70px minmax(0, 1fr); gap: 10px; align-items: start; }
.detail .icon { color: var(--ink-3); margin-top: 2px; }
.detail dt { color: var(--ink-2); font-size: 13.5px; }
.detail dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.detail dd a { color: var(--brand); text-decoration: none; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.notes { white-space: pre-wrap; margin-top: 10px; color: var(--ink-2); }
.record { font-size: 12.5px; }

.team { list-style: none; margin: 12px 0 0; padding: 0; }
.team li { display: flex; align-items: center; gap: 12px; padding: 10px 0; flex-wrap: wrap; }
.team li + li { border-top: 1px solid var(--line); }
.team-main { display: grid; flex: 1; min-width: 160px; }
.team-actions { display: flex; gap: 6px; }
.card > h2 + p, .card > h2 + .segmented { margin-top: 12px; }
.card > h2 + .segmented { display: inline-flex; }

.show-mobile { display: none; }

/* ---------- responsive */

@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .year-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cal-layout { grid-template-columns: minmax(0, 1fr) 300px; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .tabbar a { display: grid; justify-items: center; gap: 2px; padding: 4px 0; font-size: 11px; font-weight: 600; color: var(--ink-3); text-decoration: none; }
  .tabbar a.active { color: var(--brand); }
  .tabbar .icon { width: 22px; height: 22px; }
  .tabbar .tab-new { justify-self: center; width: 50px; height: 50px; border-radius: 16px; place-items: center; background: var(--brand); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 45%, transparent); }
  .tabbar .tab-new.active { color: #fff; }
  .page { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
  h1 { font-size: 23px; }
  .hide-mobile { display: none !important; }
  .show-mobile { display: block; }
  .two-col, .cal-layout, .event-layout { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: 1fr; padding: 20px; gap: 16px; }
  .hero-value { font-size: 44px; }
  .hero-split { grid-template-columns: 1fr 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis .stat:last-child { grid-column: 1 / -1; }
  .year-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .agenda { position: static; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search { max-width: none; order: 3; flex-basis: 100%; }
  .cal-nav h1 { min-width: 0; font-size: 20px; }
  .cal-head { gap: 10px; }
}

@media (max-width: 640px) {
  .card { padding: 16px; }
  .cal-card { padding: 8px; }
  .cal-grid { gap: 2px; }
  .cal-day { min-height: 52px; padding: 4px 2px; align-items: center; border-radius: 8px; }
  .cal-chips, .dow-long { display: none; }
  .dow-short { display: inline; }
  .cal-dots { display: flex; gap: 3px; justify-content: center; flex-wrap: wrap; }
  .cal-num { width: 24px; height: 24px; font-size: 12.5px; }
  .cal-summary { gap: 4px 14px; font-size: 13px; }
  .money-figs strong { font-size: 18px; }
  .stat-value { font-size: 19px; }
  .hero-split strong { font-size: 17px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .erow { gap: 4px 12px; grid-template-columns: auto minmax(0, 1fr); }
  .erow .datebox { grid-row: span 2; align-self: start; }
  .erow-side { grid-column: 2; display: flex; flex-wrap: wrap; justify-content: flex-start; align-items: center; gap: 6px 10px; }
  .card-head { flex-wrap: wrap; }
  .ledger .card-head h2 { flex-basis: 100%; }
  .ledger .card-head .btn { margin-left: auto; }
  .datebox { width: 44px; }
  .segmented > button, .segmented > a, .segmented > label > span { padding: 5px 10px; }
  .filters .segmented { width: 100%; }
  .filters .segmented > button { flex: 1; justify-content: center; }
  .year-grid { grid-template-columns: minmax(0, 1fr); }
  .detail { grid-template-columns: 20px 62px minmax(0, 1fr); }
}

@media (max-width: 380px) {
  .hero-split { grid-template-columns: 1fr; }
  .money-figs { grid-template-columns: 1fr 1fr; }
  .money-figs > div:last-child { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
