/* ==========================================================================
   Drill Sergeant — Free Network Troubleshooting Lab Stylesheet
   "Troubleshoot: I can't get online" — Operations Blueprint + BRAND.md
   Local brand fonts base: /assets/fonts/ (becomes /assets/fonts/ on website)
   ========================================================================== */

@font-face {
  font-family: 'Saira Stencil One';
  src: url('/assets/fonts/saira-stencil-one-400.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Public Sans';
  src: url('/assets/fonts/public-sans-400.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Public Sans';
  src: url('/assets/fonts/public-sans-600.woff') format('woff');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Public Sans';
  src: url('/assets/fonts/public-sans-700.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Public Sans';
  src: url('/assets/fonts/public-sans-700.woff') format('woff');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/assets/fonts/ibm-plex-mono-500.woff') format('woff');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/assets/fonts/ibm-plex-mono-500.woff') format('woff');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Single CSS asset path tokens (website equivalents: /assets/brand/ and /assets/fonts/) */
  --brand-asset-base: '/assets/brand/';
  --font-asset-base: '/assets/fonts/';

  --font-display: 'Saira Stencil One', 'Arial Black', 'Impact', sans-serif;
  --font-body: 'Public Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', 'SFMono-Regular', Consolas, monospace;

  /* Command chrome & headers — dark in BOTH light and dark schemes per BRAND.md */
  --command: #1F2717;
  --command-raised: #2A3420;
  --command-line: #3B4730;
  --command-text: #EEF1E6;
  --command-muted: #B7C1A6;

  /* Signal */
  --signal: #F08C3C;
  --signal-hover: #FFA759;
  --on-signal: #161A11;

  /* Light theme working surfaces (BRAND.md) */
  --bg: #ECEEE5;
  --surface: #F7F8F3;
  --surface-raised: #FFFFFF;
  --line: #CBD2BE;
  --text: #1A2013;
  --text-muted: #4C5840;
  --accent: #4D662B;
  --action: #A44D0E;
  --action-hover: #8B400B;
  --on-action: #FFFFFF;

  --ok-bg: #E5EEDB;
  --ok-border: #4D662B;
  --ok-text: #273812;
  --err-bg: #FCE9E2;
  --err-border: #A4301E;
  --err-text: #6D1D11;
  --warn-bg: #F9EFD8;
  --warn-border: #9B5C0F;
  --warn-text: #5D3607;

  --focus-ring: var(--action);

  --radius: 8px;
  --radius-sm: 5px;
}

[data-theme='dark'] {
  --bg: #12150E;
  --surface: #1A1F14;
  --surface-raised: #232B1B;
  --line: #36422A;
  --text: #EEF1E6;
  --text-muted: #B7C1A6;
  --accent: #9DB86A;
  --action: #F08C3C;
  --action-hover: #FFA759;
  --on-action: #161A11;

  --ok-bg: #202C16;
  --ok-border: #9DB86A;
  --ok-text: #D7E8B6;
  --err-bg: #351B16;
  --err-border: #E57A66;
  --err-text: #FFD5CC;
  --warn-bg: #322613;
  --warn-border: #F08C3C;
  --warn-text: #FCDCB8;

  --focus-ring: var(--signal);
}

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

[hidden] {
  display: none !important;
}

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  overflow-x: hidden;
}

code {
  font-family: var(--font-mono);
  font-size: 0.87em;
  background: rgba(77, 102, 43, 0.14);
  padding: 0.08em 0.3em;
  border-radius: 4px;
  overflow-wrap: anywhere;
}

[data-theme='dark'] code {
  background: rgba(157, 184, 106, 0.16);
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--signal);
  color: var(--on-signal);
  font-weight: 700;
  padding: 0.7rem 1.1rem;
  text-decoration: none;
}

.skip-link:focus {
  left: 0.65rem;
  top: 0.65rem;
  border-radius: var(--radius-sm);
}

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.skip-link,
.command-header,
.workorder-bar,
.stage-bar,
.blueprint-scroll-cue,
.svg-wrap,
.ladder-panel,
.terminal-shell,
.lab-footer,
.spotlight-callout {
  --focus-ring: var(--signal);
}

.svg-wrap:focus-visible,
.terminal-output:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: -3px;
}

