/* Oktafian Bayu Prakosa Engineering Workspace (DTCG oklch tokens loaded via styles/tokens.css). */

:root {
  --border-console: #334155;
  --rim-light: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  --shadow-card: 0 0 0 1px rgba(15, 23, 42, 0.06), 0 4px 18px -4px rgba(10, 36, 32, 0.07);
}

[data-theme="dark"] {
  --border-console: #334155;
  --rim-light: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --shadow-card: 0 0 0 1px rgba(148, 163, 184, 0.12), 0 8px 24px -6px rgba(0, 0, 0, 0.45);
}

@supports (interpolate-size: allow-keywords) {
  :root {
    interpolate-size: allow-keywords;
  }
  details.work-details::details-content {
    block-size: 0;
    overflow-y: clip;
    transition: block-size 220ms var(--ease-out-quart), content-visibility 220ms allow-discrete;
  }
  details.work-details[open]::details-content {
    block-size: auto;
  }
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  scrollbar-width: none;
  background: var(--bg-canvas);
  color: var(--ink-primary);
}

html::-webkit-scrollbar {
  display: none;
}

h1, h2, h3 {
  text-wrap: balance;
  font-optical-sizing: auto;
}

h1 {
  letter-spacing: -0.025em;
}

p {
  text-wrap: pretty;
}

section[id], article[id], div[data-sim-panel] {
  scroll-margin-top: 84px;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.98rem;
  line-height: 1.58;
  color: var(--ink-primary);
  background: var(--bg-canvas);
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--bg-dock);
  color: var(--ink-light);
  padding: 12px 18px;
  z-index: 1000;
  font-weight: 700;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
}

a {
  color: var(--accent-cobalt);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-cobalt-dark);
}

button, input, select {
  font: inherit;
}

a[href], button, .btn, summary, select, label[for],
[role="button"], [role="link"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"],
input[type="checkbox"], input[type="radio"], input[type="range"] {
  cursor: pointer;
}

:disabled, [aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.6;
}

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, .topo-node:focus-visible {
  outline: 3px solid var(--accent-cobalt);
  outline-offset: 2px;
}

.console-dark a:focus-visible, .console-dark button:focus-visible, .console-dark input:focus-visible, .console-dark select:focus-visible, .console-dark .topo-node:focus-visible, .app-dock a:focus-visible {
  outline: 3px solid var(--scada-emerald);
  outline-offset: 2px;
}

code, .mono {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

code {
  background: var(--tint-emerald);
  color: var(--accent-emerald-dark);
  padding: 2px 6px;
  border-radius: 4px;
}

.console-dark code {
  background: var(--bg-bezel);
  color: var(--scada-amber);
  border: 1px solid var(--border-console);
}

img, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Three-zone workspace app shell (single column -> rail + canvas -> 3-zone desktop). */
.workspace-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 14px 16px calc(88px + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

@media (min-width: 960px) {
  html {
    scroll-padding-bottom: 24px;
  }
  .workspace-shell {
    grid-template-columns: var(--dock-w) minmax(0, 1fr);
    padding: 18px 20px 36px;
    gap: 20px;
    transition: grid-template-columns 220ms var(--ease-drawer);
  }
  .workspace-shell[data-dock-expanded="true"] {
    --dock-w: 204px;
  }
}

@media (min-width: 1180px) {
  .workspace-shell {
    grid-template-columns: var(--dock-w) minmax(0, 1fr) 280px;
  }
}

.workspace-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* Floating left rail on desktop; compact safe-area bottom dock below 960px. */
.app-dock {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 250;
  background: var(--bg-dock);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 4px;
  box-shadow: var(--rim-light), 0 10px 28px rgba(4, 18, 16, 0.36);
}

@media (min-width: 960px) {
  .app-dock {
    position: sticky;
    top: 18px;
    left: auto;
    right: auto;
    bottom: auto;
    flex-direction: column;
    justify-content: space-between;
    padding: 14px 8px;
    min-height: 540px;
    border-radius: 22px;
  }
}

.dock-brand {
  display: none;
}

@media (min-width: 960px) {
  .dock-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1.5px solid var(--scada-emerald);
    color: var(--scada-emerald);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.85rem;
    text-decoration: none;
  }
}

.dock-nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  gap: 4px;
}

@media (min-width: 960px) {
  .dock-nav {
    flex-direction: column;
    gap: 10px;
  }
}

.dock-link {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 4px 6px;
  border-radius: 12px;
  color: var(--ink-light-muted);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 600;
  gap: 2px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.dock-link svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
}

.dock-link:hover, .dock-link[data-active="true"] {
  background: rgba(52, 211, 153, 0.16);
  color: var(--scada-emerald);
}

.dock-ext {
  display: none;
}

@media (min-width: 960px) {
  .dock-ext {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    padding-top: 10px;
  }
}

/* Single restrained glass surface at page top (R-10 dose cap). */
.workspace-topbar {
  background: var(--bg-topbar);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-card);
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: var(--rim-light), var(--shadow-card);
}

@media (min-width: 960px) {
  .workspace-topbar {
    position: sticky;
    top: 14px;
    z-index: 120;
  }
}

.topbar-id {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.topbar-title {
  font-weight: 700;
  font-size: 1.04rem;
  color: var(--ink-primary);
}

.status-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--tint-emerald);
  color: var(--accent-emerald-dark);
  font-size: 0.78rem;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent-emerald);
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill-btn {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-white);
  color: var(--ink-primary);
  font-size: 0.84rem;
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.pill-btn:hover {
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
}

