/* ============================================================
   GORGO COMMAND CENTER — Global Stylesheet
   Water Utility Cybersecurity Compliance Platform
   Version: 1.0.0
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Exo+2:wght@300;400;600;700;900&family=Inter:wght@400;500;600&display=swap');

/* ============================================================
   CSS CUSTOM PROPERTIES — Edit here for global theme changes
   ============================================================ */
:root {
  /* --- Core Backgrounds --- */
  --hud-bg:        #050d14;
  --hud-panel:     #07111a;
  --hud-panel2:    #091520;
  --hud-panel3:    #0a1825;
  --hud-surface:   #0c1e2d;

  /* --- Border Colors --- */
  --hud-border:    #0d3a52;
  --hud-border2:   #0e4a66;
  --hud-border3:   #0f5577;

  /* --- Brand Accent: Teal --- */
  --teal:          #00c8a8;
  --teal-dim:      #00a08a;
  --teal-dark:     #007a6a;
  --teal-glow:     rgba(0, 200, 168, 0.08);
  --teal-glow2:    rgba(0, 200, 168, 0.15);

  /* --- Status Colors --- */
  --amber:         #f5a623;
  --amber-dim:     #c47f10;
  --amber-glow:    rgba(245, 166, 35, 0.1);
  --red:           #e84040;
  --red-dim:       #a82020;
  --red-glow:      rgba(232, 64, 64, 0.1);
  --green:         #22dd88;
  --green-dim:     #18a865;
  --green-glow:    rgba(34, 221, 136, 0.1);
  --blue:          #2899d4;
  --blue-dim:      #1a6fa0;
  --blue-glow:     rgba(40, 153, 212, 0.1);

  /* --- Text Hierarchy --- */
  --text-primary:   #d4eaf5;
  --text-secondary: #6a9ab5;
  --text-dim:       #3a6a85;
  --text-ghost:     #1e4a62;

  /* --- Typography --- */
  --font-mono:      'Exo 2', 'Segoe UI', sans-serif; 
  --font-display:   'Inter', 'Segoe UI', sans-serif;
  --font-ui:        'Inter', 'Segoe UI', sans-serif;   /* buttons, pills, badges */
  --mono:           'Inter', 'Segoe UI', sans-serif; /* alias */
  --disp:           'Exo 2', 'Segoe UI', sans-serif;              /* alias */

  /* --- Layout --- */
  --topbar-height:  52px;
  --left-nav-width: 210px;
  --right-panel-width: 165px;

  /* --- Transitions --- */
  --t-fast:  0.12s ease;
  --t-med:   0.2s ease;
  --t-slow:  0.35s ease;

  /* --- Scanline Effect --- */
  --scanline: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 200, 168, 0.012) 2px,
    rgba(0, 200, 168, 0.012) 4px
  );

  /* --- Corner Bracket Size --- */
  --corner-size: 16px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--hud-bg);
}

body {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

input, textarea {
  font-family: inherit;
  outline: none;
}

::-webkit-scrollbar             { width: 3px; height: 3px; }
::-webkit-scrollbar-track       { background: var(--hud-bg); }
::-webkit-scrollbar-thumb       { background: var(--hud-border2); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--hud-border3); }

/* ============================================================
   HUD ROOT SHELL
   ============================================================ */
#hud-root {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--hud-bg);
  background-image: var(--scanline);
  position: relative;
  overflow: hidden;
}

/* Atmospheric gradient overlay */
#hud-root::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(0, 200, 168, 0.05) 0%, transparent 35%),
    linear-gradient(225deg, rgba(0, 200, 168, 0.02) 0%, transparent 25%);
  pointer-events: none;
  z-index: 0;
}

/* Scanline overlay — sits on top of everything */
.scanline-overlay {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 3px,
    rgba(0, 200, 168, 0.006) 3px,
    rgba(0, 200, 168, 0.006) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* ============================================================
   CORNER BRACKETS
   ============================================================ */
.corner-bracket {
  position: fixed;
  width: var(--corner-size);
  height: var(--corner-size);
  z-index: 1000;
}
.corner-bracket.tl { top: 0; left: 0;  border-top:    1px solid var(--teal); border-left:   1px solid var(--teal); }
.corner-bracket.tr { top: 0; right: 0; border-top:    1px solid var(--teal); border-right:  1px solid var(--teal); }
.corner-bracket.bl { bottom: 0; left: 0;  border-bottom: 1px solid var(--teal); border-left:   1px solid var(--teal); }
.corner-bracket.br { bottom: 0; right: 0; border-bottom: 1px solid var(--teal); border-right:  1px solid var(--teal); }

/* ============================================================
   TOP BAR
   ============================================================ */
#top-bar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--hud-border2);
  background: rgba(0, 200, 168, 0.03);
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}

