/* Main Control is an iPad landscape workstation. The document stays still;
   the selected workspace owns the remaining height and scrolls internally. */
@media (min-width: 768px) and (max-width: 1366px) and (orientation: landscape) {
  html,
  body {
    min-height: 100%;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .mc-header { display: none; }

  #admin-global-nav {
    min-height: 42px;
    height: 42px;
    padding: 0 10px;
    gap: 2px;
  }
  #admin-global-nav .admin-nav-label { display: none; }
  #admin-global-nav a {
    padding: 7px 9px;
    font-size: 15px;
  }
  #admin-global-nav a:last-child { margin-left: 0; }

  .mc-shell {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-width: none;
    min-height: calc(100dvh - 42px);
    height: auto;
    margin: 0;
    padding: 6px 10px 8px;
    overflow: visible;
  }
  .mc-shell > .mc-datebar,
  .mc-shell > .mc-overview,
  .mc-shell > .mc-section,
  .mc-shell > .mc-workspace {
    flex: none;
    margin-top: 0;
    border-radius: 10px;
  }

  .mc-datebar {
    min-height: 56px;
    height: 56px;
    padding: 6px 12px;
    gap: 7px;
  }
  .mc-datebar p { display: none; }
  .mc-datebar h1 {
    margin: 0;
    font-size: 26px;
  }
  .mc-datebar > button:not(.ghost) {
    min-width: 38px;
    padding: 3px 7px;
    font-size: 25px;
  }
  .mc-datebar .ghost {
    min-height: 36px;
    padding: 6px 10px;
    font-size: 14px;
  }
  .mc-datebar input {
    min-height: 36px;
    padding: 5px 8px;
    font-size: 14px;
  }

  .mc-live-strip {
    grid-template-columns: 118px 146px minmax(0, 1fr) !important;
    min-height: 88px;
    height: 88px;
    overflow: hidden !important;
  }
  .mc-live-strip .capacity-card,
  .mc-live-strip .mc-live-metric,
  .mc-live-strip .quick-card {
    min-height: 0;
    height: 86px;
    padding: 8px 10px;
  }
  .mc-live-strip .capacity-card {
    display: grid;
    align-content: center;
    padding-right: 8px;
    padding-left: 10px;
  }
  .mc-live-strip .capacity-card p,
  .mc-live-strip .mc-live-metric p { font-size: 14px; }
  .mc-live-strip .capacity-card strong { font-size: 27px; }
  .mc-live-strip .capacity-card span { display: none; }
  .mc-live-strip .mc-live-metric {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    column-gap: 5px;
    padding-right: 8px;
    padding-left: 9px;
  }
  .mc-live-strip .mc-live-metric p,
  .mc-live-strip .mc-live-metric strong { grid-column: 1; }
  .mc-live-strip .mc-live-metric strong { font-size: 22px; }
  .mc-live-strip .mc-live-metric button {
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: center;
    min-height: 30px;
    margin: 0;
    padding: 4px 6px;
    font-size: 13px;
  }
  .mc-live-strip .quick-card {
    grid-column: auto;
    flex-direction: row;
    align-items: center;
    gap: 6px;
  }
  .mc-live-strip .quick-card > p:first-child { display: none; }
  .mc-live-strip .quick-card .quick-action-buttons {
    flex-wrap: nowrap;
    gap: 5px;
  }
  .mc-live-strip .quick-card .primary {
    min-height: 44px;
    padding: 8px 12px;
    font-size: 16px;
    white-space: nowrap;
  }
  .mc-live-strip .quick-card .manual-lock-action {
    min-height: 44px;
    padding: 8px 12px;
    font-size: 16px;
  }

  .compact-today-controls {
    min-height: 90px;
    height: auto;
    padding: 7px 8px;
  }
  .control-matrix {
    grid-template-columns: 92px 92px repeat(5, minmax(0, 1fr)) 92px;
    gap: 5px;
  }
  .control-code-card {
    min-height: 76px;
    padding: 8px 9px;
  }
  .control-code-card > strong { font-size: 22px; }
  .control-code-card > span { font-size: 15px; }
  .capacity-control-card > strong { font-size: 17px; }
  .capacity-control-card .control-primary-value b { font-size: 24px; }
  .bulk-control-open { min-height: 76px; }
  .bulk-control-open span { font-size: 18px; }

  .staff-today-section {
    display: block;
    min-height: 96px;
    height: auto;
    padding: 8px 10px;
  }
  .staff-strip { display: flex; align-items: stretch; gap: 6px; min-width: 0; }
  #toggle-off {
    flex: 0 0 58px;
    min-height: 100px;
    padding: 8px 6px;
    font-size: 16px;
  }
  .staff-row {
    flex: 1 1 auto;
    gap: 6px;
    min-width: 0;
    padding: 0;
  }
  .staff-card {
    width: 122px;
    min-width: 122px;
    height: 100px;
    padding: 8px 10px;
  }
  .staff-card.has-queue { padding: 6px 8px; }
  .staff-card-top strong { font-size: 18px; }
  .staff-card-arrow {
    width: 26px;
    height: 26px;
    font-size: 19px;
  }
  .staff-card-room { font-size: 16px !important; }
  .staff-card-end { font-size: 14px !important; }

  .rooms-section {
    display: block;
    min-height: 72px;
    height: 72px;
    padding: 7px 10px;
  }
  .room-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
    gap: 5px;
    min-width: 0;
    padding: 0 0 2px;
    overflow: hidden;
  }
  .room-card {
    width: auto;
    min-width: 0;
    min-height: 56px;
    padding: 6px 8px;
  }
  .room-card strong { color: #111d1a; font-size: 23px; font-weight: 950; line-height: 1.05; }
  .room-card span { font-size: 13px; font-weight: 700; }

  .mc-workspace {
    display: block;
    flex: none !important;
    min-height: 0;
    margin-top: 0;
  }
  .mc-workspace-head {
    flex: none;
    min-height: 52px;
    padding: 7px 10px;
    overflow: hidden;
  }
  .view-tabs {
    flex: 1;
    min-width: 0;
    gap: 7px;
    overflow-x: auto;
  }
  .view-tabs button {
    flex: none;
    min-height: 50px;
    padding: 9px 15px;
    color: #111b18;
    font-size: 19px;
    font-weight: 900;
    white-space: nowrap;
  }
  .view-tabs button.active { background: #2f6f63; color: #fff; }
  .workspace-back-top {
    min-height: 50px;
    padding: 9px 12px;
    font-size: 17px;
  }
  #workspace-note { display: none; }
  .mc-view:not([hidden]) {
    display: block;
    flex: none;
    min-height: 0;
    padding: 11px 13px;
    overflow: visible;
  }
  #calendar-view:not([hidden]) {
    display: block;
    overflow: visible;
  }
  .calendar-key {
    flex: none;
    padding: 2px 0 4px 8px;
  }
  .calendar-key .key-note { display: none; }
  .staff-calendar-scroll {
    min-height: 360px;
    max-height: 720px;
  }
  #visits-view:not([hidden]) { padding: 0; }
  .visit-master-detail {
    height: 100dvh;
    min-height: 620px;
    overflow: hidden;
  }

  .staff-today-section .staff-drawer,
  .staff-today-section .off-drawer,
  .today-control-drawer:not([hidden]) {
    position: fixed;
    z-index: 50;
    top: 52px;
    left: 50%;
    width: min(1120px, calc(100vw - 24px));
    max-height: calc(100dvh - 64px);
    margin: 0;
    overflow: auto;
    transform: translateX(-50%);
    border: 1px solid #c9d5cf;
    border-radius: 12px;
    background: #f5f7f4;
    box-shadow: 0 18px 54px rgba(38, 58, 54, .3);
  }
}