.pill-btn[aria-pressed="true"] {
  background: var(--bg-dock);
  border-color: var(--bg-dock);
  color: var(--ink-light);
}

/* Button hierarchy with tactile active press feedback. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-white);
  color: var(--ink-primary);
  transition: transform 0.14s ease, border-color 0.14s ease, background-color 0.14s ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--ink-primary);
  background: var(--bg-canvas);
  color: var(--ink-primary);
}

.btn-emerald {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  color: var(--bg-white);
  font-weight: 700;
}

.btn-emerald:hover {
  background: var(--accent-emerald-dark);
  border-color: var(--accent-emerald-dark);
  color: var(--bg-white);
}

.btn-cobalt {
  background: var(--accent-cobalt);
  border-color: var(--accent-cobalt);
  color: var(--bg-white);
  font-weight: 700;
}

.btn-cobalt:hover {
  background: var(--accent-cobalt-dark);
  border-color: var(--accent-cobalt-dark);
  color: var(--bg-white);
}

.btn-dock {
  background: var(--bg-dock);
  border-color: var(--bg-dock);
  color: var(--bg-white);
  font-weight: 700;
}

.btn-dock:hover {
  background: #133B34;
  color: var(--bg-white);
}

.btn-scada-sky {
  background: var(--scada-sky);
  border-color: var(--scada-sky);
  color: var(--bg-console);
  font-weight: 700;
}

.btn-scada-sky:hover {
  background: #7DD3FC;
  color: var(--bg-console);
}

.btn-scada-amber {
  background: var(--scada-amber);
  border-color: var(--scada-amber);
  color: var(--bg-console);
  font-weight: 700;
}

.btn-scada-amber:hover {
  background: #FCD34D;
  color: var(--bg-console);
}

.btn-scada-rose {
  background: var(--accent-rose);
  border-color: var(--accent-rose);
  color: var(--bg-white);
  font-weight: 700;
}

.btn-scada-rose:hover {
  background: #9F1239;
  color: var(--bg-white);
}

.btn-scada-ghost {
  background: var(--bg-bezel);
  border-color: var(--border-console);
  color: var(--ink-light);
}

.btn-scada-ghost:hover {
  background: #283548;
  border-color: var(--scada-sky);
  color: var(--ink-light);
}

/* Workspace card containers. */
.dash-card {
  background: var(--bg-white);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow-card);
  min-width: 0;
}

.console-dark {
  background: var(--bg-console);
  border: 1px solid var(--border-console);
  border-radius: 18px;
  padding: 22px;
  color: var(--ink-light);
  box-shadow: var(--shadow-card);
  min-width: 0;
}

.console-dark a:not(.btn) {
  color: var(--scada-sky);
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
  margin-bottom: 18px;
}

.console-dark .section-header {
  border-bottom-color: var(--border-console);
}

.section-header h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.48rem;
  color: var(--ink-primary);
}

.console-dark .section-header h2 {
  color: var(--ink-light);
}

.section-sub {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-emerald);
}

.console-dark .section-sub {
  color: var(--scada-emerald);
}

/* Hero layout, inline sparklines, and interactive topology console. */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

@media (min-width: 880px) {
  .hero-grid {
    grid-template-columns: 1.08fr 0.92fr;
  }
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent-emerald);
  margin: 0 0 8px;
}

.hero-card h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.85rem, 3.2vw, 2.65rem);
  line-height: 1.14;
  margin: 0 0 8px;
  color: var(--ink-primary);
}

.hero-role {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-cobalt);
  margin: 0 0 12px;
}

.hero-summary {
  color: var(--ink-muted);
  margin: 0 0 16px;
}

.action-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.hero-meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 0.84rem;
  color: var(--ink-muted);
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.topo-console {
  background: var(--bg-dock);
  border-radius: 14px;
  padding: 16px;
  color: var(--ink-light);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
}

.topo-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: #CBD5E1;
}

.topo-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.topo-footer-pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 8px;
  background: #0F2D27;
  border: 1px solid rgba(52, 211, 153, 0.42);
  color: #F8FAFC !important;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.76rem;
}

.topo-footer-pill:hover {
  border-color: #34D399;
  color: #34D399 !important;
}

.topo-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.topo-tag {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--scada-sky);
}

.ci-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--scada-emerald);
  border: 1px solid var(--scada-emerald);
  padding: 2px 8px;
  border-radius: 999px;
}

.topo-flow-line {
  stroke-dasharray: 6 6;
  animation: scadaFlow 2.8s linear infinite;
}

@keyframes scadaFlow {
  to { stroke-dashoffset: -24; }
}

.topo-node rect {
  transition: stroke 0.15s ease, fill 0.15s ease;
}

.topo-node:hover rect {
  stroke: var(--scada-amber);
  fill: #173F37;
}

/* KPI Row with Inline Sparklines */
.kpi-spark-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 520px) {
  .kpi-spark-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1080px) {
  .kpi-spark-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.kpi-card {
  background: var(--bg-white);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.kpi-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.kpi-pill-emerald {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--tint-emerald);
  color: var(--accent-emerald-dark);
  padding: 2px 8px;
  border-radius: 999px;
}

.kpi-pill-blue {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--tint-blue);
  color: var(--accent-cobalt-dark);
  padding: 2px 8px;
  border-radius: 999px;
}