#top-bar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--teal-dim) 40%, var(--teal) 50%, var(--teal-dim) 60%, transparent 100%);
}

/* Logo */
.logo-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-hex {
  width: 32px;
  height: 32px;
  position: relative;
}

.logo-text-block {
  line-height: 1.2;
}

.logo-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 4px;
  color: var(--teal);
  text-transform: uppercase;
}

.logo-tagline {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--text-dim);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* System Identity (center) */
.system-identity {
  text-align: center;
  line-height: 1.4;
}

.sys-name {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.sys-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

/* Top-right indicators */
.top-indicators {
  display: flex;
  align-items: center;
  gap: 14px;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--green);
  letter-spacing: 1px;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-dot 2.2s ease-in-out infinite;
}

.threat-badge {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 600;
  padding: 3px 10px;
  border: 1px solid var(--amber-dim);
  color: var(--amber);
  background: var(--amber-glow);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.topbar-btn {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 500;
  padding: 4px 12px;
  border: 1px solid var(--hud-border2);
  color: var(--text-secondary);
  background: transparent;
  letter-spacing: 1px;
  transition: all var(--t-fast);
  cursor: pointer;
}

.topbar-btn:hover {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--teal-glow);
}

.topbar-btn.active {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--teal-glow);
}

/* ============================================================
   MAIN BODY LAYOUT
   ============================================================ */
#main-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* ============================================================
   LEFT NAVIGATION
   ============================================================ */
#left-nav {
  width: var(--left-nav-width);
  background: var(--hud-panel);
  border-right: 1px solid var(--hud-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}

.nav-section {
  padding: 10px 0 4px;
  border-bottom: 1px solid var(--hud-border);
}

.nav-section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 2px;
  padding: 0 14px 6px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  cursor: pointer;
  transition: all var(--t-fast);
  border-left: 2px solid transparent;
  position: relative;
  user-select: none;
}

.nav-item:hover {
  background: var(--teal-glow);
}

.nav-item.active {
  border-left-color: var(--teal);
  background: rgba(0, 200, 168, 0.06);
}

.nav-item.active .nav-label {
  color: var(--teal);
}

.nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.nav-dot.green  { background: var(--green); }
.nav-dot.amber  { background: var(--amber); }
.nav-dot.red    { background: var(--red); box-shadow: 0 0 5px var(--red-dim); }
.nav-dot.blue   { background: var(--blue); }
.nav-dot.teal   { background: var(--teal); }
.nav-dot.dim    { background: var(--text-dim); }

.nav-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 400;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-badge {
  font-family: var(--font-mono);
  font-size: 8px;
  padding: 1px 5px;
  border-radius: 2px;
  flex-shrink: 0;
}

.nav-badge.red    { background: rgba(232,64,64,0.15);   color: var(--red);    border: 1px solid rgba(232,64,64,0.25); }
.nav-badge.amber  { background: rgba(245,166,35,0.12);  color: var(--amber);  border: 1px solid rgba(245,166,35,0.2); }
.nav-badge.green  { background: rgba(34,221,136,0.1);   color: var(--green);  border: 1px solid rgba(34,221,136,0.18); }
.nav-badge.blue   { background: rgba(40,153,212,0.12);  color: var(--blue);   border: 1px solid rgba(40,153,212,0.2); }
.nav-badge.dim    { background: rgba(58,106,133,0.12);  color: var(--text-dim); border: 1px solid rgba(58,106,133,0.15); }

/* ============================================================
   CENTER PANEL
   ============================================================ */
#center-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Overview strip */
.overview-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-bottom: 1px solid var(--hud-border);
  flex-shrink: 0;
}

.overview-cell {
  padding: 10px 14px;
  border-right: 1px solid var(--hud-border);
  cursor: pointer;
  transition: background var(--t-fast);
}

.overview-cell:last-child { border-right: none; }
.overview-cell:hover      { background: var(--teal-glow); }

.ov-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 1px;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.ov-number {
  font-family: var(--font-mono);
  font-size: 20px;
  line-height: 1.2;
  margin-bottom: 2px;
  font-weight: 400;
}

.ov-number.green { color: var(--green); }
.ov-number.amber { color: var(--amber); }
.ov-number.red   { color: var(--red); }
.ov-number.blue  { color: var(--blue); }
.ov-number.dim   { color: var(--text-dim); }
.ov-number.teal  { color: var(--teal); }

