:root {
  --bg: #0b1220;
  --bg-2: #121a2b;
  --panel: #172033;
  --panel-2: #1c2740;
  --line: #2a3754;
  --text: #e8eef7;
  --muted: #93a0b8;
  --amber: #f5a623;
  --amber-dim: #8a5a12;
  --green: #34d399;
  --red: #f87171;
  --blue: #60a5fa;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

.app-shell { min-height: 100%; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(12px + var(--safe-t)) 16px 12px;
  background: linear-gradient(180deg, #10182a, #0b1220);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand img { width: 36px; height: 36px; }
.brand h1 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.brand small { display: block; color: var(--muted); font-size: 11px; letter-spacing: 0.08em; }
.topbar .spacer { flex: 1; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--muted);
}
.chip.live { color: var(--green); }
.chip.warn { color: var(--amber); }

.nav {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.nav button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  white-space: nowrap;
}
.nav button.active {
  background: var(--amber);
  color: #1a1204;
  border-color: var(--amber);
  font-weight: 700;
}

.page { padding: 16px; padding-bottom: calc(28px + var(--safe-b)); max-width: 1200px; margin: 0 auto; width: 100%; }
.page h2 { margin: 0 0 4px; font-size: 24px; }
.lede { color: var(--muted); margin: 0 0 18px; }

.grid { display: grid; gap: 12px; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid.two { grid-template-columns: 1.1fr 0.9fr; }
.grid.stats { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 8px; font-size: 16px; }
.stat { font-size: 28px; font-weight: 800; }
.stat span { display: block; color: var(--muted); font-size: 12px; font-weight: 500; margin-top: 4px; }

.job {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.job .meta { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tag {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  background: #243049;
  color: var(--muted);
}
.tag.ready { background: #143324; color: var(--green); }
.tag.run { background: #3a2a0a; color: var(--amber); }
.tag.done { background: #1b2a44; color: var(--blue); }
.tag.high { background: #3a1515; color: var(--red); }

.btn {
  border: 0;
  background: var(--amber);
  color: #1a1204;
  font-weight: 700;
  border-radius: 14px;
  padding: 12px 16px;
  min-height: 48px;
}
.btn.secondary { background: #243049; color: var(--text); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: #7f1d1d; color: #fecaca; }
.btn.good { background: #065f46; color: #d1fae5; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.login {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 400px at 10% -10%, #2a1d08 0%, transparent 50%),
    radial-gradient(700px 400px at 100% 0%, #12203c 0%, transparent 45%),
    var(--bg);
}
.login-card { width: min(520px, 100%); }
.login-card h1 { margin: 8px 0 4px; }
.staff-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}
.staff-pick button {
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.staff-pick button .role { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.staff-pick button.selected { border-color: var(--amber); box-shadow: 0 0 0 2px var(--amber-dim); }

.field { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.field label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.field input, .field select, .field textarea {
  background: #0e1626;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  width: 100%;
}
.field textarea { min-height: 90px; resize: vertical; }

.step-hero { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.timer {
  font-variant-numeric: tabular-nums;
  font-size: 34px;
  font-weight: 800;
  color: var(--amber);
  letter-spacing: 0.04em;
}
.parts { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.parts li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #0e1626;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.parts input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--amber); }
.instructions {
  background: #0e1626;
  border-left: 4px solid var(--amber);
  padding: 14px;
  border-radius: 0 12px 12px 0;
  line-height: 1.45;
}

.timeline { display: grid; gap: 8px; }
.t-step {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: #0e1626;
  border: 1px solid var(--line);
}
.t-step.selected { border-color: var(--amber); }
button.t-step { font: inherit; }
  width: 14px; height: 14px; border-radius: 50%;
  background: #334155;
  justify-self: center;
}
.dot.done { background: var(--green); }
.dot.run { background: var(--amber); box-shadow: 0 0 0 6px rgba(245, 166, 35, 0.18); }
.dot.ready { background: var(--blue); }

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

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + var(--safe-b));
  transform: translateX(-50%);
  background: #0e1626;
  border: 1px solid var(--amber);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 12px;
  z-index: 50;
}

.modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: grid; place-items: end center;
  z-index: 40;
}
.modal {
  width: min(640px, 100%);
  background: var(--panel);
  border-radius: 20px 20px 0 0;
  padding: 18px 18px calc(18px + var(--safe-b));
  border: 1px solid var(--line);
  max-height: 92vh;
  overflow: auto;
}

.install-hint {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.pick { width: 100%; border-collapse: collapse; margin-top: 12px; }
.pick th, .pick td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.pick td:first-child { width: 28px; }
.pick-head { margin-top: 8px; display: grid; gap: 4px; }
@media print {
  body.printing-pick header,
  body.printing-pick nav,
  body.printing-pick .no-print,
  body.printing-pick #print-pick { display: none !important; }
  body.printing-pick,
  body.printing-pick #pick-sheet,
  body.printing-pick #pick-sheet * {
    background: #fff !important;
    color: #000 !important;
  }
  body.printing-pick #pick-sheet { border: none; box-shadow: none; }
}
.fit-list label { display: flex; gap: 10px; align-items: flex-start; }
.socket-row { display: grid; grid-template-columns: 72px 1fr 1fr 1.3fr auto; gap: 8px; margin-bottom: 8px; }
.socket-row input, .socket-row select { background: #0e1626; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
@media (max-width: 800px) {
  .socket-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .grid.two, .grid.stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .grid.stats, .staff-pick, .grid.two { grid-template-columns: 1fr; }
  .topbar { padding-right: 10px; }
  .brand h1 { font-size: 14px; }
}