.kpi-pill-amber {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--tint-amber);
  color: var(--accent-amber-dark);
  padding: 2px 8px;
  border-radius: 999px;
}

.kpi-num {
  font-family: var(--font-serif);
  font-size: 1.38rem;
  font-weight: 700;
  color: var(--ink-primary);
  line-height: 1.15;
}

.kpi-desc {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

/* Discipline-coded engineering case study cards with concentric inner stages. */
.works-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

@media (min-width: 720px) {
  .works-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.work-card {
  background: var(--bg-white);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.16s ease, border-color 0.16s ease;
  min-width: 0;
}

.work-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-cobalt);
}

.work-card[hidden] {
  display: none;
}

.work-stage {
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stage-emerald { background: var(--tint-emerald); }
.stage-blue { background: var(--tint-blue); }
.stage-amber { background: var(--tint-amber); }
.stage-rose { background: var(--tint-rose); }

.work-stage-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.stage-tag-emerald { color: var(--accent-emerald-dark); font-family: var(--font-mono); font-size: 0.74rem; font-weight: 700; }
.stage-tag-blue { color: var(--accent-cobalt-dark); font-family: var(--font-mono); font-size: 0.74rem; font-weight: 700; }
.stage-tag-amber { color: var(--accent-amber-dark); font-family: var(--font-mono); font-size: 0.74rem; font-weight: 700; }
.stage-tag-rose { color: var(--accent-rose-dark); font-family: var(--font-mono); font-size: 0.74rem; font-weight: 700; }

.zoom-trigger {
  display: block;
  width: 100%;
  padding: 6px;
  background: var(--bg-white);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  text-align: center;
}

.zoom-trigger:hover {
  border-color: var(--accent-cobalt);
}

.zoom-trigger img {
  margin: 0 auto;
  max-height: 178px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.zoom-caption-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.76rem;
  color: var(--ink-muted);
}

.zoom-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-cobalt);
}

.work-card h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.16rem;
  line-height: 1.3;
  color: var(--ink-primary);
}

.work-org {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.work-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-primary);
}

.work-details summary {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-cobalt);
  padding: 6px 0;
}

.extra-plates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
}

/* Embedded dark ISA-101 SCADA workbench for 5 client-side digital twins. */
.sim-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-console);
  padding-bottom: 12px;
}

.sim-tab-btn {
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid var(--border-console);
  border-bottom: 3px solid transparent;
  background: var(--bg-bezel);
  color: var(--ink-light-muted);
  font-family: var(--font-mono);
  font-size: 0.83rem;
  font-weight: 600;
  border-radius: 10px 10px 4px 4px;
}

.sim-tab-btn:hover {
  color: var(--ink-light);
}

.sim-tab-btn[aria-selected="true"] {
  background: var(--bg-dock);
  color: var(--scada-emerald);
  border-color: var(--scada-emerald);
}

.sim-panel[hidden] {
  display: none;
}

.sim-panel h3 {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 1.24rem;
  color: var(--ink-light);
}

.sim-panel > p {
  color: var(--ink-light-muted);
  margin: 0 0 16px;
  font-size: 0.9rem;
}

.sim-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 860px) {
  .sim-grid {
    grid-template-columns: 0.92fr 1.08fr;
  }
}

.sim-controls-col, .sim-visual-col {
  min-width: 0;
}

.control-group {
  margin-bottom: 12px;
}

.control-label-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-light);
  margin-bottom: 4px;
}

.control-group input[type="range"] {
  width: 100%;
  min-height: 36px;
  accent-color: var(--scada-sky);
}

.scada-select {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  background: var(--bg-bezel);
  color: var(--ink-light);
  border: 1px solid var(--border-console);
  border-radius: 8px;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.status-readout-dark {
  background: var(--bg-bezel);
  border: 1px solid var(--border-console);
  border-radius: 12px;
  padding: 14px;
}

.status-banner {
  padding: 10px 12px;
  font-weight: 700;
  border-radius: 8px;
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 0.84rem;
}

.status-ok {
  background: rgba(52, 211, 153, 0.14);
  color: var(--scada-emerald);
  border-left: 4px solid var(--scada-emerald);
}

.status-warn {
  background: rgba(251, 191, 36, 0.14);
  color: var(--scada-amber);
  border-left: 4px solid var(--scada-amber);
}

.status-fault {
  background: rgba(248, 113, 113, 0.16);
  color: var(--scada-crimson);
  border-left: 4px solid var(--scada-crimson);
}

.svg-instrument-box {
  background: #07101E;
  border: 1px solid var(--border-console);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 12px;
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
}

.kv-box {
  background: var(--bg-console);
  border: 1px solid var(--border-console);
  border-radius: 8px;
  padding: 9px 11px;
}

.kv-key {
  font-size: 0.76rem;
  color: var(--ink-light-muted);
}

.kv-val {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink-light);
  word-break: break-word;
}

.modbus-box {
  margin-top: 12px;
  border-top: 1px solid var(--border-console);
  padding-top: 10px;
}

.nb-swatch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--border-console);
  background: var(--bg-console);
  border-radius: 8px;
}

.nb-swatch {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  border: 1px solid var(--ink-light);
  flex-shrink: 0;
}