.ov-sub {
  font-size: 10px;
  color: var(--text-dim);
}

/* Progress bar */
.posture-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--hud-border);
  flex-shrink: 0;
}

.pb-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 1.5px;
  white-space: nowrap;
  text-transform: uppercase;
}

.pb-track {
  flex: 1;
  height: 4px;
  background: rgba(0, 200, 168, 0.08);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.pb-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal-dark), var(--teal));
  border-radius: 2px;
  position: relative;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.pb-fill::after {
  content: '';
  position: absolute;
  right: 0; top: -2px; bottom: -2px;
  width: 2px;
  background: #fff;
  opacity: 0.6;
  box-shadow: 0 0 6px var(--teal);
}

.pb-pct {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--teal);
  white-space: nowrap;
}

.pb-deadline {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* Table header */
.table-header {
  display: grid;
  grid-template-columns: 26px 1fr 110px 100px 72px 76px;
  padding: 5px 16px;
  border-bottom: 1px solid var(--hud-border);
  background: rgba(0, 200, 168, 0.02);
  flex-shrink: 0;
}

.th-col {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* Compliance rows */
#compliance-rows {
  flex: 1;
  overflow-y: auto;
}

.cat-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 4px;
  background: rgba(0, 200, 168, 0.015);
  border-bottom: 1px solid var(--hud-border);
  position: sticky;
  top: 0;
  z-index: 5;
}

.cgh-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 2px;
  white-space: nowrap;
  text-transform: uppercase;
}

.cgh-line {
  flex: 1;
  height: 1px;
  background: var(--hud-border);
}

.cgh-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
}

.comp-row {
  display: grid;
  grid-template-columns: 26px 1fr 110px 100px 72px 76px;
  padding: 7px 16px;
  border-bottom: 1px solid rgba(13, 58, 82, 0.4);
  cursor: pointer;
  transition: all var(--t-fast);
  align-items: center;
  animation: row-fade-in 0.2s ease both;
}

.comp-row:hover {
  background: var(--teal-glow);
}

.comp-row.selected {
  background: rgba(0, 200, 168, 0.07);
  border-left: 2px solid var(--teal);
  padding-left: 14px;
}

/* Status icon */
.status-icon {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.status-icon.green { background: rgba(34,221,136,0.2);  border: 1px solid var(--green); }
.status-icon.amber { background: rgba(245,166,35,0.15);  border: 1px solid var(--amber); }
.status-icon.red   { background: rgba(232,64,64,0.2);    border: 1px solid var(--red); box-shadow: 0 0 4px rgba(232,64,64,0.3); }
.status-icon.blue  { background: rgba(40,153,212,0.15);  border: 1px solid var(--blue); }
.status-icon.dim   { background: rgba(58,106,133,0.15);  border: 1px solid var(--text-dim); }

/* Row text */
.req-name {
  font-size: 11px;
  color: var(--text-primary);
  font-weight: 400;
  line-height: 1.3;
}

.req-sub {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 1px;
}

/* Deadline */
.deadline-val {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.3;
}

.deadline-val.urgent { color: var(--red); }
.deadline-val.soon   { color: var(--amber); }
.deadline-val.ok     { color: var(--text-secondary); }

/* Status pill */
.status-pill {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 2px;
  letter-spacing: 0.5px;
  display: inline-block;
  white-space: nowrap;
  text-transform: uppercase;
}

.sp-complete { background: rgba(34,221,136,0.08);   color: var(--green); border: 1px solid rgba(34,221,136,0.18); }
.sp-action   { background: rgba(232,64,64,0.08);    color: var(--red);   border: 1px solid rgba(232,64,64,0.18); }
.sp-review   { background: rgba(245,166,35,0.08);   color: var(--amber); border: 1px solid rgba(245,166,35,0.18); }
.sp-pending  { background: rgba(40,153,212,0.08);   color: var(--blue);  border: 1px solid rgba(40,153,212,0.18); }
.sp-na       { background: rgba(58,106,133,0.08);   color: var(--text-dim); border: 1px solid rgba(58,106,133,0.12); }

/* Risk bar */
.risk-bar { display: flex; gap: 2px; align-items: center; }
.rb-seg   { width: 9px; height: 9px; border-radius: 1px; }

/* Row action button */
.row-action-btn {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 2px;
  border: 1px solid var(--hud-border2);
  color: var(--teal-dim);
  background: transparent;
  transition: all var(--t-fast);
  letter-spacing: 0.5px;
  cursor: pointer;
  white-space: nowrap;
}

.row-action-btn:hover {
  background: var(--teal-glow);
  border-color: var(--teal);
  color: var(--teal);
}

/* Detail tray */
#detail-tray {
  border-top: 1px solid var(--hud-border2);
  background: var(--hud-panel2);
  padding: 10px 18px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  min-height: 88px;
  max-height: 130px;
  flex-shrink: 0;
  position: relative;
}

