:root {
  --bg: #f6f4ef;
  --card: #fff;
  --ink: #1f2522;
  --muted: #69716c;
  --line: #e2ded5;
  --brand: #2f5d50;
  --brand-ink: #fff;
  --warn: #b4521c;
  --ok: #2e7d4f;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
a { color: var(--brand); }
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--brand); color: var(--brand-ink);
}
.brand { color: inherit; text-decoration: none; font-weight: 700; font-size: 1.05rem; }
#me { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
#me img { width: 28px; height: 28px; border-radius: 50%; }
#me button { background: transparent; color: inherit; border: 1px solid rgba(255,255,255,.5); }
main { max-width: 960px; margin: 0 auto; padding: 16px; }
.pad { padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
h1 { font-size: 1.4rem; margin: 0 0 8px; }
h2 { font-size: 1.1rem; margin: 0 0 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }
.grow { flex: 1 1 auto; }
button, .btn {
  font: inherit; cursor: pointer; border-radius: 8px; padding: 8px 12px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; display: inline-block;
}
button.primary, .btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
button.danger { color: var(--warn); border-color: #e9c3ad; }
button.link { border: 0; background: none; color: var(--brand); padding: 4px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea {
  font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
textarea { min-height: 70px; resize: vertical; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
label > input, label > select, label > textarea { margin-top: 4px; color: var(--ink); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 1rem; }
.check input { width: auto; }

/* totals strip */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.stat b { display: block; font-size: 1.25rem; }
.stat span { font-size: .8rem; color: var(--muted); }
.stat.warn b { color: var(--warn); }

/* project list */
.plist { list-style: none; margin: 0; padding: 0; }
.pitem {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px;
  text-decoration: none; color: inherit;
}
.pitem.blocked { opacity: .75; }
.pitem.done { opacity: .55; }
.score {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; background: #e7efe9; color: var(--brand);
}
.score.hi { background: var(--brand); color: #fff; }
.ptitle { font-weight: 600; }
.pmeta { font-size: .85rem; color: var(--muted); margin-top: 2px; }
.pmoney { text-align: right; font-size: .85rem; white-space: nowrap; }
.pmoney .over { color: var(--warn); font-weight: 600; }
.tag { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: #eee9df; color: var(--muted); margin-right: 4px; }
.tag.status-in_progress { background: #fdf0d5; color: #8a5a00; }
.tag.status-planned { background: #e3edf8; color: #24527a; }
.tag.status-done { background: #e2f3e8; color: var(--ok); }
.tag.blocked { background: #fbe6db; color: var(--warn); }

/* matrix */
.matrix { position: relative; height: 260px; border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); margin: 8px 0 26px 26px; }
.matrix .dot {
  position: absolute; transform: translate(-50%, 50%); max-width: 120px; font-size: .75rem; padding: 3px 7px; border-radius: 99px;
  background: var(--brand); color: #fff; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.matrix .ax { position: absolute; font-size: .75rem; color: var(--muted); }
.matrix .ax.x { bottom: -22px; right: 0; }
.matrix .ax.y { top: 0; left: -24px; writing-mode: vertical-rl; transform: rotate(180deg); }
.matrix .quad { position: absolute; font-size: .7rem; color: #b3ada0; }

/* sliders */
.score-row { display: grid; grid-template-columns: 80px 1fr 24px; gap: 8px; align-items: center; margin-bottom: 6px; font-size: .9rem; }
.score-row input { padding: 0; }

/* item tables */
.items { width: 100%; border-collapse: collapse; font-size: .92rem; }
.items td, .items th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.items th { font-size: .78rem; color: var(--muted); font-weight: 500; }
.items td.num, .items th.num { text-align: right; white-space: nowrap; }
.items tr.alt td { color: var(--muted); }
.items img { width: 40px; height: 40px; object-fit: contain; border-radius: 6px; background: #fafafa; }
.items .done-t { text-decoration: line-through; color: var(--muted); }
.addform { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); margin-top: 10px; align-items: end; }
.addform label { margin: 0; }

.links a { margin-right: 10px; font-size: .9rem; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; }
.tabs button { white-space: nowrap; }
.tabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }

#toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #222; color: #fff; padding: 10px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw;
}
#toast.show { opacity: .95; }

.signin { max-width: 420px; margin: 10vh auto; text-align: center; }
.signin #gbtn { display: flex; justify-content: center; margin: 20px 0; min-height: 44px; }

@media (max-width: 600px) {
  main { padding: 12px; }
  .pitem { grid-template-columns: 44px 1fr; }
  .score { width: 44px; height: 44px; }
  .pmoney { grid-column: 2; text-align: left; }
  .items .hide-sm { display: none; }
}

/* ── AI-first flow: next step, capture, inbox, interview ── */
.center { text-align: center; justify-content: center; }
button.big, .btn.big { width: 100%; padding: 14px 16px; font-size: 1.1rem; font-weight: 600; margin: 10px 0; }
.why { background: #eef5f0; border-left: 4px solid var(--brand); padding: 8px 12px; border-radius: 6px; margin: 10px 0; }
.warnc { color: var(--warn); }
.warnbox { background: #fdf3ec; border: 1px solid #f0d3bf; border-radius: 8px; padding: 10px 12px; margin: 10px 0; }
.warnbox ul { margin: 6px 0 0; padding-left: 20px; }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.bar i { display: block; height: 100%; background: var(--brand); }

#nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; justify-content: space-around; align-items: center;
  background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
#nav:empty { display: none; }
#nav a { flex: 1; text-align: center; text-decoration: none; color: var(--muted); font-size: .85rem; padding: 8px 0; font-weight: 600; }
#nav a.on { color: var(--brand); }
#navcap { width: 56px; height: 56px; border-radius: 50%; font-size: 1.8rem; line-height: 1; padding: 0; background: var(--brand); color: #fff; border: 0; margin-top: -24px; box-shadow: 0 2px 8px rgba(0,0,0,.2); }

.chips { gap: 6px; margin-bottom: 12px; }
.chips button { border-radius: 99px; padding: 6px 12px; font-size: .9rem; }
.chips button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.next { max-width: 560px; margin: 0 auto 14px; text-align: center; padding: 18px; }
.next .cover { width: 100%; max-height: 200px; object-fit: cover; border-radius: 8px; margin-bottom: 10px; }
.next h1.step { font-size: 1.6rem; margin: 10px 0 4px; }
.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; margin: 6px auto; display: grid; place-items: center;
  background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--line) 0); }
.ring span { width: 50px; height: 50px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: .85rem; font-weight: 700; }
.link-a { padding: 4px; font-size: .95rem; }
.inboxnote { display: block; max-width: 560px; margin: 0 auto 14px; text-decoration: none; }

.sheet { position: fixed; inset: 0; z-index: 10; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet-body { background: #fff; width: 100%; max-width: 560px; border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 92vh; overflow: auto; }
.bigpick { display: block; text-align: center; border: 2px dashed var(--line); border-radius: 12px; padding: 22px; font-size: 1.1rem; color: var(--ink); cursor: pointer; }
#mic { font-size: 1.3rem; }

.photos { display: flex; gap: 8px; overflow-x: auto; margin: 8px 0; }
.photos img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; flex: none; }
.photos a { position: relative; flex: none; }
.photos a span { position: absolute; left: 4px; bottom: 4px; font-size: .7rem; background: rgba(0,0,0,.55); color: #fff; padding: 1px 6px; border-radius: 99px; }
.inbox { list-style: none; padding: 0; margin: 0; }
.inbox .check { align-items: flex-start; font-size: .95rem; }
.inbox .check input { margin-top: 4px; }
.stickybar { position: sticky; bottom: 80px; }

.interview { max-width: 560px; margin: 0 auto; }
.interview h1 { font-size: 1.4rem; margin: 6px 0 14px; }
.choices { display: grid; gap: 8px; margin-bottom: 12px; }
.choices button { text-align: left; padding: 12px 14px; font-size: 1rem; }
.choices.small { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.choices.small button { font-size: .9rem; padding: 8px 10px; }
.budget { text-align: center; margin: 16px 0; }
.budget b { font-size: 2rem; display: block; margin-bottom: 8px; }
.budget input { padding: 0; }
.thinking { max-width: 420px; margin: 12vh auto; }
.spinner { width: 36px; height: 36px; border: 4px solid var(--line); border-top-color: var(--brand); border-radius: 50%; margin: 10px auto; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.plan h1 { margin-top: 4px; }
.steps { padding-left: 22px; margin: 6px 0; }
.steps li { margin: 4px 0; }
.session { font-weight: 600; font-size: .85rem; color: var(--brand); margin: 10px 0 2px; }
td.session { padding-top: 14px; border-bottom: 0; }
details { margin: 10px 0; }

/* ── feedback: 💬 on every screen, and #/feedback ── */
#fbbtn {
  position: fixed; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 7;
  width: 44px; height: 44px; border-radius: 50%; padding: 0; font-size: 1.25rem; line-height: 1;
  background: #fff; border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(0,0,0,.18); opacity: .9;
}
#fbbtn[hidden] { display: none; }
#fbsheet { z-index: 12; }
.fb-pointbar {
  position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 13;
  background: #222; color: #fff; padding: 8px 8px 8px 14px; border-radius: 99px; display: flex; gap: 10px; align-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.3); font-weight: 600;
}
.fb-pointbar button { padding: 4px 10px; border-radius: 99px; }
.fb-hover { outline: 3px solid #e0662a !important; outline-offset: 2px; }
.fbcount { font-weight: 700; color: var(--brand); background: #e7efe9; border-radius: 99px; padding: 2px 10px; }
.fbreports { list-style: none; padding: 0; margin: 8px 0; }
.fbreport { border-top: 1px solid var(--line); padding: 8px 0; }
.fbsnap { white-space: pre-wrap; font-size: .78rem; background: #f6f4ef; border-radius: 6px; padding: 8px; max-height: 260px; overflow: auto; margin: 6px 0; }
