:root {
  color-scheme: light;
  --paper: #faf7f0;
  --card: #fffefa;
  --ink: #23201a;
  --muted: #7b7466;
  --line: #e6dfd1;
  --pine: #2c3a2a;
  --pine-soft: #3a4a37;
  --pine-ink: #f2efe6;
  --leaf: #587b52;
  --leaf-soft: #e9efe3;
  --amber: #b07c22;
  --amber-soft: #f7edda;
  --clay-soft: #f3e7e0;
  --radius: 22px;
  --tile: 14px;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

a { color: inherit; }
button, input, textarea { font: inherit; }
p, h3, blockquote { text-wrap: pretty; }

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px;
}

/* ============ sticky header ============ */
.top {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.top-inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 18px 8px;
}

.brand {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: -0.005em;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qbtn {
  flex: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--pine);
  color: var(--pine-ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.qbtn:active { background: var(--pine-soft); }

/* ============ progress ============ */
.progress {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 18px 10px;
}

.progress-segs {
  display: flex;
  gap: 5px;
  min-width: 0;
}

.seg {
  flex: 1 1 0;
  min-width: 0;
  height: 5px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--line);
  cursor: pointer;
  transition: background 0.2s;
}

.seg.is-filled { background: var(--leaf); }

.progress-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 8px 0 0;
}

/* ============ content column ============ */
main {
  max-width: 640px;
  margin: 0 auto;
  min-width: 0;
  padding: 24px 18px 120px;
}

.view { display: none; }
.view.is-active { display: block; }

.section-eyebrow-top { color: var(--leaf); }

.section-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 8vw, 44px);
  line-height: 1.04;
  letter-spacing: -0.015em;
  margin: 0 0 16px;
  text-wrap: balance;
}

.lede {
  font-size: 16.5px;
  line-height: 1.65;
  margin: 0 0 20px;
}

.block-eyebrow { margin: 24px 0 10px; }

/* ============ cards ============ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--tile);
  padding: 18px 20px;
  margin: 0 0 12px;
  min-width: 0;
}

.card p { margin: 0; font-size: 15.5px; line-height: 1.6; }
.card p + p { margin-top: 10px; }
.card p.eyebrow { margin: 0 0 8px; font-size: 11px; line-height: 1.4; }

.card--leaf {
  background: var(--leaf-soft);
  border-color: transparent;
}

.card--standout {
  border-radius: var(--radius);
  padding: 24px 24px;
  margin: 4px 0 20px;
}

.card--pine {
  background: var(--pine);
  border-color: transparent;
  border-radius: var(--radius);
  color: var(--pine-ink);
  padding: 22px 24px;
  margin-top: 20px;
}

.card--pine .eyebrow { color: var(--pine-ink); opacity: 0.6; }

.card--muted {
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--muted);
}

.serif-body {
  font-family: var(--serif);
  font-size: clamp(20px, 5.4vw, 24px);
  line-height: 1.4;
  text-wrap: balance;
}

.card p.serif-body { font-size: clamp(20px, 5.4vw, 24px); line-height: 1.4; }

.pull-quote {
  font-family: var(--serif);
  font-size: clamp(20px, 5.4vw, 25px);
  line-height: 1.45;
  background: var(--leaf-soft);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin: 0 0 12px;
  text-wrap: balance;
}

.big-num strong {
  display: block;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(36px, 9vw, 46px);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  margin: 2px 0 6px;
}

.big-num p { color: var(--muted); font-size: 14px; }

.date-strong {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 21px;
}

/* ============ chips ============ */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  min-width: 0;
}

.chip {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 16px;
  font-family: var(--serif);
  font-size: 17px;
}

/* ============ roles ============ */
.role-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--tile);
  padding: 18px 20px;
  margin: 0 0 12px;
  min-width: 0;
}

.role-card .eyebrow { color: var(--leaf); }

.role-card h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 25px;
  margin: 2px 0 8px;
}

.role-body { font-size: 14.5px; margin: 0; }

.chain-card {
  margin: 20px 0 12px;
  background: var(--pine);
  color: var(--pine-ink);
  border-radius: var(--radius);
  padding: 20px 24px;
  min-width: 0;
}

.chain-card .eyebrow { color: var(--pine-ink); opacity: 0.6; }

.chain {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0 0;
  min-width: 0;
}

.chain-node {
  font-family: var(--serif);
  font-size: 19px;
  background: var(--pine-soft);
  border-radius: 999px;
  padding: 6px 16px;
}

.chain-arrow { opacity: 0.5; }

/* ============ tags ============ */
.tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

.card .tag { margin-top: 12px; }

