/* Service controls and narrow-screen adaptations for the handoff's desktop canvas. */
[hidden] {
  display: none !important;
}
.handoff-skip {
  position: fixed;
  top: -80px;
  left: 12px;
  z-index: 100;
  background: white;
  padding: 12px;
}
.handoff-skip:focus {
  top: 8px;
}
#handoff-status {
  margin: 32px auto;
  width: fit-content;
  font: 14px var(--font-family);
}
#workspace-navigation-status {
  position: fixed;
  inset-inline-end: var(--space-4);
  bottom: var(--space-4);
  z-index: 80;
  max-width: calc(100% - 2 * var(--space-4));
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--color-surface);
  color: var(--color-text);
  font: 14px/1.5 var(--font-family);
}
#workspace-navigation-status button {
  min-height: 36px;
  flex: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
#handoff-app :focus-visible,
#handoff-app :is(.fpill, .filter-pill):has(> select:focus-visible) {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}
#handoff-app :is(.fpill, .filter-pill) > select:focus-visible {
  outline: none;
}
#handoff-app .theme-switch {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 12px;
  border: 1px solid #ffffff29;
  border-radius: 10px;
  background: #ffffff0f;
}
#handoff-app .theme-switch button {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #c9c9c9;
  font: inherit;
  font-size: 13px;
}
#handoff-app .theme-switch button[aria-pressed='true'] {
  background: #ffffff29;
  color: white;
  font-weight: 700;
}
#handoff-app .mobile-menu {
  display: none;
}
#handoff-app #toast {
  position: fixed !important;
  z-index: 100 !important;
}
#handoff-app [data-operational-ui] {
  min-width: 0;
}
#handoff-app .kpi-note {
  margin-top: 4px;
  overflow-wrap: anywhere;
}
:is(#dashboard-content, #empty-state):has(> .dashboard-summary) {
  container: dashboard-body / inline-size;
}
.dashboard-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: auto repeat(2, 1fr);
  gap: var(--space-3);
}
.dashboard-summary-group,
.dashboard-summary-cards {
  display: grid;
  grid-template: subgrid / subgrid;
}
.dashboard-summary-group {
  grid-row: 1 / -1;
}
.dashboard-summary-group:first-child {
  grid-column: span 2;
}
.dashboard-summary-group:last-child {
  grid-column: span 3;
}
.dashboard-summary-group > * {
  grid-column: 1 / -1;
}
.dashboard-summary-cards {
  grid-row: 2 / -1;
}
.dashboard-summary-value {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 6px;
  margin-top: var(--space-1);
}
.dashboard-summary-value .num {
  min-width: 0;
  overflow-wrap: anywhere;
}
@container dashboard-body (max-width: 799px) {
  .dashboard-summary {
    --rental-rows: 2;
    --sales-rows: 3;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto repeat(var(--rental-rows), 1fr) auto repeat(var(--sales-rows), 1fr);
  }
  .dashboard-summary-group:first-child {
    grid-column: 1 / -1;
    grid-row: span calc(var(--rental-rows) + 1);
  }
  .dashboard-summary-group:last-child {
    grid-column: 1 / -1;
    grid-row: span calc(var(--sales-rows) + 1);
  }
}
@container dashboard-body (max-width: 319px) {
  .dashboard-summary {
    --rental-rows: 4;
    --sales-rows: 6;
    grid-template-columns: minmax(0, 1fr);
  }
}
#handoff-app .catalog-venue-name,
#handoff-app .catalog-empty-link,
.catalog-venue-prompt button {
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
#handoff-app .catalog-venue-name {
  min-width: 0;
  word-break: keep-all;
  overflow-wrap: anywhere;
  font-weight: 600;
}
.catalog-venue-label {
  min-width: 0;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
#handoff-app .catalog-empty-link {
  display: block;
  width: fit-content;
  margin: var(--space-2) auto 0;
}
.catalog-venue-prompt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-secondary);
  font-size: 13px;
}
.catalog-venue-prompt button {
  min-height: 36px;
  padding: 0 var(--space-1);
  border: 0;
  background: transparent;
  font-weight: 600;
}

