:root {
  --bg: #0b0c0e;
  --surface: #14161a;
  --surface2: #1c1f26;
  --border: #2e333d;
  --text: #e6e4e2;
  --muted: #8b909a;
  --accent: #b33a3a;
  --accent-dim: #7a2828;
  --ok: #4caf82;
  --warn: #c9a24a;
  --bad: #e85c5c;
  --font: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --mono: Consolas, "Cascadia Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(179, 58, 58, 0.14), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(122, 40, 40, 0.08), transparent);
}

.header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}

.header h1 {
  margin: 0;
  font-size: 1.35rem;
  color: var(--accent);
  font-family: var(--mono);
}

.tagline {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.setup-menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem 2rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.panel-body { padding: 1rem; }

.drawer-panel.collapsed { display: none; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.03em;
}

.btn:hover { border-color: var(--accent-dim); color: var(--accent); }
.btn-primary { background: rgba(179, 58, 58, 0.15); border-color: var(--accent-dim); color: var(--accent); }
.btn-secondary { background: var(--surface2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface2); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.75rem; }
.btn.on, .toggle-btn.on { border-color: var(--accent); color: var(--accent); background: rgba(179, 58, 58, 0.12); }
.btn:disabled, .toggle-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.toggle-group { display: flex; flex-wrap: wrap; gap: 0; }
.toggle-group .toggle-btn { border-radius: 0; margin: 0; }
.toggle-group .toggle-btn:first-child { border-radius: 6px 0 0 6px; }
.toggle-group .toggle-btn:last-child { border-radius: 0 6px 6px 0; }
.toggle-group .toggle-btn + .toggle-btn { border-left: none; }

.field-disabled { opacity: 0.45; pointer-events: none; }

.input, .textarea {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #070c16;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
}

.textarea { resize: vertical; min-height: 4rem; }
.input:focus, .textarea:focus { outline: none; border-color: var(--accent); }

.field-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.field { margin-bottom: 0.75rem; }
.field:last-child { margin-bottom: 0; }

.hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.5rem 0 0;
}

.msg {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}
.msg.ok { background: rgba(76, 175, 130, 0.12); border: 1px solid rgba(76, 175, 130, 0.35); color: var(--ok); }
.msg.warn { background: rgba(201, 162, 74, 0.12); border: 1px solid rgba(201, 162, 74, 0.35); color: var(--warn); }
.msg.bad { background: rgba(232, 92, 92, 0.12); border: 1px solid rgba(232, 92, 92, 0.35); color: var(--bad); }

.switch-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  user-select: none;
}

.switch {
  width: 36px;
  height: 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  position: relative;
  flex-shrink: 0;
}
.switch.on { background: rgba(179, 58, 58, 0.2); border-color: var(--accent); }
.switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
  transition: left 0.15s;
}
.switch.on .switch-knob { left: 19px; background: var(--accent); }

.range-val { font-family: var(--mono); color: var(--accent); font-size: 0.85rem; }

.mod-row {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(46, 51, 61, 0.5);
  font-size: 0.85rem;
}
.mod-row:last-child { border-bottom: none; }
.mod-label { color: var(--muted); }
.mod-val { font-family: var(--mono); color: var(--accent); }

.rig-size {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.65rem;
}

.plan-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.plan-table th {
  text-align: left;
  padding: 0.5rem 0.6rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.plan-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid rgba(46, 51, 61, 0.5);
  vertical-align: middle;
}
.plan-table tr:hover td { background: rgba(179, 58, 58, 0.04); }
.plan-table tr.row-done td { background: rgba(76, 175, 130, 0.1); opacity: 0.82; }
.plan-table tr.row-unknown td:first-child { border-left: 2px solid var(--warn); }
.plan-table tr.row-warn td { color: var(--warn); }

.plan-table .num { text-align: right; font-family: var(--mono); white-space: nowrap; }

.override-input {
  width: 5.5rem;
  padding: 0.2rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #070c16;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-weight: 700;
}
.badge.warn { background: rgba(201, 162, 74, 0.15); color: var(--warn); border: 1px solid rgba(201, 162, 74, 0.35); }
.badge.ok { background: rgba(76, 175, 130, 0.15); color: var(--ok); border: 1px solid rgba(76, 175, 130, 0.35); }

.totals-block {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: baseline;
}

.empty-state {
  text-align: center;
  padding: 1.5rem;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 8px;
  margin: 1rem;
}

.sk-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  background: #070c16;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8rem;
}
.sk-item label { flex: 1; color: var(--muted); }
.sk-val { font-family: var(--mono); color: var(--accent); min-width: 1rem; text-align: right; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.text-warn { color: var(--warn); }
.text-ok { color: var(--ok); }
.text-accent { color: var(--accent); }
