/* Rally — manager dashboard */
body.app { background: var(--bg); font-size: 15px; }
.shell { display: grid; grid-template-columns: 1fr; min-height: 100dvh; }
@media (min-width: 1100px) { .shell { grid-template-columns: 252px minmax(0, 1fr); } }

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--court-900); color: rgba(255, 255, 255, .82);
  display: flex; flex-direction: column; gap: var(--s4);
  padding: var(--s5) var(--s3) var(--s4);
  position: fixed; inset: 0 auto 0 0; width: 272px; z-index: var(--z-drawer);
  transform: translateX(-100%); transition: transform var(--d-slow) var(--ease-out);
  overflow-y: auto;
}
.sidebar.open { transform: none; box-shadow: var(--e3); }
@media (min-width: 1100px) {
  .sidebar { position: sticky; top: 0; height: 100dvh; width: auto; transform: none; transition: none; }
  .side-close, .scrim { display: none !important; }
}
.scrim { position: fixed; inset: 0; background: rgba(8, 20, 16, .5); z-index: calc(var(--z-drawer) - 1); }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 0 var(--s2); }
.brand-light { color: #fff; }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 10px;
  border: 0; background: transparent; color: inherit; cursor: pointer; position: relative;
  transition: background-color var(--d-fast) var(--ease-out);
}
.icon-btn:hover { background: rgba(127, 127, 127, .14); }
.club-switch {
  display: flex; align-items: center; gap: var(--s3); width: 100%; text-align: left;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08); border-radius: var(--r-md);
  padding: 10px 12px; color: #fff; cursor: pointer; transition: background-color var(--d-fast);
}
.club-switch:hover { background: rgba(255, 255, 255, .1); }
.club-logo { width: 36px; height: 36px; border-radius: 10px; background: var(--ball); color: var(--court-900); display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 14px; flex: none; }
.club-meta { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.club-meta strong { font-size: 15px; }
.club-meta small { font-size: 13px; color: rgba(255, 255, 255, .7); }
.side-nav { flex: 1; }
.side-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: var(--s3); min-height: 40px; padding: 0 var(--s3);
  border-radius: 10px; text-decoration: none; font-weight: 500; font-size: 15px; color: rgba(255, 255, 255, .8);
  transition: background-color var(--d-fast), color var(--d-fast);
}
.side-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.side-nav a[aria-current="page"] { background: rgba(217, 242, 74, .14); color: var(--ball); font-weight: 600; }
.side-nav a:focus-visible, .club-switch:focus-visible, .sidebar .icon-btn:focus-visible { outline-color: var(--ball); }
.side-label { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .5); padding: var(--s5) var(--s3) var(--s2); }
.nav-badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-pill); background: var(--ball); color: var(--court-900); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.nav-badge[hidden] { display: none; }
.side-user { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s2) 0; border-top: 1px solid rgba(255, 255, 255, .08); }
.avatar-sm { width: 36px; height: 36px; border-radius: 50%; background: #2B6B57; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.user-meta strong { color: #fff; font-size: 14px; }
.user-meta small { font-size: 12px; color: rgba(255, 255, 255, .65); }

/* ---------- Topbar ---------- */
.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; gap: var(--s3); height: 64px; padding: 0 var(--s4);
  background: rgba(246, 245, 239, .9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
@media (min-width: 768px) { .topbar { padding: 0 var(--s8); } }
@media (min-width: 1100px) { .menu-btn { display: none; } }
.search {
  flex: 1; max-width: 420px; display: flex; align-items: center; gap: var(--s2);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 0 var(--s3) 0 var(--s4); height: 40px; color: var(--muted);
}
.search:focus-within { border-color: var(--court-600); box-shadow: 0 0 0 3px rgba(17, 114, 86, .15); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 15px; color: var(--ink); height: 100%; }
.search kbd { font: 600 12px var(--font-body); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; background: var(--surface-2); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: var(--s2); }
.weather { display: none; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2); padding: 0 var(--s3); }
.weather svg { color: #B7791F; }
@media (min-width: 1200px) { .weather { display: inline-flex; } }
.bell .dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--bg); }
@media (max-width: 560px) { .hide-sm { display: none; } .search kbd { display: none; } .topbar { gap: var(--s2); } .top-actions { gap: 4px; flex: none; } .top-actions .btn { width: 40px; padding: 0; } }

