/* Roan Dashboard design system, revision 2 (2026-07-03, directed by Stiles).
   A clean modern instrument. Standing prohibitions still apply: no teal,
   no emoji, no em dashes in copy, no gradient accents, no vanity metrics.
   Signature details kept: serif display type, tabular numerals, the
   immutability line. All colors run through variables; dark mode swaps
   the variables and nothing else. */

:root {
  --bg: #FAFAF7;
  --surface: #FFFFFF;
  --surface-2: #F4F3EE;
  --ink: #1A1A1A;
  --ink-soft: #3D3C38;
  --graphite: #6B6B6B;
  --faint: #9A988F;
  --roan: #7A3B2E;
  --roan-strong: #8E4636;
  --roan-tint: rgba(122, 59, 46, 0.08);
  --green: #3D6B4F;
  --green-tint: rgba(61, 107, 79, 0.10);
  --amber: #8A6D2F;
  --amber-tint: rgba(138, 109, 47, 0.10);
  --error: #8C2B2B;
  --hairline: rgba(26, 26, 26, 0.10);
  --hairline-strong: rgba(26, 26, 26, 0.18);
  --shadow-1: 0 1px 2px rgba(26, 26, 26, 0.05);
  --shadow-2: 0 1px 3px rgba(26, 26, 26, 0.06), 0 8px 24px rgba(26, 26, 26, 0.05);
  --serif: "Source Serif 4", "Iowan Old Style", "Palatino", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Code", Menlo, monospace;
  --radius: 8px;
  --radius-sm: 6px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131311;
    --surface: #1B1B18;
    --surface-2: #22221E;
    --ink: #ECEAE2;
    --ink-soft: #C9C7BE;
    --graphite: #98968D;
    --faint: #6E6C64;
    --roan: #C4705A;
    --roan-strong: #D07E68;
    --roan-tint: rgba(196, 112, 90, 0.12);
    --green: #6FA98A;
    --green-tint: rgba(111, 169, 138, 0.12);
    --amber: #C2A160;
    --amber-tint: rgba(194, 161, 96, 0.12);
    --error: #D07A7A;
    --hairline: rgba(236, 234, 226, 0.10);
    --hairline-strong: rgba(236, 234, 226, 0.20);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-2: 0 1px 3px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { background: var(--bg); }

body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--roan); }
p a, td a, .prose a {
  text-decoration: underline;
  text-decoration-color: var(--hairline-strong);
  text-underline-offset: 3px;
}

h1, h2, h3, .serif {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
h1 { font-size: 28px; line-height: 1.25; }
h2 { font-size: 18px; margin: 36px 0 14px; }
h3 { font-size: 16px; }

.num { font-variant-numeric: tabular-nums; }

/* ---------- Shell: rail + topbar + content ---------- */

.layout { display: flex; min-height: 100vh; }

.rail {
  width: 228px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--hairline);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.rail .wordmark {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding: 4px 10px 18px;
  display: block;
}
.rail .wordmark span { color: var(--roan); }
.rail nav { display: flex; flex-direction: column; gap: 2px; }
.rail nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--graphite);
  font-size: 14px;
  font-weight: 500;
  transition: background 120ms ease, color 120ms ease;
}
.rail nav a svg { width: 16px; height: 16px; stroke: currentColor; flex-shrink: 0; }
.rail nav a:hover { color: var(--ink); background: var(--surface-2); }
.rail nav a.active { color: var(--roan); background: var(--roan-tint); }
.rail .rail-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 16px 10px 6px;
}
.rail .rail-foot {
  margin-top: auto;
  border-top: 1px solid var(--hairline);
  padding: 12px 10px 0;
  font-size: 13px;
}
.rail .rail-foot .who { font-weight: 500; }
.rail .rail-foot .firm { color: var(--graphite); font-size: 12px; }
.rail .rail-foot form { margin-top: 8px; }