/* Standards ledger, experience timeline, TOEFL card, and dossier links. */
.radar-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: center;
}

@media (min-width: 820px) {
  .radar-split {
    grid-template-columns: 0.86fr 1.14fr;
  }
}

.radar-box {
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 12px;
}

.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background:
    linear-gradient(to right, var(--bg-white) 30%, rgba(255, 255, 255, 0)),
    linear-gradient(to left, var(--bg-white) 30%, rgba(255, 255, 255, 0)) 100% 0,
    radial-gradient(farthest-side at 0 50%, rgba(15, 23, 42, 0.14), rgba(15, 23, 42, 0)),
    radial-gradient(farthest-side at 100% 50%, rgba(15, 23, 42, 0.14), rgba(15, 23, 42, 0)) 100% 0;
  background-repeat: no-repeat;
  background-color: var(--bg-white);
  background-size: 32px 100%, 32px 100%, 12px 100%, 12px 100%;
  background-attachment: local, local, scroll, scroll;
}

.table-scroll:focus-visible {
  outline: 2.5px solid var(--accent-cobalt);
  outline-offset: 2px;
}

.work-card, .timeline-card, .dash-card, .hero-grid > div, .star-card, table.ledger td {
  min-width: 0;
  overflow-wrap: anywhere;
}

table.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  background: var(--bg-white);
}

table.ledger th {
  text-align: left;
  padding: 8px 10px;
  background: var(--bg-canvas);
  border-bottom: 1.5px solid var(--ink-primary);
  font-weight: 700;
}

table.ledger td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

.timeline-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 780px) {
  .timeline-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.timeline-card {
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent-cobalt);
  border-radius: 12px;
  padding: 18px;
}

.timeline-card-emerald {
  border-left-color: var(--accent-emerald);
}

.timeline-card h3 {
  margin: 0 0 4px;
  font-family: var(--font-serif);
  font-size: 1.15rem;
}

.timeline-card ul {
  padding-left: 18px;
  margin: 10px 0 0;
  font-size: 0.9rem;
}

.timeline-card li {
  margin-bottom: 6px;
}

.cred-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

@media (min-width: 820px) {
  .cred-split {
    grid-template-columns: 1.05fr 0.95fr;
  }
}

.grade-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0;
}

.grade-tag {
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: 8px;
}

.grade-tag strong {
  color: var(--accent-emerald);
  font-family: var(--font-mono);
}

.toefl-bar-group {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.toefl-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  color: var(--ink-light);
  margin-bottom: 4px;
}

.toefl-track {
  height: 9px;
  background: var(--bg-dock);
  border-radius: 999px;
  border: 1px solid var(--border-console);
}

.toefl-fill-emerald { height: 100%; border-radius: 999px; background: var(--scada-emerald); }
.toefl-fill-sky { height: 100%; border-radius: 999px; background: var(--scada-sky); }
.toefl-fill-amber { height: 100%; border-radius: 999px; background: var(--scada-amber); }

.dossier-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 800px) {
  .dossier-split {
    grid-template-columns: 1.25fr 0.75fr;
  }
}

.dossier-subcard {
  background: var(--bg-bezel);
  border: 1px solid var(--border-console);
  border-radius: 12px;
  padding: 18px;
}

.dossier-subcard h3 {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  color: var(--ink-light);
}

.dossier-subcard p {
  margin: 0 0 14px;
  color: var(--ink-light-muted);
  font-size: 0.9rem;
}

/* Floating right Collections and telemetry status panel. */
.collections-rail {
  background: var(--bg-white);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

@media (min-width: 1180px) {
  .collections-rail {
    position: sticky;
    top: 18px;
  }
}

.collections-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
}

.collections-head h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink-primary);
}

.collections-list {
  display: grid;
  gap: 8px;
}

.collection-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-white);
  color: var(--ink-primary);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.collection-item:hover {
  background: var(--bg-canvas);
  border-color: var(--accent-emerald);
  color: var(--accent-emerald-dark);
}

.collection-item[aria-current="true"] {
  background: var(--tint-emerald);
  border-color: var(--accent-emerald);
  color: var(--accent-emerald-dark);
}

.collection-badge {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-canvas);
  color: var(--ink-muted);
}

.rail-callout {
  background: var(--bg-dock);
  color: var(--ink-light);
  border-radius: 12px;
  padding: 14px;
  font-size: 0.84rem;
}

.rail-callout strong {
  display: block;
  color: var(--scada-emerald);
  margin-bottom: 4px;
}

/* Native dialog overlays, command palette, live telemetry, and print layout. */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.84rem;
  color: var(--ink-muted);
  padding: 8px 4px;
}

.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;
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 600;
  background: var(--accent-emerald);
  transform-origin: left center;
  transform: scaleX(var(--scroll-p, 0));
  pointer-events: none;
}

@supports (animation-timeline: scroll()) {
  .scroll-progress {
    animation: railGrow linear both;
    animation-timeline: scroll(root block);
  }
  @keyframes railGrow {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
  }
}

/* Tactile press feedback (Frequency Gate: 120ms, never scale(0)). */
.btn:active, .pill-btn:active, .collection-item:active, .sim-tab-btn:active, .track-btn:active, .util-btn:active {
  transform: scale(0.97);
}

