/*
  The portal shares the public site's design language, so signing in does not feel
  like arriving at a different, older product. Same tokens, same type, same three
  theme states.
*/
@import url("https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,400;8..60,600&family=IBM+Plex+Mono:wght@400;500;600&display=swap");

:root {
  --ground:      #f4f5f2;
  --surface:     #ffffff;
  --surface-2:   #fafbf9;
  --sunk:        #eef0eb;
  --ink:         #141915;
  --ink-soft:    #333c30;
  --muted:       #5e6858;
  --faint:       #8b9484;
  --rule:        #d4d8cf;
  --rule-soft:   #e5e8e1;

  --accent:      #1c6b52;
  --accent-hover:#14563f;
  --accent-ink:  #ffffff;
  --accent-wash: #e8f2ed;
  --accent-line: #cde5da;

  --crit:  #9c2d20;  --crit-wash: #f9e8e5;  --crit-line: #f0cec8;
  --warn:  #8a5300;  --warn-wash: #fbf1e0;  --warn-line: #f0dfc2;
  --calm:  #1c6b52;  --calm-wash: #e8f2ed;  --calm-line: #cde5da;
  --dead:  #6b7365;  --dead-wash: #eef0eb;  --dead-line: #dde1d8;

  --lift: 0 1px 2px rgb(20 25 21 / .04), 0 6px 20px -10px rgb(20 25 21 / .10);

  --sans: "Archivo", ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0d100d;  --surface: #161a16;  --surface-2: #1b201b;  --sunk: #121612;
    --ink: #e6eae4;     --ink-soft: #c2c9be; --muted: #98a192;      --faint: #6d7669;
    --rule: #2a302a;    --rule-soft: #212721;
    --accent: #5cb894;  --accent-hover: #7ecbac; --accent-ink: #0d100d;
    --accent-wash: #15251e; --accent-line: #1f3b2e;
    --crit: #e58e80; --crit-wash: #2a1714; --crit-line: #43241f;
    --warn: #dba45c; --warn-wash: #271d10; --warn-line: #3d2e18;
    --calm: #5cb894; --calm-wash: #15251e; --calm-line: #1f3b2e;
    --dead: #8b9484; --dead-wash: #1b201b; --dead-line: #2a302a;
    --lift: 0 1px 2px rgb(0 0 0 / .5), 0 6px 20px -10px rgb(0 0 0 / .7);
  }
}

:root[data-theme="dark"] {
  --ground: #0d100d;  --surface: #161a16;  --surface-2: #1b201b;  --sunk: #121612;
  --ink: #e6eae4;     --ink-soft: #c2c9be; --muted: #98a192;      --faint: #6d7669;
  --rule: #2a302a;    --rule-soft: #212721;
  --accent: #5cb894;  --accent-hover: #7ecbac; --accent-ink: #0d100d;
  --accent-wash: #15251e; --accent-line: #1f3b2e;
  --crit: #e58e80; --crit-wash: #2a1714; --crit-line: #43241f;
  --warn: #dba45c; --warn-wash: #271d10; --warn-line: #3d2e18;
  --calm: #5cb894; --calm-wash: #15251e; --calm-line: #1f3b2e;
  --dead: #8b9484; --dead-wash: #1b201b; --dead-line: #2a302a;
  --lift: 0 1px 2px rgb(0 0 0 / .5), 0 6px 20px -10px rgb(0 0 0 / .7);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/*
  Links inherit the text colour by default. Making every `a` the accent turned a
  list of tenders — where every title is a link — into a wall of green, which is
  the opposite of what an accent is for. The accent is spent on things you act on:
  buttons, and the few links that are genuinely a call to action.
*/
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

/* An accent link: use where the link IS the action, not where text happens to
   be clickable. */
a.act, .act { color: var(--accent); font-weight: 500; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------------------------------------------------------------- shell */

header.top {
  position: sticky; top: 0; z-index: 40;
  height: 60px;
  display: flex; align-items: center; gap: 26px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
header.top .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14.5px; color: var(--ink); }
header.top .brand .mark {
  width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 6px; background: var(--ink); color: var(--ground);
  font-family: var(--mono); font-size: 13px; font-weight: 600;
}
header.top nav { display: flex; align-items: center; gap: 22px; margin-left: 8px; font-size: 13.5px; }
header.top nav a { color: var(--muted); }
header.top nav a.on { color: var(--ink); font-weight: 500; }
header.top .right { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 13.5px; }
header.top .who { color: var(--faint); }

main { max-width: 1180px; margin: 0 auto; padding: 26px 20px 80px; }

/* ---------------------------------------------------------------- type */

h1 { font-size: 25px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 4px; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; margin: 30px 0 12px; }
h3 { font-size: 14.5px; font-weight: 600; margin: 0 0 6px; }
p  { margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 22px; font-size: 14.5px; }
.lbl {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase; color: var(--faint);
}
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono  { font-family: var(--mono); font-size: 12px; }
.tab   { font-variant-numeric: tabular-nums; }
.serif { font-family: var(--serif); font-size: 15.5px; line-height: 1.6; }

/* ---------------------------------------------------------------- layout */

.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 18px;
}
.card.flat { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--rule-soft);
}
.card-body { padding: 18px; }

