/* Layout for the Tee Sheet console. Every control, status pill, alert, empty state, spinner,
   toolbar, drawer and dialog is a shared gk-* component, and bare fields, tables and
   disclosures take the gk-admin-native base the controller puts on .tsv. This file only
   places them, and the resource-lane grid, which is one view with one consumer.
   Every colour, space, size and radius is a shared token. Every rule is scoped under .tsv,
   the controller's own wrapper, so the same file loads in the standalone console and in
   Core's tenant admin without restyling either host. */
.tsv {
  --tsv-gutter: clamp(var(--space-lg), 2vw, var(--space-4xl));
  min-width: 0;
  font-size: var(--fs-14);
  line-height: var(--lh-normal);
}
.tsv [hidden] { display: none !important; }
.tsv .sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.tsv a { color: var(--accent-text); }
.tsv :focus-visible { outline: var(--focus-outline-width) solid var(--focus-ring-color); outline-offset: var(--focus-outline-offset); }
.tsv h2, .tsv h3, .tsv h4 { margin: 0 0 var(--space-lg); color: var(--text); font-family: var(--font-display); line-height: var(--lh-snug); }
.tsv h2 { font-size: var(--fs-16); }
.tsv h3 { font-size: var(--fs-14); }
.tsv h4 { font-size: var(--fs-13); }
.tsv p { margin: 0 0 var(--space-md); }
.tsv ul, .tsv ol { margin: 0; padding-inline-start: var(--space-3xl); }
.tsv time { font-variant-numeric: tabular-nums; }
.tsv .form-guidance { margin: 0; color: var(--text-muted); font-size: var(--fs-13); }
.tsv gk-card section > :last-child, .tsv gk-card article > :last-child { margin-bottom: 0; }

/* Forms stack their groups; a control keeps its own width and a group fills the row. */
.tsv form { display: grid; gap: var(--space-lg); justify-items: start; }
.tsv form > .form-grid, .tsv form > label, .tsv form > fieldset, .tsv form > details, .tsv form > p, .tsv form > section, .tsv form > div, .tsv form > gk-alert, .tsv form > gk-card, .tsv form > ul, .tsv form > ol { justify-self: stretch; }
.tsv .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: var(--space-lg); }
.tsv .form-actions { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.tsv label, .tsv fieldset { min-width: 0; }
.tsv fieldset { display: grid; gap: var(--space-md); align-content: start; }
.tsv input:not([type="checkbox"]):not([type="radio"]), .tsv select { min-height: var(--gk-min-tap); }
.tsv select[multiple] { min-height: 5.5rem; }
.tsv .definition-row > .form-grid { margin-block-start: var(--space-lg); }

/* The page context and its controls. */
.tsv .context-bar { --gk-toolbar-offset: var(--admin-header-h); margin: 0 var(--tsv-gutter) var(--space-lg); }
.tsv .context-main { display: grid; gap: var(--space-md); width: 100%; color: var(--text); font-size: var(--fs-14); }
.tsv .context-form { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-md); min-width: 0; }
.tsv .context-form label, .tsv .bound-site { flex: 1 1 10rem; }
.tsv .bound-site { display: grid; gap: var(--space-xs); min-width: 0; }
.tsv .bound-site span { color: var(--text-muted); font-size: var(--fs-11); font-weight: 700; letter-spacing: var(--ls-caps); text-transform: uppercase; }
.tsv .bound-site strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tsv .context-summary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm) var(--space-2xl); color: var(--text-muted); font-size: var(--fs-13); }
.tsv .workspace-nav { display: grid; margin: 0 var(--tsv-gutter) var(--space-lg); }
.tsv .date-actions, .tsv .workspace-end { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-sm); }
.tsv .workspace-search { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-md); width: 100%; min-width: 0; color: var(--text); font-size: var(--fs-14); }
.tsv .tee-search { flex: 1 1 14rem; max-width: 28rem; }
.tsv .global-search { display: flex; flex: 1 1 20rem; align-items: end; gap: var(--space-sm); }
.tsv .global-search label { flex: 1; }
.tsv .role-select { min-width: 10rem; }
.tsv .role-lock { margin: 0; font-weight: 700; }

