:root {
  --red: #ff2a2a;
  --dred: #4a0000;
  --bg: #050202;
  --glow: 0 0 10px rgba(255, 42, 42, 0.7);
  --healthy-green: #d6ffe5;
  --healthy-green-border: rgba(100, 255, 162, 0.34);
  --healthy-green-bg: rgba(36, 145, 74, 0.18);
  --sw: 310px;
  /* sidebar width */
}

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

body,
html {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  overscroll-behavior: none;
  background: #000;
  font-family: 'Share Tech Mono', monospace;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color: var(--red);
}

/* ══════════════════════════════════════════════════════
       #glitch-target  —  THE FULL SCREEN glitchGL target
       Everything inside gets processed by the WebGL pipeline
       ══════════════════════════════════════════════════════ */
#glitch-target {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  --fx-edge-scale: 1;
  --crt-on: 1;
  --base-brightness: 2;
  --base-contrast: 1.06;
  --base-saturate: 1.08;
  --scanline-opacity: 0.3;
  --scanline-bright: 1px;
  --scanline-dark-start: 2px;
  --scanline-step: 4px;
  --scanline-shift-x: 0px;
  --scanline-shift-y: 0px;
  --scanline-shift-duration: 6s;
  --flicker-opacity: 0.44;
  --flicker-speed: 140ms;
  --vignette-center: 52%;
  --vignette-alpha: 0.52;
  --aberration-r: 0.08;
  --aberration-c: 0.04;
  --phosphor-blur: 0.9px;
  --crt-curve-radius: 26px;
  --crt-curve-scale-x: 0.988;
  --crt-curve-scale-y: 0.976;
  background: var(--bg);
  background-image:
    linear-gradient(rgba(255, 0, 0, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 0, 0, 0.04) 1px, transparent 1px);
  background-size: 20px 20px;
  display: grid;
  grid-template-columns: var(--sw) 1fr;
  grid-template-rows: 100vh;
  isolation: isolate;
  overflow: hidden;
  border-radius: var(--crt-curve-radius);
  overscroll-behavior: none;
  filter: contrast(calc(1 + (var(--base-contrast) - 1) * var(--crt-on)))
    saturate(calc(1 + (var(--base-saturate) - 1) * var(--crt-on)))
    brightness(calc(1 + (var(--base-brightness) - 1) * var(--crt-on)));
}

.native-inner-scroll,
.fx-controls {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}

/* Full-window CRT treatment */
#glitch-target::before,
#glitch-target::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#glitch-target::before {
  z-index: 5;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.06) 0px,
    rgba(255, 255, 255, 0.06) var(--scanline-bright),
    rgba(0, 0, 0, 0.22) var(--scanline-dark-start),
    rgba(0, 0, 0, 0.22) var(--scanline-step)
  );
  mix-blend-mode: screen;
  opacity: calc(var(--scanline-opacity) * var(--crt-on));
  animation: crtScanlineShift var(--scanline-shift-duration) linear infinite;
  border-radius: var(--crt-curve-radius);
}

#glitch-target::after {
  z-index: 6;
  background:
    radial-gradient(
      ellipse at center,
      transparent var(--vignette-center),
      rgba(0, 0, 0, var(--vignette-alpha)) 100%
    ),
    linear-gradient(
      90deg,
      rgba(255, 30, 30, var(--aberration-r)),
      rgba(0, 255, 255, var(--aberration-c))
    );
  filter: blur(var(--phosphor-blur));
  opacity: calc(var(--flicker-opacity) * var(--crt-on));
  animation: crtFlicker var(--flicker-speed) steps(2, end) infinite;
  border-radius: var(--crt-curve-radius);
  transform: scale(var(--crt-curve-scale-x), var(--crt-curve-scale-y));
}

#glitch-target.crt-no-flicker::after {
  animation: none;
}

#glitch-target.crt-no-line-move::before {
  animation: none;
  transform: scale(var(--crt-curve-scale-x), var(--crt-curve-scale-y));
}

/* If glitchGL is active, use its CRT shader on the main dashboard layer. */
body.fx-active #glitch-target {
  filter: none;
  border-radius: 0;
  transform: scale(var(--fx-edge-scale));
  transform-origin: center center;
}

body.fx-active #glitch-target::before,
body.fx-active #glitch-target::after {
  display: none;
}

@keyframes crtScanlineShift {
  from {
    transform: translate(0, 0) scale(var(--crt-curve-scale-x), var(--crt-curve-scale-y));
  }

  to {
    transform: translate(var(--scanline-shift-x), var(--scanline-shift-y))
      scale(var(--crt-curve-scale-x), var(--crt-curve-scale-y));
  }
}

@keyframes crtFlicker {
  0%,
  100% {
    opacity: 0.4;
  }

  50% {
    opacity: 0.48;
  }
}

/* ── Decorative left column (inside glitch target, no inputs) ── */
.sidebar-deco {
  border-right: 1px solid var(--red);
  box-shadow: 4px 0 18px rgba(80, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.deco-header {
  padding: 11px 16px;
  border-bottom: 2px solid var(--red);
  font-size: 1.5rem;
  font-weight: bold;
  text-shadow: var(--glow);
  letter-spacing: 4px;
  flex-shrink: 0;
  text-align: center;
}

.deco-body {
  flex: 1;
  padding: 10px 12px;
}

.deco-section {
  font-size: 0.6rem;
  letter-spacing: 3px;
  color: #553333;
  border-bottom: 1px solid #1a0000;
  padding-bottom: 3px;
  margin: 8px 0 6px;
}

.deco-group {
  margin-bottom: 10px;
}

.deco-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 5px;
  font-size: 0.58rem;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: #8a4c4c;
}

.deco-group-header span {
  color: #b06464;
}

.deco-group-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  inline-size: 100%;
  border: 1px solid rgba(180, 92, 92, 0.24);
  background: rgba(42, 0, 0, 0.42);
  color: #c98888;
  font: inherit;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 6px 8px;
  cursor: pointer;
  transition:
    border-color 120ms ease,
    background 120ms ease,
    color 120ms ease;
}

.deco-group-toggle:hover,
.deco-group-toggle:focus-visible {
  border-color: #ff6a6a;
  background: rgba(255, 48, 48, 0.08);
  color: #ffd2d2;
  outline: none;
}

