/* ==========================================================================
   Arcane Designs · V3 Full Site Operations Solution Mockup
   Clean-room V3 CSS specification:
   - CSS light-dark() adaptive Dark & Light themes (WCAG AA >= 4.5:1)
   - White-label brand accent presets (Crimson, Cobalt, Amber, Emerald)
   - Crisp 0px square workspace geometry + optional Rounded mode
   - Sticky #171717 top header chrome + preserved 32px V3 Left Rail
   - Container-queried sticky data tables, collapsible boxes, SVG charts
   ========================================================================== */

@property --fade-start {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

@property --fade-end {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

:root {
  color-scheme: light dark;

  /* Core adaptive surfaces */
  --bg-canvas:   light-dark(#DCDCDC, #1E1E1E);
  --bg-box:      light-dark(#FFFFFF, #2A2A2A);
  --bg-sub:      light-dark(#F2F2F2, #222222);
  --bg-row-alt:  light-dark(#F7F7F7, #262626);
  --bg-hover:    light-dark(#EBEBEB, #333333);
  --bg-input:    light-dark(#FFFDF7, #191919);

  /* Borders */
  --border-main:   light-dark(#C4C4C4, #454545);
  --border-strong: light-dark(#9E9E9E, #5E5E5E);

  /* Typography */
  --text-primary:   light-dark(#111111, #EEEEEE);
  --text-secondary: light-dark(#525252, #A6A6A6);
  --text-muted:     light-dark(#6B6B6B, #8C8C8C);

  /* Default Crimson Brand Accent + WCAG AA Semantic Tokens */
  --accent:       #D71919;
  --accent-hover: #B51414;
  --accent-text:  light-dark(#B51414, #FF5C5C);
  --accent-form:  light-dark(#B51414, #FF5C5C);

  --ok-text:   light-dark(#116B33, #4CC07F);
  --ok-bg:     light-dark(#E6F4EA, rgba(76, 192, 127, 0.13));
  --ok-bdr:    light-dark(#8AC9A1, rgba(76, 192, 127, 0.42));

  --warn-text: light-dark(#7D6000, #F5C400);
  --warn-bg:   light-dark(#FEF3C7, rgba(245, 196, 0, 0.13));
  --warn-bdr:  light-dark(#D9B44A, rgba(245, 196, 0, 0.42));

  --bad-text:  light-dark(#B51414, #FF6B6B);
  --bad-bg:    light-dark(#FDE8E8, rgba(215, 25, 25, 0.16));
  --bad-bdr:   light-dark(#E09494, rgba(255, 92, 92, 0.48));

  --info-text: light-dark(#0F56B3, #6BB2FF);
  --info-bg:   light-dark(#E8F1FD, rgba(92, 168, 255, 0.13));
  --info-bdr:  light-dark(#93B8E8, rgba(92, 168, 255, 0.42));

  /* Chart & Telemetry Palette */
  --chart-grid: light-dark(#DADDE2, #363636);
  --chart-axis: light-dark(#4F4F4F, #B0B0B0);
  --chart-ob:   light-dark(#0F56B3, #5CA8FF);
  --chart-cap:  light-dark(#0C8478, #2EC4B6);
  --chart-ib:   light-dark(#116B33, #4CC07F);
  --chart-warn: light-dark(#8A6D00, #F5C400);
  --progress-track: light-dark(#DFDFDF, #191919);

  /* Geometry & Chrome */
  --radius: 0px;
  --head-h: 64px;
  --rail-w: 32px;

  --font-sans: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  --font-mono: Consolas, "SFMono-Regular", Menlo, monospace;
}

/* White-Label Brand Accent Presets */
:root[data-accent="cobalt"] {
  --accent:       #1D6FE8;
  --accent-hover: #1558BD;
  --accent-text:  light-dark(#1558BD, #6BB2FF);
  --accent-form:  light-dark(#1558BD, #6BB2FF);
}

:root[data-accent="amber"] {
  --accent:       #C97800;
  --accent-hover: #A35E00;
  --accent-text:  light-dark(#8E5200, #F5B841);
  --accent-form:  light-dark(#8E5200, #F5B841);
}

:root[data-accent="emerald"] {
  --accent:       #0F8A5F;
  --accent-hover: #0A6C49;
  --accent-text:  light-dark(#0B6E4A, #4CC07F);
  --accent-form:  light-dark(#0B6E4A, #4CC07F);
}

:root[data-corners="rounded"] {
  --radius: 6px;
}

/* Reflect <meta name="color-scheme"> override directly in CSS cascade */
:root:has(> head > meta[name="color-scheme"][content="dark"]) {
  color-scheme: dark;
}
:root:has(> head > meta[name="color-scheme"][content="light"]) {
  color-scheme: light;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  accent-color: var(--accent-form);
  overflow-x: clip;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.num, td[data-num="1"], th[data-num="1"], .kpi-val, input[type="number"] {
  font-variant-numeric: tabular-nums;
}

button, input, select, textarea {
  font-family: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: -2px;
}

/* ==========================================================================
   Top Header Chrome (Always #171717 per design3.md)
   ========================================================================== */

.top-chrome {
  position: sticky;
  top: 0;
  z-index: 40;
  background: #171717;
  color: #F0F0F0;
  border-bottom: 2px solid var(--accent);
  min-height: 64px;
  padding: 6px 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px 12px;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.brand-titles {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.brand-kicker {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-text);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-main {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-subtitle {
  font-size: 11px;
  color: #B0B0B0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-center-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.header-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.header-field {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #D2D2D2;
}

.chrome-select,
.chrome-btn {
  background: #242424;
  color: #F0F0F0;
  border: 1px solid #4A4A4A;
  border-radius: var(--radius);
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  height: 30px;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  white-space: nowrap;
}

.chrome-select {
  min-width: 112px;
}

.chrome-btn:hover,
.chrome-select:hover {
  border-color: #888888;
  background: #303030;
}

.chrome-btn.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

.chrome-btn.accent:hover {
  background: var(--accent-hover);
}

/* Explicit Rounded Pill Rail Exception */
.pill-rail {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: #222222;
  border: 1px solid #484848;
  border-radius: 999px !important;
  max-width: 100%;
}

.pill-rail-btn {
  background: transparent;
  color: #CFCFCF;
  border: 0;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 999px !important;
}

.pill-rail-btn[aria-pressed="true"] {
  background: var(--accent);
  color: #FFFFFF;
}

.pill-rail-btn:hover:not([aria-pressed="true"]) {
  background: #333333;
  color: #FFFFFF;
}

/* Compact Floor / Wallboard Mode (Larger Metrics for Floor Displays) */
body[data-shell="floor"] .top-chrome {
  min-height: 46px;
  padding: 4px 12px;
}

body[data-shell="floor"] .kpi-val {
  font-size: 26px;
}

body[data-shell="floor"] .kpi-label,
body[data-shell="floor"] .kpi-sub,
body[data-shell="floor"] .v3-box-title {
  font-size: 13px;
}

body[data-shell="floor"] table.data-grid,
body[data-shell="floor"] table.data-grid thead th,
body[data-shell="floor"] table.data-grid tbody td {
  font-size: 13.5px;
}

body[data-shell="floor"] .brand-subtitle {
  display: none;
}

body[data-shell="floor"] .brand-mark-img {
  width: 28px;
  height: 28px;
}

/* Client Portal Isolation */
body[data-portal="true"] .internal-only {
  display: none !important;
}

body:not([data-portal="true"]) .portal-only {
  display: none !important;
}

@media (max-width: 1480px) {
  .top-chrome {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .brand-cluster {
    grid-column: 1;
    grid-row: 1;
  }
  .header-controls {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }
  .header-center-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
    justify-content: flex-start;
    padding-top: 5px;
    border-top: 1px solid #292929;
  }
}

@media (max-width: 820px) {
  .top-chrome {
    grid-template-columns: minmax(0, 1fr);
    padding: 6px 10px;
  }
  .brand-cluster,
  .header-controls,
  .header-center-nav {
    grid-column: 1;
    grid-row: auto;
    justify-self: stretch;
  }
  .header-controls {
    justify-content: flex-start;
  }
  .brand-subtitle {
    display: none;
  }
}

/* Header Tools Popover (Viewport-Aware Dropdowns + Anchor Positioning) */
#headerToolsPopover {
  padding: 6px;
  background: #1B1B1B;
  color: #F0F0F0;
  border: 1px solid #555555;
  border-top: 2px solid var(--accent);
  border-radius: var(--radius);
  min-width: 224px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
}

#headerToolsPopover:is(:popover-open, .\:popover-open) {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

@supports (position-area: block-end) {
  #headerToolsPopover {
    inset: auto;
    margin: 0;
    position-area: block-end span-inline-start;
    position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
  }
}

.tools-menu-item {
  width: 100%;
  text-align: left;
  background: transparent;
  color: #EAEAEA;
  border: 0;
  border-radius: var(--radius);
  padding: 7px 10px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tools-menu-item:hover {
  background: #2C2C2C;
  color: #FFFFFF;
}

/* ==========================================================================
   Preserved 32px V3 Left Sidebar (#v3-rail) & Floating Drawer (#v3-drawer)
   ========================================================================== */

#v3-rail {
  --cb: light-dark(#D0D0D0, #2B2B2B);
  --cbl: light-dark(#B5B5B5, #3A3A3A);
  --cp: light-dark(#F2F2F2, #1F1F1F);
  --cpb: light-dark(#9A9A9A, #4A4A4A);
  --ct: light-dark(#111111, #E2E2E2);
  position: fixed;
  left: 0;
  top: var(--head-h, 64px);
  bottom: 0;
  width: var(--rail-w);
  z-index: 35;
  background: var(--cb);
  border-right: 1px solid var(--cbl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 0 8px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}

#v3-rail::-webkit-scrollbar {
  display: none;
}

#v3-rail hr {
  flex: none;
  width: 18px;
  height: 0;
  border: 0;
  border-top: 1px solid var(--cpb);
  margin: 3px 0;
}

.rail-btn {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 4px;
  background: var(--cp);
  border: 1px solid var(--cpb);
  color: var(--ct);
  cursor: pointer;
}

.rail-btn svg {
  width: 14px;
  height: 14px;
  display: block;
}

.rail-btn:hover {
  border-color: var(--accent);
}

.rail-btn.is-active,
.rail-btn[aria-expanded="true"] {
  border: 1.5px solid var(--accent);
}

.rail-btn.em {
  color: var(--accent-text);
}

.rail-btn.em.is-safe {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

.rail-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 13px;
  height: 13px;
  padding: 0 3px;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 13px;
  text-align: center;
}

/* Vertical Text Bubbles on Left Rail */
.rail-tools-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.rail-tool-btn {
  flex: none;
  width: 24px;
  padding: 9px 0;
  margin: 0;
  display: grid;
  place-items: center;
  border-radius: 12px !important;
  border: 1px solid var(--cpb);
  background: var(--cp);
  color: var(--ct);
  cursor: pointer;
}

.rail-tool-btn span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  white-space: nowrap;
}

.rail-tool-btn:hover {
  border-color: var(--accent);
}

.rail-tool-btn[aria-selected="true"] {
  border: 1.5px solid var(--accent);
  background: var(--bg-box);
}

/* Rail Utility Popovers */
.rail-pop {
  position: fixed;
  left: 38px;
  top: calc(var(--head-h, 64px) + 8px);
  z-index: 45;
  width: min(328px, calc(100vw - 46px));
  max-height: calc(100vh - var(--head-h, 64px) - 20px);
  overflow: auto;
  background: var(--bg-box);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 14px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.42);
}

.rail-pop-hdr {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-bottom: 7px;
}

.rail-pop-hdr h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.rail-pop-hdr small {
  font-size: 10.5px;
  color: var(--text-secondary);
}

.rail-pop-close {
  margin-left: auto;
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 4px;
}

.rail-pop-close:hover {
  color: var(--text-primary);
}

.rail-stripe {
  height: 1px;
  margin-bottom: 8px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) 32%, transparent 100%);
}

.rail-group-lbl {
  margin: 10px 0 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.sw-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 28px;
  padding: 4px 0;
  border: 0;
  border-bottom: 1px solid var(--border-main);
  background: transparent;
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  cursor: pointer;
  text-align: left;
}

.sw-pill {
  display: inline-block;
  min-width: 36px;
  height: 17px;
  line-height: 15px;
  text-align: center;
  font-size: 9.5px;
  font-weight: 700;
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  background: var(--bg-sub);
}

.sw-row[aria-pressed="true"] .sw-pill {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

.look-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 0;
}

.look-picks {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.look-chip {
  height: 22px;
  padding: 0 9px;
  border: 1px solid var(--border-strong);
  border-radius: 11px !important;
  background: var(--bg-sub);
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.look-chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #FFFFFF;
}

/* Floating Left-Rail Tools Drawer (#v3-drawer) */
#v3-drawer {
  position: fixed;
  left: var(--rail-w);
  top: var(--head-h, 64px);
  bottom: 0;
  z-index: 38;
  width: clamp(310px, 34vw, 520px);
  max-width: calc(100vw - var(--rail-w) - 8px);
  background: light-dark(#C4C4C4, #171717);
  border-right: 1px solid light-dark(#8E8E8E, #4A4A4A);
  box-shadow: 10px 0 24px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
}

.drawer-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: light-dark(#D9D9D9, #1F1F1F);
  border-bottom: 2px solid var(--accent);
}

.drawer-hdr h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.drawer-body {
  padding: 12px;
  overflow: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ==========================================================================
   Main Shell Offset (Respects 32px V3 Left Rail) & Cadence Bar
   ========================================================================== */

.shell-content-offset {
  margin-inline-start: var(--rail-w);
  inline-size: calc(100% - var(--rail-w));
  max-inline-size: calc(100% - var(--rail-w));
  min-inline-size: 0;
}

body[data-portal="true"] .shell-content-offset {
  margin-inline-start: var(--rail-w);
  inline-size: calc(100% - var(--rail-w));
  max-inline-size: calc(100% - var(--rail-w));
}

.cadence-strip {
  background: var(--bg-sub);
  border-bottom: 1px solid var(--border-main);
  padding: 7px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.cadence-steps {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cadence-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border: 1px solid var(--border-main);
  border-radius: var(--radius);
  background: var(--bg-box);
  color: var(--text-secondary);
  cursor: pointer;
}

.cadence-pill:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.cadence-pill.active {
  border-color: var(--accent);
  border-left: 3px solid var(--accent);
  color: var(--text-primary);
}

.gov-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Single-Row Horizontal Tab Bar (Edge-Faded Scroll Container)
   ========================================================================== */

.tabbar-wrap {
  background: var(--bg-box);
  border-bottom: 1px solid var(--border-main);
  padding: 0 10px;
}

.tablist-scroller {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: inline proximity;
  scroll-padding-inline: 2.5rem;
  gap: 2px;
  --fade-size: 2.25rem;
  --fade-dir: right;
  --fade-start-pos: 0;
  --fade-end-pos: 100%;
  mask:
    linear-gradient(black, black) no-clip subtract,
    linear-gradient(to var(--fade-dir), black, transparent) var(--fade-start-pos) 0 / var(--fade-start) 100% no-repeat no-clip,
    linear-gradient(to var(--fade-dir), transparent, black) var(--fade-end-pos) 0 / var(--fade-end) 100% no-repeat no-clip;
  animation: reveal-fade-start linear both, hide-fade-end linear both;
  animation-timeline: scroll(self inline);
  animation-range: 0 var(--fade-size), calc(100% - var(--fade-size)) 100%;
}

.tablist-scroller::-webkit-scrollbar {
  display: none;
}

@keyframes reveal-fade-start {
  to { --fade-start: var(--fade-size); }
}

@keyframes hide-fade-end {
  from { --fade-end: var(--fade-size); }
}

@supports not (animation-timeline: scroll()) {
  .tablist-scroller {
    transition: --fade-start 0.2s, --fade-end 0.2s;
  }
  .tablist-scroller.more-start { --fade-start: var(--fade-size); }
  .tablist-scroller.more-end   { --fade-end: var(--fade-size); }
}

.tablist-scroller button[role="tab"] {
  flex: none;
  scroll-snap-align: start;
  position: relative;
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  padding: 10px 13px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
}

.tablist-scroller button[role="tab"]:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.tablist-scroller button[role="tab"][aria-selected="true"] {
  color: var(--text-primary);
}

.tablist-scroller button[role="tab"][aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  border-block-end: 3px solid var(--accent);
}

/* ==========================================================================
   Workspace & Tab Panels (Zero styling on [role="tabpanel"] itself)
   ========================================================================== */

.workspace {
  max-inline-size: min(1840px, calc(100% - var(--rail-w)));
  margin-inline-start: var(--rail-w);
  margin-inline-end: auto;
}

.tabpanel-inner {
  padding: 14px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-inline-size: 0;
}

@media (max-width: 600px) {
  .tabpanel-inner {
    padding: 10px 10px 24px;
    gap: 10px;
  }
}

/* ==========================================================================
   KPI Strip, Badges & Banners
   ========================================================================== */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 175px), 1fr));
  gap: 10px;
}

.kpi-card {
  background: var(--bg-box);
  border: 1px solid var(--border-main);
  border-top: 2px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.kpi-card.accent { border-top-color: var(--accent); }
.kpi-card.ok     { border-top-color: var(--ok-text); }
.kpi-card.warn   { border-top-color: var(--warn-text); }
.kpi-card.bad    { border-top-color: var(--bad-text); }

.kpi-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.kpi-val {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text-primary);
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid var(--border-main);
  border-radius: var(--radius);
  background: var(--bg-sub);
  color: var(--text-primary);
  white-space: nowrap;
}

.badge.ok   { color: var(--ok-text);   background: var(--ok-bg);   border-color: var(--ok-bdr); }
.badge.warn { color: var(--warn-text); background: var(--warn-bg); border-color: var(--warn-bdr); }
.badge.bad  { color: var(--bad-text);  background: var(--bad-bg);  border-color: var(--bad-bdr); }
.badge.info { color: var(--info-text); background: var(--info-bg); border-color: var(--info-bdr); }

.ops-step-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--bg-box);
  border: 1px solid var(--border-main);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  font-size: 12px;
}

/* ==========================================================================
   V3 Collapsible Box (.v3-box) with 1px Red Fade Rule
   ========================================================================== */

.v3-box {
  background: var(--bg-box);
  border: 1px solid var(--border-main);
  border-radius: var(--radius);
  min-inline-size: 0;
  overflow: hidden;
}

.v3-box-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-sub);
  position: relative;
  flex-wrap: wrap;
}

.v3-box-hdr::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) 42%, var(--border-main) 100%);
}

.v3-box-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.collapse-btn {
  width: 22px;
  height: 22px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-box);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.collapse-btn:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

.v3-box-title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.v3-box-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

.v3-box-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.v3-box-body {
  padding: 12px;
  min-width: 0;
}

.v3-box[data-collapsed="true"] .v3-box-body {
  display: none;
}

.reorder-btns {
  display: none;
  align-items: center;
  gap: 4px;
}

body[data-edit-order="true"] .reorder-btns {
  display: inline-flex;
}

/* ==========================================================================
   Buttons, Segmented Bars, Inputs & Grids
   ========================================================================== */

.btn {
  background: var(--bg-sub);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--text-primary);
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.btn.red,
.btn.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

.btn.red:hover:not(:disabled),
.btn.accent:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn.sm {
  padding: 3px 8px;
  font-size: 10.5px;
}

.ctrl-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.field-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-secondary);
  font-weight: 600;
}

.field-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-secondary);
}

input[type="number"],
input[type="text"],
input[type="date"],
input[type="search"],
select,
textarea {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 4px 7px;
  font-size: 12px;
  max-width: 100%;
}

input:user-invalid,
textarea:user-invalid,
select:user-invalid {
  border-color: var(--accent);
  outline: 1px solid var(--accent);
}

input.cell-num {
  width: 68px;
  text-align: right;
  padding: 3px 5px;
}

.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
}

.stepper button {
  width: 24px;
  height: 24px;
  border: 0;
  background: var(--bg-sub);
  color: var(--text-primary);
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.stepper button:hover {
  background: var(--bg-hover);
  color: var(--accent-text);
}

.stepper output {
  min-width: 34px;
  text-align: center;
  font-weight: 700;
  font-size: 12px;
  border-inline: 1px solid var(--border-main);
  padding: 0 4px;
}

.proc-subtab-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: var(--bg-box);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}

.proc-subtab-group {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--border-strong);
  background: var(--bg-sub);
}

.proc-subtab-btn {
  appearance: none;
  border: 0;
  border-right: 1px solid var(--border-main);
  background: transparent;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.proc-subtab-btn:last-child {
  border-right: 0;
}

.proc-subtab-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.proc-subtab-btn[aria-pressed="true"] {
  background: var(--accent);
  color: #FFFFFF;
}

.split-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
  gap: 12px;
}

.dash-band {
  display: grid;
  grid-template-columns: minmax(0, 1.72fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

@media (max-width: 1200px) {
  .dash-band {
    grid-template-columns: minmax(0, 1fr);
  }
}

.dash-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* ==========================================================================
   Sticky Container-Queried Data Tables (table.data-grid)
   ========================================================================== */

.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(560px, 72vh);
  container-type: inline-size;
  border: 1px solid var(--border-main);
  border-radius: var(--radius);
}

table.data-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

table.data-grid thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
}

table.data-grid thead th {
  background: #1B1B1B;
  color: #F0F0F0;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 7px 8px;
  border-bottom: 2px solid var(--accent);
  border-right: 1px solid #343434;
  text-align: left;
  white-space: nowrap;
}

table.data-grid thead th[data-num="1"] {
  text-align: right;
}

table.data-grid thead th.sortable {
  cursor: pointer;
}

table.data-grid thead th.sortable:hover {
  color: #FFFFFF;
  background: #282828;
}

table.data-grid tbody th {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  background: var(--bg-box);
  color: var(--text-primary);
  font-weight: 700;
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-main);
  border-right: 1px solid var(--border-main);
  white-space: nowrap;
}

table.data-grid tbody td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-main);
  border-right: 1px solid var(--border-main);
  background: var(--bg-box);
  white-space: nowrap;
}

table.data-grid tbody td[data-num="1"] {
  text-align: right;
}

table.data-grid tbody tr:nth-child(even) th,
table.data-grid tbody tr:nth-child(even) td {
  background: var(--bg-row-alt);
}

table.data-grid tbody tr:hover th,
table.data-grid tbody tr:hover td {
  background: var(--bg-hover);
}

table.data-grid tr.summary-row th,
table.data-grid tr.summary-row td {
  background: var(--bg-sub) !important;
  font-weight: 700;
  border-top: 2px solid var(--border-strong);
}

@container (width < 540px) {
  table.data-grid.stack-mobile,
  table.data-grid.stack-mobile thead,
  table.data-grid.stack-mobile tbody,
  table.data-grid.stack-mobile tr,
  table.data-grid.stack-mobile th,
  table.data-grid.stack-mobile td {
    display: block;
  }

  table.data-grid.stack-mobile thead {
    display: none;
  }

  table.data-grid.stack-mobile tbody tr {
    margin-block-end: 8px;
    border: 1px solid var(--border-strong);
  }

  table.data-grid.stack-mobile tbody th {
    position: sticky;
    inset-block-start: 0;
    z-index: 2;
    background: #1F1F1F !important;
    color: #FFFFFF;
    border-bottom: 1px solid var(--accent);
    border-right: 0;
  }

  table.data-grid.stack-mobile tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    text-align: right !important;
    white-space: normal;
    border-right: 0;
  }

  table.data-grid.stack-mobile tbody td[data-label]::before {
    content: attr(data-label) ": ";
    font-weight: 700;
    color: var(--text-secondary);
    text-align: left;
  }
}

/* ==========================================================================
   13-Week Expandable Rollup Matrix (table.rollup-grid)
   ========================================================================== */

.rollup-matrix-wrap {
  overflow-x: auto;
  max-inline-size: 100%;
  border: 1px solid var(--border-strong);
  scrollbar-width: thin;
}

table.rollup-grid {
  width: 100%;
  min-width: 1180px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
}

table.rollup-grid thead th {
  background: #181818;
  color: #F2F2F2;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 5px 5px;
  border-bottom: 1px solid #383838;
  border-right: 1px solid #323232;
  white-space: nowrap;
  text-align: right;
}

table.rollup-grid thead tr.band-row th {
  text-align: center;
  letter-spacing: 0.05em;
}

table.rollup-grid thead tr.band-row th.band-actuals {
  background: #27231C;
  color: #F5C400;
  border-bottom: 2px solid #D9A400;
}

table.rollup-grid thead tr.band-row th.band-current {
  background: #8D2110;
  color: #FFFFFF;
  border-left: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
}

table.rollup-grid thead tr.band-row th.band-forecast {
  background: #142433;
  color: #7CC0FF;
  border-bottom: 2px solid var(--accent);
}

table.rollup-grid thead th.sticky-metric-hdr {
  position: sticky;
  inset-inline-start: 0;
  z-index: 4;
  text-align: left;
  min-width: 190px;
  background: #141414;
  border-right: 2px solid #525252;
}

table.rollup-grid thead tr:last-child th {
  border-bottom: 2px solid var(--accent);
}

table.rollup-grid th.col-current-wk,
table.rollup-grid td.col-current-wk {
  border-left: 2px solid var(--accent) !important;
  border-right: 2px solid var(--accent) !important;
}

table.rollup-grid tbody th {
  position: sticky;
  inset-inline-start: 0;
  z-index: 2;
  background: var(--bg-box);
  color: var(--text-primary);
  text-align: left;
  padding: 5px 8px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-main);
  border-right: 2px solid var(--border-strong);
  white-space: nowrap;
}

table.rollup-grid tbody td {
  padding: 5px 5px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--border-main);
  border-right: 1px solid var(--border-main);
  background: var(--bg-box);
  white-space: nowrap;
}

table.rollup-grid tbody td.col-actual {
  background: light-dark(#FAF7EF, #23211C);
}

table.rollup-grid tbody td.col-current-wk {
  background: light-dark(#FFF4EE, #2C1E1A);
  font-weight: 700;
}

table.rollup-grid tr.pm-l0 th,
table.rollup-grid tr.pm-l0 td {
  background: light-dark(#E8ECF0, #1F242B) !important;
  font-weight: 700;
  border-top: 2px solid var(--border-strong);
}

table.rollup-grid tr.pm-l1 th { padding-left: 20px; font-weight: 700; }
table.rollup-grid tr.pm-l2 th { padding-left: 36px; color: var(--text-secondary); font-weight: 500; }

.dept-toggle-btn {
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
}

.dept-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border: 1px solid var(--accent);
  background: var(--bg-box);
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

/* ==========================================================================
   Charts, Progress Meters & 152-Slot Bi-Directional Equipment Tracker
   ========================================================================== */

progress.ops-meter {
  appearance: none;
  border: 1px solid var(--border-main);
  overflow: clip;
  inline-size: 100%;
  block-size: 9px;
  background: var(--progress-track);
  display: block;
}

progress.ops-meter::-webkit-progress-bar { background: transparent; }
progress.ops-meter::-webkit-progress-value { background: var(--accent); }
progress.ops-meter::-moz-progress-bar { background: var(--accent); }

progress.ops-meter.ok::-webkit-progress-value { background: var(--ok-text); }
progress.ops-meter.ok::-moz-progress-bar { background: var(--ok-text); }
progress.ops-meter.warn::-webkit-progress-value { background: var(--warn-text); }
progress.ops-meter.warn::-moz-progress-bar { background: var(--warn-text); }

.svg-chart-wrap {
  width: 100%;
  max-width: 100%;
  background: var(--bg-sub);
  border: 1px solid var(--border-main);
  padding: 8px 10px;
  overflow-x: auto;
}

.svg-chart-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  min-width: 440px;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-swatch {
  width: 11px;
  height: 11px;
  display: inline-block;
  border: 1px solid var(--border-strong);
}

/* Bi-Directional Segmented Equipment Bar */
.fleet-track-outer {
  position: relative;
  padding: 24px 0 4px;
  margin: 6px 0 2px;
}

.fleet-152-line {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--fleet-cols, 152), minmax(0, 1fr));
  gap: 1px;
  width: 100%;
  height: 32px;
  padding: 3px;
  background: light-dark(#D6DCE3, #141414);
  border: 1px solid light-dark(#6E7681, #555555);
  align-items: stretch;
}

.fleet-152-line.is-mini {
  height: 18px;
  padding: 2px;
}

.fleet-sq {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
}

.fleet-sq.ib   { background: linear-gradient(180deg, #64B5F6 0%, #1E88E5 50%, #0D47A1 100%); }
.fleet-sq.icqa { background: linear-gradient(180deg, #FFE57F 0%, #F5C400 50%, #9E7B00 100%); }
.fleet-sq.free { background: linear-gradient(180deg, #5E636B 0%, #3F4349 100%); }
.fleet-sq.redtag { background: repeating-linear-gradient(135deg, #737373 0, #737373 2px, #3A3A3A 2px, #3A3A3A 4px); }
.fleet-sq.ob   { background: linear-gradient(180deg, #FF6B6B 0%, #D71919 50%, #8B0000 100%); }

.fleet-bracket {
  position: absolute;
  top: -18px;
  bottom: -2px;
  border: 2px solid #F5C400;
  pointer-events: none;
  z-index: 4;
}

.fleet-bracket-tag {
  position: absolute;
  top: -17px;
  left: 50%;
  transform: translateX(-50%);
  background: #F5C400;
  color: #111111;
  font-size: 9.5px;
  font-weight: 800;
  line-height: 14px;
  padding: 0 6px;
  white-space: nowrap;
  text-transform: uppercase;
}

.fleet-cascade {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 165px), 1fr));
  gap: 6px;
  margin-top: 8px;
  font-size: 11px;
}

.fleet-chip {
  padding: 5px 8px;
  border: 1px solid var(--border-main);
  background: var(--bg-sub);
  font-variant-numeric: tabular-nums;
}

.fleet-chip.ib   { border-inline-start: 3px solid #1E88E5; }
.fleet-chip.icqa { border-inline-start: 3px solid #F5C400; }
.fleet-chip.grey { border-inline-start: 3px solid #6E7681; }
.fleet-chip.ob   { border-inline-start: 3px solid var(--accent); }

.fleet-day-list {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fleet-day-row {
  width: 100%;
  text-align: left;
  background: var(--bg-sub);
  border: 1px solid var(--border-main);
  border-inline-start: 3px solid transparent;
  padding: 5px 8px;
  display: grid;
  grid-template-columns: 72px minmax(110px, 1fr) auto 92px;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.fleet-day-row:hover {
  background: var(--bg-hover);
}

.fleet-day-row[aria-pressed="true"] {
  background: var(--bg-box);
  border-color: var(--border-strong);
  border-inline-start-color: var(--accent);
}

@container (width < 560px) {
  .fleet-day-row {
    grid-template-columns: 58px 1fr;
  }
}

/* ==========================================================================
   Dock & Yard Tiles + Variance Bridge Form Cards
   ========================================================================== */

.yard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 138px), 1fr));
  gap: 8px;
}

.dock-tile {
  background: var(--bg-sub);
  border: 1px solid var(--border-main);
  border-top: 3px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 8px 9px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
  cursor: pointer;
  color: var(--text-primary);
}

.dock-tile:hover {
  background: var(--bg-hover);
  border-color: var(--text-primary);
}

.dock-tile[aria-pressed="true"] {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.dock-tile.st-ok   { border-top-color: var(--ok-text); }
.dock-tile.st-warn { border-top-color: var(--warn-text); }
.dock-tile.st-bad  { border-top-color: var(--bad-text); }
.dock-tile.st-info { border-top-color: var(--info-text); }

.bridge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 10px;
}

.bridge-fieldset {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  background: var(--bg-sub);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bridge-fieldset.is-bridged {
  border-left-color: var(--ok-text);
}

.bridge-fieldset legend {
  padding: 0 6px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ==========================================================================
   Native <details> Accordions (Modern Web Guidance)
   ========================================================================== */

.v3-acc-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.v3-acc {
  border: 1px solid var(--border-main);
  border-radius: var(--radius);
  background: var(--bg-box);
}

.v3-acc > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-sub);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.v3-acc > summary::-webkit-details-marker {
  display: none;
}

.v3-acc > summary::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
  background: var(--bg-box);
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

.v3-acc[open] > summary::before {
  content: "−";
  border-color: var(--accent);
}

.v3-acc > summary:hover {
  background: var(--bg-hover);
}

.v3-acc::details-content {
  interpolate-size: allow-keywords;
  overflow: clip;
  contain: layout;
}

.v3-acc:not([open])::details-content {
  block-size: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .v3-acc::details-content {
    transition: block-size 0.25s ease-in-out, content-visibility 0.25s ease-in-out, display 0.25s ease-in-out;
    transition-behavior: allow-discrete;
  }
}

.v3-acc-body {
  padding: 10px 12px;
  border-top: 1px solid var(--border-main);
  font-size: 12px;
  line-height: 1.5;
}

[command="--toggle-all"][aria-expanded="true"] .lbl-expand,
[command="--toggle-all"][aria-expanded="false"] .lbl-collapse {
  display: none;
}

/* ==========================================================================
   Native Modal Dialogs (Scroll-contained backdrop, open-scoped display)
   ========================================================================== */

dialog.ops-modal {
  padding: 0;
  border: 1px solid var(--border-strong);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg-box);
  color: var(--text-primary);
  width: min(980px, 94vw);
  max-height: 88vh;
  overflow: auto;
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgb(0 0 0 / 0.72);
  overflow: hidden;
  overscroll-behavior: contain;
}

.ops-modal-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: #171717;
  color: #F2F2F2;
  border-bottom: 1px solid var(--accent);
}

.ops-modal-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 640px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

.dropzone {
  border: 2px dashed var(--border-strong);
  background: var(--bg-sub);
  padding: 16px;
  text-align: center;
  cursor: pointer;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: var(--bad-bg);
}

/* ==========================================================================
   Toast Notification Bar
   ========================================================================== */

.toast-bar {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 999;
  max-width: min(420px, calc(100vw - 56px));
  background: #171717;
  color: #FFFFFF;
  border: 1px solid var(--accent);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 600;
}

.txt-ok   { color: var(--ok-text);   font-weight: 700; }
.txt-warn { color: var(--warn-text); font-weight: 700; }
.txt-bad  { color: var(--bad-text);  font-weight: 700; }
.txt-info { color: var(--info-text); font-weight: 700; }
.txt-muted { color: var(--text-muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