#detail-tray::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--teal-dark), transparent);
}

.dt-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 1.5px;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.dt-content {
  font-size: 10px;
  color: var(--text-secondary);
  line-height: 1.65;
}

.dt-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.dt-btn {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 500;
  padding: 3px 12px;
  border-radius: 2px;
  cursor: pointer;
  transition: all var(--t-fast);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.dt-btn.primary {
  border: 1px solid var(--teal-dim);
  color: var(--teal);
  background: var(--teal-glow);
}

.dt-btn.primary:hover {
  background: var(--teal-glow2);
  border-color: var(--teal);
}

.dt-btn.secondary {
  border: 1px solid var(--hud-border2);
  color: var(--text-secondary);
  background: transparent;
}

.dt-btn.secondary:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.dt-authority {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  white-space: pre-line;
  line-height: 1.6;
  min-width: 140px;
  text-align: right;
}

/* ============================================================
   RIGHT PANEL
   ============================================================ */
#right-panel {
  width: var(--right-panel-width);
  border-left: 1px solid var(--hud-border);
  background: var(--hud-panel);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}

.rp-section {
  padding: 10px 12px;
  border-bottom: 1px solid var(--hud-border);
  flex-shrink: 0;
}

.rp-title {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 2px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

/* Countdown items */
.countdown-item {
  margin-bottom: 9px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(13, 58, 82, 0.5);
}

.countdown-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.cd-name {
  font-size: 10px;
  color: var(--text-secondary);
  margin-bottom: 2px;
  line-height: 1.4;
}

.cd-days {
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.2;
  margin-bottom: 1px;
}

.cd-days.red   { color: var(--red); }
.cd-days.amber { color: var(--amber); }
.cd-days.green { color: var(--green); }

.cd-date {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
}

/* Mini gauges */
.mini-gauges {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mg-item { text-align: center; }

.mg-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.mg-ring-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  margin: 1 auto 3px;
}

.mg-ring-wrap svg { width: 52px; height: 52px; }

.mg-ring-text {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1;
}

/* Threat feed */
.threat-item {
  display: flex;
  gap: 7px;
  margin-bottom: 8px;
  align-items: flex-start;
}

.threat-item:last-child { margin-bottom: 0; }

.ti-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}

.ti-dot.red   { background: var(--red); }
.ti-dot.amber { background: var(--amber); }
.ti-dot.blue  { background: var(--blue); }

.ti-text { font-size: 9px; color: var(--text-secondary); line-height: 1.45; }
.ti-time { font-family: var(--font-mono); font-size: 8px; color: var(--text-dim); margin-top: 1px; }


/* ============================================================
   STATUS BAR (bottom)
   ============================================================ */
#status-bar {
  height: 22px;
  border-top: 1px solid var(--hud-border);
  background: var(--hud-panel);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  flex-shrink: 0;
  z-index: 10;
}

.sb-left, .sb-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sb-item {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.sb-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
}

.sb-dot.green { background: var(--green); }
.sb-dot.amber { background: var(--amber); }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 30px;
  right: 16px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toast {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 8px 14px;
  border-radius: 3px;
  border-left: 2px solid var(--teal);
  background: var(--hud-panel2);
  color: var(--text-secondary);
  animation: toast-in 0.2s ease both;
  max-width: 280px;
  line-height: 1.4;
}

.toast.error { border-left-color: var(--red); }
.toast.warn  { border-left-color: var(--amber); }

/* ============================================================
   MODAL OVERLAY
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 13, 20, 0.85);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.15s ease;
}

.modal-box {
  background: var(--hud-panel2);
  border: 1px solid var(--hud-border2);
  padding: 24px 28px;
  border-radius: 4px;
  min-width: 380px;
  max-width: 520px;
  position: relative;
}

.modal-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--teal), transparent);
}

.modal-title {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--teal);
  letter-spacing: 2px;
  margin-bottom: 14px;
  text-transform: uppercase;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.75); }
}

@keyframes row-fade-in {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40%           { transform: scale(1.1); opacity: 1; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(10px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes hud-boot {
  from { opacity: 0; filter: brightness(0.3); }
  to   { opacity: 1; filter: brightness(1); }
}

#hud-root {
  animation: hud-boot 0.6s ease both;
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.hidden   { display: none !important; }
.flex     { display: flex; }
.flex-col { flex-direction: column; }
.gap-2    { gap: 2px; }
.gap-4    { gap: 4px; }
.gap-8    { gap: 8px; }
.mt-4     { margin-top: 4px; }
.mt-8     { margin-top: 8px; }
.mono     { font-family: var(--font-mono); }
.text-teal    { color: var(--teal); }
.text-amber   { color: var(--amber); }
.text-red     { color: var(--red); }
.text-green   { color: var(--green); }
.text-dim     { color: var(--text-dim); }
.text-secondary { color: var(--text-secondary); }

/* ============================================================
   POPOUT OVERLAY SYSTEM
   ============================================================ */
