/* ThemeSelector mirrors Безумно.Команда: system / sun / moon, moving capsule. */
.auth-header-actions{display:flex;align-items:center;gap:24px}
.theme-selector{--theme-button-size:40px;--theme-gap:2px;--theme-padding:4px;position:relative;isolation:isolate;display:flex;flex:none;align-items:center;gap:var(--theme-gap);padding:var(--theme-padding);border:1px solid #e4dfd8;border-radius:999px;background:#fff}
.theme-selector button{position:relative;z-index:1;display:grid;place-items:center;width:var(--theme-button-size);height:var(--theme-button-size);padding:0;border:0;border-radius:50%;background:transparent;color:#71665d;-webkit-tap-highlight-color:transparent}
.theme-selector button:hover{background:#71665d0a}
.theme-selector button[aria-pressed=true]{color:#ce4b31}

.theme-indicator{position:absolute;z-index:0;top:var(--theme-padding);left:var(--theme-padding);width:var(--theme-button-size);height:var(--theme-button-size);border:1px solid rgba(91,72,59,.2);border-radius:50%;background:linear-gradient(180deg,rgba(218,211,205,.98),rgba(235,227,220,.96)),rgba(70,56,46,.1);box-shadow:inset 0 1px 0 #fffffff5,inset 0 -1px 0 #5946392e,0 7px 18px #45302233;transform:translate3d(calc(var(--theme-index)*(var(--theme-button-size) + var(--theme-gap))),0,0);transform-origin:center;transition:transform 440ms cubic-bezier(.22,1,.36,1);pointer-events:none}
.theme-indicator:after{content:'';position:absolute;inset:5px;border-radius:inherit;background:#ffffff0f;filter:blur(8px)}
/* Appearance lives with the application settings, matching settingsThemeRow. */
.settings-theme-row{display:grid;grid-template-columns:30px minmax(0,1fr) auto;align-items:center;gap:12px;min-height:68px;padding:12px 0 20px;margin-bottom:22px;border-bottom:1px solid var(--line)}
.settings-theme-row>svg{color:var(--muted)}
.settings-theme-row>span{display:grid;gap:4px;min-width:0}
.settings-theme-row b{font-size:13px;line-height:1.4}
.settings-theme-row small{font-size:11px;line-height:1.5;color:var(--muted)}
@media(max-width:900px){.auth-header-actions{gap:12px}.auth-header-actions>.privacy-pill{display:none}.auth-header-actions .theme-selector{--theme-padding:3px;--theme-gap:0px;--theme-button-size:38px}}
@media(max-width:420px){.settings-theme-row{grid-template-columns:30px minmax(0,1fr)}.settings-theme-row>.theme-selector{grid-column:2;justify-self:start}.auth-header-actions .theme-selector{--theme-button-size:36px}}

/* Dark palette: the source app's warm charcoal surfaces, warm whites and
   orange/olive accents. No filter/inversion: dates and phase colours remain semantic. */
:root[data-theme=dark]{--bg:#11120f;--panel:#1b1c18;--ink:#f7f4ef;--muted:#b6b0a7;--line:#36382f;--accent-dark:#ffb5a2;--peach:#352522;--sage:#28301e;--rose:#342326;color-scheme:dark;scrollbar-color:#5a5c50 #1b1c18}
html,body{background:var(--bg);color:var(--ink)}
:root[data-theme=dark] ::selection{background:#833a2b;color:#fff}
:root[data-theme=dark] .theme-selector{background:#24251f;border-color:#3a3c32}
:root[data-theme=dark] .theme-selector button{color:#b6b0a7}
:root[data-theme=dark] .theme-selector button:hover{background:#ffffff08}
:root[data-theme=dark] .theme-selector button[aria-pressed=true]{color:#ea7d67}
:root[data-theme=dark] .theme-indicator{border-color:#ffffff14;background:linear-gradient(180deg,rgba(92,92,92,.62),rgba(57,57,57,.56)),#ffffff14;box-shadow:inset 0 1px 0 #ffffff2b,inset 0 -1px 0 #00000047,0 6px 16px #0000003d}
:root[data-theme=dark] :is(.secondary,.choice>span){background:#24251f;border-color:#424438;color:#d5cec4}
:root[data-theme=dark] .secondary:hover{background:#303228}
:root[data-theme=dark] .primary{background:#b33c25;color:#fff}
:root[data-theme=dark] .primary:hover{background:#a4341d}
:root[data-theme=dark] .dark-button{background:#eac3bb;color:#2a2118}
:root[data-theme=dark] .dark-button:hover{background:#f9d7d0}
:root[data-theme=dark] .danger{color:#ff9c98!important}
:root[data-theme=dark] .danger-button{background:#ae3c32;color:#fff}
:root[data-theme=dark] .icon-button:hover{background:#ffffff08}
:root[data-theme=dark] :is(.soft-label,.metric-tag,.count-label){background:#292c23;color:#c2bdad}
:root[data-theme=dark] .rose{color:#efadb6}
:root[data-theme=dark] .sage{color:#bdd694}
:root[data-theme=dark] .floating-note{background:#25261f;box-shadow:0 8px 25px #0002}
:root[data-theme=dark] .note-a{color:#e6a79b}
:root[data-theme=dark] .note-b{color:#c1d09c}
:root[data-theme=dark] .orbit{border-color:#514638}
:root[data-theme=dark] .auth-panel{box-shadow:0 16px 50px #0002}
:root[data-theme=dark] :is(.privacy-pill,.auth-foot,.auth-warning,.local-note,.divider,.password-field button){color:var(--muted)}
:root[data-theme=dark] .sidebar{background:#161713}
:root[data-theme=dark] :is(.nav-item,.breadcrumb){color:#b6b0a7}
:root[data-theme=dark] .nav-item:hover{background:#24251f}
:root[data-theme=dark] .nav-item.active{background:#35251c;color:#f0a293}
:root[data-theme=dark] .sidebar-caption{color:#a29a8c}
:root[data-theme=dark] .sidebar-bottom>small{color:#a39e92}
:root[data-theme=dark] .privacy-card{background:#252c1e}
:root[data-theme=dark] .privacy-card>svg{color:#b6cc8c}
:root[data-theme=dark] .privacy-card p{color:#bec9a8}
:root[data-theme=dark] .topbar{background:#161713c9}
:root[data-theme=dark] .breadcrumb span{color:#7a796c}
:root[data-theme=dark] .avatar{background:#423324;color:#eac3bb}
:root[data-theme=dark] .local-indicator{color:#b4c496}
:root[data-theme=dark] .page-footer{color:#aca494}
:root[data-theme=dark] .cycle-card{background:#2d231c;border-color:#4b3627}
:root[data-theme=dark] :is(.card-heading>span,.card-heading .icon-button){color:#e7b994}
:root[data-theme=dark] .phase-tag{background:#463020;border-color:#68432c;color:#f5c0b6}
:root[data-theme=dark] .cycle-copy>p{color:#cbb49d}
:root[data-theme=dark] .ring-track{stroke:#544335}
:root[data-theme=dark] .ring-period{stroke:#ef9886}
:root[data-theme=dark] .ring-fertile{stroke:#8da463}
:root[data-theme=dark] .ring-progress{stroke:#e8715a}
:root[data-theme=dark] .ring-inner{stroke:#795b40}
:root[data-theme=dark] .ring-text>strong{color:#f9d8d1}
:root[data-theme=dark] :is(.ring-text>span,.ring-text>small,.cycle-card-footer){color:#cfb49a}
:root[data-theme=dark] .cycle-card-footer{border-color:#634a344d}
:root[data-theme=dark] .dot.neutral{background:#8c7c66}
:root[data-theme=dark] .dot.dark{background:#d7d9c8}
:root[data-theme=dark] .next-card>p{color:#dca296}
:root[data-theme=dark] :is(.tiny-label,.next-info,.next-info~.text-button,.metric>div>span,.metric b small,.wellbeing>.muted,.wellbeing-footer>span,.mood-choice){color:var(--muted)}
:root[data-theme=dark] .mood-face{background:#302b22;border-color:#58503e;color:#e7c796}
:root[data-theme=dark] .face-1{background:#2c3020;color:#c4d699}
:root[data-theme=dark] .face-2{background:#302e24;color:#d5c49e}
:root[data-theme=dark] .face-3{background:#2b2d2a;color:#c6c9c1}
:root[data-theme=dark] .face-4{background:#332922;color:#e0bda5}
:root[data-theme=dark] .mood-choice:hover .mood-face,:root[data-theme=dark] .mood-choice.selected .mood-face{background:#463020;color:#f5c0b6}
:root[data-theme=dark] .care-card{background:#252c1e;border-color:#3c482e}
:root[data-theme=dark] .care-card h2{color:#e7efdb}
:root[data-theme=dark] :is(.care-card p,.care-card .text-button,.care-card .tiny-label){color:#bec9a8}
:root[data-theme=dark] .care-doodle{color:#8c9e6c}
:root[data-theme=dark] .week-day{color:var(--muted)}
:root[data-theme=dark] .week-day>b{color:#e9e2d5}
:root[data-theme=dark] .week-day:hover{background:#24251f}
:root[data-theme=dark] .week-day.current{background:#35251c}
:root[data-theme=dark] .week-day.current>b{color:#f0a293}
:root[data-theme=dark] .week-mark{color:#c7c7b5}
:root[data-theme=dark] .week-mark.period{color:#ee9786}
:root[data-theme=dark] .week-mark.fertile{color:#bdd694}
:root[data-theme=dark] :is(.calendar-weekdays,.calendar-legend,.calendar-disclaimer){color:var(--muted)}
:root[data-theme=dark] .calendar-day:hover{border-color:#8c7457}
:root[data-theme=dark] .calendar-day.outside{opacity:.5}
:root[data-theme=dark] .calendar-day.period{background:#65371f;color:#f7ccc3}
:root[data-theme=dark] .calendar-day.predicted{background:#2b211b;color:#e3a69a;border-color:#705036}
:root[data-theme=dark] .calendar-day.fertile{background:#28301e;color:#c3d993}
:root[data-theme=dark] .chip{background:#292b22;border-color:#404333;color:#cec6b0}
:root[data-theme=dark] :is(.day-summary span,.empty-day,.empty-day p,.note-preview,.diary-intro .muted,.diary-body>p,.diary-date span,.insight-metrics .card>h2 small,.cycle-bar-row>span,.cycle-bar-row>b,.period-list-row>div span){color:var(--muted)}
:root[data-theme=dark] .diary-date{background:#292c23}
:root[data-theme=dark] .diary-mood{color:#c2d59e}
:root[data-theme=dark] .diary-entry:hover{border-color:#7c684d}
:root[data-theme=dark] .diary-entry>svg,:root[data-theme=dark] .period-list-row>svg{color:#b5ad9c}
:root[data-theme=dark] .cycle-bar-track>div{background:#3a3328}
:root[data-theme=dark] .cycle-bar-track i{background:#d88270}
:root[data-theme=dark] .info-banner{background:#2b281d;border-color:#4a422d;color:#d1c3a6}
:root[data-theme=dark] form label:not(.choice),:root[data-theme=dark] legend{color:#d5cec4}
:root[data-theme=dark] input:not([type=checkbox]):not([type=radio]),:root[data-theme=dark] select,:root[data-theme=dark] textarea{background:#24251f;border-color:#484a3e;color:#f7f4ef;color-scheme:dark}
:root[data-theme=dark] input::placeholder,:root[data-theme=dark] textarea::placeholder{color:#aaa397}
:root[data-theme=dark] input[type=file]::file-selector-button{background:#3b2b20;color:#f3b4a7}
:root[data-theme=dark] .choice input:checked+span{border-color:#c87141;background:#3b2b20;color:#f3b4a8}
:root[data-theme=dark] :is(.toggle-row b,.setting-action){color:#d5cec4}
:root[data-theme=dark] :is(.toggle-row small,.version,.settings-card .micro){color:var(--muted)}
:root[data-theme=dark] .setting-action:hover{color:#f3b4a7}
:root[data-theme=dark] .switch:not(:checked){background:#56594b}
:root[data-theme=dark] .error{background:#3b2220;border-color:#82453d;color:#f6c7bd}
:root[data-theme=dark] .prose{color:#d5cec4}
:root[data-theme=dark] .modal-backdrop{--backdrop-colour:rgba(0,0,0,.68);background:var(--backdrop-colour);animation-name:dark-backdrop-in}
:root[data-theme=dark] .modal-backdrop[data-state=closing]{animation-name:dark-backdrop-out}
:root[data-theme=dark] .modal,:root[data-theme=dark] .modal.wide{background:#1b1c18;color:#f7f4ef;border-color:#3a3c32;box-shadow:0 30px 80px #0009}
:root[data-theme=dark] .sheet-origin{color:#ee927f}
:root[data-theme=dark] .sheet-close{background:#24251f;border-color:#484a3e;color:#d5cec4}
:root[data-theme=dark] .sheet-close:hover{background:#303228}
:root[data-theme=dark] .sheet-handle span{background:#77796c}
:root[data-theme=dark] .sheet-footer{background:#1b1c18;border-color:#3a3c32}
:root[data-theme=dark] .import-help{background:#262820;border-color:#424538;color:#c1bcaf}
:root[data-theme=dark] .import-help b{color:#f0e9dc}
:root[data-theme=dark] .import-stats>div{background:#24251f;border-color:#424538}
:root[data-theme=dark] .import-stats span{color:#c1bcaf}
:root[data-theme=dark] .import-periods{border-color:#424538}
:root[data-theme=dark] #toast{background:#e0e5d0;color:#20251a}
@media(max-width:900px){
 :root[data-theme=dark] .mobile-nav{background:rgba(23,24,20,.96);border-color:#3a3c32;box-shadow:0 15px 40px #0008}
 :root[data-theme=dark] .mobile-nav>button{color:#bcb6ab}
 :root[data-theme=dark] .mobile-nav>button.active{color:#ed907e}
 :root[data-theme=dark] .mobile-nav-indicator{border-color:#ffffff14;background:linear-gradient(180deg,rgba(92,92,92,.62),rgba(57,57,57,.56)),#ffffff14;box-shadow:inset 0 1px 0 #ffffff2b,inset 0 -1px 0 #00000047,0 6px 16px #0000003d}
}
@keyframes dark-backdrop-in{from{background-color:rgba(0,0,0,0)}to{background-color:rgba(0,0,0,.68)}}
@keyframes dark-backdrop-out{from{background-color:rgba(0,0,0,.68)}to{background-color:rgba(0,0,0,0)}}
@media(prefers-reduced-motion:reduce){.theme-indicator{transition:none}}
@media(max-width:900px){.auth-page{padding-top:max(25px,env(safe-area-inset-top));padding-bottom:max(40px,env(safe-area-inset-bottom))}}

/* Change the palette atomically; only the moving capsule keeps its transition. */
.theme-changing :is(button,input,select,textarea,.choice>span,.quiz-option,.phone-field,.password-field){transition:none!important}
