:root {
  --bg: #F7F1E8; --bg2: #F1E8DB; --card: #FFFCF7; --ink: #2A211C; --ink2: #5B4D44; --muted: #8E7F73; --line: #E8DCCD;
  --accent: #D2603A; --accent-deep: #B44C2A; --accent-soft: #F8E3D8;
  --off: #5E8C6C; --off-soft: #E2EDE3; --away: #6F5FA8; --away-soft: #ECE7F7;
  --radius: 22px; --shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 10px 30px -18px rgba(74,45,24,.35), 0 2px 6px -2px rgba(74,45,24,.08);
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", serif;
  --sans: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --num: ui-rounded, "SF Pro Rounded", -apple-system, "PingFang SC", system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.5; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; overscroll-behavior-y: none;
  background: radial-gradient(120% 60% at 100% 0%, #FBE6D7 0%, rgba(251,230,215,0) 55%), radial-gradient(90% 50% at 0% 100%, #EFE6F3 0%, rgba(239,230,243,0) 60%), var(--bg); background-attachment: fixed; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent-deep); }
#app { max-width: 560px; margin: 0 auto; padding: calc(var(--safe-t) + 18px) 18px calc(var(--safe-b) + 110px); }

/* view transitions */
.view { animation: viewIn .5s cubic-bezier(.2,.8,.2,1) both; }
.view.out { animation: viewOut .22s ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes viewOut { to { opacity: 0; transform: translateY(-8px); } }
.stagger > * { animation: viewIn .55s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 35ms + 60ms); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 2px 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: .02em; color: var(--ink2); font-size: 15px; }
.brand img { width: 30px; height: 30px; border-radius: 9px; box-shadow: 0 4px 10px -4px rgba(180,76,42,.5); }
.sync { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.sync::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--off); box-shadow: 0 0 0 3px rgba(94,140,108,.15); }
.sync.busy::before { background: #D9A23A; box-shadow: 0 0 0 3px rgba(217,162,58,.18); animation: pulse 1s infinite; }
.sync.err::before { background: #C4473A; }
@keyframes pulse { 50% { opacity: .35; } }
.icon-btn { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; background: rgba(255,252,247,.75); border: 1px solid var(--line); color: var(--ink2); }
.icon-btn svg { width: 20px; height: 20px; }
h1.title { font-family: var(--serif); font-weight: 800; font-size: 32px; line-height: 1.2; margin: 0 2px 6px; letter-spacing: .01em; }
.lede { color: var(--ink2); margin: 0 2px 22px; font-size: 16px; }

/* cards */
.card { background: var(--card); border: 1px solid rgba(232,220,205,.9); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.section-label { font-size: 13px; letter-spacing: .12em; color: var(--muted); margin: 26px 4px 10px; font-weight: 600; }

/* hero (his today) */
.hero { position: relative; overflow: hidden; padding: 22px 20px 20px; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, rgba(210,96,58,.16), rgba(210,96,58,0) 70%); pointer-events: none; }
.hero .eyebrow { font-size: 14px; color: var(--muted); display: flex; justify-content: space-between; }
.hero .big { font-family: var(--serif); font-size: 30px; font-weight: 800; line-height: 1.25; margin: 6px 0 4px; }
.hero .big .t { font-family: var(--num); font-weight: 700; color: var(--accent-deep); letter-spacing: -.01em; }
.hero .sub { color: var(--ink2); font-size: 16px; }
.status-line { margin-top: 14px; padding: 10px 12px; border-radius: 14px; background: var(--bg2); color: var(--ink2); font-size: 15px; display: flex; gap: 8px; align-items: center; }
.status-line b { color: var(--ink); font-family: var(--num); }
.rems { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.rem { border-radius: 16px; padding: 12px 14px; background: var(--accent-soft); color: var(--accent-deep); }
.rem.pickup { background: #E6EEF7; color: #2F5E8C; }
.rem.muted { background: var(--bg2); color: var(--muted); }
.rem .k { font-size: 13px; opacity: .85; }
.rem .v { font-family: var(--num); font-size: 26px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.rem .d { font-size: 12.5px; opacity: .8; }

/* day rows */
.days { display: flex; flex-direction: column; gap: 10px; }
.week-label { font-size: 13px; color: var(--muted); margin: 14px 6px 2px; letter-spacing: .08em; }
.day { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 18px; background: var(--card); border: 1px solid rgba(232,220,205,.9); box-shadow: 0 6px 18px -16px rgba(74,45,24,.4); width: 100%; text-align: left; transition: transform .18s ease, box-shadow .18s ease, background .2s; }
.day:active { transform: scale(.985); }
.day .date { width: 48px; flex: none; text-align: center; }
.day .date .n { font-family: var(--num); font-size: 24px; font-weight: 700; line-height: 1.05; }
.day .date .w { font-size: 12.5px; color: var(--muted); }
.day.today .date .n { color: var(--accent); }
.day .body { flex: 1; min-width: 0; }
.day .line1 { font-size: 16.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.day .line1 .time { font-family: var(--num); font-weight: 700; letter-spacing: -.01em; }
.day .line2 { font-size: 13.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day .chev { color: #C9B9A8; flex: none; }
.tag { font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 99px; letter-spacing: .02em; }
.tag.work { background: var(--accent-soft); color: var(--accent-deep); }
.tag.off { background: var(--off-soft); color: var(--off); }
.tag.away { background: var(--away-soft); color: var(--away); }
.tag.today { background: var(--ink); color: #FFF7EE; }
.day.empty { background: rgba(255,252,247,.55); border-style: dashed; box-shadow: none; }
.day.empty .line1 { color: var(--muted); font-weight: 500; }
.day.flash { animation: flash .9s ease; }
@keyframes flash { 0% { background: var(--accent-soft); } 100% { background: var(--card); } }

/* progress */
.progress { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.bar { flex: 1; height: 8px; border-radius: 99px; background: var(--bg2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #E58A62, var(--accent)); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.progress .num { font-family: var(--num); font-weight: 700; font-size: 15px; color: var(--ink2); white-space: nowrap; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 54px; padding: 0 22px; border-radius: 18px; font-weight: 600; font-size: 17px; transition: transform .15s ease, background .2s, opacity .2s; width: 100%; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: #FFF8F2; box-shadow: 0 10px 24px -12px rgba(180,76,42,.7); }
.btn.dark { background: var(--ink); color: #FFF7EE; }
.btn.ghost { background: rgba(255,252,247,.8); border: 1px solid var(--line); color: var(--ink); }
.btn.small { height: 44px; font-size: 15.5px; border-radius: 14px; padding: 0 16px; width: auto; }
.btn[disabled] { opacity: .55; }
.btn-row { display: flex; gap: 10px; }
.link-btn { color: var(--accent-deep); font-weight: 600; font-size: 15px; padding: 6px 2px; }

/* dock */
.dock { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-b) + 14px); z-index: 20; display: flex; gap: 6px; padding: 6px; border-radius: 22px; background: rgba(42,33,28,.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 14px 34px -14px rgba(42,33,28,.6); }
.dock button { color: #F3E7DA; height: 48px; padding: 0 16px; border-radius: 17px; display: flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 600; white-space: nowrap; }
.dock button svg { width: 19px; height: 19px; }
.dock button.on { background: rgba(255,247,238,.14); }

/* onboarding */
.hero-onb { padding-top: 8vh; }
.mark-big { width: 84px; height: 84px; border-radius: 26px; box-shadow: 0 18px 40px -16px rgba(180,76,42,.65); margin-bottom: 26px; }
.onb-title { font-family: var(--serif); font-weight: 800; font-size: 40px; line-height: 1.15; margin: 0 0 12px; }
.onb-title em { font-style: normal; color: var(--accent); }
.feature { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--line); }
.feature:first-child { border-top: 0; }
.feature .ic { width: 38px; height: 38px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-deep); }
.feature .ic.b { background: #E6EEF7; color: #2F5E8C; } .feature .ic.c { background: var(--off-soft); color: var(--off); }
.feature .ic svg { width: 20px; height: 20px; }
.feature b { display: block; font-size: 16.5px; } .feature span { color: var(--muted); font-size: 14.5px; }
.role-pick { display: grid; gap: 12px; margin-top: 10px; }
.role { text-align: left; padding: 18px; border-radius: 20px; background: var(--card); border: 1.5px solid var(--line); display: flex; gap: 14px; align-items: center; transition: border-color .2s, transform .15s; }
.role:active { transform: scale(.985); }
.role .em { font-size: 30px; }
.role b { display: block; font-size: 18px; } .role span { color: var(--muted); font-size: 14.5px; }

/* sheet */
.backdrop { position: fixed; inset: 0; background: rgba(42,33,28,.36); z-index: 40; opacity: 0; transition: opacity .28s ease; backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.backdrop.show { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-width: 560px; margin: 0 auto; background: var(--card); border-radius: 28px 28px 0 0; padding: 10px 20px calc(var(--safe-b) + 20px); max-height: 92dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  transform: translateY(105%); transition: transform .42s cubic-bezier(.2,.9,.2,1); box-shadow: 0 -20px 50px -20px rgba(42,33,28,.4); }
.sheet.show { transform: none; }
.grab { width: 40px; height: 5px; border-radius: 9px; background: #E2D5C6; margin: 2px auto 14px; }
.sheet h2 { font-family: var(--serif); font-size: 25px; margin: 0 0 4px; font-weight: 800; }
.sheet .hint { color: var(--muted); font-size: 14.5px; margin: 0 0 16px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--bg2); border-radius: 16px; padding: 4px; gap: 4px; margin-bottom: 16px; position: relative; }
.seg button { height: 44px; border-radius: 12px; font-weight: 600; color: var(--ink2); font-size: 16px; transition: background .2s, color .2s, box-shadow .2s; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 4px 12px -6px rgba(74,45,24,.35); }
.seg button.on[data-t="work"] { color: var(--accent-deep); } .seg button.on[data-t="off"] { color: var(--off); } .seg button.on[data-t="away"] { color: var(--away); }
.times { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin-bottom: 14px; }
.times .dash { color: var(--muted); }
.tbox { position: relative; display: block; border-radius: 18px; background: var(--bg); border: 1.5px solid var(--line); padding: 8px 14px 10px; transition: border-color .2s; }
.tbox:focus-within { border-color: var(--accent); }
.tbox small { display: block; font-size: 12.5px; color: var(--muted); }
.tbox input { width: 100%; border: 0; background: transparent; font-family: var(--num); font-size: 30px; font-weight: 700; padding: 0; outline: none; min-height: 40px; -webkit-appearance: none; appearance: none; text-align: left; }
.tbox input::-webkit-date-and-time-value { text-align: left; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { height: 38px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--bg); font-size: 14.5px; font-weight: 600; color: var(--ink2); font-family: var(--num); transition: background .15s, border-color .15s, transform .12s; }
.chip:active { transform: scale(.96); }
.chip.on { background: var(--accent-soft); border-color: #EDC3AE; color: var(--accent-deep); }
.chip.copy { font-family: var(--sans); }
.field { display: block; margin-bottom: 14px; }
.field small { display: block; font-size: 13px; color: var(--muted); margin: 0 4px 6px; }
.field input[type=text] { width: 100%; height: 50px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--bg); padding: 0 14px; font-size: 16.5px; outline: none; }
.field input[type=text]:focus { border-color: var(--accent); }
.away-note { font-size: 14px; color: var(--away); background: var(--away-soft); border-radius: 14px; padding: 10px 12px; margin-bottom: 14px; }
.off-note { font-size: 14px; color: var(--off); background: var(--off-soft); border-radius: 14px; padding: 10px 12px; margin-bottom: 14px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; margin-top: 6px; }
.sheet-foot { display: flex; justify-content: space-between; margin-top: 12px; }

/* settings */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 2px; border-top: 1px solid var(--line); }
.set-row:first-of-type { border-top: 0; }
.set-row .lbl b { display: block; font-size: 16.5px; font-weight: 600; } .set-row .lbl span { color: var(--muted); font-size: 13.5px; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: #DCCFC1; transition: background .2s; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.18); transition: transform .25s cubic-bezier(.2,.9,.2,1); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); }
.stepper { display: flex; align-items: center; gap: 4px; background: var(--bg2); border-radius: 14px; padding: 4px; flex: none; }
.stepper button { width: 38px; height: 36px; border-radius: 11px; font-size: 20px; font-weight: 600; color: var(--ink2); }
.stepper button:active { background: var(--card); }
.stepper output { min-width: 66px; text-align: center; font-family: var(--num); font-weight: 700; font-size: 16px; }
.name-input { width: 120px; height: 40px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); padding: 0 12px; text-align: right; outline: none; font-size: 16px; }

/* guide */
.guide h3 { font-size: 18px; margin: 22px 0 8px; display: flex; align-items: center; gap: 8px; }
.guide h3 .pill { font-size: 12px; background: var(--accent); color: #fff; padding: 2px 8px; border-radius: 99px; font-weight: 600; }
.guide ol { margin: 0; padding-left: 0; list-style: none; counter-reset: s; }
.guide ol li { counter-increment: s; position: relative; padding: 9px 0 9px 38px; font-size: 15.5px; color: var(--ink2); border-top: 1px dashed var(--line); }
.guide ol li:first-child { border-top: 0; }
.guide ol li::before { content: counter(s); position: absolute; left: 0; top: 9px; width: 26px; height: 26px; border-radius: 50%; background: var(--bg2); color: var(--ink); font-family: var(--num); font-weight: 700; font-size: 14px; display: grid; place-items: center; }
.guide b { color: var(--ink); }
.guide .note { font-size: 14px; color: var(--muted); background: var(--bg); border-radius: 14px; padding: 10px 12px; margin-top: 10px; }
.urlbox { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 8px 8px 8px 12px; margin: 8px 0; }
.urlbox code { flex: 1; min-width: 0; font-size: 12.5px; color: var(--ink2); word-break: break-all; font-family: ui-monospace, Menlo, monospace; }
.preview { font-family: var(--num); font-size: 15px; background: var(--ink); color: #FFF2E4; border-radius: 14px; padding: 10px 14px; white-space: pre-wrap; margin-top: 8px; min-height: 44px; }

/* banners & toast */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 18px; background: #FFF6E3; border: 1px solid #F1DDB0; color: #6B5320; font-size: 14.5px; margin-bottom: 16px; }
.banner b { color: #4B3A14; }
.banner .x { margin-left: auto; color: #A08550; font-size: 20px; line-height: 1; padding: 0 2px; }
#toast { position: fixed; left: 50%; top: calc(var(--safe-t) + 14px); transform: translate(-50%, -30px); opacity: 0; z-index: 60; background: var(--ink); color: #FFF7EE; padding: 10px 18px; border-radius: 99px; font-size: 15px; font-weight: 600; transition: transform .35s cubic-bezier(.2,.9,.2,1), opacity .25s; pointer-events: none; white-space: nowrap; }
#toast.show { transform: translate(-50%, 0); opacity: 1; }
.empty-state { text-align: center; padding: 26px 10px; color: var(--muted); }
.code { font-family: ui-monospace, Menlo, monospace; letter-spacing: .08em; font-size: 15px; color: var(--ink); }
.spacer { height: 10px; }
.btn svg { width: 20px; height: 20px; flex: none; }
.times { grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); }
.tbox { min-width: 0; overflow: hidden; }
.tbox input { font-size: 26px; min-width: 0; max-width: 100%; }
.tbox input::-webkit-calendar-picker-indicator { display: none; }
.eyebrow-small { font-size: 14px; color: var(--muted); margin: 0 2px 4px; letter-spacing: .04em; }