/* ---------- Content ---------- */
.content { padding: var(--s6) var(--s4) var(--s12); max-width: 1480px; width: 100%; margin: 0 auto; display: grid; gap: var(--s6); outline: none; }
@media (min-width: 768px) { .content { padding: var(--s8) var(--s8) var(--s16); } }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s4) var(--s8); }
.date-line { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(18, 112, 63, .15); }
.demo-tag { font-size: 12px; font-weight: 600; color: var(--muted); border: 1px dashed #BDB9AA; border-radius: var(--r-pill); padding: 1px 8px; }
.page-head h1 { font-size: clamp(26px, 3vw, 34px); font-weight: 700; letter-spacing: -0.02em; }
.page-sub { color: var(--ink-2); margin-top: 6px; font-size: 16px; }
.page-sub strong { color: var(--danger); }
.club-facts { display: flex; gap: var(--s2); margin: 0; flex-wrap: wrap; }
.club-facts div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 14px; }
.club-facts dt { font-size: 12px; color: var(--muted); font-weight: 500; }
.club-facts dd { margin: 0; font-weight: 600; font-size: 14px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s5); box-shadow: var(--e1); min-width: 0; }
@media (min-width: 768px) { .card { padding: var(--s6); } }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s4); flex-wrap: wrap; }
.card-title { font-size: 19px; font-weight: 600; }
.card-sub { font-size: 14px; color: var(--muted); margin-top: 2px; }
.mini-title { font-family: var(--font-body); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: var(--s5) 0 var(--s3); }
.sec-head { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s4); }
.sec-head h2 { font-size: 21px; font-weight: 600; }
.count-pill { font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: var(--r-pill); }
.count-pill.danger { background: var(--danger-bg); color: var(--danger); }
.count-pill.ok { background: var(--success-bg); color: var(--success); }

/* KPIs */
.kpis { display: grid; gap: var(--s4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1200px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s4) var(--s5); box-shadow: var(--e1); min-width: 0; }
.kpi-top { display: flex; align-items: center; gap: var(--s2); }
.kpi-icon { width: 32px; height: 32px; border-radius: 9px; background: var(--court-50); color: var(--court-700); display: grid; place-items: center; }
.kpi-icon .icon { width: 18px; height: 18px; }
.kpi-label { font-family: var(--font-body); font-size: 14px; font-weight: 600; color: var(--ink-2); letter-spacing: 0; }
.kpi-value { font-family: var(--font-display); font-size: 32px; font-weight: 700; letter-spacing: -0.02em; margin-top: var(--s2); line-height: 1.1; }
.kpi-line { font-size: 14px; color: var(--ink-2); margin-top: 4px; }
.kpi-line .up { color: var(--success); font-weight: 700; }
.kpi-foot { font-size: 13px; color: var(--muted); margin-top: var(--s2); padding-top: var(--s2); border-top: 1px solid var(--line-2); }
@media (max-width: 480px) { .kpi { padding: var(--s3) var(--s4); } .kpi-value { font-size: 26px; } }