/* Alerts and receipts that sit between the page chrome and the workspace. */
.tsv [data-app-shell] > gk-alert, .tsv [data-tsv="banner"] > gk-alert { margin: var(--space-lg) var(--tsv-gutter) 0; }
.tsv .workspace gk-alert, .tsv gk-sheet gk-alert, .tsv gk-modal gk-alert { margin-block: var(--space-lg); }
.tsv .downstream-results { display: grid; gap: var(--space-xs); }
.tsv .downstream-results li span { display: block; }
.tsv .global-search-results { margin: 0 var(--tsv-gutter) var(--space-lg); }
.tsv .global-search-results ol { display: grid; gap: var(--space-sm); }
.tsv .global-search-results li { display: grid; grid-template-columns: minmax(10rem, 1fr) minmax(12rem, 2fr) auto; align-items: center; gap: var(--space-sm); }

/* The workspace. */
.tsv .workspace { display: grid; gap: var(--space-lg); align-content: start; padding: 0 var(--tsv-gutter) var(--space-8xl); }
.tsv .workspace > * { min-width: 0; }
.tsv .workspace:focus-visible { outline: none; }
.tsv .workspace-loading { display: grid; place-items: center; padding: var(--space-8xl) 0; }
.tsv .table-scroll { max-width: 100%; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--card); }
.tsv .table-scroll > table { border: 0; border-radius: 0; overflow: visible; }
.tsv .table-scroll th, .tsv .table-scroll td { vertical-align: top; }
.tsv .tee-grid { min-width: 62rem; }
.tsv .tee-grid thead th { position: sticky; z-index: 2; top: 0; }
.tsv .tee-grid tbody > tr:focus-visible { outline-offset: var(--focus-outline-offset-inset); }
.tsv .tee-grid tbody > tr[data-drop-slot] { scroll-margin-block: var(--space-8xl); }
.tsv .tee-grid th[scope="row"] { min-width: 8rem; }
.tsv .tee-grid th[scope="row"] > *, .tsv .tee-grid td > strong { display: block; }
.tsv .tee-grid time { font-size: var(--fs-20); font-weight: 700; }
.tsv .tee-grid td > span, .tsv .tee-grid th > span { display: block; color: var(--text-muted); font-size: var(--fs-12); font-weight: 400; }
.tsv .move-target-invalid, .tsv .move-reconciliation-slot { outline: var(--focus-glow-width) solid var(--caution-text); outline-offset: var(--focus-outline-offset-inset); }
.tsv .move-reconciliation-slot { background: var(--caution-bg); }
.tsv .move-reconciliation-pin { margin-block: var(--space-xs) 0; }
.tsv .move-accepted { animation: accepted-move-highlight 0.9s ease-out; }
@keyframes accepted-move-highlight { from { outline: var(--focus-glow-width) solid var(--focus-ring-color); outline-offset: var(--focus-outline-offset-inset); } to { outline: var(--focus-glow-width) solid transparent; outline-offset: var(--focus-outline-offset-inset); } }

/* Buttons that carry stacked text. */
.tsv .stack { display: grid; justify-items: start; gap: var(--space-3xs); width: 100%; text-align: left; white-space: normal; overflow-wrap: anywhere; }
.tsv .position-label { color: var(--text-muted); font-size: var(--fs-11); font-weight: 700; }
.tsv .player-positions { display: grid; grid-template-columns: repeat(4, minmax(7rem, 1fr)); gap: var(--space-xs); }
.tsv .player-position { min-width: 0; font-size: var(--fs-12); }
.tsv .player-position--unavailable { display: grid; align-content: center; gap: var(--space-3xs); padding: var(--space-md); border: 1px dashed var(--border); border-radius: var(--radius-btn); color: var(--text-muted); font-size: var(--fs-12); }
.tsv .reservation-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-sm); margin-top: var(--space-xs); }
.tsv .select-control { min-height: var(--gk-min-tap); }
.tsv .price, .tsv .provenance { display: block; }
.tsv .price { font-weight: 700; }
.tsv .provenance { color: var(--text-muted); font-size: var(--fs-12); }
.tsv .explain-price { margin-top: var(--space-xs); }

