/* ==========================================================================
   NetCoop AI — Handcrafted System Boot & Enterprise Engineering Workspace
   Swiss / IBM Plex Engineering Aesthetic — Zero AI Clutter
   ========================================================================== */

/* ─── Full-Screen Minimalist 3-Column Boot Overlay (White Theme) ──────────── */
#netcoop-boot-screen,
.boot-screen,
.nc-splash {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
  background: #ffffff !important;
  color: #15181d !important;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.44s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.44s cubic-bezier(0.16, 1, 0.3, 1);
}

#netcoop-boot-screen.is-loaded,
#netcoop-boot-screen.out,
.boot-screen.is-loaded,
.nc-splash.out {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Defensive size guard so no image inside boot screen can ever render oversized */
#netcoop-boot-screen img,
.boot-screen img,
.nc-splash img {
  max-width: 168px;
  max-height: 168px;
  width: 156px;
  height: auto;
  object-fit: contain;
  display: block;
}

.nc-cine-boot {
  width: 100%;
  max-width: 1680px;
  padding: 0 4.8vw;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 32px;
}

/* Left Column: Continuous 6-Row Scrolling Stream + Slot-3 Inverted Bar */
.nc-cine-left {
  justify-self: start;
  min-width: 0;
}

.nc-cine-ticker {
  height: 132px; /* Exact 6 visible rows x 22px */
  overflow: hidden;
  position: relative;
}

.nc-cine-ticker__track {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.nc-cine-ticker__line {
  height: 22px;
  line-height: 22px;
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #15181d;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.nc-cine-ticker__line.is-active span {
  display: inline-flex;
  align-items: center;
  height: 19px;
  line-height: 19px;
  min-width: 304px;
  padding: 0 12px 0 6px;
  background: #15181d;
  color: #ffffff;
}

/* Center Column: NetCoop Brand Logo + [ XX% ] / ( DONE ) */
.nc-cine-center {
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.nc-cine-logo {
  width: 156px;
  max-width: 156px;
  height: auto;
  object-fit: contain;
  user-select: none;
  animation: nc-cine-logo-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes nc-cine-logo-in {
  from { opacity: 0; transform: translateY(5px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.nc-cine-counter {
  border: 0;
  background: none;
  padding: 4px 10px;
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #15181d;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.15s;
}

.nc-cine-counter.is-done {
  letter-spacing: 0.1em;
}

.nc-cine-counter:hover {
  opacity: 0.72;
}

/* Right Column: Character-Scramble Typewriter Decode + Block Cursor */
.nc-cine-right {
  justify-self: end;
  min-width: 0;
}

.nc-cine-typewriter {
  width: 344px;
  min-height: 52px;
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #15181d;
  text-align: center;
  white-space: pre-line;
}

.nc-cine-cursor {
  display: inline-block;
  margin-left: 2px;
  font-size: 11px;
  line-height: 1;
  color: #15181d;
  vertical-align: -1px;
  animation: nc-cursor-blink 0.82s steps(1) infinite;
}

@keyframes nc-cursor-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.nc-cine-skip {
  position: fixed;
  right: 4.8vw;
  bottom: 22px;
  border: 0;
  background: none;
  padding: 4px 8px;
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #8a919c;
  cursor: pointer;
  transition: color 0.15s;
}

.nc-cine-skip:hover {
  color: #15181d;
}

@media (max-width: 1060px) {
  .nc-cine-boot {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 24px;
    padding: 0 20px;
  }
  .nc-cine-center { order: 1; gap: 12px; }
  .nc-cine-left   { order: 2; justify-self: center; }
  .nc-cine-right  { order: 3; justify-self: center; }
  .nc-cine-typewriter { width: min(344px, 90vw); }
  #netcoop-boot-screen img,
  .boot-screen img,
  .nc-cine-logo {
    width: 128px;
    max-width: 128px;
    max-height: 140px;
  }
}

.nc-logo-light,
.nc-logo-dark {
  width: 180px !important;
  max-width: 180px !important;
  height: auto !important;
  object-fit: contain;
  user-select: none;
}

.nc-logo-dark {
  display: none !important;
}

[data-theme="dark"] .nc-logo-light {
  display: none !important;
}

[data-theme="dark"] .nc-logo-dark {
  display: block !important;
}

/* ─── Subsystem Verification Rows ─────────────────────────────────────────── */
.nc-boot-checks {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  border-bottom: 1px solid var(--line, #e1e4e8);
}

.nc-boot-checks tr + tr td {
  border-top: 1px solid var(--line, #e1e4e8);
}

.nc-boot-checks td {
  padding: 8px 14px;
  vertical-align: middle;
}

.nc-boot-checks__id {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--ink-3, #7a818c);
  width: 28px;
}

.nc-boot-checks__name {
  font-weight: 500;
  color: var(--ink, #15181d);
}

.nc-boot-checks__spec {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--ink-3, #7a818c);
  text-align: right;
}

.nc-boot-checks__state {
  width: 74px;
  text-align: right;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 500;
}

.nc-check-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--ink-3, #7a818c);
}

.nc-check-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line-strong, #cdd2d8);
}

.nc-check-badge.is-sync {
  color: var(--accent, #2d5bd1);
}
.nc-check-badge.is-sync::before {
  background: var(--accent, #2d5bd1);
}

.nc-check-badge.is-ok {
  color: var(--ok, #1d7a52);
}
.nc-check-badge.is-ok::before {
  background: var(--ok, #1d7a52);
}

/* ─── Boot Progress Footer ────────────────────────────────────────────────── */
.nc-boot-panel__foot {
  padding: 12px 14px 14px;
  background: var(--surface-2, #f6f7f9);
}

.boot-status-box {
  width: 100%;
}

.boot-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  font-size: 12px;
}

.boot-status-lead {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.boot-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok, #1d7a52);
  flex: none;
}

.boot-status-text {
  color: var(--ink-2, #4b525c);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.boot-percent {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink, #15181d);
  font-variant-numeric: tabular-nums;
  flex: none;
}

.boot-progress-track {
  position: relative;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: var(--line-strong, #cdd2d8);
  overflow: hidden;
}

.boot-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: 2px;
  background: var(--accent, #2d5bd1);
  transition: width 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.nc-boot-caption {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 460px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--ink-3, #7a818c);
}

.nc-boot-skip {
  border: 0;
  background: none;
  padding: 2px 6px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--ink-2, #4b525c);
  cursor: pointer;
  border-radius: 3px;
}
.nc-boot-skip:hover {
  background: var(--surface-3, #eceef1);
  color: var(--ink, #15181d);
}

/* ─── App Shell & Topbar / Subbar ─────────────────────────────────────────── */
.nc-app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
}

.topbar-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex: none;
}

.nc-topbar-badge {
  font: 500 10.5px/1 var(--font-mono);
  padding: 2px 5px;
  border-radius: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-3);
  margin-left: 2px;
}

.nc-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font: 500 12px/1 var(--font-mono);
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, background 0.15s;
}
.nc-status-pill:hover {
  border-color: var(--line-strong);
  background: var(--surface-3);
  color: var(--ink);
}

.nc-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  flex: none;
}
.nc-status-dot.is-busy {
  background: var(--accent);
  animation: pulse 1.1s infinite;
}
.nc-status-dot.is-warn {
  background: var(--high);
}

.nc-subbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
}

.nc-subbar__inner {
  max-width: 1520px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 42px;
}

.nc-tabs {
  border-bottom: 0;
  padding: 0;
  gap: 4px;
}

.nc-tabs .tab {
  height: 42px;
  padding: 0 12px;
  font-size: 13px;
  gap: 7px;
}

.nc-tabs .tab svg {
  width: 14px;
  height: 14px;
  color: var(--ink-3);
  transition: color 0.15s;
}
.nc-tabs .tab.is-on svg,
.nc-tabs .tab:hover svg {
  color: var(--accent);
}

.nc-tab-count {
  font: 500 11px/16px var(--font-mono);
  padding: 0 5px;
  border-radius: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.nc-subbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.nc-main-view {
  max-width: 1568px;
  margin: 0 auto;
  padding: 18px 24px 48px;
  width: 100%;
}

/* ─── System Runtime Tab (#tab-boot) Full-Width Panel Layout ──────────────── */
.nc-boot-overview {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.nc-boot-summary-cell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
}

.nc-boot-summary-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.nc-boot-summary-lead {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.55;
  margin: 0;
}

.nc-boot-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.nc-boot-kpi {
  padding: 12px 16px;
  min-width: 0;
}

.nc-boot-kpi + .nc-boot-kpi {
  border-left: 1px solid var(--line);
}

.nc-boot-kpi__label {
  font-size: 11.5px;
  color: var(--ink-3);
}

.nc-boot-kpi__val {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.nc-boot-kpi__sub {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nc-boot-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 2px;
}

.nc-boot-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── Log & Agent Table Split Grid ────────────────────────────────────────── */
.nc-boot-split {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 12px;
}

.boot-tab-console__body {
  padding: 10px 14px;
  font: 12px/1.65 var(--font-mono);
  color: var(--ink);
  max-height: 310px;
  overflow-y: auto;
}

.boot-log-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}
.boot-log-line:last-child {
  border-bottom: 0;
}

.boot-log-time {
  color: var(--ink-3);
  font-size: 11.5px;
  flex: none;
  font-variant-numeric: tabular-nums;
}

.boot-log-tag {
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10.5px;
  flex: none;
}
.boot-log-tag--ok   { background: var(--ok-soft); color: var(--ok); }
.boot-log-tag--sync { background: var(--accent-soft); color: var(--accent); }
.boot-log-tag--warn { background: var(--med-soft); color: var(--med); }

/* ─── Non-Overlapping Panel Headers & Editor Sub-Toolbar ──────────────────── */
.panel__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 8px 14px;
  min-height: 42px;
  height: auto;
  border-bottom: 1px solid var(--line);
}

.panel__title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  line-height: 1.35;
}

.panel__title svg {
  width: 15px;
  height: 15px;
  color: var(--ink-3);
  flex: none;
}

.panel__meta {
  line-height: 1.35;
  min-width: 0;
}

#rt-probe-source-label {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel__link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 0;
  white-space: nowrap;
  cursor: pointer;
  line-height: 1.35;
}

.panel__link svg {
  width: 13px;
  height: 13px;
  flex: none;
}

.panel__head-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.panel__head > .panel__meta + .panel__head-actions,
.panel__head > .panel__meta + .panel__link {
  margin-left: 4px;
}

.panel__head-actions .panel__link,
.panel__head-actions .panel__meta {
  margin-left: 0;
}

.nc-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
  padding: 7px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.nc-editor-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.nc-tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 25px;
  padding: 0 9px;
  border-radius: 3px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  font: 500 11.5px/1 var(--font-ui);
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}

.nc-tool-chip svg {
  width: 12.5px;
  height: 12.5px;
  flex: none;
}

.nc-tool-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}

.nc-tool-chip--accent {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong));
  color: var(--accent);
}

.nc-tool-chip--accent:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* ─── Live Network Target Prober Bar ──────────────────────────────────────── */
.nc-prober-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nc-prober-input-wrap {
  flex: 1;
  min-width: 260px;
}

.nc-prober-presets {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 9px;
}

.nc-preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  max-width: 100%;
  padding: 0 8px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  font: 500 11.5px/1 var(--font-ui);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.nc-preset-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}

/* ─── Topology Graph & Node Cards ─────────────────────────────────────────── */
.list__item.nc-sc {
  grid-template-columns: 126px minmax(0, 1fr) auto;
  gap: 14px;
}

.nc-sc__badge {
  width: 96px;
  display: inline-flex;
  align-items: center;
}

.nc-topo-touch-hint {
  display: none;
}

.nc-topo-svg-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px;
}

.nc-topo-svg {
  width: 100%;
  min-width: 680px;
  height: auto;
  max-height: 260px;
  display: block;
}

.topo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 10px;
}

.topo-node {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.topo-node:hover {
  border-color: var(--accent);
  background: var(--surface-2);
}
.topo-node--impaired {
  border-left: 3px solid var(--crit);
}
.topo-node--healthy {
  border-left: 3px solid var(--ok);
}

.topo-node__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.topo-node__id {
  font: 600 12.5px var(--font-mono);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topo-node__sub {
  font-size: 12px;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}

.topo-node__meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 10px;
  font: 11.5px var(--font-mono);
  color: var(--ink-2);
  padding-top: 6px;
  border-top: 1px solid var(--line);
}
.topo-node__meta > div {
  min-width: 0;
  overflow-wrap: anywhere;
}
.topo-node__meta span {
  color: var(--ink-3);
}

/* ─── Layout Containment & Semantic Component Hooks ───────────────────────── */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.nc-app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 100vw;
  overflow-x: clip;
}

.grid > *,
.nc-boot-split > *,
.stack > *,
.panel,
.panel__body {
  min-width: 0;
  max-width: 100%;
}

.table-wrap {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  max-width: 100%;
}

.code {
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.nc-runtime-badges {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nc-m8ven-link {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  max-width: 100%;
}

.nc-m8ven-badge {
  display: block;
  height: 20px;
  width: auto;
  max-width: 100%;
  border-radius: 3px;
}

.nc-studio-actions {
  display: flex;
  align-items: center;
  margin-top: 10px;
  gap: 8px;
  flex-wrap: wrap;
}

.nc-studio-status {
  color: var(--ink-3);
  margin-left: auto;
  min-width: 0;
}

.nc-scenarios-list {
  overflow-y: auto;
  max-height: 405px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.nc-bus-select--agent {
  width: 190px;
}

.nc-bus-select--type {
  width: 170px;
}

.nc-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.nc-modal-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.nc-modal-title svg {
  flex: none;
}

.nc-modal-close {
  width: 28px;
  height: 28px;
  flex: none;
}

.nc-palette-esc {
  cursor: pointer;
}

/* ─── Responsive: Tablet & Compact Desktop (<= 960px) ─────────────────────── */
@media (max-width: 960px) {
  .topbar {
    padding: 0 12px;
    gap: 8px;
  }

  .search-trigger {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
    flex: none;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
    flex: none;
  }

  .nc-status-pill {
    height: 34px;
    min-width: 0;
    max-width: 240px;
  }

  #top-status {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nc-subbar {
    padding: 0 12px;
  }

  .nc-subbar__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
  }

  .nc-tabs {
    width: calc(100% + 24px);
    margin: 0 -12px;
    padding: 0 12px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    gap: 2px;
  }

  .nc-tabs::-webkit-scrollbar {
    display: none;
  }

  .nc-tabs .tab {
    flex: 0 0 auto;
    height: 44px;
    padding: 0 12px;
    font-size: 12.5px;
    white-space: nowrap;
  }

  .nc-subbar__actions {
    width: 100%;
    padding: 8px 0;
    border-top: 1px solid var(--line);
    display: flex;
    gap: 8px;
  }

  #global-probe-btn {
    flex: 1 1 auto;
    min-height: 38px;
    justify-content: center;
  }

  #global-reboot-btn {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 12px;
  }

  .nc-main-view {
    padding: 14px 12px calc(40px + env(safe-area-inset-bottom, 0px));
  }

  .nc-boot-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nc-boot-kpi:nth-child(3) {
    border-left: 0;
  }

  .nc-boot-kpi:nth-child(n+3) {
    border-top: 1px solid var(--line);
  }

  .nc-boot-split {
    grid-template-columns: 1fr;
  }

  .nc-topo-touch-hint {
    display: block;
    font: 500 11px/1.4 var(--font-mono);
    color: var(--ink-3);
    margin-bottom: 6px;
  }
}

/* ─── Responsive: Phablet & Mobile Landscape (<= 768px) ───────────────────── */
@media (max-width: 768px) {
  @supports (-webkit-touch-callout: none) {
    .input,
    .select,
    .textarea,
    .palette__input input {
      font-size: 16px !important;
    }
  }

  .btn {
    min-height: 38px;
  }

  .btn--sm {
    min-height: 34px;
  }

  .input,
  .select {
    min-height: 40px;
  }

  .panel__head {
    align-items: flex-start;
    padding: 10px 12px;
    gap: 8px 10px;
  }

  .panel__title {
    font-size: 13px;
    flex: 1 1 210px;
    white-space: normal;
  }

  .panel__meta {
    margin-left: 0;
  }

  .panel__head-actions {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
    gap: 8px 10px;
  }

  #rt-probe-source-label {
    max-width: 100%;
    width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .panel__link {
    min-height: 32px;
    padding: 4px 9px;
    border-radius: var(--r-xs);
    background: var(--surface-2);
    border: 1px solid var(--line);
    font-size: 11.5px;
    text-decoration: none !important;
  }

  .nc-prober-input-wrap {
    flex: 1 1 100%;
    min-width: 0;
    width: 100%;
  }

  #nc-probe-diagnose-btn,
  #nc-probe-live-btn {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
    min-height: 40px;
  }

  .nc-prober-presets {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }

  .nc-prober-presets::-webkit-scrollbar {
    display: none;
  }

  .nc-prober-presets > span {
    flex: 0 0 auto;
  }

  .nc-preset-chip {
    flex: 0 0 auto;
    height: 32px;
    padding: 0 10px;
    font-size: 12px;
    max-width: none;
  }

  .nc-editor-toolbar {
    padding: 8px 12px;
    gap: 8px;
  }

  .nc-tool-chip {
    height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }

  .nc-bus-toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px 12px;
  }

  .nc-bus-search {
    grid-column: 1 / -1;
    min-width: 0;
    width: 100%;
  }

  .nc-bus-select {
    width: 100%;
    min-width: 0;
  }

  .nc-modal-close {
    width: 36px;
    height: 36px;
  }

  .hide-mobile {
    display: none !important;
  }
}

