/* Final schedule surface layer. Layout and event logic stay in app.js. */

@media screen {
  body[data-page="schedule"] #main > .heading {
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom-color: var(--line);
  }

  body[data-page="schedule"] #main > .heading h1 {
    font-size: clamp(28px, 3vw, 34px);
    line-height: 1.12;
    letter-spacing: -0.018em;
  }

  body[data-page="schedule"] #main > .heading .sub {
    max-width: 58ch;
    margin-top: 4px;
    color: var(--muted);
    line-height: 1.45;
  }

  body[data-page="schedule"] #main > .schedule-unified-controls {
    min-width: 0;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface, #fff);
    box-shadow: 0 2px 10px rgba(58, 45, 29, 0.045);
  }

  body[data-page="schedule"] .schedule-unified-controls :is(input, select, button, summary) {
    min-width: 0;
  }

  body[data-page="schedule"] .schedule-unified-controls :is(input[type="search"], select, .schedule-date-bound input) {
    min-height: 44px;
    border-radius: 8px;
  }

  body[data-page="schedule"] .schedule-unified-controls .month-navigation {
    min-width: 0;
    align-items: center;
  }

  body[data-page="schedule"] .schedule-unified-controls .month-navigation > button {
    flex: 0 0 44px;
    width: 44px;
    min-height: 44px;
    border-radius: 8px;
  }

  body[data-page="schedule"] .schedule-unified-controls .month-picker {
    min-width: 0;
    font-size: clamp(20px, 2vw, 23px);
    line-height: 1.2;
    text-align: center;
  }

  body[data-page="schedule"] .schedule-unified-controls .schedule-period-options {
    min-width: 0;
  }

  body[data-page="schedule"] .schedule-period-select {
    display: grid;
    gap: 4px;
    min-width: 0;
  }

  body[data-page="schedule"] .schedule-period-select > span {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.3;
  }

  body[data-page="schedule"] .schedule-unified-controls .schedule-period-options select {
    min-width: 0;
    max-width: 100%;
  }

  body[data-page="schedule"] .schedule-unified-controls .schedule-actor-row {
    min-width: 0;
  }

  body[data-page="schedule"] .schedule-unified-controls .schedule-actor-row > label:first-child,
  body[data-page="schedule"] .schedule-unified-controls .schedule-date-bound {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
  }

  body[data-page="schedule"] .schedule-unified-controls .schedule-search-types,
  body[data-page="schedule"] .schedule-unified-controls .schedule-inline-filters,
  body[data-page="schedule"] .schedule-unified-controls .schedule-visible-filters {
    min-width: 0;
  }

  body[data-page="schedule"] .schedule-unified-controls .schedule-search-types > input {
    width: 100%;
  }

  body[data-page="schedule"] .schedule-unified-controls .schedule-kind-options {
    min-width: 0;
    border-radius: 9px;
  }

  body[data-page="schedule"] .schedule-unified-controls .schedule-kind-options button {
    min-width: 0;
    min-height: 44px;
    line-height: 1.25;
    text-wrap: balance;
  }

  body[data-page="schedule"] .schedule-unified-controls .schedule-visible-filters {
    align-items: end;
  }

  body[data-page="schedule"] .schedule-unified-controls .filter-reset {
    min-height: 44px;
    border-radius: 8px;
    white-space: normal;
  }

  body[data-page="schedule"] #schedule-content {
    min-width: 0;
  }

  body[data-page="schedule"] #schedule-content .calendar {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface, #fff);
    box-shadow: 0 2px 10px rgba(58, 45, 29, 0.04);
  }

  body[data-page="schedule"] #schedule-content .weekday {
    min-width: 0;
    padding: 10px 6px;
    background: var(--wash);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    line-height: 1.25;
    text-transform: uppercase;
  }

  body[data-page="schedule"] #schedule-content .day {
    min-width: 0;
    background: #fffdf8;
  }

  body[data-page="schedule"] #schedule-content .day-select {
    min-width: 0;
    color: var(--muted);
  }

  body[data-page="schedule"] #schedule-content .day-date,
  body[data-page="schedule"] #schedule-content .day-count {
    font-variant-numeric: tabular-nums;
  }

  body[data-page="schedule"] #schedule-content .event {
    min-width: 0;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(58, 45, 29, 0.04);
    overflow-wrap: anywhere;
    transition: box-shadow 160ms ease, transform 160ms ease;
  }

  body[data-page="schedule"] #schedule-content .event:hover {
    box-shadow: 0 3px 8px rgba(58, 45, 29, 0.1);
    transform: translateY(-1px);
  }

  body[data-page="schedule"] #schedule-content .event strong {
    display: block;
    min-width: 0;
    font-family: var(--serif, Georgia, serif);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: -0.005em;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  body[data-page="schedule"] #schedule-content .event :is(.time, .event-kind, small) {
    min-width: 0;
    font-family: var(--sans, system-ui, sans-serif);
    font-size: 11px;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  body[data-page="schedule"] #schedule-content .event .time {
    font-variant-numeric: tabular-nums;
    font-weight: 650;
  }

  body[data-page="schedule"] #schedule-content .event small {
    color: var(--muted);
  }

  body[data-page="schedule"] #schedule-content :is(.event, .agenda-event):focus-visible,
  body[data-page="schedule"] #schedule-content .day-select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
  }
}

