/* CNC Router Speeds & Feeds Calculator
   Dark industrial theme. Colors live in the variables below. */

:root {
  color-scheme: dark;
  --bg: #12151a;
  --panel: #1b2028;
  --panel-alt: #222934;
  --line: #2f3846;
  --text: #e6ebf2;
  --muted: #8b97a8;
  --accent: #f59e0b;
  --good: #22c55e;
  --warn: #eab308;
  --bad: #ef4444;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
}

/* ---------- Page layout ---------- */

.wrap { max-width: 1180px; margin: 0 auto; padding: 16px; }
h1 { font-size: 20px; margin: 0 0 2px; }
.subtitle { color: var(--muted); margin-bottom: 14px; }
.footnote { color: var(--muted); font-size: 12px; margin-top: 10px; }

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: 14px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

@media (max-width: 820px) {
  .layout, .two-col { grid-template-columns: 1fr; }
}

/* ---------- Panels ---------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}
.panel + .panel { margin-top: 14px; }
.two-col .panel + .panel { margin-top: 0; }

.panel h2 {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 10px;
}

/* ---------- Form controls ---------- */

label { display: block; color: var(--muted); font-size: 12px; margin: 10px 0 4px; }

.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }

select,
input[type=number] {
  width: 100%;
  background: var(--panel-alt);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 8px;
  font-size: 14px;
}

input[type=range] { width: 100%; accent-color: var(--accent); }

.slider-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  margin: 12px 0 2px;
}
.slider-label b { color: var(--text); font-weight: 600; }

.segmented { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.segmented button {
  flex: 1;
  background: var(--panel-alt);
  color: var(--muted);
  border: 0;
  padding: 6px;
  cursor: pointer;
  font-size: 12px;
}
.segmented button.on { background: var(--accent); color: #111; font-weight: 700; }
.segmented.spaced { margin-top: 6px; }

.checkbox-row { display: flex; gap: 8px; align-items: center; margin-top: 12px; color: var(--text); }

/* ---------- Readout cards ---------- */

.readouts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 560px) { .readouts { grid-template-columns: repeat(2, 1fr); } }

.card { background: var(--panel-alt); border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.card .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.card .value { font-size: 24px; font-weight: 700; margin-top: 2px; }
.card .unit { font-size: 12px; color: var(--muted); font-weight: 400; }
.card.hero { border-color: var(--accent); }
.card.hero .value { color: var(--accent); font-size: 30px; }

/* Status bars under the load and deflection readouts */
.bar { height: 10px; background: #0c0f13; border-radius: 6px; position: relative; margin-top: 8px; overflow: hidden; }
.bar .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; transition: width 0.15s; }
.bar .limit-mark { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: #ffffff55; }

/* ---------- Badges ---------- */

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.badge { font-size: 12px; padding: 4px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-alt); }
.badge.warn { border-color: var(--warn); color: var(--warn); }
.badge.bad { border-color: var(--bad); color: var(--bad); }
.badge.ok { border-color: var(--good); color: var(--good); }

/* ---------- Diagram, detail table, advice ---------- */

svg { width: 100%; height: auto; display: block; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
td { padding: 4px 0; border-bottom: 1px solid var(--line); }
td:last-child { text-align: right; font-variant-numeric: tabular-nums; }

.advice { margin-top: 14px; border-left: 3px solid var(--accent); }
.advice ul { margin: 6px 0 0; padding-left: 18px; }
.advice li { margin: 5px 0; }
