/* Responsive and workstation layout. Loaded last: these rules override the area files. */
@media (max-width: 1050px) { .simulation-bar { flex-wrap: wrap; }.simulation-bar label { margin-left: 0; }.lower-grid { flex-direction: column; } }
/* Too narrow to seat the brand and the mode buttons side by side: stack them. */
@media (max-width: 800px) { .demo-grid, .demo-continuity-grid { grid-template-columns: 1fr; }.agent-activity-indicator { width: 100%; margin-left: 0; order: 2; }.tab-bar { flex-wrap: wrap; } .topbar { grid-template-columns: minmax(0, 1fr); } .topbar .mode-controls { grid-area: 2 / 1; justify-self: start; } .topbar .tab-bar { grid-area: 3 / 1; } }
@media (max-width: 760px) { .kpi-grid, .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* The Live Control Room is a workstation on a desktop: its frame is fixed to
   the viewport and only dense evidence areas scroll. Narrow windows keep the
   normal document flow declared above. */
/* Header compaction is a WIDTH concern only. It must not be gated on height:
   a short desktop window is exactly the case that can least afford four rows
   of chrome, and gating it there previously left those windows worse off than
   before any compaction existed. */
@media (min-width: 901px) {
  /* One header row: brand, views, activity, mode. The eyebrow and tagline are
     marketing rather than operational, so they yield their two lines to the map. */
  .topbar { min-height: 0; column-gap: 20px; padding: 0 0 8px; grid-template-columns: auto minmax(0, 1fr) auto; }
  .topbar > div:first-child { grid-area: 1 / 1; }
  .topbar .eyebrow, .topbar .tagline { display: none; }
  .topbar h1 { margin: 0; font-size: 1.3rem; }
  .topbar .tab-bar { grid-area: 1 / 2; min-height: 0; margin: 0; border-bottom: 0; overflow-x: auto; scrollbar-width: none; }
  .topbar .tab-bar::-webkit-scrollbar { display: none; }
  /* A view name that wraps to three lines is worse than one that scrolls. */
  .tab-button, .agent-activity-indicator { white-space: nowrap; }
  .topbar .mode-controls { grid-area: 1 / 3; }
  .topbar .mode-controls button, .simulation-bar button { padding: 7px 12px; font-size: .82rem; }
  .topbar .tab-button { padding: 7px 10px; font-size: .88rem; }
  /* The search opener shares the simulation row rather than owning one. */
  #control-room-view { display: grid; min-height: 0; gap: 8px 12px; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr); }
  .simulation-bar { min-height: 0; gap: 14px; margin: 0; padding: 7px 12px; grid-area: 1 / 1; }
  .simulation-bar > div { display: flex; gap: 7px; align-items: baseline; min-width: 0; }
  .simulation-bar > div .eyebrow { margin: 0; }
  .simulation-bar label { display: flex; gap: 7px; align-items: center; }
  .simulation-bar select { padding: 5px 26px 5px 7px; }
  .control-room-search { z-index: 30; align-items: center; min-height: 0; margin: 0; grid-area: 1 / 2; }
  /* The opener's grid column is only as wide as the button; size the palette to the viewport. */
  .search-palette { width: min(620px, calc(100vw - 40px)); }
  .dashboard { grid-area: 2 / 1 / 3 / 3; }
}
/* Only the bounded-workstation behaviour needs the height, because it trades
   page scrolling for locally scrolling panes and needs room to be worth it. */
@media (min-width: 901px) and (min-height: 800px) {
  body:has(#control-room-view:not([hidden])) { overflow: hidden; }
  .app-shell { display: grid; height: 100dvh; min-height: 0; max-width: none; padding: 10px 20px; grid-template-rows: auto minmax(0, 1fr); }
  .dashboard { min-height: 0; height: 100%; }
  .floor-section { display: grid; min-height: 0; padding: 16px; grid-template-rows: auto minmax(230px, 1fr) minmax(126px, .44fr); gap: 10px; }
  .section-heading { min-height: 30px; margin: 0; }
  .floor { height: auto; min-height: 0; }
  .lower-grid { min-height: 0; margin: 0; }
  .lower-grid > section { display: grid; min-height: 0; grid-template-rows: auto minmax(0, 1fr); }
  .lower-grid .eyebrow { margin-bottom: 5px; }
  .issue-list, .event-feed { max-height: none; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .context-panel { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 17px 18px; }
  .context-panel hr { margin: 16px 0; }
  .issue-summary { margin-top: 10px; }
  .baseline-panel { margin-top: 12px; }
  .recommendation-panel { margin-top: 12px; }
  .search-palette { max-height: calc(100dvh - 96px); overflow: auto; }
  /* The shell is fixed to the viewport here, so the non-floor views scroll
     inside their own frame instead of spilling past it. */
  #settings-view, #analytics-view, #rooms-view { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
}
/* Not wide enough for the activity wording next to everything else. The dot
   still shows state, and the live-region text stays available to assistive
   technology rather than being removed. */
@media (min-width: 901px) and (max-width: 1359px) {
  #agent-activity-label { position: absolute; width: 1px; height: 1px; overflow: hidden; white-space: nowrap; clip-path: inset(50%); }
  .agent-activity-indicator { padding: 6px 4px; }
}
/* Too narrow for brand, views and mode on one row (Offline adds a third mode
   button). Views take a second row rather than scrolling out of sight. */
@media (min-width: 901px) and (max-width: 1179px) {
  .topbar { row-gap: 6px; grid-template-columns: minmax(0, 1fr) auto; }
  .topbar .mode-controls { grid-area: 1 / 2; }
  .topbar .tab-bar { grid-area: 2 / 1 / 3 / -1; }
}
/* Wide enough to carry the tagline without costing the header a second row. */
@media (min-width: 1500px) {
  .topbar > div:first-child { display: flex; gap: 11px; align-items: baseline; }
  .topbar .tagline { display: block; color: var(--ink-3); font-size: .78rem; }
}
/* Screens launcher: opens each panel as its own wall-display page. */
.screen-launcher { position: relative; }
.screen-launcher > summary { list-style: none; cursor: pointer; padding: 7px 12px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-raised); color: var(--ink); font-size: .82rem; font-weight: 600; white-space: nowrap; }
.screen-launcher > summary::-webkit-details-marker { display: none; }
.screen-launcher-menu { position: absolute; right: 0; z-index: 40; display: grid; gap: 2px; min-width: 210px; margin-top: 6px; padding: 8px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-raised); box-shadow: var(--shadow-md); }
.screen-launcher-menu p { margin: 2px 6px 6px; color: var(--ink-3); font-size: .72rem; }
.screen-launcher-menu a { padding: 7px 8px; border-radius: var(--radius-sm); color: var(--ink); font-size: .85rem; text-decoration: none; }
.screen-launcher-menu a:hover, .screen-launcher-menu a:focus-visible { background: var(--accent-wash); color: var(--accent-ink); }
.control-room-search { gap: 8px; }

/* Wall-display screens (/rooms/:id/display/:screen): one panel fills the monitor.
   Console controls are removed; the clock, run state and agent activity stay. */
.display-mode .tab-bar > .tab-button, .display-mode .mode-controls, .display-mode #control-room-search,
.display-mode .simulation-bar label, .display-mode .simulation-bar button, .display-mode .topbar .tagline { display: none !important; }
.display-screen-label { margin: 0; color: var(--accent-ink); font-size: 1rem; font-weight: 700; }
.display-mode .topbar > div:first-child { display: flex; gap: 14px; align-items: baseline; }
.display-mode #agent-activity-label { position: static; width: auto; height: auto; clip-path: none; }
.display-mode .app-shell { max-width: none; }
.display-mode #control-room-view { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
.display-mode .simulation-bar, .display-mode .dashboard { grid-column: 1; }
.display-mode .simulation-bar strong { font-size: 1.15rem; }
.display-mode .dashboard { display: flex; min-height: 0; }
.display-mode[data-display="map"] .lower-grid,
.display-mode[data-display="map"] .context-panel,
.display-mode[data-display="issues"] .context-panel,
.display-mode[data-display="events"] .context-panel,
.display-mode[data-display="issues"] .floor-section > :not(.lower-grid),
.display-mode[data-display="events"] .floor-section > :not(.lower-grid),
.display-mode[data-display="issues"] .lower-grid > section:has(#event-feed),
.display-mode[data-display="events"] .lower-grid > section:has(#issue-list),
.display-mode[data-display="dispatch"] .floor-section { display: none !important; }
.display-mode .floor-section { flex: 1 1 auto; border-right: 0; }
.display-mode[data-display="map"] .floor-section { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.display-mode[data-display="map"] .floor { height: auto; min-height: 520px; }
.display-mode[data-display="issues"] .floor-section, .display-mode[data-display="events"] .floor-section { display: grid; grid-template-rows: minmax(0, 1fr); }
.display-mode[data-display="issues"] .lower-grid, .display-mode[data-display="events"] .lower-grid { margin: 0; min-height: 0; }
.display-mode .lower-grid > section { display: grid; min-height: 0; grid-template-rows: auto minmax(0, 1fr); }
.display-mode .issue-list, .display-mode .event-feed { align-content: start; max-height: none; min-height: 0; overflow-y: auto; font-size: 1.05rem; }
.display-mode .issue-card span { font-size: .85rem; }
.display-mode[data-display="dispatch"] .context-panel { flex: 1 1 auto; max-width: none; overflow-y: auto; padding: 22px 28px; }
@media (min-width: 901px) {
  .display-mode .app-shell { display: grid; height: 100dvh; padding: 10px 20px; grid-template-rows: auto minmax(0, 1fr); }
  body.display-mode { overflow: hidden; }
  .display-mode #analytics-view { min-height: 0; overflow-y: auto; }
}
.display-mode[data-display="pareto"] #analytics-content, .display-mode[data-display="pareto"] #analytics-view > .section-heading { display: none; }
.display-mode[data-display="pareto"] .pareto-panel { margin-top: 0; }
.display-mode[data-display="pareto"] .pareto-insight { font-size: 1.1rem; }

/* Staffing shares the console and display approval UI. */
.staffing-tile { min-width: 0; min-height: 0; overflow: auto; padding: 16px; background: var(--paper-raised); overflow-wrap: anywhere; }
.staffing-tile h3 { margin-top: 0; }
.staffing-open { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.staffing-open details, .staffing-open li { min-width: 0; }
.staffing-open p { margin: 0; }
.staffing-open label { display: grid; gap: 5px; min-width: 0; }
.staffing-open select, .staffing-open input, #staffing-policy { max-width: 100%; min-width: 0; }
.staffing-open table { border-collapse: collapse; width: 100%; font-size: .8rem; }
.staffing-open th, .staffing-open td { padding: 7px; text-align: left; border-bottom: 1px solid var(--rule); }
.staffing-open ol { padding-left: 22px; }
.staffing-open li { margin-bottom: 14px; }
.staffing-open .evidence-scroll { max-width: 100%; min-width: 0; overflow-x: auto; }
.staffing-decisions { padding-left: 22px; }
.display-mode:not([data-display="staffing"]) #staffing-tile { display: none !important; }
.display-mode[data-display="staffing"] .floor-section, .display-mode[data-display="staffing"] .context-panel { display: none !important; }
.display-mode[data-display="staffing"] #staffing-tile { flex: 1; padding: 24px; font-size: 1.05rem; }
@media (max-width: 900px) { .staffing-tile { border-top: 1px solid var(--rule); } }

/* Compact decisions keep the recommended action ahead of expandable evidence. */
.staffing-tile { padding: 14px; font-size: .8rem; line-height: 1.45; }
.staffing-open { gap: 8px; }
.staffing-decision-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.staffing-decision-heading h3 { margin: 0; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.staffing-pick { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 5px 10px; }
.staffing-pick > strong { font-size: 1rem; letter-spacing: -.015em; }
.staffing-countdown { color: var(--warn-ink); font: 500 .72rem var(--font-mono); }
.staffing-rationale { color: var(--ink-2); font-size: .76rem; }
.staffing-primary-actions { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 0; background: var(--paper-raised); }
.staffing-primary-actions button { padding: 8px 12px; font-size: .78rem; }
.staffing-policy-note { color: var(--ink-3); font-size: .7rem; }
.staffing-tile details, #demo-staffing-outlook details { border-top: 1px solid var(--rule); }
.staffing-tile summary, #demo-staffing-outlook summary { padding: 10px 0; font-size: .76rem; color: var(--ink-2); cursor: pointer; font-weight: 600; }
.staffing-tile details p { font-size: .76rem; }
.staffing-form { display: grid; gap: 10px; padding-bottom: 12px; }
.staffing-coverage { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 12px 0; color: var(--ink-2); font-size: .74rem; }
.staffing-coverage strong { color: var(--ink); font-family: var(--font-mono); }
.staffing-feedback:empty { display: none; }
#demo-staffing-outlook { font-size: .84rem; }
.simulation-bar { flex-wrap: wrap; }

/* The phone workspace exposes the selected task without traversing the floor map. */
@media (max-width: 900px) {
  body:not(.display-mode) .topbar .tagline, body:not(.display-mode) .topbar > div > .eyebrow { display: none; }
  body:not(.display-mode) .topbar { gap: 8px; padding-bottom: 12px; }
  body:not(.display-mode) .topbar h1 { font-size: 1.12rem; }
  body:not(.display-mode) .topbar .tab-bar { flex-wrap: nowrap; gap: 0; justify-content: space-between; }
  body:not(.display-mode) .topbar .tab-button { font-size: .75rem; padding: 8px 6px; }
  body:not(.display-mode) .topbar .agent-activity-indicator { width: auto; margin-left: auto; padding: 6px; }
  body:not(.display-mode) #agent-activity-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  body:not(.display-mode) .mode-controls button { font-size: .75rem; padding: 7px 9px; }
  body:not(.display-mode) .simulation-bar { display: flex; gap: 10px 12px; align-items: center; padding: 12px; margin-bottom: 10px; }
  body:not(.display-mode) .simulation-bar > div { display: grid; gap: 3px; }
  body:not(.display-mode) .simulation-bar .room-identity { flex: 1 0 100%; }
  body:not(.display-mode) .simulation-bar .room-identity strong { max-width: 100%; }
  body:not(.display-mode) .simulation-bar strong { font-size: .76rem; }
  body:not(.display-mode) .simulation-bar .eyebrow { font-size: .68rem; margin: 0; }
  body:not(.display-mode) .workspace-nav { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 5px; margin: 12px 0; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-sunk); }
  .workspace-nav button { display: flex; gap: 4px; align-items: center; justify-content: center; min-width: 0; min-height: 44px; padding: 5px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-2); box-shadow: none; font-size: .76rem; }
  .workspace-nav button[aria-pressed="true"] { background: var(--paper-raised); color: var(--accent-ink); box-shadow: var(--shadow-sm); }
  .workspace-nav span { min-width: 16px; padding: 1px 4px; border-radius: var(--radius-pill); color: var(--accent-ink); background: var(--accent-wash); font: 600 .66rem var(--font-mono); }
  body:not(.display-mode) .dashboard { display: block; }
  body:not(.display-mode) .floor-section { padding: 12px; }
  body:not(.display-mode) .context-panel { border-top: 1px solid var(--rule); }
  body:not(.display-mode) .context-panel, body:not(.display-mode) .staffing-tile { scroll-margin-top: 64px; }
  body:not(.display-mode):not([data-workspace-view="floor"]) .floor-section > .section-heading,
  body:not(.display-mode):not([data-workspace-view="floor"]) #floor,
  body:not(.display-mode):not([data-workspace-view="issues"]) .context-panel,
  body:not(.display-mode):not([data-workspace-view="staffing"]) #staffing-tile,
  body:not(.display-mode):not([data-workspace-view="issues"]) .lower-grid > section:has(#issue-list),
  body:not(.display-mode):not([data-workspace-view="events"]) .lower-grid > section:has(#event-feed),
  body:not(.display-mode)[data-workspace-view="staffing"] .floor-section { display: none; }
  body:not(.display-mode)[data-workspace-view="floor"] .lower-grid { display: none; }
  body:not(.display-mode) .lower-grid { display: block; margin-top: 0; }
  body:not(.display-mode) .issue-list { max-height: 260px; overflow-y: auto; }
  body:not(.display-mode) .event-feed { max-height: none; }
  body:not(.display-mode) .building-controls { max-width: calc(100% - 16px); flex-wrap: wrap; }
  .staffing-primary-actions button { min-height: 44px; }
  #analytics-view { padding: 14px 0; }
}
.display-mode .workspace-nav { display: none !important; }
.staffing-primary-actions [data-staffing-action="approve"] { color: var(--on-accent); border-color: var(--accent); background: var(--accent); }
.staffing-primary-actions [data-staffing-action="approve"]:hover:not(:disabled) { border-color: var(--accent-ink); background: var(--accent-ink); }
.staffing-primary-actions button:disabled { color: var(--ink-3); border-color: var(--rule); background: var(--paper-sunk); }
@media (min-width: 901px) and (max-width: 1359px) {
  .simulation-bar { gap: 9px; }
  .simulation-bar .room-identity { display: grid; flex: 0 0 90px; gap: 2px; }
  .simulation-bar .room-identity .eyebrow { font-size: .64rem; white-space: nowrap; }
  .simulation-bar .room-identity strong { max-width: 90px; font-size: .78rem; }
  .simulation-bar > div:not(.room-identity) .eyebrow { font-size: .64rem; }
}
@media (max-width: 900px) { body:not(.display-mode) .dashboard { min-height: 0; } }

/* Wall screens retain the same decisions at a reading distance, rather than tile density. */
@media (min-width: 901px) {
  .display-mode[data-display="staffing"] #staffing-tile { padding: 28px; font-size: 1rem; }
  .display-mode[data-display="staffing"] #staffing-tile > :is(.staffing-open, details, .staffing-coverage, .empty-state) { max-width: 1280px; }
  .display-mode[data-display="staffing"] .staffing-open { gap: 16px; }
  .display-mode[data-display="staffing"] .staffing-decision-heading h3 { font-size: 1.1rem; }
  .display-mode[data-display="staffing"] .staffing-pick > strong { font-size: 1.8rem; }
  .display-mode[data-display="staffing"] :is(.staffing-rationale, .staffing-countdown, .staffing-coverage, .staffing-open table) { font-size: 1rem; }
  .display-mode[data-display="staffing"] :is(.staffing-policy-note, .staffing-tile summary, .staffing-tile details p) { font-size: .94rem; }
  .display-mode[data-display="staffing"] .staffing-primary-actions button { min-height: 48px; padding: 12px 18px; font-size: 1rem; }
  .display-mode[data-display="staffing"] .status-badge { font-size: .85rem; }
}
