/* ==========================================================================
   Scrap Sale Portal
   Palette: mill-floor neutrals with oxidised copper as the single accent -
   the materials the application actually deals in. Steel carries structure,
   copper carries action, and semantic colour is reserved for auction state.
   ========================================================================== */

:root {
  color-scheme: light;

  /* neutrals, biased very slightly green-grey like a shop floor */
  --paper: #f2f4f1;
  --surface: #ffffff;
  --surface-2: #fafbf9;
  --surface-sunken: #e9ece8;
  --line: #d6dbd6;
  --line-strong: #b8c0b9;
  --ink: #16191b;
  --ink-2: #414a4c;
  --ink-3: #6c7679;

  /* structure and action */
  --steel: #37474d;
  --steel-2: #2b383d;
  --steel-ink: #e8edee;
  --copper: #a8481c;
  --copper-hover: #8d3a14;
  --copper-wash: #fbf1ec;

  /* auction and record state */
  --ok: #17603c;
  --ok-wash: #e9f4ee;
  --warn: #8a5a06;
  --warn-wash: #fdf3e0;
  --stop: #97231f;
  --stop-wash: #fbecea;
  --quiet: #5c6669;
  --quiet-wash: #eef1ee;

  --radius: 4px;
  --radius-lg: 6px;
  --shadow-raise: 0 1px 2px rgba(22, 25, 27, 0.06), 0 4px 14px rgba(22, 25, 27, 0.06);
  --shadow-float: 0 8px 34px rgba(22, 25, 27, 0.18);

  --font-display: "Archivo", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --rail: 244px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #121517;
    --surface: #1a1e21;
    --surface-2: #1f2427;
    --surface-sunken: #0e1113;
    --line: #2d3438;
    --line-strong: #414a4e;
    --ink: #e9edee;
    --ink-2: #b3bcbe;
    --ink-3: #8b9598;
    --steel: #232b2f;
    --steel-2: #1a2124;
    --steel-ink: #dde5e6;
    --copper: #e07a41;
    --copper-hover: #ef8b52;
    --copper-wash: #2a1c14;
    --ok: #5fc48d;
    --ok-wash: #16281f;
    --warn: #e0aa4d;
    --warn-wash: #2a2113;
    --stop: #f0817b;
    --stop-wash: #2c1917;
    --quiet: #98a2a5;
    --quiet-wash: #21272a;
    --shadow-raise: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.3);
    --shadow-float: 0 8px 34px rgba(0, 0, 0, 0.55);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #121517;
  --surface: #1a1e21;
  --surface-2: #1f2427;
  --surface-sunken: #0e1113;
  --line: #2d3438;
  --line-strong: #414a4e;
  --ink: #e9edee;
  --ink-2: #b3bcbe;
  --ink-3: #8b9598;
  --steel: #232b2f;
  --steel-2: #1a2124;
  --steel-ink: #dde5e6;
  --copper: #e07a41;
  --copper-hover: #ef8b52;
  --copper-wash: #2a1c14;
  --ok: #5fc48d;
  --ok-wash: #16281f;
  --warn: #e0aa4d;
  --warn-wash: #2a2113;
  --stop: #f0817b;
  --stop-wash: #2c1917;
  --quiet: #98a2a5;
  --quiet-wash: #21272a;
  --shadow-raise: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.3);
  --shadow-float: 0 8px 34px rgba(0, 0, 0, 0.55);
}

/* --------------------------------------------------------------- foundations */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font: 400 14px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.012em;
  text-wrap: balance;
  margin: 0;
}

h1 { font-size: 1.45rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: 0.97rem; }

p { margin: 0 0 0.7em; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--copper);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover { color: var(--copper-hover); }

:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link { font: inherit; color: inherit; border: 1px solid var(--line, rgba(0,0,0,.2)); cursor: pointer;
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  padding: 10px 16px;
  z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 0.82rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.strong { font-weight: 600; }

.eyebrow {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* -------------------------------------------------------------- boot / loading */

.app-loading { display: grid; place-items: center; min-height: 100vh; }
.boot { text-align: center; color: var(--ink-3); }
.boot-mark {
  width: 34px;
  height: 34px;
  margin: 0 auto 14px;
  border: 3px solid var(--line-strong);
  border-top-color: var(--copper);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .boot-mark { animation: none; border-top-color: var(--line-strong); }
}

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

.shell {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  background: var(--steel);
  color: var(--steel-ink);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 14px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand { padding: 0 8px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.12); margin-bottom: 12px; }
.brand-org {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  display: block;
}
.brand-app {
  font-size: 0.7rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(232, 237, 238, 0.6);
  margin-top: 3px;
  display: block;
}

.rail-group { margin-top: 14px; }
.rail-group > .eyebrow {
  padding: 0 8px 6px;
  color: rgba(232, 237, 238, 0.45);
  display: block;
}

.rail a.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: rgba(232, 237, 238, 0.82);
  text-decoration: none;
  font-size: 0.885rem;
  border-left: 2px solid transparent;
}
.rail a.nav:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.rail a.nav[aria-current="page"] {
  background: rgba(255, 255, 255, 0.11);
  color: #fff;
  border-left-color: var(--copper);
  font-weight: 600;
}
.nav-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--copper);
  color: #fff;
  padding: 1px 6px;
  border-radius: 9px;
  min-width: 20px;
  text-align: center;
}
.nav-count[data-tone="quiet"] { background: rgba(255, 255, 255, 0.16); }

.rail-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.who { padding: 0 8px 10px; }
.who-name { font-weight: 600; font-size: 0.885rem; display: block; }
.who-role {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(232, 237, 238, 0.6);
}
.rail-actions { display: flex; gap: 6px; padding: 0 4px; }
/* The password link is a real anchor so it can be opened in a new tab, but it
   sits beside two buttons and has to look like them. */
.rail-actions button,
.rail-actions a {
  flex: 1;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--steel-ink);
  font: 500 0.79rem var(--font-body);
  padding: 6px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
