/* ════════════════════════════════════════════════════════
   FaultWall Control Plane — terminal-native theme
   Matches faultwall.com: IBM Plex, phosphor green, grid bg
════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg: #0c0e0c;
  --grid: rgba(140,180,140,0.05);
  --line: rgba(190,220,190,0.14);
  --panel: rgba(0,0,0,0.35);
  --panel-2: rgba(0,0,0,0.5);
  --fg: #dce5dc;
  --muted: rgba(220,229,220,0.45);
  --accent: #4ae56a;
  --accent-dim: rgba(74,229,106,0.12);
  --blue: #5ea2ff;
  --green: #4ae56a;
  --red: #ff4b4b;
  --yellow: #e5c84a;
  --mono: 'IBM Plex Mono', 'SF Mono', Menlo, monospace;
  --sans: 'IBM Plex Sans', -apple-system, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
}
::selection { background: var(--accent); color: var(--bg); }

/* ── Top nav: status bar ── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 28px;
  background: rgba(12,14,12,0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 13px;
}
.brand { font-weight: 600; font-size: 14px; letter-spacing: 0.02em; display: flex; align-items: center; gap: 10px; }
.brand span { color: var(--accent); }
.brand-logo { height: 24px; width: auto; display: block; }
.spacer { flex: 1; }
.muted { color: var(--muted); }

.wrap { max-width: 980px; margin: 0 auto; padding: 40px 20px 60px; position: relative; z-index: 1; }

/* ── Cards: hairline panels, square corners ── */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 28px;
  margin-bottom: 18px;
  transition: border-color 0.25s var(--ease);
}
.card:hover { border-color: rgba(190,220,190,0.28); }

/* Auth card */
#authView {
  max-width: 440px; margin: 60px auto;
  padding: 40px 36px;
}
.auth-logo { height: 44px; width: auto; display: block; margin-bottom: 16px; }

h1 {
  font-family: var(--sans);
  font-size: clamp(24px, 4vw, 30px); font-weight: 700;
  letter-spacing: -0.025em; margin: 0 0 8px; line-height: 1.15;
}
h2 { font-family: var(--sans); font-size: 16px; font-weight: 700; margin: 0 0 12px; letter-spacing: -0.01em; }

.field { margin: 14px 0; }
label { display: block; font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
input {
  width: 100%; padding: 11px 14px; border-radius: 0;
  border: 1px solid var(--line); background: var(--panel-2);
  color: var(--fg); font-size: 14px; font-family: var(--mono);
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

.row { display: flex; gap: 12px; margin-top: 18px; }

/* ── Buttons: solid green primary, hollow secondary ── */
button {
  padding: 11px 22px; border-radius: 0; cursor: pointer;
  font-family: var(--mono); font-size: 13.5px; font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  border: 1px solid var(--accent);
  box-shadow: none;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
button:hover { background: transparent; color: var(--accent); }
button.secondary {
  background: transparent; color: var(--fg);
  border: 1px solid var(--line);
}
button.secondary:hover { border-color: var(--accent); color: var(--accent); background: transparent; }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button.ghost:hover { color: var(--fg); border-color: rgba(190,220,190,0.3); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } }

.codeblock {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 0;
  padding: 16px; overflow-x: auto; font-family: var(--mono);
  font-size: 12.5px; color: var(--accent); white-space: pre-wrap; word-break: break-all;
}

.kv div { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 13px; }
.kv div:last-child { border-bottom: none; }
.kv b { color: var(--muted); font-weight: 500; }

/* ── Stats ── */
.stats { display: flex; gap: 14px; flex-wrap: wrap; }
.stat {
  text-align: left; flex: 1; min-width: 90px;
  padding: 16px; border-radius: 0;
  background: var(--panel-2); border: 1px solid var(--line);
}
.stat .num {
  font-family: var(--sans);
  font-size: 28px; font-weight: 700; letter-spacing: -0.02em;
  color: var(--accent);
}
.stat .lbl { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 6px; }
.stat.block .num { color: var(--red); }
.stat.flag .num { color: var(--yellow); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 11px; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.06em; }
td { font-family: var(--mono); font-size: 12.5px; }

.msg { min-height: 18px; font-size: 13px; margin-top: 10px; font-family: var(--mono); }
.msg.err { color: var(--red); }
.msg.ok { color: var(--green); }
.foot { text-align: center; padding: 28px; font-size: 12px; font-family: var(--mono); position: relative; z-index: 1; }

.pill { padding: 2px 10px; border-radius: 0; font-family: var(--mono); font-size: 11px; font-weight: 600; border: 1px solid transparent; }
.pill.on { background: var(--accent-dim); color: var(--green); border-color: rgba(74,229,106,0.3); }
.pill.off { background: rgba(255,75,75,.1); color: var(--red); border-color: rgba(255,75,75,0.3); }
.pill.auto { background: rgba(94,162,255,.1); color: var(--blue); border-color: rgba(94,162,255,0.3); }

/* APA review queue */
.apa-item { border: 1px solid var(--line); border-radius: 0; padding: 16px; margin-bottom: 14px; background: var(--panel-2); }
.apa-item:last-child { margin-bottom: 0; }
.apa-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.apa-head .muted { font-size: 12px; font-family: var(--mono); }
.codeblock.diff { color: var(--fg); max-height: 280px; overflow-y: auto; white-space: pre; }
.apa-actions { margin-top: 12px; }

/* Automation toggle */
.toggle-row { display: flex; align-items: center; gap: 12px; margin: 6px 0 16px; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 0; transition: background .15s, border-color .15s;
}
.slider::before {
  content: ""; position: absolute; height: 16px; width: 16px; left: 4px; top: 4px;
  background: var(--muted); border-radius: 0; transition: transform .15s, background .15s;
}
.switch input:checked + .slider { background: var(--accent-dim); border-color: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); background: var(--accent); }

code { background: var(--accent-dim); border: none; border-radius: 0; padding: 1px 6px; font-family: var(--mono); font-size: 12px; color: var(--accent); }
