/* Radiant QuikQA web app -- brand stylesheet.
   Crimson #d00008, charcoal #303030, white background, Montserrat.
   Clean medical / tech aesthetic, consistent with radiant-mpc.com. */

:root {
  --crimson: #d00008;
  --crimson-dark: #a80006;
  --crimson-bright: #f03020;
  --charcoal: #303030;
  --ink: #1a1a1a;
  --bg: #ffffff;
  --panel: #fafafa;
  --line: #e6e6e8;
  --muted: #6b6b70;
  --pass: #1f8a3b;
  --pass-bg: #e8f6ec;
  --action: #c98a00;
  --action-bg: #fdf3df;
  --fail: #c4131c;
  --fail-bg: #fdeaea;
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--crimson); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Header ---- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1080px; margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 38px; width: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.wordmark {
  font-weight: 800; font-size: 1.32rem; letter-spacing: -0.01em;
  color: var(--ink);
}
.wordmark .accent { color: var(--crimson); }
.brand-sub {
  font-size: 0.62rem; text-transform: uppercase;
  letter-spacing: 0.16em; color: var(--muted);
}
.header-tag {
  font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.13em; color: var(--muted);
}
.nav-links { display: flex; gap: 18px; align-items: center; }
.nav-links a { color: var(--charcoal); font-size: 0.86rem; font-weight: 500; }

/* ---- Layout ---- */
.container { max-width: 1080px; margin: 0 auto; padding: 32px 24px 64px; }
.narrow { max-width: 760px; }

.page-title { font-size: 1.9rem; font-weight: 700; margin: 0 0 4px; }
.page-sub { color: var(--muted); margin: 0 0 28px; font-size: 0.95rem; }

.crumbs { font-size: 0.82rem; color: var(--muted); margin-bottom: 16px; }
.crumbs a { color: var(--muted); }

