/* Alpaca Health — Site Launch Board. Flat paper world, own palette
   (not Alpaca's brand). Phone rules: ≥16px body, ≥14px labels,
   ≥44px tap targets, one column at 375px, zero horizontal scroll. */

:root {
  --paper: #f3f1e8;
  --paper-sunk: #e9e6d8;
  --paper-edge: #dbd6c3;
  --ink: #1c1b16;
  --muted: #55524a;
  --dim: #7a766a;
  --line: #d8d3c1;
  --line-strong: #bdb7a2;

  --ok: #0b6a49;    --ok-bg: rgba(15, 138, 95, .10);
  --warn: #6b5000;  --warn-bg: rgba(226, 178, 0, .14);
  --bad: #a32d14;   --bad-bg: rgba(201, 58, 30, .10);
  --act: #1834b4;   --act-bg: rgba(27, 63, 216, .08);

  --sans: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "Chivo Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius: 0px;
  --shadow: none;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--ink); text-decoration-color: var(--act); text-decoration-thickness: 2px; text-underline-offset: .18em; }
a:hover { color: var(--act); }

button, select, textarea, input { font-family: inherit; font-size: 16px; color: var(--ink); }

:focus-visible { outline: 2px solid var(--act); outline-offset: 2px; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: var(--paper); padding: 10px 14px; z-index: 200;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ---------- top bar ---------- */

.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--paper-sunk);
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; flex-direction: column; line-height: 1.15; cursor: pointer; }
.brand-mark { font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.brand-dot { color: var(--act); }
.brand-sub { font-size: 14px; color: var(--muted); font-family: var(--mono); }

.topnav { display: flex; gap: 4px; }
.nav-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  font-weight: 600; font-size: 15px; color: var(--muted);
  text-decoration: none; border-bottom: 3px solid transparent;
}
.nav-link:hover { color: var(--ink); }
.nav-link.active { color: var(--ink); border-bottom-color: var(--act); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.demo-badge {
  font-family: var(--mono); font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
  border: 1px solid var(--line-strong); padding: 4px 8px; color: var(--muted);
  white-space: nowrap;
}

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px;
  border: 1px solid var(--ink); background: var(--paper);
  font-weight: 600; font-size: 15px; cursor: pointer;
  text-decoration: none; color: var(--ink);
}
.btn:hover { background: var(--paper-sunk); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn-sm { min-height: 44px; padding: 8px 12px; font-size: 14px; }
.btn-primary { background: var(--act); border-color: var(--act); color: #fff; }
.btn-primary:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-ghost { border-color: var(--line-strong); background: var(--paper); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); background: var(--paper-sunk); }

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

#view { max-width: 1280px; margin: 0 auto; padding: 24px 20px 48px; }

.site-foot {
  max-width: 1280px; margin: 0 auto; padding: 18px 20px 40px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 14px;
}
.site-foot p { margin-bottom: 6px; }
.foot-links a { font-size: 14px; }

.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.eyebrow { font-family: var(--mono); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--act); font-weight: 700; }
h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin: 4px 0 6px; }
.tagline { color: var(--muted); max-width: 640px; }
.hero-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.kpis { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.kpi {
  display: inline-flex; flex-direction: column; align-items: flex-end; gap: 1px;
  border-left: 3px solid var(--act); padding: 6px 10px; background: var(--paper-sunk);
}
.kpi b { font-size: 20px; font-family: var(--mono); }
.kpi { font-size: 13px; color: var(--muted); }

.board-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.board-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.board-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* ---------- cards & rows ---------- */

.card {
  border: 1px solid var(--line-strong); background: var(--paper);
  padding: 16px;
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.card-sub { font-size: 14px; color: var(--muted); }
.section-title { font-size: 17px; font-weight: 700; margin: 6px 0 10px; }
.section-sub { font-size: 14px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px; }

.rows { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding: 12px 4px;
  min-height: 56px;
}
.row:first-child { border-top: none; }
.row-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.row-title b { font-size: 16px; }
.row-sub { font-size: 14px; color: var(--muted); }
.row-main { flex: 1 1 260px; min-width: 0; }
.row-note { font-size: 14px; color: var(--muted); margin-top: 2px; }
.row-status { white-space: nowrap; }
.row-cta { white-space: nowrap; }
.row-next { flex: 1 1 220px; min-width: 0; }
.next-label { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; }
.next .next-label { color: var(--muted); }
.next.blocked .next-label { color: var(--bad); }
.next.progress .next-label { color: var(--warn); }
.next.live .next-label { color: var(--ok); }
.next-note { font-size: 14px; color: var(--muted); margin-top: 2px; }

.practice-row, .fam-row { cursor: pointer; }
.practice-row:hover, .fam-row:hover { background: var(--paper-sunk); }

.row-steps { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.step-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 26px; border: 1px solid var(--line-strong);
  font-family: var(--mono); font-size: 14px;
}
.step-done { color: var(--ok); border-color: var(--ok); background: var(--ok-bg); }
.step-progress { color: var(--warn); border-color: var(--warn); background: var(--warn-bg); }
.step-blocked { color: var(--bad); border-color: var(--bad); background: var(--bad-bg); font-weight: 700; }
.step-pending { color: var(--dim); }

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

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 14px; line-height: 1.15; font-weight: 600;
  padding: 5px 9px; border: 1px solid var(--line-strong);
  border-radius: 999px; white-space: nowrap;
}
.chip-ok { color: var(--ok); border-color: var(--ok); background: var(--ok-bg); }
.chip-wait { color: var(--warn); border-color: var(--warn); background: var(--warn-bg); }
.chip-bad { color: var(--bad); border-color: var(--bad); background: var(--bad-bg); }
.chip-mute { color: var(--muted); border-color: var(--line-strong); background: var(--paper); }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }

