@font-face {
  font-family: "Manrope";
  src: url("/assets/fonts/manrope-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}

@font-face {
  font-family: "Manrope";
  src: url("/assets/fonts/manrope-latin-ext.woff2") format("woff2");
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --font: "Manrope", Inter, system-ui, sans-serif;
  --bg: #090d0c;
  --bg-elevated: #0e1412;
  --surface: #121917;
  --surface-2: #17201d;
  --surface-3: #1c2723;
  --surface-soft: rgba(255, 255, 255, 0.035);
  --sidebar: #080c0b;
  --border: #26312d;
  --border-strong: #334039;
  --text: #f4f7f5;
  --text-soft: #c3ccc7;
  --muted: #88958f;
  --faint: #64716b;
  --accent: #2fc88e;
  --accent-strong: #19aa74;
  --accent-soft: rgba(47, 200, 142, 0.12);
  --blue: #6a9fba;
  --blue-soft: rgba(106, 159, 186, 0.13);
  --amber: #c9a267;
  --amber-soft: rgba(201, 162, 103, 0.13);
  --red: #c77c78;
  --red-soft: rgba(199, 124, 120, 0.13);
  --violet: #9a8ab7;
  --violet-soft: rgba(154, 138, 183, 0.13);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
  --sidebar-width: 244px;
  --topbar-height: 78px;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f3;
  --bg-elevated: #f8faf8;
  --surface: #ffffff;
  --surface-2: #f0f3f1;
  --surface-3: #e8eeeb;
  --surface-soft: rgba(18, 33, 27, 0.035);
  --sidebar: #fcfdfc;
  --border: #dce3df;
  --border-strong: #cbd5d0;
  --text: #111a17;
  --text-soft: #3d4b45;
  --muted: #697871;
  --faint: #8a9791;
  --accent: #168a60;
  --accent-strong: #0b704c;
  --accent-soft: rgba(22, 138, 96, 0.09);
  --blue: #39748f;
  --blue-soft: rgba(57, 116, 143, 0.09);
  --amber: #926a2e;
  --amber-soft: rgba(146, 106, 46, 0.09);
  --red: #a65350;
  --red-soft: rgba(166, 83, 80, 0.09);
  --violet: #715e91;
  --violet-soft: rgba(113, 94, 145, 0.09);
  --shadow: 0 18px 50px rgba(20, 35, 29, 0.08);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; letter-spacing: 0; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
svg { width: 18px; height: 18px; stroke-width: 1.8; flex: 0 0 auto; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--sidebar-width); display: flex; flex-direction: column; padding: 18px 14px; background: var(--sidebar); border-right: 1px solid var(--border); }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; min-height: 46px; padding: 0 6px 18px; }
.brand-lockup { min-width: 0; display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 38px; height: 38px; display: grid; place-items: center; overflow: hidden; border: 1px solid rgba(47, 200, 142, 0.24); border-radius: 7px; background: var(--accent-soft); }
.brand-logo img { width: 30px; height: 30px; object-fit: contain; }
.brand-lockup strong, .brand-lockup small { display: block; }
.brand-lockup strong { font-size: 15px; font-weight: 750; line-height: 1.1; }
.brand-lockup small { margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.brand-copy { min-width: 0; }
.sidebar-close.icon-button { display: none; }
.primary-nav, .secondary-nav { display: grid; gap: 3px; }
.primary-nav { margin-top: 13px; }
.secondary-nav { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--border); }
.primary-nav a, .secondary-nav a { min-height: 42px; display: flex; align-items: center; gap: 11px; padding: 0 12px; border: 1px solid transparent; border-radius: 6px; color: var(--muted); font-size: 13px; font-weight: 650; transition: color .16s ease, background .16s ease, border-color .16s ease; }
.primary-nav a:hover, .secondary-nav a:hover { color: var(--text); background: var(--surface-soft); }
.primary-nav a.active { color: var(--text); background: var(--accent-soft); border-color: rgba(47, 200, 142, 0.15); }
.primary-nav a.active svg { color: var(--accent); }
.sidebar-user { min-width: 0; display: flex; align-items: center; gap: 9px; margin-top: 14px; padding: 13px 6px 0; border-top: 1px solid var(--border); }
.avatar { width: 32px; height: 32px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--surface-3); color: var(--accent); font-size: 12px; font-weight: 800; }
.sidebar-user-copy { min-width: 0; flex: 1; }
.sidebar-user-copy strong, .sidebar-user-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-copy strong { font-size: 11px; }
.sidebar-user-copy small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.sidebar-scrim { display: none; }

