:root {
  --bg: #14171c;
  --panel: #1a1e25;
  --panel-2: #21262f;
  --line: #2d343f;
  --text: #dfe4ec;
  --muted: #8f9bad;
  --accent: #4da3ff;
  --accent-dim: #2b6cb0;
  --ok: #58c98a;
  --warn: #e8b04b;
  --err: #ef6b6b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 13px/1.45 "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
header h1 { font-size: 15px; margin: 0; font-weight: 600; letter-spacing: .2px; }
header .sub { margin: 0; color: var(--muted); font-size: 12px; }
.status { margin-left: auto; color: var(--muted); font-size: 12px; }
.status.busy { color: var(--accent); }
.status.err  { color: var(--err); }
.status.ok   { color: var(--ok); }

/* ---------------------------------------------------------- tabs */
.tabs {
  display: flex;
  gap: 2px;
  padding: 0 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 9px 16px;
  font: inherit;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

main { flex: 1; min-height: 0; display: flex; }
.page { display: none; flex: 1; min-height: 0; overflow-y: auto; }
.page.active { display: block; }
.pageInner { padding: 18px 22px 60px; }
.pageInner.narrow { max-width: 560px; }

h2 { font-size: 13px; margin: 0 0 4px; font-weight: 600; }
h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); margin: 0 0 8px; font-weight: 600;
}
.mt { margin-top: 22px; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 14px; max-width: 720px; }

.rowBar { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }

button {
  font: inherit; cursor: pointer; border-radius: 4px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 6px 12px;
}
button:hover { border-color: var(--accent-dim); }
button.primary { background: var(--accent-dim); border-color: var(--accent-dim); }
button.primary:hover { background: var(--accent); }
button.primary:disabled { opacity: .5; cursor: default; background: var(--panel-2); }
button.ghost { padding: 4px 10px; font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------- tables */
table.grid { border-collapse: collapse; width: 100%; font-size: 12px; }
table.grid th {
  text-align: left; font-weight: 600; color: var(--muted);
  border-bottom: 1px solid var(--line); padding: 7px 10px; white-space: nowrap;
  font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
}
table.grid td { padding: 6px 10px; border-bottom: 1px solid var(--panel-2); }
table.grid tr:hover td { background: var(--panel); }
table.grid td.mono, table.grid td .mono {
  font-family: ui-monospace, Consolas, monospace; font-size: 12px;
}
th.tick, td.tick { width: 30px; }
.bcList { color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 11px; }
.tag {
  display: inline-block; padding: 1px 6px; border-radius: 3px;
  background: var(--panel-2); border: 1px solid var(--line);
  font-size: 11px; color: var(--muted);
}
.tag.ok { color: var(--ok); border-color: #2f5c44; }
.tag.warn { color: var(--warn); border-color: #6b5423; }
.tag.err { color: var(--err); border-color: #6d3434; }

.matGrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px; max-width: 900px;
}
.matGrid div {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 4px; padding: 7px 10px;
}
.matGrid span { display: block; color: var(--muted); font-size: 11px; }
.matGrid b { font-weight: 600; font-family: ui-monospace, Consolas, monospace; }

/* ---------------------------------------------------------- fields */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 4px; }
.field input, select {
  width: 100%; padding: 6px 9px; border-radius: 4px;
  border: 1px solid var(--line); background: var(--panel-2);
  color: var(--text); font: inherit;
}
.field input:focus, select:focus { outline: none; border-color: var(--accent-dim); }
.field em { display: block; color: var(--muted); font-size: 11px; font-style: normal; margin-top: 3px; }
.check { display: flex; align-items: center; gap: 7px; color: var(--muted); }

.progressWrap { margin-top: 18px; }
.progressBar { height: 5px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.progressFill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.log {
  margin-top: 14px; padding: 10px; border-radius: 4px; white-space: pre-wrap;
  background: #241a1a; border: 1px solid #6d3434; color: #f0b4b4;
  font-family: ui-monospace, Consolas, monospace; font-size: 11px;
}

/* ---------------------------------------------------------- results */
.resultsLayout { display: flex; height: 100%; min-height: 0; }
.side {
  width: 250px; flex: none; overflow-y: auto; padding: 16px;
  background: var(--panel); border-right: 1px solid var(--line);
}
.seriesList { display: flex; flex-direction: column; gap: 4px; }
.seriesRow {
  display: flex; align-items: center; gap: 8px; padding: 4px 6px;
  border-radius: 4px; cursor: pointer;
}
.seriesRow:hover { background: var(--panel-2); }
.swatch { width: 11px; height: 11px; border-radius: 2px; flex: none; }
.seriesRow span { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
/* Segmented buttons for the solver choice. A row of buttons rather than a
   dropdown because the third option is not a faster way to do the same thing:
   it runs a different constitutive model, and that should be visible without
   opening a menu. */
.choiceRow { display: flex; flex-wrap: wrap; gap: 4px; }
.choiceRow .choice {
  padding: 5px 12px; font-size: 12px; color: var(--muted);
}
.choiceRow .choice.on {
  background: var(--accent-dim); border-color: var(--accent-dim); color: #fff;
}
/* The VUMAT option gets the warning colour rather than the accent, because
   picking it changes the physics and not just the speed. */
.choiceRow .choice.warnOn {
  background: var(--warn); border-color: var(--warn); color: #1a1a1a;
}
.choiceRow .choice:disabled { opacity: 0.4; cursor: not-allowed; }

.compRow { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.compRow button {
  padding: 3px 9px; font-size: 12px; color: var(--muted);
  font-family: ui-monospace, Consolas, monospace;
}
.compRow button.on { background: var(--accent-dim); border-color: var(--accent-dim); color: #fff; }

.plotArea { flex: 1; min-width: 0; overflow-y: auto; padding: 16px 20px 50px; }
#plot svg { display: block; width: 100%; height: auto; }
.empty { color: var(--muted); padding: 60px 0; text-align: center; }
table.summary { margin-top: 18px; }

/* ---------------------------------------------------------- warnings */
.warnBox {
  margin-bottom: 14px; padding: 10px 12px; border-radius: 4px;
  background: #2a2415; border: 1px solid #6b5423; color: #f0d9a4;
  font-size: 12px;
}
.warnBox.bad { background: #2a1a1a; border-color: #6d3434; color: #f0b4b4; }
.warnBox b { font-family: ui-monospace, Consolas, monospace; }
.warnBox ul { margin: 6px 0 0; padding-left: 18px; }
.warnBox li { margin: 2px 0; }
.dim { color: var(--muted); font-size: 11px; }