.deco-device {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--dred);
  background: rgba(255, 0, 0, 0.04);
  margin-bottom: 5px;
  font-size: 0.78rem;
  transition:
    border-color 120ms ease,
    background 120ms ease,
    box-shadow 140ms ease;
}

.deco-device[data-topology-device-key] {
  cursor: pointer;
}

.deco-device[data-topology-device-key]:hover,
.deco-device[data-topology-device-key]:focus-visible,
.deco-device.is-linked-hovered {
  border-color: #ff6a6a;
  background: rgba(255, 48, 48, 0.08);
  box-shadow:
    0 0 14px rgba(255, 92, 92, 0.22),
    inset 0 0 12px rgba(255, 72, 72, 0.05);
  outline: none;
}

.deco-device-main {
  min-width: 0;
  flex: 1 1 auto;
}

.deco-device-title {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deco-device.portfolio-experience {
  border-color: var(--healthy-green-border);
  background: var(--healthy-green-bg);
  color: var(--healthy-green);
}

.deco-device.portfolio-experience[data-topology-device-key]:hover,
.deco-device.portfolio-experience[data-topology-device-key]:focus-visible,
.deco-device.portfolio-experience.is-linked-hovered {
  border-color: rgba(100, 255, 162, 0.62);
  background: rgba(36, 145, 74, 0.26);
  box-shadow:
    0 0 16px rgba(100, 255, 162, 0.28),
    inset 0 0 12px rgba(100, 255, 162, 0.08);
}

.deco-device.offline {
  border-color: #2e2e2e;
  background: rgba(120, 120, 120, 0.1);
  color: #a0a0a0;
}

.deco-device.stale {
  border-style: dashed;
}

.deco-device small {
  color: #ff7777;
  font-size: 0.66rem;
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deco-device.portfolio-project,
.deco-device.portfolio-experience {
  min-height: 42px;
  font-size: 0.72rem;
  line-height: 1.1;
}

.deco-device-meta {
  margin-top: 2px;
}

.deco-device.portfolio-experience .deco-device-title {
  color: var(--healthy-green);
}

.deco-device.portfolio-experience .deco-device-meta {
  color: #ff7777;
}

.deco-device.offline small {
  color: #7f7f7f;
}

.deco-alert {
  color: #fff;
  background: var(--red);
  padding: 3px 7px;
  font-size: 0.72rem;
  font-weight: bold;
  flex: 0 0 auto;
}

.deco-device.portfolio-experience .deco-alert {
  color: var(--healthy-green);
  background: rgba(36, 145, 74, 0.36);
  border: 1px solid var(--healthy-green-border);
  box-shadow: 0 0 12px rgba(100, 255, 162, 0.24);
}

.deco-device.offline .deco-alert {
  background: #555;
  color: #ddd;
}

/* ── Main dashboard (right of decorative sidebar) ── */
.main-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(320px, 24vw, 360px);
  grid-template-rows: 78px 1fr 145px;
  gap: 10px;
  padding: 10px;
  height: 100vh;
}

/* Header */
.header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 3;
  border-bottom: 2px solid var(--red);
  padding: 6px 14px;
  box-shadow: 0 4px 14px rgba(80, 0, 0, 0.7);
}

.header-traffic-mini {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  margin-right: 18px;
  justify-content: center;
  position: relative;
  z-index: 4;
}

.header-traffic-mini-label {
  font-size: 0.56rem;
  letter-spacing: 2.4px;
  color: #b05656;
}

.header-traffic-mini-row {
  display: flex;
  align-items: center;
  gap: 0;
}

.header-traffic-mini-graph {
  flex: 1;
  height: 46px;
  min-width: 0;
  border: 1px solid rgba(160, 34, 34, 0.9);
  background:
    linear-gradient(180deg, rgba(42, 0, 0, 0.66) 0%, rgba(8, 0, 0, 0.96) 100%),
    repeating-linear-gradient(90deg, rgba(255, 78, 78, 0.08) 0 1px, transparent 1px 18px),
    repeating-linear-gradient(180deg, rgba(255, 78, 78, 0.06) 0 1px, transparent 1px 10px);
  box-shadow:
    inset 0 0 12px rgba(255, 34, 34, 0.08),
    0 0 12px rgba(255, 46, 46, 0.12);
  overflow: hidden;
}

.header-traffic-mini-graph svg {
  width: 100%;
  height: 100%;
  display: block;
}

.header-traffic-mini-graph canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.header-traffic-mini-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0.52rem;
  letter-spacing: 1.4px;
  color: #7a4040;
}

.header-stats {
  display: flex;
  gap: 18px;
  font-size: 0.78rem;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  flex: 0 0 auto;
}

.badge {
  background: var(--red);
  color: #000;
  padding: 2px 8px;
  font-weight: bold;
  font-size: 0.74rem;
  transition:
    background-color 140ms ease,
    color 140ms ease;
}

.badge.threat-low {
  background: #59d46f;
  color: #001100;
}

.badge.threat-medium {
  background: #d6b54f;
  color: #1a1200;
}

.badge.threat-high {
  background: #ff8d3d;
  color: #230a00;
}

.badge.threat-critical {
  background: #ff2a2a;
  color: #fff;
}

.net-status {
  color: #ff9b9b;
}

.net-status.status-good {
  color: #7cf19f;
}

.net-status.status-watch {
  color: #ffd56a;
}

.net-status.status-bad {
  color: #ff8f8f;
}

.health-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border: 1px solid rgba(255, 196, 122, 0.28);
  border-radius: 999px;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: #ffe4bd;
  background: rgba(255, 148, 72, 0.08);
}

.health-status-pill.is-healthy {
  border-color: rgba(100, 255, 162, 0.34);
  color: #d6ffe5;
  background: rgba(36, 145, 74, 0.18);
}

.health-status-pill.is-warning,
.health-status-pill.is-checking {
  border-color: rgba(255, 194, 121, 0.34);
  color: #ffe4bd;
  background: rgba(255, 154, 60, 0.14);
}

.health-status-pill.is-critical {
  border-color: rgba(255, 112, 112, 0.42);
  color: #ffd9d9;
  background: rgba(168, 42, 42, 0.26);
}

/* Panels */
.panel {
  background: rgba(12, 0, 0, 0.75);
  border: 1px solid var(--red);
  box-shadow:
    inset 0 0 14px var(--dred),
    var(--glow);
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
}