.tag--talk { background: var(--line); color: var(--muted); }
.tag--money { background: var(--leaf-soft); color: var(--leaf); }
.tag--repairs { background: #e5eae2; color: var(--pine-soft); }
.tag--agreement { background: var(--amber-soft); color: var(--amber); }
.tag--logistics { background: var(--clay-soft); color: #8c5a45; }
.tag--wrap { background: var(--line); color: var(--muted); }

/* ============ parked list ============ */
.parked-item p { margin: 0; }
.parked-text { font-size: 15px; }

.parked-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  min-width: 0;
}

.parked-meta .tag { margin-top: 0; white-space: normal; }

.parked-when { font-size: 12px; color: var(--muted); }

.parked-empty { color: var(--muted); font-size: 14px; margin: 0 0 12px; }

/* ============ pager ============ */
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  min-width: 0;
}

.pager a {
  font-family: var(--serif);
  font-size: 17px;
  text-decoration: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 20px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pager a:hover { border-color: var(--leaf); }
.pager a:active { background: var(--leaf-soft); }

.pager-spacer { flex: 1 1 0; min-width: 0; }

/* ============ tab bar ============ */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  min-width: 0;
  background: var(--pine);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
}

.tab {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 1px 4px;
  border-radius: 10px;
  color: var(--pine-ink);
  opacity: 0.6;
  text-decoration: none;
}

.tab svg { width: 22px; height: 22px; flex: none; }

.tab span {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.tab.is-active {
  opacity: 1;
  background: var(--pine-soft);
  color: #c8ddc0;
}

/* ============ modal ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(35, 32, 26, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 18px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
}

.modal {
  width: min(440px, 100%);
  background: var(--paper);
  border-radius: var(--radius);
  padding: 24px 22px;
}

.modal h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 30px;
  margin: 2px 0 8px;
  letter-spacing: -0.01em;
}

.modal-body { font-size: 14.5px; color: var(--muted); margin: 0 0 14px; }

.modal-body .tag { white-space: normal; vertical-align: 1px; }

.modal textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  padding: 12px 14px;
  min-height: 88px;
  resize: vertical;
  outline: none;
}

.modal textarea:focus { border-color: var(--leaf); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.btn-solid {
  border: 0;
  border-radius: 999px;
  padding: 10px 24px;
  background: var(--pine);
  color: var(--pine-ink);
  font-weight: 600;
  cursor: pointer;
}

.btn-solid:active { background: var(--pine-soft); }

.btn-ghost {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 20px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

/* ============ desktop ============ */
@media (min-width: 700px) {
  .tabbar {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: 18px;
    width: auto;
    min-width: 560px;
    max-width: 640px;
    border-radius: 999px;
    padding: 8px 10px;
    box-shadow: 0 12px 32px rgba(35, 32, 26, 0.2);
  }

  .tab { padding: 6px 10px 5px; }

  .modal-backdrop { align-items: center; }

  main { padding-bottom: 140px; }
}

/* ============ role loop ============ */
.loop-svg {
  display: block;
  width: 100%;
  max-width: 340px;
  margin: 8px auto 6px;
  color: var(--pine-ink);
}

/* ============ notes ============ */
.notes-box {
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--tile);
  padding: 12px 16px 8px;
  margin-top: 30px;
}

.notes-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.notes-head .eyebrow { margin: 0; color: var(--leaf); }

.notes-status {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--leaf);
  opacity: 0;
  transition: opacity 0.3s;
}

.notes-status.is-on { opacity: 1; }

.notes-box textarea {
  width: 100%;
  border: 0;
  background: transparent;
  outline: none;
  resize: vertical;
  min-height: 48px;
  font-size: 15px;
  color: var(--ink);
  padding: 8px 0 4px;
}

.notes-box textarea::placeholder { color: var(--muted); opacity: 0.7; }

/* ============ send notes ============ */
.send-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 14px;
  margin: 12px 0;
  background: var(--paper);
}

.btn-wide { width: 100%; }

.send-status {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--leaf);
  margin: 10px 0 0;
}

.time-chip { display: inline-block; margin-bottom: 18px; }

.parked-note { font-size: 13.5px; color: var(--muted); margin: -2px 0 12px; }

/* ============ who picker ============ */
.chips {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

#whoChips .chip {
  display: block;
  width: 100%;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 6px;
  font-family: var(--serif);
  font-size: 17px;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

#whoChips .chip.is-picked {
  background: var(--pine);
  border-color: var(--pine);
  color: var(--pine-ink);
}

.who-hint {
  font-size: 12.5px;
  color: var(--muted);
  margin: 10px 0 22px;
}

.pill-you {
  stroke: var(--amber);
  stroke-width: 2.5;
}

.send-as { font-size: 14.5px; margin: 12px 0; }
.send-as strong { font-family: var(--serif); font-size: 16px; }

.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--leaf);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--leaf-soft);
}