.btn, .pill-btn, .collection-item, .sim-tab-btn, .track-btn, .util-btn {
  transition: transform 120ms var(--ease-out-quart), background-color 160ms var(--ease-out-quart), border-color 160ms var(--ease-out-quart), color 160ms var(--ease-out-quart);
}

.dash-card, .kpi-card, .work-card, .collections-rail {
  box-shadow: var(--rim-light), var(--shadow-card);
}

.work-card {
  border-radius: var(--r-card);
  padding: var(--card-pad);
  container-type: inline-size;
  container-name: workcard;
}

.work-stage {
  border-radius: max(4px, calc(var(--r-card) - var(--card-pad) + 6px));
}

.zoom-trigger img {
  transition: transform 200ms var(--ease-out-quart);
}

.zoom-trigger:hover img {
  transform: scale(1.02);
}

/* Keep dark-ink line SVG schematics legible on dark Control Room theme (R-34). */
[data-theme="dark"] .zoom-trigger {
  background: #13262B;
  border-color: var(--border-subtle);
  color: var(--ink-primary);
}

[data-theme="dark"] .zoom-trigger img[src$=".svg"] {
  background: #F8FAFC;
  border-radius: 6px;
  padding: 4px;
}

[data-theme="dark"] .pill-btn[aria-pressed="true"] {
  background: #34D399;
  border-color: #34D399;
  color: #061714;
}

[data-theme="dark"] .btn {
  background: #13262B;
  color: #F8FAFC;
  border-color: #33525E;
}

[data-theme="dark"] .btn-emerald {
  background: #047857;
  border-color: #34D399;
  color: #FFFFFF;
}

[data-theme="dark"] .btn-cobalt {
  background: #1D4ED8;
  border-color: #38BDF8;
  color: #FFFFFF;
}

[data-theme="dark"] .btn-dock {
  background: #0A2420;
  border-color: #34D399;
  color: #F8FAFC;
}

[data-theme="dark"] .kpi-pill-emerald,
[data-theme="dark"] .kpi-pill-blue,
[data-theme="dark"] .kpi-pill-amber {
  border: 1px solid rgba(255, 255, 255, 0.14);
}

[data-theme="dark"] .kpi-pill-amber {
  background: #291F0B;
  color: #FDE68A;
}

[data-theme="dark"] .grade-tag {
  background: #13262B;
  border-color: #2B4954;
  color: #F1F5F9;
}

[data-theme="dark"] .timeline-card {
  background: #122329;
  border-color: #25414B;
}

[data-theme="dark"] .radar-box {
  background: #0C181D;
  border-color: var(--border-subtle);
}

[data-theme="dark"] .ledger th {
  background: #13262B;
  color: #F8FAFC;
}

[data-theme="dark"] .ledger td {
  color: #E2E8F0;
  border-color: var(--border-subtle);
}

[data-theme="dark"] .collection-badge {
  background: #162B32;
  color: #CBD5E1;
}

[data-theme="dark"] .rail-callout {
  background: #061714;
  border: 1px solid #1E443C;
}

/* Asymmetric featured flagship card span (RHYTHM 3, R-14). */
@media (min-width: 720px) {
  .work-card-featured {
    grid-column: span 2;
  }
}

@container workcard (min-width: 660px) {
  .work-featured-split {
    display: grid;
    grid-template-columns: 1.18fr 1fr;
    gap: 18px;
    align-items: start;
  }
}

/* Collapsible desktop left rail header, labels, and active marker. */
.dock-head {
  display: none;
}

.dock-group-label {
  display: none;
}

.dock-toggle-btn {
  display: none;
}

@media (min-width: 960px) {
  .dock-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
  }
  .dock-brand {
    flex-shrink: 0;
  }
  .dock-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 44px;
    min-height: 44px;
    padding: 4px 8px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.04);
    color: var(--ink-light-muted);
    font-size: 0.72rem;
    font-weight: 600;
  }
  .dock-toggle-btn:hover {
    color: var(--scada-emerald);
    border-color: var(--scada-emerald);
  }
  .dock-toggle-btn svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    transition: transform 200ms var(--ease-out-quart);
  }
  .workspace-shell[data-dock-expanded="true"] .dock-head {
    flex-direction: row;
    justify-content: space-between;
    padding: 0 6px;
  }
  .workspace-shell[data-dock-expanded="true"] .dock-toggle-btn svg {
    transform: rotate(180deg);
  }
  .workspace-shell[data-dock-expanded="true"] .dock-group-label {
    display: block;
    width: 100%;
    padding: 6px 10px 2px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #94A3B8;
    text-transform: uppercase;
  }
  .workspace-shell[data-dock-expanded="true"] .dock-link {
    width: 100%;
    flex-direction: row;
    justify-content: flex-start;
    padding: 8px 12px;
    gap: 10px;
    font-size: 0.84rem;
  }
  .workspace-shell[data-dock-expanded="true"] .app-dock {
    align-items: stretch;
    padding: 14px 10px;
  }
  .workspace-shell[data-dock-expanded="true"] .dock-ext {
    width: 100%;
  }
}

.dock-link[data-active="true"] {
  box-shadow: inset 3px 0 0 var(--scada-emerald);
  font-weight: 700;
}

@media (max-width: 959px) {
  .dock-link-desktop {
    display: none;
  }
  .dock-link[data-active="true"] {
    box-shadow: inset 0 -3px 0 var(--scada-emerald);
  }
  .dock-link svg {
    width: 17px;
    height: 17px;
  }
  .dock-link {
    font-size: 0.63rem;
    padding: 4px 3px;
    min-width: 44px;
  }
}