/* 2026-10-27: shared planner rhythm. The schedule keeps its data model and
   event states; this layer only aligns color, type, spacing and states. */
body[data-page="schedule"] {
  --schedule-space-1: 6px;
  --schedule-space-2: 10px;
  --schedule-space-3: 14px;
  --schedule-space-4: 20px;
  --schedule-control-height: 42px;
}

body[data-page="schedule"] #main > .heading h1,
body[data-page="schedule"] .month-picker,
body[data-page="schedule"] #schedule-content .agenda-event strong,
body[data-page="schedule"] #schedule-content .event strong {
  font-family: var(--serif, Georgia, serif);
  font-weight: 500;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

body[data-page="schedule"] #main > .heading .sub,
body[data-page="schedule"] .schedule-unified-controls,
body[data-page="schedule"] #schedule-content .event,
body[data-page="schedule"] #schedule-content .agenda-event,
body[data-page="schedule"] .calendar-legend,
body[data-page="schedule"] .filtered-events {
  font-family: var(--sans, system-ui, sans-serif);
}

body[data-page="schedule"] .schedule-unified-controls {
  display: grid;
  gap: var(--schedule-space-3);
  border-color: color-mix(in srgb, var(--accent) 18%, var(--line));
  background: var(--surface, #fff);
  box-shadow: 0 4px 18px rgba(58, 45, 29, .055);
}

body[data-page="schedule"] .schedule-period-row,
body[data-page="schedule"] .schedule-search-types,
body[data-page="schedule"] .schedule-actor-row,
body[data-page="schedule"] .schedule-visible-filters,
body[data-page="schedule"] .schedule-inline-filters,
body[data-page="schedule"] .schedule-extra-filter-content {
  gap: var(--schedule-space-2);
}

body[data-page="schedule"] .schedule-unified-controls :is(input, select, button, summary) {
  min-height: var(--schedule-control-height);
}

body[data-page="schedule"] .schedule-unified-controls :is(input, select) {
  border-color: color-mix(in srgb, var(--accent) 18%, var(--line));
  background: var(--surface, #fff);
}

body[data-page="schedule"] .schedule-unified-controls .segmented {
  padding: 3px;
  border-color: color-mix(in srgb, var(--accent) 14%, var(--line));
  background: var(--wash);
}

body[data-page="schedule"] .schedule-unified-controls .segmented button {
  color: var(--muted);
}

body[data-page="schedule"] .schedule-unified-controls .segmented button.selected {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(58, 45, 29, .12);
}

body[data-page="schedule"] .schedule-extra-filters > summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--accent);
  font-weight: 600;
}

body[data-page="schedule"] .schedule-filter-count {
  display: inline-grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

body[data-page="schedule"] #schedule-content .calendar,
body[data-page="schedule"] #schedule-content .agenda {
  border-color: color-mix(in srgb, var(--accent) 16%, var(--line));
  box-shadow: 0 4px 18px rgba(58, 45, 29, .045);
}

body[data-page="schedule"] #schedule-content .weekday {
  background: var(--wash);
  color: var(--accent);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .045em;
}

body[data-page="schedule"] #schedule-content .event,
body[data-page="schedule"] #schedule-content .agenda-event {
  box-shadow: none;
}

body[data-page="schedule"] #schedule-content .event:hover,
body[data-page="schedule"] #schedule-content .agenda-event:hover {
  box-shadow: 0 3px 9px rgba(58, 45, 29, .11);
  transform: translateY(-1px);
}

body[data-page="schedule"] #schedule-content .event strong {
  font-size: 13px;
  line-height: 1.28;
}

body[data-page="schedule"] #schedule-content .agenda-event strong {
  font-size: 17px;
  line-height: 1.28;
}

body[data-page="schedule"] #schedule-content :is(.event, .agenda-event) :is(.time, .agenda-time) {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