.panel-fill {
  flex: 1 1 auto;
  min-height: 0;
}

.panel-title {
  font-size: 0.82rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--red);
  padding-bottom: 5px;
  margin-bottom: 10px;
  text-shadow: var(--glow);
}

/* Three.js topology — center */
.topology {
  grid-column: 1;
  grid-row: 2;
  border: 1px solid var(--red);
  box-shadow: var(--glow);
  background: radial-gradient(ellipse at center, rgba(35, 0, 0, 0.95) 0%, #000 100%);
  overflow: hidden;
  position: relative;
  touch-action: none;
}

#three-canvas-wrap {
  width: 100%;
  height: 100%;
  touch-action: none;
}

.topology-tooltip {
  position: fixed;
  left: 8px;
  top: 8px;
  pointer-events: none;
  z-index: 40;
  opacity: 0;
  transition: opacity 90ms ease;
  border: 1px solid var(--red);
  background: rgba(0, 0, 0, 0.94);
  box-shadow: 0 0 10px rgba(255, 42, 42, 0.45);
  padding: 6px 8px;
  font-size: 0.66rem;
  line-height: 1.45;
  white-space: normal;
  max-width: min(320px, calc(100vw - 16px));
  word-break: break-word;
}

.topology-tooltip.visible {
  opacity: 1;
}

.topology-tooltip .host {
  color: #fff;
}

.topology-tooltip .ip {
  color: #ffd1d1;
}

.topology-tooltip .server {
  color: #ff9d9d;
}

.topology-tooltip .skill {
  color: #ffd6b7;
}

/* Right sidebar */
.right-sidebar {
  grid-column: 2;
  grid-row: 2 / 4;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  min-width: 0;
}

.about-panel {
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
}

.about-panel-title {
  flex: 0 0 auto;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 82, 82, 0.42);
  color: #fff2f2;
  font-size: 0.94rem;
  letter-spacing: 0.14em;
  line-height: 1.1;
  text-transform: uppercase;
  text-shadow: var(--glow);
}

.about-panel-copy {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  color: #ffd6d6;
  font-size: 0.76rem;
  line-height: 1.54;
}

.about-panel-copy p {
  margin: 0 0 0.92rem;
}

.about-panel-copy p:last-child {
  margin-bottom: 0;
}

.about-panel-skills {
  color: #ffd6b7;
  line-height: 1.9;
}

.about-panel-skills-break {
  display: block;
  line-height: 1;
}

.about-panel-skills-label {
  display: block;
  margin: 0 0 0.42rem;
  color: #fff2f2;
  line-height: 1.2;
  white-space: nowrap;
}

.about-panel-skills-value {
  display: block;
  line-height: 2;
  word-break: normal;
  overflow-wrap: break-word;
}

.sidebar-tabs-panel {
  min-height: 0;
  min-width: 0;
}

.sidebar-tab-strip {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  margin: -2px -2px 10px;
  padding: 0 2px;
}

.sidebar-tab {
  appearance: none;
  flex: 1 1 0;
  min-width: 0;
  border: 1px solid rgba(255, 82, 82, 0.4);
  border-bottom: none;
  background: linear-gradient(180deg, rgba(72, 0, 0, 0.88) 0%, rgba(24, 0, 0, 0.96) 100%);
  color: #ff9a9a;
  font: inherit;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 8px 4px 7px;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  box-shadow: inset 0 0 8px rgba(255, 48, 48, 0.1);
  transition:
    color 120ms ease,
    border-color 120ms ease,
    background 120ms ease,
    transform 120ms ease;
  text-align: center;
  line-height: 1.15;
}

.sidebar-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  margin-left: 0.42rem;
  padding: 0.08rem 0.34rem;
  border: 1px solid rgba(255, 176, 176, 0.48);
  border-radius: 999px;
  background: rgba(255, 68, 68, 0.16);
  color: #fff;
  font-size: 0.58rem;
  line-height: 1;
  vertical-align: middle;
}

.sidebar-tab:hover,
.sidebar-tab:focus-visible {
  color: #fff0f0;
  border-color: rgba(255, 124, 124, 0.7);
  outline: none;
}

.sidebar-tab.is-active {
  color: #fff;
  background: linear-gradient(180deg, rgba(108, 0, 0, 0.92) 0%, rgba(42, 0, 0, 0.98) 100%);
  border-color: rgba(255, 132, 132, 0.78);
  box-shadow:
    0 0 12px rgba(255, 52, 52, 0.16),
    inset 0 0 14px rgba(255, 62, 62, 0.12);
  transform: translateY(1px);
}

.sidebar-pages {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: flex;
  overflow: hidden;
}

.sidebar-page {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
}

