/* Stage 1.5 — preview shell (desktop canvas + mobile full-bleed). App visuals come from system.css. */
*{box-sizing:border-box}
html,body{margin:0;padding:0;height:100%}
body{
  background:#EEF1F5;
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","PingFang SC","Helvetica Neue",sans-serif;
  color:#1D1D1F;
  -webkit-text-size-adjust:100%;
  overscroll-behavior:none;
}
.stage{min-height:100dvh;display:flex;align-items:center;justify-content:center;padding:28px 16px 72px}
.phone{
  position:relative;width:390px;height:844px;background:#FFFFFF;overflow:hidden;
  border-radius:34px;box-shadow:0 24px 70px rgba(16,24,40,.18),0 2px 8px rgba(16,24,40,.08);
  border:1px solid #DCE3EC;
}
#root{position:absolute;inset:0;display:flex;flex-direction:column;overflow:hidden}
/* dev bar */
.devbar{position:fixed;left:0;right:0;bottom:0;display:flex;justify-content:center;padding:10px 12px 14px;pointer-events:none}
.devbar-inner{pointer-events:auto;display:flex;align-items:center;gap:14px;background:rgba(255,255,255,.94);
  border:1px solid #E4EAF2;border-radius:999px;padding:7px 14px;box-shadow:0 4px 16px rgba(16,24,40,.08)}
.devbar-title{font-size:12px;font-weight:600;color:#5B6B80}
.devbar-actions{display:flex;gap:6px}
.devbtn{height:26px;padding:0 10px;border-radius:999px;border:1px solid #E4EAF2;background:#fff;color:#5B6B80;
  font:600 12px/1 -apple-system,"PingFang SC",sans-serif;cursor:pointer}
.devbtn.is-on{background:#0066CC;border-color:#0066CC;color:#fff}
.devbtn:active{transform:scale(.97)}
/* mobile: full-bleed, no desktop chrome */
@media (max-width: 600px), (pointer: coarse) and (max-width: 1024px), (max-height: 520px) and (max-width: 1024px){
  body{background:#FFFFFF}
  .stage{padding:0;min-height:100dvh;align-items:stretch}
  .phone{width:100%;height:100dvh;border-radius:0;border:none;box-shadow:none}
  .devbar{display:none}
}
/* route transition */
.screen{position:absolute;inset:0;display:flex;flex-direction:column;background:#FFFFFF;overflow:hidden}
.screen.is-enter{animation:screenIn 180ms cubic-bezier(.2,.8,.2,1)}
@keyframes screenIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.screen.focus-bg{background:#F5F8FD}
.scroll-area{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain}
.tabhost{flex:none}
/* sheet overlay inside the phone */
.overlay{position:absolute;inset:0;display:flex;align-items:flex-end;z-index:50}
.overlay-scrim{position:absolute;inset:0;background:rgba(15,23,42,.42);border:0;padding:0}
.overlay-panel{position:relative;width:100%;background:#fff;border-top-left-radius:18px;border-top-right-radius:18px;
  box-shadow:0 -8px 32px rgba(16,24,40,.13);max-height:92%;display:flex;flex-direction:column;
  overflow-y:auto;-webkit-overflow-scrolling:touch;
  padding-bottom:max(16px,env(safe-area-inset-bottom))}
.overlay-scroll{overflow-y:auto}
.grab{width:36px;height:5px;border-radius:999px;background:#D3DCE8;margin:8px auto 0;flex:none}
.fade-in{animation:fadeIn 160ms ease-out}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}
.toast{position:absolute;left:20px;right:20px;top:auto;bottom:100px;pointer-events:none;z-index:60;background:#1E3A5F;color:#fff;
  border-radius:12px;padding:11px 14px;font-size:13px;font-weight:600;display:flex;align-items:center;gap:10px;
  box-shadow:0 8px 24px rgba(16,24,40,.18)}
.toast .undo{pointer-events:auto;min-height:44px;margin-left:auto;color:#9DC1FF;font-weight:700;background:none;border:0;font-size:13px;padding:0}
.press{transition:opacity 120ms ease}
.press:active{opacity:.55}
@media (prefers-reduced-motion: reduce){.screen.is-enter{animation:none}.fade-in{animation:none}}
/* native-control resets for the HTML prototype (buttons/anchors that reuse app classes) */
button{font-family:inherit;color:inherit}
.row .check{padding:0;cursor:pointer;border-style:solid}
.row .textcol{cursor:pointer}
.tab{text-decoration:none}
.section-h .r{text-decoration:none;cursor:pointer}
.btn{text-decoration:none}
.fab{border:0;cursor:pointer}
:focus-visible{outline:2px solid #0066CC;outline-offset:2px}

/* keep tabbed scroll content clear of the FAB + tab bar */
.screen .scroll-area{padding-bottom:128px}
.fab{bottom:104px}

/* deterministic screenshots: don't capture mid-animation */
html.shot .fade-in,html.shot .screen.is-enter{animation:none!important;opacity:1!important}
@media (prefers-reduced-motion: reduce){.fade-in{animation:none}}

/* calm focus style for form fields (native outline is heavy on mobile Safari) */
input.field:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px rgba(0,102,204,.12)}
input.field:focus-visible{outline:none}

/* Quick Add chip selection — .ghost (later in system.css) was overriding .soft,
   so tapping 今天/明天/待规划/时长 appeared to do nothing. */
.chip{transition:background-color 120ms ease,color 120ms ease,border-color 120ms ease}
.chip:active{opacity:.62}
.chip.is-sel{background:var(--accent)!important;border-color:var(--accent)!important;color:#fff!important;font-weight:600}
.chip.is-sel .ic{color:#fff}

/* bottom sheets: keep every child inside the viewport (Safari was clipping both edges) */
.sheet-body{padding:12px 20px calc(18px + env(safe-area-inset-bottom));width:100%;box-sizing:border-box}
.field, input, select, textarea{box-sizing:border-box;max-width:100%}
.overlay-panel{width:100%;overflow-x:hidden}

/* chips can be <button> now (goal countdown, filter chips). Reset the native button chrome
   that Safari draws as a hard black ring around pill-shaped controls. */
button.chip{-webkit-appearance:none;appearance:none;border:1px solid transparent;background-clip:padding-box;font-family:inherit;line-height:inherit}
button.chip.soft{border-color:transparent}
button.chip.ghost{border-color:var(--hairline)}
button.chip.is-sel{border-color:var(--accent)}
button.chip:focus-visible{outline:2px solid var(--accent);outline-offset:2px}

/* Stage 6: the dev toolbar (width presets / reset) is not part of the product UI */
#devbar{display:none!important}

/* Safe areas and reachable controls in portrait, landscape, and browser zoom. */
.screen{padding-top:env(safe-area-inset-top)}
.tabbar{height:calc(64px + max(18px, env(safe-area-inset-bottom)));padding-bottom:max(18px, env(safe-area-inset-bottom))}
.tab{min-height:44px}
.fab{bottom:calc(84px + max(18px, env(safe-area-inset-bottom)))}
button.chip{min-height:44px;height:auto}
.mobile-focus-page{overflow-y:auto;overscroll-behavior:contain;padding-bottom:env(safe-area-inset-bottom)!important}
.mobile-focus-page>div{flex-shrink:0!important}
.mobile-focus-page>div:nth-child(2){min-height:260px!important;flex:none!important;padding-block:20px}
.mobile-focus-page .ring-wrap{width:min(300px,100%);height:auto;aspect-ratio:1;flex:none}
.mobile-focus-page .ring-wrap svg{width:100%;height:100%}
.mobile-focus-page .dur{flex-wrap:wrap}
.mobile-check-page{min-height:0;flex:1;overflow-y:auto;padding-bottom:max(20px,env(safe-area-inset-bottom))}
.mobile-check-heading{padding:24px 20px 16px;text-align:center}.mobile-check-heading h1{margin:10px 0 4px}.mobile-check-heading p{margin:0;line-height:1.5}
.mobile-complete-mark{width:48px;height:48px;background:var(--accent-soft);color:var(--accent);display:inline-flex;align-items:center;justify-content:center;border-radius:50%}
.mobile-check-content{padding:20px;background:var(--surface);border-top:1px solid var(--hairline);border-radius:18px 18px 0 0}
.mobile-check-content h2{margin:0;overflow-wrap:anywhere;min-width:0}.mobile-check-content .kv{gap:12px;align-items:start;flex-wrap:wrap}
.mobile-actual-time{display:flex;flex-direction:column;gap:4px;margin:18px 0 22px}
.mobile-check-amount{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:18px}
.mobile-resume-label{display:block;margin-top:20px}.mobile-resume-label .field{display:block;width:100%;margin-top:8px}
.mobile-check-note{line-height:1.5;margin:16px 0}.mobile-check-buttons{display:flex;flex-wrap:wrap;gap:10px;margin-top:18px}.mobile-check-buttons .btn{flex:1;min-width:120px;font-size:15px}
@media (prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;transition:none!important;animation:none!important}}

button.btn-tertiary,button.ctrl-main,button.ctrl-ghost{border:0;appearance:none}
.stepper button.b{border:0;background:var(--surface-2);font:inherit;font-size:22px;appearance:none}
.mobile-text-button{font-family:inherit;font-size:14px;font-weight:600;line-height:20px}

.mobile-detail-plan{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 0;border-bottom:1px solid var(--divider)}.mobile-detail-plan>span{min-width:0}.mobile-detail-plan>span>span{display:block;margin-top:4px}.mobile-detail-plan+div{margin-top:12px}
.mobile-detail-history{display:flex;flex-wrap:wrap;gap:6px 14px;padding:12px 0;border-bottom:1px solid var(--divider)}.mobile-detail-history>span:first-child{width:100%}
button:disabled{opacity:.5;cursor:default}.seg button[aria-pressed="true"]{background:var(--surface)!important;color:var(--accent)!important;box-shadow:var(--sh-sm)}

[data-mobile-modal]{scroll-padding:16px;outline:none}.overlay-panel :focus-visible{outline:2px solid var(--accent);outline-offset:3px}.overlay [data-dialog-close]{min-width:44px;min-height:44px}.overlay .toast{top:16px;bottom:auto;pointer-events:none}#qa-error:not(:empty){margin-top:12px;line-height:1.5}input[aria-invalid="true"]{border-color:var(--danger)}

.mobile-duration-label{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:14px;font-size:14px;color:var(--ink2)}.mobile-duration-label .field{width:92px;flex:none;text-align:center}.mobile-duration-label+p{line-height:1.5;margin:8px 0}.mobile-check-buttons .btn{height:auto;min-height:50px;padding:10px}html[lang="en"] .row .title{white-space:normal;overflow-wrap:anywhere}html[lang="en"] .dayrow .dow{width:38px}html[lang="en"] .dayrow .tag{width:76px}html[lang="en"] .mobile-next .btn{height:auto;min-height:50px;padding:10px}

.qa-more{margin-top:16px;border-top:1px solid var(--hairline)}.qa-more summary{min-height:44px;line-height:44px;font-size:14px;font-weight:500;color:var(--ink2);cursor:pointer}
.qa-save{position:sticky;bottom:0;margin-top:16px;flex:none;min-height:50px}
[data-mobile-modal="quick-add"]{max-height:calc(100dvh - 24px);scroll-padding-bottom:70px}

.mobile-settings-page{display:flex;flex-direction:column;min-height:0;flex:1;background:var(--color-subtle);padding-bottom:env(safe-area-inset-bottom)}
.settings-header{display:grid;grid-template-columns:44px 1fr 44px;align-items:center;padding:8px 16px;background:var(--surface);border-bottom:1px solid var(--hairline)}.settings-header h1{text-align:center;margin:0}.settings-header .mobile-icon-button{background:transparent}
.settings-scroll{flex:1;min-height:0;overflow:auto;padding:0 20px 24px}.settings-group{margin:24px 0 0}.settings-group h2{font-size:14px;line-height:22px;font-weight:600;margin:0 0 8px;color:var(--ink2)}
.settings-group .list-row{padding:10px 14px;min-height:54px;background:var(--surface);font-size:15px;gap:12px}.settings-group .list-row .v{display:flex;align-items:center;gap:8px;font-size:13px;min-width:0;text-align:right}
.settings-group .list-row:first-of-type{border-radius:10px 10px 0 0}.settings-group .list-row:last-of-type{border-radius:0 0 10px 10px}
.settings-action{display:flex;justify-content:space-between;width:100%;border:0;border-bottom:1px solid var(--divider);text-align:left;font:inherit;cursor:pointer}
.settings-switch-hit{margin-left:auto;display:flex;align-items:center;min-height:44px;background:none;border:0;padding:8px 0 8px 12px}
.settings-note{font-size:12px;line-height:20px;color:var(--ink3);margin:8px 0 12px}.settings-duration{padding:8px 14px;background:var(--surface);border-radius:10px 10px 0 0}.settings-duration .mobile-duration-label{margin-top:0}
.settings-danger .settings-action{color:var(--danger)}.mobile-focus-end{display:flex;justify-content:center;padding:8px 0 20px}

.settings-group [data-act="language-toggle"]{margin-left:auto}
.mobile-check-page h2,.mobile-focus-page .t-title2,.mobile-focus-page .t-title3{overflow-wrap:anywhere}

/* Floating capture remains separate from navigation and clear of the safe area. */
.screen.has-tabs .fab{bottom:calc(80px + max(18px,env(safe-area-inset-bottom)))}
.screen.has-tabs .scroll-area{padding-bottom:116px}
.screen:not(.has-tabs) .fab{bottom:max(20px,env(safe-area-inset-bottom))}
.screen:not(.has-tabs) .scroll-area{padding-bottom:104px}
.screen.has-tabs.is-enter{animation:none}.screen.has-tabs.is-enter>.scroll-area{animation:screenIn 180ms cubic-bezier(.2,.8,.2,1)}
.toast{bottom:calc(164px + max(18px,env(safe-area-inset-bottom)))}
@media(prefers-reduced-motion:reduce){.fab,.fab-label,.tab-indicator,.tab .lb,.screen.has-tabs.is-enter>.scroll-area{transition:none;animation:none}}