.src-chip {
  display: inline-block; margin-top: 2px;
  font-family: var(--mono); font-size: 14px; color: var(--act);
  background: var(--act-bg); padding: 1px 6px;
}

.code-chip {
  font-family: var(--mono); font-size: 14px; border: 1px solid var(--line-strong);
  padding: 2px 7px; vertical-align: 2px; color: var(--muted);
}

/* ---------- checks (checklist rows) ---------- */

.checks { display: flex; flex-direction: column; }
.check-row {
  display: flex; gap: 12px; align-items: flex-start;
  border-top: 1px solid var(--line); padding: 11px 2px;
}
.check-row:first-child { border-top: none; }
.check-status { flex: 0 0 auto; padding-top: 2px; }
.check-main { flex: 1 1 auto; min-width: 0; }
.check-main b { font-size: 16px; }
.check-meta { display: block; font-size: 14px; color: var(--muted); }
.check-note { font-size: 15px; margin-top: 4px; }
.check-cta { flex: 0 0 auto; }
.blocked-note {
  font-size: 15px; margin-top: 4px; padding: 8px 10px;
  border-left: 3px solid var(--bad); background: var(--bad-bg); color: var(--bad);
}
.step-note { font-size: 15px; color: var(--muted); margin: 4px 0; }
.sugg-words { font-size: 15px; margin: 6px 0; }
.sugg-note { font-size: 14px; color: var(--muted); }
.sugg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sugg-card { margin-bottom: 12px; }
.sugg-card h2 { font-size: 16px; }

.accented-card { border-left: 4px solid var(--act); }
.warn-card { border-left: 4px solid var(--warn); }
.ok-card { border-left: 4px solid var(--ok); }

/* ---------- demo control ---------- */

.demo-ctl { background: var(--paper-sunk); }
.ctl-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  border-top: 1px solid var(--line); padding: 10px 2px;
}
.ctl-row:first-of-type { border-top: none; }
.ctl-info { display: flex; flex-direction: column; min-width: 0; }
.ctl-info b { font-size: 15px; }
.ctl-note { font-size: 14px; color: var(--muted); }

/* ---------- activity log ---------- */

.act { list-style: none; margin-top: 4px; }
.act-row { font-size: 14px; padding: 8px 2px; border-top: 1px solid var(--line); }
.act-row:first-child { border-top: none; }
.act-when { font-family: var(--mono); font-size: 14px; color: var(--dim); margin-right: 6px; }

.rail-subhead {
  font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); margin: 14px 0 2px;
}

/* ---------- funnel ---------- */

.stage-grid {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px; margin-bottom: 8px;
}
.stage-card {
  border: 1px solid var(--line-strong); padding: 14px 12px;
  background: var(--paper-sunk); display: flex; flex-direction: column; gap: 2px;
}
.stage-count b { font-size: 30px; font-family: var(--mono); line-height: 1.05; }
.stage-name { font-weight: 700; font-size: 15px; }
.stage-conv { font-size: 14px; color: var(--muted); font-family: var(--mono); }
.funnel-note { font-size: 14px; color: var(--muted); margin-bottom: 18px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filter { display: flex; flex-direction: column; gap: 2px; font-size: 14px; color: var(--muted); margin-right: 4px; }
.filter select {
  min-height: 44px; padding: 0 8px; background: var(--paper);
  border: 1px solid var(--line-strong); min-width: 150px;
}

/* ---------- capacity ---------- */

.cap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.cap-cell { border: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; }
.cap-cell b { font-size: 18px; font-family: var(--mono); }
.cap-cell span { font-size: 14px; color: var(--muted); }

.prov-row { padding: 8px 2px; border-top: 1px solid var(--line); font-size: 15px; }

.slot-list { display: flex; flex-direction: column; gap: 8px; }
.slot-chip {
  display: inline-flex; flex-wrap: wrap; gap: 6px;
  border: 1px solid var(--line-strong); padding: 8px 12px; font-size: 14px;
  background: var(--paper-sunk);
}
.slot-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: 56px; padding: 10px 14px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--paper);
  text-align: left;
}
.slot-btn:hover { border-color: var(--ink); background: var(--paper-sunk); }
.slot-btn b { font-size: 16px; }
.slot-btn span { font-size: 14px; color: var(--muted); }

