/* Rally · the manager's day. Built on app-base.css (the tasteskill app foundation), framed-sheet style.
   Grid arithmetic at 1440: 1440 − 232 sidebar − 8 inset = 1200 sheet; − 2 edge − 2 × 24 padding = 1150 content;
   main column 1150 − 24 gap − 384 rail = 742. One gutter (16) inside each column, 24 between the columns. */
:root {
  --fs-small: 13px;
  /* the frame is tinted from Rally's bottle ink; the sheet stays white */
  --ground: #eef2ef;
  --surface: #ffffff;
  --raised: #f4f6f4;
  --active: #dfe6e1;
  --border: #e2e7e3;
  --rule: #edf0ee;
  --control: #c9d1cc;
  --text: #0d2a1c;
  --muted: #4b5a52;
  --faint: #5c6a62;
  --accent: #2f7a52;            /* court green: the bookings, the now line, focus */
  --positive: #2f7a52;          /* a green accent is also --positive */
  --pill-positive-bg: #dcefe3; --pill-positive-ink: #0f3b23;
  --primary: #0d2a1c; --primary-ink: #ffffff;
  --ball: #f6e016;              /* Rally's yellow: the mark and open play */
  --open-fill: #f8ef9c;
  --book-fill: #dcebe1;
  --league-fill: #c9d4cd;
  --chart-1: var(--accent);
  --chart-muted: #c6cfc9;
  --grid: #e6eae7;
  --axis-ink: var(--faint);

  --font: "General Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fs-title: 24px; --fs-section: 16px; --fs-kpi: 24px; --fs-body: 14px; --fs-small: 12px;
  --sidebar-width: 232px;
  --pad: 24px; --gap: 16px; --card-pad: 20px;
  --radius-card: 8px; --radius-control: 6px; --radius-sheet: 16px;
}

body { background: var(--ground); font-feature-settings: "tnum" 0; }
.num, table, .kpi-value, .tnum { font-variant-numeric: tabular-nums; }

/* ---------- shell: the L-frame and the sheet ---------- */
.app { grid-template-columns: var(--sidebar-width) minmax(0, 1fr); grid-template-rows: 48px minmax(0, 1fr); }
.sidebar { grid-row: 1 / 3; padding: 14px 12px 16px; gap: 1px; }
.topbar { display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 16px 0 0; }
.sheet { min-width: 0; margin: 0 8px 8px 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sheet); padding: var(--pad); }

.brand { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 8px; font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.brand svg { width: 22px; height: 22px; flex: none; }
.club { display: flex; align-items: center; gap: 10px; width: 100%; margin: 10px 0 8px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); text-align: left; cursor: pointer; transition: border-color var(--t-hover) ease; }
.club:hover { border-color: var(--control); }
.club .crest { width: 28px; height: 28px; flex: none; border-radius: 6px; background: var(--text); color: var(--ball); display: grid; place-items: center; font-weight: 600; font-size: 12px; }
.club b { display: block; font-weight: 600; line-height: 18px; }
.club span { display: block; color: var(--faint); font-size: 13px; line-height: 18px; }
.club svg { margin-left: auto; width: 14px; height: 14px; color: var(--faint); }
.sidebar .close-nav { display: none; position: absolute; top: 10px; right: 10px; }
.nav-item .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--pill-negative-bg); color: var(--pill-negative-ink); font-size: 12px; font-weight: 500; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.nav-item .count.quiet { background: var(--active); color: var(--text); }
.user { display: flex; align-items: center; gap: 10px; padding: 8px; }
.avatar { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; background: hsl(var(--h, 150) 45% 88%); color: hsl(var(--h, 150) 45% 22%); }
.user b { display: block; font-weight: 500; line-height: 18px; }
.user span { display: block; color: var(--faint); font-size: 13px; line-height: 18px; }

