:root {
  --bg: #F7F5F2; --card: #FFFFFF; --ink: #1C1A18; --mut: #77716B; --line: #E9E4DE;
  --acc: #E8590C; --acc-ink: #FFFFFF; --acc-soft: #FDEBDD;
  --teal: #0E7C86; --teal-soft: #DDF1F2; --good: #2F8F4E; --warn: #C2410C;
  --chip: #F0ECE7; --shadow: 0 1px 2px rgba(28,26,24,.05), 0 4px 16px rgba(28,26,24,.05);
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414; --card: #1F1E1D; --ink: #F3F0EC; --mut: #A39C94; --line: #2E2C2A;
    --acc: #FF7A33; --acc-ink: #1A0E06; --acc-soft: #3A2417;
    --teal: #4FC3CC; --teal-soft: #15302F; --good: #5CC27D; --chip: #2A2826;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--mut); }
.hidden { display: none !important; }

/* layout */
.screen { min-height: 100vh; padding: calc(var(--safe-t) + 16px) 16px calc(var(--safe-b) + 96px); max-width: 560px; margin: 0 auto; }
.screen.full { padding-bottom: calc(var(--safe-b) + 24px); }
.top { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 16px; gap: 12px; }
h1 { font-size: 28px; line-height: 1.15; margin: 0; letter-spacing: -.4px; }
h2 { font-size: 20px; margin: 0 0 10px; letter-spacing: -.2px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--mut); margin: 22px 0 8px; font-weight: 600; }
.sub { color: var(--mut); font-size: 14px; }
.card { background: var(--card); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.card + .card { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }

/* buttons */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 54px; border-radius: 16px; background: var(--acc); color: var(--acc-ink); font-weight: 650; font-size: 17px; padding: 0 18px; }
.btn:active { transform: scale(.985); opacity: .92; }
.btn.ghost { background: var(--chip); color: var(--ink); }
.btn.teal { background: var(--teal); color: #fff; }
.btn.sm { min-height: 42px; font-size: 15px; border-radius: 12px; width: auto; }
.btn.danger { background: transparent; color: var(--warn); border: 1px solid var(--line); }
.link { color: var(--acc); font-weight: 600; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--chip); font-size: 18px; }

/* tab bar */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); display: flex; padding: 6px 6px calc(var(--safe-b) + 6px); z-index: 20; }
.tabs a { flex: 1; text-align: center; text-decoration: none; color: var(--mut); font-size: 11px; font-weight: 600; padding: 6px 0 2px; border-radius: 12px; }
.tabs a .ti { display: block; font-size: 22px; line-height: 1.1; margin-bottom: 2px; filter: grayscale(1); opacity: .7; }
.tabs a.on { color: var(--acc); }
.tabs a.on .ti { filter: none; opacity: 1; }