.sidebar-page.is-active {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-page > * {
  min-width: 0;
  max-width: 100%;
}

.sidebar-section-title {
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #ffd0d0;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(255, 82, 82, 0.42);
}

.ai-analyst-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.ai-analyst-header-row .sidebar-section-title {
  flex: 1 1 auto;
  min-width: 0;
}

.analysis-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.analysis-scroll-region {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 2px;
}

.analysis-item {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
  column-gap: 12px;
  row-gap: 8px;
  align-items: start;
  padding: 9px 10px;
  border: 1px solid rgba(255, 92, 92, 0.28);
  background:
    linear-gradient(
      90deg,
      rgba(255, 48, 48, 0.11) 0%,
      rgba(255, 48, 48, 0.03) 48%,
      transparent 100%
    ),
    rgba(20, 0, 0, 0.38);
  min-width: 0;
  max-width: 100%;
}

.analysis-label {
  grid-column: 1 / 2;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ff9696;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.analysis-value {
  grid-column: 2 / 3;
  min-width: 0;
  max-width: 100%;
  justify-self: end;
  text-align: right;
  font-size: clamp(0.72rem, 1.02vw, 0.84rem);
  line-height: 1.22;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 6px rgba(255, 70, 70, 0.45);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.analysis-value.muted {
  color: #ff9e9e;
  text-shadow: none;
}

.analysis-detail {
  grid-column: 1 / -1;
  font-size: 0.66rem;
  line-height: 1.45;
  color: #ff8a8a;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.dns-activity {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}

.dns-sparkline {
  position: relative;
  flex: 1 1 auto;
  min-height: 180px;
  border: 1px solid rgba(255, 92, 92, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 56, 56, 0.08) 0%, rgba(0, 0, 0, 0) 100%),
    radial-gradient(circle at top, rgba(255, 70, 70, 0.14) 0%, rgba(0, 0, 0, 0.88) 72%),
    repeating-linear-gradient(90deg, rgba(255, 78, 78, 0.08) 0 1px, transparent 1px 18px),
    repeating-linear-gradient(180deg, rgba(255, 78, 78, 0.06) 0 1px, transparent 1px 12px);
  box-shadow:
    inset 0 0 12px rgba(255, 34, 34, 0.08),
    0 0 12px rgba(255, 46, 46, 0.12);
  overflow: hidden;
}

.dns-sparkline canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.dns-sparkline-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  color: #ff8d8d;
  pointer-events: none;
}

.dns-activity-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.68rem;
  line-height: 1.45;
  color: #ff9797;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.dns-activity-summary strong {
  display: block;
  color: #fff;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.device-dns-page {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}

.alerts-page {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}

.device-dns-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(255, 92, 92, 0.28);
  background:
    linear-gradient(
      90deg,
      rgba(255, 48, 48, 0.11) 0%,
      rgba(255, 48, 48, 0.03) 48%,
      transparent 100%
    ),
    rgba(20, 0, 0, 0.38);
  min-width: 0;
  max-width: 100%;
}

.device-dns-header strong {
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  color: #fff;
  font-size: 0.88rem;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.device-dns-header span {
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  font-size: 0.66rem;
  line-height: 1.45;
  color: #ff9b9b;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.alerts-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(255, 92, 92, 0.28);
  background:
    linear-gradient(
      90deg,
      rgba(255, 48, 48, 0.11) 0%,
      rgba(255, 48, 48, 0.03) 48%,
      transparent 100%
    ),
    rgba(20, 0, 0, 0.38);
  min-width: 0;
  max-width: 100%;
}

.alerts-header strong {
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  color: #fff;
  font-size: 0.88rem;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.alerts-header span {
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  font-size: 0.66rem;
  line-height: 1.45;
  color: #ff9b9b;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.device-dns-log {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px 2px 2px 0;
}

.alerts-log {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px 2px 2px 0;
}

.device-details-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 92, 92, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 36, 36, 0.08) 0%, rgba(0, 0, 0, 0) 100%), rgba(20, 0, 0, 0.28);
}

.device-details-section-title {
  color: #fff2f2;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.device-details-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.device-details-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid rgba(255, 120, 120, 0.26);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffd0d0;
  background: rgba(255, 64, 64, 0.08);
}

.device-details-pill.good {
  color: #d2ffe5;
  border-color: rgba(132, 255, 189, 0.28);
  background: rgba(48, 186, 104, 0.12);
}

.device-details-pill.warning {
  color: #ffe3b0;
  border-color: rgba(255, 196, 82, 0.28);
  background: rgba(255, 182, 43, 0.12);
}

.device-details-pill.bad {
  color: #ffd4d4;
  border-color: rgba(255, 78, 78, 0.34);
  background: rgba(255, 48, 48, 0.14);
}

.device-details-pill.muted {
  color: #ffb9b9;
  background: rgba(255, 84, 84, 0.05);
}

.device-details-kv-list,
.device-details-list,
.device-dns-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.device-details-kv-row,
.device-details-entry {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 9px;
  border: 1px solid rgba(255, 92, 92, 0.14);
  background: rgba(0, 0, 0, 0.18);
  min-width: 0;
}

.device-details-kv-label,
.device-details-entry-time {
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ff8f8f;
}

.device-details-kv-value,
.device-details-entry-title {
  font-size: 0.76rem;
  line-height: 1.45;
  color: #fff4f4;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.device-details-entry-detail,
.device-details-copy,
.device-details-entry-meta,
.device-details-empty {
  font-size: 0.67rem;
  line-height: 1.5;
  color: #ffafaf;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.device-details-entry-meta {
  color: #ff9494;
}

.device-details-toggle {
  align-self: flex-start;
  padding: 5px 10px;
  border: 1px solid rgba(255, 110, 110, 0.24);
  background: rgba(255, 72, 72, 0.08);
  color: #ffd0d0;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.device-details-toggle:hover {
  border-color: rgba(255, 132, 132, 0.34);
  background: rgba(255, 92, 92, 0.12);
}

.device-details-toggle.subtle {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 158, 158, 0.16);
}

.device-metadata-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.device-metadata-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.device-metadata-label {
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ff9a9a;
}

.device-metadata-input,
.device-metadata-textarea {
  width: 100%;
  border: 1px solid rgba(255, 104, 104, 0.2);
  background: rgba(7, 0, 0, 0.58);
  color: #fff4f4;
  padding: 8px 10px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.76rem;
  line-height: 1.42;
  letter-spacing: 0.04em;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
  resize: vertical;
  outline: none;
}

.device-metadata-input:focus,
.device-metadata-textarea:focus {
  border-color: rgba(255, 140, 140, 0.4);
  box-shadow: 0 0 0 1px rgba(255, 92, 92, 0.14);
}

.device-metadata-input:disabled,
.device-metadata-textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.device-metadata-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.device-metadata-status {
  font-size: 0.64rem;
  line-height: 1.5;
  color: #ffb3b3;
}

.device-metadata-status.success {
  color: #c6ffd8;
}

.device-metadata-status.error {
  color: #ffd1d1;
}

.device-metadata-status.warning {
  color: #ffe3b0;
}

.device-metadata-status.muted {
  color: #ffb3b3;
}

.device-dns-entry {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 92, 92, 0.22);
  background: rgba(18, 0, 0, 0.42);
  min-width: 0;
  max-width: 100%;
}

.alerts-entry {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 92, 92, 0.22);
  background: rgba(18, 0, 0, 0.42);
  min-width: 0;
  max-width: 100%;
}