.search { display: flex; align-items: center; gap: 8px; width: min(548px, 50%); height: 32px; margin: 0 auto; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--faint); }
.search svg { width: 14px; height: 14px; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.search input::placeholder { color: var(--faint); }
.search kbd { font: inherit; font-size: 12px; color: var(--faint); padding: 0 6px; border: 1px solid var(--border); border-radius: 4px; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; transition: background-color var(--t-hover) ease; }
.icon-btn:hover { background: var(--active); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }
.topbar .right { display: flex; align-items: center; gap: 4px; }
.topbar .phone-title { display: none; font-weight: 600; }
.topbar .menu-toggle { display: none; }

/* ---------- title row ---------- */
.title-row { align-items: flex-end; margin-bottom: 24px; }
.title-row h1 { font-weight: 600; }
.title-row .sub { margin-top: 6px; font-size: 15px; line-height: 22px; color: var(--text); max-width: 72ch; }
.title-row .sub .date { color: var(--muted); }
.title-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.btn { height: 32px; }
.btn svg { width: 14px; height: 14px; }
.btn.primary:hover { background: #1b3d2c; }
.btn[disabled] { cursor: not-allowed; color: var(--faint); background: var(--raised); border-color: var(--border); }

/* ---------- the layout: main column and the 384px rail ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 384px; grid-template-areas: "kpis rail" "sheet rail" "lower rail"; grid-template-rows: auto auto 1fr; column-gap: 24px; row-gap: var(--gap); align-items: start; }
.kpis { grid-area: kpis; }
.court-panel { grid-area: sheet; }
.lower { grid-area: lower; display: grid; gap: var(--gap); }
.rail { grid-area: rail; display: grid; gap: 0; align-content: start; }

.kpi { padding: 14px 18px 14px; }
.kpi-label { font-size: 13px; line-height: 18px; }
.kpi-value { margin-top: 4px; font-size: var(--fs-kpi); font-weight: 500; line-height: 30px; }
.kpi-value small { font-size: 15px; }
.delta { font-size: 13px; line-height: 18px; margin-top: 4px; color: var(--muted); }
.delta .bad { color: var(--negative); font-weight: 500; }
.delta .good { color: var(--positive); font-weight: 500; }

.panel > header { margin-bottom: 14px; }
.panel h2 { font-size: var(--fs-section); }
.panel .meta { color: var(--faint); }

/* ---------- the court sheet ---------- */
.court-panel { position: relative; padding: 16px 20px 18px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.court-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.court-head .left { display: flex; align-items: baseline; gap: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 12px; padding: 0; list-style: none; color: var(--muted); font-size: 13px; line-height: 18px; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 18px; height: 10px; border-radius: 3px; flex: none; }
.sheet-scroll { position: relative; }
.cs { position: relative; --label: 112px; }
.cs-head { position: relative; height: 34px; margin-left: var(--label); }
.cs-hour { position: absolute; top: 14px; font-size: 12px; line-height: 16px; color: var(--faint); transform: translateX(-50%); white-space: nowrap; }
.cs-hour.first { transform: none; }
.cs-prime { position: absolute; top: 0; height: 12px; font-size: 12px; line-height: 12px; color: var(--accent); font-weight: 500; white-space: nowrap; }
.cs-now-label { position: absolute; top: -2px; transform: translateX(-50%); padding: 0 6px; height: 18px; line-height: 18px; border-radius: 4px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 500; white-space: nowrap; z-index: 3; }
.cs-body { position: relative; }
.cs-row { position: relative; display: flex; border-top: 1px solid var(--rule); }
.cs-row:last-child { border-bottom: 1px solid var(--rule); }
.cs-name { flex: none; width: var(--label); padding: 7px 8px 0 0; }
.cs-name b { display: block; font-weight: 500; line-height: 18px; }
.cs-name span { display: block; color: var(--faint); font-size: 13px; line-height: 16px; }
.cs-track { position: relative; flex: 1; }
.cs-layer { position: absolute; inset: 0 0 0 var(--label); pointer-events: none; }
.cs-past { position: absolute; top: 0; bottom: 0; left: 0; background: var(--raised); }
.cs-primeband { position: absolute; top: 0; bottom: 0; background: rgb(47 122 82 / 0.06); }
.cs-hourline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--rule); }
.cs-now { position: absolute; top: -20px; bottom: 0; width: 2px; margin-left: -1px; background: var(--accent); z-index: 2; }
.cs-bars { position: absolute; inset: 0 0 0 var(--label); }
.bar { position: absolute; display: flex; flex-direction: column; justify-content: center; gap: 0; min-width: 0; padding: 0 8px; border: 0; border-radius: 4px; text-align: left; font-size: 13px; line-height: 16px; color: var(--text); background: var(--book-fill); cursor: pointer; overflow: hidden; transition: transform var(--t-press) var(--ease-out), outline-color var(--t-hover) ease; }
.bar span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .t2 { color: var(--muted); }
.bar:hover { outline: 1px solid var(--text); outline-offset: 0; }
.bar:active { transform: translateY(1px); }
.bar[aria-pressed="true"] { outline: 2px solid var(--text); outline-offset: 1px; }
.bar.booking { border-left: 3px solid var(--accent); padding-left: 7px; }
.bar.open { background: var(--open-fill); }
.bar.league { background: var(--league-fill); }
.bar.clinic { background: var(--surface); border: 1px solid #7d8b83; padding-left: 7px; }
.bar.maint { background: var(--raised) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6'%3E%3Cpath d='M-1 7 7 -1' stroke='%23b9c3bd' stroke-width='1'/%3E%3C/svg%3E"); color: var(--muted); }
.bar.issue { background: var(--pill-negative-bg); color: var(--pill-negative-ink); border: 1.5px solid var(--negative); padding-left: 7px; }
.bar.issue .t2 { color: var(--pill-negative-ink); }
.bar.past { opacity: 0.72; }
.bar.held { background: var(--surface); border: 1.5px dashed var(--accent); padding-left: 7px; color: var(--accent); }
.bar.flash { animation: flash 900ms var(--ease-out); }
@keyframes flash { from { transform: scale(1.04); } to { transform: none; } }
.free-slot { position: absolute; border: 1px dashed var(--accent); border-radius: 4px; color: var(--accent); font-size: 12px; line-height: 15px; padding: 0 8px; display: flex; align-items: center; background: var(--surface); }
.free-slot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; color: var(--faint); font-size: 13px; line-height: 18px; }

/* popover for a selected bar: it floats over the sheet */ /* taste-skill-ignore */
.pop { position: absolute; z-index: 30; width: 300px; padding: 14px 16px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 10px 28px rgb(13 42 28 / 0.16); /* taste-skill-ignore: overlay */ opacity: 0; transform: translateY(4px); transition: opacity var(--t-ui) ease, transform var(--t-ui) var(--ease-out); pointer-events: none; }
.pop.open { opacity: 1; transform: none; pointer-events: auto; }
.pop h3 { font-size: 14px; line-height: 20px; font-weight: 600; padding-right: 24px; }
.pop dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin-top: 8px; font-size: 13px; line-height: 18px; }
.pop dt { color: var(--faint); }
.pop .actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.pop .close { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; }

/* ---------- rail: what needs the manager ---------- */
.rail-h { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 8px; font-size: 16px; line-height: 22px; font-weight: 600; }
.rail-h .meta { font-size: 13px; font-weight: 400; color: var(--faint); }
.rail-h + .panel, .rail .panel + .panel { margin-top: 0; }
.rail .group { display: grid; gap: 8px; }
.rail .group + .rail-h { margin-top: 20px; }
.issue-card { padding: 16px 18px; }
.issue-card h3 { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; line-height: 20px; font-weight: 600; }
.issue-card h3 .dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--negative); flex: none; }
.issue-card h3 .dot.warn { background: #c27803; }
.issue-card h3 .when { margin-left: auto; color: var(--faint); font-weight: 400; font-size: 13px; white-space: nowrap; }
.issue-card p { margin-top: 6px; color: var(--muted); font-size: 13px; line-height: 19px; }
.clash { display: grid; gap: 0; margin-top: 10px; }
.clash > div { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; padding: 8px 0; border-top: 1px solid var(--rule); font-size: 13px; line-height: 18px; }
.clash > div:last-child { border-bottom: 1px solid var(--rule); }
.clash b { font-weight: 500; }
.clash .sub { grid-column: 1 / -1; color: var(--faint); font-size: 13px; line-height: 18px; }
.clash .tnum { color: var(--muted); }
.issue-card .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.issue-card .done { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; padding: 8px 10px; border-radius: 6px; background: var(--pill-positive-bg); color: var(--pill-positive-ink); font-size: 13px; line-height: 18px; }
.issue-card .done svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.issue-card.resolved h3 .dot { background: var(--positive); }
.people { display: grid; margin-top: 8px; }
.person { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; min-height: 48px; padding: 8px 0; border-top: 1px solid var(--rule); }
.person b { display: block; font-weight: 500; font-size: 13px; line-height: 18px; }
.person span.s { display: block; color: var(--faint); font-size: 13px; line-height: 18px; }
.person .btn { height: 28px; padding: 0 10px; font-size: 13px; }
.status-line { font-size: 13px; line-height: 18px; color: var(--faint); margin-top: 8px; }

/* ---------- lower main: check-in and the week ---------- */
.ci-table td, .ci-table th { padding-left: 0; padding-right: 12px; }
.ci-table td:last-child, .ci-table th:last-child { padding-right: 0; text-align: right; }
.ci-table td { padding-top: 10px; padding-bottom: 10px; vertical-align: middle; }
.ci-table .when { width: 76px; color: var(--muted); white-space: nowrap; }
.ci-table .court { width: 92px; color: var(--muted); white-space: nowrap; }
.ci-table .count { width: 84px; text-align: right; white-space: nowrap; }
.ci-table .count .of { color: var(--faint); }
.ci-table .act { width: 104px; }
.ci-table .btn { height: 28px; padding: 0 10px; font-size: 13px; }
.ci-table .late { display: block; color: var(--negative); font-size: 13px; line-height: 18px; }
.panel .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; color: var(--faint); font-size: 13px; }

