@font-face { font-family: "Bricolage Grotesque"; src: url("/fonts/bricolage-grotesque.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/fonts/instrument-sans.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  --cream: #F7F1E7; --sand: #EDE4D6; --line: #D9CFBF; --white: #FFFFFF;
  --ink: #17212D; --muted: #5B6470; --blue: #2F5D8A; --blue-dark: #1F4268;
  --red: #9A3B1E; --green: #1D6B3A;
  --display: "Bricolage Grotesque", Georgia, serif;
  --body: "Instrument Sans", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--body); font-size: 16px; -webkit-text-size-adjust: 100%; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.hidden-label { position: absolute; left: -9999px; }

.app { min-height: 100dvh; padding-bottom: calc(48px + env(safe-area-inset-bottom)); }
.topbar { position: sticky; top: 0; z-index: 5; background: var(--white); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.topbar-in { max-width: 1120px; margin: 0 auto; padding: 0 20px; min-height: 60px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 700; font-size: 17px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand img { border-radius: 7px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { min-height: 40px; padding: 0 12px; border-radius: 9px; display: flex; align-items: center; color: var(--muted); text-decoration: none; font-size: 15px; white-space: nowrap; }
.nav a:hover { background: var(--cream); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--sand); color: var(--ink); font-weight: 600; }
.ask { min-height: 40px; padding: 0 16px 0 12px; border-radius: 20px; background: var(--ink); color: var(--cream); display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.top { max-width: 1120px; margin: 0 auto; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 24px 20px 14px; }
.top h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 32px; }
.summary { font-size: 13px; color: var(--muted); text-align: right; }

.screen { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.btn { min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--white); font-size: 15px; cursor: pointer; }
.btn.primary { background: var(--ink); color: var(--white); border-color: var(--ink); font-weight: 600; }
.btn.line { background: transparent; border-color: var(--ink); font-weight: 600; }
.btn:disabled { opacity: 0.5; cursor: default; }

.add { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.seg { display: inline-flex; align-self: flex-start; background: var(--sand); border-radius: 10px; padding: 3px; }
.seg label { min-height: 36px; display: flex; align-items: center; padding: 0 14px; border-radius: 8px; font-size: 14px; color: var(--muted); cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg label:has(input:checked) { background: var(--white); color: var(--ink); font-weight: 600; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--blue); }
.add-row { display: flex; gap: 8px; }
.add-row input, .filter input, .filter select { flex: 1; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; background: var(--white); font-size: 15px; min-width: 0; }
.filter { display: flex; gap: 8px; margin-bottom: 16px; }
.filter select { flex: 0 0 auto; }

.list { display: flex; flex-direction: column; gap: 10px; }
.group { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.group.over { color: var(--red); }
.card { background: var(--white); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.kind { font-weight: 600; color: var(--blue); }
.over .kind, .kind.over { color: var(--red); }
.card .title { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.card .body { font-size: 14px; color: var(--muted); white-space: pre-line; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions .btn { flex: 0 0 auto; }
.actions .btn.primary { flex: 1 1 auto; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; line-height: 1.5; }
.entry { background: var(--white); border-radius: 12px; padding: 12px 14px; display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 14px; }
.entry .what { overflow-wrap: anywhere; }
.entry .when { font-size: 12px; color: var(--muted); margin-top: 2px; }


.signin { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; gap: 8px; }
.signin img { border-radius: 24px; }
.signin h1 { font-family: var(--display); font-size: 28px; margin: 8px 0 16px; }
.signin form { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 10px; }
.signin label { font-size: 14px; font-weight: 600; }
.signin input { min-height: 48px; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; background: var(--white); font-size: 16px; }
.msg { min-height: 20px; color: var(--red); font-size: 14px; margin: 0; }

dialog { border: 0; padding: 0; color: var(--ink); }
dialog::backdrop { background: rgba(23, 33, 45, 0.55); }
.chat { width: 100%; max-width: 720px; height: min(86dvh, 760px); margin: auto auto 0; border-radius: 20px 20px 0 0; background: var(--white); display: none; flex-direction: column; }
.chat[open] { display: flex; }
.chat header { padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--sand); display: flex; justify-content: space-between; align-items: center; }
.chat h2 { margin: 0; font-family: var(--display); font-size: 20px; }
.about { font-size: 12px; color: var(--muted); }
.icon { width: 44px; height: 44px; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; font-size: 15px; line-height: 1.45; }
.bubble { max-width: 85%; padding: 10px 14px; white-space: pre-line; overflow-wrap: anywhere; }
.bubble.me { align-self: flex-end; background: var(--blue); color: var(--white); border-radius: 16px 16px 4px 16px; }
.bubble.claude { align-self: flex-start; background: var(--cream); border-radius: 16px 16px 16px 4px; }
.bubble.wait { color: var(--muted); }
.chat-form { padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--sand); display: flex; gap: 8px; }
.chat-form input { flex: 1; min-height: 48px; border: 1px solid var(--line); border-radius: 24px; padding: 0 16px; font-size: 16px; min-width: 0; }
.send { width: 48px; height: 48px; border: 0; border-radius: 24px; background: var(--ink); color: var(--cream); display: flex; align-items: center; justify-content: center; cursor: pointer; }

.sheet { width: calc(100% - 32px); max-width: 420px; border-radius: 16px; background: var(--white); }
.sheet form { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.sheet h2 { margin: 0; font-size: 18px; }
.sheet input[type="text"], .sheet input[type="date"] { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; font-size: 16px; }
.choice { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; }
.sheet-actions { display: flex; gap: 8px; justify-content: flex-end; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom)); background: var(--ink); color: var(--cream); padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 10; max-width: calc(100% - 32px); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--sand); border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.tabs button { min-height: 40px; border: 0; border-radius: 9px; background: transparent; font-size: 14px; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--white); color: var(--ink); font-weight: 600; }
.help { font-size: 13px; color: var(--muted); line-height: 1.45; margin: 0 0 12px; }
.card.post { flex-direction: row; gap: 12px; }
.thumb { width: 64px; height: 86px; border-radius: 8px; background: var(--sand); flex: none; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); text-align: center; padding: 4px; }
.post .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; font-size: 12px; color: var(--muted); }
.figs b { display: block; font-size: 16px; color: var(--ink); }
.verdict.above { color: var(--green); font-weight: 600; }
.verdict.below { color: var(--red); font-weight: 600; }
.copy { background: var(--cream); border-radius: 10px; padding: 10px 12px; font-size: 14px; line-height: 1.4; }
.copy small { display: block; font-size: 12px; color: var(--muted); }
.why { font-size: 13px; color: var(--blue); line-height: 1.4; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chip { font-size: 12px; border-radius: 12px; padding: 3px 9px; background: var(--sand); color: var(--muted); white-space: nowrap; }
.chip.passed { background: #DCEBDD; color: var(--green); }
.chip.started { background: #DCE6F1; color: var(--blue-dark); }
.chip.now { background: var(--ink); color: var(--cream); }
.tick { display: flex; gap: 10px; align-items: flex-start; }
.tick input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
.tick.done .title { text-decoration: line-through; color: var(--muted); }
.big { font-family: var(--display); font-size: 40px; font-weight: 700; line-height: 1; }
.bar { flex: 1; height: 10px; border-radius: 5px; background: var(--sand); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--blue); border-radius: 5px; }
.target { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.target .w { width: 62px; } .target .n { width: 70px; text-align: right; }
.links { display: flex; gap: 8px; }
.links a { flex: 1; text-align: center; text-decoration: none; display: flex; align-items: center; justify-content: center; color: var(--ink); }
.small { font-size: 13px; color: var(--muted); line-height: 1.45; }
select.inline { min-height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); font-size: 13px; padding: 0 6px; }

/* Wider screens: lists become grids. Group headings and notes span the full width. */
@media (min-width: 860px) {
  #posts, #grow, #accounts, #log, #progress, #plan, #list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  #overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #today { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
  .list > .group, .list > .help, .list > .empty, .list > .small, .list > .links, .list > .tabs, .list > .wide { grid-column: 1 / -1; }
  .add { flex-direction: row; align-items: center; }
  .add .seg { align-self: auto; }
  .add-row { flex: 1; }
  .tabs { max-width: 520px; }
  .chat { margin: auto; border-radius: 20px; }
}
/* Phones: the screens move to their own row under the name, scrolling sideways. */
@media (max-width: 720px) {
  .topbar-in { flex-wrap: wrap; gap: 0 12px; padding: 0 12px; }
  .brand { flex: 1; min-height: 52px; }
  .ask { min-height: 36px; font-size: 14px; }
  .nav { order: 3; flex: 0 0 100%; margin: 0 -12px; padding: 0 8px 8px; }
  .nav a { min-height: 36px; padding: 0 10px; font-size: 14px; }
  .top { padding: 16px 16px 10px; }
  .top h1 { font-size: 26px; }
  .screen { padding: 0 16px; }
}
.card .when { font-size: 12px; color: var(--muted); line-height: 1.45; }
.ask-mini { width: 36px; height: 36px; flex: none; border: 1px solid var(--line); border-radius: 18px; background: var(--white); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.ask-mini:hover { background: var(--cream); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card-head > div { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.advice { background: var(--cream); border-radius: 10px; padding: 8px 12px; font-size: 14px; line-height: 1.4; }
.advice b { color: var(--blue-dark); }
.advice.leave b { color: var(--muted); }
.attach { width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 24px; display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.pic-row { display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-top: 1px solid var(--sand); font-size: 14px; color: var(--muted); }
.pic-row img { width: 40px; height: 52px; object-fit: cover; border-radius: 6px; }
.pic-row span { flex: 1; }
.bubble-copy { align-self: flex-start; margin-top: -6px; min-height: 32px; font-size: 13px; padding: 0 10px; }
.bubble img { display: block; max-width: 160px; border-radius: 8px; margin-bottom: 6px; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step .num { width: 28px; height: 28px; flex: none; border-radius: 14px; background: var(--ink); color: var(--cream); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.step.done .num { background: var(--green); }
.step.done .title { color: var(--muted); }
.step > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.comment-edit { width: 100%; min-height: 64px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 16px; line-height: 1.4; background: var(--cream); resize: vertical; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; }
.stat .big { font-size: 32px; }
.delta { font-weight: 600; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.chart-wrap { width: 100%; }
.chart { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 12px; font-family: var(--body); }
.chart .line { fill: none; stroke: var(--blue); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--blue); stroke: var(--white); stroke-width: 2; }
.chart .hit { fill: transparent; }
.chart .pt:hover .dot { r: 6; }
.list > .tabs { max-width: 620px; }
.newpost { margin-bottom: 16px; }
.newpost.drop { outline: 2px dashed var(--blue); outline-offset: 4px; }
.newpost .target .w { width: auto; }
.field { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; font: inherit; font-size: 16px; background: var(--cream); }
.fieldset { display: flex; flex-direction: column; gap: 4px; }
.fieldset small { font-size: 12px; color: var(--muted); font-weight: 600; }
.pics { display: flex; gap: 8px; overflow-x: auto; }
.pics img { height: 180px; border-radius: 8px; flex: none; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; max-height: 50vh; overflow-y: auto; }
.pick { position: relative; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); cursor: pointer; }
.pick img, .pick .thumb { width: 100%; height: 120px; object-fit: cover; border-radius: 8px; background: var(--sand); }
.pick input { position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; }
.pick:has(input:checked) img { outline: 3px solid var(--blue); }
.sheet:has(.pick-grid) { max-width: 640px; }
