/* =============================================================================
   Mid Solution Programs Portal — paper / ink / teal design system.
   Drop-in stylesheet referenced by base.html as /static/portal.css.

   Loaded fonts (in base.html):
     Newsreader  — display / serif headlines
     Geist       — body sans
     Geist Mono  — code, tokens, eyebrow microcopy

   Palette: warm cream paper background, deep ink text, teal accent.
   ============================================================================= */

:root {
  /* paper / ink */
  --bg:        #EAE4D2;   /* outer paper */
  --surface:   #FBF8EC;   /* card */
  --surface-2: #F1ECDA;   /* slightly darker — chrome bar, subtle blocks */
  --ink:       #14161A;   /* primary text / headings */
  --ink-2:     #2C2F35;   /* body */
  --muted:     #6E7077;   /* meta, captions */
  --border:    #D8D2C0;   /* input, faint dividers */
  --border-2:  #C7C0AC;   /* card edges */
  --rule:      #DDD7C4;   /* horizontal divider, table rows */

  /* accent / status */
  --accent:    #2A6F70;   /* teal, primary action + brand */
  --accent-2:  #1F5556;
  --accent-pale:#D4E0DC;
  --danger:    #B23A3A;
  --danger-pale:#F1D6D2;
  --warn:      #B07015;
  --warn-pale: #F0E0BB;
  --info:      #3D6A99;
  --info-pale: #D9E5F1;
  --ok:        #3F7A47;
  --ok-pale:   #DCE9D6;

  /* fonts */
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans:    "Geist", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono:    "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ── reset + base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
main {
  max-width: 1100px;
  margin: 36px auto 80px;
  padding: 0 24px;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin: 0 0 8px;
}
h1 { font-size: 36px;  line-height: 1.15; }
h2 { font-size: 22px;  line-height: 1.25; }
h3 { font-size: 18px;  line-height: 1.3; }
h4 { font-size: 14.5px; font-family: var(--font-sans); font-weight: 600;
     letter-spacing: 0.005em; text-transform: none;
     margin: 22px 0 10px; color: var(--ink); }
p { margin: 8px 0; }
em { font-style: italic; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 20px 0; }
code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--ink);
}

/* ── helpers ──────────────────────────────────────────────────────────────── */
.muted { color: var(--muted); }
.mono  { font-family: var(--font-mono); }
.lead {
  font-size: 16px;
  color: var(--ink-2);
  max-width: 64ch;
  line-height: 1.55;
}
.lede { font-size: 16px; color: var(--ink-2); max-width: 60ch; }
.eyebrow,
.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.section-label { display: inline-flex; align-items: center; gap: 6px; }
.section-label > span:first-child {
  display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: var(--accent);
}
.crumb {
  display: flex; gap: 8px; align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
}
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--ink-2); }
.crumb > span { color: var(--border-2); }
.divider { border-top: 1px solid var(--rule); margin: 16px 0; }

/* ── header bar / brand ───────────────────────────────────────────────────── */
header.bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
  padding: 14px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-2);
}
.brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: inherit;
}
.brand:hover { text-decoration: none; }
.seal {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 6px;
}
.wordmark { display: flex; flex-direction: column; line-height: 1.15; }
.wordmark .name {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.wordmark .sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.nav {
  display: flex; align-items: center; gap: 18px;
}
.nav a, .nav .who {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav .who { font-family: var(--font-mono); font-size: 12px; }

/* ── buttons ──────────────────────────────────────────────────────────────── */
button, .btn, a.btn, input[type="submit"] {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.005em;
  padding: 9px 18px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #FBF8EC;
  cursor: pointer;
  text-decoration: none;
  transition: background 100ms ease, border-color 100ms ease, color 100ms ease;
}
button:hover, .btn:hover, a.btn:hover, input[type="submit"]:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #FBF8EC;
  text-decoration: none;
}
button:disabled, .btn[disabled], button[disabled] {
  background: var(--border-2);
  border-color: var(--border-2);
  color: #FBF8EC;
  cursor: not-allowed;
}
button.secondary, .btn.secondary, a.btn.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
button.secondary:hover, .btn.secondary:hover, a.btn.secondary:hover {
  background: var(--accent-pale);
  color: var(--accent-2);
}
button.ghost, .btn.ghost, a.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--border-2);
}
button.ghost:hover, .btn.ghost:hover, a.btn.ghost:hover {
  color: var(--ink-2);
  border-color: var(--ink-2);
  background: transparent;
}
button.danger, .btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--surface);
}
button.danger:hover, .btn.danger:hover {
  background: #8E2C2C;
  border-color: #8E2C2C;
}
.btn-row {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-top: 18px;
}

/* ── forms ────────────────────────────────────────────────────────────────── */
label {
  display: block;
  margin: 14px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], select, textarea {
  display: block;
  width: 100%;
  padding: 9px 11px;
  margin-top: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.4;
  transition: border-color 100ms ease, box-shadow 100ms ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-pale);
}
input::placeholder { color: var(--muted); opacity: 1; }

/* status messages */
.err {
  background: var(--danger-pale);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin: 12px 0;
}
.ok {
  background: var(--ok-pale);
  border: 1px solid var(--ok);
  color: var(--ok);
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin: 12px 0;
}