/* Topbar utility buttons (Ctrl+K & Dual-Theme Toggle). */
.topbar-utils {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.util-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-white);
  color: var(--ink-primary);
  font-size: 0.82rem;
  font-weight: 600;
}

.util-btn:hover {
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
}

.util-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  vertical-align: -0.125em;
}

kbd {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
  color: var(--ink-muted);
}

/* Recruiter 7.4s quick-scan summary strip and T-shaped track switcher. */
.recruiter-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 14px;
}

.recruiter-chip {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  color: var(--ink-primary);
}

.track-lens-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  padding: 6px;
  border-radius: 12px;
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
}

.track-lens-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-muted);
  padding: 0 6px;
}

.track-btn {
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-primary);
  font-size: 0.8rem;
  font-weight: 600;
}

.track-btn:hover {
  background: var(--bg-white);
  border-color: var(--border-subtle);
}

.track-btn[aria-pressed="true"] {
  background: var(--bg-white);
  border-color: var(--accent-emerald);
  color: var(--accent-emerald-dark);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.copy-inline-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 10px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
  color: var(--ink-primary);
  font-size: 0.76rem;
  font-weight: 600;
}

.copy-inline-btn:hover {
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
}

.btn-micro {
  min-height: 44px;
  padding: 7px 11px;
  font-size: 0.79rem;
}

/* Topology head pause button & five-second rule motion stop (R-39). */
.topo-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.flow-toggle-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #0F2D27;
  color: #F8FAFC;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
}

.flow-toggle-btn:hover, .flow-toggle-btn[aria-pressed="true"] {
  border-color: var(--scada-amber);
  color: var(--scada-amber);
}

.motion-paused .topo-flow-line,
.motion-paused [data-live-anim] {
  animation-play-state: paused !important;
}

/* Workbench export/share toolbar & ISA-18.2 alarm indicator (<= 1.6 Hz WCAG 2.3.1 safe). */
.sim-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-console);
}

.sim-toolbar-note {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-light-muted);
}

.sim-toolbar-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.alarm-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #0B1520;
  border: 1px solid var(--border-console);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-light);
}

.alarm-badge-unack {
  animation: isa18Blink 0.75s steps(2, start) infinite;
}

@keyframes isa18Blink {
  0% { opacity: 1; }
  50% { opacity: 0.45; }
  100% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .alarm-badge-unack {
    animation: none !important;
    outline: 2px double var(--scada-crimson);
    outline-offset: 1px;
  }
}

.sbo-armed {
  background: #991B1B !important;
  border-color: #FCA5A5 !important;
  color: #FFFFFF !important;
}

/* Live GitHub repository telemetry panel (R-27 + Sparkplug B stale quality states). */
.telemetry-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.telemetry-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.77rem;
  font-weight: 700;
  border: 1px solid var(--border-subtle);
  background: var(--tint-emerald);
  color: var(--accent-emerald-dark);
}

.telemetry-status-pill[data-state="stale"],
.telemetry-status-pill[data-state="error"] {
  background: repeating-linear-gradient(
    -45deg,
    var(--tint-amber),
    var(--tint-amber) 6px,
    rgba(180, 83, 9, 0.08) 6px,
    rgba(180, 83, 9, 0.08) 12px
  );
  color: var(--accent-amber-dark);
  border-color: var(--accent-amber);
}

.telemetry-status-pill[data-state="loading"] {
  background: var(--tint-blue);
  color: var(--accent-cobalt-dark);
  border-color: var(--accent-cobalt);
}

.ci-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-weight: 700;
}

.ci-chip-pass {
  background: var(--tint-emerald);
  color: var(--accent-emerald-dark);
}

.ci-chip-none {
  background: var(--bg-canvas);
  color: var(--ink-muted);
  border: 1px dashed var(--border-strong);
}

.empty-state-box {
  padding: 28px 20px;
  border-radius: var(--r-card);
  border: 1px dashed var(--border-strong);
  background: var(--bg-white);
  text-align: center;
  color: var(--ink-muted);
}

.empty-state-box p {
  margin: 0 auto 12px;
}

/* Single-shot calm scroll reveal (progressive; visible by default without JS). */
@media (prefers-reduced-motion: no-preference) {
  .reveal-ready {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 280ms var(--ease-out-quart), transform 280ms var(--ease-out-quart);
  }
  .reveal-ready.is-visible {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Native top-layer <dialog> for Lightbox and Ctrl+K Command Palette (@starting-style). */
dialog.lightbox-dialog,
dialog.cmd-dialog {
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 0;
  background: var(--bg-white);
  color: var(--ink-primary);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.42);
  max-width: min(980px, calc(100vw - 24px));
  width: 100%;
  opacity: 1;
  transform: scale(1) translateY(0);
  transition: opacity 160ms var(--ease-out-quart), transform 160ms var(--ease-out-quart), overlay 160ms allow-discrete, display 160ms allow-discrete;
}

dialog.cmd-dialog {
  max-width: min(600px, calc(100vw - 24px));
  margin-top: min(12vh, 96px);
  transition-duration: 90ms;
}

@starting-style {
  dialog.lightbox-dialog[open],
  dialog.cmd-dialog[open] {
    opacity: 0;
    transform: scale(0.96) translateY(6px);
  }
}

dialog.lightbox-dialog::backdrop,
dialog.cmd-dialog::backdrop {
  background: rgba(6, 20, 18, 0.78);
}

.lightbox-inner {
  padding: 16px;
}

.lightbox-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.lightbox-img {
  max-height: 76dvh;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
  border-radius: 8px;
  background: #FFFFFF;
}

.cmd-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.cmd-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink-primary);
  font-size: 1rem;
  padding: 4px 0;
}

