:root {
  /* True triadic scheme from Electric Teal (174deg, +120deg, +240deg) */
  --teal: #10D4C2;
  --teal-dim: rgba(16, 212, 194, 0.16);
  --teal-glow: rgba(16, 212, 194, 0.35);

  --magenta: #D236E2;
  --magenta-dim: rgba(210, 54, 226, 0.16);
  --magenta-glow: rgba(210, 54, 226, 0.35);

  --gold: #D4C210;
  --gold-dim: rgba(212, 194, 16, 0.16);
  --gold-glow: rgba(212, 194, 16, 0.35);

  --danger: #F25573;
  --danger-dim: rgba(242, 85, 115, 0.16);

  --bg: #080C12;
  --surface: #0F1622;
  --surface-2: #152033;
  --border: #22324B;
  --text: #E6F0FA;
  --muted: #8FA3BF;
  --mono: ui-monospace, "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top right, rgba(210, 54, 226, 0.08), transparent 40%),
              radial-gradient(circle at top left, rgba(16, 212, 194, 0.08), transparent 45%),
              var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* Login */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--teal);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.brand-row h1 {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
}

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--magenta));
  box-shadow: 0 0 12px var(--teal-glow);
  flex-shrink: 0;
}

.muted {
  color: var(--muted);
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
}

