:root {
  --bg: #0a0a0b;
  --surface: #131316;
  --surface2: #1a1a1e;
  --border: #222;
  --text: #e5e5e5;
  --muted: #888;
  --primary: #8ab4f8;
  --primary-dim: #6fa8ff;
  --critical: #ff4155;
  --high: #ff8c3a;
  --important: #ffc83a;
  --medium: #5cb3ff;
  --low: #7ad47a;
  --mono: ui-monospace, "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Topbar */
.topbar {
  display: flex; align-items: center;
  padding: 0 1.5rem; height: 56px;
  background: #0d0d10; border-bottom: 1px solid var(--border);
  gap: 2rem;
}
.brand {
  font-size: 1.5rem; font-weight: 200; letter-spacing: -0.03em;
  color: #fff;
}
.brand span { color: var(--primary); font-weight: 300; }
.topbar nav { display: flex; gap: 0.5rem; }
.topbar nav a {
  color: var(--muted); padding: 0.4rem 0.85rem;
  text-decoration: none; font-size: 0.9rem; border-radius: 6px;
  cursor: pointer; transition: background 0.1s;
}
.topbar nav a:hover { background: var(--surface); color: var(--text); }
.topbar nav a.active { background: var(--surface); color: var(--text); }
.host-info {
  margin-left: auto; color: var(--muted); font-size: 0.82rem;
  font-family: var(--mono);
}

/* Main */
main {
  max-width: 1400px; margin: 2rem auto; padding: 0 2rem;
}
.page-title {
  font-size: 1.4rem; font-weight: 400; letter-spacing: -0.01em;
  margin-bottom: 0.3rem;
}
.page-sub { color: var(--muted); margin-bottom: 1.5rem; font-size: 0.9rem; }

/* Cards & grid */
.grid { display: grid; gap: 1rem; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 1.2rem 1.4rem;
}
.card h3 {
  font-size: 0.78rem; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 0.5rem;
}
.card .big {
  font-size: 2.2rem; font-weight: 300; letter-spacing: -0.02em;
}
.card .hint { color: var(--muted); font-size: 0.82rem; margin-top: 0.2rem; }

.card.critical .big { color: var(--critical); }
.card.high .big { color: var(--high); }
.card.important .big { color: var(--important); }
.card.medium .big { color: var(--medium); }
.card.low .big { color: var(--low); }

/* Tables */
.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
}
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead th {
  text-align: left; padding: 0.7rem 1rem; border-bottom: 1px solid var(--border);
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em;
  font-size: 0.7rem; font-weight: 600;
}
tbody td { padding: 0.7rem 1rem; border-bottom: 1px solid #1a1a1e; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface2); }

td.num { font-variant-numeric: tabular-nums; color: #bbb; font-family: var(--mono); }
td.mono { font-family: var(--mono); font-size: 0.85rem; }

/* Buttons */
button {
  border: 1px solid var(--border); background: var(--surface2);
  color: var(--text); padding: 0.45rem 0.9rem; border-radius: 6px;
  font: inherit; cursor: pointer; font-size: 0.85rem;
  transition: background 0.1s, border-color 0.1s;
}
button:hover { background: var(--surface); border-color: #333; }
button.primary {
  background: var(--primary); color: #000; border-color: var(--primary);
  font-weight: 600;
}
button.primary:hover { background: var(--primary-dim); border-color: var(--primary-dim); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { color: var(--text); background: var(--surface2); }
button.danger { border-color: #5a1f1f; background: #2a1010; color: #ff8080; }
button.danger:hover { background: #3a1818; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Severity badges */
.sev { display: inline-block; padding: 0.15em 0.55em; border-radius: 3px;
       font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em;
       font-weight: 600; }
.sev-critical { background: var(--critical); color: #fff; }
.sev-high { background: var(--high); color: #000; }
.sev-important { background: var(--important); color: #000; }
.sev-medium { background: var(--medium); color: #000; }
.sev-low { background: var(--low); color: #000; }
.sev-unknown { background: #444; color: #fff; }

/* Risk pills */
.risk { display: inline-block; padding: 0.15em 0.55em; border-radius: 3px;
        font-size: 0.72rem; text-transform: uppercase; font-weight: 600;
        letter-spacing: 0.08em; }
.risk-low { background: #1a3d24; color: #7ad47a; }
.risk-medium { background: #3d3a1a; color: #ffc83a; }
.risk-high { background: #3d2a1a; color: #ff8c3a; }
.risk-manual { background: #1a1a3d; color: #8ab4f8; }

/* Plan group row */
.plan-row .impact { font-weight: 600; color: #fff; }
.plan-row td .findings-mini { color: var(--muted); font-size: 0.75rem; font-family: var(--mono); }

/* Login */
.login-box {
  max-width: 420px; margin: 6rem auto; padding: 2rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  text-align: center;
}
.login-box h2 { font-weight: 300; margin-bottom: 1.2rem; }
.login-box input {
  width: 100%; padding: 0.65rem 0.9rem; font: inherit;
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; margin-bottom: 1rem; font-family: var(--mono); font-size: 0.85rem;
}
.login-box .error { color: var(--critical); margin-top: 0.8rem; font-size: 0.85rem; }

/* Modal */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal.hidden { display: none; }
.modal-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; width: 720px; max-width: 95vw; max-height: 90vh;
  display: flex; flex-direction: column;
}
.modal-head {
  padding: 1rem 1.5rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h2 { font-size: 1.1rem; font-weight: 500; }
.modal-body { padding: 1.2rem 1.5rem; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 1rem 1.5rem; border-top: 1px solid var(--border);
  display: flex; gap: 0.6rem; justify-content: flex-end;
}

.fix-meta {
  display: flex; gap: 1.5rem; margin-bottom: 1rem; color: var(--muted);
  font-size: 0.85rem;
}
.fix-meta b { color: var(--text); }
.fix-summary {
  background: var(--surface2); border-radius: 6px; padding: 1rem;
  font-size: 0.85rem; color: #bbb; max-height: 180px; overflow-y: auto;
  font-family: var(--mono); line-height: 1.5;
}
.fix-summary .cmd { display: block; margin-bottom: 0.3rem; }
.fix-summary .cmd::before { content: "$ "; color: var(--primary); }

/* Progress bar */
.progress-bar {
  height: 8px; background: var(--surface2); border-radius: 4px;
  overflow: hidden; margin: 0.8rem 0 0.3rem;
}
.progress-bar > div {
  height: 100%; background: linear-gradient(90deg, var(--primary-dim), var(--primary));
  transition: width 0.2s ease-out;
}
.progress-label {
  display: flex; justify-content: space-between; font-size: 0.78rem;
  color: var(--muted); font-family: var(--mono); margin-bottom: 0.6rem;
}
.progress-label span:first-child { color: var(--primary); font-weight: 600; }
.fix-log {
  background: #050506; border: 1px solid var(--border); border-radius: 6px;
  padding: 0.8rem; font-family: var(--mono); font-size: 0.78rem;
  max-height: 300px; overflow-y: auto; white-space: pre-wrap; color: #ccc;
}
.fix-log .ok { color: var(--low); }
.fix-log .fail { color: var(--critical); }
.fix-log .cmd { color: var(--primary); }

#fix-result {
  padding: 1.2rem; border-radius: 8px; margin-top: 0.8rem;
  background: var(--surface2); text-align: center;
}
#fix-result.success { border: 1px solid #1a3d24; color: var(--low); }
#fix-result.failed { border: 1px solid #5a1f1f; color: var(--critical); }
#fix-result .big-mark { font-size: 2.5rem; display: block; }

/* Toast */
#toast {
  position: fixed; top: 80px; right: 24px;
  display: flex; flex-direction: column; gap: 0.5rem; z-index: 200;
}
.toast {
  background: var(--surface); border: 1px solid var(--border);
  padding: 0.6rem 0.9rem; border-radius: 6px; color: var(--text);
  font-size: 0.85rem; min-width: 260px;
  animation: slide-in 0.2s ease-out;
}
.toast.error { border-color: #5a1f1f; color: #ff8080; }
.toast.success { border-color: #1a3d24; color: var(--low); }
@keyframes slide-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* Misc */
.hidden { display: none !important; }
.row { display: flex; gap: 0.6rem; align-items: center; }
.spacer { flex: 1; }
.muted { color: var(--muted); font-size: 0.85rem; }
code {
  font-family: var(--mono); font-size: 0.85rem;
  background: var(--surface2); padding: 0.08rem 0.4rem; border-radius: 3px;
}