.main > div:has(> .performance-summary-grid) {
  container: analytics-body / inline-size;
}
.performance-summary-grid {
  display: grid;
  grid-template-columns: repeat(var(--summary-columns, 1), minmax(min-content, 1fr));
  gap: var(--space-3);
}
.performance-summary-grid .lbl {
  word-break: keep-all;
  overflow-wrap: anywhere;
}
@container analytics-body (min-width: 344px) {
  .performance-summary-grid {
    --summary-columns: 2;
  }
}
@container analytics-body (min-width: 570px) {
  .performance-summary-grid {
    --summary-columns: 3;
  }
}
@container analytics-body (min-width: 940px) {
  .performance-summary-grid {
    --summary-columns: 6;
  }
}
.main > div:has(> #perf-contents) {
  --performance-section-gap: var(--space-5);
}
.performance-content-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-4);
  text-align: left;
  color: inherit;
  overflow-wrap: anywhere;
}
.performance-content-metrics {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: var(--space-3) var(--space-4);
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-divider);
  font-variant-numeric: tabular-nums;
  word-break: keep-all;
}

#vperf-filter .fpill {
  min-width: 0;
  max-width: 100%;
}
#vperf-filter .fpill svg {
  flex: none;
}
#vperf-filter .fpill select {
  min-width: 0;
  text-overflow: ellipsis;
}

/* Table columns scroll together while expanded detail stays in the visible pane. */
.analytics-table-scroll {
  container-type: inline-size;
}
.analytics-table-detail {
  position: sticky;
  left: 0;
  max-width: 100cqi;
  box-sizing: border-box;
  min-width: 0;
  contain: inline-size;
}
body[data-page='analytics-venues'] .main {
  scrollbar-gutter: stable;
}
/* The header and expandable rows share tracks sized by the largest visible value. */
:is(#perf-detail, #vperf-list) .analytics-table-scroll > div {
  display: grid;
  column-gap: var(--space-5);
}
#perf-detail .analytics-table-scroll > div {
  grid-template-columns:
    max-content max-content minmax(160px, 2fr) minmax(120px, 1.25fr) minmax(60px, 0.6fr)
    repeat(3, minmax(max-content, 0.75fr)) minmax(max-content, 1.25fr)
    minmax(max-content, 1fr) max-content;
}
#vperf-list .analytics-table-scroll > div {
  grid-template-columns:
    max-content minmax(140px, 1.4fr) minmax(104px, 1fr) minmax(60px, 0.6fr) max-content
    repeat(2, minmax(max-content, 1fr)) minmax(104px, 1fr)
    repeat(2, minmax(max-content, 1.45fr)) minmax(max-content, 1fr)
    minmax(calc(160px + var(--space-2) + var(--space-5)), max-content);
}
:is(#perf-detail, #vperf-list) .analytics-table-scroll > div > * {
  grid-column: 1 / -1;
}
.analytics-production-title,
.analytics-place {
  min-width: 0;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.analytics-production-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 500;
}
.analytics-production-title > :first-child {
  min-width: 0;
}
#vperf-list
  .analytics-table-scroll
  > div
  > :is(:first-child, .prow)
  > :is(:nth-child(9), :last-child) {
  margin-inline-start: var(--space-2);
}
#vperf-list .analytics-table-scroll > div > .prow > :nth-child(8) {
  flex-direction: row-reverse;
}
#vperf-list .analytics-table-scroll > div > .prow > :nth-child(8) > :last-child {
  max-width: 64px;
}
.analytics-grade-note {
  color: var(--color-text-secondary);
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
#perf-detail
  .analytics-table-scroll
  > div
  > :is(div:first-child, .prow)
  > :nth-child(n + 6):nth-child(-n + 10),
#vperf-list
  .analytics-table-scroll
  > div
  > :is(div:first-child, .prow)
  > :nth-child(n + 5):nth-child(-n + 11) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
:root[data-theme='dark'] #handoff-app .card {
  background: var(--color-surface);
  border-color: var(--color-border);
}
:root[data-theme='dark'] #handoff-app :is(.lbl, th) {
  color: var(--color-text-muted);
}
:root[data-theme='dark'] #handoff-app .fld {
  color: var(--color-text-secondary);
}
:root[data-theme='dark'] #handoff-app .fgrp {
  color: var(--color-text);
  border-color: var(--color-divider);
}
:root[data-theme='dark'] #handoff-app :is(.inp, .fpill) {
  background-color: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}
