/**
 * Light, always.
 *
 * This used to follow the system setting, so anyone with their laptop in dark
 * mode saw cool grey software. She asked for the opposite of that: calm, warm,
 * neutral, closer to a yoga studio than a CRM. Following the OS meant her taste
 * lost to a checkbox in System Settings, so this commits to one look.
 *
 * Sand and cream for ground, sage for the one accent, warm near-black for text.
 * Nothing is pure white or pure grey; every neutral has a little warmth in it,
 * which is most of the difference between "calm" and "clinical".
 */
:root {
  --ground: #FAF6F0;        /* warm sand, the page itself */
  --surface: #FFFDFA;       /* cards, a shade lighter than the ground */
  --surface-alt: #F1EAE0;
  --rule: #E3D9CB;
  --rule-soft: #EFE8DD;
  --ink: #2B2621;           /* warm near-black, never #000 */
  --ink-soft: #5E564C;
  --ink-faint: #948A7C;
  --accent: #6E8B78;        /* sage */
  --accent-soft: #E8EEE9;
  --warn: #8A6234;
  --warn-soft: #F3E7D6;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

main { max-width: 700px; margin: 0 auto; padding: 2rem 1.25rem 5rem; }

/* --- chrome --- */

.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface); border-bottom: 1px solid var(--rule);
  padding: .7rem 1rem calc(.7rem + env(safe-area-inset-top)) 1rem;
  padding-top: calc(.7rem + env(safe-area-inset-top));
  display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: baseline;
}
.brand { font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.nav { display: flex; gap: 1rem; margin-left: auto; }
.nav a { color: var(--ink-faint); text-decoration: none; font-size: .92rem; }
.nav a.on { color: var(--accent); font-weight: 600; }

/* A system serif for headings: elegant, no webfont, and the CSP blocks
   external stylesheets anyway. */
h1 {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 1.85rem; line-height: 1.2; margin: 0 0 .3rem;
  letter-spacing: -.01em; font-weight: 600; color: var(--ink);
}
.q { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; }
h2 { font-size: .72rem; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-faint); margin: 2rem 0 .5rem; font-weight: 600; }
h2:first-child { margin-top: 0; }
p { margin: 0; }

.stack { display: flex; flex-direction: column; gap: .8rem; }
.narrow { max-width: 34rem; }
.sub { color: var(--ink-soft); font-size: .95rem; }
.fine { color: var(--ink-faint); font-size: .84rem; }
.empty { color: var(--ink-faint); font-size: .92rem; padding: .4rem 0; }
.error { background: var(--warn-soft); color: var(--warn); padding: .6rem .8rem; border-radius: 6px; font-size: .9rem; }
.count { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: .05em .5em; font-size: .8rem; letter-spacing: 0; }

/* --- cards --- */

.card {
  display: flex; flex-direction: column; gap: .35rem;
  background: var(--surface); border: 1px solid var(--rule-soft);
  border-radius: 12px; padding: 1.1rem 1.25rem; text-decoration: none; color: inherit;
}
.card.prompt { border-left: 3px solid var(--accent); }
.card strong { font-size: 1.05rem; }
.kicker { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-faint); font-weight: 600; }
.meta { color: var(--ink-soft); font-size: .88rem; }
.cta { color: var(--accent); font-weight: 600; font-size: .9rem; margin-top: .2rem; }

.followup .draft {
  background: var(--ground); border: 1px solid var(--rule-soft); border-radius: 6px;
  padding: .6rem .7rem; font-size: .9rem; color: var(--ink-soft);
  white-space: pre-wrap; margin: .3rem 0;
}
.pending { color: var(--ink-faint); }

/* --- buttons --- */

.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.btn {
  display: inline-block; border: 1px solid var(--rule); background: var(--surface);
  color: var(--ink); border-radius: 6px; padding: .55rem .9rem;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn.small { padding: .35rem .7rem; font-size: .85rem; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

.btn.ghost { background: transparent; color: var(--ink-faint); }
.btn:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* --- forms --- */

.capture { display: flex; flex-direction: column; gap: 1rem; }
.capture label { display: flex; flex-direction: column; gap: .3rem; }
.capture label > span { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-faint); font-weight: 600; }
.capture label > span em { text-transform: none; letter-spacing: 0; font-style: normal; font-weight: 400; }
input, textarea, select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule); border-radius: 6px; padding: .6rem .7rem; width: 100%;
}
textarea { resize: vertical; }

.chips { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .3rem; }
.chips legend { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-faint); font-weight: 600; padding: 0; }
.chips > label { display: inline-flex; }
.chips { flex-direction: row; flex-wrap: wrap; align-items: center; gap: .4rem; }
.chips legend { width: 100%; }
.chips input { position: absolute; opacity: 0; width: 0; height: 0; }
.chips span {
  display: inline-block; border: 1px solid var(--rule); border-radius: 999px;
  padding: .4rem .9rem; font-size: .9rem; color: var(--ink-soft); cursor: pointer;
}
.chips input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

