/* Landed — one stylesheet, no CDN.
   A dashboard someone may run offline should not depend on a network fetch to look
   like anything. Dark and light both supported; the palette is deliberately quiet so
   the three states carry the only strong colour on the page. */

/* One palette, warm and light, in every environment.
   Deliberately not following prefers-color-scheme: a sourcing report is read,
   printed and screen-shared alongside the documents it cites, and those are white.
   A dashboard that flips to near-black on one machine and not another also makes a
   demo unrepeatable. Warm neutrals rather than blue-greys, so the three state
   colours stay the only strong colour on the page. */
:root {
  --bg: #f8f6f2;
  --panel: #ffffff;
  --ink: #262220;
  --muted: #6d655d;
  --line: #e7e1d7;
  --accent: #4257b2;
  --landed: #1a7f52;
  --landed-bg: #e8f5ed;
  --contested: #8a5a00;
  --contested-bg: #fdf2dc;
  --blocked: #a5322a;
  --blocked-bg: #fbebe8;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px 64px; }

/* ---- header ---- */
header.top {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #fbf9f5 100%);
  margin-bottom: 28px;
}
header.top .wrap {
  display: flex; align-items: center; gap: 16px;
  padding-top: 14px; padding-bottom: 14px;
}
.brand { font-weight: 700; letter-spacing: -0.02em; font-size: 18px; color: var(--ink); }
.brand span { color: var(--muted); font-weight: 400; margin-left: 10px; font-size: 13px; }
.spacer { flex: 1; }

/* ---- typography ---- */
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.02em; }
h2 { font-size: 15px; margin: 0 0 12px; text-transform: uppercase;
     letter-spacing: 0.06em; color: var(--muted); }
h3 { font-size: 15px; margin: 0 0 8px; }
.sub { color: var(--muted); margin: 0 0 22px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.num { font-variant-numeric: tabular-nums; text-align: right; }

/* ---- panels ---- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(38, 34, 32, 0.04);
}
.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
@media (max-width: 760px) { .grid.two { grid-template-columns: 1fr; } }

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted); font-weight: 600;
  padding: 6px 10px; border-bottom: 1px solid var(--line);
}
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
.scroll { overflow-x: auto; }

/* ---- the three states ---- */
.state {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.state.landed { color: var(--landed); background: var(--landed-bg); }
.state.contested { color: var(--contested); background: var(--contested-bg); }
.state.not_landed { color: var(--blocked); background: var(--blocked-bg); }

/* A blocked supplier shows a dash, never a number. */
.withheld { color: var(--muted); }

/* ---- provenance ---- */
.cite {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12px; color: var(--muted);
}
.assumed {
  border-left: 3px solid var(--contested);
  padding-left: 8px;
}
.assumed-tag {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--contested); font-weight: 700;
}

/* ---- conflicts ---- */
.conflict {
  border-left: 3px solid var(--blocked);
  background: var(--blocked-bg);
  padding: 10px 12px; border-radius: 0 6px 6px 0; margin-bottom: 10px;
}
.conflict.advisory {
  border-left-color: var(--contested); background: var(--contested-bg);
}
.conflict p { margin: 0 0 6px; }
.conflict .values { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.conflict .values span {
  background: var(--panel); border: 1px solid var(--line);
  padding: 2px 8px; border-radius: 4px; font-size: 13px;
}

/* ---- forms ---- */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 8px 10px; font: inherit;
  color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: -1px;
}
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }
.field { margin-bottom: 12px; }