.workspace { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { position: sticky; top: 0; z-index: 30; min-height: var(--topbar-height); display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px clamp(18px, 3vw, 38px); background: color-mix(in srgb, var(--bg) 90%, transparent); border-bottom: 1px solid var(--border); backdrop-filter: blur(18px); }
.topbar-leading { min-width: 0; display: flex; align-items: center; gap: 12px; }
.topbar h1 { margin: 2px 0 0; font-size: 20px; line-height: 1.2; font-weight: 750; }
.eyebrow { margin: 0; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.connection-status { display: inline-flex; align-items: center; gap: 7px; margin-right: 4px; color: var(--muted); font-size: 11px; font-weight: 650; }
.connection-status > span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.menu-button.icon-button { display: none; }

.view-container { width: 100%; max-width: 1680px; margin: 0 auto; padding: 24px clamp(18px, 3vw, 38px) 48px; outline: none; }
.view-loading { min-height: 48vh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); }
.spinner { width: 24px; height: 24px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-button { width: 36px; height: 36px; display: inline-grid; place-items: center; flex: 0 0 auto; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text-soft); cursor: pointer; transition: color .15s ease, background .15s ease, border-color .15s ease; }
.icon-button:hover { color: var(--text); background: var(--surface-2); border-color: var(--border-strong); }
.icon-button.danger:hover { color: var(--red); background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 28%, var(--border)); }
.button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font-size: 12px; font-weight: 750; cursor: pointer; transition: transform .12s ease, background .15s ease, border-color .15s ease; }
.button:hover { background: var(--surface-2); border-color: var(--border-strong); }
.button:active { transform: translateY(1px); }
.button-primary { background: var(--accent); border-color: var(--accent); color: #062018; }
.button-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.button-danger { color: var(--red); background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 25%, var(--border)); }
.button-quiet { background: transparent; }
.button-wide { width: 100%; }
.button[disabled], .icon-button[disabled] { opacity: .5; cursor: not-allowed; }
.spinner-small { width: 15px; height: 15px; }

.view-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.view-header h2 { margin: 0; font-size: 23px; line-height: 1.25; }
.view-header p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.view-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.period-control { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.period-control button { min-height: 30px; padding: 0 11px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 750; cursor: pointer; }
.period-control button.active { background: var(--surface-3); color: var(--text); }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.metric-card { min-width: 0; min-height: 126px; padding: 17px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.metric-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.metric-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 6px; background: var(--surface-3); color: var(--text-soft); }
.metric-icon.accent { color: var(--accent); background: var(--accent-soft); }
.metric-icon.blue { color: var(--blue); background: var(--blue-soft); }
.metric-icon.amber { color: var(--amber); background: var(--amber-soft); }
.metric-icon.red { color: var(--red); background: var(--red-soft); }
.metric-label { margin: 14px 0 5px; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.metric-value { margin: 0; overflow-wrap: anywhere; font-size: 24px; line-height: 1.12; font-weight: 780; }
.metric-comparison { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; color: var(--muted); font-size: 10px; }
.metric-comparison.up { color: var(--accent); }
.metric-comparison.down { color: var(--red); }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .75fr); gap: 12px; }
.content-grid.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { min-width: 0; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.panel-header { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.panel-header h3 { margin: 0; font-size: 13px; }
.panel-header p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.panel-body { padding: 16px; }
.panel-body.flush { padding: 0; }
.dashboard-summary-panel { margin-top: 2px; }
.operational-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.operational-grid > div { min-width: 0; padding: 9px 18px; border-right: 1px solid var(--border); }
.operational-grid > div:last-child { border-right: 0; }
.operational-grid span, .operational-grid strong, .operational-grid small { display: block; }
.operational-grid span { color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; }
.operational-grid strong { margin-top: 7px; overflow-wrap: anywhere; font-size: 19px; }
.operational-grid small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.operational-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--border); border-radius: 7px; background: var(--border); }
.operational-grid.compact > div { padding: 12px; border: 0; background: var(--surface-2); }
.empty-state { min-height: 240px; display: grid; place-content: center; justify-items: center; padding: 30px; text-align: center; color: var(--muted); }
.empty-state .empty-icon { width: 40px; height: 40px; display: grid; place-items: center; margin-bottom: 10px; border-radius: 7px; background: var(--surface-2); }
.empty-state h4 { margin: 0; color: var(--text-soft); font-size: 13px; }
.empty-state p { max-width: 300px; margin: 6px 0 0; font-size: 11px; }

