/*
 * Virtuoso operational refinement.
 * Scheduling: compact rail -> focused work canvas.
 * Valet mode: live totals -> immediate actions -> queue -> ticket detail.
 * Presentation only: existing controls, IDs, permissions, and workflows remain intact.
 */

:where(body.schedule-page, body.valet-page) {
  --ops-canvas: #0b0e0f;
  --ops-surface: #111516;
  --ops-line: rgba(244, 239, 229, 0.14);
  --ops-line-strong: rgba(244, 239, 229, 0.25);
  --ops-ivory: #f4efe5;
  --ops-muted: #aaa8a1;
  --ops-red: #b61f2b;
  --ops-red-deep: #7e111b;
  --ops-gold: #d4ad52;
  --ops-focus: #f1cc70;
  background: var(--ops-canvas);
  color: var(--ops-ivory);
  font-feature-settings: "kern" 1, "tnum" 1;
  text-rendering: optimizeLegibility;
}

:where(body.schedule-page, body.valet-page) *,
:where(body.schedule-page, body.valet-page) *::before,
:where(body.schedule-page, body.valet-page) *::after {
  box-sizing: border-box;
  min-width: 0;
}

:where(body.schedule-page, body.valet-page)
  :where(button, a, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--ops-focus);
  outline-offset: 2px;
}

:where(body.schedule-page, body.valet-page)
  :where(button, .button, summary, [role="button"]) {
  transition:
    background-color var(--motion-duration-instant) var(--motion-ease-out),
    border-color var(--motion-duration-instant) var(--motion-ease-out),
    color var(--motion-duration-instant) var(--motion-ease-out);
}

:where(body.schedule-page, body.valet-page)
  :where(h1, h2, h3, h4, p, label, legend, td, th, dd, dt, button, a, span) {
  overflow-wrap: anywhere;
}

/* Scheduling: one navigation rail and one uninterrupted work surface. */
body.schedule-page {
  --sidebar: var(--ops-red-deep);
  --sidebar-active: #4e090f;
  overflow-x: hidden;
}

body.schedule-page .page-shell,
body.schedule-page .schedule-portal-shell {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  gap: 0;
  background: var(--ops-canvas);
}

body.schedule-page .schedule-portal-shell > .topbar.card {
  position: relative;
  z-index: 20;
  min-height: 68px;
  margin: 0;
  padding: 10px clamp(14px, 2vw, 28px);
  border: 0;
  border-bottom: 1px solid var(--ops-line);
  border-radius: 0;
  background: #0d1011;
  box-shadow: none;
  backdrop-filter: none;
}

body.schedule-page .schedule-portal-shell > .topbar.card h1 {
  margin: 0;
  font-size: clamp(1rem, 0.9rem + 0.35vw, 1.3rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

body.schedule-page .schedule-portal-shell > .topbar.card p {
  margin: 3px 0 0;
  color: var(--ops-muted);
  font-size: 0.74rem;
  line-height: 1.25;
}

body.schedule-page .schedule-portal-shell > .topbar.card > .button,
body.schedule-page .schedule-portal-shell > .topbar.card .topbar-actions {
  width: auto;
  justify-self: end;
}

body.schedule-page .schedule-workspace {
  display: grid;
  grid-template-columns: clamp(212px, 16vw, 252px) minmax(0, 1fr);
  gap: 0;
  min-height: calc(100vh - 68px);
  min-height: calc(100dvh - 68px);
  align-items: stretch;
}

body.schedule-page .schedule-navigation {
  position: sticky;
  top: 0;
  z-index: 12;
  align-self: start;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow-y: auto;
  border-inline-end: 1px solid rgba(255, 255, 255, 0.13);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 18rem),
    var(--sidebar);
  scrollbar-width: thin;
}

body.schedule-page .schedule-sidebar {
  min-height: 100%;
  gap: 0;
  padding: 10px 0 24px;
  background: transparent;
}

body.schedule-page .schedule-sidebar-folder {
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0;
  background: transparent;
}

body.schedule-page .schedule-sidebar-folder > summary,
body.schedule-page .schedule-sidebar-button {
  min-height: 46px;
  padding-block: 9px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff9ef;
  font-size: 0.78rem;
  line-height: 1.2;
}

body.schedule-page .schedule-sidebar-folder > summary {
  padding-inline: 13px;
  color: rgba(255, 249, 239, 0.78);
}

body.schedule-page .schedule-sidebar-button {
  padding-inline: 20px 12px;
  box-shadow: inset 1px 0 transparent;
}

body.schedule-page .schedule-sidebar-folder > summary:hover,
body.schedule-page .schedule-sidebar-button:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

body.schedule-page .schedule-sidebar-button.active,
body.schedule-page .schedule-sidebar-button[aria-current="page"] {
  background: rgba(38, 0, 4, 0.52);
  color: #fff;
  box-shadow:
    inset 1px 0 var(--ops-gold),
    inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}

body.schedule-page .schedule-nav-icon {
  opacity: 0.82;
}

body.schedule-page .schedule-sidebar-button.active .schedule-nav-icon {
  color: var(--ops-gold);
  opacity: 1;
}

body.schedule-page .schedule-notification-badge {
  min-width: 20px;
  min-height: 20px;
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-variant-numeric: tabular-nums;
}

body.schedule-page .schedule-panel {
  width: 100%;
  min-width: 0;
  max-width: 1680px;
  gap: 18px;
  align-content: start;
  padding: clamp(18px, 2.2vw, 36px);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.012), transparent 28rem),
    var(--ops-canvas);
  font-size: 0.9rem;
}