/* The resource-lane grid: a time column and one lane per starting resource. */
.tsv .resource-lanes { min-width: max(52rem, 16rem * var(--lane-count, 3)); }
.tsv .resource-lanes th, .tsv .resource-lanes td { min-width: 15rem; padding: var(--space-sm); border-left: 1px solid var(--border); text-align: left; }
.tsv .resource-lanes th:first-child { position: sticky; z-index: 3; left: 0; min-width: 5rem; border-left: 0; background: var(--admin-table-head); }
.tsv .resource-lanes thead th { position: sticky; z-index: 2; top: 0; }
.tsv .resource-lanes thead th:first-child { z-index: 4; }
.tsv .resource-lanes thead span { display: block; color: var(--text-muted); font-size: var(--fs-12); font-weight: 400; }
.tsv .resource-lane-slot { display: grid; gap: var(--space-sm); min-height: 10rem; padding: var(--space-md); border: 2px solid transparent; border-radius: var(--radius-btn); background: var(--card); scroll-margin: var(--space-8xl); }
.tsv .resource-lane-slot:focus { border-color: var(--focus-ring-color); outline: none; }
.tsv .resource-lane-slot > header, .tsv .resource-lane-slot > footer { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); }
.tsv .resource-lane-slot > footer { align-items: flex-start; }
.tsv .lane-reservations { display: grid; gap: var(--space-xs); }
.tsv .lane-open { color: var(--success-text); font-weight: 700; }
.tsv .lane-unpublished { display: block; padding: var(--space-lg); color: var(--text-muted); font-size: var(--fs-12); }

/* Compact list. */
.tsv .tee-list { display: grid; gap: var(--space-sm); padding: 0; list-style: none; }
.tsv .tee-row { display: grid; grid-template-columns: minmax(8rem, 0.6fr) minmax(8rem, 0.5fr) minmax(16rem, 1.4fr) minmax(10rem, 0.7fr) auto; align-items: center; gap: var(--space-lg); }
.tsv .tee-row > div, .tsv .list-time { display: grid; gap: var(--space-2xs); }
.tsv .list-time time { font-size: var(--fs-20); font-weight: 700; }
.tsv .list-reservations > div { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); }
.tsv .reservation-card { display: grid; grid-template-columns: 1.2fr 0.8fr 0.8fr; gap: var(--space-sm); min-width: 14rem; flex: 1 1 14rem; }
.tsv .reservation-card > div { display: grid; gap: var(--space-3xs); }
.tsv .reservation-card span { color: var(--text-muted); font-size: var(--fs-12); }

/* Day notices, operator queues, history and role policy. */
.tsv .day-notices ul { display: grid; gap: var(--space-xs); margin: 0; padding: 0; list-style: none; }
.tsv .day-notices li { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-lg); align-items: baseline; }
.tsv .day-notices li span:last-child:not(:first-child) { color: var(--text-muted); }
.tsv .notice-composers { display: grid; gap: var(--space-md); margin-top: var(--space-lg); }
.tsv .queue-groups, .tsv .role-policy-list { display: grid; gap: var(--space-md); margin-block: var(--space-md); }
.tsv .queue-groups ol { display: grid; gap: var(--space-sm); }
.tsv .queue-groups li, .tsv .operator-history li, .tsv .role-policy li { display: grid; gap: var(--space-2xs); }
.tsv .operator-history ol, .tsv .role-policy ul { display: grid; gap: var(--space-sm); }
.tsv .operator-history li span, .tsv .role-policy li span, .tsv .queue-groups li span { color: var(--text-muted); }
.tsv .role-assignment { padding-top: var(--space-lg); border-top: 1px solid var(--border); }
.tsv .assignment-inventory { display: grid; gap: var(--space-lg); margin-top: var(--space-lg); }