body[data-page="schedule"] #schedule-content .schedule-availability-warning {
  margin-top: var(--schedule-space-2);
  border: 1px solid color-mix(in srgb, var(--gold, #876b3e) 38%, var(--line));
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
}

body[data-page="schedule"] #schedule-content :is(.event, .agenda-event):focus-visible,
body[data-page="schedule"] #schedule-content .day-select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 65%, transparent);
  outline-offset: -2px;
}

@media (max-width: 760px) {
  body[data-page="schedule"] .schedule-unified-controls {
    padding: 12px;
  }
  body[data-page="schedule"] .schedule-period-row {
    align-items: stretch;
  }
  body[data-page="schedule"] .schedule-period-options,
  body[data-page="schedule"] .schedule-view-modes {
    width: 100%;
  }
  body[data-page="schedule"] .schedule-period-options select,
  body[data-page="schedule"] .schedule-view-modes button {
    width: 100%;
  }
  body[data-page="schedule"] .schedule-unified-controls .personal-view-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  body[data-page="schedule"] .schedule-unified-controls .personal-view-row button {
    min-height: 44px;
    padding: 7px 8px;
    font-size: 12px;
    line-height: 1.25;
  }
  body[data-page="schedule"] .schedule-unified-controls .personal-view-row button:last-child {
    grid-column: 1 / -1;
  }
  body[data-page="schedule"] #schedule-content .agenda-day {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
  }
  body[data-page="schedule"] #schedule-content .agenda-date {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
  }
  body[data-page="schedule"] #schedule-content .agenda-event {
    grid-template-columns: 58px minmax(0, 1fr) 16px;
    gap: 8px;
    padding: 10px 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-page="schedule"] #schedule-content :is(.event, .agenda-event) {
    transition: none;
  }
}

@media screen and (min-width: 761px) and (max-width: 1100px) {
  body[data-page="schedule"] .schedule-unified-controls .schedule-visible-filters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  body[data-page="schedule"] .schedule-unified-controls .filter-reset {
    grid-column: 1 / -1;
    justify-self: end;
  }
}

@media screen and (max-width: 800px) {
  body[data-page="schedule"] #main > .heading {
    margin-bottom: 10px;
    padding-bottom: 10px;
  }

  body[data-page="schedule"] #main > .heading h1 {
    font-size: 26px;
  }

  body[data-page="schedule"] #main > .schedule-unified-controls {
    gap: 8px;
    padding: 10px;
    border-radius: 10px;
  }

  body[data-page="schedule"] .schedule-unified-controls .month-picker {
    font-size: 20px;
  }

  body[data-page="schedule"] .schedule-unified-controls .schedule-kind-options button {
    min-height: 44px;
    padding-inline: 5px;
    font-size: 12px;
    line-height: 1.2;
  }

  body[data-page="schedule"] .schedule-unified-controls .schedule-visible-filters {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-page="schedule"] .schedule-unified-controls .filter-reset {
    grid-column: 1;
    justify-self: stretch;
  }

  body[data-page="schedule"] #schedule-content .calendar {
    border-radius: 10px;
  }

  body[data-page="schedule"] #schedule-content .event strong {
    font-size: 12px;
    line-height: 1.25;
  }

  body[data-page="schedule"] #schedule-content .event :is(.time, .event-kind, small) {
    font-size: 11px;
  }
}

@media screen and (max-width: 430px) {
  body[data-page="schedule"] .schedule-unified-controls .schedule-kind-options button {
    font-size: 12px;
    padding-inline: 4px;
    white-space: normal;
  }

  body[data-page="schedule"] #schedule-content .calendar .event {
    padding: 5px 4px;
  }
}

@media screen and (prefers-reduced-motion: reduce) {
  body[data-page="schedule"] #schedule-content .event {
    transition: none;
  }

  body[data-page="schedule"] #schedule-content .event:hover {
    transform: none;
  }
}

@media print {
  body[data-page="schedule"] #main > .schedule-unified-controls {
    display: none;
  }
}

/* 2026-10-28: compact readable rhythm for the schedule surface. */
@media screen and (min-width: 981px) {
  body[data-page="schedule"] #schedule-content .day {
    min-height: 118px;
    padding: 6px;
  }

  body[data-page="schedule"] #schedule-content .event {
    margin: 2px 0;
    padding: 5px 6px;
  }
}

