:root {
  --bg: #f3f1ec;
  --surface: #ffffff;
  --surface-2: #eceae4;
  --ink: #1b1f24;
  --ink-2: #4b535d;
  --muted: #7a828c;
  --line: #dcd8cf;
  --accent: #ef4a2b;
  --brand-grad: linear-gradient(90deg, #ff3b33, #ff8c4b);
  --black: #121417;
  --accent-ink: #ffffff;
  --accent-soft: #fde4dd;
  --steel: #2f3b48;
  --active: #ef4a2b;
  --planned: #3f6c99;
  --hold: #c78a00;
  --done: #2f8a4f;
  --danger: #c92a2a;
  --high: #d9480f;
  --shadow: 0 1px 2px rgba(20, 24, 28, .06), 0 4px 14px rgba(20, 24, 28, .07);
  --radius: 14px;
  --nav-h: 68px;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Montserrat", "Barlow", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121519; --surface: #1b2026; --surface-2: #232931; --ink: #eef0f2; --ink-2: #b8c0c9;
    --muted: #8a939d; --line: #2e353e; --accent: #ff5a3c; --accent-ink: #ffffff; --accent-soft: #3a1d17; --active: #ff5a3c; --black: #0b0c0e;
    --steel: #0c0f12; --planned: #6a9bd0; --hold: #e0a82b; --done: #4cb672;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #121519; --surface: #1b2026; --surface-2: #232931; --ink: #eef0f2; --ink-2: #b8c0c9;
    --muted: #8a939d; --line: #2e353e; --accent: #ff5a3c; --accent-ink: #ffffff; --accent-soft: #3a1d17; --active: #ff5a3c; --black: #0b0c0e;
    --steel: #0c0f12; --planned: #6a9bd0; --hold: #e0a82b; --done: #4cb672;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
    color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.4; }
body.noscroll { overflow: hidden; }
h1, h2, h3 { font-family: var(--font-head); letter-spacing: .01em; margin: 0; line-height: 1.1; }
h1 { font-size: 27px; font-weight: 800; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 21px; font-weight: 800; letter-spacing: -.01em; text-wrap: balance; }
h3 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-2); }
p { margin: .4em 0; }
a { color: var(--accent); }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack-v > * + * { margin-top: 12px; }
.hidden { display: none !important; }