button, .btn {
  font: inherit; font-weight: 600; cursor: pointer;
  padding: 8px 14px; border-radius: 6px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  white-space: nowrap;
}
button.ghost, .btn.ghost {
  background: transparent; color: var(--ink); border-color: var(--line);
}
button.danger { background: transparent; color: var(--blocked); border-color: var(--line); }
button:hover { filter: brightness(1.06); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.inline { display: inline; }

/* ---- notices ---- */
.notice {
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  background: var(--panel); padding: 10px 12px;
  border-radius: 0 6px 6px 0; margin-bottom: 16px;
}
.notice.error { border-left-color: var(--blocked); color: var(--blocked); }
.empty { color: var(--muted); padding: 22px 0; text-align: center; }

/* ---- auth ---- */
.auth { max-width: 380px; margin: 72px auto; }

/* ---- diff ---- */
.delta.up { color: var(--blocked); }
.delta.down { color: var(--landed); }
.flip {
  border-left: 3px solid var(--accent); background: var(--panel);
  padding: 12px 14px; border-radius: 0 6px 6px 0; margin-bottom: 16px;
}

/* ---- assistant ---- */
.chat { display: flex; flex-direction: column; gap: 12px; margin-bottom: 4px; }
.turn { max-width: 82%; }
.turn.user { align-self: flex-end; text-align: right; }
.turn .who {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); font-weight: 700; margin-bottom: 3px;
}
.turn p {
  margin: 0; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg);
}
.turn.user p { background: var(--accent); color: #fff; border-color: transparent; }
.proposal {
  margin-top: 8px; padding: 10px 12px; text-align: left;
  border: 1px solid var(--line); border-left: 3px solid var(--contested);
  background: var(--contested-bg); border-radius: 0 6px 6px 0;
}
.proposal p { margin: 0 0 8px; padding: 0; background: none; border: none; }

/* ---- footer ---- */
footer.boundary {
  border-top: 1px solid var(--line); margin-top: 40px; padding-top: 16px;
  color: var(--muted); font-size: 13px;
}

/* ---- a supplier not yet in any comparison ---- */
.state.pending { color: var(--muted); background: var(--bg); border: 1px solid var(--line); }

/* ---- panel headers with a count on the right ---- */
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.panel-head h2 { margin: 0; }

/* ---- supplier columns ----
   One column per supplier, side by side and scrolling horizontally past four or so.
   Stacking them on narrow screens keeps each supplier's documents together, which is
   the unit someone is actually working with. */
.columns {
  display: grid; gap: 14px; overflow-x: auto; padding-bottom: 4px;
  grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr);
}
@media (max-width: 760px) {
  .columns { grid-auto-flow: row; grid-auto-columns: auto; }
}
.column {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; background: var(--bg);
  display: flex; flex-direction: column; gap: 10px;
}
.column-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
}
.column-head form { flex: 0 0 auto; }
.column-head button {
  padding: 0 7px; line-height: 1.6; font-size: 15px;
}
.addbar { margin-bottom: 4px; }

/* ---- document lists ---- */
.filelist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.filelist li { font-size: 13px; }
.filelist li.empty { padding: 8px 0; text-align: left; }
.tag {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 999px; margin-left: 6px;
}
button.linkish {
  background: none; border: none; padding: 0 0 0 8px;
  color: var(--muted); font-weight: 400; text-decoration: underline;
}
.upload { display: grid; gap: 6px; margin-top: auto; }
.details summary {
  cursor: pointer; color: var(--muted); padding: 2px 0;
}
.details form { display: grid; gap: 4px; padding: 8px 0 2px; }
.details textarea { resize: vertical; }
.upload input[type=file] { font-size: 12px; padding: 6px; }

/* ---- what-to-upload checklist ---- */
.checklist { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 14px; }
.checklist p { margin: 4px 0 0; }
.req {
  display: inline-block; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 1px 7px; border-radius: 999px; margin-right: 8px;
}
.req.yes { color: var(--blocked); background: var(--blocked-bg); }
.req.no { color: var(--muted); background: var(--bg); border: 1px solid var(--line); }

/* ---- the comparison matrix ----
   Cost lines down the side, suppliers across. The row header stays put while the
   columns scroll, so a figure never loses the label that says what it is. */
.matrix th, .matrix td { white-space: nowrap; }
.matrix .rowhead {
  position: sticky; left: 0; z-index: 1;
  background: var(--panel); text-align: left; white-space: normal;
  min-width: 150px; font-weight: 600;
}
.matrix thead th { vertical-align: bottom; padding-bottom: 10px; }
.matrix thead th > div { font-size: 14px; color: var(--ink);
  text-transform: none; letter-spacing: 0; margin-bottom: 4px; }
.matrix th.best { background: var(--landed-bg); border-radius: 6px 6px 0 0; }
.matrix .badge {
  margin-top: 5px; font-size: 11px; font-weight: 700; color: var(--landed);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.matrix tr.total td { border-top: 2px solid var(--line); }
.matrix tr.total .rowhead { text-transform: uppercase; font-size: 12px;
  letter-spacing: 0.05em; color: var(--muted); }

.panel.run { border-color: var(--accent); }

/* HTMX shows this while a request is in flight. */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }
.htmx-request.htmx-indicator { display: inline; }
