/* Tokens: cool sage paper, pine ink, marigold for "soon", mulberry for "late". */
:root {
  --paper: #edf1ee;
  --surface: #ffffff;
  --ink: #13302a;
  --muted: #56695f;
  --rule: #cbd6d1;
  --soon: #d99a00;
  --soon-wash: #fbf1d4;
  --late: #a3245a;
  --late-wash: #f7e1ea;
  --go: #1e7a5a;
  --go-wash: #dff1e9;
  --link: #1b6670;
  --display: "Bricolage Grotesque", "Arial Narrow", Arial, sans-serif;
  --body: "Atkinson Hyperlegible", Verdana, sans-serif;
  --rail: 13.5rem;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1rem/1.5 var(--body);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.12; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 1.3rem + 2.4vw, 3rem); }
h2 { font-size: 1.35rem; margin-top: 2.5rem; margin-bottom: .75rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; max-width: 68ch; }
a { color: var(--link); text-underline-offset: .15em; }
small, .muted { color: var(--muted); }
.boot { padding: 3rem; color: var(--muted); }

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

/* ---------------------------------------------------------------- frame */
.frame { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail {
  background: var(--ink); color: #e6efe9; padding: 1.5rem 1rem; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: .25rem;
}
.rail .who { font-family: var(--display); font-size: 1.5rem; font-weight: 700; padding: 0 .6rem 1.25rem; line-height: 1.05; }
.rail .who span { display: block; font: 400 .85rem/1.3 var(--body); color: #a9c0b6; margin-top: .3rem; }
.rail a {
  color: inherit; text-decoration: none; padding: .55rem .6rem; border-radius: 6px; display: flex;
  justify-content: space-between; align-items: center; gap: .5rem;
}
.rail a:hover { background: #1d423a; }
.rail a[aria-current="page"] { background: #e6efe9; color: var(--ink); font-weight: 700; }
.rail .count { background: var(--soon); color: #2a1f00; border-radius: 99px; padding: 0 .5rem; font-size: .8rem; font-weight: 700; }
.rail .foot { margin-top: auto; }
.rail .foot button { background: none; border: 0; color: #a9c0b6; font: inherit; cursor: pointer; padding: .55rem .6rem; text-decoration: underline; }
main { padding: 2.25rem clamp(1rem, 4vw, 3.5rem) 5rem; min-width: 0; }
main > header { margin-bottom: 1.75rem; }
main > header p { margin-top: .6rem; color: var(--muted); }

@media (max-width: 820px) {
  .frame { display: block; }
  .rail {
    position: fixed; inset: auto 0 0 0; height: auto; flex-direction: row; padding: .35rem .35rem calc(.35rem + env(safe-area-inset-bottom, 0px));
    z-index: 20; gap: 0; justify-content: space-around;
  }
  .rail .who, .rail .foot { display: none; }
  .rail a { flex-direction: column; font-size: .78rem; padding: .45rem .3rem; gap: .1rem; flex: 1; text-align: center; position: relative; }
  .rail .count { position: absolute; top: .1rem; right: 18%; font-size: .68rem; }
  main { padding-bottom: 6.5rem; }
}

/* --------------------------------------------------------------- runway */
/* The one loud element: a 90-day strip with a flag for every date on Jack's list. */
.runway-scroll { overflow-x: auto; margin: 0 calc(-1 * clamp(1rem, 4vw, 3.5rem)); padding: 0 clamp(1rem, 4vw, 3.5rem); }
.runway { position: relative; min-width: 56rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; }
.runway .months { position: absolute; inset: 0; }
.runway .month { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--rule); padding: .5rem 0 0 .5rem; font: 700 .95rem var(--display); color: var(--muted); }
.runway .soonzone { position: absolute; top: 0; bottom: 0; left: 0; background: repeating-linear-gradient(-45deg, var(--soon-wash) 0 10px, transparent 10px 20px); border-right: 2px solid var(--soon); }
.runway .soonzone span { position: absolute; bottom: .35rem; right: .5rem; font-size: .8rem; color: #7a5600; white-space: nowrap; }
.runway .flag { position: absolute; bottom: 0; border-left: 2px solid var(--ink); padding: 0 0 0 .4rem; }
.runway .flag a, .runway .flag span.lbl {
  display: block; background: var(--ink); color: #fff; text-decoration: none; font-size: .82rem; line-height: 1.25;
  padding: .25rem .5rem; border-radius: 0 6px 6px 0; margin-left: -.4rem; max-width: 12.5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.runway .flag b { font-family: var(--display); margin-right: .35rem; }
.runway .flag.soon { border-color: var(--soon); } .runway .flag.soon a, .runway .flag.soon span.lbl { background: var(--soon); color: #2a1f00; }
.runway .flag.sent { border-color: var(--go); } .runway .flag.sent a { background: var(--go); }
.runway .flag.unverified a, .runway .flag.unverified span.lbl { background: var(--surface); color: var(--ink); outline: 2px dashed currentColor; outline-offset: -2px; }
.runway .flag.unlisted { border-color: var(--rule); } .runway .flag.unlisted span.lbl, .runway .flag.unlisted a { background: var(--paper); color: var(--muted); outline: 1px solid var(--rule); outline-offset: -1px; }
.legend { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; margin-top: .6rem; font-size: .88rem; color: var(--muted); }
.legend i { display: inline-block; width: 1.1rem; height: .7rem; vertical-align: -1px; margin-right: .35rem; border-radius: 2px; }

/* ---------------------------------------------------------------- lists */
.cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 0 3rem; }
@media (max-width: 1080px) { .cols { grid-template-columns: 1fr; } }

.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.rows > li { border-bottom: 1px solid var(--rule); padding: .8rem 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .35rem 1rem; align-items: start; }
.rows > li .title { font-weight: 700; }
.rows > li .meta { color: var(--muted); font-size: .92rem; }
.rows > li .side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; }
.empty { border: 1px dashed var(--rule); border-radius: 10px; padding: 1.25rem; color: var(--muted); background: #f6f9f7; }

/* Numbered setup instructions inside a panel: tighter than prose, numbers in the gutter. */
.steps { margin: .8rem 0 1rem; padding-left: 1.3rem; color: var(--muted); }
.steps li { margin-bottom: .45rem; }
.steps strong { color: var(--ink); }

/* `.rows > li` is the more specific selector, so `.check` alone loses to it and the row
   collapses to two columns: the text is pushed right and the side column wraps underneath. */
.check, .rows > li.check { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; gap: .35rem .6rem; align-items: start; }
.check input[type="checkbox"] { width: 1.3rem; height: 1.3rem; margin: .1rem 0 0; accent-color: var(--go); }
.check.done .title { text-decoration: line-through; color: var(--muted); font-weight: 400; }
/* Read-only marker for the first-run card, where there is nothing to tick by hand. */
.check .tick { font-size: 1.15rem; line-height: 1.3; color: var(--muted); }
.check.done .tick { color: var(--go); }

.tag { display: inline-block; font-size: .82rem; line-height: 1; padding: .3rem .55rem; border-radius: 99px; background: #dde6e1; color: var(--ink); white-space: nowrap; }
.tag.soon { background: var(--soon-wash); color: #6b4c00; } .tag.late { background: var(--late-wash); color: var(--late); }
.tag.go { background: var(--go-wash); color: #135640; } .tag.dash { background: none; outline: 1.5px dashed var(--muted); outline-offset: -1.5px; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.chips button { font: inherit; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); border-radius: 99px; padding: .35rem .85rem; cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------------------------------------------------------------- forms */
button.act, a.act {
  font: 700 .95rem var(--body); border: 0; border-radius: 7px; padding: .55rem .95rem; cursor: pointer;
  background: var(--ink); color: #fff; text-decoration: none; display: inline-block;
}
button.act.quiet, a.act.quiet { background: none; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
button.act.warn { background: none; color: var(--late); box-shadow: inset 0 0 0 1.5px var(--late); }
button.act:disabled { opacity: .5; cursor: progress; }
.btnrow { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: .2rem; }
input[type="text"], input[type="email"], input[type="number"], input[type="date"], input[type="url"], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid #9fb1a9; border-radius: 6px; padding: .5rem .6rem;
}
textarea { min-height: 11rem; line-height: 1.55; resize: vertical; }
/* Shown to be copied, not typed in. */
input[readonly] { background: #eef3f1; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 1rem; }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 1.25rem; margin-bottom: 1rem; }
.panel > h3 { margin-bottom: .6rem; }
/* h2 carries a 2.5rem top margin for page sections. Inside a padded box that reads as a
   hole above the heading. */
.panel > :first-child { margin-top: 0; }
.inline { display: flex; gap: .5rem; align-items: end; flex-wrap: wrap; }
.inline > div { flex: 1 1 10rem; }

.copyrow { display: grid; grid-template-columns: minmax(8rem, 15rem) minmax(0, 1fr) auto; gap: .5rem 1rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--rule); }
@media (max-width: 640px) { .copyrow { grid-template-columns: 1fr auto; } .copyrow label { grid-column: 1 / -1; margin: 0; } }
.counter { font-size: .82rem; color: var(--muted); } .counter.over { color: var(--late); font-weight: 700; }

/* --------------------------------------------------------------- review */
.score { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
.score b { font: 700 3rem/1 var(--display); }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; vertical-align: top; padding: .5rem .75rem .5rem 0; border-bottom: 1px solid var(--rule); }
th { color: var(--muted); font-weight: 400; font-size: .88rem; }
.tablewrap { overflow-x: auto; }
.pips { white-space: nowrap; letter-spacing: .1em; color: var(--go); }
blockquote { margin: .4rem 0; padding-left: .8rem; border-left: 3px solid var(--rule); color: var(--muted); font-style: italic; }
pre.change { background: #f3f6f4; border-radius: 6px; padding: .6rem; font-size: .82rem; overflow-x: auto; margin: .4rem 0 0; white-space: pre-wrap; }

/* ---------------------------------------------------------------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: var(--ink); }
.login .panel { max-width: 26rem; width: 100%; padding: 2rem; }
.login h1 { font-size: 2.2rem; margin-bottom: .5rem; }

#toast {
  position: fixed; left: 50%; bottom: 5.5rem; transform: translate(-50%, 1rem); background: var(--ink); color: #fff;
  padding: .6rem 1rem; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 40; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--late); }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