.list-stack { display: grid; }
.list-row { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-time { min-width: 46px; color: var(--text); font-size: 12px; font-weight: 750; }
.list-main { min-width: 0; }
.list-main strong, .list-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-main strong { font-size: 11px; }
.list-main small { margin-top: 3px; color: var(--muted); font-size: 10px; }

.status { display: inline-flex; align-items: center; justify-content: center; min-height: 22px; padding: 0 8px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-soft); background: var(--surface-2); font-size: 9px; font-weight: 750; white-space: nowrap; }
.status::before { content: ""; width: 5px; height: 5px; margin-right: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.status-confirmed, .status-played, .status-paid { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 24%, var(--border)); }
.status-pending, .status-partial { color: var(--amber); background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 24%, var(--border)); }
.status-cancelled, .status-no_show { color: var(--red); background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 24%, var(--border)); }
.status-recurring { color: var(--violet); background: var(--violet-soft); border-color: color-mix(in srgb, var(--violet) 24%, var(--border)); }
.status-unpaid { color: var(--muted); }

.filters { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.filter-field { min-width: 130px; display: grid; gap: 5px; }
.filter-field.grow { min-width: 220px; flex: 1; }
.filter-field > span, .field > span:first-child { color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; }
.input, input, select, textarea { width: 100%; min-height: 38px; border: 1px solid var(--border); border-radius: 6px; outline: none; background: var(--bg-elevated); color: var(--text); padding: 0 11px; transition: border-color .15s ease, box-shadow .15s ease; }
textarea { min-height: 84px; padding-top: 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--faint); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 16px, calc(100% - 11px) 16px; background-size: 4px 4px, 4px 4px; background-repeat: no-repeat; padding-right: 28px; }
.search-input { position: relative; }
.search-input svg { position: absolute; left: 11px; top: 50%; width: 15px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-input input { padding-left: 34px; }
.field { display: grid; gap: 7px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-stack { display: grid; gap: 14px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.form-error { margin: 0; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--red) 25%, var(--border)); border-radius: 6px; background: var(--red-soft); color: var(--red); font-size: 11px; }
.form-hint { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.toggle-row { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.toggle-row:last-child { border-bottom: 0; }
.toggle-copy strong { display: block; font-size: 11px; }
.toggle-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.switch { position: relative; width: 38px; height: 22px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { position: absolute; inset: 0; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface-3); cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .18s ease, background .18s ease; }
.switch input:checked + span { background: var(--accent-soft); border-color: var(--accent); }
.switch input:checked + span::after { background: var(--accent); transform: translateX(16px); }

.table-wrap { width: 100%; overflow: auto; }
.data-table { width: 100%; min-width: 760px; border-collapse: collapse; }
.data-table th { height: 38px; padding: 0 13px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 9px; font-weight: 800; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { height: 53px; padding: 8px 13px; border-bottom: 1px solid var(--border); color: var(--text-soft); font-size: 11px; vertical-align: middle; }
.data-table tbody tr { cursor: pointer; transition: background .12s ease; }
.data-table tbody tr:hover { background: var(--surface-soft); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.cell-main { color: var(--text); font-weight: 700; }
.cell-sub { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.cell-actions { display: flex; justify-content: flex-end; gap: 5px; }
.money-positive { color: var(--accent); font-weight: 750; }
.money-negative { color: var(--red); font-weight: 750; }

.agenda-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.date-navigator { display: flex; align-items: center; gap: 6px; }
.date-title { min-width: 170px; text-align: center; }
.date-title { padding: 0 8px; border: 0; background: transparent; color: var(--text); cursor: pointer; }
.date-title strong { display: block; font-size: 12px; text-transform: capitalize; }
.date-title small { color: var(--muted); font-size: 9px; }
.agenda-legend { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 9px; }
.agenda-legend span { display: inline-flex; align-items: center; gap: 5px; }
.agenda-legend i { width: 7px; height: 7px; border-radius: 2px; background: var(--surface-3); }
.agenda-board { --court-count: 3; display: grid; grid-template-columns: 74px repeat(var(--court-count), minmax(180px, 1fr)); overflow: auto; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.agenda-corner, .agenda-court-head { position: sticky; top: 0; z-index: 5; min-height: 54px; display: flex; align-items: center; padding: 10px; background: var(--surface); border-bottom: 1px solid var(--border); }
.agenda-corner { left: 0; z-index: 6; justify-content: center; color: var(--muted); font-size: 9px; }
.agenda-court-head { border-left: 1px solid var(--border); }
.agenda-court-head strong { font-size: 11px; }
.agenda-court-head small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.agenda-time { position: sticky; left: 0; z-index: 3; min-height: 78px; display: flex; align-items: flex-start; justify-content: center; padding-top: 11px; background: var(--surface); border-bottom: 1px solid var(--border); color: var(--muted); font-size: 10px; font-weight: 700; }
.agenda-cell { position: relative; min-height: 78px; padding: 5px; border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface); }
.agenda-cell:hover { background: var(--surface-soft); }
.agenda-empty { width: 100%; height: 100%; min-height: 66px; display: grid; place-items: center; border: 1px dashed transparent; border-radius: 5px; background: transparent; color: transparent; cursor: pointer; }
.agenda-cell:hover .agenda-empty { color: var(--muted); border-color: var(--border); }
.booking-block { width: 100%; min-height: 66px; display: grid; align-content: center; gap: 3px; padding: 8px 9px; border: 1px solid var(--border-strong); border-left: 3px solid var(--accent); border-radius: 5px; background: var(--surface-2); cursor: pointer; text-align: left; }
.booking-block:hover { background: var(--surface-3); }
.booking-block.pending { border-left-color: var(--amber); }
.booking-block.cancelled, .booking-block.no_show { border-left-color: var(--red); opacity: .65; }
.booking-block.played { border-left-color: var(--blue); }
.booking-block.recurring { box-shadow: inset 0 0 0 1px var(--violet-soft); }
.booking-block strong { overflow: hidden; color: var(--text); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.booking-block small { overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.block-item { border-left-color: var(--faint); background: repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 8px, var(--surface-3) 8px, var(--surface-3) 16px); }

.summary-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--border); border-radius: 7px; background: var(--border); }
.summary-item { padding: 15px; background: var(--surface); }
.summary-item span { display: block; color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; }
.summary-item strong { display: block; margin-top: 6px; font-size: 18px; }
.progress { height: 6px; overflow: hidden; border-radius: 99px; background: var(--surface-3); }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.payment-summary { display: grid; gap: 9px; padding: 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-elevated); }
.payment-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 10px; }
.payment-line strong { color: var(--text); font-size: 12px; }

.action-list { display: grid; gap: 7px; }
.action-row { min-height: 68px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg-elevated); color: var(--text); text-align: left; cursor: pointer; }
.action-row:hover { border-color: var(--border-strong); background: var(--surface-2); }
.action-row > svg:first-child { color: var(--accent); }
.action-row span strong, .action-row span small { display: block; }
.action-row span strong { font-size: 11px; }
.action-row span small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.action-row > svg:last-child { color: var(--muted); }
.confirm-copy { margin: 0; color: var(--text-soft); font-size: 12px; line-height: 1.65; }
.choice-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.choice-field > legend { margin-bottom: 8px; color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.choice-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice-grid label { min-width: 0; }
.choice-grid input { position: absolute; opacity: 0; pointer-events: none; }
.choice-grid label > span { min-height: 43px; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 7px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-elevated); color: var(--muted); font-size: 10px; font-weight: 750; text-align: center; cursor: pointer; }
.choice-grid input:checked + span { border-color: color-mix(in srgb, var(--accent) 48%, var(--border)); background: var(--accent-soft); color: var(--accent); }
.payment-preview { margin: 0; padding: 11px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: 10px; }
.payment-preview strong { margin-left: 4px; color: var(--text); font-size: 13px; }
.inline-details { border: 1px solid var(--border); border-radius: 6px; background: var(--bg-elevated); }
.inline-details summary { min-height: 42px; display: flex; align-items: center; justify-content: space-between; padding: 0 11px; color: var(--text-soft); font-size: 10px; font-weight: 750; cursor: pointer; list-style: none; }
.inline-details summary::-webkit-details-marker { display: none; }
.inline-details summary span { min-width: 21px; min-height: 21px; display: grid; place-items: center; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: 8px; }
.payment-history { padding: 0 11px; border-top: 1px solid var(--border); }
.payment-history > div { min-height: 51px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border); }
.payment-history > div:last-child { border-bottom: 0; }
.payment-history strong, .payment-history small { display: block; }
.payment-history strong { font-size: 10px; }
.payment-history small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.booking-detail { display: grid; gap: 18px; }
.detail-status-row { display: flex; gap: 6px; flex-wrap: wrap; }
.detail-list { display: grid; margin: 0; border-top: 1px solid var(--border); }
.detail-list > div { display: grid; grid-template-columns: 105px minmax(0, 1fr); gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.detail-list dt { color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; }
.detail-list dd { min-width: 0; margin: 0; overflow-wrap: anywhere; color: var(--text-soft); font-size: 10px; text-align: right; }
.detail-actions { display: grid; gap: 7px; }
.status-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; padding-top: 16px; border-top: 1px solid var(--border); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.section-heading h3 { margin: 0; font-size: 13px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.exception-list { display: grid; margin-top: 9px; border-top: 1px solid var(--border); }
.exception-row { min-height: 51px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); }
.exception-row > span { min-width: 0; }
.exception-row strong, .exception-row small { display: block; }
.exception-row strong { font-size: 10px; }
.exception-row small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.history-row { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.history-row > span strong, .history-row > span small { display: block; }
.history-row > span strong { font-size: 10px; }
.history-row > span small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.tag-list { display: flex; gap: 4px; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; min-height: 21px; padding: 0 7px; border: 1px solid color-mix(in srgb, var(--tag-color) 35%, var(--border)); border-radius: 999px; background: color-mix(in srgb, var(--tag-color) 12%, transparent); color: color-mix(in srgb, var(--tag-color) 80%, var(--text)); font-size: 8px; font-weight: 750; }
.tag-large { min-height: 28px; padding: 0 10px; font-size: 10px; }
.tag-gallery { display: flex; gap: 8px; flex-wrap: wrap; padding: 15px 0; border-top: 1px solid var(--border); }
.checkbox-list { display: flex; gap: 7px; flex-wrap: wrap; }
.checkbox-list label { cursor: pointer; }
.checkbox-list input { position: absolute; opacity: 0; pointer-events: none; }
.checkbox-list input:not(:checked) + .tag { filter: saturate(.2); opacity: .45; }
.finance-overview { margin: 12px 0; }
.finance-entries { margin-top: 12px; }
.account-list { display: grid; }
.account-list > div { min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); }
.account-list > div:last-child { border-bottom: 0; }
.account-list span { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; }
.account-list strong { font-size: 12px; }
.settings-subsection { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); }
.row-control { display: flex; align-items: center; justify-content: flex-end; gap: 8px; color: var(--muted); font-size: 10px; }
.hours-control { display: grid; grid-template-columns: auto minmax(100px, 1fr) auto minmax(100px, 1fr); align-items: center; gap: 8px; }
.hours-control > span { color: var(--muted); font-size: 10px; }

.tabs { display: flex; gap: 3px; overflow-x: auto; margin-bottom: 16px; padding-bottom: 1px; border-bottom: 1px solid var(--border); }
.tabs button { min-height: 38px; padding: 0 13px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 10px; font-weight: 750; white-space: nowrap; cursor: pointer; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.settings-section { display: grid; gap: 12px; max-width: 980px; }
.settings-section > header { margin-bottom: 4px; }
.settings-section > header h3 { margin: 0; font-size: 15px; }
.settings-section > header p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.settings-list { border-top: 1px solid var(--border); }
.settings-row { display: grid; grid-template-columns: minmax(180px, .65fr) minmax(0, 1.35fr); gap: 24px; padding: 18px 0; border-bottom: 1px solid var(--border); }
.settings-row-copy strong { display: block; font-size: 11px; }
.settings-row-copy small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.settings-row-control { min-width: 0; }
.integration-status { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.integration-status > small { color: var(--muted); font-size: 9px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px; background: rgba(0, 0, 0, .64); backdrop-filter: blur(5px); }
.modal { width: min(560px, 100%); max-height: min(88vh, 800px); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.modal.modal-wide { width: min(820px, 100%); }
.modal-header { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 17px; border-bottom: 1px solid var(--border); }
.modal-header h2 { margin: 0; font-size: 16px; }
.modal-header p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.modal-body { overflow-y: auto; padding: 17px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 17px; border-top: 1px solid var(--border); background: var(--bg-elevated); }
.drawer-backdrop { align-items: stretch; justify-items: end; padding: 0; }
.drawer { width: min(470px, 100%); height: 100%; max-height: none; border-width: 0 0 0 1px; border-radius: 0; animation: drawer-in .18s ease-out; }
@keyframes drawer-in { from { transform: translateX(18px); opacity: .75; } }

.toast-region { position: fixed; right: 16px; bottom: 16px; z-index: 200; width: min(360px, calc(100vw - 32px)); display: grid; gap: 8px; }
.toast { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border-strong); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow); animation: toast-in .2s ease-out; }
.toast.success > svg { color: var(--accent); }
.toast.error > svg { color: var(--red); }
.toast strong { display: block; font-size: 11px; }
.toast small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

.login-page { display: grid; min-height: 100vh; background: #07100d; }
.login-backdrop { position: fixed; inset: 0; background: linear-gradient(90deg, rgba(5, 15, 11, .82), rgba(5, 15, 11, .95)), url("/assets/img/cancha1.webp") center / cover; filter: saturate(.65); }
.login-shell { position: relative; z-index: 1; width: min(980px, calc(100% - 36px)); margin: auto; display: grid; grid-template-columns: 1fr 420px; align-items: center; gap: clamp(40px, 8vw, 110px); }
.login-brand { color: #f5f8f6; }
.brand-lockup-large .brand-logo { width: 48px; height: 48px; }
.brand-lockup-large strong { font-size: 21px; }
.brand-lockup-large small { color: #93a49c; }
.login-brand > p { max-width: 430px; margin: 24px 0 0; color: #9aa9a2; font-size: 26px; line-height: 1.25; font-weight: 550; }
.login-panel { padding: 28px; border: 1px solid #2a3832; border-radius: 8px; background: rgba(13, 22, 18, .94); box-shadow: 0 30px 80px rgba(0, 0, 0, .35); backdrop-filter: blur(18px); }
.login-panel header h1 { margin: 8px 0 5px; font-size: 25px; }
.login-panel header > p:last-child { margin: 0 0 23px; color: #8f9c96; font-size: 11px; }
.login-panel footer { margin-top: 22px; padding-top: 16px; border-top: 1px solid #26332e; color: #68766f; font-size: 9px; text-align: center; }
.input-action { position: relative; display: block; }
.input-action input { padding-right: 45px; }
.input-action .icon-button { position: absolute; top: 1px; right: 1px; border-color: transparent; background: transparent; }

.error-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.error-panel { width: min(420px, 100%); padding: 30px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); text-align: center; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 800; }
.error-panel h1 { margin: 8px 0; font-size: 52px; }
.error-panel > p:not(.eyebrow) { margin: 0 0 20px; color: var(--muted); }

@media (max-width: 1180px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-close.icon-button, .menu-button.icon-button { display: inline-grid; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .52); }
  body.sidebar-open .sidebar-scrim { display: block; }
  .workspace { margin-left: 0; }
  .connection-status { display: none; }
  .login-shell { grid-template-columns: 1fr; max-width: 440px; }
  .login-brand { display: none; }
  .operational-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--border); }
  .operational-grid > div { border: 0; background: var(--surface); }
}

@media (max-width: 640px) {
  .topbar { min-height: 68px; padding: 10px 13px; }
  .topbar h1 { font-size: 17px; }
  .topbar-actions .button span { display: none; }
  .view-container { padding: 16px 12px 32px; }
  .view-header { align-items: stretch; flex-direction: column; }
  .view-actions { width: 100%; }
  .period-control { width: 100%; overflow-x: auto; }
  .period-control button { flex: 1; }
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 7px; }
  .metric-card { min-height: 112px; padding: 13px; }
  .metric-value { font-size: 19px; }
  .metric-comparison { font-size: 8px; }
  .filters { align-items: stretch; }
  .filter-field, .filter-field.grow { width: 100%; min-width: 0; }
  .agenda-toolbar { align-items: stretch; flex-direction: column; }
  .agenda-legend { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .summary-strip { grid-template-columns: 1fr; }
  .settings-row { grid-template-columns: 1fr; gap: 10px; }
  .integration-status { justify-content: flex-start; flex-wrap: wrap; }
  .choice-grid-three { grid-template-columns: 1fr; }
  .hours-control { grid-template-columns: auto 1fr auto 1fr; }
  .row-control { justify-content: flex-start; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { width: 100%; max-height: 92vh; border-width: 1px 0 0; border-radius: 8px 8px 0 0; }
  .drawer { max-height: 100vh; border-radius: 0; }
}

@media (max-width: 420px) {
  .metrics-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