main.content {
  flex: 1;
  min-width: 0;
  padding: 40px 48px 96px;
  max-width: 1080px;
}

.page-head { margin-bottom: 28px; }
.page-head .crumb { font-size: 13px; color: var(--graphite); margin-bottom: 6px; }
.page-head .crumb a { color: var(--graphite); }
.page-head .crumb a:hover { color: var(--roan); }
.page-sub { color: var(--graphite); font-size: 14.5px; margin-top: 6px; max-width: 620px; }

/* ---------- Stat blocks ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin: 4px 0 8px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-1);
}
.stat .stat-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--graphite);
}
.stat .stat-value {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  margin-top: 4px;
}
.stat .stat-note { font-size: 13px; color: var(--graphite); margin-top: 2px; }
.stat a { text-decoration: none; }

/* ---------- Cards and panels ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}

.card-list { display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-1);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
a.card:hover, .card.linked:hover { border-color: var(--hairline-strong); box-shadow: var(--shadow-2); color: var(--ink); }
.card .card-title { font-family: var(--serif); font-size: 17px; font-weight: 600; }
.card .card-meta { color: var(--graphite); font-size: 13px; margin-top: 3px; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }

/* ---------- Status ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 550;
  letter-spacing: 0.01em;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  color: var(--graphite);
  background: var(--surface-2);
  vertical-align: 1px;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.badge-deployed, .badge.badge-approved { color: var(--green); background: var(--green-tint); border-color: transparent; }
.badge.badge-in_progress, .badge.badge-in_build, .badge.badge-scoping,
.badge.badge-received, .badge.badge-proposed { color: var(--roan); background: var(--roan-tint); border-color: transparent; }
.badge.badge-in_testing, .badge.badge-pending { color: var(--amber); background: var(--amber-tint); border-color: transparent; }
.badge.badge-paused, .badge.badge-declined, .badge.badge-retired, .badge.badge-rejected {
  color: var(--graphite);
}

/* ---------- Tables: the ledger treatment ---------- */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--graphite);
  padding: 12px 16px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface-2);
  white-space: nowrap;
}
th:first-child { border-top-left-radius: var(--radius); }
th:last-child { border-top-right-radius: var(--radius); }
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}
tbody tr { transition: background 120ms ease; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.adjustment td { color: var(--graphite); }
tr.total td {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--surface-2);
  border-top: 1px solid var(--hairline-strong);
}
tr.total:hover td { background: var(--surface-2); }

.ledger-terms {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--graphite);
}

/* ---------- Forms ---------- */

label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-soft); margin: 16px 0 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], input[type="file"], textarea, select {
  width: 100%;
  max-width: 480px;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
textarea { min-height: 104px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--roan);
  box-shadow: 0 0 0 3px var(--roan-tint);
}
::placeholder { color: var(--faint); }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  color: #FFFFFF;
  background: var(--roan);
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  cursor: pointer;
  margin-top: 18px;
  transition: background 120ms ease;
}
button:hover, .button:hover { background: var(--roan-strong); color: #FFFFFF; }
button.secondary, .button.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--hairline-strong);
}
button.secondary:hover, .button.secondary:hover { background: var(--surface-2); color: var(--ink); }
button.inline { margin-top: 0; padding: 5px 12px; font-size: 13px; }
button.quiet { background: none; border: none; color: var(--graphite); padding: 0; font-size: 13px; }
button.quiet:hover { background: none; color: var(--roan); }

/* ---------- Flash and errors ---------- */

.flash {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--roan);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 22px;
  font-size: 14px;
  box-shadow: var(--shadow-1);
}
.flash.error { border-left-color: var(--error); }
.field-error { color: var(--error); font-size: 13px; margin-top: 4px; }

.empty {
  color: var(--graphite);
  background: var(--surface);
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  font-size: 14px;
}

.unread-marker {
  display: inline-block;
  width: 7px; height: 7px;
  background: var(--roan);
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: 2px;
}