/* ---------- app shell ---------- */
.app { max-width: 920px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px); }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px; background: var(--black); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand-logo { height: 24px; width: auto; display: block; }
.brand-sub { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.55); border-left: 1px solid rgba(255,255,255,.2); padding-left: 10px; }
.brand-text { min-width: 0; }
.brand-text strong { font-family: var(--font-head); font-size: 21px; display: block; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { font-size: 12px; opacity: .7; text-transform: uppercase; letter-spacing: .08em; }
.topbar .icon-btn { color: #fff; position: relative; }
.badge { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.demo-banner { background: #ffd43b; color: #2b2100; font-size: 14px; padding: 7px 16px; text-align: center; font-weight: 600; }

.page { padding: 18px 16px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center;
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav-inner { display: flex; width: 100%; max-width: 920px; }
.bottomnav a {
  flex: 1; height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 12.5px; font-weight: 600; letter-spacing: .02em;
}
.bottomnav a.on { color: var(--accent); }
.bottomnav a.on svg { stroke-width: 2.4; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border-radius: 12px; border: 1.5px solid transparent; background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: 17px; text-decoration: none; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.dark { background: var(--steel); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 15px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.big { min-height: 64px; font-size: 20px; border-radius: 16px; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border: 0; background: transparent; border-radius: 12px; color: var(--ink-2); flex: none; }
.icon-btn:active { background: var(--surface-2); }
.fab {
  position: fixed; right: max(18px, calc(50vw - 460px + 18px)); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 18px); z-index: 25;
  height: 58px; padding: 0 22px 0 18px; border-radius: 29px; border: 0; background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; box-shadow: 0 6px 20px rgba(239, 74, 43, .38); background: var(--brand-grad); color: #fff;
}

/* ---------- cards & chips ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: 0 -16px 16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 15px; font-weight: 600; font-size: 15px; color: var(--ink-2); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip .n { opacity: .6; margin-left: 4px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-active { color: var(--active); background: color-mix(in srgb, var(--active) 14%, transparent); }
.st-planned { color: var(--planned); background: color-mix(in srgb, var(--planned) 14%, transparent); }
.st-hold { color: var(--hold); background: color-mix(in srgb, var(--hold) 16%, transparent); }
.st-done { color: var(--done); background: color-mix(in srgb, var(--done) 14%, transparent); }
.tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.flag { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; }
.pr-high { color: var(--high); }
.pr-normal { color: var(--ink-2); }
.pr-low { color: var(--muted); }

/* ---------- avatars ---------- */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; flex: none; letter-spacing: .02em; }
.avatar.ring { box-shadow: 0 0 0 2px var(--surface); }
.avatar.more { background: var(--surface-2); color: var(--ink-2); font-size: 12px; }
.stack { display: inline-flex; }
.stack .avatar + .avatar { margin-left: -8px; }

/* ---------- dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat b { font-family: var(--font-head); font-weight: 800; font-size: 28px; font-variant-numeric: tabular-nums; display: block; line-height: 1; }
.stat span { font-size: 13px; color: var(--muted); font-weight: 600; }
.today-card { background: var(--steel); color: #fff; border-radius: var(--radius); padding: 16px; margin-bottom: 18px; }
.today-card h3 { color: rgba(255, 255, 255, .7); margin-bottom: 10px; }
.today-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid rgba(255, 255, 255, .12); }
.today-row:first-of-type { border-top: 0; padding-top: 0; }
.today-row .t { font-family: var(--font-head); font-weight: 800; font-size: 17px; width: 76px; flex: none; font-variant-numeric: tabular-nums; }
.today-row .btn.ghost { color: #fff; border-color: rgba(255, 255, 255, .35); }

.circles { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 22px 14px; }
.circle-item { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; background: none; border: 0; padding: 0; text-decoration: none; color: inherit; }
.circle {
  --c: var(--planned); --p: 0;
  width: 138px; height: 138px; border-radius: 50%; position: relative; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-2) 0);
  transition: transform .15s ease;
}
.circle-item:active .circle { transform: scale(.96); }
.circle-inner {
  width: 118px; height: 118px; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 10px; box-shadow: inset 0 0 0 1px var(--line);
}
.circle-inner strong { font-family: var(--font-head); font-weight: 700; font-size: 15px; line-height: 1.15; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.circle-inner .pct { font-size: 13px; font-weight: 700; color: var(--c); margin-top: 4px; }
.circle .hi { position: absolute; top: 6px; right: 10px; width: 22px; height: 22px; border-radius: 50%; background: var(--high); color: #fff; font-weight: 800; font-size: 14px; display: grid; place-items: center; box-shadow: 0 0 0 3px var(--bg); }
.circle .live { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); background: var(--done); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; box-shadow: 0 0 0 3px var(--bg); white-space: nowrap; }
.circle-meta { font-size: 13.5px; color: var(--muted); font-weight: 600; line-height: 1.25; }
.c-active { --c: var(--active); } .c-planned { --c: var(--planned); } .c-on_hold { --c: var(--hold); } .c-done { --c: var(--done); }

.banner { display: flex; gap: 12px; align-items: flex-start; background: var(--accent-soft); border-radius: var(--radius); padding: 14px; margin-bottom: 16px; }
.banner .grow p { margin: 2px 0 0; font-size: 15px; color: var(--ink-2); }

/* ---------- job page ---------- */
.job-hero { background: var(--steel); color: #fff; padding: 14px 16px 18px; }
.job-hero .row .icon-btn { color: #fff; }
.job-hero h1 { margin: 6px 0 8px; }
.job-hero .meta { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 15px; opacity: .85; }
.job-hero .meta span { display: inline-flex; align-items: center; gap: 6px; }
.job-hero .meta svg { width: 17px; height: 17px; }
.job-hero .pill { background: rgba(255, 255, 255, .14); }
.progress { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .15); overflow: hidden; margin-top: 14px; }
.progress > i { display: block; height: 100%; background: var(--brand-grad); border-radius: 4px; }
.clock-card { margin: -0px 16px 0; transform: translateY(-1px); }
.clock { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); margin: 14px 16px 0; }
.clock .grow strong { display: block; }
.on-site-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--done); box-shadow: 0 0 0 4px color-mix(in srgb, var(--done) 25%, transparent); flex: none; animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--done) 10%, transparent); } }

.tabs { position: sticky; top: calc(env(safe-area-inset-top) + 0px); z-index: 15; display: flex; overflow-x: auto; background: var(--bg); border-bottom: 1px solid var(--line); padding: 0 8px; margin-top: 12px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; padding: 14px 12px 12px; text-decoration: none; color: var(--muted); font-weight: 700; font-size: 16px; border-bottom: 3px solid transparent; }
.tabs a.on { color: var(--ink); border-color: var(--accent); }