.stack-md {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.field input,
.input-sm {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 0.6rem 0.75rem;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-sm {
  padding: 0.42rem 0.65rem;
  font-size: 0.85rem;
  min-width: 240px;
}

.field input:focus,
.input-sm:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px var(--teal-dim);
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.85rem;
}

.login-hint {
  margin: 1.25rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
}

/* Buttons */
.btn {
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0.5rem 0.95rem;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s, filter 0.15s, opacity 0.15s;
  color: var(--text);
  background: var(--surface-2);
}

.btn:hover:not(:disabled) {
  filter: brightness(1.1);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-full {
  width: 100%;
  padding: 0.65rem;
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
}

.btn-primary {
  background: var(--teal);
  color: #041312;
}

.btn-magenta {
  background: var(--magenta-dim);
  border-color: var(--magenta);
  color: #f3b5f9;
}

.btn-danger {
  background: var(--danger-dim);
  border-color: var(--danger);
  color: #ffb8c5;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.link-btn {
  background: none;
  border: none;
  color: var(--teal);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

/* App Shell */
.app-shell {
  max-width: 1380px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}

.topbar-left, .topbar-right, .power-controls, .user-chip, .brand-inline {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.brand-title {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.03em;
}

.meta-text {
  font-size: 0.82rem;
  color: var(--muted);
  font-family: var(--mono);
}

.status-badge {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.status-running {
  color: var(--teal);
  background: var(--teal-dim);
  border-color: var(--teal);
}

.status-starting, .status-stopping {
  color: var(--gold);
  background: var(--gold-dim);
  border-color: var(--gold);
}

.status-stopped {
  color: var(--muted);
  background: rgba(143, 163, 191, 0.12);
}

.status-crashed {
  color: var(--danger);
  background: var(--danger-dim);
  border-color: var(--danger);
}

.user-chip {
  padding-left: 0.75rem;
  border-left: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}

/* Metrics */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.85rem;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.accent-teal { border-top: 2px solid var(--teal); }
.accent-magenta { border-top: 2px solid var(--magenta); }
.accent-gold { border-top: 2px solid var(--gold); }

.metric-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-val {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
}

.metric-sub {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.bar-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 0.35s ease;
}

.fill-teal { background: var(--teal); box-shadow: 0 0 8px var(--teal-glow); }
.fill-magenta { background: var(--magenta); box-shadow: 0 0 8px var(--magenta-glow); }
.fill-gold { background: var(--gold); box-shadow: 0 0 8px var(--gold-glow); }

.core-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 18px;
}

.core-bar-col {
  flex: 1;
  background: var(--bg);
  border-radius: 2px;
  height: 100%;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.core-bar-fill {
  width: 100%;
  background: var(--teal);
  min-height: 2px;
  transition: height 0.35s ease;
}

/* Tabs */
.tabs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
  flex-wrap: wrap;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 0.5rem 0.95rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.tab-btn:hover {
  color: var(--text);
  background: var(--surface);
}

.tab-btn.active {
  color: var(--teal);
  background: var(--teal-dim);
  border-color: rgba(16, 212, 194, 0.4);
}

.pill {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.45rem;
  font-size: 0.72rem;
  border-radius: 999px;
  background: var(--magenta-dim);
  color: #f3b5f9;
  font-family: var(--mono);
}

.sse-indicator {
  margin-left: auto;
  font-size: 0.75rem;
  font-family: var(--mono);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.sse-on {
  color: var(--teal);
  background: var(--teal-dim);
}

.sse-off {
  color: var(--gold);
  background: var(--gold-dim);
}

/* Panels */
.tab-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.panel-toolbar, .mods-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.84rem;
  color: var(--muted);
  cursor: pointer;
}

/* Console */
.console-output {
  background: #05080D;
  border: 1px solid var(--border);
  border-radius: 8px;
  height: 480px;
  overflow-y: auto;
  padding: 0.7rem 0.85rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-line {
  padding: 0.05rem 0;
}

.log-ts {
  color: #556985;
  margin-right: 0.55rem;
  user-select: none;
}

.log-stdout { color: #d5e4f5; }
.log-stderr { color: #ff8ca3; }
.log-system { color: var(--gold); }
.log-stdin  { color: var(--teal); font-weight: 600; }

.console-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #05080D;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.45rem 0.35rem 0.75rem;
}

.console-input-row:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px var(--teal-dim);
}

.prompt-glyph {
  color: var(--teal);
  font-family: var(--mono);
  font-weight: 700;
}

.console-input-row input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.86rem;
  outline: none;
}

/* Banner & Dropzone */
.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  font-size: 0.85rem;
}

.banner-gold {
  background: var(--gold-dim);
  border: 1px solid var(--gold);
  color: #f4ea8d;
}

.override-toggle {
  color: #fff6a8;
  font-weight: 600;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 1.15rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: rgba(16, 212, 194, 0.03);
  transition: border-color 0.15s, background 0.15s;
}

.dropzone.dragover {
  border-color: var(--teal);
  background: var(--teal-dim);
}

.dropzone.locked {
  opacity: 0.55;
}

.dropzone-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.mods-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(34, 50, 75, 0.7);
}

.data-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table tr:hover td {
  background: rgba(16, 212, 194, 0.04);
}

.col-check { width: 36px; text-align: center; }
.col-actions { width: 170px; text-align: right; white-space: nowrap; }

.mod-title {
  font-weight: 600;
  color: var(--text);
}

.mod-sub {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.prop-key {
  font-family: var(--mono);
  color: var(--teal);
  width: 38%;
}

.prop-val {
  font-family: var(--mono);
  color: var(--text);
  word-break: break-all;
}

.empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 1.5rem !important;
}

/* Toasts */
.toast-container {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 1000;
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--teal);
  border-left: 4px solid var(--teal);
  color: var(--text);
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  font-size: 0.84rem;
  max-width: 380px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.toast.error {
  border-color: var(--danger);
  border-left-color: var(--danger);
}

.toast.warn {
  border-color: var(--gold);
  border-left-color: var(--gold);
}

/* Phase 2 Telemetry UI */
.pill-teal {
  background: var(--teal-dim);
  color: var(--teal);
}

.banner-teal {
  background: var(--teal-dim);
  border: 1px solid var(--teal);
  color: #b7fbf4;
}

.select-sm {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

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

.kpi-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.kpi-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.kpi-value {
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 700;
}

.kpi-sub {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
}

.text-teal { color: var(--teal); }
.text-magenta { color: #f089fb; }
.text-gold { color: var(--gold); }

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 0.85rem;
}

.chart-card {
  background: #080E17;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.chart-title {
  font-size: 0.84rem;
  font-weight: 600;
}

.chart-legend {
  display: flex;
  gap: 0.75rem;
  font-size: 0.74rem;
  color: var(--muted);
}

.leg-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-teal { background: var(--teal); }
.dot-magenta { background: var(--magenta); }
.dot-gold { background: var(--gold); }

.chart-body {
  width: 100%;
  min-height: 170px;
}

.chart-body svg {
  width: 100%;
  height: 175px;
  display: block;
}

.chart-empty {
  height: 170px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.section-head h3 {
  margin: 0;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}

.dim-badge {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.74rem;
  background: var(--teal-dim);
  color: var(--teal);
  border: 1px solid rgba(16, 212, 194, 0.35);
}

.dim-nether {
  background: var(--danger-dim);
  color: #ffb8c5;
  border-color: rgba(242, 85, 115, 0.4);
}

.dim-end {
  background: var(--magenta-dim);
  color: #f3b5f9;
  border-color: rgba(210, 54, 226, 0.4);
}

.impact-bar-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.impact-track {
  width: 90px;
  height: 6px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
  flex-shrink: 0;
}

.impact-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--magenta));
}

/* Phase 3 Security, 2FA & Backups */
.security-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 0.85rem;
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.input-xs {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 0.42rem 0.55rem;
  font-size: 0.85rem;
  width: 74px;
}

.qr-img {
  width: 190px;
  height: 190px;
  border-radius: 8px;
  background: #ffffff;
  padding: 6px;
  border: 2px solid var(--teal);
}

.btn-link-reset {
  text-decoration: none;
}

.mr-xs {
  margin-right: 0.35rem;
}