/* ── cards / surfaces ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 24px 26px;
  margin: 22px 0;
  box-shadow: 0 1px 0 rgba(20,22,26,.02);
}
.card.alert {
  border-color: var(--danger);
  background: linear-gradient(180deg, var(--danger-pale) 0%, var(--surface) 60%);
}
.card.alert .section-label > span:first-child { background: var(--danger); }
.card details > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  margin-top: 14px;
  padding: 6px 0;
  list-style: none;
}
.card details > summary::-webkit-details-marker { display: none; }
.card details > summary::before {
  content: "▸ "; color: var(--muted); margin-right: 4px;
}
.card details[open] > summary::before { content: "▾ "; }

/* ── tables ───────────────────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
thead th {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-align: left;
  font-weight: 500;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-2);
}
tbody td {
  padding: 10px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: 0; }

/* "props" — label/value table for profile + program metadata */
table.props { margin-top: 6px; }
table.props th {
  width: 200px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--muted);
  font-weight: 500;
  text-align: left;
  padding: 9px 12px 9px 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
table.props td {
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13.5px;
  color: var(--ink-2);
}
table.props tr:last-child th, table.props tr:last-child td { border-bottom: 0; }

.table-wrap {
  border: 1px solid var(--border-2);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}
.table-wrap table thead th { padding: 12px 14px; background: var(--surface-2); }
.table-wrap table tbody td { padding: 11px 14px; }

/* ── pills ────────────────────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}
.pill.ok     { background: var(--ok-pale);     border-color: var(--ok);     color: var(--ok); }
.pill.info   { background: var(--info-pale);   border-color: var(--info);   color: var(--info); }
.pill.warn   { background: var(--warn-pale);   border-color: var(--warn);   color: var(--warn); }
.pill.danger { background: var(--danger-pale); border-color: var(--danger); color: var(--danger); }

/* ── page-head / group-head ──────────────────────────────────────────────── */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px;
  margin: 8px 0 28px;
  flex-wrap: wrap;
}
.page-head .left { flex: 1 1 480px; }
.page-head h1 { margin-top: 6px; }
.page-head .lead { margin-top: 12px; }

.group-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 36px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}
.group-head h2 { margin: 0; }
.group-head .count {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

/* ── hero / col-2 / signup-grid ──────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px;
  align-items: start;
  margin: 16px 0 42px;
}
.hero h1 { font-size: 44px; line-height: 1.08; margin-bottom: 0; }
.hero h1 em { font-style: italic; color: var(--accent); }

.col-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin: 28px 0;
}

.signup-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 28px;
  align-items: start;
}
.signup-grid aside { display: flex; flex-direction: column; gap: 18px; }

/* ── attestation / sidebar info block ─────────────────────────────────────── */
.attestation {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 18px 20px;
}
.attestation .head {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}
.attestation .row {
  display: flex; justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px dotted var(--rule);
}
.attestation .row:last-child { border-bottom: 0; }
.attestation .row .k { color: var(--muted); font-family: var(--font-mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; }
.attestation .row .v { color: var(--ink-2); font-family: var(--font-mono); font-size: 12px; }

/* ── timeline ─────────────────────────────────────────────────────────────── */
.timeline {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 20px 22px;
}
.timeline ol { list-style: none; padding: 0; margin: 0; }
.timeline li {
  display: grid; grid-template-columns: 32px 1fr;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
}
.timeline li:last-child { border-bottom: 0; }
.timeline li .dot {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}
.timeline li .ttl  { font-weight: 600; color: var(--ink-2); margin-bottom: 2px; }
.timeline li .desc { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.timeline li.current .dot {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
}
.timeline li.current .ttl { color: var(--ink); }

/* ── proof-of-work status ─────────────────────────────────────────────────── */
.pow-status {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.pulse {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-pale);
  animation: pulse 1.4s ease-out infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(42,111,112,0.45); }
  70%  { box-shadow: 0 0 0 10px rgba(42,111,112,0);  }
  100% { box-shadow: 0 0 0 0 rgba(42,111,112,0);     }
}

/* ── token / copy-row ─────────────────────────────────────────────────────── */
pre.token, .token {
  font-family: var(--font-mono);
  font-size: 14px;
  background: var(--ink);
  color: var(--bg);
  padding: 16px 18px;
  border-radius: 8px;
  word-break: break-all;
  white-space: pre-wrap;
  margin: 14px 0 0;
  line-height: 1.5;
}
.copy-row {
  display: flex; align-items: center; gap: 14px;
  margin-top: 12px;
}

/* ── program-card ─────────────────────────────────────────────────────────── */
.program-card {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  margin: 18px 0;
  overflow: hidden;
}
.program-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px;
  padding: 22px 26px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-2);
}
.program-head h3 { margin: 0 0 4px; }
.program-head .summary {
  margin: 0; font-size: 13.5px; color: var(--muted); max-width: 60ch;
}
.program-head .meta { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.program-body { padding: 18px 26px 22px; }

/* ── empty ────────────────────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 32px 18px;
  color: var(--muted);
}
.empty .glyph {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--border-2);
  margin-bottom: 8px;
}
.empty p { margin: 0; max-width: 50ch; margin-inline: auto; }

/* ── meta-strip (footer-style fact line) ──────────────────────────────────── */
.meta-strip {
  display: flex; gap: 26px; flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}
.meta-strip span b { color: var(--ink); font-weight: 500; }

/* ── responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 880px) {
  main { padding: 0 18px; margin-top: 24px; }
  header.bar { padding: 12px 18px; gap: 14px; }
  .hero { grid-template-columns: 1fr; gap: 22px; }
  .hero h1 { font-size: 36px; }
  .col-2, .signup-grid { grid-template-columns: 1fr; }
  table.props th { width: 130px; }
  .program-head { flex-direction: column; }
  .program-head .meta { align-items: flex-start; flex-direction: row; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