body.schedule-page .schedule-panel-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px 24px;
  margin: 0;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--ops-line-strong);
}

body.schedule-page .schedule-panel-heading h2 {
  max-width: 24ch;
  margin: 0;
  color: var(--ops-ivory);
  font-size: clamp(1.45rem, 1.2rem + 0.8vw, 2.1rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

body.schedule-page .schedule-panel-heading p {
  max-width: 64ch;
  margin: 0;
  color: var(--ops-muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

/* The panel is the surface. Its sections use rhythm and rules, not card piles. */
body.schedule-page .schedule-panel > .card,
body.schedule-page .schedule-panel > form.card,
body.schedule-page .schedule-panel > section.card,
body.schedule-page .schedule-panel > article.card,
body.schedule-page .schedule-panel > .dashboard-grid > .card {
  margin: 0;
  padding: clamp(14px, 1.35vw, 22px) 0;
  border: 0;
  border-top: 1px solid var(--ops-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

body.schedule-page .schedule-panel > .card:first-child,
body.schedule-page .schedule-panel > form.card:first-child,
body.schedule-page .schedule-panel > section.card:first-child {
  padding-top: 0;
  border-top: 0;
}

body.schedule-page .schedule-panel
  :where(.dashboard-grid, .stat-grid, .metric-grid, .portal-card-grid) {
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--ops-line);
  border-radius: 10px;
  background: var(--ops-line);
}

body.schedule-page .schedule-panel
  :where(.dashboard-grid, .stat-grid, .metric-grid, .portal-card-grid)
  > .card {
  min-height: 0;
  padding: 14px;
  border: 0;
  border-radius: 0;
  background: var(--ops-surface);
  box-shadow: none;
}

body.schedule-page .schedule-panel
  :where(.notice-item, .shift-item, .shift-section, .directory-card,
    .location-directory-card, .employee-record-card, .applicant-card-compact,
    .availability-request-card, .time-off-request-card, .schedule-report,
    .schedule-ledger-card, .schedule-admin-details) {
  border-color: var(--ops-line);
  border-radius: 8px;
  background: var(--ops-surface);
  box-shadow: none;
}

body.schedule-page .schedule-panel :where(input, select, textarea) {
  min-height: 40px;
  border: 1px solid var(--ops-line-strong);
  border-radius: 6px;
  background: #0d1112;
  color: var(--ops-ivory);
}

body.schedule-page .schedule-panel textarea {
  min-height: 84px;
}

body.schedule-page .schedule-panel :where(.button, button) {
  min-height: 40px;
  border-radius: 6px;
  font-weight: 750;
}

/* Event and dealership builders reflow by available workspace, not device labels. */
body.schedule-page .schedule-template-builder,
body.schedule-page .schedule-template-location-sections,
body.schedule-page .schedule-template-location-section,
body.schedule-page .schedule-template-grid-wrap {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

body.schedule-page .schedule-template-location-section {
  container: schedule-template / inline-size;
}

body.schedule-page .schedule-template-grid-wrap {
  overflow: visible;
  border: 1px solid var(--ops-line-strong);
  border-radius: 10px;
  background: var(--ops-surface);
}

body.schedule-page .schedule-template-location-heading {
  display: grid;
  width: auto;
  min-width: 0;
  gap: 3px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ops-line-strong);
  background: #0d1011;
  text-align: left;
}

body.schedule-page .schedule-template-location-heading strong,
body.schedule-page .schedule-template-location-heading span {
  min-width: 0;
  max-width: 100%;
  margin: 0;
  word-break: normal;
  overflow-wrap: break-word;
}

body.schedule-page .schedule-template-location-heading strong {
  color: var(--ops-ivory);
  font-size: 0.9rem;
  line-height: 1.25;
}

body.schedule-page .schedule-template-location-heading span {
  color: var(--ops-muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

body.schedule-page .schedule-template-day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  width: 100%;
  min-width: 0;
  align-items: start;
  gap: 8px;
  padding: 8px;
  background: transparent;
}

body.schedule-page .schedule-template-day {
  display: grid;
  align-content: start;
  min-width: 0;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--ops-line);
  border-radius: 8px;
  background: var(--ops-line);
}

@container schedule-template (min-width: 1160px) {
  body.schedule-page .schedule-template-day-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

body.schedule-page .schedule-template-day-heading {
  min-width: 0;
  margin: 0;
  padding: 10px 9px;
  background: #121617;
  color: var(--ops-ivory);
  font-size: clamp(0.7rem, 0.67rem + 0.1vw, 0.78rem);
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

body.schedule-page .schedule-template-day-heading :where(span, strong, small) {
  display: block;
  margin-top: 3px;
  color: var(--ops-muted);
  word-break: normal;
  overflow-wrap: normal;
  white-space: nowrap;
}

body.schedule-page .schedule-template-day-grid .schedule-template-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  max-width: 100%;
  gap: 7px;
  padding: 10px;
  border: 0;
  background: var(--ops-surface);
}

body.schedule-page .schedule-template-day-grid .schedule-template-cell + .schedule-template-cell {
  border-top: 1px solid var(--ops-line);
}

body.schedule-page .schedule-template-day-grid .schedule-template-cell::before {
  display: none;
  content: none;
}

body.schedule-page .schedule-template-day-grid .schedule-template-cell label {
  display: block;
  min-width: 0;
  margin: 0;
  color: var(--ops-muted);
  font-size: 0.68rem;
  line-height: 1.2;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

body.schedule-page .schedule-template-day-grid .schedule-template-time,
body.schedule-page .schedule-template-day-grid .schedule-template-cell-controls,
body.schedule-page .schedule-template-day-grid .schedule-template-count,
body.schedule-page .schedule-template-day-grid .schedule-template-type {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

body.schedule-page .schedule-template-day-grid .schedule-template-time,
body.schedule-page .schedule-template-day-grid .schedule-template-cell-controls {
  grid-column: auto;
}

body.schedule-page .schedule-template-day-grid .schedule-template-cell-controls {
  grid-template-columns: minmax(64px, 1fr) 48px;
  gap: 6px;
}

body.schedule-page .schedule-panel :where(table, .responsive-data-table) {
  border-collapse: collapse;
  border-color: var(--ops-line);
  background: transparent;
}

body.schedule-page .schedule-panel :where(th, td) {
  min-height: 42px;
  padding: 9px 10px;
  border-color: var(--ops-line);
  line-height: 1.35;
  vertical-align: middle;
}

body.schedule-page .schedule-panel th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #171b1c;
  color: #d8d3ca;
  font-size: 0.68rem;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

body.schedule-page .schedule-panel tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.018);
}

body.schedule-page .schedule-panel :where(.muted, small) {
  color: var(--ops-muted);
}

/* Valet mode: decisive live command surface, never a dashboard card wall. */
body.valet-page .page-shell {
  padding:
    max(10px, env(safe-area-inset-top))
    max(10px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom))
    max(10px, env(safe-area-inset-left));
}

body.valet-page .valet-portal-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
}

body.valet-page .valet-module {
  gap: 10px;
  padding: 0;
}

body.valet-page .valet-command-header {
  display: grid;
  grid-template-columns: minmax(220px, 0.76fr) minmax(460px, 1.5fr);
  grid-template-rows: auto;
  align-items: stretch;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--ops-line);
  border-radius: 10px;
  background: #101415;
  box-shadow: none;
}

body.valet-page .valet-board-identity {
  display: flex;
  align-content: center;
  align-items: center;
  gap: 8px 12px;
  padding: 14px 16px;
  border-inline-end: 1px solid var(--ops-line);
}

body.valet-page .valet-board-identity h2 {
  margin: 0;
  color: var(--ops-ivory);
  font-size: clamp(1.05rem, 0.9rem + 0.42vw, 1.36rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
}

body.valet-page .valet-board-identity p {
  margin: 4px 0 0;
  color: var(--ops-muted);
  font-size: 0.7rem;
  line-height: 1.25;
}

body.valet-page .valet-live-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(62px, 0.72fr)) minmax(118px, 1.25fr);
  gap: 0;
  align-items: stretch;
  padding: 0;
  border: 0;
  background: transparent;
}

body.valet-page .valet-live-totals span {
  min-height: 72px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  padding: 10px 8px;
  border: 0;
  border-inline-start: 1px solid var(--ops-line);
  border-radius: 0;
  background: transparent;
  color: var(--ops-muted);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

body.valet-page .valet-live-totals b,
body.valet-page .valet-live-totals strong {
  color: var(--ops-ivory);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

body.valet-page .valet-total-requested {
  background: rgba(212, 173, 82, 0.08) !important;
}

body.valet-page .valet-total-requested strong {
  color: #f2ce76;
}

body.valet-page .valet-command-bar {
  position: sticky;
  top: max(8px, env(safe-area-inset-top));
  z-index: 15;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  overflow: hidden;
  border: 1px solid var(--ops-line);
  border-radius: 9px;
  background: var(--ops-line);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
}

body.valet-page .valet-command-bar .button,
body.valet-page .valet-command-bar .valet-arrival-button {
  min-width: 0;
  min-height: 54px;
  padding: 9px 12px;
  border: 0;
  border-radius: 0;
  background: rgba(13, 17, 18, 0.96);
  color: var(--ops-ivory);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.15;
  white-space: normal;
}

body.valet-page .valet-command-bar .button:hover {
  background: #1a1f20;
}

body.valet-page .valet-command-bar .valet-arrival-button {
  background: var(--ops-gold);
  color: #17130a;
}

body.valet-page .valet-command-bar .button.is-active,
body.valet-page .valet-command-bar .button[aria-pressed="true"] {
  background: var(--ops-red);
  color: #fff;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.28);
}

body.valet-page .valet-board.valet-tile-board {
  gap: 8px;
  align-content: start;
  margin: 0;
  padding: 2px 0 0;
}

body.valet-page :where(.valet-ticket, .valet-ticket-tile) {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--ops-line);
  border-radius: 8px;
  background: var(--ops-surface);
  box-shadow: none;
}

body.valet-page .valet-ticket-tile > summary {
  min-height: 66px;
  padding: 10px 12px;
  border-radius: 0;
}

body.valet-page .valet-ticket-tile.is-selected {
  border-color: var(--ops-gold);
  box-shadow: inset 0 0 0 1px var(--ops-gold);
}

body.valet-page .valet-ticket-tile.requested,
body.valet-page .valet-ticket-tile.retrieving {
  border-color: #e9c45e;
}

body.valet-page .valet-ticket-tile.ready {
  border-color: #5ecb90;
}

body.valet-page
  :where(.valet-ticket-actions, .valet-ticket-quick-actions, .valet-status-actions) {
  gap: 6px;
}

body.valet-page
  :where(.valet-ticket-actions, .valet-ticket-quick-actions, .valet-status-actions)
  .button {
  min-height: 46px;
  border-radius: 6px;
}

body.valet-page .valet-selected-ticket-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  overflow: visible;
  padding: 0;
}

body.valet-page .valet-selected-ticket-actions .button {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  border-radius: 6px;
  white-space: normal;
}

body.valet-page .valet-selected-ticket-actions .valet-status-button {
  grid-column: 1 / -1;
}

body.valet-page
  :where(.valet-forgotten-item-dismiss, .valet-crew-alert-dismiss,
    .valet-arrival-plate-scan, .valet-manual-toggle, .valet-overlay-close) {
  min-width: 44px;
  min-height: 44px;
}

body.valet-page .valet-overlay-panel > .valet-overlay-close {
  inset-inline-end: 12px;
}

body.valet-page .valet-overlay-panel > :where(h2, h3):first-of-type {
  padding-inline-end: 58px;
}

body.valet-page :where(.valet-ticket-detail, .valet-live-shift-report) {
  border-color: var(--ops-line);
  border-radius: 8px;
  background: var(--ops-surface);
  box-shadow: none;
}

body.valet-page :where(.valet-overlay-panel, .valet-arrival-modal, .valet-nfc-modal) {
  border: 1px solid var(--ops-line-strong);
  border-radius: 12px;
  background: #111516;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.62);
}

body.valet-page .valet-arrival-modal :where(input, select, textarea) {
  min-height: 44px;
  border-radius: 6px;
}

body.valet-page .valet-arrival-optional,
body.valet-page .valet-arrival-modal .valet-damage-check {
  border-color: var(--ops-line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
}

body.valet-page .valet-arrival-save-row .button {
  min-height: 58px;
  border-radius: 7px;
}

/* Light valet theme retains the hierarchy with daylight contrast. */
body.valet-page.valet-light-page {
  --ops-canvas: #eef0f1;
  --ops-surface: #fff;
  --ops-line: rgba(20, 24, 25, 0.14);
  --ops-line-strong: rgba(20, 24, 25, 0.26);
  --ops-ivory: #131718;
  --ops-muted: #586063;
}

body.valet-page.valet-light-page .valet-command-header,
body.valet-page.valet-light-page .valet-command-bar .button {
  background: rgba(255, 255, 255, 0.97);
  color: #131718;
}

body.valet-page.valet-light-page .valet-command-bar .valet-arrival-button {
  background: #d4ad52;
  color: #17130a;
}

body.valet-page.valet-light-page
  :where(.valet-overlay-panel, .valet-arrival-modal, .valet-nfc-modal) {
  background: #fff;
}

/* Tablet: narrower rail, no loss of navigation or actions. */
@media (min-width: 761px) and (max-width: 1100px) {
  body.schedule-page .schedule-workspace {
    grid-template-columns: 204px minmax(0, 1fr);
  }

  body.schedule-page .schedule-panel {
    padding: 20px;
  }

  body.schedule-page .schedule-sidebar-folder > summary,
  body.schedule-page .schedule-sidebar-button {
    padding-inline-end: 10px;
    font-size: 0.74rem;
  }

  body.valet-page .valet-command-header {
    grid-template-columns: minmax(190px, 0.7fr) minmax(420px, 1.5fr);
  }
}

/* Handset scheduling: existing toggle opens the complete bounded navigation. */
@media (max-width: 760px) {
  body.schedule-page .schedule-portal-shell > .topbar.card {
    min-height: 60px;
    padding:
      max(10px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      10px
      max(12px, env(safe-area-inset-left));
  }

  body.schedule-page .schedule-workspace {
    display: block;
    min-height: calc(100dvh - 60px);
  }

  body.schedule-page .schedule-navigation {
    position: sticky;
    top: 0;
    z-index: 18;
    width: 100%;
    height: auto;
    min-height: 0;
    overflow: visible;
    border-inline-end: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  }

  body.schedule-page .schedule-menu-toggle {
    display: flex;
    width: 100%;
    min-height: 48px;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: 0;
    border-radius: 0;
    background: var(--sidebar);
    color: #fff;
  }

  body.schedule-page .schedule-sidebar {
    max-height: min(70vh, 620px);
    max-height: min(70dvh, 620px);
    overflow-y: auto;
    padding: 0 0 max(12px, env(safe-area-inset-bottom));
  }

  body.schedule-page .schedule-sidebar-folder > summary,
  body.schedule-page .schedule-sidebar-button {
    min-height: 48px;
  }

  body.schedule-page .schedule-panel {
    gap: 14px;
    padding:
      18px
      max(12px, env(safe-area-inset-right))
      max(24px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
    font-size: 0.92rem;
  }

  body.schedule-page .schedule-panel-heading {
    grid-template-columns: minmax(0, 1fr);
    padding-bottom: 12px;
  }

  body.schedule-page .schedule-panel-heading h2 {
    max-width: none;
    font-size: clamp(1.35rem, 7vw, 1.75rem);
  }

  body.schedule-page .schedule-panel > :where(.card, form.card, section.card, article.card) {
    padding-block: 13px;
  }

  body.schedule-page .schedule-panel :where(input, select, textarea, .button, button) {
    min-height: 44px;
  }
}

/* Handset valet: two action columns stay readable and thumb-safe. */
@media (max-width: 640px) {
  body.valet-page .page-shell {
    padding:
      max(5px, env(safe-area-inset-top))
      max(5px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(5px, env(safe-area-inset-left));
  }

  body.valet-page .valet-module {
    gap: 7px;
  }

  body.valet-page .valet-command-header {
    grid-template-columns: minmax(0, 1fr);
    border-radius: 7px;
  }

  body.valet-page .valet-board-identity {
    min-height: 58px;
    padding: 9px 10px;
    border-inline-end: 0;
    border-bottom: 1px solid var(--ops-line);
  }

  body.valet-page .valet-board-identity h2 {
    font-size: 1.05rem;
  }

  body.valet-page .valet-live-totals {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.valet-page .valet-live-totals span {
    min-height: 44px;
    padding: 6px;
    font-size: 0.75rem;
    letter-spacing: 0;
  }

  body.valet-page .valet-live-totals span:nth-child(n + 4) {
    grid-column: span 1;
  }

  body.valet-page .valet-total-requested {
    grid-column: span 2 !important;
  }

  body.valet-page .valet-live-totals b,
  body.valet-page .valet-live-totals strong {
    font-size: 0.86rem;
  }

  body.valet-page .valet-command-bar {
    top: max(5px, env(safe-area-inset-top));
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    padding: 1px;
    border-radius: 7px;
  }

  body.valet-page .valet-command-bar .button,
  body.valet-page .valet-command-bar .valet-arrival-button {
    min-height: 50px;
    padding: 8px 7px;
    font-size: 0.75rem;
  }

  body.valet-page .valet-ticket-tile > summary {
    min-height: 64px;
    padding: 9px 10px;
  }

  body.valet-page :where(.valet-overlay-panel, .valet-arrival-modal, .valet-nfc-modal) {
    width: calc(100% - 10px);
    max-height: calc(100dvh - 10px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    border-radius: 10px;
  }
}

@media (max-width: 360px) {
  body.valet-page .valet-live-totals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.valet-page .valet-live-totals span:first-child {
    grid-column: 1 / -1;
  }

  body.valet-page .valet-total-requested {
    grid-column: span 1 !important;
  }

  body.valet-page .valet-selected-ticket-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (pointer: coarse) {
  :where(body.schedule-page, body.valet-page)
    :where(button, .button, summary, input, select) {
    min-height: 44px;
  }

  body.valet-page
    :where(.valet-command-bar .button, .valet-ticket-actions .button,
      .valet-ticket-quick-actions .button, .valet-status-actions .button) {
    min-height: 50px;
  }
}

@media (hover: hover) and (pointer: fine) {
  body.valet-page .valet-command-bar .button:hover {
    background: #1a1f20;
  }
}

@media (hover: none) {
  :where(body.schedule-page, body.valet-page) :where(button, .button, summary):hover {
    filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  :where(body.schedule-page, body.valet-page) {
    scroll-behavior: auto !important;
  }

  :where(body.schedule-page, body.valet-page)
    :where(button, .button, summary, [role="button"]) {
    transition:
      background-color var(--motion-duration-instant) ease-out,
      border-color var(--motion-duration-instant) ease-out,
      color var(--motion-duration-instant) ease-out,
      filter var(--motion-duration-instant) ease-out !important;
  }

  body.valet-page :where(.valet-plate-scan-indicator, .valet-plate-scan-reticle) {
    animation: none !important;
  }
}

@media (forced-colors: active) {
  :where(body.schedule-page, body.valet-page)
    :where(.card, .schedule-sidebar-button, .schedule-sidebar-folder,
      .valet-command-header, .valet-command-bar, .valet-ticket, .valet-ticket-tile,
      .valet-overlay-panel, .valet-arrival-modal, .valet-nfc-modal) {
    border: 1px solid CanvasText;
    background: Canvas;
    color: CanvasText;
    box-shadow: none;
  }

  :where(body.schedule-page, body.valet-page)
    :where(.active, [aria-current="page"], [aria-pressed="true"]) {
    outline: 2px solid Highlight;
    outline-offset: -2px;
  }
}