.terminal-input:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: -2px;
}

.eyebrow {
  margin: 0 0 0.2rem;
  font-family: var(--font-mono);
  font-size: 0.69rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow-signal {
  color: var(--action);
}

.command-header .eyebrow-signal,
.workorder-bar .eyebrow-signal,
.terminal-bar .eyebrow-signal,
.ladder-panel .eyebrow-signal {
  color: var(--signal);
}

.muted {
  margin: 0.25rem 0;
  font-size: 0.84rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Compact Command Header & 6-Step CompTIA Method Strip
   -------------------------------------------------------------------------- */

.command-header {
  background: var(--command);
  color: var(--command-text);
  border-bottom: 2px solid var(--command-line);
}

.header-bar {
  max-width: 1760px;
  margin: 0 auto;
  padding: 0.44rem 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-bottom: 1px solid var(--command-line);
}

.brand-lockup {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.brand-mark {
  height: 28px;
  width: auto;
  max-width: 100%;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}

.brand-wordmark {
  font-family: var(--font-display);
  font-size: 1.14rem;
  letter-spacing: 0.06em;
  color: var(--command-text);
  line-height: 1;
}

.brand-divider {
  font-family: var(--font-mono);
  color: var(--command-muted);
}

.header-title {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--command-text);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.step-strip {
  max-width: 1760px;
  margin: 0 auto;
  padding: 0.4rem 0.9rem;
}

.step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.34rem;
}

.step-pill {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.34rem;
  padding: 0.3rem 0.48rem;
  min-height: 31px;
  border: 1px solid var(--command-line);
  border-radius: var(--radius-sm);
  background: var(--command-raised);
  color: var(--command-text);
  font-family: var(--font-body);
  font-size: 0.77rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.step-pill:hover {
  border-color: var(--signal);
}

.step-pill.is-active {
  border-color: var(--signal);
  box-shadow: inset 0 0 0 1px var(--signal);
}

.step-pill.is-done {
  border-color: #9DB86A;
}

.step-num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--command);
  color: var(--command-muted);
  flex-shrink: 0;
}

.step-pill.is-active .step-num {
  background: var(--signal);
  color: var(--on-signal);
}

.step-pill.is-done .step-num {
  background: #9DB86A;
  color: #161A11;
}

.step-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workorder-bar {
  background: var(--command-raised);
  color: var(--command-text);
  border-bottom: 1px solid var(--command-line);
}

.workorder-inner {
  max-width: 1760px;
  margin: 0 auto;
  padding: 0.45rem 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.9rem;
  font-size: 0.8rem;
}

.workorder-inner .eyebrow { margin: 0; }
.wo-chip code { background: rgba(157, 184, 106, 0.18); color: #EEF1E6; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn-cmd,
.btn-primary,
.btn-secondary,
.btn-signal,
.seg-btn,
.chip-btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.81rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 33px;
  padding: 0.34rem 0.68rem;
  border: 1px solid transparent;
}

.btn-sm { min-height: 30px; padding: 0.25rem 0.56rem; font-size: 0.77rem; }
.full-btn { width: 100%; margin-top: 0.35rem; }

.btn-cmd { background: var(--command-raised); color: var(--command-text); border-color: var(--command-line); }
.btn-cmd:hover { border-color: var(--signal); }

.btn-primary { background: var(--action); color: var(--on-action); }
.btn-primary:hover { background: var(--action-hover); }

.btn-secondary { background: var(--surface-raised); color: var(--text); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--accent); }

.btn-signal { background: var(--signal); color: var(--on-signal); }
.btn-signal:hover { background: var(--signal-hover); }

.chip-btn {
  min-height: 26px;
  padding: 0.16rem 0.46rem;
  font-family: var(--font-mono);
  font-size: 0.71rem;
  background: var(--surface-raised);
  color: var(--text);
  border-color: var(--line);
}

.chip-btn:hover { border-color: var(--action); }

.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: visible;
}

.seg-btn {
  border: 0;
  border-radius: 0;
  background: var(--surface-raised);
  color: var(--text);
  min-height: 29px;
  padding: 0.22rem 0.54rem;
  font-size: 0.75rem;
}