.week { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0 28px; }
.week h3 { font-size: 14px; line-height: 20px; font-weight: 500; }
.week .chart-head { margin-bottom: 4px; }
.mini-legend { display: flex; gap: 12px; color: var(--muted); font-size: 13px; }
.mini-legend i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 2px; vertical-align: 0; }
.sources { display: grid; gap: 0; margin-top: 12px; }
.sources div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 13px; line-height: 18px; border-top: 1px solid var(--rule); }
.sources div span:first-child { color: var(--muted); }
.ns-list { display: grid; margin-top: 8px; }
.ns { display: grid; grid-template-columns: 84px 1fr auto; gap: 0 10px; padding: 8px 0; border-top: 1px solid var(--rule); font-size: 13px; line-height: 18px; }
.ns .d { white-space: nowrap; }
.ns .d { color: var(--muted); }
.ns .s { grid-column: 2 / -1; color: var(--faint); font-size: 13px; line-height: 18px; }
.ns .f { text-align: right; color: var(--muted); }
.ns.repeat b::after { content: " · 2nd this week"; font-weight: 400; color: var(--negative); }

.feed { display: grid; }
.feed div { display: grid; grid-template-columns: 58px 1fr; gap: 0 10px; padding: 8px 0; border-top: 1px solid var(--rule); font-size: 13px; line-height: 18px; }
.feed div:first-child { border-top: 0; }
.feed .t { color: var(--faint); }
.feed .w { grid-column: 2; color: var(--faint); font-size: 13px; line-height: 18px; }
.coach-row { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; padding: 8px 0; border-top: 1px solid var(--rule); font-size: 13px; line-height: 18px; }
.coach-row:first-child { border-top: 0; }
.coach-row span { color: var(--faint); font-size: 13px; }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translate(-50%, 12px); max-width: min(520px, calc(100vw - 32px)); padding: 10px 14px; border-radius: 8px; background: var(--text); color: #fff; font-size: 13px; line-height: 18px; opacity: 0; pointer-events: none; transition: opacity var(--t-ui) ease, transform var(--t-ui) var(--ease-out); box-shadow: 0 8px 24px rgb(13 42 28 / 0.2); } /* taste-skill-ignore: overlay */
.toast.show { opacity: 1; transform: translate(-50%, 0); }
dialog { border: 1px solid var(--border); border-radius: 10px; padding: 20px; max-width: 420px; color: var(--text); box-shadow: 0 16px 40px rgb(13 42 28 / 0.2); } /* taste-skill-ignore: dialog */
dialog::backdrop { background: rgb(13 42 28 / 0.3); }
dialog h2 { font-size: 16px; line-height: 22px; font-weight: 600; }
dialog p { margin-top: 8px; color: var(--muted); font-size: 14px; line-height: 20px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.btn.danger { color: var(--negative); border-color: #e6b8b5; }
.btn.danger:hover { background: var(--pill-negative-bg); }

/* ---------- narrower desktops ---------- */
@media (max-width: 1240px) {
  .layout { grid-template-columns: minmax(0, 1fr) 340px; }
}

/* ---------- tablet and phone: the frame folds; what needs action moves up ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "rail" "kpis" "sheet" "lower"; grid-template-rows: none; }
  .rail { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--gap); }
  .rail .rail-h { grid-column: 1 / -1; }
  .rail .group { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .rail .group.single { grid-template-columns: minmax(0, 1fr); }
  .rail .group > .issue-card:nth-child(3) { grid-column: 1 / -1; }
  .rail .group > .issue-card:nth-child(3) .people { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
  .rail .later { display: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: 48px auto; }
  .sidebar { grid-row: auto; padding-top: 14px; }
  .topbar { padding: 0 12px; background: var(--ground); }
  .topbar .menu-toggle { display: inline-grid; }
  .topbar .search { display: none; }
  .topbar .phone-title { display: block; }
  .topbar .right { margin-left: auto; }
  .sheet { margin: 0; border-radius: 0; border-width: 1px 0 0; padding: 16px; }
  .sidebar .close-nav { display: inline-grid; }
  .title-row { gap: 12px; }
  .title-actions .btn:not(.primary) { display: none; }
  .court-panel { padding: 14px 14px 16px; }
  .week { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .ci-table .court { display: none; }
  .ci-table td .sub.court-m { display: block; }
}
@media (max-width: 640px) {
  .rail, .rail .group { grid-template-columns: minmax(0, 1fr); }
  .rail .group > .issue-card:nth-child(3) .people { grid-template-columns: minmax(0, 1fr); }
  .kpi { padding: 12px 14px; }
  .ci-table .when { width: 64px; }
  .ci-table .count { width: 56px; }
  .ci-table .act { width: 88px; }
  .title-row h1 { font-size: 22px; }
  .court-head .segmented { display: none; }
  .phone-only { display: inline; }
  .cs { --label: 62px; }
  .cs-name { padding-top: 12px; }
  .cs-name span { display: none; }
  .cs-foot span:last-child { display: none; }
  .legend { gap: 6px 12px; }
}
.phone-only { display: none; }
.ci-table td .sub.court-m { display: none; }
@media (prefers-reduced-motion: reduce) { .bar.flash { animation: none; } }
