/* Navigation shell: keep the existing creative/report surfaces and appearance modes. */
.app-layout { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: calc(100dvh - 70px); }
.app-content { min-width: 0; }
/* Edge retains its deployed full-width display; the ordinary shell stays intact. */
body.edge-mode .app-layout { display: block; min-height: 0; }
body.edge-mode .app-sidebar { display: none; }
.app-sidebar { position: sticky; top: 70px; align-self: start; max-height: calc(100dvh - 70px); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; background: #222831; color: #e4e9f1; padding: 12px 10px; }
.primary-nav { display: flex; flex-direction: column; gap: 4px; }
.primary-link, .nav-child { display: flex; align-items: center; min-height: 44px; padding: 10px 12px; border-radius: 5px; color: #e4e9f1; text-decoration: none; font-size: 15px; line-height: 1.4; }
.primary-link { gap: 8px; font-weight: 600; }
.primary-link:hover, .nav-child:hover { background: #303946; color: #fff; text-decoration: none; }
.primary-link.active { background: #303b4a; color: #fff; }
.primary-link[aria-current="page"], .nav-child.active { background: #364d6e; box-shadow: inset 3px 0 #a6c9ff; color: #fff; }
.nav-group-row { display: flex; align-items: stretch; gap: 2px; }
.nav-group-row .primary-link { flex: 1; min-width: 0; }
.btn.nav-group-toggle { flex: 0 0 44px; min-height: 44px; padding: 8px; border: 0; border-radius: 5px; background: transparent; color: #c6d3e5; font-size: 18px; cursor: pointer; }
.btn.nav-group-toggle:hover:not(:disabled) { color: #fff; background: #303946; }
.nav-children { margin: 2px 0 6px 14px; padding-left: 6px; border-left: 1px solid #526176; }
.nav-children[hidden] { display: none; }
.nav-child { padding-left: 12px; }
.primary-nav :is(a, button):focus-visible { outline: 2px solid #b1cbff; outline-offset: -2px; }
.nav-menu-toggle { display: none; }
.btn.sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 36px; width: 36px; height: 36px; padding: 0; font-size: 19px; }
.sidebar-toggle:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
body.edge-mode .sidebar-toggle { display: none; }
/* Center notices with margins, not a translated left:50% box that widens narrow pages. */
.notifications { left: 0; right: 0; margin-inline: auto; transform: none; }
@media (min-width: 761px) {
  .app-layout.sidebar-collapsed { grid-template-columns: minmax(0, 1fr); }
  .app-layout.sidebar-collapsed .app-sidebar { display: none; }
}
.nav-attention { margin-left: auto; font-size: 13px; font-variant-numeric: tabular-nums; padding: 0 6px; background: #58453b; color: #ffdfc4; border-radius: 4px; }
.app-content .workspacebar { max-width: 1800px; margin: 0 auto; padding: 12px 28px 0; flex-wrap: wrap; gap: 10px; }
.app-content .workspacebar:empty { display: none; }
.app-content .product-picker { width: min(100%, 720px); min-width: 0; }
.app-content .product-picker select { flex: 1; min-width: 0; max-width: 100%; width: 100%; text-overflow: ellipsis; }
.app-content .product-picker .btn { flex-shrink: 0; }
.app-content main.workspace { padding: 20px 28px 32px; width: 100%; }
.topbar { height: 70px; padding: 0 24px; gap: 22px; }
.topbar .company { padding-left: 20px; }
.topbar .company label { font-size: 11px; letter-spacing: .5px; }
.topbar .company select { font-size: 15px; }
.topbar .theme-switch .btn { min-height: 36px; }
html:has(body.operations-workspace) { color-scheme: light; }
html[data-theme="dark"]:has(body.operations-workspace) { color-scheme: dark; }
body.operations-workspace {
  color-scheme: light;
  --bg: #f4f6f9; --surface: #fff; --raised: #edf1f7; --line: #d5dce6;
  --text: #202c3c; --muted: #526176; --lime: #255fb3; --lime-ink: #fff; --danger: #a12e24;
  --soft: #e9f0fc; --accent-ink: #234f91;
  background: var(--bg); color: var(--text);
}
html[data-theme="dark"] body.operations-workspace {
  color-scheme: dark;
  --bg: #151b24; --surface: #202936; --raised: #293545; --line: #45546a;
  --text: #eef2f8; --muted: #bac7d8; --lime: #a6c9ff; --lime-ink: #142b49; --danger: #ffb4aa;
  --soft: #30435f; --accent-ink: #d5e6ff;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]):has(body.operations-workspace) { color-scheme: dark; }
  html:not([data-theme="light"]) body.operations-workspace {
    color-scheme: dark;
    --bg: #151b24; --surface: #202936; --raised: #293545; --line: #45546a;
    --text: #eef2f8; --muted: #bac7d8; --lime: #a6c9ff; --lime-ink: #142b49; --danger: #ffb4aa;
    --soft: #30435f; --accent-ink: #d5e6ff;
  }
}
body.operations-workspace .topbar { background: var(--surface); color: var(--text); backdrop-filter: none; }
body.operations-workspace :is(.topbar, .workspacebar, .workspace-home) :is(select, .btn) { color: var(--text); background: var(--surface); border-color: var(--line); }
body.operations-workspace :is(.topbar, .workspacebar, .workspace-home) .btn:hover { background: var(--raised); }
body.operations-workspace .topbar .theme-switch .btn[aria-pressed="true"] { background: var(--soft); color: var(--accent-ink); }
.workspace-home { display: grid; gap: 18px; min-width: 0; }
.workspace-home .page-heading { margin-bottom: 0; }
.workspace-home > .btn { justify-self: start; }
.workspace-table-scroll { max-height: 55dvh; overflow: auto; border: 1px solid var(--line); border-radius: 7px; }
.workspace-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); }
.workspace-table th { position: sticky; top: 0; background: var(--raised); text-align: left; }
.workspace-table :is(th, td) { padding: 10px 14px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.workspace-table tbody tr:nth-child(even) { background: var(--raised); }
.workspace-connections { display: grid; gap: 10px; padding: 18px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.workspace-source-links { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 1100px) {
  .app-layout { grid-template-columns: 216px minmax(0, 1fr); }
  .app-sidebar { padding: 12px 8px; }
  .app-content .workspacebar { padding: 8px 20px 0; }
  .app-content main.workspace { padding: 20px; }
  .topbar .private-label { display: none; }
}
@media (max-width: 760px) {
  .btn.sidebar-toggle { display: none; }
  .app-layout { display: block; min-height: calc(100dvh - 94px); }
  .btn.nav-menu-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; min-height: 44px; margin: 0; padding: 8px 12px; font-size: 15px; font-weight: 600; white-space: nowrap; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 5px; }
  .btn.nav-menu-toggle::before { content: "☰" / ""; font-size: 17px; line-height: 1; }
  .btn.nav-menu-toggle:hover:not(:disabled) { background: var(--raised); color: var(--text); border-color: var(--line); }
  .nav-menu-toggle:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
  .app-sidebar { display: none; position: static; max-height: 60dvh; margin: 6px 12px 0; padding: 8px; border-radius: 5px; scroll-margin-top: 110px; }
  .app-sidebar.is-open { display: block; }
  .primary-nav { gap: 4px; }
  .topbar { height: auto; min-height: 72px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); gap: 7px 8px; }
  .topbar > .nav-menu-toggle { grid-row: 1; grid-column: 1; }
  .topbar > .wordmark { grid-row: 1; grid-column: 2; min-width: 0; overflow: hidden; white-space: nowrap; font-size: 18px; }
  .topbar .company { padding-left: 0; border: 0; grid-row: 2; grid-column: 1 / -1; }
  .topbar .company > div { display: flex; align-items: center; gap: 8px; }
  .topbar .company label { font-size: 11px; flex-shrink: 0; }
  .topbar .company select { width: 100%; max-width: 100%; min-width: 0; font-size: 14px; min-height: 32px; }
  .topbar .top-actions { grid-row: 1; grid-column: 3; gap: 6px; }
  .topbar .top-actions > .btn { padding: 6px; min-height: 36px; }
  .topbar .theme-switch .btn { padding: 4px 8px; }
  .app-content .workspacebar { padding: 4px 12px 0; }
  .app-content .product-picker { grid-template-columns: minmax(0, 1fr) auto auto; }
  .app-content main.workspace { padding: 18px 12px 26px; }
  .workspace-table :is(th, td) { padding: 10px; }
  .workspace-table .btn { min-height: 40px; }
}
/* Phones (portrait and short touch landscapes) get a direct Stats destination. */
.primary-link.nav-phone-only { display: none; }
@media (max-width: 760px), (pointer: coarse) and (max-height: 500px) and (max-width: 1000px) {
  .primary-link.nav-phone-only { display: flex; }
}

/* Batch history uses the shared bounded table and one reusable rich detail. */
.batch-layout > *, .batch-jobs { min-width: 0; }
.batch-jobs-scroll { width: 100%; min-width: 0; max-width: 100%; max-height: min(55dvh, 480px); overscroll-behavior: contain; scrollbar-gutter: stable; }
.batch-jobs-table { min-width: 700px; table-layout: fixed; font-size: 14px; line-height: 1.45; }
.batch-jobs-table thead th { z-index: 1; }
.batch-jobs-table tbody th { position: static; background: transparent; font-weight: 400; }
.batch-jobs-table :is(th, td) { vertical-align: middle; }
.batch-jobs-table th:nth-child(1) { width: 27%; }
.batch-jobs-table th:nth-child(2) { width: 16%; }
.batch-jobs-table th:nth-child(3) { width: 21%; }
.batch-jobs-table th:nth-child(4) { width: 22%; }
.batch-jobs-table th:nth-child(5) { width: 14%; }
.batch-jobs-table :is(strong, small, time, .batch-job-bank) { display: block; }
.batch-jobs-table :is(small, .batch-job-bank) { color: var(--muted); }
.batch-jobs-table .is-selected { box-shadow: inset 3px 0 var(--lime); }
.batch-jobs :is(small, .hint, .status, .btn) { font-size: 14px; }
.batch-jobs .btn { min-height: 44px; white-space: normal; }
.batch-job-detail { display: grid; gap: 10px; max-height: min(75dvh, 840px); overflow: auto; overscroll-behavior: contain; font-size: 14px; }
.batch-job-detail > .btn { justify-self: start; }
.batch-job-detail .job { min-width: 0; overflow-wrap: anywhere; }