.device-dns-time {
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ff9d9d;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.alerts-time {
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ff9d9d;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.device-dns-domain {
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #fff;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.alerts-device {
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #fff;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.device-dns-resolver {
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  font-size: 0.64rem;
  line-height: 1.4;
  color: #ff8b8b;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.alerts-title {
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  font-size: 0.64rem;
  line-height: 1.4;
  color: #ffb1b1;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.alerts-detail {
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  font-size: 0.66rem;
  line-height: 1.45;
  color: #ff8b8b;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.device-dns-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  padding: 16px;
  border: 1px dashed rgba(255, 92, 92, 0.28);
  color: #ff8f8f;
  text-align: center;
  font-size: 0.72rem;
  line-height: 1.45;
}

.alerts-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  padding: 16px;
  border: 1px dashed rgba(255, 92, 92, 0.28);
  color: #ff8f8f;
  text-align: center;
  font-size: 0.72rem;
  line-height: 1.45;
}

.ai-analyst-page {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  --ai-copy-font: 'Avenir Next', 'Segoe UI', 'Helvetica Neue', 'Nimbus Sans', Arial, sans-serif;
  --ai-code-font:
    'SFMono-Regular', 'SF Mono', 'Cascadia Mono', 'Consolas', 'Liberation Mono', monospace;
}

.ai-analyst-expand-toggle {
  appearance: none;
  border: 1px solid rgba(255, 132, 132, 0.42);
  background: linear-gradient(180deg, rgba(86, 0, 0, 0.9) 0%, rgba(28, 0, 0, 0.96) 100%);
  color: #fff2f2;
  font: inherit;
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 8px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    border-color 120ms ease,
    background 120ms ease,
    transform 120ms ease,
    box-shadow 120ms ease;
}

.ai-analyst-expand-toggle:hover,
.ai-analyst-expand-toggle:focus-visible {
  border-color: rgba(255, 196, 196, 0.72);
  background: linear-gradient(180deg, rgba(118, 0, 0, 0.94) 0%, rgba(40, 0, 0, 0.98) 100%);
  outline: none;
  transform: translateY(-1px);
}

.ai-analyst-expand-toggle.is-expanded {
  border-color: rgba(255, 204, 136, 0.52);
  background: linear-gradient(180deg, rgba(116, 36, 0, 0.94) 0%, rgba(46, 12, 0, 0.98) 100%);
  color: #ffe5c5;
}

.ai-analyst-status {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.ai-analyst-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 92, 92, 0.28);
  background: rgba(34, 0, 0, 0.42);
  color: #ffd0d0;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

.ai-analyst-pill.subtle {
  color: #ff9d9d;
}

.ai-analyst-pill.is-online {
  border-color: rgba(96, 255, 146, 0.4);
  color: #d5ffe2;
  background: rgba(0, 48, 18, 0.42);
}

.ai-analyst-pill.is-degraded {
  border-color: rgba(255, 182, 79, 0.4);
  color: #ffe8bf;
  background: rgba(52, 28, 0, 0.42);
}

.ai-analyst-pill.is-offline {
  border-color: rgba(255, 92, 92, 0.28);
  color: #ffd0d0;
  background: rgba(34, 0, 0, 0.42);
}

.ai-analyst-meta {
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  font-family: var(--ai-copy-font);
  font-size: 0.74rem;
  line-height: 1.56;
  letter-spacing: 0.01em;
  color: #ff9a9a;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  text-rendering: optimizeLegibility;
}

.ai-analyst-log {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.ai-analyst-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  padding: 16px;
  border: 1px dashed rgba(255, 92, 92, 0.28);
  color: #ff9191;
  text-align: center;
  font-size: 0.72rem;
  line-height: 1.5;
}

.ai-analyst-entry {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 13px;
  border: 1px solid rgba(255, 92, 92, 0.22);
  background: rgba(18, 0, 0, 0.42);
  min-width: 0;
  max-width: 100%;
}

.ai-analyst-entry.user {
  border-color: rgba(255, 148, 72, 0.26);
  background: rgba(36, 12, 0, 0.42);
}

.ai-analyst-entry.pending {
  opacity: 0.82;
}

.ai-analyst-entry-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
  min-width: 0;
}