#popout-overlay {
  position: absolute; /* fixed breaks when hud-root has filter:brightness() from hud-boot animation */
  inset: 0;
  background: rgba(5, 13, 20, 0.82);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.15s ease;
  padding: 20px;
}

/* ── CENTERED MODAL (no log data) ── */
#popout-modal {
  background: var(--hud-panel2);
  border: 1px solid var(--hud-border2);
  border-radius: 4px;
  width: 100%;
  max-width: 660px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  animation: modal-in 0.2s cubic-bezier(0.4,0,0.2,1);
}

#popout-modal::before, #popout-split::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--teal), transparent);
}

/* Corner brackets on modal */
#popout-modal::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 4px;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(0,200,168,0.06);
}

/* ── SPLIT SCREEN (has log data) ── */
#popout-split {
  background: var(--hud-panel2);
  border: 1px solid var(--hud-border2);
  border-radius: 4px;
  width: 100%;
  max-width: 1100px;
  height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  animation: modal-in 0.2s cubic-bezier(0.4,0,0.2,1);
}

/* ── SHARED HEADER ── */
.pop-header, .split-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--hud-border);
  flex-shrink: 0;
  gap: 12px;
}

.pop-header-left, .split-header-left {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.pop-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.pop-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.pop-sub {
  font-size: 9px;
  color: var(--text-dim);
  margin-top: 2px;
}

.pop-close-btn {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 500;
  padding: 3px 10px;
  border: 1px solid var(--hud-border2);
  color: var(--text-dim);
  background: transparent;
  cursor: pointer;
  transition: all var(--t-fast);
  letter-spacing: 1px;
  border-radius: 2px;
}

.pop-close-btn:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* ── META ROW ── */
.pop-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  padding: 10px 18px;
  border-bottom: 1px solid var(--hud-border);
  flex-shrink: 0;
}

.pop-meta-cell {
  min-width: 120px;
  flex: 1;
  padding-right: 16px;
}

.pop-meta-label {
  font-family: var(--font-mono);
  font-size: 7px;
  color: var(--text-dim);
  letter-spacing: 1.5px;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.pop-meta-val {
  font-size: 10px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── BODY ── */
.pop-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pop-section { display: flex; flex-direction: column; gap: 5px; }

.pop-section-label {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--text-dim);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.pop-detail-text {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ── FOOTER ── */
.pop-footer {
  border-top: 1px solid var(--hud-border);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 8px;
}

.pop-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.pop-gorgo-product {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
}

.pop-product-label { color: var(--text-dim); letter-spacing: 1px; }
.pop-product-name  { color: var(--teal); }

/* ── SPLIT BODY ── */
.split-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}

.split-left {
  border-right: 1px solid var(--hud-border);
  padding: 14px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.split-right {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.split-right-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--hud-border);
  flex-shrink: 0;
}

/* ── LOG TIMELINE ── */
.log-timeline {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.log-entry {
  display: flex;
  gap: 12px;
  padding-bottom: 14px;
  position: relative;
}

/* Vertical connector line */
.log-entry:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 12px;
  bottom: 0;
  width: 1px;
  background: var(--hud-border);
}

.log-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--teal-dark);
  border: 1px solid var(--teal-dim);
  flex-shrink: 0;
  margin-top: 3px;
  position: relative;
  z-index: 1;
}

.log-content { flex: 1; min-width: 0; }

.log-action {
  font-size: 10px;
  color: var(--text-primary);
  line-height: 1.55;
  margin-bottom: 3px;
}

.log-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.log-who  { font-family: var(--font-mono); font-size: 8px; color: var(--teal-dim); }
.log-date { font-family: var(--font-mono); font-size: 8px; color: var(--text-dim); }
.log-evidence { font-family: var(--font-mono); font-size: 8px; color: var(--blue); margin-top: 3px; display: block; }

/* ── ANIMATIONS ── */
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.97) translateY(-8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}