.grid { display: grid; gap: 14px; }
.grid.k2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.k4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.split { display: grid; grid-template-columns: 300px 1fr; gap: 22px; align-items: start; }
@media (max-width: 840px) { .split { grid-template-columns: 1fr; } }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ---------------------------------------------------------------- stats */

.stats {
  display: grid; gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow: hidden;
}
.stat { background: var(--surface); padding: 15px 17px; }
.stat dt { margin: 0 0 5px; }
.stat dd {
  margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.stat .qual { display: block; margin-top: 4px; font-size: 12px; color: var(--faint); font-weight: 400; }

/* ---------------------------------------------------------------- tables */

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; padding: 11px 16px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: .09em; text-transform: uppercase; color: var(--faint);
  border-bottom: 1px solid var(--rule); white-space: nowrap;
}
td { padding: 12px 16px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- forms */

label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-soft); margin: 0 0 5px; }
input, select, textarea {
  width: 100%; padding: 8px 11px;
  border: 1px solid var(--rule); border-radius: 7px;
  background: var(--surface); color: var(--ink);
  font-size: 13.5px; font-family: inherit;
}
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
input::placeholder { color: var(--faint); }
.field { margin-bottom: 14px; }
.hint { margin: 5px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--faint); }

.btn {
  display: inline-block; border: 0; cursor: pointer;
  padding: 9px 16px; border-radius: 7px;
  background: var(--accent); color: var(--accent-ink);
  font-family: inherit; font-size: 13.5px; font-weight: 600;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--rule); }
.btn.ghost:hover { background: var(--sunk); }
.btn.danger { background: transparent; color: var(--crit); border: 1px solid var(--crit-line); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; }

/* ---------------------------------------------------------------- chips */

.title {
  color: var(--ink);
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.4;
}
.title:hover { color: var(--accent); text-decoration: none; }

/* One row of a result list: the whole row is the target, and it says so. */
.rowlink {
  display: block; position: relative;
  padding: 14px 16px 14px 19px;
  border-bottom: 1px solid var(--rule-soft);
  background: var(--surface);
}
.rowlink:last-child { border-bottom: 0; }
.rowlink:hover { background: var(--surface-2); text-decoration: none; }
.rowlink .stripe { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.meta {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 4px 14px; margin-top: 5px;
  font-size: 12.5px; color: var(--muted);
}
.meta .strong { color: var(--ink-soft); font-weight: 600; }
.viewbtn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px; border-radius: 6px;
  border: 1px solid var(--rule); background: var(--surface-2);
  font-size: 12px; font-weight: 500; color: var(--muted);
}

.chip {
  display: inline-block; margin: 2px 3px 2px 0;
  padding: 2px 9px; border-radius: 999px;
  background: var(--accent-wash); color: var(--accent);
  font-size: 11.5px; font-weight: 600;
}
.chip.neg { background: var(--crit-wash); color: var(--crit); }
.chip.plain { background: var(--sunk); color: var(--muted); }

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.pill.ok   { background: var(--calm-wash); color: var(--calm); box-shadow: inset 0 0 0 1px var(--calm-line); }
.pill.warn { background: var(--warn-wash); color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn-line); }
.pill.bad  { background: var(--crit-wash); color: var(--crit); box-shadow: inset 0 0 0 1px var(--crit-line); }
.pill.dead { background: var(--dead-wash); color: var(--dead); box-shadow: inset 0 0 0 1px var(--dead-line); }

/* ---------------------------------------------------------------- notices */

.note {
  padding: 12px 15px; border-radius: 8px; font-size: 13.5px; line-height: 1.55;
  background: var(--accent-wash); color: var(--ink-soft);
  border-left: 3px solid var(--accent);
  margin: 0 0 16px;
}
.note.warn { background: var(--warn-wash); border-left-color: var(--warn); }
.note.err  { background: var(--crit-wash); border-left-color: var(--crit); color: var(--crit); }

.empty {
  padding: 44px 22px; text-align: center;
  border: 1px dashed var(--rule); border-radius: 10px; background: var(--surface);
}
.empty strong { display: block; font-size: 14.5px; color: var(--ink-soft); margin-bottom: 5px; }
.empty p { margin: 0 auto; max-width: 34ch; font-size: 13px; color: var(--faint); }

/* ---------------------------------------------------------------- auth */

.auth { max-width: 380px; margin: 8vh auto 0; }
.auth .card { padding: 26px; }
.auth h1 { font-size: 22px; }

/* ---------------------------------------------------------------- steps */

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.steps > li {
  counter-increment: step;
  display: grid; grid-template-columns: 30px 1fr; gap: 14px;
  padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--rule);
}
.steps > li:first-child { border-radius: 10px 10px 0 0; }
.steps > li:last-child  { border-radius: 0 0 10px 10px; }
.steps > li + li { border-top: 0; }
.steps > li::before {
  content: counter(step);
  display: grid; place-items: center; width: 24px; height: 24px;
  border-radius: 50%; background: var(--accent-wash); color: var(--accent);
  font-size: 12px; font-weight: 700;
}
.steps > li.done::before { content: "✓"; background: var(--accent); color: var(--accent-ink); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