/* ---- Hero ---- */
.hero {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(135deg, #fff 60%, #fff4f3);
  padding: 30px 32px; margin-bottom: 32px;
}
.hero h1 { margin: 0 0 8px; font-size: 1.7rem; }
.hero p { margin: 0; color: var(--charcoal); max-width: 640px; }
.hero .accent-rule {
  width: 54px; height: 4px; background: var(--crimson);
  border-radius: 2px; margin-bottom: 16px;
}

/* ---- Module cards ---- */
.category-label {
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.13em;
  color: var(--crimson); font-weight: 700;
  margin: 28px 0 12px; border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}
.card-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.mod-card {
  display: block; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
  background: #fff; transition: all 0.14s ease;
}
.mod-card:hover {
  border-color: var(--crimson); text-decoration: none;
  box-shadow: 0 4px 18px rgba(208,0,8,0.08);
  transform: translateY(-1px);
}
.mod-card .mc-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.mod-card h3 { margin: 0; font-size: 1.04rem; color: var(--ink); }
.mod-card p { margin: 0; color: var(--muted); font-size: 0.85rem; }
.mod-icon {
  width: 34px; height: 34px; border-radius: 7px;
  background: #fdecec; color: var(--crimson);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.95rem;
}

/* ---- Status pills ---- */
.pill {
  display: inline-block; font-size: 0.66rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 3px 9px; border-radius: 999px;
}
.pill.live { background: var(--pass-bg); color: var(--pass); }
.pill.beta { background: var(--action-bg); color: var(--action); }
.pill.scaffold { background: #eee; color: var(--muted); }

.verdict {
  display: inline-block; font-weight: 800;
  padding: 6px 16px; border-radius: 6px; font-size: 0.95rem;
  letter-spacing: 0.03em;
}
.verdict.pass { background: var(--pass-bg); color: var(--pass); }
.verdict.action { background: var(--action-bg); color: var(--action); }
.verdict.fail { background: var(--fail-bg); color: var(--fail); }
.verdict.unknown { background: #eee; color: var(--muted); }

/* ---- Forms ---- */
.form-panel {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 28px; background: #fff;
}
.field { margin-bottom: 16px; }
.field label {
  display: block; font-weight: 600; font-size: 0.84rem;
  margin-bottom: 5px; color: var(--charcoal);
}
.field .hint { font-weight: 400; color: var(--muted); font-size: 0.78rem; }
.field input[type=text], .field input[type=number], .field input[type=date],
.field select, .field textarea {
  width: 100%; padding: 9px 11px; font-size: 0.9rem;
  border: 1px solid #ccccd0; border-radius: 6px;
  font-family: inherit; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--crimson);
  box-shadow: 0 0 0 3px rgba(208,0,8,0.1);
}
.field input[type=file] {
  width: 100%; padding: 8px; font-size: 0.85rem;
  border: 1px dashed #bbb; border-radius: 6px; background: var(--panel);
}

/* ---- Multi-file batch picker (Leaf-Speed) ---- */
/* Fixed-height, scrollable list: the box is ALWAYS 220px tall, whether
   it holds zero files or a hundred. Adding files therefore never grows
   the form or pushes the "Run analysis" button down. */
.file-list {
  margin-top: 10px;
  height: 220px;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}
.file-list-empty {
  padding: 14px 13px; color: var(--muted); font-size: 0.84rem;
}
.file-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 11px; border-bottom: 1px solid var(--line);
  font-size: 0.84rem; background: #fff;
}
.file-row:last-child { border-bottom: none; }
.file-row:nth-child(even) { background: #fcfcfc; }
.file-name {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 500; color: var(--charcoal);
}
.file-size {
  flex: 0 0 auto; color: var(--muted); font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}
.file-remove {
  flex: 0 0 auto; cursor: pointer;
  width: 22px; height: 22px; line-height: 1;
  border: 1px solid #d8d8dc; border-radius: 5px;
  background: #fff; color: var(--muted);
  font-size: 1rem; font-family: inherit;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.12s;
}
.file-remove:hover {
  border-color: var(--crimson); color: var(--crimson);
  background: #fdecec;
}
.file-list-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 6px; font-size: 0.79rem; color: var(--muted);
}
.linkbtn {
  background: none; border: none; cursor: pointer;
  color: var(--crimson); font-family: inherit; font-size: 0.79rem;
  font-weight: 600; padding: 0; text-decoration: underline;
}
.linkbtn:hover { color: var(--crimson-dark); }

/* ---- Batch results table ---- */
table.data td .verdict {
  font-size: 0.72rem; padding: 3px 9px;
}
.checkrow { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.checkrow input { width: 16px; height: 16px; accent-color: var(--crimson); }
.checkrow label { margin: 0; font-weight: 500; font-size: 0.86rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 18px; }
.section-head {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--crimson); font-weight: 700;
  margin: 22px 0 12px; padding-bottom: 5px; border-bottom: 1px solid var(--line);
}
.section-head:first-child { margin-top: 0; }

.btn {
  display: inline-block; cursor: pointer;
  background: var(--crimson); color: #fff; border: none;
  font-family: inherit; font-weight: 600; font-size: 0.92rem;
  padding: 11px 26px; border-radius: 6px; transition: background 0.12s;
}
.btn:hover { background: var(--crimson-dark); text-decoration: none; }
.btn.secondary {
  background: #fff; color: var(--charcoal); border: 1px solid #ccc;
}
.btn.secondary:hover { background: var(--panel); }
.btn-row { margin-top: 22px; display: flex; gap: 12px; align-items: center; }

/* ---- Tables ---- */
table.data {
  width: 100%; border-collapse: collapse; font-size: 0.88rem;
  margin: 4px 0 18px;
}
table.data th, table.data td {
  text-align: left; padding: 8px 12px; border: 1px solid var(--line);
}
table.data th {
  background: var(--panel); color: var(--charcoal); font-weight: 600;
  width: 42%;
}
table.data tr:nth-child(even) td { background: #fcfcfc; }

/* ---- Result page ---- */
.result-head {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 26px; margin-bottom: 22px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; background: #fff;
}
.result-head .summary { color: var(--charcoal); font-size: 0.95rem; }
.panel {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 26px; margin-bottom: 22px; background: #fff;
}
.panel h2 {
  margin: 0 0 14px; font-size: 1.05rem;
  border-bottom: 2px solid var(--crimson); padding-bottom: 7px;
  display: inline-block;
}
.plot-img {
  max-width: 100%; border: 1px solid var(--line);
  border-radius: 6px; margin: 8px 0;
}
.warn-list { list-style: none; padding: 0; margin: 0; }
.warn-list li {
  background: var(--action-bg); border-left: 3px solid var(--action);
  padding: 9px 13px; margin-bottom: 8px; font-size: 0.85rem;
  border-radius: 0 4px 4px 0;
}
.alert {
  padding: 11px 15px; border-radius: 6px; font-size: 0.87rem;
  margin-bottom: 16px;
}
.alert.error { background: var(--fail-bg); color: var(--fail);
  border: 1px solid #f3c0c0; }
.alert.info { background: #eef4fb; color: #2a5a8a;
  border: 1px solid #cfe0f0; }

.disclaimer {
  font-size: 0.78rem; color: var(--muted);
  border: 1px solid var(--line); background: var(--panel);
  border-radius: 6px; padding: 12px 15px; margin-top: 24px;
}

pre.tb {
  background: #2b2b2b; color: #e6e6e6; padding: 14px;
  border-radius: 6px; overflow-x: auto; font-size: 0.76rem;
  font-family: 'Consolas', monospace;
}

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--line); margin-top: 40px;
  padding: 24px; text-align: center;
  font-size: 0.78rem; color: var(--muted);
}

@media (max-width: 680px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .result-head { flex-direction: column; align-items: flex-start; }
  .nav-links { display: none; }
}

/* ---- Periodic-QA checklist (Monthly / Annual) ---- */
/* Checklist tables are full-bleed three/four-column grids; override the
   42%-wide `th` rule from table.data. */
table.qa-table th, table.qa-result-table th { width: auto; }
table.qa-table td, table.qa-result-table td { vertical-align: middle; }
.qa-col-name   { width: 52%; }
.qa-col-tol    { width: 20%; white-space: nowrap; }
.qa-col-result { width: 18%; white-space: nowrap; }
.qa-col-verdict { width: 14%; text-align: center; }

.qa-tol-input, .qa-meas-input {
  width: 78px; padding: 6px 8px; font-size: 0.85rem;
  border: 1px solid #ccccd0; border-radius: 6px; font-family: inherit;
}
.qa-check-select {
  width: 100%; max-width: 130px; padding: 6px 8px; font-size: 0.85rem;
  border: 1px solid #ccccd0; border-radius: 6px; font-family: inherit;
  background: #fff;
}
.qa-pm { color: var(--muted); margin-right: 2px; }
.qa-unit { color: var(--muted); font-size: 0.8rem; margin-left: 4px; }
.qa-group-counts { margin: 0 0 12px; }

/* ---- Print: clean QA report ---- */
@media print {
  .no-print { display: none !important; }
  .site-header, .site-footer { display: none !important; }
  body { font-size: 12px; }
  main { margin: 0; }
  .container { max-width: none; padding: 0; }
  .panel, .result-head {
    border: 1px solid #999; box-shadow: none;
    page-break-inside: avoid;
  }
  .verdict { border: 1px solid #999; }
  .btn, .btn-row { display: none !important; }
  a[href]:after { content: ""; }
  table.data tr:nth-child(even) td { background: #fff; }
}

/* ---- Hosted evaluation-instance banner ---- */
/* Shown only when QUIKQA_EVAL_BANNER=1 (the public eval deployment).
   Carries the no-print class so it never appears on printed QA reports. */
.eval-banner {
  background: var(--action-bg);
  border-bottom: 1px solid var(--action);
  color: #6f4e00;
  padding: 9px 24px;
  text-align: center;
  font-size: 0.82rem;
  line-height: 1.45;
}
.eval-banner strong { color: var(--action); }