.seg-btn:first-child {
  border-top-left-radius: calc(var(--radius-sm) - 1px);
  border-bottom-left-radius: calc(var(--radius-sm) - 1px);
}

.seg-btn:last-child {
  border-top-right-radius: calc(var(--radius-sm) - 1px);
  border-bottom-right-radius: calc(var(--radius-sm) - 1px);
}

.seg-btn:focus-visible {
  position: relative;
  z-index: 2;
}

.seg-btn + .seg-btn {
  border-left: 1px solid var(--line);
}

.seg-btn.is-active { background: var(--command); color: var(--command-text); }

/* --------------------------------------------------------------------------
   Main Grid (390px single-col -> 1280/1440px first-screen desktop fit)
   -------------------------------------------------------------------------- */

.sim-grid {
  max-width: 1760px;
  margin: 0 auto;
  padding: 0.6rem 0.85rem 0.85rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
}

.left-rail,
.main-column,
.panel-card,
.canvas-stage,
.blueprint-frame,
.canvas-and-ladder,
.svg-wrap,
.ladder-panel,
.sim-panel,
.event-table-wrap,
.inspector-pane,
.device-drawer,
.terminal-shell {
  min-width: 0;
}

.left-rail {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  order: 2;
}

.main-column {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  order: 1;
}

@media (min-width: 1024px) {
  .sim-grid {
    grid-template-columns: 304px minmax(0, 1fr);
    padding: 0.6rem 0.85rem 0.85rem;
  }
  .left-rail { order: 1; }
  .main-column { order: 2; }
}

@media (min-width: 1400px) {
  .sim-grid {
    grid-template-columns: 312px minmax(0, 1fr);
  }
}

@media (min-width: 1680px) {
  .sim-grid {
    grid-template-columns: 320px minmax(0, 1fr);
  }
}

.panel-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.68rem 0.78rem;
}

.panel-title {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Left Rail: Helpdesk Ticket & CompTIA Method Tracker
   -------------------------------------------------------------------------- */

.ticket-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.4rem;
}

.status-pill {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  padding: 0.14rem 0.45rem;
  border-radius: 999px;
  letter-spacing: 0.08em;
}

.status-pill.is-open { background: var(--err-bg); color: var(--err-text); border: 1px solid var(--err-border); }
.status-pill.is-resolved { background: var(--ok-bg); color: var(--ok-text); border: 1px solid var(--ok-border); }

.ticket-quote {
  margin: 0.45rem 0 0.55rem;
  padding: 0.45rem 0.58rem;
  background: var(--surface-raised);
  border-left: 3px solid var(--action);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.84rem;
  font-weight: 600;
}

.ticket-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.hint-box {
  margin-top: 0.5rem;
  padding: 0.45rem 0.58rem;
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn-text);
  font-size: 0.79rem;
}

.step-goal {
  margin: 0.35rem 0 0.32rem;
  font-size: 0.81rem;
  color: var(--text-muted);
}

.method-note {
  margin: 0 0 0.48rem;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.method-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.note-textarea {
  width: 100%;
  min-width: 0;
  padding: 0.42rem 0.52rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.8rem;
  resize: vertical;
}

.method-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
}

.method-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  max-height: 170px;
  overflow-y: auto;
}

.method-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  padding: 0.3rem 0.45rem;
  font-size: 0.76rem;
}

.method-item.is-done {
  border-color: var(--ok-border);
  background: var(--ok-bg);
  color: var(--ok-text);
}

.method-item.is-active {
  border-color: var(--action);
}

.method-item-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
}

.method-item-note {
  margin: 0.16rem 0 0 1.05rem;
  font-size: 0.74rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.method-item.is-done .method-item-note {
  color: var(--ok-text);
}

.closure-wrap {
  margin-top: 0.6rem;
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  color: var(--ok-text);
  font-size: 0.79rem;
}

.closure-wrap h3 { margin: 0 0 0.3rem; font-size: 0.88rem; }
.closure-wrap ul { margin: 0.35rem 0; padding-left: 1.05rem; }
.closure-wrap li { margin: 0.18rem 0; }

.fault-replay-controls {
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--ok-border);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* --------------------------------------------------------------------------
   Canvas Stage + Bottom-to-Top Connectivity Ladder
   -------------------------------------------------------------------------- */

.canvas-stage {
  background: var(--command);
  border: 1px solid var(--command-line);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--command-text);
}