/* home */
.hero { background: var(--acc); color: var(--acc-ink); border: 0; }
.hero .sub { color: inherit; opacity: .85; }
.hero .btn { background: var(--acc-ink); color: var(--acc); margin-top: 14px; }
@media (prefers-color-scheme: dark) { .hero .btn { background: #1A0E06; color: var(--acc); } }
.hero-no { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; opacity: .85; }
.hero-title { font-size: 26px; font-weight: 750; letter-spacing: -.4px; margin: 2px 0 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; padding: 5px 10px; border-radius: 999px; background: var(--chip); color: var(--ink); }
.hero .chip { background: rgba(255,255,255,.18); color: inherit; }
.other { display: flex; gap: 8px; margin-top: 10px; }
.other button { flex: 1; padding: 10px 6px; border-radius: 12px; background: rgba(255,255,255,.16); color: inherit; font-size: 13px; font-weight: 600; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wd { text-align: center; padding: 8px 0; border-radius: 12px; background: var(--chip); font-size: 12px; color: var(--mut); font-weight: 600; }
.wd b { display: block; font-size: 16px; color: var(--ink); margin-top: 2px; }
.wd.today { outline: 2px solid var(--acc); outline-offset: -2px; }
.wd.s { background: var(--acc); color: var(--acc-ink); } .wd.s b { color: var(--acc-ink); }
.wd.c { background: var(--teal-soft); color: var(--teal); } .wd.c b { color: var(--teal); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; box-shadow: var(--shadow); }
.stat .v { font-size: 24px; font-weight: 750; letter-spacing: -.3px; }
.stat .l { font-size: 12px; color: var(--mut); }
.note { border-left: 4px solid var(--teal); }
.note .from { font-size: 12px; color: var(--teal); font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }

/* run */
.run-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.bar { flex: 1; height: 6px; background: var(--chip); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--acc); border-radius: 99px; transition: width .3s; }
.run-count { font-size: 13px; color: var(--mut); font-weight: 600; min-width: 44px; text-align: right; }
.ex-photo { position: relative; border-radius: 20px; overflow: hidden; aspect-ratio: 4/3; background: var(--chip); }
.ex-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ex-photo .ph-none { width: 100%; height: 100%; display: grid; place-items: center; color: var(--mut); font-size: 56px; }
.ex-tag { position: absolute; top: 12px; left: 12px; background: var(--acc); color: var(--acc-ink); font-weight: 750; padding: 4px 10px; border-radius: 10px; font-size: 15px; }
.ex-setno { position: absolute; top: 12px; right: 12px; background: rgba(0,0,0,.6); color: #fff; font-weight: 650; padding: 4px 10px; border-radius: 10px; font-size: 14px; }
.ex-name { font-size: 24px; font-weight: 750; letter-spacing: -.3px; margin: 14px 0 2px; line-height: 1.15; }
.ex-where { font-size: 12px; color: var(--mut); text-transform: uppercase; letter-spacing: .7px; font-weight: 600; }
.target { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.target .chip { font-weight: 650; }
.target .chip.acc { background: var(--acc-soft); color: var(--acc); }
.target .chip.good { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
details.tip { margin-top: 10px; background: var(--chip); border-radius: 14px; padding: 10px 12px; font-size: 14px; }
details.tip summary { font-weight: 650; list-style: none; cursor: pointer; }
details.tip summary::-webkit-details-marker { display: none; }
details.tip p { margin: 6px 0 0; color: var(--ink); }
.steppers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.stepper { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 8px; text-align: center; }
.stepper .lbl { font-size: 12px; color: var(--mut); font-weight: 600; }
.stepper .ctl { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: 2px; }
.stepper button { width: 44px; height: 44px; border-radius: 12px; background: var(--chip); font-size: 22px; font-weight: 600; }
.stepper input { width: 100%; min-width: 0; text-align: center; font-size: 26px; font-weight: 750; border: 0; background: transparent; padding: 0; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.feel { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.feel button { padding: 10px 4px; border-radius: 12px; background: var(--chip); font-size: 14px; font-weight: 600; color: var(--mut); }
.feel button.on { background: var(--ink); color: var(--bg); }
.run-actions { margin-top: 14px; display: grid; gap: 8px; }
.swap { text-align: center; margin-top: 10px; font-size: 14px; }
.swap button { color: var(--mut); text-decoration: underline; text-underline-offset: 3px; }
.done-sets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.done-sets span { font-size: 12px; padding: 4px 8px; border-radius: 8px; background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); font-weight: 650; }

/* timers */
.overlay { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; padding: calc(var(--safe-t) + 20px) 20px calc(var(--safe-b) + 24px); max-width: 560px; margin: 0 auto; }
.overlay .lbl { text-align: center; font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: var(--mut); margin-top: 12px; }
.ring { position: relative; width: min(72vw, 300px); aspect-ratio: 1; margin: 24px auto 8px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .bg { stroke: var(--chip); }
.ring .fg { stroke: var(--acc); stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.ring.teal .fg { stroke: var(--teal); }
.ring .num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 76px; font-weight: 750; letter-spacing: -2px; font-variant-numeric: tabular-nums; }
.next-up { margin-top: auto; }
.next-up .card { display: flex; gap: 12px; align-items: center; }
.next-up img, .next-up .ph-none { width: 72px; height: 54px; border-radius: 10px; object-fit: cover; background: var(--chip); display: grid; place-items: center; flex-shrink: 0; }
.ov-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.big-timer { text-align: center; font-size: 64px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -1px; margin: 14px 0 4px; }

/* lists */
.list { background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.li { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-top: 1px solid var(--line); }
.li:first-child { border-top: 0; }
.li .t { font-weight: 600; }
.li .s { font-size: 13px; color: var(--mut); }
.li .r { margin-left: auto; text-align: right; font-weight: 650; white-space: nowrap; }
.li.tap:active { background: var(--chip); }
.warm li { margin: 6px 0; }

/* forms */
.field { display: block; margin-top: 10px; }
.field span { display: block; font-size: 13px; color: var(--mut); font-weight: 600; margin-bottom: 4px; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px 14px; font-size: 17px; }
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { outline: 2px solid var(--acc); outline-offset: -1px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.days button { padding: 11px 0; border-radius: 12px; background: var(--chip); font-weight: 650; font-size: 14px; color: var(--mut); }
.days button.on { background: var(--acc); color: var(--acc-ink); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.switch:first-child { border-top: 0; }
.tgl { width: 50px; height: 30px; border-radius: 99px; background: var(--chip); position: relative; flex-shrink: 0; transition: background .2s; }
.tgl::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .2s; }
.tgl.on { background: var(--good); }
.tgl.on::after { left: 23px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--chip); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { padding: 9px 4px; border-radius: 10px; font-weight: 650; font-size: 14px; color: var(--mut); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.hscroll { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll .chip { white-space: nowrap; font-weight: 600; padding: 8px 12px; }
.hscroll .chip.on { background: var(--acc); color: var(--acc-ink); }

/* chart */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--mut); font-size: 10px; }
.chart .ln { fill: none; stroke: var(--acc); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--acc); opacity: .1; }
.chart .dot { fill: var(--card); stroke: var(--acc); stroke-width: 2; }
.chart .lbl { fill: var(--ink); font-size: 11px; font-weight: 700; }
.chart.teal .ln, .chart.teal .dot { stroke: var(--teal); } .chart.teal .area { fill: var(--teal); }
.chart .barr { fill: var(--acc); opacity: .85; }
.empty { text-align: center; color: var(--mut); padding: 22px 10px; font-size: 14px; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal .h { font-size: 11px; color: var(--mut); font-weight: 700; padding: 4px 0; }
.cal .d { aspect-ratio: 1; border-radius: 12px; display: grid; place-items: center; font-weight: 600; font-size: 15px; position: relative; }
.cal .d.out { opacity: .25; }
.cal .d.today { outline: 2px solid var(--acc); outline-offset: -2px; }
.cal .d.s { background: var(--acc); color: var(--acc-ink); }
.cal .d.c { background: var(--teal-soft); color: var(--teal); }
.cal .d.s.c { background: var(--acc); color: var(--acc-ink); }
.cal .d.s.c::after { content: ''; position: absolute; bottom: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--acc-ink); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--mut); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 50; animation: fade .2s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; background: var(--bg); border-radius: 22px 22px 0 0; padding: 10px 16px calc(var(--safe-b) + 18px); max-height: 88vh; overflow-y: auto; max-width: 560px; margin: 0 auto; animation: up .25s cubic-bezier(.2,.8,.2,1); }
.sheet .grab { width: 40px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 12px; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-b) + 90px); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-size: 15px; font-weight: 600; z-index: 60; max-width: 90vw; text-align: center; box-shadow: 0 6px 24px rgba(0,0,0,.2); }

/* login */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; max-width: 420px; margin: 0 auto; }
.login .logo { width: 84px; height: 84px; border-radius: 22px; margin-bottom: 20px; }
.err { color: var(--warn); font-size: 14px; margin-top: 8px; min-height: 20px; }
.pr { display: inline-block; background: #F5C518; color: #3A2C00; font-size: 11px; font-weight: 800; padding: 2px 6px; border-radius: 6px; margin-left: 6px; vertical-align: 2px; }
.install { background: var(--acc-soft); border-color: transparent; }
.install ol { margin: 8px 0 0; padding-left: 20px; }
.install li { margin: 4px 0; }
.offline { background: #6B6259; color: #fff; text-align: center; font-size: 13px; padding: 6px; border-radius: 10px; margin-bottom: 10px; }
