/* Halo Scans web page. Colours are tokens; dark mode follows the system setting. */
:root {
  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface-2: #f1f4f3;
  --text: #17201c;
  --muted: #5a6762;
  --border: #d8dfdc;
  --accent: #0b6e4f;
  --accent-hover: #095c42;
  --accent-ink: #ffffff;
  --accent-soft: #e2f1eb;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #8a5300;
  --warn-soft: #fff3d6;
  --info: #31506f;
  --info-soft: #eaf0f6;
  --log-bg: #f6f8f7;
  --focus: #2f7de1;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 20, 0.06), 0 6px 20px rgba(16, 24, 20, 0.05);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1311;
    --surface: #161c19;
    --surface-2: #1c2420;
    --text: #e4ebe7;
    --muted: #98a6a0;
    --border: #2b3631;
    --accent: #2fa57d;
    --accent-hover: #3bb98e;
    --accent-ink: #06140e;
    --accent-soft: #15322a;
    --danger: #ff8a7a;
    --danger-soft: #3a1b18;
    --warn: #f3c164;
    --warn-soft: #33270f;
    --info: #a9c4e2;
    --info-soft: #1a2531;
    --log-bg: #111714;
    --focus: #6aa8ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
}

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }

h1, h2 { margin: 0 0 12px; line-height: 1.25; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.1rem; }
p { margin: 0 0 12px; }

.mn { display: block; font-size: 0.74em; font-weight: 400; color: var(--muted); letter-spacing: 0.01em; }
h1 .mn, h2 .mn { display: inline; margin-left: 6px; }
.btn .mn { display: inline; margin-left: 4px; color: inherit; opacity: 0.8; }
.mn-block { color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.block { display: block; }
.center { text-align: center; }

/* ---- top bar ---- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.topbar-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  min-height: 60px; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 32px; height: 32px; flex: none; }
.logo-bg { fill: var(--accent); }
.logo-arc { fill: none; stroke: var(--accent-ink); stroke-width: 2.4; stroke-linecap: round; }
.brand-name { font-weight: 650; font-size: 1.05rem; }
.brand-sub { font-size: 0.8rem; color: var(--muted); }
.account { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
@media (max-width: 480px) {
  .brand-sub { display: none; }
}

/* ---- cards and layout ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  min-width: 0;
}
.login-card { max-width: 420px; margin: 32px auto; }
.layout { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) {
  .layout { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
}
.boot { text-align: center; padding: 48px 0; }

/* ---- form controls ---- */
.field { display: block; margin: 0 0 16px; min-width: 0; }
fieldset.field { border: 0; padding: 0; }
.label { display: block; font-weight: 600; margin-bottom: 6px; }
legend.label { padding: 0; }
.label.small { font-weight: 550; }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }

input, select, button { font: inherit; color: inherit; }
input[type="text"], input:not([type]), input[type="password"], input[type="datetime-local"], select {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
select { min-width: 0; max-width: 100%; text-overflow: ellipsis; }
select:disabled { opacity: 0.6; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, .log:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
#sub-info { margin: 6px 0 0; }

.range { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 520px) {
  .range { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.range .field { margin-bottom: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  min-height: 36px;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--text); font-weight: 600; }

.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 16px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 3px 0 0; flex: none; accent-color: var(--accent); }
.check .mn { display: inline; margin-left: 6px; }

/* ---- buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 42px;
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 34px; padding: 4px 12px; font-size: 0.9rem; }
.btn.link { background: none; border: 0; color: var(--accent); padding: 0; min-height: 0; font-weight: 550; }
.btn.link:hover:not(:disabled) { text-decoration: underline; }
.btn.wide { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions .btn { flex: 1 1 140px; }

/* ---- alerts ---- */
.alert { border-radius: 8px; padding: 10px 12px; margin: 0 0 14px; background: var(--info-soft); color: var(--info); }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.info { background: var(--info-soft); color: var(--info); }

/* ---- progress ---- */
.job-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.job-head h2 { margin: 0; }
.pill { border-radius: 999px; padding: 3px 12px; font-size: 0.85rem; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.pill.queued, .pill.running { background: var(--info-soft); color: var(--info); border-color: transparent; }
.pill.done { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill.failed { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.pill.nodata, .pill.stopped { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

progress { display: block; width: 100%; height: 8px; margin: 4px 0 14px; accent-color: var(--accent); }
.stats { display: flex; gap: 28px; margin: 0 0 14px; }
.stats div { min-width: 0; }
.stats dt { font-size: 0.8rem; color: var(--muted); }
.stats dd { margin: 0; font-size: 1.25rem; font-weight: 650; font-variant-numeric: tabular-nums; }

.log {
  margin: 0 0 16px;
  min-height: 180px;
  max-height: 360px;
  overflow: auto;
  padding: 10px 12px;
  background: var(--log-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font: 12.5px/1.5 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---- note ---- */
.note { margin: 24px 0 40px; font-size: 0.86rem; color: var(--muted); max-width: 80ch; }