/* ---------- back office ---------- */

.bo-rows .row { align-items: center; }
.bo-cell { display: flex; flex-direction: column; min-width: 120px; }
.bo-cell b { font-size: 16px; font-family: var(--mono); }
.bo-cell span { font-size: 14px; color: var(--muted); }

/* ---------- empty / alert states ---------- */

.empty { border: 1px dashed var(--line-strong); padding: 22px 16px; text-align: center; margin: 6px 0; }
.empty-title { font-weight: 700; font-size: 15px; }
.empty-sub { font-size: 14px; color: var(--muted); margin-top: 4px; }
.alert-note { color: var(--bad); }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--paper);
  padding: 12px 18px; font-size: 15px; z-index: 120;
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
  max-width: min(92vw, 560px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- modal ---------- */

.modal-scrim {
  position: fixed; inset: 0; background: rgba(28, 27, 22, .45);
  display: flex; align-items: flex-end; justify-content: center; z-index: 100;
}
.modal {
  background: var(--paper); border: 1px solid var(--line-strong);
  width: min(560px, 100vw); max-height: 90vh; overflow-y: auto;
  padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
}
.modal h2 { font-size: 19px; }
.modal-select, .modal-textarea {
  width: 100%; min-height: 44px; border: 1px solid var(--line-strong);
  background: var(--paper); padding: 8px;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- walkthrough ---------- */

.wt-panel {
  position: fixed; right: 18px; bottom: 18px; z-index: 110;
  width: min(360px, calc(100vw - 36px));
  background: var(--ink); color: var(--paper);
  border: 1px solid var(--ink); padding: 16px;
  box-shadow: 0 0 0 1px var(--paper-edge);
}
.wt-title { font-weight: 800; font-size: 16px; margin-bottom: 6px; }
.wt-text { font-size: 14px; color: #d8d3c1; margin-bottom: 12px; }
.wt-text b { color: #fff; }
.wt-actions { display: flex; justify-content: flex-end; gap: 8px; }
.wt-panel .btn-ghost { border-color: #57544a; background: transparent; color: var(--paper); }
.wt-panel .btn-primary { background: var(--paper); color: var(--ink); border-color: var(--paper); }

.wt-highlight {
  outline: 3px solid var(--act); outline-offset: 3px;
  animation: wt-pulse 1.1s ease-in-out infinite alternate;
}
@keyframes wt-pulse { from { outline-width: 3px; } to { outline-width: 6px; } }

/* ---------- 768px tablet ---------- */

@media (max-width: 900px) {
  .board-grid { grid-template-columns: 1fr; }
  .stage-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero { flex-direction: column; align-items: flex-start; }
  .kpis { justify-content: flex-start; }
}

/* ---------- 375px phone ---------- */

@media (max-width: 640px) {
  .topbar { padding: 10px 12px; gap: 8px; }
  .topnav { order: 3; width: 100%; border-top: 1px solid var(--line); padding-top: 6px; }
  .nav-link { flex: 1; justify-content: center; padding: 0 6px; font-size: 14px; }
  .topbar-right { margin-left: 0; width: 100%; }
  .demo-badge { font-size: 12px; }
  #view { padding: 16px 12px 36px; }
  .site-foot { padding: 14px 12px 28px; }
  h1 { font-size: 24px; }
  .card { padding: 12px; }
  .row { padding: 12px 2px; }
  .row-cta { width: 100%; }
  .row-cta .btn { width: 100%; }
  .stage-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stage-count b { font-size: 24px; }
  .cap-grid { grid-template-columns: 1fr 1fr; }
  .bo-rows .row { align-items: flex-start; }
  .bo-cell { min-width: 0; }
  .kpis { justify-content: flex-start; }
  .kpi { align-items: flex-start; }
  .modal { align-items: stretch; }
  .wt-panel { left: 12px; right: 12px; width: auto; bottom: 12px; }
  .hero-right { width: 100%; }
  .hero-right .btn, .hero-right .kpis { width: 100%; }
  .hero-right .btn { justify-content: center; }
}

/* ---------- tiny 320px ---------- */

@media (max-width: 380px) {
  .stage-grid { grid-template-columns: 1fr; }
}