/* ---------- Attention ---------- */
.att-grid { display: grid; gap: var(--s4); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 860px) { .att-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1360px) { .att-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.att {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: var(--s5); box-shadow: var(--e2); display: flex; flex-direction: column; gap: var(--s3);
  animation: card-in var(--d-slow) var(--ease-out) both;
}
.att::before { content: ""; position: absolute; left: -1px; top: 16px; bottom: 16px; width: 4px; border-radius: 0 4px 4px 0; }
.att.danger::before { background: var(--danger); }
.att.warn::before { background: #D99A1E; }
.att.resolved { box-shadow: var(--e1); background: var(--surface-2); }
.att.resolved::before { background: var(--success); }
@keyframes card-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.att-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; }
.att-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: var(--r-pill); }
.att-badge.danger { background: var(--danger-bg); color: var(--danger); }
.att-badge.warn { background: var(--warn-bg); color: var(--warn); }
.att-badge.ok { background: var(--success-bg); color: var(--success); }
.att-badge.neutral { background: var(--line-2); color: var(--ink-2); }
.att-when { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.att h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.att-text { color: var(--ink-2); font-size: 14px; }
.att-status { font-size: 13px; color: var(--muted); }
.att-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: auto; padding-top: var(--s1); }
.clash-list, .coach-list, .wait-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.clash-list li, .coach-list li { display: flex; gap: var(--s3); align-items: flex-start; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line-2); font-size: 14px; }
.clash-list small, .coach-list small, .wait-meta { color: var(--muted); font-size: 13px; }
.clash-list .sw { margin-top: 5px; }
.coach-list li { align-items: center; }
.coach-list li > span:nth-child(2) { flex: 1; }
.suggest { display: flex; gap: var(--s2); align-items: flex-start; font-size: 14px; background: var(--ball-50); border: 1px solid #E3EE9E; color: var(--ink); padding: 10px 12px; border-radius: var(--r-sm); }
.suggest svg { color: #6B7A00; margin-top: 2px; }
.avatar-xs { width: 32px; height: 32px; border-radius: 50%; background: var(--court-100); color: var(--court-700); font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none; }
.wait-row { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) 0; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.wait-row:first-child { border-top: 0; padding-top: 0; }
.wait-main { flex: 1; min-width: 180px; display: grid; gap: 4px; font-size: 14px; }
.wait-main .tag { justify-self: start; margin-top: 2px; }
.wait-act { align-self: center; }

.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: var(--r-pill); white-space: nowrap; }
.tag.ok { background: var(--success-bg); color: var(--success); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.neutral { background: var(--line-2); color: var(--ink-2); }
.tag .icon-sm { width: 13px; height: 13px; }

.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: spin .8s linear infinite; }
.spinner.dark { border-color: rgba(18, 32, 27, .2); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Also list */
.also { margin-top: var(--s4); padding-top: var(--s4); padding-bottom: var(--s2); }
.also .card-title { font-size: 16px; margin-bottom: var(--s2); }
.also-list { list-style: none; margin: 0; padding: 0; display: grid; }
@media (min-width: 1200px) { .also-list { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--s8); } }
.also-item { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.also-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.also-icon .icon { width: 18px; height: 18px; }
.also-icon.warn { background: var(--warn-bg); color: var(--warn); }
.also-icon.neutral { background: var(--line-2); color: var(--ink-2); }
.also-item.is-done .also-icon { background: var(--success-bg); color: var(--success); }
.also-main { flex: 1; min-width: 200px; }
.also-title { font-weight: 600; font-size: 14px; }
.also-item.is-done .also-title { color: var(--muted); font-weight: 500; }
.also-body { font-size: 13px; color: var(--muted); }

/* ---------- Timeline ---------- */
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; border-left: 3px solid; }
.sw.booking { background: var(--t-booking-bg); border-color: var(--t-booking); }
.sw.open { background: var(--t-open-bg); border-color: var(--t-open); }
.sw.league { background: var(--t-league-bg); border-color: var(--t-league); }
.sw.clinic { background: var(--t-clinic-bg); border-color: var(--t-clinic); }
.sw.ladder { background: var(--t-ladder-bg); border-color: var(--t-ladder); }
.sw.shop { background: #F1E7DA; border-color: #8A6A3F; }
.sw.freed { background: repeating-linear-gradient(135deg, #fff, #fff 2px, var(--court-100) 2px, var(--court-100) 4px); border: 1px dashed var(--court-600); }
.sw.conflict { background: var(--danger-bg); border: 2px solid var(--danger); }

.tl-scroll { overflow-x: auto; padding-bottom: var(--s2); scrollbar-width: thin; }
.tl-scroll:focus-visible { outline-offset: -3px; }
.tl { position: relative; min-width: 1360px; --label: 96px; }
.tl-head, .tl-row { display: grid; grid-template-columns: var(--label) 1fr; }
.tl-head { height: 50px; position: relative; }
.tl-corner { font-size: 12px; font-weight: 600; color: var(--muted); align-self: end; padding-bottom: 8px; position: sticky; left: 0; background: var(--surface); z-index: 3; }
.tl-hours { position: relative; border-bottom: 1px solid var(--line); }
.tl-hour { position: absolute; bottom: 8px; transform: translateX(-50%); font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.tl-hour:first-child { transform: none; }
.tl-hour.prime { color: var(--ink); font-weight: 600; }
.tl-prime { position: absolute; top: 0; height: 14px; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6B7A00; border-top: 2px solid var(--ball-600); padding-top: 1px; text-align: center; }
.tl-row { height: 58px; border-bottom: 1px solid var(--line-2); }
.tl-row:last-of-type { border-bottom: 0; }
.tl-court { display: flex; flex-direction: column; justify-content: center; gap: 2px; font-size: 14px; position: sticky; left: 0; background: var(--surface); z-index: 3; padding-right: var(--s2); }
.clash-flag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--danger); }
.clash-flag .icon-sm { width: 13px; height: 13px; }
.tl-lane {
  position: relative;
  background-image: linear-gradient(90deg, var(--line-2) 1px, transparent 1px);
  background-size: calc(100% / 16) 100%;
}
.tl-row.has-clash .tl-lane { background-color: rgba(253, 236, 236, .45); }
.blk {
  position: absolute; top: 6px; bottom: 6px; padding: 4px 8px 4px 9px; margin: 0;
  display: flex; flex-direction: column; justify-content: center; gap: 1px; text-align: left; overflow: hidden;
  border: 0; border-left: 3px solid; border-radius: 7px; cursor: pointer; font: inherit;
  transition: box-shadow var(--d-fast) var(--ease-out), filter var(--d-fast) var(--ease-out);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6); z-index: 2;
}
.blk:hover { box-shadow: 0 4px 12px -4px rgba(18, 32, 27, .25); filter: saturate(1.15); z-index: 3; }
.blk:focus-visible { z-index: 4; outline-offset: 1px; }
.blk-title, .blk-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.blk-title { font-size: 13px; font-weight: 600; line-height: 1.25; }
.blk-sub { font-size: 12px; line-height: 1.25; opacity: .9; }
.t-booking { background: var(--t-booking-bg); color: var(--t-booking); border-color: var(--t-booking); }
.t-open { background: var(--t-open-bg); color: var(--t-open); border-color: var(--t-open); }
.t-league { background: var(--t-league-bg); color: var(--t-league); border-color: var(--t-league); }
.t-clinic, .t-lesson { background: var(--t-clinic-bg); color: var(--t-clinic); border-color: var(--t-clinic); }
.t-ladder { background: var(--t-ladder-bg); color: var(--t-ladder); border-color: var(--t-ladder); }
.t-maint { background: repeating-linear-gradient(135deg, var(--t-maint-bg), var(--t-maint-bg) 6px, #F5F5F2 6px, #F5F5F2 12px); color: var(--t-maint); border-color: var(--t-maint); }
.blk.past { background: #F1F0EA; color: var(--muted); border-color: #B9B6A8; }
.blk.noshow { background: repeating-linear-gradient(135deg, #F7F6F1, #F7F6F1 6px, #EEECE4 6px, #EEECE4 12px); color: var(--muted); border-color: var(--muted); }
.blk.noshow .blk-sub { color: var(--danger); font-weight: 600; opacity: 1; }
.blk.freed { background: repeating-linear-gradient(135deg, #fff, #fff 6px, var(--court-50) 6px, var(--court-50) 12px); color: var(--court-700); border: 1.5px dashed var(--court-600); border-left: 3px solid var(--court-600); }
.blk.alert { box-shadow: inset 0 0 0 2px var(--danger); padding-right: 24px; }
.blk.alert .blk-sub { color: var(--danger); font-weight: 600; opacity: 1; }
.blk.cancelled { background: #F1F0EA; color: var(--muted); border-color: #B9B6A8; text-decoration: line-through; }
.blk.clash { box-shadow: inset 0 0 0 2px var(--danger); top: 3px; bottom: auto; height: calc(50% - 4px); padding-top: 1px; padding-bottom: 1px; flex-direction: row; align-items: center; gap: 6px; }
.blk.clash.lane-b { top: calc(50% + 1px); }
.blk.clash .blk-sub { display: none; }
.blk.clash .blk-title { font-size: 12px; }
.blk-alert { color: var(--danger); display: inline-flex; }
.blk.clash .blk-alert .icon-sm { width: 13px; height: 13px; }
.blk:not(.clash) .blk-alert { position: absolute; top: 5px; right: 6px; }
.blk:not(.clash) .blk-alert .icon-sm { width: 14px; height: 14px; }
.tl-now { position: absolute; top: 40px; bottom: 0; left: calc(var(--label) + (100% - var(--label)) * var(--now) / 100); width: 2px; margin-left: -1px; background: var(--danger); z-index: 1; pointer-events: none; }
.tl-head { z-index: 3; }
.tl-now span { position: absolute; top: -2px; left: 50%; transform: translateX(-50%); background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: var(--r-pill); white-space: nowrap; }
.tl-past { position: absolute; top: 50px; bottom: 0; left: var(--label); width: calc((100% - var(--label)) * var(--now) / 100); background: rgba(246, 245, 239, .35); pointer-events: none; z-index: 1; }

/* ---------- Two column ---------- */
.two-col { display: grid; gap: var(--s6); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 1200px) { .two-col { grid-template-columns: minmax(0, 1.75fr) minmax(320px, 1fr); } .two-col.week { grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); } }

/* Bookings */
.card-head.wrap { align-items: center; }
.bk-tools { display: flex; gap: var(--s2); }
.mini-search { display: flex; align-items: center; gap: 6px; height: 38px; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 0 var(--s3); color: var(--muted); background: var(--surface); }
.mini-search:focus-within { border-color: var(--court-600); box-shadow: 0 0 0 3px rgba(17, 114, 86, .15); }
.mini-search input { border: 0; outline: 0; font: inherit; font-size: 14px; width: 150px; background: transparent; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s4); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 var(--s3);
  border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 500; color: var(--ink-2); cursor: pointer;
  transition: background-color var(--d-fast), border-color var(--d-fast), color var(--d-fast);
}
.chip:hover { border-color: #C9C6B8; }
.chip[aria-pressed="true"] { background: var(--court-800); border-color: var(--court-800); color: #fff; }
.chip-n { font-size: 12px; font-weight: 700; padding: 0 6px; border-radius: var(--r-pill); background: var(--line-2); color: var(--ink-2); }
.chip[aria-pressed="true"] .chip-n { background: rgba(255, 255, 255, .18); color: #fff; }
.table-wrap { margin: 0 calc(var(--s5) * -1); }
@media (min-width: 768px) { .table-wrap { margin: 0 calc(var(--s6) * -1); } }
.bk-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.bk-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.bk-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.bk-table th:first-child, .bk-table td:first-child { padding-left: var(--s6); }
.bk-table th:last-child, .bk-table td:last-child { padding-right: var(--s6); }
.bk-table tbody tr { transition: background-color var(--d-fast); }
.bk-table tbody tr:hover { background: var(--surface-2); }
.bk-table tr.row-alert { background: #FFF7F7; }
.bk-table tr.row-muted td { color: var(--muted); }
.nowrap { white-space: nowrap; }
.row-link { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 4px 0; text-align: left; cursor: pointer; min-height: 36px; }
.row-link strong { display: block; font-weight: 600; }
.row-link small { display: block; color: var(--muted); font-size: 13px; }
.row-link:hover strong { text-decoration: underline; text-underline-offset: 2px; }
.type-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.type-dot.booking { background: var(--t-booking); }
.type-dot.open { background: #8C9A06; }
.type-dot.league { background: var(--t-league); }
.type-dot.clinic, .type-dot.lesson { background: var(--t-clinic); }
.type-dot.ladder { background: var(--t-ladder); }
.pay { font-weight: 500; white-space: nowrap; }
.pay.ok { color: var(--success); }
.pay.warn { color: var(--warn); font-weight: 700; }
.pay.neutral { color: var(--ink-2); }
.link-btn { border: 0; background: none; padding: 4px 2px; color: var(--court-700); font-weight: 600; font-size: 13px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: var(--r-pill); white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.s-done { background: var(--line-2); color: var(--muted); }
.s-playing { background: var(--success-bg); color: var(--success); }
.s-next { background: var(--info-bg); color: var(--info); }
.s-later { background: transparent; color: var(--ink-2); border: 1px solid var(--line); }
.s-conflict { background: var(--danger-bg); color: var(--danger); }
.s-noshow { background: var(--danger-bg); color: var(--danger); }
.s-cancelled { background: var(--line-2); color: var(--muted); }
.s-pending { background: var(--warn-bg); color: var(--warn); }
.empty { padding: var(--s8) var(--s6); text-align: center; color: var(--muted); }

@media (max-width: 720px) {
  .bk-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .bk-table, .bk-table tbody, .bk-table tr, .bk-table td { display: block; }
  .bk-table tr { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; padding: 12px var(--s5); border-bottom: 1px solid var(--line-2); }
  .bk-table td { padding: 0 !important; border: 0; }
  .bk-table td[data-label="Time"] { grid-column: 1; font-weight: 600; }
  .bk-table td[data-label="Court"] { grid-column: 2; color: var(--muted); }
  .bk-table td[data-label="Status"] { grid-column: 3; grid-row: 1; justify-self: end; }
  .bk-table td[data-label="Booking"] { grid-column: 1 / -1; }
  .bk-table td[data-label="Players"] { grid-column: 1; font-size: 13px; color: var(--muted); }
  .bk-table td[data-label="Players"]::before { content: "Players "; }
  .bk-table td[data-label="Payment"] { grid-column: 2 / -1; font-size: 13px; }
}

/* Check-ins */
.meter { height: 10px; background: var(--line-2); border-radius: var(--r-pill); overflow: hidden; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--court-700), var(--court-600)); border-radius: inherit; transition: width var(--d-slow) var(--ease-out); }
.meter-legend { display: flex; gap: var(--s5); margin-top: var(--s2); font-size: 13px; color: var(--muted); }
.meter-legend strong { color: var(--ink); font-size: 15px; margin-right: 2px; }
.arrivals, .recent { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.arrival { border: 1px solid var(--line-2); border-radius: var(--r-md); padding: var(--s3); background: var(--surface-2); }
.arr-head { display: flex; align-items: center; gap: var(--s3); }
.arr-time { font-weight: 700; font-size: 14px; width: 64px; flex: none; }
.arr-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; font-size: 14px; }
.arr-title small { color: var(--muted); font-size: 12px; }
.arr-count { font-weight: 700; font-size: 13px; padding: 2px 8px; border-radius: var(--r-pill); background: var(--line-2); color: var(--ink-2); }
.arr-count.full { background: var(--success-bg); color: var(--success); }
.roster { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s2); padding-left: 76px; }
@media (max-width: 480px) { .roster { padding-left: 0; } }
.pchip {
  display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0 10px; border-radius: var(--r-pill);
  border: 1px dashed #BDB9AA; background: var(--surface); font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer;
  transition: background-color var(--d-fast), border-color var(--d-fast), color var(--d-fast);
}
.pchip:hover { border-color: var(--court-600); color: var(--court-700); }
.pchip[aria-pressed="true"] { background: var(--success-bg); border: 1px solid #A9D9BC; color: var(--success); font-weight: 600; }
.pchip .icon-sm { width: 13px; height: 13px; }
.kiosk { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-top: var(--s2); padding-left: 76px; font-size: 13px; color: var(--muted); }
@media (max-width: 480px) { .kiosk { padding-left: 0; } }
.recent li { display: flex; align-items: center; gap: var(--s3); font-size: 14px; padding: 6px 0; }
.ok-dot { width: 24px; height: 24px; border-radius: 50%; background: var(--success-bg); color: var(--success); display: grid; place-items: center; flex: none; }
.ok-dot .icon-sm { width: 13px; height: 13px; }
.rec-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.rec-main small { color: var(--muted); font-size: 12px; }
.rec-at { font-size: 12px; color: var(--muted); }

/* Revenue */
.rev-total { text-align: right; }
.rev-total strong { display: block; font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; }
.delta.up { color: var(--success); }
.rev-body { display: grid; gap: var(--s6); }
@media (min-width: 760px) { .rev-body { grid-template-columns: minmax(0, 1.5fr) minmax(200px, 1fr); align-items: start; } }
.chart { margin: 0; }
.chart-legend { display: flex; gap: var(--s4); font-size: 13px; color: var(--ink-2); margin-bottom: var(--s2); flex-wrap: wrap; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.lg-this { background: var(--court-700); }
.lg-last { background: transparent; border: 1.5px dashed #8E9A94; }
.lg-today { background: var(--ball-600); }
.rev-svg { width: 100%; height: auto; overflow: visible; }
.rev-svg .grid { stroke: var(--line-2); stroke-width: 1; }
.rev-svg .axis { font: 500 12px var(--font-body); fill: var(--muted); }
.rev-svg .axis.strong { fill: var(--ink); font-weight: 700; }
.rev-svg .val { font: 600 11px var(--font-body); fill: var(--ink-2); }
.rev-svg .bar-this { fill: var(--court-700); }
.rev-svg .bar-today { fill: var(--ball-600); stroke: #8C9A06; stroke-width: 1; }
.rev-svg .bar-last { fill: #F1F0EA; stroke: #8E9A94; stroke-width: 1.5; stroke-dasharray: 4 3; }
.rev-mix ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.rev-mix .mini-title { margin-top: 0; }
.mix-row { display: flex; justify-content: space-between; gap: var(--s2); font-size: 13px; color: var(--ink-2); }
.mix-row > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.mix-row strong { color: var(--ink); }
.mix-bar { height: 6px; background: var(--line-2); border-radius: var(--r-pill); margin-top: 6px; overflow: hidden; }
.mix-bar span { display: block; height: 100%; border-radius: inherit; }
.mix-bar .booking { background: var(--t-booking); }
.mix-bar .clinic { background: var(--t-clinic); }
.mix-bar .open { background: #8C9A06; }
.mix-bar .league { background: var(--t-league); }
.mix-bar .shop { background: #8A6A3F; }

/* No-shows */
#noshows { outline: none; }
#noshows:focus-visible { box-shadow: 0 0 0 3px var(--court-600); }
.ns-rate { font-size: 14px; color: var(--ink-2); margin: calc(var(--s2) * -1) 0 var(--s3); }
.ns-list { list-style: none; margin: 0; padding: 0; }
.ns-row { display: flex; align-items: center; gap: var(--s3); padding: 10px 0; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.ns-when { width: 64px; flex: none; display: flex; flex-direction: column; line-height: 1.25; font-size: 13px; }
.ns-when small { color: var(--muted); font-size: 12px; }
.ns-main { flex: 1; min-width: 140px; display: flex; flex-direction: column; line-height: 1.3; font-size: 14px; }
.ns-main small { color: var(--muted); font-size: 12px; }
.ns-act { display: flex; gap: 4px; }

.app-foot { font-size: 13px; color: var(--muted); text-align: center; padding-top: var(--s4); }
.app-foot a { color: var(--court-700); font-weight: 600; }

/* ---------- Drawer ---------- */
.drawer-scrim { position: fixed; inset: 0; background: rgba(8, 20, 16, .4); z-index: calc(var(--z-modal) - 1); opacity: 0; transition: opacity var(--d-med) var(--ease-out); }
.drawer-scrim.open { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); z-index: var(--z-modal);
  background: var(--surface); box-shadow: var(--e3); display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform var(--d-slow) var(--ease-out);
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); padding: var(--s6); border-bottom: 1px solid var(--line); }
.drawer-kicker { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.drawer-head h2 { font-size: 22px; font-weight: 600; }
.drawer-body { padding: var(--s6); overflow-y: auto; display: grid; gap: var(--s4); align-content: start; }
.dl { margin: 0; display: grid; gap: 0; }
.dl div { display: grid; grid-template-columns: 120px 1fr; gap: var(--s3); padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; }
.d-roster { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.d-roster li { display: flex; justify-content: space-between; align-items: center; }
.drawer-note { font-size: 14px; color: var(--ink-2); background: var(--court-50); padding: var(--s3); border-radius: var(--r-sm); }
.drawer-actions { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s2); }

/* ---------- Modal ---------- */
.modal { border: 0; border-radius: var(--r-xl); padding: 0; width: min(560px, calc(100% - 32px)); box-shadow: var(--e3); color: var(--ink); }
.modal::backdrop { background: rgba(8, 20, 16, .5); }
.modal[open] { animation: modal-in var(--d-med) var(--ease-out); }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal form { padding: var(--s6); display: grid; gap: var(--s4); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s4); }
.modal-head h2 { font-size: 21px; font-weight: 600; }
.modal-sub { color: var(--ink-2); font-size: 15px; }
.options { border: 0; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.opt { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer; transition: border-color var(--d-fast), background-color var(--d-fast); }
.opt:hover { border-color: #C9C6B8; }
.opt:has(input:checked) { border-color: var(--court-600); background: var(--court-50); box-shadow: inset 0 0 0 1px var(--court-600); }
.opt:has(input:disabled) { cursor: not-allowed; background: var(--surface-2); }
.opt:has(input:disabled) strong { color: var(--muted); }
.opt input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--court-700); flex: none; }
.opt-body { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.opt-body small { color: var(--muted); font-size: 13px; }
.check-row { display: flex; align-items: center; gap: var(--s2); font-size: 14px; color: var(--ink-2); cursor: pointer; min-height: 36px; }
.check-row input { width: 18px; height: 18px; accent-color: var(--court-700); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--s2); flex-wrap: wrap; padding-top: var(--s2); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: var(--s4); bottom: var(--s4); left: var(--s4); z-index: var(--z-toast); display: flex; flex-direction: column; align-items: flex-end; gap: var(--s2); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: var(--s3); max-width: 440px;
  background: var(--court-900); color: #fff; padding: 12px 8px 12px 16px; border-radius: var(--r-md); box-shadow: var(--e3); font-size: 14px;
  animation: toast-in var(--d-med) var(--ease-out);
}
.toast > .icon { color: var(--ball); }
.toast.warn > .icon { color: #FFC66B; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity 150ms var(--ease-in), transform 150ms var(--ease-in); }
.toast-msg { flex: 1; }
.toast-undo { border: 0; background: rgba(255, 255, 255, .12); color: var(--ball); font-weight: 700; font-size: 13px; padding: 6px 12px; border-radius: var(--r-pill); cursor: pointer; }
.toast-undo:hover { background: rgba(255, 255, 255, .2); }
.toast-x { border: 0; background: none; color: rgba(255, 255, 255, .7); width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; }
.toast-x:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.toast :focus-visible { outline-color: var(--ball); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .att, .modal[open], .toast { animation: none; }
  .spinner { animation-duration: 1.6s !important; animation-iteration-count: infinite !important; }
}

/* Keep anchor targets clear of the sticky topbar */
#schedule, #bookings, #checkins, #week, #attention, #noshows { scroll-margin-top: 80px; }