.stage-bar {
  padding: 0.46rem 0.75rem;
  background: var(--command-raised);
  border-bottom: 1px solid var(--command-line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.stage-bar-left { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.stage-title { margin: 0; font-size: 0.88rem; font-weight: 700; color: var(--command-text); }
.stage-status { font-family: var(--font-mono); font-size: 0.72rem; color: var(--signal); }

.led-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.69rem;
  color: var(--command-muted);
}

.legend-item { display: inline-flex; align-items: center; gap: 0.3rem; }
.led-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.led-green { background: #9DB86A; }
.led-amber { background: #F0B43C; }
.led-red   { background: #E5534B; }

.canvas-toast {
  padding: 0.42rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-bottom: 1px solid var(--command-line);
}

.canvas-toast.is-ok    { background: #213117; color: #D7E8B6; }
.canvas-toast.is-error { background: #3D1A16; color: #FFD5CC; }
.canvas-toast.is-info  { background: #2D2615; color: #FCDCB8; }

.blueprint-frame {
  position: relative;
  display: flex;
  flex-direction: column;
}

.canvas-and-ladder {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  background: #12150E;
}

@media (min-width: 820px) {
  .canvas-and-ladder {
    grid-template-columns: minmax(0, 1fr) 172px;
  }
}

@media (min-width: 1680px) {
  .canvas-and-ladder {
    grid-template-columns: minmax(0, 1fr) 188px;
  }
}

.svg-wrap {
  position: relative;
  background: #12150E;
  display: flex;
  align-items: center;
}

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

@media (min-width: 1024px) {
  .blueprint-svg {
    max-height: clamp(420px, calc(100vh - 255px), 760px);
  }
}

/* Connectivity Ladder (bottom-to-top via column-reverse!) */
.ladder-panel {
  background: #171D12;
  border-top: 1px solid var(--command-line);
  padding: 0.55rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

@media (min-width: 820px) {
  .ladder-panel {
    border-top: 0;
    border-left: 1px solid var(--command-line);
  }
}

.ladder-title {
  margin: 0;
  font-size: 0.84rem;
  color: var(--command-text);
}

.ladder-sub {
  margin: 0.1rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--command-muted);
}

.ladder-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.32rem;
}

.ladder-rung {
  border: 1px solid var(--command-line);
  border-radius: var(--radius-sm);
  background: #1F2717;
  padding: 0.34rem 0.44rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.ladder-rung.is-pass {
  border-color: #9DB86A;
  background: #213017;
}

.ladder-rung.is-fail {
  border-color: #E5534B;
  background: #3B1814;
}

.rung-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
}

.rung-name {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--command-text);
}

.rung-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.04rem 0.32rem;
  border-radius: 999px;
  background: #2A3420;
  color: var(--command-muted);
}

.ladder-rung.is-pass .rung-badge { background: #9DB86A; color: #161A11; }
.ladder-rung.is-fail .rung-badge { background: #E5534B; color: #FFFFFF; }

.rung-detail {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--command-muted);
  overflow-wrap: anywhere;
}

.ladder-rung.is-pass .rung-detail { color: #D7E8B6; }
.ladder-rung.is-fail .rung-detail { color: #FFD5CC; }

.ladder-note {
  margin: 0.15rem 0 0;
  min-height: 1.15em;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--signal);
  overflow-wrap: anywhere;
}

/* SVG Element Styles (renders >= 12px at 1366px wide) */
.bp-coord {
  fill: #7B8E69;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.08em;
}

.cable-wired {
  fill: none;
  stroke: #9DB86A;
  stroke-width: 3.6;
  stroke-linecap: round;
}

.cable-wired.is-down {
  stroke: #7F8974;
  stroke-dasharray: 5 5;
}

.cable-wan {
  fill: none;
  stroke: #7D9560;
  stroke-width: 2.8;
  stroke-linecap: round;
}

.cable-ghost {
  fill: none;
  stroke: #E57A66;
  stroke-width: 2.2;
  stroke-dasharray: 6 5;
  stroke-linecap: round;
  opacity: 0.85;
}

.cable-ghost.is-muted {
  opacity: 0.16;
  stroke: #5A694A;
}

.ghost-node {
  transition: opacity 160ms ease;
}

.ghost-node.is-muted {
  opacity: 0.24;
}

.ghost-card {
  fill: #241816;
  stroke: #E57A66;
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
}

.ghost-node.is-muted .ghost-card {
  fill: #171D12;
  stroke: #4A5A3A;
}

.ghost-title {
  fill: #FFD5CC;
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 700;
}

.ghost-sub {
  fill: #E5A69A;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
}

.ghost-node.is-muted .ghost-title,
.ghost-node.is-muted .ghost-sub {
  fill: #7F8F6F;
}

.port-label {
  fill: #C7D1B8;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
}

.led-halo { pointer-events: none; opacity: 0.32; }
.led-halo.is-up { fill: #9DB86A; }
.led-halo.is-down { fill: #E5534B; opacity: 0.25; }
.link-led { stroke: #12150E; stroke-width: 1.4; }
.link-led.is-up { fill: #9DB86A; }
.link-led.is-down { fill: #E5534B; }

.device-node { cursor: pointer; outline: none; }
.device-card { stroke: #4A5A3A; stroke-width: 1.6; }
.device-node:hover .device-card,
.device-node.is-selected .device-card { stroke: #F08C3C; stroke-width: 2.4; }
.device-node:focus-visible .device-card { stroke: var(--focus-ring); stroke-width: 3; }

.device-name { fill: #EEF1E6; font-family: var(--font-body); font-size: 14px; font-weight: 700; }
.chassis-micro { fill: #B7C1A6; font-family: var(--font-mono); font-size: 12.5px; }

.ip-pill { fill: #1D2615; stroke: #4A5A3A; stroke-width: 1.2; }
.ip-pill.is-signal { stroke: #F08C3C; }
.ip-pill.is-warn { stroke: #E5534B; fill: #351814; }
.ip-pill-text { fill: #E8ECDD; font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; }

.hop-glow { fill: none; stroke: transparent; stroke-width: 3.5; pointer-events: none; }
.hop-glow.is-orange { stroke: #F08C3C; fill: rgba(240, 140, 60, 0.13); }
.hop-glow.is-olive  { stroke: #9DB86A; fill: rgba(157, 184, 106, 0.13); }
.hop-glow.is-red    { stroke: #E5534B; fill: rgba(229, 83, 75, 0.16); }

.packet-token { pointer-events: none; }
.packet-token.is-orange .pkt-bg { fill: #F08C3C; stroke: #161A11; stroke-width: 1.4; }
.packet-token.is-orange .pkt-flap { stroke: #161A11; }
.packet-token.is-orange .pkt-pill-bg { fill: #251B10; stroke: #F08C3C; stroke-width: 1.2; }

.packet-token.is-olive .pkt-bg { fill: #9DB86A; stroke: #161A11; stroke-width: 1.4; }
.packet-token.is-olive .pkt-flap { stroke: #161A11; }
.packet-token.is-olive .pkt-pill-bg { fill: #1A2413; stroke: #9DB86A; stroke-width: 1.2; }

.packet-token.is-red .pkt-bg { fill: #E5534B; stroke: #161A11; stroke-width: 1.4; }
.packet-token.is-red .pkt-flap { stroke: #FFFFFF; }
.packet-token.is-red .pkt-pill-bg { fill: #3C1614; stroke: #E5534B; stroke-width: 1.2; }

.pkt-pill-text { fill: #EEF1E6; font-family: var(--font-mono); font-size: 12.5px; font-weight: 700; }
.fault-pill-text { fill: #FFD9D5; font-family: var(--font-mono); font-size: 12.5px; font-weight: 700; }

/* --------------------------------------------------------------------------
   Device Drawer (Docked right on desktop >=960px; Fixed Bottom Sheet on phones)
   -------------------------------------------------------------------------- */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 8, 0.58);
  z-index: 50;
}

.device-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  max-height: 82vh;
  overflow-y: auto;
  background: var(--surface);
  color: var(--text);
  border-top: 3px solid var(--signal);
  border-radius: 14px 14px 0 0;
  padding: 0.65rem 0.85rem 1rem;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.45);
}

.sheet-handle {
  width: 42px;
  height: 4px;
  border-radius: 99px;
  background: var(--line);
  margin: 0 auto 0.55rem;
}

@media (min-width: 1024px) {
  .drawer-backdrop { display: none !important; }
  .sheet-handle { display: none; }
  .device-drawer {
    position: static;
    width: 100%;
    max-height: none;
    overflow-y: visible;
    border-top: 2px solid var(--signal);
    border-left: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0.72rem 0.9rem 0.85rem;
  }
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.55rem;
}

.drawer-head-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.drawer-title { margin: 0; font-size: 0.96rem; }

.portal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.55rem;
}

.tab-btn {
  padding: 0.26rem 0.46rem;
  min-height: 29px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

.tab-btn.is-active {
  background: var(--command);
  color: var(--command-text);
  border-color: var(--signal);
}

/* Windows Command Prompt Terminal */
.terminal-shell {
  background: #141910;
  color: var(--command-text);
  border: 1px solid var(--command-line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.terminal-bar {
  background: var(--command);
  padding: 0.34rem 0.55rem;
  border-bottom: 1px solid var(--command-line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem;
}

.terminal-bar .eyebrow { margin: 0; }
.terminal-meta { font-family: var(--font-mono); font-size: 0.67rem; color: var(--command-muted); }

.terminal-output {
  min-width: 0;
  min-height: 220px;
  height: 220px;
  width: 100%;
  max-width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0.65rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.44;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (min-width: 1024px) {
  .terminal-output {
    font-size: 13.5px;
    min-height: 260px;
    height: 260px;
    overflow-x: hidden;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .device-drawer.is-expanded .terminal-output {
    height: 440px;
  }
}

.sim-collapsed-summary {
  margin: 0;
  padding: 0.45rem 0.78rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.term-line { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.term-line:empty::before { content: "\00a0"; }
.term-line.is-cmd { color: #F08C3C; font-weight: 600; }
.term-line.is-system { color: #9DB86A; white-space: pre-wrap; }
.term-line.is-hint { color: #FCDCB8; white-space: pre-wrap; margin-top: 0.2rem; }
.term-line.is-err { color: #FFD5CC; }

.term-aligned {
  position: relative;
  margin: 0;
  min-width: 0;
  max-width: 100%;
}

.term-aligned-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  white-space: pre;
  overflow-wrap: normal;
  scrollbar-width: thin;
  scrollbar-color: var(--signal) var(--command-raised);
}

.term-aligned-scroll .term-line {
  white-space: pre;
  overflow-wrap: normal;
}

.term-aligned-scroll:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: -3px;
}

.term-aligned.is-scrollable {
  margin: 0.28rem 0;
  border: 1px solid var(--command-line);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.24);
}

.term-aligned.is-scrollable .term-aligned-scroll {
  padding: 0.32rem 0.5rem 0.42rem;
}

.term-aligned.is-scrollable .term-aligned-scroll::-webkit-scrollbar {
  height: 6px;
}

.term-aligned.is-scrollable .term-aligned-scroll::-webkit-scrollbar-track {
  background: var(--command-raised);
  border-radius: 0 0 3px 3px;
}

.term-aligned.is-scrollable .term-aligned-scroll::-webkit-scrollbar-thumb {
  background: var(--signal);
  border-radius: 3px;
}

.term-aligned.is-scrollable.has-more-right::after,
.term-aligned.is-scrollable.has-more-left::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 6px;
  width: 22px;
  pointer-events: none;
}

.term-aligned.is-scrollable.has-more-right::after {
  right: 0;
  background: linear-gradient(to right, rgba(20, 25, 16, 0), rgba(20, 25, 16, 0.92));
  border-right: 3px solid var(--signal);
}

.term-aligned.is-scrollable.has-more-left::before {
  left: 0;
  background: linear-gradient(to left, rgba(20, 25, 16, 0), rgba(20, 25, 16, 0.92));
  border-left: 3px solid var(--signal);
}

.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.5rem;
  border-top: 1px solid var(--command-line);
  background: var(--command);
}

.terminal-prompt {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  color: var(--signal);
  white-space: nowrap;
}

.terminal-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--command-line);
  border-radius: 4px;
  background: #12150E;
  color: var(--command-text);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.28rem 0.42rem;
}

.quick-cmds {
  margin-top: 0.42rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
}

/* Physical Cable Bay & Adapter Cards */
.physical-bay {
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #171D12;
  color: var(--command-text);
  margin-bottom: 0.5rem;
}

.physical-caption {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: #EEF1E6;
}

.adapter-card {
  padding: 0.55rem 0.62rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  margin-bottom: 0.5rem;
}

.adapter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.adapter-row-divider {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}

.adapter-row .muted { margin: 0.1rem 0 0; font-size: 0.75rem; }

.field-wrap { display: flex; flex-direction: column; gap: 0.16rem; margin-bottom: 0.42rem; font-size: 0.78rem; font-weight: 600; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.42rem; }
.text-input, .select-sm {
  width: 100%;
  min-width: 0;
  padding: 0.34rem 0.48rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.8rem;
}
.mono-input { font-family: var(--font-mono); }

.radio-fieldset { border: 0; padding: 0; margin: 0 0 0.35rem; }
.fieldset-spaced { margin-top: 0.5rem; }
.radio-row { display: flex; align-items: center; gap: 0.4rem; margin: 0.2rem 0; font-size: 0.79rem; cursor: pointer; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.mini-kv {
  margin: 0 0 0.5rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.26rem 0.65rem;
  font-size: 0.79rem;
}
.mini-kv dt { color: var(--text-muted); }
.mini-kv dd { margin: 0; font-weight: 600; }

.feedback-box {
  margin-top: 0.48rem;
  padding: 0.46rem 0.56rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-size: 0.78rem;
}
.feedback-box p { margin: 0.15rem 0; }
.feedback-box.is-ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-text); }
.feedback-box.is-error { background: var(--err-bg); border-color: var(--err-border); color: var(--err-text); }
.feedback-box.is-warn,
.feedback-box.is-info { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }

/* --------------------------------------------------------------------------
   Docked Simulation Panel
   -------------------------------------------------------------------------- */

.sim-panel { padding: 0; overflow: hidden; }

.sim-bar {
  background: var(--surface-raised);
  border-bottom: 1px solid var(--line);
  padding: 0.44rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.sim-bar-left { display: flex; flex-wrap: wrap; align-items: center; gap: 0.48rem; }
.sim-bar-left .eyebrow { margin: 0; }
.sim-title { margin: 0; font-size: 0.89rem; }
.sim-pill { font-family: var(--font-mono); font-size: 0.67rem; font-weight: 700; padding: 0.12rem 0.45rem; border-radius: 999px; background: var(--command); color: var(--signal); }
.sim-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }

.sim-body-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) {
  .sim-body-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
}

.event-table-wrap {
  overflow-x: auto;
  max-height: 186px;
  overflow-y: auto;
  border-bottom: 1px solid var(--line);
}

@media (min-width: 960px) {
  .event-table-wrap { border-bottom: 0; border-right: 1px solid var(--line); }
}

.event-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.event-table th {
  text-align: left;
  padding: 0.38rem 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-raised);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
}

.event-row { border-bottom: 1px solid var(--line); cursor: pointer; }
.event-row:hover { background: rgba(157, 184, 106, 0.1); }
.event-row.is-active { background: var(--ok-bg); box-shadow: inset 3px 0 0 var(--action); }
.event-row td { padding: 0.36rem 0.55rem; }
.event-row-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; width: 100%; }
.event-time { font-family: var(--font-mono); white-space: nowrap; color: var(--text-muted); }

.type-tag { display: inline-block; font-family: var(--font-mono); font-size: 0.66rem; font-weight: 700; padding: 0.09rem 0.38rem; border-radius: 999px; }
.type-tag.is-ok { background: var(--ok-bg); color: var(--ok-text); border: 1px solid var(--ok-border); }
.type-tag.is-warn { background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-border); }
.type-tag.is-err { background: var(--err-bg); color: var(--err-text); border: 1px solid var(--err-border); }

.inspector-pane { padding: 0.55rem 0.7rem; max-height: 186px; overflow-y: auto; }
.inspector-title { margin: 0 0 0.4rem; font-size: 0.84rem; }

.pdu-layer {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  padding: 0.4rem 0.5rem;
  margin-bottom: 0.4rem;
}

.pdu-layer-title { margin: 0 0 0.24rem; font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.pdu-row { padding: 0.18rem 0; border-top: 1px solid var(--line); font-size: 0.75rem; }
.pdu-row:first-of-type { border-top: 0; padding-top: 0; }
.pdu-field { display: block; font-family: var(--font-mono); font-weight: 600; }
.pdu-plain { display: block; color: var(--text-muted); font-size: 0.72rem; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.lab-footer {
  background: var(--command);
  color: var(--command-muted);
  border-top: 2px solid var(--command-line);
  padding: 0.8rem 0.9rem;
  font-size: 0.8rem;
}

.footer-inner {
  max-width: 1760px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.1rem;
}

.footer-logo {
  height: 80px;
  width: auto;
  max-width: 100%;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}

.footer-copy {
  flex: 1 1 240px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.footer-brand { margin: 0; font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.08em; color: var(--command-text); }
.footer-follow { margin: 0; color: var(--command-text); text-wrap: pretty; }
.footer-follow a { color: var(--signal); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.footer-follow a:hover { color: var(--signal-hover); }
.footer-follow a:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; border-radius: 2px; }
.footer-legal { margin: 0; }

/* --------------------------------------------------------------------------
   "Show me" Guided Spotlight & Help Counter (CSP-safe CSSOM positioning)
   -------------------------------------------------------------------------- */

.help-usage {
  margin: 0.45rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.spot-shade {
  position: fixed;
  z-index: 75;
  background: rgba(10, 12, 8, 0.72);
}

.spotlight-ring {
  position: fixed;
  z-index: 80;
  pointer-events: none;
  border: 2.5px solid var(--signal);
  border-radius: 8px;
  box-shadow: 0 0 0 2px rgba(240, 140, 60, 0.38);
  animation: spot-pulse 1.5s ease-in-out infinite;
}

.spotlight-callout {
  position: fixed;
  z-index: 90;
  width: min(300px, calc(100vw - 1.5rem));
  max-width: calc(100vw - 1.25rem);
  background: var(--command);
  color: var(--command-text);
  border: 2px solid var(--signal);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.58);
}

.spotlight-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.spotlight-callout .eyebrow-signal {
  color: var(--signal);
  margin: 0;
}

.spotlight-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--command-muted);
}

.spotlight-text {
  margin: 0 0 0.65rem;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--command-text);
}

.spotlight-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
}

@keyframes spot-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(240, 140, 60, 0.42); }
  50% { box-shadow: 0 0 0 6px rgba(240, 140, 60, 0.16); }
}

.blueprint-scroll-cue {
  display: none;
}

.scroll-cue-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--command-muted);
}

.scroll-cue-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.scroll-cue-btn {
  font-size: 1.25rem;
  line-height: 1;
  padding: 0;
}

@media (max-width: 1023px) {
  /* Phone reading order: Ticket (title, Open PC, Hint, Show me) -> Blueprint & Ladder -> Method Notes -> Simulation */
  .left-rail,
  .main-column {
    display: contents;
  }

  .ticket-card  { order: 1; }
  .canvas-stage { order: 2; }
  .method-card  { order: 3; }
  .sim-panel    { order: 4; }

  .blueprint-scroll-cue {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.35rem 0.65rem;
    background: var(--command-raised);
    border-bottom: 1px solid var(--command-line);
    color: var(--command-text);
  }

  .svg-wrap {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-color: var(--signal) var(--command);
    scrollbar-width: thin;
  }

  /* Keep blueprint readable (>= 11px on-canvas text) inside its own scrollable frame */
  .blueprint-svg {
    width: 800px;
    min-width: 800px;
    height: 474px;
    max-height: none;
  }

  /* >= 44x44 CSS px touch targets for every interactive phone control */
  .btn-primary,
  .btn-secondary,
  .btn-cmd,
  .btn-signal,
  .seg-btn,
  .btn-sm,
  .chip-btn,
  .tab-btn,
  .step-pill,
  .scroll-cue-btn {
    min-height: 44px;
    min-width: 44px;
  }

  .text-input,
  .select-sm,
  .terminal-input,
  .note-textarea {
    min-height: 44px;
    font-size: 16px;
  }

  .radio-row,
  .event-row-btn {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ladder-rung { transition: none; }
  .spotlight-ring { animation: none; }
}