/* ---------- Messages: chat treatment ---------- */

.chat {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 190px);
  min-height: 380px;
}
.chat-log {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 2px 14px;
}
.bubble {
  max-width: 68%;
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 9px 14px;
  box-shadow: var(--shadow-1);
}
.bubble.mine {
  align-self: flex-end;
  background: var(--roan-tint);
  border-color: transparent;
  border-radius: 14px;
  border-bottom-right-radius: 4px;
}
.bubble .b-body { white-space: pre-wrap; font-size: 14.5px; }
.bubble .b-file { font-size: 13px; margin-top: 4px; }
.b-meta {
  font-size: 11.5px;
  color: var(--faint);
  padding: 0 6px 6px;
  align-self: flex-start;
}
.b-meta.mine { align-self: flex-end; }
.chat-day {
  align-self: center;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 14px 0 6px;
}
.composer {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  border-top: 1px solid var(--hairline);
  padding-top: 14px;
  background: var(--bg);
}
.composer textarea {
  flex: 1;
  max-width: none;
  min-height: 44px;
  max-height: 160px;
  border-radius: 12px;
}
.composer button { margin-top: 0; height: 44px; border-radius: 12px; }
.composer .attach {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 1px solid var(--hairline-strong);
  border-radius: 12px;
  color: var(--graphite);
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease;
}
.composer .attach:hover { color: var(--roan); border-color: var(--roan); }
.composer .attach svg { width: 18px; height: 18px; stroke: currentColor; }
.composer .attach.has-file { color: var(--roan); border-color: var(--roan); }

.convo-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--roan-tint);
  color: var(--roan);
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.convo { display: flex; gap: 12px; align-items: center; }
.convo .convo-body { min-width: 0; }

/* ---------- Helen marketplace ---------- */

.shelf-head { display: flex; align-items: baseline; gap: 10px; margin: 36px 0 14px; }
.shelf-head h2 { margin: 0; }
.shelf-head .shelf-note { font-size: 13px; color: var(--graphite); }

.market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.market-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-1);
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.market-card:hover { border-color: var(--hairline-strong); box-shadow: var(--shadow-2); transform: translateY(-1px); color: var(--ink); }
.market-card .ship-lockup { font-family: var(--serif); font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.market-card .tagline { color: var(--graphite); font-size: 13.5px; margin-top: 3px; }
.market-card .desc { font-size: 14px; margin-top: 10px; color: var(--ink-soft); }
.market-card .card-foot { margin-top: auto; padding-top: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.demo-stamp {
  display: inline-block;
  border: 1px solid var(--graphite);
  color: var(--graphite);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 3px;
}
.fit-tag {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--green);
  background: var(--green-tint);
  border-radius: 999px;
  padding: 2px 9px;
}
.vertical-tag { font-size: 12px; color: var(--graphite); }

.item-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.item-hero h1 { font-size: 34px; }
.item-meta {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 16px 20px;
  min-width: 240px;
  font-size: 13.5px;
}
.item-meta dt { font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--graphite); margin-top: 10px; }
.item-meta dt:first-child { margin-top: 0; }
.item-meta dd { margin: 1px 0 0; }
.prose { max-width: 640px; font-size: 15px; color: var(--ink-soft); }
.prose p { margin-bottom: 12px; }

/* ---------- Collapsibles ---------- */

details summary {
  cursor: pointer;
  color: var(--graphite);
  font-size: 13px;
  font-weight: 500;
  margin-top: 8px;
  user-select: none;
}
details summary:hover { color: var(--roan); }
details .detail-body {
  color: var(--graphite);
  font-size: 13px;
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 12.5px;
}

/* ---------- Landing page ---------- */