.ai-analyst-entry-role {
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffb4b4;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

.ai-analyst-entry.user .ai-analyst-entry-role {
  color: #ffd2a8;
}

.ai-analyst-entry-time {
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  color: #ff8f8f;
  text-transform: uppercase;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

.ai-analyst-entry-body {
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  font-family: var(--ai-copy-font);
  font-size: clamp(0.8rem, 0.76rem + 0.16vw, 0.92rem);
  line-height: 1.72;
  letter-spacing: 0.005em;
  font-weight: 400;
  color: #fff;
  white-space: normal;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.ai-analyst-entry-body.is-plain {
  white-space: pre-wrap;
}

.ai-md-block {
  display: block;
  margin-bottom: 12px;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: normal;
}

.ai-md-block:last-child {
  margin-bottom: 0;
}

.ai-md-heading {
  color: #fff2f2;
  font-family: 'Share Tech Mono', monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.45;
}

.ai-md-h1 {
  font-size: 0.92rem;
}

.ai-md-h2 {
  font-size: 0.86rem;
}

.ai-md-h3,
.ai-md-h4,
.ai-md-h5,
.ai-md-h6 {
  font-size: 0.79rem;
}

.ai-md-paragraph {
  color: #fff;
}

.ai-md-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-md-list-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-width: 0;
}

.ai-md-list-marker {
  color: #ffb1b1;
  min-width: 18px;
  text-align: right;
  line-height: 1.7;
}

.ai-md-list-item-content {
  min-width: 0;
  color: #fff;
  line-height: 1.64;
}

.ai-md-quote {
  border-left: 2px solid rgba(255, 132, 132, 0.56);
  padding: 9px 0 9px 13px;
  color: #ffd2d2;
  background: rgba(42, 0, 0, 0.28);
}

.ai-md-code-block {
  border: 1px solid rgba(255, 92, 92, 0.2);
  background: rgba(8, 0, 0, 0.82);
  overflow: hidden;
}

.ai-md-code-lang {
  padding: 6px 10px 0;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.56rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ffadad;
}

.ai-md-pre {
  margin: 0;
  padding: 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-family: var(--ai-code-font);
  font-size: 0.72rem;
  line-height: 1.58;
  color: #ffe6e6;
  background: rgba(0, 0, 0, 0.16);
}

.ai-md-inline-code {
  display: inline;
  padding: 1px 5px;
  border: 1px solid rgba(255, 132, 132, 0.26);
  background: rgba(30, 0, 0, 0.72);
  color: #ffe0e0;
  font-family: var(--ai-code-font);
  font-size: 0.82em;
  line-height: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  vertical-align: baseline;
}

.ai-md-link {
  color: #ffd6a4;
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.ai-md-rule {
  height: 1px;
  background: linear-gradient(
    90deg,
    rgba(255, 92, 92, 0.08) 0%,
    rgba(255, 122, 122, 0.72) 50%,
    rgba(255, 92, 92, 0.08) 100%
  );
}

.ai-analyst-entry-body strong {
  color: #fff6f6;
}

.ai-analyst-entry-body em {
  color: #ffd5d5;
  font-style: italic;
}

.ai-analyst-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  min-width: 0;
}

.ai-analyst-composer textarea {
  width: 100%;
  min-height: 64px;
  max-height: 120px;
  resize: vertical;
  border: 1px solid rgba(255, 92, 92, 0.28);
  background: rgba(16, 0, 0, 0.92);
  color: #fff6f0;
  -webkit-text-fill-color: #fff6f0;
  caret-color: #ffd7c4;
  font-family: var(--ai-copy-font);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.01em;
  padding: 10px 11px;
  outline: none;
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  text-rendering: optimizeLegibility;
  text-shadow: 0 0 6px rgba(255, 244, 236, 0.12);
  opacity: 1;
}

.ai-analyst-composer textarea::placeholder {
  color: #cf8b8b;
  -webkit-text-fill-color: #cf8b8b;
  opacity: 1;
}

.ai-analyst-composer textarea:focus {
  border-color: rgba(255, 132, 132, 0.58);
  box-shadow:
    0 0 0 1px rgba(255, 132, 132, 0.18),
    inset 0 0 18px rgba(255, 76, 76, 0.06);
}

.ai-analyst-composer button {
  appearance: none;
  border: 1px solid rgba(255, 132, 132, 0.5);
  background: linear-gradient(180deg, rgba(108, 0, 0, 0.92) 0%, rgba(42, 0, 0, 0.98) 100%);
  color: #fff;
  font: inherit;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 10px 12px;
  cursor: pointer;
  min-width: 72px;
  transition:
    border-color 120ms ease,
    transform 120ms ease,
    background 120ms ease;
}

.ai-analyst-composer button:hover,
.ai-analyst-composer button:focus-visible {
  border-color: rgba(255, 188, 188, 0.72);
  background: linear-gradient(180deg, rgba(142, 0, 0, 0.96) 0%, rgba(56, 0, 0, 0.98) 100%);
  outline: none;
  transform: translateY(-1px);
}

.ai-analyst-composer button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.main-area.ai-analyst-expanded .topology {
  display: none;
}

.main-area.ai-analyst-expanded .right-sidebar {
  grid-column: 1 / -1;
  grid-row: 2;
}

.main-area.ai-analyst-expanded .sidebar-tabs-panel {
  height: 100%;
  padding: 14px 16px;
}

.main-area.ai-analyst-expanded .sidebar-tab-strip {
  gap: 6px;
  margin-bottom: 14px;
}

.main-area.ai-analyst-expanded .sidebar-page.is-active {
  gap: 14px;
}

.main-area.ai-analyst-expanded .ai-analyst-page {
  padding-right: 4px;
}

.main-area.ai-analyst-expanded .ai-analyst-status {
  gap: 8px;
}

.main-area.ai-analyst-expanded .ai-analyst-meta {
  font-size: 0.8rem;
  line-height: 1.64;
}

.main-area.ai-analyst-expanded .ai-analyst-log {
  gap: 10px;
  padding-right: 6px;
}

.main-area.ai-analyst-expanded .ai-analyst-entry {
  gap: 10px;
  padding: 14px 16px;
}

.main-area.ai-analyst-expanded .ai-analyst-entry-body {
  font-size: clamp(0.86rem, 0.8rem + 0.18vw, 1rem);
  line-height: 1.78;
}

.main-area.ai-analyst-expanded .ai-analyst-composer {
  gap: 10px;
}

.main-area.ai-analyst-expanded .ai-analyst-composer textarea {
  min-height: 84px;
  max-height: 220px;
}

.main-area.ai-analyst-expanded .ai-analyst-composer button {
  min-width: 104px;
}

/* Bottom panels */
.bottom-panels {
  grid-column: 1;
  grid-row: 3;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.health-panel {
  overflow: hidden;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

.health-panel .panel-title {
  margin-bottom: 8px;
}

.health-panel.is-warning,
.health-panel.is-checking {
  border-color: rgba(255, 194, 121, 0.42);
  box-shadow: 0 0 22px rgba(255, 153, 52, 0.11);
}

.health-panel.is-critical {
  border-color: rgba(255, 112, 112, 0.46);
  box-shadow: 0 0 24px rgba(255, 74, 74, 0.15);
}

.health-checks {
  position: relative;
  margin-top: 6px;
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.health-checks.is-transitioning {
  pointer-events: none;
}

@media (max-width: 760px), (pointer: coarse) and (max-width: 1024px) {
  html,
  body {
    overflow: hidden;
  }

  #glitch-target {
    position: fixed;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    border-radius: 0;
  }

  .sidebar-deco {
    flex: 0 0 auto;
    min-height: 156px;
    max-height: 34dvh;
    border-right: 0;
    border-bottom: 1px solid var(--red);
  }

  .deco-header {
    padding: 9px 12px;
    font-size: 1.05rem;
    letter-spacing: 2.6px;
  }

  .deco-body {
    padding: 8px 10px;
  }

  .deco-device.portfolio-project,
  .deco-device.portfolio-experience {
    min-height: 36px;
    font-size: 0.68rem;
  }

  .main-area {
    flex: 1 0 auto;
    width: 100%;
    height: auto;
    min-height: 720px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(240px, 34dvh) minmax(250px, auto) auto;
    gap: 8px;
    padding: 8px;
  }

  .header {
    flex-direction: column;
    min-height: 84px;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
  }

  .header-traffic-mini {
    width: 100%;
    margin-right: 0;
  }

  .header-traffic-mini-row {
    width: 100%;
  }

  .header-traffic-mini-graph {
    flex: 1 1 100%;
    width: 100%;
    height: 34px;
  }

  .header-stats {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 7px;
    font-size: 0.62rem;
  }

  .badge,
  .health-status-pill {
    font-size: 0.58rem;
  }

  .topology {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    min-height: 240px;
  }

  .right-sidebar {
    grid-column: 1;
    grid-row: 3;
    min-height: 250px;
  }

  .about-panel {
    padding: 13px;
  }

  .about-panel-title {
    font-size: 0.78rem;
  }

  .about-panel-copy {
    max-height: 210px;
    font-size: 0.72rem;
  }

  .bottom-panels {
    grid-column: 1;
    grid-row: 4;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
}

.health-carousel-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffb48f;
}

.health-carousel-indicator {
  color: #fff0df;
}

.health-carousel-hint {
  color: #ffb48f;
}

.health-carousel-stage {
  position: relative;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.health-carousel-item {
  position: absolute;
  inset: 0;
  transition:
    transform 320ms ease,
    opacity 320ms ease;
}

.health-carousel-item.is-current {
  transform: translateX(0);
  opacity: 1;
}

.health-carousel-item.is-incoming {
  opacity: 0.92;
}

.health-carousel-stage.is-next .health-carousel-item.is-incoming {
  transform: translateX(100%);
}

.health-carousel-stage.is-previous .health-carousel-item.is-incoming {
  transform: translateX(-100%);
}

.health-carousel-stage.is-next.is-animating .health-carousel-item.is-current {
  transform: translateX(-100%);
  opacity: 0.16;
}

.health-carousel-stage.is-next.is-animating .health-carousel-item.is-incoming {
  transform: translateX(0);
  opacity: 1;
}

.health-carousel-stage.is-previous.is-animating .health-carousel-item.is-current {
  transform: translateX(100%);
  opacity: 0.16;
}

.health-carousel-stage.is-previous.is-animating .health-carousel-item.is-incoming {
  transform: translateX(0);
  opacity: 1;
}

.health-check {
  border: 1px solid rgba(255, 128, 128, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 44, 44, 0.04), rgba(0, 0, 0, 0.04)), rgba(31, 8, 8, 0.46);
  padding: 8px 10px;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.health-check.is-healthy {
  border-color: rgba(100, 255, 162, 0.18);
  background:
    linear-gradient(180deg, rgba(33, 135, 71, 0.08), rgba(0, 0, 0, 0.04)), rgba(13, 28, 18, 0.5);
}

.health-check.is-warning,
.health-check.is-checking {
  border-color: rgba(255, 194, 121, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 149, 44, 0.09), rgba(0, 0, 0, 0.04)), rgba(33, 18, 9, 0.5);
}

.health-check.is-critical {
  border-color: rgba(255, 112, 112, 0.26);
  background:
    linear-gradient(180deg, rgba(176, 43, 43, 0.14), rgba(0, 0, 0, 0.04)), rgba(36, 10, 10, 0.56);
}

.health-check-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.health-check-label {
  font-size: 0.66rem;
  font-weight: bold;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff2f2;
}

.health-check-value {
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffd7b7;
  text-align: right;
}

.health-check-detail {
  margin-top: 6px;
  font-size: 0.67rem;
  line-height: 1.5;
  color: #ffcbc0;
}

.health-check-remediation {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 182, 151, 0.14);
  font-size: 0.64rem;
  line-height: 1.5;
  color: #ffe0b8;
  user-select: text;
}

.traffic-bar {
  height: 30px;
  margin-top: 7px;
  border-bottom: 1px solid var(--red);
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 10px,
    rgba(255, 0, 0, 0.14) 10px,
    rgba(255, 0, 0, 0.14) 12px
  );
  position: relative;
  overflow: hidden;
}

.traffic-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, rgba(255, 42, 42, 0.65), rgba(255, 135, 60, 0.75));
  box-shadow: 0 0 14px rgba(255, 42, 42, 0.45);
  transition: width 220ms ease;
}