.q { font-size: 1.5rem; }

/* --- people --- */

.tagbar { display: flex; flex-wrap: wrap; gap: .35rem; }
.tagchip {
  border: 1px solid var(--rule); border-radius: 999px; padding: .3rem .7rem;
  font-size: .84rem; color: var(--ink-soft); text-decoration: none; background: var(--surface);
}
.tagchip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.tagchip span { color: var(--ink-faint); font-size: .78rem; }

.tagtoggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.tagtoggle span {
  display: inline-block; border: 1px solid var(--rule); border-radius: 999px;
  padding: .3rem .7rem; font-size: .84rem; color: var(--ink-soft); cursor: pointer; background: var(--surface);
}
.tagtoggle input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.tagform { display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; }

.plist { display: flex; flex-direction: column; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: var(--surface); }
.prow {
  display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; align-items: baseline;
  padding: .75rem 1rem; border-bottom: 1px solid var(--rule-soft); text-decoration: none; color: inherit;
}
.prow:last-child { border-bottom: 0; }
.pname { font-weight: 600; }
.pname em { font-style: normal; color: var(--ink-faint); font-weight: 400; }
.ptags { grid-column: 1; color: var(--ink-faint); font-size: .82rem; }
.pstage { grid-row: 1; grid-column: 2; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); }
.pstage.active, .pstage.client { color: var(--accent); font-weight: 600; }

.agenda, .timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.agenda li, .timeline li { color: var(--ink-soft); font-size: .92rem; display: flex; gap: .6rem; flex-wrap: wrap; }

/* A drafted message sits under its follow-up rather than beside it. */
.agenda .draft {
  flex-basis: 100%;
  background: var(--ground); border: 1px solid var(--rule-soft); border-radius: 6px;
  padding: .6rem .7rem; font-size: .9rem; color: var(--ink-soft);
  white-space: pre-wrap; margin: .35rem 0 0;
}
.agenda .fine { flex-basis: 100%; margin: .2rem 0 0; }
.agenda li span:first-child, .when { color: var(--ink-faint); font-variant-numeric: tabular-nums; min-width: 4.5rem; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; margin: 0; }
.kv dt { color: var(--ink-faint); font-size: .88rem; }
.kv dd { margin: 0; }

.code {
  background: var(--surface-alt); border: 1px solid var(--rule); border-radius: 6px;
  padding: .8rem; font-size: .8rem; overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink-soft);
}

.hero { display: flex; flex-direction: column; gap: .8rem; align-items: flex-start; padding-top: 2rem; }
.hero .btn { margin-top: .4rem; }

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

/* --- send run --- */

.progress { display: flex; flex-direction: column; gap: .35rem; }
.progress .bar { display: block; height: 6px; background: var(--surface-alt); border-radius: 999px; overflow: hidden; }
.progress .bar span { display: block; height: 100%; background: var(--accent); transition: width .25s ease; }
.progress .pnum { font-size: .85rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

.sendlist { display: flex; flex-direction: column; gap: .7rem; }
.sendcard {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 8px;
  padding: .9rem 1rem; display: flex; flex-direction: column; gap: .5rem;
}
.sendcard.waiting { opacity: .6; }
.sendcard.gone { display: none; }
.sendhead { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; }
.sendhead strong { font-size: 1.05rem; }
.sendhead .chan {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 600;
  color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: .2em .6em;
}
.sendcard .draft {
  background: var(--ground); border: 1px solid var(--rule-soft); border-radius: 6px;
  padding: .65rem .75rem; font-size: .93rem; color: var(--ink); white-space: pre-wrap;
}
.sendcard .open { text-align: center; }
.fine.warn { color: var(--warn); }
.done-msg[hidden] { display: none; }

/* --- audience building --- */

.chips span em { font-style: normal; color: var(--ink-faint); font-size: .8em; }

.preview {
  display: flex; align-items: baseline; gap: .7rem; flex-wrap: wrap;
  background: var(--accent-soft); border-radius: 8px; padding: .8rem 1rem;
}
.preview .pcount {
  font-size: 1.6rem; font-weight: 700; color: var(--accent);
  font-variant-numeric: tabular-nums; line-height: 1;
}

.picklist { display: flex; flex-direction: column; gap: .6rem; }
.pick {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 8px;
  padding: .85rem 1rem; display: flex; flex-direction: column; gap: .4rem;
}
.pick.in { border-color: var(--accent); background: var(--accent-soft); }
.pick.out { opacity: .45; }
.pickhead { display: flex; justify-content: space-between; align-items: flex-start; gap: .8rem; }
.pickhead strong { font-size: 1.02rem; }
.pickhead .meta { display: block; font-size: .82rem; }
.score {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: .95rem;
  border-radius: 999px; padding: .18em .6em; flex-shrink: 0;
}
.score.high { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); }
.score.mid  { background: var(--warn-soft); color: var(--warn); }
.score.low  { background: var(--surface-alt); color: var(--ink-faint); }
.score.pendingscore { background: var(--surface-alt); color: var(--ink-faint); }
.why { font-size: .93rem; color: var(--ink); }
.why.pending { color: var(--ink-faint); font-style: italic; }

