:root {
  --bg: #f4f6f9; --card: #ffffff; --ink: #1c2430; --muted: #5d6b7c; --line: #dde3ea;
  --accent: #1f4e78; --accent-ink: #ffffff; --good: #1e7b45; --warn: #a15c00; --bad: #b3261e; --soft: #fdf1e6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161c; --card: #1b2129; --ink: #e6ebf1; --muted: #9aa7b6; --line: #2c3540;
    --accent: #6ea8dc; --accent-ink: #0d1117; --good: #5cc98a; --warn: #e3a64f; --bad: #f08a80; --soft: #2a2218;
  }
}
:root[data-theme="dark"] {
  --bg: #12161c; --card: #1b2129; --ink: #e6ebf1; --muted: #9aa7b6; --line: #2c3540;
  --accent: #6ea8dc; --accent-ink: #0d1117; --good: #5cc98a; --warn: #e3a64f; --bad: #f08a80; --soft: #2a2218;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
header { background: var(--card); border-bottom: 1px solid var(--line); padding: 18px 0; margin-bottom: 20px; }
h1 { margin: 0; font-size: 22px; }
h2 { margin: 0 0 8px; font-size: 17px; }
h3 { margin: 22px 0 6px; font-size: 15px; }
.sub, .hint { color: var(--muted); margin: 4px 0 10px; }
.hint { font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 18px; }
.hidden { display: none !important; }
.drop { display: block; border: 2px dashed var(--line); border-radius: 10px; padding: 28px 12px; text-align: center;
  color: var(--muted); cursor: pointer; }
.drop.over { border-color: var(--accent); color: var(--ink); }
.drop input { display: none; }
.chosen { list-style: none; padding: 0; margin: 10px 0; }
.chosen li { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tag { font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.tag.ok { color: var(--good); } .tag.bad { color: var(--bad); }
button, .btn { display: inline-block; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px;
  padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
button:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.downloads { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.step { font-weight: 600; }
.step.running::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%;
  border: 2px solid var(--accent); border-right-color: transparent; animation: spin .8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
.error { color: var(--bad); margin-top: 10px; white-space: pre-wrap; }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-top: 12px; }
.total { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.total .k { color: var(--muted); font-size: 13px; }
.total .v { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.total .d { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.blocks { display: flex; gap: 10px; flex-wrap: wrap; }
.blocks .tag { font-size: 13px; padding: 4px 10px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--bg); position: sticky; top: 0; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.applied { color: var(--good); font-weight: 600; } .kept { color: var(--warn); font-weight: 600; }
.recent { list-style: none; padding: 0; margin: 0; }
.recent li { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.recent a { color: var(--accent); cursor: pointer; }

.comps { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 12px 0; display: grid; gap: 6px; }
.comps legend { font-weight: 600; padding: 0 6px; }
.comps label { display: flex; gap: 8px; align-items: center; }

.sec { margin-top: 22px; }
.brief-blocks { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.comps select, .comps input[type=number], .comps textarea { font: inherit; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); }
.comps textarea { width: 100%; }
.comps label select, .comps label input[type=number] { margin-left: auto; width: 60%; }
.voice { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* home: the three modules */
.home { color: var(--accent); text-decoration: none; font-size: 13px; }
.modules { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-bottom: 18px; }
.module { position: relative; display: block; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 18px 18px 40px; color: var(--ink); text-decoration: none; }
.module:hover { border-color: var(--accent); }
.module p { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
.module .num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent);
  color: var(--accent-ink); font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.module .runs { position: absolute; left: 18px; bottom: 14px; font-size: 12px; color: var(--muted); }
.recent a[href] { text-decoration: none; }

/* upload forms of the gap / structural pages */
.fields { display: grid; gap: 12px; }
.field { display: grid; gap: 4px; }
.field > span { font-weight: 600; font-size: 14px; }
.field em { font-style: normal; font-weight: 400; color: var(--muted); font-size: 12px; }
.field b { font-weight: 400; color: var(--warn); font-size: 12px; }
.field input[type=text], .field input[type=number], .field select { font: inherit; padding: 7px 8px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--card); color: var(--ink); width: 100%; }
.field input[type=file] { font: inherit; font-size: 13px; max-width: 100%; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.fields button { justify-self: start; }
