:root {
  color-scheme: light;
  --paper: #f0f5ff;
  --sheet: #fff;
  --ink: #24335a;
  --muted: #4f5e7e;
  --line: #d9e2f5;
  --accent: #304f9a;
  --accent-ink: #243d7d;
  --accent-soft: #e1ebff;
  --success: #376442;
  --success-soft: #e3f1dc;
  --amber: #f2e3c5;
  --amber-ink: #6a451e;
  --red: #913a32;
  --red-soft: #f6e3dc;
  --radius: 15px;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--paper);
  color: var(--ink);
  accent-color: var(--accent);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
::selection { color: var(--accent-ink); background: #d5e2ff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
main:focus, .calendar-detail:focus { outline: none; }
[hidden] { display: none !important; }
svg { flex: none; vertical-align: middle; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
button:disabled { opacity: .65; cursor: progress; }
button:disabled, a { -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { margin: 0; }
h1, h2, h3, p, ul { margin: 0; }
h1 { font-size: 2.85rem; line-height: 1.08; font-weight: 720; letter-spacing: -.037em; overflow-wrap: anywhere; }
h2 { font-size: 1.23rem; line-height: 1.25; font-weight: 695; letter-spacing: -.019em; }
h3 { font-size: 1rem; }
small, .hint { font-size: .875rem; color: var(--muted); }
summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
details[open] > summary > svg:last-child { rotate: 180deg; }
.muted, .section-note, .section-meta { color: var(--muted); }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; top: 12px; left: 12px; z-index: 6; padding: .65rem 1rem; border-radius: 8px; background: var(--sheet); }
.loading { padding: 20vh 1.5rem; text-align: center; color: var(--muted); }

.top { border-bottom: 1px solid var(--line); }
.top-inner, .main { max-width: 1144px; margin-inline: auto; padding-inline: 32px; }
.top-inner { min-height: 73px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 725; font-size: 1.07rem; letter-spacing: -.025em; width: fit-content; }
.brand img { flex: none; }
.tabs, .account, .actions { display: flex; align-items: center; gap: 7px; }
.tabs a { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 14px; min-height: 44px; border-radius: 9px; color: var(--muted); font-size: .88rem; font-weight: 630; }
.tabs a[aria-current] { color: var(--accent); background: var(--accent-soft); }
.tabs a:hover { color: var(--accent-ink); background: #e9f0ff; }
.account { justify-content: end; min-width: 0; color: var(--muted); font-size: .875rem; }
.account-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-label { font-size: .74rem; color: var(--amber-ink); background: var(--amber); padding: 2px 6px; border-radius: 4px; }
.main { padding-block: 43px 60px; }
.page-heading { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin-bottom: 24px; }
.date-line { color: var(--muted); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 9px; }
.profiles { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.profile { min-height: 44px; display: inline-flex; align-items: center; gap: 7px; padding: 5px 13px 5px 7px; border: 1px solid transparent; border-radius: 8px; background: transparent; font-weight: 650; }
.profile[aria-pressed="true"] { border-color: var(--line); background: var(--sheet); color: var(--accent); }
.profile:hover { background: var(--accent-soft); }
.avatar { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; font-size: .84rem; background: #eee0cf; color: #664227; }
.avatar-1 { background: #e2e7ee; color: #3e5069; }

.spread { display: grid; grid-template-columns: minmax(0, 1.24fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.column { display: grid; min-width: 0; gap: 18px; }
.sheet { border: 1px solid var(--line); border-radius: var(--radius); background: var(--sheet); min-width: 0; }
.section-heading, .month-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 20px 22px 14px; }
.section-meta, .section-note { font-size: .875rem; }
.section-meta { text-align: right; }
.section-note { margin: 0 22px 14px; }
.section-heading:last-child { padding-bottom: 20px; }
.empty-sheet { padding: 24px; }
.empty-sheet p { margin: .55rem 0 1rem; color: var(--muted); }
.counter { color: var(--accent); font-weight: 720; font-variant-numeric: tabular-nums; }
.badge { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .785rem; font-weight: 670; line-height: 1.2; border-radius: 6px; padding: 5px 7px; background: #eef2fb; flex: 0 0 auto; }
.badge.done, .legend-dot.done, .calendar-cell.done { color: var(--success); background: var(--success-soft); }
.badge.missed, .legend-dot.missed, .calendar-cell.missed { color: var(--red); background: var(--red-soft); }
.badge.pending, .legend-dot.pending, .calendar-cell.pending { color: var(--amber-ink); background: var(--amber); }
.badge.open, .calendar-cell.open { color: var(--accent); background: #e8efff; }

.progress-number { font-size: 2.85rem; font-weight: 730; letter-spacing: -.035em; line-height: 1; font-variant-numeric: tabular-nums; }
.progress-cells { display: flex; gap: 6px; align-items: center; }
.progress-cell { display: grid; place-items: center; border: 1px solid #abc0ac; background: #f7f8ed; border-radius: 8px; width: 40px; height: 35px; }
.progress-cell.filled { background: var(--accent); border-color: var(--accent); color: #fff; }
.progress-cell.extra { margin-left: 3px; border: 1px dashed #a4885f; color: var(--amber-ink); background: transparent; font-size: .83rem; font-weight: 720; }
.progress-cell.extra.filled { border-style: solid; background: #edc784; }
.rows { list-style: none; padding: 0 22px 10px; }
.rows > li + li { border-top: 1px solid var(--line); }
.chore, .routine-row, .pending-link { display: flex; width: 100%; gap: 12px; align-items: center; text-align: left; min-height: 55px; padding: 8px 2px; }
.chore { background: none; border: 0; border-radius: 6px; }
button.chore:hover, .pending-link:hover, .rule-edit > summary:hover { color: var(--accent); background: #f2f6ff; }
.chore strong, .routine-name strong, .pending-link strong { font-weight: 650; overflow-wrap: anywhere; }
.checkbox { flex: none; display: grid; place-items: center; width: 25px; height: 25px; border-radius: 6px; border: 1px solid #969d8c; color: transparent; }
.checked .checkbox { color: white; background: var(--success); border-color: var(--success); }
.chore small, .routine-row small, .agreement-list small, .agreement-chores small, .access-list small, .pending-link small { display: block; }
.routine-symbol { display: grid; place-items: center; color: var(--accent); width: 28px; }
.routine-name, .pending-link > span { flex: 1; min-width: 0; }
.routine-row { gap: 8px; }
.routine-row > svg:last-child { color: var(--muted); }
.rule-note { color: var(--muted); margin: 0 0 7px 38px; font-size: .875rem; overflow-wrap: anywhere; }
.exception-line { padding: 0 22px 16px; color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.subdetail { border-top: 1px solid var(--line); margin: 0 22px; }
.subdetail > summary, .editor > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 46px; color: var(--accent); font-weight: 650; }
.subdetail > summary { font-size: .875rem; }
.subdetail > button { margin-bottom: 10px; }
.inline-form { display: grid; align-items: end; gap: 10px; padding: 7px 0 14px; }
.inline-form .button { justify-self: start; }

.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 13px; border: 1px solid var(--line); background: var(--sheet); border-radius: 8px; color: var(--accent); font-weight: 650; text-align: center; }
.button:hover, .icon-button:hover { background: var(--accent-soft); }
.button.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.button.primary:hover { background: var(--accent-ink); }
.button.small { font-size: .875rem; }
.button.subtle, .icon-button.logout { background: transparent; border-color: transparent; }
.button[aria-pressed="true"] { background: var(--accent-soft); border-color: #a6bbf0; color: var(--accent-ink); }
.icon-button { width: 44px; padding: 0; flex-shrink: 0; }
.actions { flex-wrap: wrap; }
label { display: block; font-size: .875rem; font-weight: 650; }
input:not([type="checkbox"]), textarea, select { width: 100%; display: block; margin-top: 4px; border: 1px solid #acbcdf; background: #fbfdff; border-radius: 7px; min-height: 44px; padding: 7px 9px; font-size: 1rem; font-weight: 400; caret-color: var(--accent); }
textarea { resize: vertical; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { font-size: .875rem; font-weight: 650; margin-bottom: 5px; }
.stack { display: grid; gap: 14px; }
.form-error { color: var(--red); }

.reward-block { padding: 0 22px 16px; }
.reward-block.treat { padding-top: 14px; border-top: 1px solid var(--line); }
.reward-block .section-note { margin: 8px 0 0; }
.reward-title { display: flex; gap: 12px; justify-content: space-between; align-items: center; }
.reward-amount { color: var(--amber-ink); font-size: 1.08rem; font-weight: 730; }
.reward-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; margin-top: 9px; }
.week-day { display: grid; justify-items: center; padding: 4px 0; border-radius: 5px; color: var(--muted); background: #eef1fa; }
.week-day span { font-size: .75rem; }
.week-day.yes { background: var(--amber); color: var(--amber-ink); }
.treat-summary { list-style: none; padding: 7px 0 0; display: flex; gap: 6px 16px; flex-wrap: wrap; }
.treat-summary li { display: flex; gap: 5px; align-items: center; font-size: .875rem; }

.month-heading { align-items: center; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; margin: 0 22px; }
.weekday { text-align: center; color: var(--muted); font-size: .82rem; padding: 4px 0; }
.calendar-cell { min-height: 48px; display: grid; justify-items: center; align-content: start; gap: 4px; padding: 6px 1px; background: #eef1fa; border: 1px solid transparent; border-radius: 7px; font-size: .96rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.calendar-cell.unavailable { background: #f5f7fe; color: var(--muted); min-height: 44px; }
.calendar-cell:hover { border-color: var(--accent); }
.calendar-cell.current-day .cell-number { text-decoration: underline; text-underline-offset: 3px; }
.calendar-cell[aria-current] { box-shadow: inset 0 0 0 2px var(--accent); }
.cell-number { font-weight: 665; }
.day-signals { display: flex; flex-wrap: wrap; justify-content: center; width: 100%; gap: 2px 3px; }
.day-signal { position: relative; display: grid; place-items: center; width: 20px; height: 18px; border-radius: 4px; line-height: 1; color: inherit; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 13px; list-style: none; padding: 14px 22px 21px; font-size: .8rem; }
.legend li { display: flex; align-items: center; gap: 4px; }
.legend-dot { width: 13px; height: 13px; border: 1px solid var(--line); background: #eef1fa; border-radius: 4px; }
.calendar-colors { padding-bottom: 13px; }
.signal-key { font-size: .79rem; padding-block: 1px 10px; color: var(--muted); }
.detail-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 50px; }
.detail-heading p { font-size: .875rem; }

.editor > summary { min-height: 60px; padding: 12px 22px; }
.edit-form { padding: 0 22px 20px; }
#agreement-editor { scroll-margin-top: 12px; }
.chores-settings { display: grid; gap: 10px; }
.chores-settings > p { font-size: .875rem; }
.chore-editor { border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px 10px; }
.chore-editor legend { padding-inline: 4px; }
.editor-rows { display: grid; gap: 7px; }
.chore-editor-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 6px; }
.chore-editor-row textarea { margin: 0; field-sizing: content; line-height: 1.35; }
.chore-editor .add-chore { margin-top: 8px; }
.chore-editor button:disabled { cursor: default; }
.agreement-conditions { margin-inline: 0; }
.agreement-conditions > .stack { padding-bottom: 10px; }
.day-options, .time-options { display: flex; gap: 8px; flex-wrap: wrap; }
.day-options label { min-height: 44px; display: flex; gap: 4px; align-items: center; padding: 4px 6px; }
.time-options label { flex: 1 1 42%; }
.agreement-list li, .access-list li { display: flex; gap: 9px; align-items: center; padding: 9px 0; min-height: 44px; overflow-wrap: anywhere; }
.agreement-list svg { color: var(--accent); }
.agreement-chores { padding: 0 22px 12px; }
.agreement-chores ul { padding-left: 17px; margin-top: 5px; }
.access-list li { justify-content: space-between; }
.invite-result { padding: 10px 22px 18px; }
.invite-result button { margin-top: 8px; }
.entry { width: min(450px, calc(100% - 36px)); margin: 10vh auto 40px; }
.entry .brand { margin-bottom: 18px; }
.entry-sheet { padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--sheet); }
.entry h1 { font-size: 2.2rem; margin-bottom: 10px; }
.entry .stack, .entry-choices { margin-top: 20px; }
.entry .hint { margin-top: 14px; }
.entry-choices { display: grid; gap: 7px; }
.entry-choices .button { justify-content: space-between; }
.entry-choices span { font-size: .875rem; color: var(--muted); font-weight: 500; }
.notice { position: fixed; bottom: 16px; right: max(16px, env(safe-area-inset-right)); z-index: 4; max-width: min(360px, calc(100% - 32px)); padding: 10px 15px; border-radius: 8px; background: var(--accent-ink); color: white; font-size: .9rem; box-shadow: 0 5px 18px #252c221c; pointer-events: none; }
.notice.error { background: var(--red); }
.quick-feedback { display: flex; align-items: center; gap: 10px; padding-block: 3px; pointer-events: auto; }
.quick-feedback button { padding: 5px 2px; min-height: 44px; border: 0; background: none; color: #ffe99a; font-weight: 700; }
.quick-feedback button:focus-visible { outline-color: #ffe99a; outline-offset: 0; }
#notice:not([hidden]) ~ .quick-feedback:not([hidden]) { translate: 0 -57px; }

@media (max-width: 900px) {
  .top-inner, .main { padding-inline: 22px; }
  .spread { gap: 14px; grid-template-columns: minmax(0, 1.16fr) minmax(0, 1fr); }
  .day-signals { column-gap: 2px; }
  .day-signal { width: 19px; }
}

@media (max-width: 760px) {
  .top-inner { display: flex; min-height: 62px; justify-content: space-between; gap: 8px; }
  .top-inner, .main { padding-inline: max(15px, env(safe-area-inset-left)); }
  .brand { font-size: 1rem; gap: 7px; }
  .brand img { width: 33px; height: 33px; }
  .account { gap: 1px; }
  .account .demo-label { margin-right: 4px; }
  .account-name { max-width: 90px; }
  .tabs { position: fixed; z-index: 3; bottom: 0; left: 0; right: 0; justify-content: space-around; border-top: 1px solid var(--line); background: var(--paper); padding: 5px 8px max(5px, env(safe-area-inset-bottom)); }
  .tabs a { flex: 1; flex-direction: column; gap: 2px; padding: 4px 2px; min-width: 0; font-size: .74rem; }
  .main { padding-block: 23px calc(74px + env(safe-area-inset-bottom)); }
  h1 { font-size: 2.35rem; }
  .page-heading { align-items: start; flex-direction: column; gap: 12px; margin-bottom: 15px; }
  .date-line { font-size: .9rem; margin-top: 5px; gap: 8px; }
  .profile { min-height: 44px; padding-inline: 6px 12px; }
  .profiles { gap: 2px; padding: 2px; }
  .spread, .column { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .spread:not(.calendar-spread) > .column { display: contents; }
  .section-heading, .month-heading { padding: 15px 14px 11px; }
  .rows, .reward-block { padding-inline: 14px; }
  .section-note, .subdetail, .calendar-grid { margin-inline: 14px; }
  .calendar-grid { gap: 3px; }
  .day-signal { width: 17px; height: 15px; }
  .day-signal > svg { width: 13px; height: 13px; }
  .detail-heading { padding-inline: 3px; }
  .legend { padding-inline: 14px; }
  .notice { bottom: calc(62px + env(safe-area-inset-bottom)); }
}

@media (max-width: 360px) {
  .top-inner { gap: 6px; }
  .brand { gap: 6px; font-size: .94rem; }
  .account .demo-label { margin-right: 3px; padding-inline: 5px; }
  .calendar-grid { margin-inline: 7px; gap: 2px; }
  .day-signals { gap: 2px 1px; }
  .day-signal { width: 16px; height: 15px; }
  .day-signal > svg { width: 13px; height: 13px; }
}

@media (prefers-reduced-motion: no-preference) {
  button, .tabs a, .calendar-cell { transition: background-color 140ms ease, border-color 140ms ease; }
  button:active { translate: 0 1px; }
}