/* --- assistant --- */

.chat { display: flex; flex-direction: column; gap: .6rem; }
.msg { max-width: 88%; border-radius: 12px; padding: .7rem .9rem; font-size: .95rem; }
.msg p { margin: 0; white-space: pre-wrap; }
.msg.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg.them { align-self: flex-start; background: var(--surface); border: 1px solid var(--rule); border-bottom-left-radius: 4px; }
.msg.thinking p { color: var(--ink-faint); font-style: italic; }
.did { margin: .5rem 0 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: .2rem; }
.did li { font-size: .86rem; color: var(--ink-soft); }

.confirm {
  background: var(--warn-soft); border-left: 3px solid var(--warn);
  border-radius: 8px; padding: .8rem 1rem; margin-top: .6rem;
  display: flex; flex-direction: column; gap: .4rem;
}
.confirm p { color: var(--ink); font-size: .95rem; }

.ask { display: flex; gap: .5rem; margin-top: .3rem; }
.ask input { flex: 1; }

.acts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.act {
  display: flex; justify-content: space-between; align-items: center; gap: .8rem;
  font-size: .89rem; color: var(--ink-soft);
  padding: .45rem .6rem; border: 1px solid var(--rule-soft); border-radius: 6px;
  background: var(--surface);
}
.act em { font-style: normal; color: var(--ink-faint); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.act.undone, .act.declined { opacity: .5; }
.act.failed { border-color: var(--warn); }

/* --- import --- */

.implist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.implist li {
  display: flex; flex-direction: column; gap: .1rem;
  padding: .5rem .7rem; border: 1px solid var(--rule-soft); border-radius: 6px;
  background: var(--surface); font-size: .92rem;
}
.implist li.new { border-left: 3px solid var(--accent); }
.implist li.known { border-left: 3px solid var(--rule); }
.implist li.skip { border-left: 3px solid var(--warn); opacity: .7; }

/* --- privacy and terms --- */
.legal h2 { font-size: 1rem; margin: 1.6rem 0 .4rem; }
.legal p, .legal li { color: var(--ink-soft); font-size: .95rem; line-height: 1.6; }
.legal ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.legal li { margin-bottom: .3rem; }

/* --- guidance ---
   A plain-language line under each heading. She has never used a CRM and should
   not have to work out what a screen is for. */
.hint {
  color: var(--ink-faint); font-size: .88rem; line-height: 1.6;
  margin: -.2rem 0 .5rem; max-width: 46ch;
}

.steps { margin: .5rem 0 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: .7rem; }
.steps li { color: var(--ink-soft); line-height: 1.65; }
.steps strong { color: var(--ink); }

.glossary { margin: .5rem 0 0; }
.glossary dt { font-weight: 600; color: var(--ink); margin-top: .9rem; }
.glossary dd { margin: .15rem 0 0; color: var(--ink-soft); line-height: 1.6; }

.legal details { border-top: 1px solid var(--rule-soft); padding: .7rem 0; }
.legal details summary { cursor: pointer; color: var(--ink); font-weight: 500; }
.legal details p { margin: .5rem 0 0; }

/* --- the More menu ---
   Rarely-used screens live behind one word so the row stays readable on a
   phone. A <details> element does this with no JavaScript; app.js only closes
   it when you tap elsewhere. */
.nav .more { position: relative; }
.nav .more > summary {
  list-style: none; cursor: pointer;
  color: var(--ink-faint); font-size: .92rem;
}
.nav .more > summary::-webkit-details-marker { display: none; }
.nav .more.on > summary, .nav .more[open] > summary { color: var(--accent); font-weight: 600; }

.moremenu {
  position: absolute; right: 0; top: calc(100% + .6rem); z-index: 20;
  display: flex; flex-direction: column; min-width: 9rem;
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: 10px; padding: .35rem;
  box-shadow: 0 8px 24px rgba(43, 38, 33, .10);
}
.moremenu a {
  padding: .5rem .7rem; border-radius: 6px;
  color: var(--ink-soft); text-decoration: none; font-size: .92rem;
}
.moremenu a:hover { background: var(--surface-alt); }
.moremenu a.on { color: var(--accent); font-weight: 600; }
