
:root {
  --bg: #f2f5f1; --surface: #ffffff; --surface-2: #f6f9f5; --line: #e1e8df;
  --ink: #142218; --ink-2: #44554a; --muted: #6f7f74;
  --btn: #1d6b3a; --green: #1d6b3a; --green-deep: #14532d; --green-soft: #e3f1e6;
  --gold: #d99a00; --gold-soft: #fff4d6; --red: #c0392b; --red-soft: #fde9e6;
  --shadow: 0 1px 2px rgba(20,34,24,.06), 0 4px 16px rgba(20,34,24,.06);
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1510; --surface: #152019; --surface-2: #1a281f; --line: #24352a;
    --ink: #e6efe8; --ink-2: #b9c9bd; --muted: #8ea195;
    --btn: #217a43; --green: #4cb36f; --green-deep: #0f2a19; --green-soft: #183323;
    --gold: #f2c14e; --gold-soft: #2e2611; --red: #ef7564; --red-soft: #33191a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  }
}
:root[data-theme="dark"] {
  --bg: #0d1510; --surface: #152019; --surface-2: #1a281f; --line: #24352a;
  --ink: #e6efe8; --ink-2: #b9c9bd; --muted: #8ea195;
  --btn: #217a43; --green: #4cb36f; --green-deep: #0f2a19; --green-soft: #183323;
  --gold: #f2c14e; --gold-soft: #2e2611; --red: #ef7564; --red-soft: #33191a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: Inter, system-ui, sans-serif; background: var(--bg); color: var(--ink); min-height: 100vh;
       padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
h1, h2, h3, .num { font-family: Outfit, Inter, sans-serif; }
button { font: inherit; color: inherit; }


/* slim header */
.top { position: sticky; top: 0; z-index: 20; background: var(--green-deep); color: #fff; }
.top-in { max-width: 920px; margin: 0 auto; height: 56px; padding: 0 16px; display: flex; align-items: center; gap: 10px; }
.logo { width: 32px; height: 32px; border-radius: 9px; background: #fff; display: grid; place-items: center; }
.brand { font-family: Outfit; font-weight: 700; font-size: 1.1rem; letter-spacing: .2px; }
.brand small { display: block; font-family: Inter; font-weight: 500; font-size: .7rem; opacity: .7; letter-spacing: 0; }
.top .spacer { flex: 1; }
.icon-btn { background: rgba(255,255,255,.12); border: 0; width: 36px; height: 36px; border-radius: 10px; cursor: pointer; display: grid; place-items: center; color: #fff; }
.desk-tabs { display: none; gap: 4px; }
.desk-tabs button { background: none; border: 0; color: #cfe5d5; padding: 8px 12px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: .9rem; }
.desk-tabs button.on { background: rgba(255,255,255,.14); color: #fff; }

/* bottom tab bar (phones) */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line);
          display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: env(safe-area-inset-bottom); }
.tabbar button { background: none; border: 0; padding: 8px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 3px;
                 font-size: .68rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabbar svg { width: 24px; height: 24px; }
.tabbar button.on { color: var(--green); }
.tabbar .plus { width: 46px; height: 46px; margin-top: -20px; border-radius: 50%; background: var(--btn); color: #fff; display: grid; place-items: center;
                box-shadow: 0 4px 12px rgba(29,107,58,.4); border: 4px solid var(--surface); }
.tabbar .plus svg { width: 22px; height: 22px; }
@media (min-width: 760px) {
  .tabbar { display: none; }
  .desk-tabs { display: flex; }
  body { padding-bottom: 32px; }
}

main { max-width: 920px; margin: 0 auto; padding: 16px; }
.view { display: none; }
.view.on { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.grid > * { min-width: 0; }
@media (min-width: 760px) { .grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; border: 1px solid var(--line); }
.card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card h3 a, .link { color: var(--green); font-size: .82rem; font-weight: 600; text-decoration: none; font-family: Inter; cursor: pointer; background: none; border: 0; }
.eyebrow { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 600; padding: 3px 9px; border-radius: 999px;
        background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.chip.g { background: var(--green-soft); color: var(--green); border-color: transparent; }
.chip.y { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.chip.r { background: var(--red-soft); color: var(--red); border-color: transparent; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }

/* home */
.hello { margin: 4px 2px 14px; }
.hello h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.3px; }
.hello p { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.cta { width: 100%; border: 0; border-radius: var(--radius); background: var(--btn); color: #fff; padding: 16px; font-weight: 700; font-size: 1.05rem;
       display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; box-shadow: 0 6px 18px rgba(29,107,58,.3); font-family: Outfit; }
.wx-top { display: flex; align-items: center; gap: 14px; }
.wx-big { font-size: 2.6rem; line-height: 1; }
.wx-verdict { font-family: Outfit; font-weight: 700; font-size: 1.15rem; }
.strip { display: flex; gap: 6px; overflow-x: auto; margin-top: 12px; padding-bottom: 4px; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.hr { flex: 0 0 52px; text-align: center; border-radius: 12px; padding: 8px 0; background: var(--surface-2); border: 1px solid var(--line); }
.hr .t { font-size: .7rem; color: var(--muted); font-weight: 600; }
.hr .i { font-size: 1.25rem; margin: 2px 0; }
.hr .p { font-size: .72rem; font-weight: 600; }
.hr.good { border-color: var(--green); }
.hr.poor { opacity: .55; }
.last { display: flex; align-items: center; gap: 16px; }
.score-ring { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--green-soft); flex: 0 0 auto; }
.score-ring .num { font-size: 1.9rem; font-weight: 800; color: var(--green); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; box-shadow: var(--shadow); }
.tile .num { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.tile .lbl { font-size: .7rem; color: var(--muted); font-weight: 600; margin-top: 2px; }
.spark-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.spark-row:first-of-type { border-top: 0; padding-top: 0; }
.spark-row .who { font-weight: 600; font-size: .9rem; }

/* enter */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: none; padding: 10px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--green); box-shadow: var(--shadow); }
.field { margin-top: 16px; }
.field label { display: block; font-size: .78rem; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.field input[type=date], .field input[type=text] { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: inherit; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { border: 1px solid var(--line); background: var(--surface-2); padding: 9px 14px; border-radius: 999px; font-weight: 600; cursor: pointer; }
.pill.on { background: var(--btn); border-color: var(--btn); color: #fff; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 18px; }
.stepper button { width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); font-size: 1.6rem; cursor: pointer; }
.stepper .num { font-size: 3.2rem; font-weight: 800; min-width: 110px; text-align: center; }
.save { margin-top: 20px; }
.toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
         background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 14px; font-weight: 600; font-size: .9rem; transition: .25s; z-index: 50; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* history */
.filters { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; }
.month { font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin: 16px 4px 8px; }
.round { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; box-shadow: var(--shadow); }
.round .d { text-align: center; width: 40px; flex: 0 0 auto; }
.round .d b { display: block; font-family: Outfit; font-size: 1.3rem; line-height: 1; }
.round .d span { font-size: .68rem; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.round .mid { flex: 1; min-width: 0; }
.round .who { font-size: .85rem; color: var(--ink-2); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.round .note { font-size: .78rem; color: var(--muted); font-style: italic; margin-top: 2px; }
.round .sc { font-family: Outfit; font-size: 1.6rem; font-weight: 800; }

/* stats */
table.sum { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.sum th { text-align: right; font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; padding: 6px 6px; font-weight: 700; }
table.sum th:first-child, table.sum td:first-child { text-align: left; }
table.sum td { padding: 10px 6px; border-top: 1px solid var(--line); text-align: right; }
table.sum td.b { color: var(--green); font-weight: 700; }
table.sum td.w { color: var(--red); }

/* weather list */
.wrow { display: grid; grid-template-columns: 52px 34px 1fr auto; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.wrow:first-child { border-top: 0; }
.wrow .tm { font-weight: 700; font-family: Outfit; }
.wrow .ic { font-size: 1.4rem; }
.wrow .dt { font-size: .82rem; color: var(--ink-2); }

.notes-card { border-style: dashed; background: transparent; box-shadow: none; }
.notes-card li { margin: 6px 0 6px 18px; font-size: .88rem; color: var(--ink-2); }
canvas#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }

/* ---------- additions for the full app ---------- */
.cta:disabled { opacity: .6; cursor: default; }
.btn-ghost { width: 100%; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); border-radius: 14px; padding: 13px; font-weight: 700; cursor: pointer; }
.btn-danger { width: 100%; border: 1px solid transparent; background: var(--red-soft); color: var(--red); border-radius: 14px; padding: 13px; font-weight: 700; cursor: pointer; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.seg button:disabled { cursor: default; }
.seg.locked { opacity: .7; }
.stepper input { font-family: Outfit; font-size: 3rem; font-weight: 800; width: 130px; text-align: center; border: 0; background: transparent; color: var(--ink); -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: 2px solid var(--green); border-radius: 12px; }
.guest-in { margin-top: 8px; display: none; }
.guest-in.on { display: block; }
.err { color: var(--red); font-size: .85rem; font-weight: 600; margin-top: 10px; min-height: 1em; text-align: center; }
.round { cursor: pointer; transition: transform .1s; text-align: left; width: 100%; font: inherit; color: inherit; }
.round:active { transform: scale(.99); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* sheets (edit round, rounds behind a figure) */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 70; display: none; align-items: flex-end; justify-content: center; }
.sheet-bg.on { display: flex; animation: fade .15s ease; }
.sheet { background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sheet-head h3 { font-size: 1.15rem; }
.x { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--surface-2); cursor: pointer; font-size: 1.1rem; }
@media (min-width: 760px) { .sheet-bg { align-items: center; } .sheet { border-radius: 20px; } }

/* stats */
.section-title { font-family: Outfit; font-weight: 700; font-size: 1.15rem; margin: 22px 2px 10px; }
.kind { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 4px; }
.sub { font-size: .8rem; color: var(--muted); margin-bottom: 6px; }
table.sum td button { background: none; border: 0; font: inherit; color: inherit; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
table.sum td button:hover, table.sum td button:focus-visible { background: var(--surface-2); outline: none; }
.chart { position: relative; width: 100%; margin-bottom: 6px; }
.chart svg { display: block; width: 100%; touch-action: pan-y; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); font-size: .78rem; padding: 6px 9px; border-radius: 8px;
       white-space: nowrap; transform: translate(-50%, calc(-100% - 12px)); display: none; z-index: 2; line-height: 1.35; }
.up { color: var(--green); font-weight: 700; }
.down { color: var(--red); font-weight: 700; }
.flat { color: var(--muted); font-weight: 700; }
.rec { padding: 12px 0; border-top: 1px solid var(--line); }
.rec:first-child { border-top: 0; padding-top: 0; }
.rec div { font-size: .88rem; margin: 3px 0; color: var(--ink-2); }
table.lu { width: 100%; border-collapse: collapse; font-size: .86rem; margin-bottom: 14px; }
table.lu th { text-align: left; font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; padding: 6px; font-weight: 700; }
table.lu td { padding: 8px 6px; border-top: 1px solid var(--line); }
table.lu .n { text-align: right; white-space: nowrap; }
.bar { position: relative; height: 10px; background: var(--surface-2); border-radius: 4px; min-width: 70px; }
.bar span { position: absolute; top: 0; height: 10px; border-radius: 4px; }
.bar i { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--muted); }
.foot { font-size: .75rem; color: var(--muted); margin-top: 10px; line-height: 1.5; }