.cmd-input:focus-visible {
  outline: none;
}

.cmd-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  max-height: min(56dvh, 380px);
  overflow-y: auto;
  display: grid;
  gap: 4px;
}

.cmd-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--ink-primary);
  font-size: 0.88rem;
  font-weight: 600;
}

.cmd-option[aria-selected="true"],
.cmd-option:hover {
  background: var(--tint-emerald);
  border-color: var(--accent-emerald);
  color: var(--accent-emerald-dark);
}

.cmd-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-muted);
}

.cmd-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.74rem;
  color: var(--ink-muted);
}

.cmd-empty {
  padding: 20px 14px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.88rem;
  margin: 0;
}

/* Polite live toast notification. */
.toast-region {
  position: fixed;
  right: 16px;
  bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  z-index: 700;
  max-width: min(360px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--bg-dock);
  color: #F8FAFC;
  border: 1px solid var(--scada-emerald);
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 160ms var(--ease-out-quart), transform 160ms var(--ease-out-quart);
}

.toast-region.toast-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (min-width: 960px) {
  .toast-region {
    bottom: 20px;
  }
}

.dossier-subcard-highlight {
  border-top: 3px solid var(--scada-emerald);
}

/* Industrial Architecture: Purdue L0-L3, MADR ADR Modal, Sparkplug B Stale Overlay, Popover Glossary & High Contrast. */
.purdue-panel {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-white);
  box-shadow: var(--shadow-card), var(--rim-light);
}

.purdue-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.purdue-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.purdue-btn {
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
  color: var(--ink-primary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  transition: background var(--dur-hover) var(--ease-out-quart), border-color var(--dur-hover) var(--ease-out-quart);
}

.purdue-btn[aria-selected="true"] {
  background: var(--bg-dock);
  color: #FFFFFF;
  border-color: var(--accent-emerald);
}

.purdue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.purdue-layer {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
  transition: border-color var(--dur-hover) var(--ease-out-quart), background var(--dur-hover) var(--ease-out-quart);
}

.purdue-layer[data-active="true"] {
  border-color: var(--accent-emerald);
  background: var(--tint-emerald);
}

.purdue-layer h3 {
  margin: 0 0 4px;
  font-size: 0.86rem;
  font-family: var(--font-mono);
  color: var(--ink-primary);
}

.purdue-layer p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-muted);
}

dialog.adr-dialog {
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 0;
  background: var(--bg-white);
  color: var(--ink-primary);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.42);
  max-width: min(820px, calc(100vw - 24px));
  width: 100%;
  opacity: 1;
  transform: scale(1) translateY(0);
  transition: opacity 150ms var(--ease-out-quart), transform 150ms var(--ease-out-quart), overlay 150ms allow-discrete, display 150ms allow-discrete;
}

@starting-style {
  dialog.adr-dialog[open] {
    opacity: 0;
    transform: scale(0.96) translateY(6px);
  }
}

dialog.adr-dialog::backdrop {
  background: rgba(6, 20, 18, 0.78);
}

.adr-list {
  display: grid;
  gap: 10px;
  max-height: min(68dvh, 520px);
  overflow-y: auto;
  padding-right: 4px;
}

.adr-item {
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--bg-canvas);
}

.adr-item-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.adr-item h3 {
  margin: 0 0 6px;
  font-size: 0.96rem;
  font-family: var(--font-serif);
}

.adr-item p {
  margin: 0 0 4px;
  font-size: 0.84rem;
  color: var(--ink-muted);
}

.quality-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid var(--scada-emerald);
  color: var(--scada-emerald);
  background: rgba(16, 185, 129, 0.12);
}

.quality-badge[data-quality="bad"] {
  border-style: dashed;
  border-color: var(--scada-amber);
  color: var(--scada-amber);
  background: rgba(251, 191, 36, 0.14);
}

.sim-stale-mode .kv-val,
.sim-stale-mode .svg-instrument-box {
  outline: 2px dashed var(--scada-amber);
  outline-offset: 2px;
}

.waveform-box {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #071815;
  border: 1px solid var(--border-console);
}

.glossary-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
  color: var(--ink-primary);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
}

[popover].glossary-popover {
  max-width: min(440px, calc(100vw - 24px));
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--bg-white);
  color: var(--ink-primary);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 140ms var(--ease-out-quart), transform 140ms var(--ease-out-quart);
}

@starting-style {
  [popover].glossary-popover:popover-open {
    opacity: 0;
    transform: translateY(6px);
  }
}

[popover].glossary-popover::backdrop {
  background: rgba(6, 20, 18, 0.5);
}

@supports (grid-template-rows: subgrid) {
  .work-card {
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    align-content: start;
  }
}