.traffic-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.62rem;
  color: #ff9b9b;
  letter-spacing: 0.08em;
}

.traffic-legend .grow {
  margin-left: auto;
  color: #ffd5a0;
}

.traffic-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 5px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  vertical-align: -1px;
}

.traffic-swatch.inbound {
  background: rgba(255, 76, 76, 0.72);
  box-shadow: 0 0 8px rgba(255, 76, 76, 0.25);
}

.traffic-swatch.outbound {
  background: rgba(255, 179, 82, 0.76);
  box-shadow: 0 0 8px rgba(255, 179, 82, 0.25);
}

.traffic-graph {
  position: relative;
  height: 108px;
  margin-top: 8px;
  border: 1px solid rgba(255, 51, 51, 0.35);
  background:
    linear-gradient(180deg, rgba(255, 30, 30, 0.06), rgba(0, 0, 0, 0.08)),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 18px,
      rgba(255, 42, 42, 0.08) 18px,
      rgba(255, 42, 42, 0.08) 19px
    ),
    repeating-linear-gradient(
      180deg,
      transparent,
      transparent 22px,
      rgba(255, 42, 42, 0.08) 22px,
      rgba(255, 42, 42, 0.08) 23px
    );
  overflow: hidden;
}

.traffic-graph svg {
  display: block;
  width: 100%;
  height: 100%;
}

.traffic-graph-empty {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 0.66rem;
  color: #ff8a8a;
  letter-spacing: 0.08em;
}

.packet-text {
  font-size: 0.66rem;
  line-height: 1.55;
  color: #ff6060;
  overflow: hidden;
  flex: 1;
}

.runner-controls {
  display: grid;
  grid-template-columns: repeat(2, 72px);
  gap: 14px;
  flex: 1 1 auto;
  justify-content: center;
  align-content: center;
  align-items: center;
}

.runner-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.runner-button {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  max-width: 72px;
  height: 72px;
  aspect-ratio: 1;
  border: 1px solid #ffd8d8;
  background: #9a2121;
  background-color: #9a2121;
  background-image: none;
  color: #ffffff;
  box-shadow:
    0 0 16px rgba(255, 36, 36, 0.34),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background-color 120ms ease,
    box-shadow 120ms ease;
  text-align: center;
}

.runner-button:hover,
.runner-button:focus-visible {
  transform: translateY(-1px);
  border-color: #ffffff;
  background-color: #d22828;
  outline: none;
}

