:root {
  color-scheme: light dark;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  --bg: #fff; --ink: #1c1c1e; --secondary: #68686d; --line: #e5e5ea;
  --accent: #c92522; --day: #80530b; --night: #5952aa; --rest: #68686d;
  --subtle: #f2f2f7; --bar: #fffffff2; --notice: #fff5df;
  background: var(--bg); color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; }
html.sheet-open { overflow: hidden; }
button, input { font: inherit; }
button { cursor: pointer; color: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { opacity: .35; cursor: default; }
button:focus-visible, input:focus-visible { outline: 3px solid #007aff; outline-offset: 2px; }
h1,h2,h3,p,dl { margin: 0; }
p { line-height: 1.5; }
svg { display: block; flex-shrink: 0; }
.app { max-width: 620px; margin: 0 auto; padding: env(safe-area-inset-top) max(16px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left)); }
.navigation-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 52px; border-bottom: .5px solid var(--line); background: var(--bar); }
.navigation-bar h1 { font-size: 17px; font-weight: 600; letter-spacing: -.3px; }
.navigation-bar > button:first-child { justify-self: start; }
.navigation-bar > button:last-child { justify-self: end; }
.text-button { min-height: 44px; padding: 0 3px; border: 0; border-radius: 6px; background: transparent; color: var(--accent); font-size: 16px; }
.status-strip { display: grid; grid-template-columns: 1fr 1fr; border-bottom: .5px solid var(--line); }
.summary-button { border: 0; background: transparent; padding: 13px 8px 14px 0; text-align: left; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.summary-button + .summary-button { padding-left: 18px; }
.caption { color: var(--secondary); font-size: 12px; }
.summary-button strong { font-weight: 600; font-size: 16px; letter-spacing: -.25px; line-height: 1.25; }
.secondary { color: var(--secondary); font-size: 13px; line-height: 1.45; }
.summary-button .secondary { font-size: 12px; }
.calendar-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 4px; padding: 18px 0 0; }
.month-picker { position: relative; display: flex; align-items: center; gap: 5px; min-height: 44px; cursor: pointer; font-size: 26px; font-weight: 700; letter-spacing: -.8px; }
.month-picker svg { width: 15px; height: 15px; color: var(--secondary); }
.month-picker input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.month-picker:focus-within { outline: 3px solid #007aff; outline-offset: 2px; border-radius: 5px; }
.calendar-controls { display: flex; flex-shrink: 0; }
.calendar-controls button { display: grid; place-items: center; border: 0; border-radius: 6px; padding: 0; background: transparent; color: var(--accent); width: 44px; height: 44px; }
.calendar-controls svg { width: 20px; height: 20px; }
.schedule-context { display: flex; justify-content: space-between; font-size: 12px; color: var(--secondary); padding: 1px 0 21px; }
#mode-title { font-weight: 500; }
.weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); }
.weekdays { text-align: center; font-size: 10px; font-weight: 500; color: var(--secondary); padding-bottom: 8px; }
.date-cell { border: 0; background: transparent; min-width: 0; min-height: 64px; border-radius: 7px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 4px 0 6px; }
.date-number { min-width: 35px; min-height: 35px; display: grid; place-items: center; border-radius: 50%; font-size: 22px; font-weight: 400; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.duty-label { font-size: 11px; color: var(--rest); line-height: 1.2; }
.day .duty-label { color: var(--day); }
.night .duty-label { color: var(--night); }
.muted .date-number { opacity: .32; }
.muted .duty-label { opacity: .5; }
.is-today .date-number { color: var(--accent); font-weight: 600; }
.selected .date-number { background: var(--ink); color: var(--bg); }
.selected.is-today .date-number { background: var(--accent); color: #fff; }
.legend { display: flex; justify-content: center; gap: 24px; padding: 15px 0 17px; color: var(--secondary); font-size: 11px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { width: 5px; height: 5px; border-radius: 50%; }
.day-dot { background: var(--day); } .night-dot { background: var(--night); } .rest-dot { background: var(--rest); }
.selected-row { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 0; border-top: .5px solid var(--line); border-bottom: .5px solid var(--line); padding: 15px 0; min-height: 70px; background: transparent; text-align: left; }
.selected-row strong { display: block; font-size: 15px; font-weight: 600; }
.selected-row span { display: block; color: var(--secondary); font-size: 13px; margin-top: 4px; }
.selected-row > svg { width: 18px; height: 18px; color: var(--secondary); }
.bottom-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; color: var(--secondary); font-size: 11px; }
.bottom-bar .text-button { font-size: 13px; min-width: 44px; text-align: right; }
dialog { width: min(480px,calc(100% - 24px)); max-height: calc(100dvh - 28px); overflow-y: auto; overscroll-behavior: contain; border: 0; border-radius: 16px; padding: 0 20px 24px; background: var(--bg); color: var(--ink); box-shadow: 0 18px 70px #0003; }
dialog::backdrop { background: #0006; }
.sheet-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 54px; border-bottom: .5px solid var(--line); margin-bottom: 22px; }
.sheet-toolbar > span { font-size: 15px; font-weight: 500; }
.sheet-toolbar .text-button { font-weight: 600; }
dialog h2 { font-size: 24px; letter-spacing: -.6px; line-height: 1.25; margin-bottom: 18px; }
dialog h3 { font-size: 16px; font-weight: 600; margin: 22px 0 7px; }
dialog p:not(.footnote):not(.error) { font-size: 14px; }
.duty-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.duty-heading h3 { font-size: 20px; margin: 0; letter-spacing: -.4px; }
.detail-symbol { color: var(--secondary); }
.detail-symbol.day { color: var(--day); }
.detail-symbol.night { color: var(--night); }
.detail-symbol svg { width: 24px; height: 24px; }
.inset-list { margin: 20px 0; background: var(--subtle); border-radius: 10px; padding: 0 14px; }
.inset-list > div { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 14px 0; min-height: 47px; font-size: 14px; }
.inset-list > div + div { border-top: .5px solid var(--line); }
dt { color: var(--secondary); }
dd { margin: 0; text-align: right; }
.notice { background: var(--notice); border-radius: 9px; padding: 13px; margin: 18px 0; font-size: 13px; }
.footnote { margin-top: 18px; font-size: 12px; line-height: 1.45; color: var(--secondary); }
.field-label, .section-label { display: block; color: var(--secondary); font-size: 13px; margin: 22px 0 9px; }
input[type=date] { display: block; width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 9px; padding: 12px; color: var(--ink); background: var(--subtle); font-size: 17px; }
.preview { border-top: .5px solid var(--line); }
.preview > div { display: flex; justify-content: space-between; padding: 10px 0; font-size: 14px; border-bottom: .5px solid var(--line); }
.preview strong { font-weight: 500; }
.preview strong.day { color: var(--day); } .preview strong.night { color: var(--night); }
.confirmation { display: flex; align-items: flex-start; gap: 11px; margin: 22px 0; font-size: 13px; line-height: 1.5; }
.confirmation input { width: 22px; height: 22px; flex-shrink: 0; margin: 0; accent-color: var(--accent); }
.primary-button { width: 100%; border: 0; border-radius: 9px; background: var(--accent); color: #fff; min-height: 48px; font-weight: 600; font-size: 16px; }
.error { margin: 12px 0; background: var(--notice); padding: 13px; font-size: 13px; border-radius: 8px; }
[hidden] { display: none!important; }
@media(max-width:620px) {
  dialog { margin: auto auto 0; width: 100%; max-height: calc(100dvh - max(20px,env(safe-area-inset-top))); border-radius: 15px 15px 0 0; padding-bottom: max(24px,env(safe-area-inset-bottom)); }
  .date-cell { min-height: 60px; }
}
@media(max-width:360px) {
  .app { padding-left: 12px; padding-right: 12px; }
  .month-picker { font-size: 22px; }
  .summary-button strong { font-size: 14px; }
  .summary-button .secondary { font-size: 11px; }
  .summary-button + .summary-button { padding-left: 10px; }
  .date-cell { min-height: 55px; }
  .date-number { min-width: 32px; min-height: 32px; font-size: 20px; }
  .duty-label { font-size: 10px; }
}
@media(min-width:621px) {
  .app { padding-top: 20px; }
  .navigation-bar { min-height: 60px; }
}
@media(prefers-color-scheme:dark) {
  :root { --bg:#000; --ink:#f2f2f7; --secondary:#a1a1a8; --line:#2c2c2e; --accent:#ff6961; --day:#e3bc75; --night:#b8b0f6; --rest:#a1a1a8; --subtle:#1c1c1e; --bar:#000000f2; --notice:#30281b; }
  .primary-button, .selected.is-today .date-number { background:#cf302b; color:#fff; }
}
@media(hover:hover) { .date-cell:hover,.summary-button:hover,.selected-row:hover { background:var(--subtle); } }
@media(prefers-reduced-motion:no-preference) { button { transition: background-color .1s; } dialog[open] { animation: sheet-in .18s ease-out; } @keyframes sheet-in { from { transform:translateY(12px); opacity:.5; } to { transform:translateY(0); opacity:1; } } }

/* Watch onboarding uses the same restrained form and navigation as the calendar. */
.onboarding { max-width: 480px; margin: 0 auto; padding: env(safe-area-inset-top) max(20px,env(safe-area-inset-right)) max(28px,env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left)); min-height: 100dvh; display: flex; flex-direction: column; }
.onboarding-navigation { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 54px; border-bottom: .5px solid var(--line); margin-bottom: 32px; }
#onboarding-back { grid-column: 1; justify-self: start; }
#onboarding-progress { grid-column: 2; font-size: 13px; color: var(--secondary); }
#onboarding-cancel { grid-column: 3; justify-self: end; }
.onboarding h1 { font-size: 28px; line-height: 1.15; letter-spacing: -.7px; margin: 0 0 12px; }
.onboarding h1:focus, .navigation-bar h1:focus { outline: none; }
#onboarding-description { font-size: 15px; margin-bottom: 26px; }
#onboarding-form { display: flex; flex-direction: column; flex: 1; }
#watch-options { border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; margin: 0; min-width: 0; }
.watch-option { display: flex; align-items: center; gap: 12px; min-height: 62px; font-size: 17px; cursor: pointer; }
.watch-option + .watch-option { border-top: .5px solid var(--line); }
.watch-option input { width: 22px; height: 22px; accent-color: var(--accent); margin-left: auto; }
.watch-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.watch-dot.red, .watch-context.red::before { background: #e13d36; }
.watch-dot.white, .watch-context.white::before { background: #fff; border: 1px solid #8e8e93; }
.watch-dot.blue, .watch-context.blue::before { background: #3478d4; }
.watch-dot.green, .watch-context.green::before { background: #349454; }
.watch-context::before { content: ''; display: inline-block; vertical-align: 0; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.onboarding-actions { margin-top: auto; padding-top: 28px; }
.onboarding-actions > button { width: 100%; }
#onboarding-demo { margin-top: 8px; font-size: 14px; }
.primary-button:disabled { opacity: .4; }
.review-watch { font-size: 17px; font-weight: 600; margin: 0 0 14px; }
.preview > div { align-items: center; min-height: 51px; }
.preview-duty { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.preview-hours { font-size: 12px; color: var(--secondary); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