.rail-actions button:hover,
.rail-actions a:hover { background: rgba(255, 255, 255, 0.16); }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 30px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex-wrap: wrap;
}
.topbar .titles { min-width: 0; }
.topbar h1 { margin-bottom: 2px; }
.topbar .sub { color: var(--ink-3); font-size: 0.87rem; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.content { padding: 24px 30px 60px; display: flex; flex-direction: column; gap: 22px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px 14px;
    gap: 6px;
  }
  .brand { border: 0; margin: 0; padding: 0 8px 0 0; flex: 1 1 100%; }
  .rail-group { margin: 0; display: contents; }
  .rail-group > .eyebrow { display: none; }
  .rail a.nav { border-left: 0; border-bottom: 2px solid transparent; padding: 6px 10px; }
  .rail a.nav[aria-current="page"] { border-left: 0; border-bottom-color: var(--copper); }
  .rail-foot { margin: 0; padding: 8px 0 0; border: 0; flex: 1 1 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .who { padding: 0; }
  .rail-actions { flex: 0 0 auto; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
}

/* ------------------------------------------------------------------ buttons */

.btn {
  font: 500 0.885rem/1 var(--font-body);
  padding: 9px 15px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--surface-sunken); border-color: var(--ink-3); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn.primary { background: var(--copper); border-color: var(--copper); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--copper-hover); border-color: var(--copper-hover); }
.btn.dark { background: var(--steel); border-color: var(--steel); color: var(--steel-ink); }
.btn.dark:hover { background: var(--steel-2); }
.btn.danger { color: var(--stop); border-color: color-mix(in srgb, var(--stop) 45%, var(--line)); }
.btn.danger:hover { background: var(--stop-wash); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-sunken); border-color: var(--line); }
.btn.sm { padding: 6px 10px; font-size: 0.8rem; }
.btn.block { width: 100%; justify-content: center; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* -------------------------------------------------------------------- panels */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.panel > header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.panel > header h2 { font-size: 1rem; }
.panel > header .hint { color: var(--ink-3); font-size: 0.82rem; }
.panel-body { padding: 18px; }
.panel-body.tight { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

/* Stat tiles: only where the figures are the point of the screen. */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.stat { background: var(--surface); padding: 15px 17px; display: flex; flex-direction: column; gap: 3px; }
.stat .label { font-size: 0.73rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.stat .value { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat .foot { font-size: 0.78rem; color: var(--ink-3); }
.stat.alert { background: var(--copper-wash); }
.stat.alert .value { color: var(--copper); }
.stat a { text-decoration: none; }
a.stat, a.stat:hover { text-decoration: none; color: inherit; }
a.stat:hover { background: var(--surface-2); }
a.stat .label { text-decoration: none; }
a.stat .foot { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 2px; }

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

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
table.data th {
  text-align: left;
  font: 600 0.71rem/1.3 var(--font-display);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  position: sticky;
  top: 0;
  white-space: nowrap;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.actions { text-align: right; white-space: nowrap; }
table.data .primary-cell { font-weight: 600; }
table.data .sub-cell { color: var(--ink-3); font-size: 0.81rem; margin-top: 2px; }

.empty { padding: 44px 20px; text-align: center; color: var(--ink-3); }
.empty h3 { color: var(--ink-2); margin-bottom: 5px; }

/* ---------------------------------------------------------------------- pills */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: 600 0.71rem/1 var(--font-display);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 8px 4px 7px;
  border-radius: 3px;
  border-left: 3px solid currentColor;
  white-space: nowrap;
}
.pill[data-tone="ok"] { color: var(--ok); background: var(--ok-wash); }
.pill[data-tone="warn"] { color: var(--warn); background: var(--warn-wash); }
.pill[data-tone="stop"] { color: var(--stop); background: var(--stop-wash); }
.pill[data-tone="quiet"] { color: var(--quiet); background: var(--quiet-wash); }
.pill[data-tone="copper"] { color: var(--copper); background: var(--copper-wash); }

/* The confidentiality marker: real information, not decoration. */
.confidential {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: 600 0.67rem/1 var(--font-display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--copper);
  background: var(--copper-wash);
  border: 1px dashed color-mix(in srgb, var(--copper) 40%, transparent);
  padding: 3px 7px;
  border-radius: 3px;
}

.countdown { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 500; }
.countdown[data-urgency="soon"] { color: var(--warn); font-weight: 600; }
.countdown[data-urgency="imminent"] { color: var(--stop); font-weight: 600; }
.countdown[data-urgency="over"] { color: var(--ink-3); }

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

form.stack { display: flex; flex-direction: column; gap: 15px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-weight: 600; font-size: 0.83rem; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.field .req { color: var(--stop); font-weight: 400; }
.field .help { font-size: 0.79rem; color: var(--ink-3); }
.field .err { font-size: 0.79rem; color: var(--stop); font-weight: 500; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="tel"], input[type="datetime-local"], input[type="date"], input[type="search"],
select, textarea {
  font: 400 0.9rem var(--font-body);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 8px 10px;
  width: 100%;
  min-width: 0;
}
input.mono, textarea.mono { font-family: var(--font-mono); }
textarea { resize: vertical; min-height: 74px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--copper); outline: 2px solid color-mix(in srgb, var(--copper) 28%, transparent); outline-offset: 0; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--stop); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-sunken); color: var(--ink-3); }
input::placeholder, textarea::placeholder { color: var(--ink-3); }

.field-row { display: grid; gap: 15px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

fieldset { border: 0; border-top: 1px solid var(--line); margin: 6px 0 0; padding: 16px 0 0; display: flex; flex-direction: column; gap: 15px; }
fieldset > legend { font-family: var(--font-display); font-weight: 600; font-size: 0.73rem; letter-spacing: 0.11em; text-transform: uppercase; color: var(--ink-3); padding: 0 8px 0 0; }

.check { display: flex; gap: 9px; align-items: flex-start; font-size: 0.87rem; }
.check input { width: auto; margin: 3px 0 0; accent-color: var(--copper); }

.form-alert { border-left: 3px solid var(--stop); background: var(--stop-wash); color: var(--stop); padding: 10px 13px; border-radius: var(--radius); font-size: 0.86rem; font-weight: 500; }
.form-note { border-left: 3px solid var(--copper); background: var(--copper-wash); padding: 11px 14px; border-radius: var(--radius); font-size: 0.86rem; }
.form-note.ok { border-color: var(--ok); background: var(--ok-wash); }
.form-note[data-tone="warn"] { border-color: var(--warn); background: var(--warn-wash); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { flex: 0 1 190px; }
.filters .field.wide { flex: 1 1 240px; }
.filters .filter-action { flex: 0 0 auto; align-self: flex-end; }

/* ------------------------------------------------------------- public screens */

.gate { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
/* Pinned to the viewport, not stretched to the form.
   A grid item fills its row, and the registration form makes that row about
   1700px tall. space-between then pushed the headline and the invite facts to
   the middle and foot of THAT height - roughly 750px down, well below the fold
   - so the panel read as blank beside the form. Sticky keeps the panel a
   screen tall and in view while the long form scrolls past it. */
.gate-side { background: var(--steel); color: var(--steel-ink); padding: 44px 46px; display: flex; flex-direction: column; justify-content: space-between; gap: 30px; position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto; }
.gate-side .brand-org { font-size: 1.3rem; }
.gate-lead { font-family: var(--font-display); font-size: clamp(1.5rem, 2.6vw, 2.1rem); font-weight: 600; line-height: 1.18; letter-spacing: -0.02em; margin: 0 0 14px; max-width: 22ch; }
.gate-side p { color: rgba(232, 237, 238, 0.76); max-width: 46ch; }
.gate-facts { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.gate-fact { display: flex; gap: 12px; align-items: baseline; font-size: 0.87rem; color: rgba(232, 237, 238, 0.85); }
.gate-fact b { font-family: var(--font-mono); color: var(--copper); font-size: 0.78rem; letter-spacing: 0.04em; flex: 0 0 auto; }
:root[data-theme="dark"] .gate-fact b { color: var(--copper); }
.gate-main { padding: 44px 46px; display: flex; flex-direction: column; justify-content: center; overflow-y: auto; }
.gate-form { width: 100%; max-width: 430px; margin: 0 auto; }
.gate-form.wide { max-width: 720px; }
.gate-form > h1 { margin-bottom: 6px; }
.gate-form > .lead { color: var(--ink-3); margin-bottom: 22px; }

@media (max-width: 860px) {
  .gate { grid-template-columns: minmax(0, 1fr); }
  /* One column here, so the panel sits above the form and must not be pinned
     or a screen tall - that would hide the form behind it on a phone. */
  .gate-side { padding: 26px 20px; gap: 18px; position: static; height: auto; overflow: visible; }
  .gate-lead { font-size: 1.4rem; }
  .gate-facts { display: none; }
  .gate-main { padding: 26px 20px 48px; }
}

/* ----------------------------------------------------------- listing cards */

.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 17px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  text-decoration: none;
  color: inherit;
  border-top: 3px solid var(--line-strong);
}
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-raise); }
.card[data-urgency="imminent"] { border-top-color: var(--stop); }
.card[data-urgency="soon"] { border-top-color: var(--warn); }
.card[data-urgency="open"] { border-top-color: var(--ok); }
.card[data-urgency="over"] { border-top-color: var(--line-strong); }
.card-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card-ref { font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-3); letter-spacing: -0.01em; }
.card h3 { font-size: 1rem; line-height: 1.3; }
.card-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.83rem; color: var(--ink-2); }
.card-meta span { display: inline; }
.card-meta b { font-weight: 600; color: var(--ink); }
.card-foot { margin-top: auto; padding-top: 11px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card-clock { display: flex; flex-direction: column; gap: 1px; }
.card-clock .label { font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.card-clock .countdown { font-size: 0.95rem; }
.card-bid { text-align: right; font-size: 0.8rem; color: var(--ink-3); }
.card-bid .amount { font-family: var(--font-mono); font-weight: 600; font-size: 0.95rem; color: var(--ok); display: block; }

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

.detail { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.6fr) minmax(290px, 1fr); align-items: start; }
@media (max-width: 1000px) { .detail { grid-template-columns: minmax(0, 1fr); } }

dl.facts { display: grid; grid-template-columns: minmax(130px, auto) minmax(0, 1fr); gap: 9px 18px; margin: 0; font-size: 0.88rem; }
dl.facts dt { color: var(--ink-3); font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; padding-top: 1px; }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
dl.facts dd.big { font-family: var(--font-mono); font-size: 1.02rem; font-weight: 600; }

.money { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; }
.money.lg { font-size: 1.2rem; }

.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 0.85rem;
}
.doc .doc-kind { font-weight: 600; }
.doc .doc-name { color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.doc .spacer { margin-left: auto; }

.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 0.85rem; }
.timeline-item:last-child { border-bottom: 0; }
.timeline-when { font-family: var(--font-mono); font-size: 0.76rem; color: var(--ink-3); }
.timeline-who { font-size: 0.78rem; color: var(--ink-3); margin-top: 2px; }

/* ------------------------------------------------------------ toasts & modal */

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 9px; z-index: 60; max-width: min(430px, calc(100vw - 32px)); }
.toast {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--ok);
  border-radius: var(--radius);
  box-shadow: var(--shadow-float);
  padding: 11px 14px;
  font-size: 0.87rem;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.toast[data-tone="error"] { border-left-color: var(--stop); }