/* Starter, Manager, Revenue, Marshal and TV views. */
.tsv .starter-view, .tsv .configuration-workspace, .tsv .tv-view { display: grid; gap: var(--space-lg); }
.tsv .starter-selection [role="group"] { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.tsv .starter-selection p { margin: 0; }
.tsv .starter-selection [role="group"] > div { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.tsv .starter-selection .starter-attendance-actions { flex-basis: 100%; align-items: end; }
.tsv .starter-attendance-actions label { flex: 1 1 11rem; }
.tsv .starter-attendance-preview ol { display: grid; gap: var(--space-sm); margin-bottom: 0; }
.tsv .starter-attendance-preview li { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: baseline; }
.tsv .starter-attendance-preview li ul { flex-basis: 100%; margin: 0; }
.tsv .starter-slot > header { display: grid; grid-template-columns: 5rem 1fr auto; gap: var(--space-sm); align-items: center; }
.tsv .starter-slot time { font-size: var(--fs-20); font-weight: 700; }
.tsv .starter-party { display: grid; grid-template-columns: minmax(10rem, 1fr) minmax(14rem, 2fr); gap: var(--space-md); padding-top: var(--space-md); }
.tsv .starter-party > div { display: grid; align-content: start; gap: var(--space-xs); }
.tsv .starter-party > div > span { color: var(--text-muted); }
.tsv .starter-party gk-button { display: block; }
.tsv .starter-notes { display: grid; gap: var(--space-2xs); margin: var(--space-xs) 0 0; }
.tsv .attendance-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); padding: var(--space-sm) 0; border-top: 1px solid var(--border); }
.tsv .attendance-actions > strong { margin-right: auto; }
.tsv .attendance-actions--selected { background: var(--primary-surface); }
.tsv .exception-list, .tsv .marshal-list, .tsv .tv-view ol { display: grid; gap: var(--space-sm); padding: 0; list-style: none; }
.tsv .exception-list li, .tsv .marshal-list li { padding: var(--space-md) 0; border-bottom: 1px solid var(--border); }
.tsv .marshal-list li { display: grid; grid-template-columns: 5rem 1fr 1fr auto; gap: var(--space-sm); }
.tsv .metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: var(--space-lg); }
.tsv .tv-view { font-size: clamp(var(--fs-16), 2vw, var(--fs-24)); }
.tsv .tv-view li { display: grid; grid-template-columns: 6rem 1fr 1fr 1fr; gap: var(--space-2xl); padding: var(--space-lg) 0; border-bottom: 1px solid var(--border); }

/* Supply and Pricing authoring. */
.tsv .configuration-workspace > section { display: grid; gap: var(--space-lg); }
.tsv .configuration-workspace > section > header { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-2xl); }
.tsv .configuration-workspace h2, .tsv .configuration-workspace header p { margin: 0; }
.tsv .inventory-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr)); gap: var(--space-lg); }
.tsv .inventory-grid ul { display: grid; gap: var(--space-sm); padding: 0; list-style: none; }
.tsv .inventory-grid li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); }
.tsv .policy-publications { display: grid; gap: var(--space-2xl); padding-top: var(--space-2xl); border-top: 1px solid var(--border); }
.tsv .clone-destinations, .tsv .operational-notes { display: grid; gap: var(--space-md); padding: 0; list-style: none; }
.tsv .operational-notes li { display: grid; gap: var(--space-sm); padding-bottom: var(--space-md); border-bottom: 1px solid var(--border); }
.tsv .operational-notes li > div { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.tsv .note-create { display: grid; gap: var(--space-md); padding-top: var(--space-md); border-top: 1px solid var(--border); }
.tsv .round-operations { display: grid; gap: var(--space-md); padding: 0; list-style: none; }
.tsv .round-operations li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); padding: var(--space-sm) 0; border-top: 1px solid var(--border); }
.tsv .round-operations li > span { margin-right: auto; }

/* The command tray is a gk-toolbar pinned to the bottom of the page. */
.tsv .command-tray { margin: var(--space-lg) var(--tsv-gutter); }
.tsv .command-tray h2, .tsv .command-tray p { margin: 0; }
.tsv .command-tray p { margin-top: var(--space-2xs); color: var(--text-muted); font-weight: 400; }
.tsv .selection-summary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm) var(--space-2xl); }
.tsv .selection-summary strong { color: var(--text); }
.tsv .selection-summary label { min-width: 10rem; }
.tsv .selection-actions, .tsv .mode-controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); min-width: 0; max-width: 100%; }

