/*
 * SENTINEL Sprint 10.1
 * Desktop-only containment and consistency layer.
 * Functional layouts remain owned by their existing modules.
 */

@media (min-width: 821px) {
  body.sentinel-evolution {
    min-width: 0;
  }

  body.sentinel-evolution .dashboard-app {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    grid-template-columns: var(--sentinel-rail-width) minmax(0, 1fr);
    transition: grid-template-columns 170ms cubic-bezier(0.2, 0, 0, 1);
  }

  body.sentinel-evolution.sidebar-collapsed .dashboard-app {
    grid-template-columns: var(--sentinel-rail-collapsed) minmax(0, 1fr);
  }

  body.sentinel-evolution .dashboard-topbar,
  body.sentinel-evolution .dashboard-sidebar,
  body.sentinel-evolution .dashboard-main,
  body.sentinel-evolution .dashboard-main > .app-section,
  body.sentinel-evolution .dashboard-main > .shell,
  body.sentinel-evolution .dashboard-main .section-panel,
  body.sentinel-evolution .dashboard-main .settings-layout,
  body.sentinel-evolution .dashboard-main .settings-content,
  body.sentinel-evolution .dashboard-main .settings-subsection,
  body.sentinel-evolution .dashboard-main .metric-card,
  body.sentinel-evolution .dashboard-main .tool-result {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  body.sentinel-evolution .dashboard-main {
    align-self: stretch;
    overflow-x: visible;
  }

  body.sentinel-evolution .dashboard-main > .app-section {
    width: 100%;
    margin-inline: 0;
  }

  body.sentinel-evolution .dashboard-sidebar {
    width: auto;
    max-width: var(--sentinel-rail-width);
  }

  body.sentinel-evolution.sidebar-collapsed .dashboard-sidebar {
    max-width: var(--sentinel-rail-collapsed);
  }

  /* Page rhythm and hierarchy */

  body.sentinel-evolution .app-section:not(.war-counter-workspace) > .section-panel,
  body.sentinel-evolution .app-section:not(.war-counter-workspace) > .panel {
    width: 100%;
  }

  body.sentinel-evolution .panel-head {
    position: relative;
    min-width: 0;
  }

  body.sentinel-evolution .panel-head > .tutorial-page-help {
    position: absolute;
    top: 0;
    right: 0;
  }

  body.sentinel-evolution .panel-head:has(> .tutorial-page-help) {
    min-height: 32px;
    padding-right: 38px;
  }

  body.sentinel-evolution .section-panel > h2:first-child,
  body.sentinel-evolution .section-panel > h3:first-child {
    margin-top: 0;
  }

  body.sentinel-evolution .dashboard-grid-gap {
    margin-top: 10px;
  }

  body.sentinel-evolution .cta-row {
    align-items: center;
    flex-wrap: wrap;
  }

  body.sentinel-evolution .tool-result {
    overflow: auto;
  }

  body.sentinel-evolution .tool-result > table {
    max-width: none;
  }

  /* Dashboard */

  body.sentinel-evolution [data-section-panel="dashboard"] .dashboard-action-grid {
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 8px;
  }

  body.sentinel-evolution [data-section-panel="dashboard"] .dashboard-action-card {
    min-width: 0;
    min-height: 76px;
    padding: 12px 14px;
    border-radius: var(--sentinel-radius-md);
  }

  body.sentinel-evolution [data-section-panel="dashboard"] .help-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 8px;
  }

  body.sentinel-evolution [data-section-panel="dashboard"] .status-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
  }

  /* Settings */

  body.sentinel-evolution [data-section-panel="settings"] .settings-layout {
    grid-template-columns: minmax(190px, 220px) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
  }

  body.sentinel-evolution [data-section-panel="settings"] .settings-nav {
    top: calc(var(--sentinel-topbar-height) + 12px);
    max-height: calc(100dvh - var(--sentinel-topbar-height) - 24px);
    overflow-y: auto;
  }

  body.sentinel-evolution [data-section-panel="settings"] .settings-nav-btn {
    min-width: 0;
    line-height: 1.2;
  }

  body.sentinel-evolution [data-section-panel="settings"] .settings-subsection.active {
    min-width: 0;
    width: 100%;
  }

  body.sentinel-evolution [data-section-panel="settings"] #settingsExperienceStatus {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 5px;
    padding: 7px;
    overflow: visible;
  }

  body.sentinel-evolution [data-section-panel="settings"] #settingsExperienceStatus p {
    min-width: 0;
    margin: 0;
    padding: 6px 8px;
    border: 1px solid var(--sentinel-border);
    border-radius: var(--sentinel-radius-sm);
    background: rgb(7 19 31 / 72%);
    color: var(--sentinel-text-soft);
    font-size: 0.65rem;
    line-height: 1.3;
  }

  body.sentinel-evolution.settings-counter-editor-active [data-section-panel="settings"],
  body.sentinel-evolution.settings-counter-editor-active [data-section-panel="settings"] > .section-panel,
  body.sentinel-evolution.settings-counter-editor-active [data-section-panel="settings"] .settings-layout,
  body.sentinel-evolution.settings-counter-editor-active [data-section-panel="settings"] .settings-content,
  body.sentinel-evolution.settings-counter-editor-active [data-section-panel="settings"] .settings-subsection.active,
  body.sentinel-evolution.settings-counter-editor-active [data-section-panel="settings"] .counter-editor-full-card,
  body.sentinel-evolution.settings-counter-editor-active [data-section-panel="settings"] .counter-editor-table-wrap,
  body.sentinel-evolution.settings-counter-editor-active [data-section-panel="settings"] .quick-counter-intake,
  body.sentinel-evolution.settings-counter-editor-active [data-section-panel="settings"] .quick-counter-intake-body {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  body.sentinel-evolution.settings-counter-editor-active [data-section-panel="settings"] .settings-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  body.sentinel-evolution.settings-counter-editor-active [data-section-panel="settings"] .settings-nav {
    position: sticky;
    top: var(--sentinel-topbar-height);
    z-index: calc(var(--sentinel-z-sticky) - 2);
    display: flex;
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
    gap: 3px;
    margin-bottom: 8px;
    padding: 5px;
    overflow: visible;
    border-radius: var(--sentinel-radius-md);
  }

  body.sentinel-evolution.settings-counter-editor-active [data-section-panel="settings"] .settings-nav-btn {
    min-height: 28px;
    padding: 5px 8px;
    border-radius: var(--sentinel-radius-sm);
    font-size: 0.62rem;
  }

  body.sentinel-evolution .counter-editor-full-card {
    overflow: visible;
  }

  body.sentinel-evolution .counter-editor-table-scroll {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overscroll-behavior-inline: contain;
  }

  body.sentinel-evolution .counter-editor-filters {
    grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(150px, 0.7fr));
    gap: 7px;
  }

  body.sentinel-evolution .counter-editor-pager {
    min-height: 30px;
    margin-bottom: 6px;
  }

  /* AI War Engine and developer forms */

  body.sentinel-evolution [data-section-panel="ai-counter"] .engine-tab-panel {
    margin-top: 10px;
  }

  body.sentinel-evolution [data-section-panel="ai-counter"] .defense-slots {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 8px;
  }

  body.sentinel-evolution [data-section-panel="ai-counter"] .defense-slot {
    min-width: 0;
    padding: 10px;
    border-radius: var(--sentinel-radius-md);
  }

  body.sentinel-evolution [data-section-panel="ai-counter"] .defense-slot:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  body.sentinel-evolution [data-section-panel="ai-counter"] .slot-build-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }

  body.sentinel-evolution [data-section-panel="ai-counter"] .slot-star-panel {
    margin-top: 8px;
    padding-top: 7px;
  }

  body.sentinel-evolution [data-section-panel="ai-counter"] .roster-help,
  body.sentinel-evolution [data-section-panel="ai-counter"] .team-selection-panel {
    border-radius: var(--sentinel-radius-md);
  }

  /* Data Quality and secondary admin screens */

  body.sentinel-evolution [data-section-panel="war-tracker"] .war-tracker-filters,
  body.sentinel-evolution [data-section-panel="war-tracker"] .war-tracker-report-controls {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 7px;
  }

  body.sentinel-evolution [data-section-panel="war-tracker"] .wt-performance-grid {
    gap: 8px;
  }

  body.sentinel-evolution [data-section-panel="war-tracker"] .status-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 7px;
  }

  body.sentinel-evolution [data-section-panel="war-sim"] .tool-grid,
  body.sentinel-evolution [data-section-panel="team-eval"] .tool-grid,
  body.sentinel-evolution [data-section-panel="meta-analysis"] .tool-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }

  /* Professional desktop states */

  body.sentinel-evolution .metric-card,
  body.sentinel-evolution .status-card,
  body.sentinel-evolution .tool-result,
  body.sentinel-evolution .settings-nav,
  body.sentinel-evolution .engine-tab-nav {
    box-shadow: none;
  }

  body.sentinel-evolution .sentinel-modal,
  body.sentinel-evolution .scan-add,
  body.sentinel-evolution .auth-dialog-card,
  body.sentinel-evolution .composer-shell {
    max-width: calc(100vw - 32px);
  }
}