@media (prefers-contrast: more) {
  .workspace-topbar {
    background: var(--bg-white) !important;
    backdrop-filter: none !important;
    border-bottom: 2px solid var(--ink-primary);
  }
  .dash-card, .work-card, .kpi-card, .purdue-panel, .purdue-layer, .timeline-card {
    border: 2px solid var(--ink-primary) !important;
    box-shadow: none !important;
  }
  :root {
    --ink-muted: #0F172A;
    --border-subtle: #334155;
  }
  [data-theme="dark"] {
    --ink-muted: #F8FAFC;
    --border-subtle: #94A3B8;
  }
}

@media (forced-colors: active) {
  .workspace-topbar, .dash-card, .work-card, .kpi-card, .purdue-panel, .console-dark, .app-dock, .collections-rail {
    background: Canvas !important;
    color: CanvasText !important;
    border: 1px solid CanvasText !important;
  }
  a { color: LinkText !important; }
  button, .btn, .pill-btn, .track-btn, .util-btn {
    background: ButtonFace !important;
    color: ButtonText !important;
    border: 1px solid ButtonText !important;
  }
  [aria-pressed="true"], [aria-selected="true"] {
    background: Highlight !important;
    color: HighlightText !important;
  }
}

.noscript-banner {
  margin: 12px 0;
  padding: 14px 16px;
  border-radius: 12px;
  border: 2px solid var(--accent-amber);
  background: var(--tint-amber);
  color: var(--ink-primary);
}

/* Executive print stylesheet (Ctrl+P -> crisp A4 dossier). */
@media print {
  .app-dock, .collections-rail, .workspace-topbar, .scroll-progress, .toast-region,
  .sim-toolbar, .track-lens-bar, .copy-inline-btn, .flow-toggle-btn, .purdue-tabs, dialog, [popover] {
    display: none !important;
  }
  body, html, .dash-card, .work-card, .console-dark {
    background: #FFFFFF !important;
    color: #0F172A !important;
    box-shadow: none !important;
  }
  .workspace-shell {
    display: block !important;
    padding: 0 !important;
    max-width: 100% !important;
  }
  .work-card, .dash-card, .timeline-card, .kpi-card {
    break-inside: avoid;
    border: 1px solid #CBD5E1 !important;
  }
  .console-dark *, .status-readout-dark * {
    color: #0F172A !important;
  }
}

/* Dual Visitor Mode (Engineer/SCADA vs HR 10-Sec Brief) & About/STAR Section. */
.visitor-mode-bar {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
  padding: 4px 6px;
  border-radius: 12px;
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
}

.visitor-mode-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-muted);
  padding: 0 6px;
}

.visitor-mode-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.visitor-mode-btn[aria-pressed="true"] {
  background: #047857;
  color: #FFFFFF;
  border-color: #047857;
}

[data-theme="dark"] .visitor-mode-btn[aria-pressed="true"] {
  background: #34D399;
  color: #061714;
  border-color: #34D399;
}

.hr-brief-panel {
  margin: 0 0 16px;
  padding: 16px;
  border-radius: 14px;
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
}

.hr-brief-lead {
  margin: 0 0 14px;
  font-size: 0.98rem;
  color: var(--ink-primary);
  line-height: 1.55;
}

.hr-outcome-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.hr-tile {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-white);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

[data-theme="dark"] .hr-tile {
  background: var(--bg-surface-alt);
}

.hr-tile strong {
  font-family: var(--font-mono);
  font-size: 1.08rem;
  color: var(--accent-emerald-dark);
}

.hr-tile span {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.hr-track-summary {
  margin: 0 0 14px;
  padding-left: 18px;
  color: var(--ink-primary);
  font-size: 0.88rem;
  display: grid;
  gap: 5px;
}

html[data-visitor-mode="hr"] .eng-hero-details,
html[data-visitor-mode="hr"] .eng-hero-console {
  display: none;
}

html[data-visitor-mode="hr"] .hero-grid {
  grid-template-columns: 1fr;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

@media (min-width: 860px) {
  .about-grid {
    grid-template-columns: 290px minmax(0, 1fr);
  }
}

.iec-crest-card {
  background: var(--bg-dock);
  color: var(--ink-light);
  border-radius: 14px;
  padding: 16px;
  border: 1px solid rgba(52, 211, 153, 0.28);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.iec-crest-svg {
  width: 100%;
  height: auto;
  display: block;
}

.iec-crest-meta p {
  margin: 0 0 4px;
  font-size: 0.84rem;
  color: var(--ink-light-muted);
}

.iec-crest-meta p:first-child {
  color: var(--ink-light);
  font-size: 0.94rem;
}

.iec-crest-card .grade-tag {
  background: #13262B;
  border-color: #2B4954;
  color: #F1F5F9;
}

[data-theme="dark"] .hr-brief-panel {
  background: var(--bg-console);
}

[data-theme="dark"] .hr-tile strong {
  color: #6EE7B7;
}

[data-theme="dark"] .star-card {
  background: var(--bg-console);
}

.prose-lead {
  margin: 0 0 14px;
  font-size: 0.96rem;
  color: var(--ink-primary);
}

.star-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 720px) {
  .star-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

.star-card {
  padding: 14px;
  border-radius: 12px;
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
}

.star-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-emerald-dark);
  margin-bottom: 4px;
}

.star-card h3 {
  margin: 0 0 6px;
  font-size: 0.96rem;
  font-family: var(--font-serif);
}

.star-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-muted);
}