.landing { min-height: 100vh; display: flex; flex-direction: column; }
.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
}
.landing-nav .wordmark { font-family: var(--serif); font-size: 22px; font-weight: 700; }
.landing-nav .wordmark span { color: var(--roan); }
.landing-nav .nav-links { display: flex; align-items: center; gap: 22px; font-size: 14px; font-weight: 500; }
.landing-nav .nav-links a { color: var(--graphite); }
.landing-nav .nav-links a:hover { color: var(--ink); }
.landing-nav .nav-links .button { margin-top: 0; padding: 8px 18px; }

.hero {
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
  padding: 72px 40px 48px;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(300px, 460px);
  gap: 56px;
  align-items: center;
}
.hero h1 { font-size: 44px; line-height: 1.15; letter-spacing: -0.02em; }
.hero .hero-sub { font-size: 17px; color: var(--graphite); margin-top: 18px; max-width: 460px; }
.hero .hero-actions { margin-top: 28px; display: flex; gap: 12px; }
.hero .hero-actions .button { margin-top: 0; padding: 11px 22px; font-size: 15px; }

.hero-ledger {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.hero-ledger .hero-ledger-title {
  padding: 12px 18px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--graphite);
  border-bottom: 1px solid var(--hairline);
  background: var(--surface-2);
}
.hero-ledger table { font-size: 13px; }
.hero-ledger td { padding: 10px 16px; }
.hero-ledger td:first-child, .hero-ledger td:last-child { white-space: nowrap; }
.hero-ledger .caption { padding: 10px 18px; font-size: 11.5px; color: var(--faint); border-top: 1px solid var(--hairline); }

.landing-points {
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
  padding: 8px 40px 80px;
}
.landing-points .point {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  padding: 22px 0;
  border-top: 1px solid var(--hairline);
  font-size: 15px;
}
.landing-points .point h3 { font-size: 16px; }
.landing-points .point p { color: var(--graphite); max-width: 560px; }

.landing-foot {
  margin-top: auto;
  border-top: 1px solid var(--hairline);
  padding: 24px 40px;
  font-size: 13px;
  color: var(--graphite);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

/* ---------- Auth pages ---------- */

.auth-shell { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  padding: 32px 32px 28px;
}
.auth-card h1 { font-size: 22px; }
.auth-card .page-sub { margin-top: 4px; }
.auth-card input { max-width: none; }
.auth-card button { width: 100%; margin-top: 22px; }
.auth-foot { margin-top: 18px; font-size: 12.5px; color: var(--graphite); text-align: center; max-width: 400px; }
.auth-brand { font-family: var(--serif); font-size: 20px; font-weight: 700; margin-bottom: 18px; }
.auth-brand span { color: var(--roan); }

/* ---------- Utility ---------- */

.rule { border: 0; border-top: 1px solid var(--hairline); margin: 28px 0; }
.muted { color: var(--graphite); }
.small { font-size: 13px; }
.mt-0 { margin-top: 0; }
[x-cloak] { display: none !important; }

.admin-note { font-size: 12.5px; color: var(--faint); }

code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 2px 6px;
  word-break: break-all;
}

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

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 40px; gap: 32px; }
  .hero h1 { font-size: 34px; }
  .landing-points .point { grid-template-columns: 1fr; gap: 6px; }
}

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .rail {
    width: auto;
    height: auto;
    position: static;
    flex-direction: column;
    padding: 14px 16px;
  }
  .rail nav { flex-direction: row; flex-wrap: wrap; gap: 2px; }
  .rail nav a { padding: 7px 10px; }
  .rail .wordmark { padding-bottom: 8px; }
  .rail .rail-label { display: none; }
  .rail .rail-foot { margin-top: 10px; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; }
  .rail .rail-foot form { margin-top: 0; }
  main.content { padding: 24px 18px 64px; }
  .landing-nav { padding: 16px 20px; }
  .hero { padding-left: 20px; padding-right: 20px; }
  .landing-points { padding-left: 20px; padding-right: 20px; }
  .landing-foot { padding-left: 20px; padding-right: 20px; }
  h1 { font-size: 24px; }
}