/* The reservation drawer (gk-sheet) and the consequence dialog (gk-modal). */
.tsv .drawer-heading { min-width: 0; }
.tsv .drawer-heading p, .tsv .drawer-heading h2, .tsv .drawer-heading span { margin: 0; }
.tsv .drawer-heading h2 { font-size: var(--fs-20); }
.tsv .drawer-heading p, .tsv .drawer-heading span { display: block; color: var(--text-muted); font-size: var(--fs-13); }
.tsv .dirty-status { display: block; margin-top: var(--space-xs); color: var(--text-muted); font-size: var(--fs-12); }
.tsv .dirty-status[data-dirty="true"] { color: var(--caution-text); }
.tsv .drawer [data-form="reservation"] { padding-top: var(--space-lg); }
.tsv .preview-dialog > * + * { margin-top: var(--space-lg); }
.tsv .preview-dialog > [slot="actions"] { margin-top: 0; }
.tsv .preview-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: var(--space-sm); }
.tsv .consequence-list { display: grid; gap: var(--space-sm); }
.tsv .consequence-list li span { display: block; color: var(--text-muted); }

/* The printable day sheet exists only on paper. */
.tsv .print-sheet { display: none; }

@media (max-width: 980px) {
  .tsv .tee-row { grid-template-columns: minmax(7rem, 0.5fr) 1fr; }
  .tsv .tee-row > * { min-width: 0; }
  .tsv .reservation-card { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .tsv .context-bar { position: static; }
  .tsv .context-form > gk-button { flex: 1 1 100%; }
  .tsv .workspace-end { width: 100%; }
  .tsv .role-select { flex: 1; }
  .tsv .tee-search, .tsv .global-search { width: 100%; max-width: none; }
  .tsv .global-search-results li { grid-template-columns: 1fr; }
  .tsv .view-tabs { max-width: 100%; }
  .tsv .command-tray { position: static; }
  .tsv .workspace { padding-bottom: var(--space-4xl); }
  .tsv .tee-row { grid-template-columns: 1fr; }
  .tsv .starter-slot > header, .tsv .starter-party, .tsv .marshal-list li, .tsv .tv-view li { grid-template-columns: 1fr; }
  .tsv .configuration-workspace > section > header { display: grid; }
  .tsv .player-positions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 360px) {
  .tsv .context-bar, .tsv .workspace-nav, .tsv .workspace { margin-inline: var(--space-sm); padding-inline: var(--space-sm); }
  .tsv .date-actions, .tsv .date-actions gk-button { width: 100%; }
  .tsv .date-actions gk-button { flex: 1; }
  .tsv [data-app-shell] > gk-alert, .tsv .command-tray { margin-inline: var(--space-sm); }
}
@media (prefers-reduced-motion: reduce) {
  .tsv .move-accepted { animation: none; }
}
@media (forced-colors: active) {
  .tsv .resource-lane-slot, .tsv .player-position--unavailable, .tsv .attendance-actions { border: 2px solid CanvasText; }
}
@media print {
  @page { size: A4; margin: 10mm; }
  .tsv .context-bar, .tsv .workspace-nav, .tsv .command-tray, .tsv gk-sheet, .tsv gk-modal, .tsv gk-alert, .tsv .workspace { display: none !important; }
  .tsv .print-sheet { display: block; color: var(--text); background: var(--card); font: var(--fs-12) / var(--lh-snug) var(--font-body); }
  .tsv .print-sheet h1 { margin: 0 0 var(--space-2xs); font-size: var(--fs-16); }
  .tsv .print-sheet > p { margin: 0 0 var(--space-xs); }
  .tsv .print-sheet > p:last-child { margin: var(--space-xs) 0 0; break-inside: avoid; }
  .tsv .print-sheet table { width: 100%; table-layout: fixed; border-collapse: collapse; }
  .tsv .print-sheet thead { display: table-header-group; }
  .tsv .print-sheet th, .tsv .print-sheet td { padding: var(--space-3xs) var(--space-2xs); border: 1px solid var(--border-strong); text-align: left; }
  .tsv .print-sheet tr { break-inside: avoid; page-break-inside: avoid; }
  .tsv a { color: var(--text); text-decoration: none; }
}