.feed { position: relative; margin-left: 8px; }
.feed::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.feed-item { position: relative; display: flex; gap: 12px; padding: 8px 0 14px; }
.feed-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line); flex: none; z-index: 1; color: var(--ink-2); }
.feed-ic svg { width: 16px; height: 16px; }
.feed-ic.k-note { border-color: var(--planned); color: var(--planned); }
.feed-ic.k-in { border-color: var(--done); color: var(--done); }
.feed-ic.k-out { border-color: var(--muted); }
.feed-ic.k-task { border-color: var(--accent); color: var(--accent); }
.feed-ic.k-photo { border-color: var(--hold); color: var(--hold); }
.feed-ic.k-mile { background: var(--steel); border-color: var(--steel); color: #fff; }
.feed-body { flex: 1; min-width: 0; padding-top: 4px; }
.feed-body .who { font-weight: 700; }
.feed-body .when { color: var(--muted); font-size: 13px; margin-left: 6px; }
.feed-body .txt { margin-top: 3px; white-space: pre-wrap; word-wrap: break-word; }
.feed-body img { margin-top: 8px; width: 160px; height: 120px; object-fit: cover; border-radius: 10px; display: block; }
.day-label { font-family: var(--font-head); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-size: 12px; margin: 10px 0 4px 48px; }

.composer { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 18px; }
.composer textarea { flex: 1; min-height: 48px; max-height: 160px; resize: vertical; }

/* ---------- tasks ---------- */
.task { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.task + .task { margin-top: 8px; }
.task.done .task-title { text-decoration: line-through; color: var(--muted); }
.tick { width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--line); background: var(--surface); display: grid; place-items: center; flex: none; padding: 0; color: #fff; }
.tick.on { background: var(--done); border-color: var(--done); }
.tick.doing { border-color: var(--accent); }
.tick.doing::after { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
.tick:disabled { opacity: .55; }
.task-main { flex: 1; min-width: 0; background: none; border: 0; padding: 0; text-align: left; }
.task-title { font-weight: 600; display: block; }
.task-sub { display: flex; align-items: center; gap: 8px; margin-top: 3px; font-size: 13.5px; color: var(--muted); flex-wrap: wrap; }
.addline { display: flex; gap: 8px; margin-bottom: 14px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 10px; }
.section-title:first-child { margin-top: 0; }

/* ---------- location ---------- */
.map { width: 100%; height: 280px; border: 0; border-radius: var(--radius); background: var(--surface-2); display: block; }
.addr { font-size: 20px; font-weight: 600; margin: 14px 0; }

/* ---------- photos ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.photo-grid button { aspect-ratio: 1; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.viewer { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .94); color: #fff; display: flex; flex-direction: column; }
.viewer img { flex: 1; min-height: 0; object-fit: contain; width: 100%; }
.viewer .bar { display: flex; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top) + 10px) 12px 10px; }
.viewer .bar .icon-btn { color: #fff; }
.viewer .cap { padding: 12px 16px calc(env(safe-area-inset-bottom) + 16px); }
.upload-tile { aspect-ratio: 1; border: 2px dashed var(--line) !important; background: transparent !important; color: var(--accent); display: grid !important; place-items: center; font-weight: 700; font-size: 14px; }

/* ---------- lists ---------- */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); min-height: 60px; }
.li:first-child { border-top: 0; }
.li .grow strong { display: block; }
.li .grow .small { color: var(--muted); }
button.li { width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; }

/* ---------- board ---------- */
.board-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px 20px; -webkit-overflow-scrolling: touch; }
.board { display: flex; gap: 12px; align-items: flex-start; min-height: 60vh; }
.col { width: 252px; flex: none; background: var(--surface-2); border-radius: var(--radius); padding: 10px; border: 2px solid transparent; transition: border-color .12s, background .12s; }
.col.over { border-color: var(--accent); background: var(--accent-soft); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; }
.col-head strong { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-head .count { font-size: 13px; font-weight: 700; color: var(--muted); }
.col-empty { border: 2px dashed var(--line); border-radius: 10px; padding: 18px 8px; text-align: center; color: var(--muted); font-size: 14px; }
.tcard { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--c, var(--planned)); border-radius: 10px; padding: 10px 10px 10px 12px; box-shadow: var(--shadow); touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: grab; }
.tcard + .tcard { margin-top: 8px; }
.tcard .job { font-size: 12.5px; font-weight: 700; color: var(--c); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tcard .tt { font-weight: 600; margin-top: 2px; }
.tcard .row { margin-top: 6px; font-size: 13px; }
.tcard.dragging { opacity: .35; }
.drag-ghost { position: fixed; z-index: 100; pointer-events: none; width: 232px; transform: rotate(-2deg) scale(1.03); box-shadow: 0 14px 30px rgba(0, 0, 0, .25); opacity: .95; }
.board-hint { font-size: 14px; color: var(--muted); margin: -4px 0 12px; }

/* ---------- schedule ---------- */
.weekbar { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.weekbar strong { flex: 1; text-align: center; font-family: var(--font-head); font-weight: 700; font-size: 17px; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 18px; }
.daybtn { border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px 0; text-align: center; }
.daybtn small { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.daybtn b { font-family: var(--font-head); font-weight: 800; font-size: 19px; }
.daybtn i { display: block; height: 6px; width: 6px; border-radius: 50%; margin: 3px auto 0; background: transparent; }
.daybtn.has i { background: var(--accent); }
.daybtn.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.daybtn.on small { color: inherit; opacity: .7; }
.daybtn.today { border-color: var(--accent); }
.shift-group { margin-bottom: 14px; }
.shift-group > .row { margin-bottom: 8px; }
.jobdot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; }

/* ---------- forms & sheets ---------- */
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 14px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .05em; }
.hint { display: block; font-size: 13.5px; color: var(--muted); margin-top: 5px; }
.input, input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=time], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; min-height: 50px; padding: 11px 13px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); font-size: 17px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 9px; min-height: 42px; font-weight: 700; color: var(--ink-2); font-size: 15px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.weekdays { display: flex; gap: 6px; }
.weekdays button { flex: 1; min-height: 44px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 700; }
.weekdays button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.switch { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.switch input { width: 50px; height: 30px; appearance: none; background: var(--line); border-radius: 15px; position: relative; flex: none; transition: background .15s; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked { background: var(--done); }
.switch input:checked::after { transform: translateX(20px); }

.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(15, 18, 22, .5); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { width: 100%; max-width: 560px; max-height: 92vh; background: var(--bg); border-radius: 20px 20px 0 0; display: flex; flex-direction: column; animation: up .2s ease-out; }
@media (min-width: 640px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 20px; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 12px 8px 18px; }
.sheet-body { padding: 8px 18px 18px; overflow-y: auto; }
.sheet-foot { display: flex; gap: 10px; padding: 12px 18px calc(env(safe-area-inset-bottom) + 14px); border-top: 1px solid var(--line); }
.sheet-foot .btn { flex: 1; }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }
@keyframes fade { from { opacity: 0; } }

.picker { display: flex; flex-direction: column; gap: 6px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 52px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); text-align: left; font-weight: 600; }
.pick span:nth-child(2) { flex: 1; }
.pick .check { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center; color: #fff; }
.pick.on { border-color: var(--accent); }
.pick.on .check { background: var(--accent); border-color: var(--accent); }
.pick .check svg { width: 16px; height: 16px; }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 34px 20px; color: var(--ink-2); }
.empty-ic { width: 60px; height: 60px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 12px; color: var(--muted); }
.empty p { color: var(--muted); max-width: 320px; margin: 6px auto 14px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 18px); transform: translateX(-50%); z-index: 90; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); max-width: calc(100vw - 32px); animation: up .2s; }
.toast.error { background: var(--danger); color: #fff; }

.auth { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px 20px calc(env(safe-area-inset-bottom) + 24px); max-width: 440px; margin: 0 auto; }
.auth-logo { width: 150px; height: auto; margin-bottom: 22px; display: block; }
.auth-ic { width: 60px; height: 60px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 18px; }
.auth h1 { font-size: 30px; }
.auth .sub { color: var(--muted); margin: 6px 0 24px; }
.demo-box { margin-top: 26px; padding: 16px; border: 1.5px dashed var(--line); border-radius: var(--radius); }
.loading { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }
.spinner { width: 36px; height: 36px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.notif { display: flex; gap: 12px; padding: 14px; border-top: 1px solid var(--line); }
.notif:first-child { border-top: 0; }
.notif .ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.notif .ic.rem { background: color-mix(in srgb, var(--planned) 15%, transparent); color: var(--planned); }
.notif.unread { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 15px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }
.steps { padding-left: 20px; margin: 8px 0; }
.steps li { margin: 6px 0; }

@media (min-width: 700px) {
  .page { padding: 24px; }
  .circles { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
  .circle { width: 160px; height: 160px; }
  .circle-inner { width: 138px; height: 138px; }
  .circle-inner strong { font-size: 16.5px; }
}

/* logo that swaps for dark backgrounds */
.only-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .only-light { display: none; } :root:not([data-theme="light"]) .only-dark { display: block; } }
:root[data-theme="dark"] .only-light { display: none; }
:root[data-theme="dark"] .only-dark { display: block; }
.c-active .circle-inner .pct { color: var(--accent); }