:root[data-theme='dark'] #handoff-app :is(th, td) {
  border-color: var(--color-divider);
}
:root[data-theme='dark'] #handoff-app .hero {
  background-color: var(--color-canvas);
}
:root[data-theme='dark'] #handoff-app #login {
  color-scheme: light;
}
:root[data-theme='dark'] #handoff-app #login .card,
:root[data-theme='dark'] #handoff-app #login .inp {
  background: white;
  color: #111;
}
@media (max-width: 1100px) {
  #handoff-app .main > header,
  #handoff-app .main > div {
    padding-inline: 32px !important;
  }
  #handoff-app #performance-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 767px) {
  html:has(body[data-page='analytics-venues']) {
    overflow-y: scroll;
  }
  #handoff-app .shell {
    display: flex;
    flex-direction: column !important;
    height: auto !important;
    min-height: 100dvh;
    overflow: visible !important;
  }
  #handoff-app .mobile-menu {
    display: block;
    align-self: stretch;
    text-align: left;
    min-height: 48px;
    padding: 0 20px;
    background: #111;
    color: #fff;
    border: 0;
  }
  #handoff-app .side {
    display: none !important;
  }
  #handoff-app .side[data-open='true'] {
    display: flex !important;
  }
  #handoff-app .main {
    overflow: visible !important;
  }
  #handoff-app .main > header,
  #handoff-app .main > div {
    padding-inline: 20px !important;
  }
  #handoff-app #performance-cards {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)) !important;
  }
  #handoff-app :is(#sales, #rent, #open) > div:last-child {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  #handoff-app #shows-detail {
    min-width: 0;
  }
  #handoff-app #shows-detail > div[style*='grid'] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  #handoff-app [aria-modal='true'].card {
    margin: auto;
    max-width: 100% !important;
  }
  #handoff-app [aria-modal='true'] [style*='grid-template-columns: 1fr 1fr'],
  #handoff-app .venue-form-fields {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  #handoff-app
    :is(
      #venues-modal,
      #shows-modal,
      #shows-cmodal,
      #shows-delmodal,
      #logout-modal,
      #vperf-drawer,
      #vperf-venue,
      #error-page,
      #login
    ) {
    position: fixed !important;
  }
  #handoff-app :is(#vperf-filter, #venues-filter, #shows-filter) > * {
    max-width: 100%;
    box-sizing: border-box;
  }
  #handoff-app :is(#vperf-filter, #venues-filter, #shows-filter) > :is(label, button) {
    min-height: var(--control-height);
  }
  #handoff-app :is(#vperf-filter, #venues-filter, #shows-filter) label :is(input, select) {
    height: calc(var(--control-height) - 2px);
  }
  #handoff-app .main input,
  #handoff-app .main select,
  #handoff-app [aria-modal='true'] input {
    font-size: 16px !important;
  }
  #handoff-app .main div:has(> .tip) {
    position: relative;
  }
  #handoff-app .main .tip {
    position: static !important;
  }
  #handoff-app .main .tipbox {
    left: 0 !important;
    max-width: 100%;
    box-sizing: border-box;
  }
}

#handoff-app #auth-form {
  position: relative;
}

:root[data-theme='dark'] body:has(#handoff-app) {
  background: var(--color-canvas);
  color: var(--color-text);
}

.report-file-history .report-file-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.report-file-history .report-file-link:hover {
  text-decoration: underline;
}
.report-file-history .history-field-label {
  display: none;
}
@media (max-width: 767px) {
  #handoff-app .report-file-history,
  #handoff-app .report-file-history tbody {
    display: block;
    min-width: 0;
  }
  .report-file-history thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .report-file-history tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'file state'
      'date actions'
      'qty sales';
    gap: var(--space-1) var(--space-3);
    align-items: start;
    padding: var(--space-3) var(--space-4);
  }
  .report-file-history tbody tr + tr {
    border-top: 1px solid var(--color-divider);
  }
  #handoff-app .report-file-history td {
    min-width: 0;
    padding: 0;
    border: 0;
    text-align: start;
    white-space: normal;
  }
  .report-file-history td:nth-child(1) {
    grid-area: date;
    font-size: var(--font-size-caption);
  }
  .report-file-history td:nth-child(2) {
    grid-area: file;
  }
  .report-file-history .report-file-link {
    min-height: 32px;
    overflow-wrap: anywhere;
  }
  .report-file-history td:nth-child(3) {
    grid-area: state;
    align-self: center;
  }
  .report-file-history td:nth-child(4) {
    grid-area: qty;
  }
  .report-file-history td:nth-child(5) {
    grid-area: sales;
    justify-self: end;
  }
  .report-file-history td:nth-child(4),
  .report-file-history td:nth-child(5) {
    margin-top: var(--space-2);
    font-variant-numeric: tabular-nums;
  }
  .report-file-history .history-field-label {
    display: inline;
    color: var(--color-text-muted);
    font-size: var(--font-size-caption);
  }
  .report-file-history td:nth-child(6) {
    grid-area: actions;
    justify-self: end;
  }
  #handoff-app .report-file-history td:nth-child(6) button {
    margin: 0;
  }
}