.toast[data-tone="info"] { border-left-color: var(--copper); }
.toast .close { margin-left: auto; background: none; border: 0; color: var(--ink-3); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 2px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(16, 20, 22, 0.55); display: grid; place-items: center; padding: 18px; z-index: 70; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  width: min(620px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
}
.modal.wide { width: min(920px, 100%); }
.modal > header { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.modal > .modal-body { padding: 20px; overflow-y: auto; }
.modal > footer { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 9px; background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); flex-wrap: wrap; }
.modal .x { background: none; border: 0; font-size: 1.3rem; line-height: 1; color: var(--ink-3); cursor: pointer; padding: 0 4px; }

/* ------------------------------------------------------------------ copy box */

.copybox { display: flex; gap: 8px; align-items: stretch; }
.copybox input { font-family: var(--font-mono); font-size: 0.8rem; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs button {
  font: 500 0.87rem var(--font-body);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 9px 13px;
  color: var(--ink-3);
  cursor: pointer;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--copper); font-weight: 600; }
.tabs button:hover { color: var(--ink); }

.bar-row { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(0, 2.4fr) auto; gap: 11px; align-items: center; font-size: 0.85rem; padding: 6px 0; }
.bar-track { background: var(--surface-sunken); border-radius: 2px; height: 9px; overflow: hidden; }
.bar-fill { background: var(--copper); height: 100%; border-radius: 2px; min-width: 2px; }
.bar-fill[data-tone="quiet"] { background: var(--line-strong); }

@media print {
  .rail, .topbar-actions, .toasts, .btn { display: none !important; }
  body, .panel { background: #fff; }
  .shell { grid-template-columns: 1fr; }
}

/* --------------------------------------------- onboarding document checklist */

.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.check-list li { display: flex; gap: 9px; align-items: baseline; font-size: 0.9rem; }
.check-list .check-mark { font-family: var(--font-mono); flex: 0 0 auto; width: 1em; }
.check-list li[data-state="done"] .check-mark { color: var(--ok); }
.check-list li[data-state="todo"] .check-mark { color: var(--warn); }
/* Outstanding items carry the weight; collected ones recede rather than
   disappear, because "we already hold this" is itself worth being able to see. */
.check-list li[data-state="done"] > span:last-child { color: var(--ink-3); }
.check-list li[data-state="todo"] > span:last-child { font-weight: 500; }