/* ─── Responsive: Mobile Portrait (<= 600px) ──────────────────────────────── */
@media (max-width: 600px) {
  /* Full-Screen Boot Overlay */
  .boot-screen {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .nc-cine-boot {
    padding: 16px 16px 68px;
    gap: 18px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }

  .nc-cine-center {
    gap: 10px;
  }

  #netcoop-boot-screen img,
  .boot-screen img,
  .nc-cine-logo {
    width: 104px !important;
    max-width: 104px !important;
    max-height: 116px !important;
  }

  .nc-cine-counter {
    min-height: 34px;
    padding: 4px 10px;
    font-size: 11.5px;
  }

  .nc-cine-left {
    width: 100%;
    max-width: calc(100vw - 32px);
    overflow: hidden;
  }

  .nc-cine-ticker {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
  }

  .nc-cine-ticker__line {
    font-size: 10px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nc-cine-ticker__line.is-active span {
    min-width: 0;
    width: 100%;
    max-width: calc(100vw - 36px);
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 10px;
  }

  .nc-cine-right {
    width: 100%;
    max-width: calc(100vw - 28px);
  }

  .nc-cine-typewriter {
    width: 100%;
    max-width: 330px;
    margin: 0 auto;
    font-size: 9.8px;
    letter-spacing: 0.02em;
    white-space: pre-line;
    min-height: 46px;
  }

  .nc-cine-skip {
    bottom: max(16px, env(safe-area-inset-bottom, 16px));
    min-height: 44px;
    min-width: 80px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
  }

  /* Topbar */
  .topbar {
    padding: 0 10px;
    gap: 6px;
  }

  .topbar__brand {
    gap: 6px;
    min-width: 0;
  }

  .topbar-logo {
    width: 20px;
    height: 20px;
  }

  .nc-status-pill {
    max-width: 148px;
    padding: 0 8px;
    font-size: 11px;
  }

  /* System Runtime (#tab-boot) */
  .nc-boot-summary-body {
    padding: 12px;
    gap: 12px;
  }

  .nc-boot-summary-lead {
    font-size: 12.5px;
  }

  .nc-boot-kpi {
    padding: 10px 12px;
  }

  .nc-boot-kpi__val {
    font-size: 12.5px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .nc-boot-kpi__sub {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.35;
  }

  .boot-status-box {
    padding: 10px 12px;
  }

  .boot-status-row {
    align-items: flex-start;
    gap: 8px;
  }

  .boot-status-text {
    font-size: 11.5px;
    line-height: 1.4;
  }

  .nc-boot-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .nc-boot-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  #btn-runtime-probe-now {
    grid-column: 1 / -1;
    min-height: 42px;
    justify-content: center;
  }

  .nc-boot-actions .btn {
    justify-content: center;
    text-align: center;
    padding: 0 8px;
    font-size: 12px;
  }

  .boot-tab-console__body {
    padding: 10px 12px;
    font-size: 11.5px;
    max-height: 260px;
  }

  .boot-log-line {
    flex-wrap: wrap;
    gap: 4px 8px;
    padding: 6px 0;
  }

  .boot-log-line > span:last-child {
    flex: 1 1 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.45;
  }

  /* Live Diagnostics (#tab-studio) */
  .panel__body {
    padding: 12px;
  }

  #nc-probe-diagnose-btn,
  #nc-probe-live-btn {
    flex: 1 1 100%;
    width: 100%;
    min-height: 42px;
  }

  .textarea {
    min-height: 190px;
    padding: 10px;
  }

  .nc-studio-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  #nc-run {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 42px;
    justify-content: center;
  }

  .nc-studio-actions > .btn:not(#nc-run) {
    justify-content: center;
    padding: 0 6px;
    font-size: 11.5px;
  }

  .nc-studio-status {
    grid-column: 1 / -1;
    margin-left: 0;
    width: 100%;
    padding-top: 2px;
    overflow-wrap: anywhere;
  }

  .nc-scenarios-list {
    max-height: 340px;
  }

  .list__item.nc-sc {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 10px;
    padding: 12px;
  }

  .nc-sc__badge {
    grid-column: 1 / -1;
    width: auto;
  }

  .list__item.nc-sc .list__title {
    white-space: normal;
    line-height: 1.35;
  }

  .list__item.nc-sc .list__sub {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
  }

  /* Verdict & Diagnostic Results (#nc-results) */
  .verdict {
    padding: 14px;
  }

  .verdict__top {
    gap: 6px 8px;
  }

  .verdict__id {
    margin-left: 0;
    width: 100%;
    font-size: 11px;
    overflow-wrap: anywhere;
  }

  .nc-verdict-foot {
    flex-direction: column;
    align-items: stretch !important;
    gap: 12px !important;
  }

  .verdict .facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    width: 100%;
  }

  .nc-verdict-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .nc-verdict-actions .btn {
    width: 100%;
    justify-content: center;
    font-size: 11.5px;
    padding: 0 8px;
  }

  .nc-hitl-row {
    flex-direction: column;
    align-items: stretch !important;
  }

  #hitl-ack-btn {
    width: 100%;
    justify-content: center;
    min-height: 40px;
  }

  /* Network Topology (#tab-topology) */
  .nc-topo-svg-wrap {
    padding: 10px;
  }

  .nc-topo-svg {
    min-width: 580px;
  }

  .topo-grid {
    grid-template-columns: 1fr;
  }

  #topo-load-live-btn,
  #topo-load-campus-btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  /* Data Tables */
  .table th,
  .table td {
    padding: 8px 10px;
    font-size: 12px;
  }

  /* Modals, Command Palette & Toasts */
  .modal,
  .modal--wide {
    top: max(10px, env(safe-area-inset-top, 10px));
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 20px);
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .nc-modal-title {
    font-size: 13.5px;
  }

  .modal__foot {
    flex-wrap: wrap;
    gap: 8px;
  }

  .modal__foot .btn {
    flex: 1 1 auto;
    justify-content: center;
    min-height: 38px;
  }

  .palette {
    top: max(10px, env(safe-area-inset-top, 10px));
    width: calc(100vw - 16px);
    padding: 0;
  }

  .palette__input {
    padding: 10px 12px;
  }

  .palette__results {
    max-height: min(65dvh, 380px);
    -webkit-overflow-scrolling: touch;
  }

  .palette__item {
    min-height: 44px;
    padding: 10px 12px;
  }

  .palette__foot {
    display: none;
  }

  .toasts {
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom, 10px));
    max-width: none;
  }

  .toast {
    min-width: 0;
    width: 100%;
  }
}

/* ─── Responsive: Small & Ultra-Narrow Phones (<= 400px) ──────────────────── */
@media (max-width: 400px) {
  #netcoop-boot-screen img,
  .boot-screen img,
  .nc-cine-logo {
    width: 94px !important;
    max-width: 94px !important;
    max-height: 104px !important;
  }

  .nc-status-pill {
    max-width: 112px;
  }

  .nc-boot-kpis {
    grid-template-columns: 1fr;
  }

  .nc-boot-kpi + .nc-boot-kpi {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .nc-boot-actions {
    grid-template-columns: 1fr;
  }

  .nc-studio-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #nc-clear {
    grid-column: 1 / -1;
  }

  .nc-verdict-actions {
    grid-template-columns: 1fr !important;
  }

  .nc-bus-toolbar {
    grid-template-columns: 1fr;
  }

  .topo-node__meta {
    grid-template-columns: 1fr;
  }
}
