:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --ink: #1d1d1f;
  --muted: #6b6b70;
  --line: #e3e1dc;
  --accent: #2f6fdb;
  --accent-ink: #ffffff;
  --range: #cfdcf5;
  --tick: #1f4fa3;
  --error: #b42318;
  --warn: #9a6700;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141416; --surface: #1d1d20; --ink: #ececee; --muted: #9a9aa2; --line: #2e2e33;
    --accent: #5b8ff0; --accent-ink: #0b0b0d; --range: #27406e; --tick: #9cbcff; --error: #ff8a80; --warn: #e3b341;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141416; --surface: #1d1d20; --ink: #ececee; --muted: #9a9aa2; --line: #2e2e33;
  --accent: #5b8ff0; --accent-ink: #0b0b0d; --range: #27406e; --tick: #9cbcff; --error: #ff8a80; --warn: #e3b341;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
h1 { font-size: 20px; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 6px; }
button, input, select { font: inherit; color: inherit; }
input, select {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 0;
}
button {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 14px; cursor: pointer;
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); }
button:disabled { opacity: 0.5; cursor: default; }
label { display: inline-flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); }
label.inline { flex-direction: row; align-items: center; gap: 6px; }
.muted { color: var(--muted); font-size: 13px; }
.note { color: var(--muted); font-size: 13px; max-width: 70ch; }
.lede { margin: 0 0 12px; color: var(--muted); }
.error { color: var(--error); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.top {
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 14px max(16px, calc((100% - 1200px) / 2)) 0;
  display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; align-items: end;
}
.pickers { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 600px) {
  .top { grid-template-columns: 1fr; }
  .pickers label:first-child { flex: 1; }
  .pickers select { max-width: none; width: 100%; }
}
.pickers select { min-width: 0; max-width: 60vw; }
.tabs { grid-column: 1 / -1; display: flex; gap: 4px; overflow-x: auto; }
.tabs button {
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 12px;
  color: var(--muted); white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

main { padding: 18px max(16px, calc((100% - 1200px) / 2)) 40px; }
.scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: 0; }
td small { display: block; color: var(--muted); font-size: 12px; }
.machines td:first-child { min-width: 180px; }
.range-col { width: 40%; min-width: 160px; }
.range { position: relative; height: 18px; }
.range .band { position: absolute; top: 5px; height: 8px; background: var(--range); border-radius: 4px; }
.range .tick { position: absolute; top: 1px; width: 3px; height: 16px; margin-left: -1px; background: var(--tick); border-radius: 2px; }
.tag { font-size: 11px; color: var(--warn); }
h2.section { font-size: 17px; margin: 28px 0 4px; }

.builder { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 20px; align-items: start; }
@media (max-width: 760px) { .builder { grid-template-columns: 1fr; } }
.pick { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.pick-head { display: flex; justify-content: space-between; align-items: baseline; }
.pick-tools { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 4px 0 8px; font-size: 13px; }
.pick-list { list-style: none; margin: 0; padding: 0; max-height: 55vh; overflow-y: auto; border-top: 1px solid var(--line); }
.pick-list li label {
  display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; color: var(--ink);
  font-size: 14px; padding: 6px 2px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.pick-list .time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.extra { display: flex; gap: 6px; margin-top: 10px; }
.extra input { flex: 1; }
.chips { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 13px; display: flex; gap: 4px; align-items: center; }
.chips button { border: 0; background: none; padding: 0 6px; color: var(--muted); }

.bank-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 14px; }
.bank-form input { width: 110px; }
.banks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.bank { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.bank-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.bank-head b { font-variant-numeric: tabular-nums; font-size: 17px; }
.bank-bar { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; display: flex; margin-bottom: 8px; }
.bank-bar span { background: var(--accent); border-right: 2px solid var(--surface); }
.bank-bar span:nth-child(2n) { background: var(--tick); }
.bank ul { list-style: none; margin: 0; padding: 0; }
.bank li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 14px; }
.bank li .time { font-variant-numeric: tabular-nums; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; max-width: 720px; }
.card p { margin: 0 0 10px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.row input:not([type="date"]) { flex: 1; min-width: 140px; }
.row label select { max-width: 280px; }
.merged { list-style: none; margin: 10px 0 0; padding: 0; font-size: 14px; }
.merged li, .suggestion { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--line); }
.suggestion { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
.job ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.removed th, .removed td { padding: 8px 10px; }
.actions { font-size: 12px; margin-top: 2px; }
.actions button { font-size: 12px; }
.merge-machines { margin-top: 28px; max-width: none; }
