/* Shared light/dark surfaces and a consistent hierarchy for the mobile app. */
html,body{background:var(--bg);color:var(--text)}
body{transition:background-color .18s ease,color .18s ease}
.topbar{display:grid;grid-template-columns:44px minmax(0,1fr) auto;align-items:center;padding-inline:2px}
.topbar-title{font-size:22px;justify-self:center;white-space:nowrap;overflow:visible;overflow-wrap:normal;grid-column:2;grid-row:1}
.topbar>.icon-btn{grid-column:1;grid-row:1}
.topbar-companion{grid-column:3;grid-row:1}
.topbar.title-on-row .topbar-title{grid-column:1/-1;grid-row:2;justify-self:start;text-align:left}
.topbar-companion{display:flex;gap:1px;align-items:center}
.topbar-companion>.icon-btn{width:40px;min-width:40px;height:44px;color:var(--muted)}
.topbar-companion>.icon-btn svg{width:22px;height:22px}
.topbar-streak{font-size:16px;gap:4px;padding:0 4px}
.topbar-streak .streak-flame{width:23px;height:29px;color:var(--accent-ink)}
.bottom-nav{background:var(--surface);border-color:var(--line)}
.fab{border-radius:50%;width:50px;height:50px}
.habit-week-strip{background:var(--surface);border-radius:25px;padding:7px;gap:3px;margin-bottom:23px}
.habit-week-strip .day{border-radius:19px;min-height:78px;padding:10px 0;gap:7px}
.habit-week-strip .day.active{background:var(--text);color:var(--bg);box-shadow:none}
.habit-week-strip .day.active strong,.habit-week-strip .day.active span{color:var(--bg)}
.habit-week-strip .day.active .day-pips{opacity:.6}
.habit-week-strip .day strong{font-size:20px}
@media(min-width:900px){.habit-week-strip{max-width:740px}}
.habits-v2 .habit-card{border-radius:26px;padding:21px 18px 16px;row-gap:0}
.habits-v2 .habit-card>.icon-tile{background:color-mix(in srgb,var(--habit-color) 38%,var(--surface));color:var(--text);border:0}
.habits-v2 .habit-body h3{font-size:17px;letter-spacing:-.3px}
.habits-v2 .habit-body .habit-progress{font-size:14px}
.habit-mini-week .mini-day>span{width:30px;height:30px;background:var(--surface-3)}
.mini-day.completed>span{background:color-mix(in srgb,var(--green) 18%,var(--surface));color:var(--green)}
.mini-day .habit-progress-ring{stroke:var(--ring-track)}
.habit-progress-ring{stroke:var(--ring-track)}
.habits-v2 .habit-card>.habit-action.done .habit-action-glyph{color:var(--green)}
.habit-day-summary .progress-track{background:var(--ring-track)}
.habit-day-summary .progress-fill{background:var(--accent-graphic)}
.task-card,.column,.collection-card,.stat-card,.chart-card,.info-card,.settings-group,.companion-settings .settings-group{background:var(--surface);border-color:var(--line);color:var(--text);box-shadow:none}
.task-card .subtasks{margin-top:12px;padding-top:10px;border-top:1px solid var(--line)}
.task-card .subtasks summary{display:flex;justify-content:space-between;align-items:center;min-height:36px;font-size:12px;cursor:pointer;color:var(--muted)}
.task-card .subtasks:not([open])>.subtask{display:none!important}
.task-card .subtask{font-size:14px;min-height:44px;color:var(--text)}
.subtask input{accent-color:var(--accent)}
.habit-editor-v2 .habit-icon-preview{background:none!important;color:var(--text);border:0;border-radius:0}
.habit-editor-v2 .habit-icon-preview svg{width:30px;height:30px}
.habit-appearance-button,.habit-summary,.habit-goal-segment,.habit-editor-v2 .choice-trigger,.value-trigger,.date-trigger,.choice-trigger,.field input:not([type=checkbox]):not([type=radio]):not([type=color]),.field textarea,.field select{background:var(--control);color:var(--text);border-color:var(--line);box-shadow:none}
.habit-goal-segment button[aria-pressed=true]{background:var(--accent);color:var(--accent-contrast)}
.habit-editor-v2 .habit-appearance-button{min-height:75px;border-radius:17px}
.icon-option{color:var(--text);background:var(--surface)}
.habit-editor-v2 .habit-icon-screen,.value-picker,.date-dialog,.choice-options,.habit-editor-v2 .choice-options{background:var(--surface);color:var(--text);border-color:var(--line)}
.value-wheel{background:linear-gradient(to bottom,transparent 110px,var(--accent-soft) 110px,var(--accent-soft) 154px,transparent 154px),var(--surface-2)}
.color-picker-preview{background:var(--control)}
.value-wheel-option{color:var(--muted)}
.value-wheel-option.selected{color:var(--text)}
.date-day,.date-weekday{color:var(--text)}
.date-day.selected{color:var(--accent-contrast)}
.mode-picker{border:0;padding:0;margin:0 0 30px;min-width:0}
.mode-picker>legend{font-size:17px;font-weight:650;margin-bottom:15px}
.mode-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.mode-options label{position:relative;cursor:pointer;min-width:0}
.mode-options input{position:absolute;width:1px;height:1px;opacity:0}
.mode-options label>span{display:flex;align-items:center;align-content:center;justify-content:center;flex-wrap:wrap;gap:12px;min-width:0;height:100%;box-sizing:border-box;border:1.5px solid var(--line);border-radius:18px;padding:18px;background:var(--surface);font-size:15px;overflow-wrap:anywhere}
.mode-options b{font-size:23px;font-weight:400}
.mode-options input:checked+span{border-color:var(--accent-ink);background:var(--accent-soft)}
.mode-options input:focus-visible+span{outline:2px solid var(--accent-graphic);outline-offset:3px}
.theme-picker .theme-picker-note{margin:8px 0 16px;font-size:12px}
.theme-option-body{background:var(--surface)}
.theme-custom{background:var(--surface)}
.focus-controls{grid-template-columns:1fr;max-width:260px;width:100%;margin:0 auto}
.focus-controls .btn{min-height:50px;font-size:15px;border-radius:25px}
.focus-progress{stroke:var(--ring-track);stroke-width:8}
.focus-progress [data-timer-arc]{stroke:var(--accent-graphic)}
.focus-clock,.focus-clock>div{background:transparent;box-shadow:none}
.focus-clock>div{gap:10px}
.focus-clock [data-timer-status]{font-size:12px;color:var(--muted)}
.focus-note{color:var(--muted)}
.focus-more{margin-top:4px}
.focus-more .btn{color:var(--muted)}
.notification-sound-choice{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:15px 0;border-block:1px solid var(--line);margin:10px 0}
.notification-sound-choice>div{display:grid;gap:5px;min-width:0}
.notification-sound-choice strong{font-size:14px}
.notification-sound-choice span{color:var(--muted);font-size:12px;overflow-wrap:anywhere}
.notification-sound-choice .btn{font-size:12px;flex:none}
/* Habit details are a short dashboard, followed by history and visible actions. */
.habit-detail-dashboard{display:grid;gap:18px}
.habit-detail-dashboard .detail-hero{display:flex;align-items:center;padding:20px!important;border-radius:24px;background:var(--surface);margin:0!important}
.habit-detail-dashboard .detail-hero>.icon-tile{background:transparent!important;color:var(--habit-color);border:0}
.habit-detail-dashboard .detail-hero h2{font-size:25px!important;letter-spacing:-.6px;margin:5px 0}
.habit-detail-dashboard .detail-hero p{font-size:12px;color:var(--muted)}
.habit-detail-primary .btn{width:100%;min-height:48px;font-size:14px;border-radius:18px}
.habit-detail-actions-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.habit-detail-actions-grid .btn{display:flex;flex-direction:column;gap:7px;font-size:11px;min-height:68px;border:0;background:var(--surface);border-radius:17px;color:var(--text);padding:10px 3px}
.habit-detail-actions-grid .btn svg{width:20px;height:20px;color:var(--accent-ink)}
.habit-detail-dashboard .detail-series-link{display:flex;align-items:center;gap:12px;padding:17px 18px;border-radius:22px;background:var(--accent-soft);color:var(--text);width:100%}
.detail-series-link>div{display:grid;text-align:left;gap:3px;flex:1}
.detail-series-link strong{font-size:19px;font-weight:650}
.detail-series-link small{font-size:11px;color:var(--muted)}
.detail-series-link .streak-flame{flex:0 0 32px;width:32px;height:40px;color:var(--accent-graphic)}
.habit-detail-dashboard>.stat-card,.habit-detail-dashboard .stats-clean>.stat-card{margin:0;background:var(--surface);border:0;border-radius:24px;padding:21px}
.habit-detail-dashboard .menu-actions{display:grid;grid-template-columns:1fr;gap:8px;margin-top:8px}
.habit-detail-dashboard .menu-actions .btn{justify-content:flex-start;font-size:13px;min-height:46px;padding:12px 15px;border-color:var(--line);color:var(--muted)}
.habit-detail-dashboard .stats-clean{margin:0}
.stats-grid.stats-v2.stats-clean,.sheet .stats-grid.stats-v2.stats-clean{grid-template-columns:1fr;gap:18px}
.stats-grid.stats-v2.stats-clean>.stat-card,.stats-overview>.stat-card{background:var(--surface);border:0;border-radius:26px;padding:24px;box-shadow:none}
.stats-clean .section-title h3,.sheet .stats-clean .section-title h3{max-width:none;font-size:17px}
.stats-clean .stat-caption{font-size:12px}
.stats-clean .gauge svg path:first-child{stroke:var(--ring-track)}
.stats-clean .gauge svg path:last-child{stroke:var(--accent-graphic)}
.stats-v2.stats-clean .gauge,#modal .stats-v2.stats-clean .gauge{width:245px;margin-top:24px;display:grid;grid-template-columns:minmax(0,1fr);aspect-ratio:auto;min-height:0;gap:0}
.stats-v2.stats-clean .gauge>svg,#modal .stats-v2.stats-clean .gauge>svg{grid-area:1/1;align-self:start;width:100%;height:auto;max-height:none}
.stats-v2.stats-clean .gauge-value,#modal .stats-v2.stats-clean .gauge-value{font-size:35px;position:static;grid-area:1/1;align-self:start;padding-top:31%;top:auto;left:auto;width:100%;min-width:0;transform:none}
.stats-clean .gauge-value small{color:var(--muted);font-size:12px}
.stats-clean .stat-footnote{font-size:12px;text-align:center;color:var(--muted)}
.stats-overview{gap:18px}
.stats-clean .metric strong{color:var(--text)}
.stats-day,.history-day{background:var(--surface-3);color:var(--text);border-color:transparent}
.history-day.completed,.stats-day.completed{background:color-mix(in srgb,var(--green) 16%,var(--surface));color:var(--green)}
.history-day.partial,.stats-day.partial{background:color-mix(in srgb,var(--yellow) 16%,var(--surface));color:var(--yellow)}
.history-day.missed,.stats-day.missed{background:color-mix(in srgb,var(--danger) 14%,var(--surface));color:var(--danger)}
.history-day.skipped,.stats-day.skipped{background:var(--surface-3);color:var(--muted)}
.stats-day.future,.history-day.future{background:transparent;color:var(--faint)}
.weekly-bar-track,.bar-track{background:var(--surface-3)}
.stats-selected-day,.stat-explainer{background:transparent;border-color:var(--line)}
.stats-entry{background:transparent;color:var(--text);border-color:var(--line)}
.calendar-month,.calendar-day-header,.calendar-week,.flexible-add,.agenda-gap,.calendar-now-marker,.plan-proposal,.plan-preview-summary,.plan-draft-editor,.calendar-task-preview,.flexible-plan-row{color:var(--text)}
.calendar-task-preview,.plan-proposal,.plan-draft-editor,.plan-preview-summary{background:var(--surface);border-color:var(--line)}
.agenda-event .agenda-title,.agenda-event h3{color:var(--text)}
.calendar-month-cell,.calendar-week-day{background:var(--surface);color:var(--text)}
.calendar-week-day.selected,.calendar-month-cell.selected{background:var(--accent-soft);color:var(--text)}
.calendar-month-cell.selected strong{color:var(--accent-ink)}
.calendar-day-header,.flexible-day-header{background:var(--bg)}
.toast{background:var(--surface);color:var(--text)}
/* Animated vector flame: large where the series is the focus, small in navigation. */
.streak-flame .flame-body{transform-box:fill-box;transform-origin:center bottom}
.series-hero-flame .is-alight .flame-body,.day-celebration .flame-body{animation:flame-breathe 2.8s ease-in-out infinite}
.activity-series-summary{gap:8px;margin:0;border:0;padding:6px 0 20px}
.series-hero-flame{display:grid;place-items:center;min-height:160px;width:100%;margin-bottom:4px}
.series-hero-flame .streak-flame{width:112px;height:140px;color:var(--accent-graphic)}
.activity-series-summary>strong{font-size:64px;font-weight:750;letter-spacing:-2px;line-height:1}
.activity-series-summary>h3{font-size:20px;margin-top:2px}
.activity-series-summary>p{font-size:13px;line-height:1.6;margin-top:6px}
.activity-series-week{margin:28px 0 20px;gap:6px}
.activity-series-week span{width:36px;height:36px;border-radius:50%;background:var(--surface-3);color:var(--muted)}
.activity-series-week .completed span{background:var(--accent);color:var(--accent-contrast)}
.activity-series-week .is-missed span{background:var(--danger-soft);color:var(--danger)}
.activity-series-week .is-partial span{background:var(--yellow-soft);color:var(--yellow)}
.activity-series-week .is-skipped span{border:1px dashed var(--muted);background:transparent}
.activity-series-week .today span{outline:2px solid var(--accent-graphic);outline-offset:3px}
.activity-series-week small{font-size:11px}
.activity-series-records{padding:22px 15px;margin-top:15px;background:var(--surface);border-radius:22px}
.activity-series-records strong{font-size:27px}
.activity-series-records span{font-size:12px}
.series-today{display:grid;grid-template-columns:1fr auto;text-align:left;gap:12px;width:100%;padding:20px;border-radius:22px;background:var(--surface)}
.series-today span{font-size:13px;color:var(--muted)}
.series-today strong{font-size:14px}
.series-today .progress-track{grid-column:1/-1;height:5px;background:var(--ring-track)}
.series-today .progress-fill{background:var(--accent-graphic)}
.series-help{margin-top:0;padding:20px 2px;border-color:var(--line)}
.series-help h3{font-size:14px;color:var(--text)}
.series-help p{font-size:12px;line-height:1.8}
.streak-celebrating{overflow:hidden}
.day-celebration{position:fixed;inset:0;z-index:2000;background:var(--bg);color:var(--text);display:flex;flex-direction:column;overflow:auto;padding:calc(18px + env(safe-area-inset-top)) 24px calc(20px + env(safe-area-inset-bottom));animation:celebration-enter .3s ease-out}
.day-celebration__body{width:100%;max-width:450px;margin:auto;display:flex;align-items:center;flex-direction:column;text-align:center;gap:8px;padding:16px 0}
.celebration-eyebrow{font-size:13px;color:var(--muted);font-weight:500}
.day-celebration__flame{position:relative;display:grid;place-items:center;width:190px;height:210px;margin:12px 0;animation:flame-arrive .7s cubic-bezier(.2,.8,.3,1.15)}
.day-celebration__flame>.streak-flame{width:138px;height:175px;color:var(--accent-graphic)}
.day-celebration__count{font-size:82px;line-height:1;letter-spacing:-3px;color:var(--accent-ink);font-weight:800;animation:count-arrive .55s .15s ease-out both}
.day-celebration h2{font-size:24px;font-weight:650;margin-top:4px}
.day-celebration__message{font-size:14px;line-height:1.6;color:var(--muted);max-width:260px;margin-top:10px}
.celebration-week{display:grid;grid-template-columns:repeat(7,1fr);gap:8px;width:100%;margin:24px 0 10px}
.celebration-week>div{display:grid;justify-items:center;gap:12px}
.celebration-week small{font-size:11px;color:var(--muted)}
.celebration-week span{display:grid;place-items:center;width:34px;height:34px;border-radius:50%;background:var(--surface-3);color:var(--muted);font-size:14px}
.celebration-week .completed span{background:var(--accent);color:var(--accent-contrast)}
.celebration-encouragement{font-size:12px;color:var(--muted);line-height:1.7;margin:10px 0}
.day-celebration footer{width:100%;max-width:450px;margin:12px auto 0}
.day-celebration footer .btn{width:100%;min-height:52px;border-radius:18px;font-size:16px}
.day-celebration__flame i{position:absolute;width:7px;height:13px;border-radius:50%;background:var(--accent-ink);opacity:0;animation:flame-spark 2.3s ease-out infinite;left:var(--spark-x,20%);bottom:30%;transform:rotate(15deg)}
.day-celebration__flame i:nth-of-type(2){--spark-x:80%;animation-delay:.7s}
.day-celebration__flame i:nth-of-type(3){--spark-x:42%;animation-delay:1.3s}
.day-celebration__flame i:nth-of-type(4){--spark-x:66%;animation-delay:1.8s;width:5px;height:8px}
.day-celebration__flame i:nth-of-type(5){--spark-x:10%;animation-delay:1s;width:5px;height:8px}
@keyframes flame-breathe{0%,100%{transform:scale(1,.98) rotate(-1.5deg)}50%{transform:scale(.97,1.035) rotate(1.5deg)}}
@keyframes flame-core{0%,100%{transform:scale(.94,.96)}50%{transform:scale(1.06,1.03)}}
@keyframes flame-spark{0%{opacity:0;translate:0 0}20%{opacity:.9}100%{opacity:0;translate:0 -135px}}
@keyframes flame-arrive{from{opacity:0;transform:translateY(24px) scale(.5)}to{opacity:1;transform:none}}
@keyframes count-arrive{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
@keyframes celebration-enter{from{opacity:0}to{opacity:1}}
@media(max-width:360px){.topbar-title{font-size:20px}.topbar-companion>.icon-btn{width:36px;min-width:36px}.habit-week-strip .day{min-height:70px}.habit-week-strip .day strong{font-size:18px}.stats-grid.stats-v2.stats-clean>.stat-card,.stats-overview>.stat-card{padding:20px}.activity-series-week span{width:30px;height:30px}.celebration-week{gap:4px}.day-celebration{padding-inline:18px}.celebration-week span{width:30px;height:30px}}
@media(max-height:700px){.day-celebration__flame{height:150px;margin:0}.day-celebration__flame>.streak-flame{width:100px;height:130px}.day-celebration__count{font-size:62px}.celebration-week{margin:15px 0 5px}.day-celebration__body{gap:5px}}
@media(prefers-reduced-motion:reduce){.day-celebration,.day-celebration *,.series-hero-flame *{animation:none!important}.day-celebration__flame i{display:none}body{transition:none}}
.habit-management-title{font-size:14px;font-weight:600;margin:2px 0 12px;color:var(--muted)}
.habit-detail-dashboard .habit-detail-actions{margin:0!important}
.habit-detail-dashboard .detail-hero{width:100%}
[data-mode=light] .history-outside,[data-mode=light] .stats-weekday,[data-mode=light] .weekday-label{color:var(--faint)}
[data-mode=light] .check-btn{border-color:var(--line);background:var(--surface-2)}
[data-mode=light] .check-btn.done,[data-mode=light] .check-btn.checked{background:var(--green);color:var(--on-green)}
[data-mode=light] .settings-switch input{background:var(--toggle-off)}
[data-mode=light] .settings-switch input:checked{background:var(--accent)}

.calendar-visible-tools{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin:0 0 20px}
.calendar-visible-tools .btn{border:0;border-radius:16px;font-size:12px;padding:10px 14px;background:var(--surface);color:var(--text)}
.agenda-row-links{display:flex;gap:12px;flex-wrap:wrap;padding:4px 0}
.agenda-row-links .btn{min-height:30px;padding:3px 0;font-size:11px;color:var(--accent-ink);background:none}
/* Light surfaces keep the same hierarchy and legible neutral text. */
:root[data-mode=light] .icon-btn:not(.danger):not(.active):not(.ui-icon-control),:root[data-mode=light] .topbar .icon-btn:not(.ui-icon-control),:root[data-mode=light] .sheet-header .icon-btn:not(.ui-icon-control),:root[data-mode=light] .bottom-nav .nav-item:not(.active)>svg,:root[data-mode=light] .settings-switch svg,:root[data-mode=light] .settings-card:not(.reset-all-card) .settings-card-icon,:root[data-mode=light] .view-menu-option>svg:first-child,:root[data-mode=light] .choice-control>summary>svg,:root[data-mode=light] .date-trigger>svg{color:var(--text)}
:root[data-mode=light] .habits-v2 .habit-card>.icon-tile{color:var(--text)!important}
:root[data-mode=light] .bottom-nav .nav-item:not(.active),:root[data-mode=light] .habit-day-summary,:root[data-mode=light] .stats-v2.stats-clean .stat-caption,:root[data-mode=light] .stats-v2.stats-clean .gauge-value small,:root[data-mode=light] .stats-weekly .stat-caption{color:var(--muted)}
:root[data-mode=light] .stats-clean .metric>span{color:var(--muted)!important}
:root[data-mode=light] .stats-entry-title{color:var(--text)}
:root[data-mode=light] .stats-entry-status.partial{color:var(--yellow)}

.history-calendar .stats-day,.history-calendar .history-day{background:var(--surface-3);color:var(--text);border-color:transparent}
.history-calendar .stats-day.completed,.history-calendar .history-day.completed{background:color-mix(in srgb,var(--green) 16%,var(--surface));border-color:transparent;color:var(--green)}
.history-calendar .stats-day.partial,.history-calendar .history-day.partial{background:color-mix(in srgb,var(--yellow) 12%,var(--surface));border-color:color-mix(in srgb,var(--yellow) 60%,var(--surface));color:var(--yellow)}
.history-calendar .stats-day.missed,.history-calendar .history-day.missed{background:color-mix(in srgb,var(--danger) 10%,var(--surface));border-color:transparent;color:var(--danger)}
.history-calendar .stats-day.skipped,.history-calendar .history-day.skipped{background:var(--surface-3);border-color:transparent;color:var(--muted)}
.history-calendar .stats-day.future,.history-calendar .history-day.future,.history-calendar .stats-day.unknown,.history-calendar .history-day.unknown{background:var(--surface-2);border-color:transparent;color:var(--faint)}
.history-calendar .stats-day.selected,.history-calendar .history-day.selected{outline-color:var(--accent-graphic);outline-offset:2px}
.stats-selected-day>summary{display:flex;flex-direction:column;align-items:flex-start;gap:5px}
.stats-clean .series-link{color:var(--accent-ink);border-color:var(--line)}

.habit-detail-dashboard .detail-hero>.icon-tile{box-shadow:none!important;color:var(--accent-ink)!important}
:root[data-mode=light] .habit-detail-dashboard .detail-hero>.icon-tile{color:var(--accent-deep)!important}
:root[data-mode=light] .focus-habit>svg{color:var(--accent-deep)}
:root[data-mode=light] .habits-v2 .habit-card>.icon-tile>svg,:root[data-mode=light] .habit-detail-dashboard .detail-hero>.icon-tile>svg{color:inherit}

:root[data-mode=light] .habits-v2 .habit-body .habit-progress,:root[data-mode=light] .habits-v2 .is-complete .habit-body .habit-progress{color:var(--muted)}
.flexible-result{display:block;font-size:11px!important;min-height:32px;margin-top:3px}

/* Solid selected colours remain identical in the application and home widgets. */
.btn.primary,.btn.primary:hover,.fab,.fab:hover{border:1px solid var(--accent-graphic)}
.btn.primary,.btn.primary:hover,.fab,.fab:hover,.habit-goal-segment button[aria-pressed=true],.date-day.selected,.calendar-month-cell.selected,.activity-series-week .completed span,.celebration-week .completed span{background:var(--accent);color:var(--accent-contrast);box-shadow:none}
.theme-option-swatch{color:var(--swatch-contrast)}
.progress-fill,.habit-day-summary .progress-fill{background:var(--accent-graphic);box-shadow:none}
.bottom-nav .nav-item.active svg{filter:none}
.topbar-streak .streak-flame{color:var(--accent-graphic)}
.topbar-streak .streak-flame:not(.is-alight){opacity:1}

#app[data-view=calendar] .day-agenda .agenda-time{color:var(--text)}
#app[data-view=calendar] .day-agenda .agenda-time>span{color:var(--muted)}
#app[data-view=calendar] .day-agenda .agenda-event.is-complete .agenda-icon{background:var(--surface-3);background:color-mix(in srgb,var(--green) 14%,var(--surface));color:var(--green)}
#app[data-view=calendar] .day-agenda .agenda-event.is-complete .agenda-action{background:var(--surface-3);background:color-mix(in srgb,var(--green) 14%,var(--surface));color:var(--green)}
#app[data-view=calendar] .day-agenda .agenda-icon>svg{color:inherit}

/* Every form uses the same theme tokens, including controls inherited from
   the original dark-only screens. Keep labels readable in both modes. */
#modal .field>span:first-child,
#modal .field>label,
#modal .habit-field-note,
#modal .settings-note,
#modal .settings-card small,
#modal .statistics-help,
#modal .value-trigger.is-empty { color:var(--muted); }
#modal .field input::placeholder,
#modal .field textarea::placeholder { color:var(--muted);opacity:1; }
#modal .choice-control { background:transparent;color:var(--text); }
#modal .choice-control>summary,
#modal .habit-fixed-date { background:var(--control);color:var(--text);border-color:var(--line);box-shadow:none; }
#modal .choice-options { background:var(--surface);color:var(--text);border-color:var(--line); }
#modal .choice-options button { color:var(--text); }
#modal .choice-options button[aria-pressed=true] { background:var(--accent-soft);color:var(--accent-ink); }
#modal .habit-goal-segment button:not([aria-pressed=true]) { color:var(--muted); }
#modal .statistics-help code { color:var(--accent-ink); }
.value-picker-error,.date-picker-error { color:var(--danger); }
#modal .sheet input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not([type=color]):not([type=range]),
#modal .sheet textarea,
#modal .sheet select { background:var(--control);color:var(--text);border-color:var(--line);box-shadow:none; }
#modal .sheet input::placeholder,
#modal .sheet textarea::placeholder { color:var(--muted);opacity:1; }
#modal .habit-icon-preview,
#modal .habit-icon-preview svg { color:var(--text)!important;box-shadow:none!important;filter:none; }
#modal .choice-options button[aria-pressed=true] { color:var(--text); }

#modal .btn.ghost { color:var(--muted);background:transparent;border-color:var(--line); }
#modal .btn.ghost:hover { color:var(--text);background:var(--surface-2); }
.habit-detail-dashboard .detail-series-link small { color:var(--text); }
/* Board selectors in the original stylesheet are more specific than .column
   and .task-card. Resolve their surfaces for both appearance modes. */
.board .column,.matrix .quadrant { background:var(--surface-2);border-color:var(--line); }
.board .task-card,.matrix .task-card { background:var(--surface);color:var(--text);border-color:var(--line);box-shadow:none; }
:root[data-mode=light] .history-calendar :is(.history-day,.stats-day).completed,
:root[data-mode=light] .stats-entry-status.completed { color:var(--green); }
:root[data-mode=light] .history-calendar :is(.history-day,.stats-day).partial,
:root[data-mode=light] .stats-entry-status.partial { color:var(--yellow); }
:root[data-mode=light] .history-calendar :is(.history-day,.stats-day).missed,
:root[data-mode=light] .stats-entry-status.missed { color:var(--danger); }
.board .column-empty { color:var(--muted); }

/* Small interaction refinements, shared by both appearance modes. */
.topbar-companion {gap:10px}
.topbar-streak {flex-shrink:0}
.subtask-editor {display:grid;gap:12px;margin-top:20px;min-width:0}
.subtask-editor h4 {margin:0;font-size:15px}
.subtask-editor [data-subtask-rows] {display:grid;gap:9px}
.subtask-editor-row {display:grid;grid-template-columns:24px minmax(0,1fr) 40px;gap:6px;align-items:center}
.subtask-editor-row input {width:100%;min-width:0;min-height:46px;background:var(--control-bg);color:var(--text);border:1px solid var(--line);border-radius:14px;padding:10px 12px;font:inherit}
.subtask-step,.subtask-editor-note {color:var(--muted);font-size:12px}
.subtask-editor-note {margin:0}
.subtask-editor [data-subtask-add] {justify-self:start;display:flex;gap:8px;align-items:center}
.date-set-field [data-date-selection] {font-size:12px;line-height:1.6;color:var(--muted);overflow-wrap:anywhere}
.date-selection-caption {margin:20px 0 0;color:var(--muted);font-size:14px;text-align:center;line-height:1.5}
.stats-disclosure>summary {display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:14px;min-height:48px;list-style:none;cursor:pointer}
.stats-disclosure>summary::-webkit-details-marker {display:none}
.stats-disclosure>summary::marker {content:''}
.stat-explainer.stats-disclosure>summary::after {content:none;display:none}
.stats-disclosure>summary {color:var(--text);background:transparent}
.stats-disclosure>summary>svg {color:var(--muted)}
.stats-disclosure>summary>svg {flex-shrink:0;transition:transform .18s}
.stats-disclosure[open]>summary>svg {transform:rotate(180deg)}
.stats-tasks .stats-disclosure {margin-top:18px;border-top:1px solid var(--line);padding-top:8px}
.stats-tasks .stats-disclosure p {display:flex;align-items:center;gap:10px;overflow-wrap:anywhere}
.stats-range-controls {display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;margin-top:20px}
.stats-range-controls>.form-grid {grid-column:1/-1}
.stats-range-metrics {margin-top:24px}
.stats-range-metrics>.stats-duration {grid-column:1/-1}
.stats-range-error {color:var(--danger);font-size:14px;line-height:1.5}
@media(max-width:359px){.topbar-companion{gap:6px}.stats-range-controls{grid-template-columns:minmax(0,1fr)}}
@media(prefers-reduced-motion:reduce){.stats-disclosure>summary>svg{transition:none}}

.activity-series-week .is-frozen span{background:#69bde830;color:var(--text);border:1px solid #69bde8}.streak-protection-card{margin-top:18px;overflow-wrap:anywhere}.streak-protection-card>strong{display:block;font-size:22px;margin:10px 0}.wd-day-frozen{background:#69bde830!important;color:var(--text)}