.runner-button.is-on {
  border-color: #e6ffe9;
  background: #068d33;
  background-color: #05832f;
  background-image: none;
  color: #ffffff;
  box-shadow:
    0 0 18px rgba(72, 255, 138, 0.42),
    inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.runner-button.is-on:hover,
.runner-button.is-on:focus-visible {
  background-color: #0ce755;
}

.runner-button.is-disabled {
  opacity: 0.58;
  cursor: not-allowed;
  border-color: rgba(255, 216, 216, 0.55);
  background-color: #651616;
  box-shadow:
    0 0 10px rgba(255, 36, 36, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.runner-button.is-disabled:hover,
.runner-button.is-disabled:focus-visible {
  transform: none;
  border-color: rgba(255, 216, 216, 0.55);
  background-color: #651616;
}

.runner-button.is-pending {
  opacity: 0.82;
  cursor: wait;
}

.runner-button:disabled {
  cursor: wait;
}

.runner-label {
  font-size: 0.62rem;
  font-weight: bold;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #ffffff;
  text-align: center;
  line-height: 1.1;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.46);
}

.contact-controls {
  display: grid;
  grid-template-columns: repeat(3, 72px);
  gap: 12px;
  flex: 1 1 auto;
  justify-content: center;
  align-content: center;
  align-items: center;
}

.contact-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.contact-button {
  width: 72px;
  height: 72px;
  border: 1px solid #ffd8d8;
  background: #9a2121;
  color: #ffffff;
  box-shadow:
    0 0 16px rgba(255, 36, 36, 0.34),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 1rem;
  font-weight: bold;
  letter-spacing: 0.08em;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background-color 120ms ease,
    box-shadow 120ms ease;
}

.contact-button:hover,
.contact-button:focus-visible {
  transform: translateY(-1px);
  border-color: #ffffff;
  background-color: #d22828;
  outline: none;
}

.contact-button--green {
  border-color: #e6ffe9;
  background: #068d33;
  background-color: #05832f;
  background-image: none;
  color: #ffffff;
  box-shadow:
    0 0 18px rgba(72, 255, 138, 0.42),
    inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.contact-button--green:hover,
.contact-button--green:focus-visible {
  background-color: #0ce755;
}

.contact-label {
  font-size: 0.62rem;
  font-weight: bold;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #ffffff;
  text-align: center;
  line-height: 1.1;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.46);
}

/* In-app FX controls (non-overlay) */
.fx-controls {
  display: grid;
  gap: 8px;
  max-height: 38vh;
  padding-right: 4px;
}

.fx-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.66rem;
  color: #aa4444;
}

.fx-row label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 8px;
}

.fx-row .val {
  color: #ff6b6b;
  min-width: 44px;
  text-align: right;
}

.fx-controls input[type='range'] {
  width: 100%;
  accent-color: var(--red);
  cursor: pointer;
}

.fx-controls input[type='checkbox'] {
  accent-color: var(--red);
  cursor: pointer;
}

.fx-controls select {
  width: 100%;
  background: rgba(8, 0, 0, 0.9);
  border: 1px solid rgba(74, 0, 0, 0.8);
  color: var(--red);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.68rem;
  padding: 3px 6px;
  cursor: pointer;
  outline: none;
}

.sidebar-tab {
  appearance: none;
  flex: 1 1 0;
  min-width: 0;
  border: 1px solid rgba(255, 82, 82, 0.4);
  border-bottom: none;
  background: linear-gradient(180deg, rgba(72, 0, 0, 0.88) 0%, rgba(24, 0, 0, 0.96) 100%);
  color: #ff9a9a;
  font: inherit;
  font-size: 0.54rem;
  /* ← down from 0.62rem */
  letter-spacing: 0.04em;
  /* ← down from 0.12em */
  text-transform: uppercase;
  padding: 8px 6px 7px;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  box-shadow: inset 0 0 8px rgba(255, 48, 48, 0.1);
  transition:
    color 120ms ease,
    border-color 120ms ease,
    background 120ms ease,
    transform 120ms ease;
  text-align: center;
  line-height: 1.15;
  white-space: nowrap;
  /* ← key fix: no wrapping */
  overflow: hidden;
  text-overflow: ellipsis;
}

.browser-session-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  background: rgba(8, 0, 0, 0.62);
  backdrop-filter: blur(12px);
  transition:
    opacity 180ms ease,
    visibility 180ms ease;
}

body.browser-session-authenticated .browser-session-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.browser-session-panel {
  width: min(520px, 100%);
  display: grid;
  gap: 12px;
  padding: 24px;
  border: 1px solid rgba(255, 86, 86, 0.34);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(37, 0, 0, 0.96) 0%, rgba(10, 0, 0, 0.98) 100%),
    radial-gradient(circle at top left, rgba(255, 70, 70, 0.08), transparent 42%);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.48),
    inset 0 0 24px rgba(255, 60, 60, 0.08);
}

.browser-session-kicker {
  margin: 0;
  color: #ff9d9d;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.browser-session-title {
  margin: 0;
  color: #fff7f7;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  letter-spacing: 0.04em;
}

.browser-session-copy,
.browser-session-user,
.browser-session-status {
  color: #f0b0b0;
  line-height: 1.5;
}

.browser-session-state {
  color: #fff;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.browser-session-form {
  display: grid;
  gap: 10px;
}

.browser-session-label {
  color: #ffb7b7;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.browser-session-hint {
  color: #ffd6b7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: none;
}

.browser-session-input {
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 86, 86, 0.32);
  border-radius: 12px;
  background: rgba(24, 0, 0, 0.9);
  color: #fff;
  font: inherit;
  font-size: 0.92rem;
  outline: none;
}

.browser-session-input:focus {
  border-color: rgba(255, 140, 140, 0.72);
  box-shadow: 0 0 0 3px rgba(255, 76, 76, 0.16);
}

.browser-session-submit,
.browser-session-button {
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 90, 90, 0.4);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(116, 0, 0, 0.96) 0%, rgba(58, 0, 0, 0.98) 100%);
  color: #fff4f4;
  font: inherit;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.browser-session-submit:hover,
.browser-session-submit:focus-visible,
.browser-session-button:hover,
.browser-session-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 162, 162, 0.64);
  box-shadow: 0 0 18px rgba(255, 64, 64, 0.18);
  outline: none;
}

.browser-session-status.is-warn {
  color: #ffd2d2;
}

.browser-session-button {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 70;
  min-height: 40px;
  padding-inline: 14px;
}