@media screen and (max-width: 480px) {
  body[data-page="schedule"] #schedule-content .calendar {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-page="schedule"] #schedule-content .calendar .day {
    min-height: 0;
    padding: 8px 10px;
  }

  body[data-page="schedule"] #schedule-content .calendar .day-select {
    min-height: 44px;
    padding: 2px 0 6px;
  }

  body[data-page="schedule"] #schedule-content .calendar .day-events {
    gap: 6px;
  }

  body[data-page="schedule"] #schedule-content .calendar .event {
    min-height: 44px;
    padding: 7px 8px;
  }

  body[data-page="schedule"] #schedule-content .calendar .event strong {
    font-size: 13px;
    line-height: 1.35;
  }

  body[data-page="schedule"] #schedule-content .calendar .event :is(.time, .event-kind, small) {
    font-size: 12px;
    line-height: 1.35;
  }
}

@media screen and (hover: none) {
  body[data-page="schedule"] #schedule-content :is(.event, .agenda-event):hover {
    box-shadow: none;
    transform: none;
  }
}

/* 2026-10-28: shared visual finish for every signed-in workspace. */
@media screen {
  body[data-viewer] {
    text-rendering: optimizeLegibility;
  }

  body[data-viewer] :is(h1, h2, h3, h4, .dialog-head h2, .card h2, .card h3) {
    text-wrap: balance;
  }

  body[data-viewer] :is(input, select, textarea) {
    border-radius: 9px;
    line-height: 1.35;
  }

  body[data-viewer] :is(button, input, select, textarea, summary, a):focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent, #852f43) 56%, transparent);
    outline-offset: 2px;
  }

  body[data-viewer] :is(.toolbar, .actions, .heading-actions) {
    gap: 8px;
  }

  body[data-viewer="staff"] #main .availability-staff .availability-staff-row-actions button {
    min-height: 44px;
  }

  body[data-viewer] :is(.card, .notice, .error, .empty-state, dialog) {
    overflow-wrap: anywhere;
  }

  body[data-viewer] .messages-surface:not(.messages-general-archive) :is(button, input, select) {
    min-height: 44px;
  }

  body[data-viewer] .accuracy-inline-form :is(input:not([type="checkbox"]):not([type="radio"]), select),
  body[data-viewer] .accuracy-inline-form .primary {
    min-height: 44px !important;
    height: 44px !important;
  }
}

@media screen and (max-width: 800px) {
  body[data-viewer] :is(input, select, textarea) {
    min-height: 44px;
  }

  body[data-viewer] :is(nav button, .segmented button, [role="tablist"] > button,
    .toolbar > button, .actions > button, .heading-actions > button) {
    min-height: 44px;
  }

  body[data-viewer="staff"] nav button {
    min-height: 44px;
  }

  body[data-viewer] .monthly-stage [data-month-select] {
    min-height: 44px;
  }

  body[data-viewer] .book-casts-role-order button,
  body[data-viewer] .book-casts-count-edit,
  body[data-viewer] .book-casts-entry-source > summary {
    min-height: 44px;
  }

  body[data-viewer] .familiar-paper .familiar-cell-button {
    min-height: 44px;
  }

  body[data-viewer] .familiar-row-tools button,
  body[data-viewer] .familiar-add-tools button {
    min-height: 44px;
  }

  body[data-viewer] .activity-planning-candidate button,
  body[data-viewer] .my-dates-request .actions button,
  body[data-viewer] .dd-section-tabs button,
  body[data-viewer] #planning-refresh-status button {
    min-height: 44px;
  }

  body[data-viewer] .schedule-kind-options button,
  body[data-viewer] .personal-view-row button {
    min-height: 44px;
  }

  body[data-viewer] .actor-edit-icon,
  body[data-viewer] .people-title-add {
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
  }

  body[data-viewer] :is(.activity-picker-scopes button, .activity-picker-categories button,
    .repertoire-menu-items button, .repertoire-footer .repertoire-actions button,
    .repertoire-month-cast-cell button) {
    min-height: 44px;
  }

  body[data-viewer] :is(.personal-cast-unassigned > summary, .my-role-detail summary,
    .my-role-cast summary, .inbox-leader-chip button, .inbox-leader-choices button,
    .planning-workspace-readiness summary, .activity-planning-person summary,
    .ds-table-details summary, .ds-periods button,
    .theatre-stand-sheet-settings summary, .theatre-stand-break,
    .book-casts-source-archive > summary, .book-casts-new-person > summary,
    .schedule-density-filters > summary, .availability-density-filters > summary) {
    min-height: 44px;
  }
}

@media screen and (max-width: 360px) {
  body[data-viewer="actor"][data-page="profile"] nav#navigation button span {
    font-size: 11px;
    line-height: 1.2;
  }
}
