/* Day uses the original palette. Appearance controls are shared by both modes. */
html[data-theme="day"] .sidebar { background:var(--palette-102238,#102238); }
.screen-dock a, .screen-dock button, .screen-dock .icon { color:#fff; }
.appearance-controls { margin-bottom:10px; }
.palette-control { display:flex;align-items:center;gap:12px;color:#c0cede;font-size:12px; }
.palette-control select { margin:0;flex:1;min-height:44px;padding-block:8px;background-color:var(--palette-101d2e,#101d2e);color:#e4effb;border-color:#3c526c;border-radius:10px; }
@media(max-width:960px) and (max-height:500px) { .sidebar-bottom .appearance-controls { flex:0 0 170px;margin:0; }.sidebar-bottom .appearance-controls .theme-switch { margin-bottom:6px; } }
.theme-switch { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px;padding:4px;margin-bottom:10px;background:var(--palette-101d2e,#101d2e);border:1px solid #3c526c;border-radius:12px; }
.theme-switch button { display:flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:7px 10px;background:transparent;border:1px solid transparent;border-radius:8px;color:#c0cede;font-size:13px;font-weight:700; }
.theme-switch button[aria-pressed="true"] { background:var(--palette-2b4768,#2b4768);border-color:#607e9f;color:#fff; }
.theme-switch button:focus-visible { outline:2px solid var(--palette-a3ccf5,#a3ccf5);outline-offset:1px; }
.theme-switch button span { font-size:19px;line-height:1; }
@media(max-width:960px) and (max-height:500px) { .sidebar-bottom .theme-switch { flex:0 0 160px;margin-bottom:0; } }

html[data-theme="night"] {
  color-scheme:dark;
  --ink:#e0e9f5;--muted:#a8b9cf;--line:#3b3d42;--paper:var(--night-background);--white:var(--night-surface);
  --navy:var(--palette-b4d3f4,#b4d3f4);--navy-deep:var(--palette-8fb9e5,#8fb9e5);--sky:var(--palette-9dc6f0,#9dc6f0);--sky-soft:var(--palette-20354d,#20354d);
  --night-background:color-mix(in srgb,#121315 96%,var(--palette-075bff,#075bff));
  --night-surface:color-mix(in srgb,#1e2023 94%,var(--palette-075bff,#075bff));
  --night-raised:color-mix(in srgb,#292b2f 93%,var(--palette-075bff,#075bff));
  --night-field:color-mix(in srgb,#17191c 95%,var(--palette-075bff,#075bff));
  --night-navigation:color-mix(in srgb,#1a1c1f 91%,var(--palette-075bff,#075bff));
  background:var(--night-background);color:#e0e9f5;
}
html[data-theme="night"] body,
html[data-theme="night"] .main-shell,
html[data-theme="night"] .page-content { background:var(--night-background);color:var(--ink); }
html[data-theme="night"] .main-shell { --workspace-muted:#a8b9cf;--workspace-ink:#e0e9f5;--workspace-paper:var(--night-background);--workspace-line:var(--line); }
html[data-theme="night"] .main-shell :is(p,small,span,label,legend) { color:inherit; }
html[data-theme="night"] .main-shell :is(.stat-card > span,.stat-detail,.plan-label,.workspace-fold small,.activity-list span) { color:#a8b9cf; }
html[data-theme="night"] .main-shell :is(.panel,.stat-card,.plan-card,.profile-plan,.training-workout-card,.notification-card,.calendar-day,.availability-notice,.client-review-panel,.checkin-reminder,.checkin-summary,.client-schedule,.nutrition-home,.nutrition-water-card,.nutrition-method) { background:var(--night-surface);color:var(--ink);border-color:var(--line);box-shadow:0 4px 16px #00000018; }
html[data-theme="night"] .main-shell :is(.panel-heading,.workspace-fold > summary,.current-plan-link,.attention-strip,.next-step-panel,.agenda-working-hours,.client-schedule > .schedule-card,.notification-unread,.booking-request-notice,.booking-request-panel,.availability-day,.availability-time-off,.plan-workout[open] > summary,.plan-workout > summary:hover) { background:var(--night-raised);color:var(--ink);border-color:var(--line); }
html[data-theme="night"] .main-shell :is(h1,h2,h3,.workspace-fold > summary strong,.plan-card h2,.profile-plan h2,.stat-card > strong,.booking-time strong,.nutrition-home-values b,.nutrition-profile-calories strong,.nutrition-profile-macros dd) { color:#eaf2ff; }
html[data-theme="night"] :is(.main-shell,dialog,.login-card,.access-card) :is(.fine-print,.muted,.optional,.modal-description,.page-heading p,.stat-card small,.stat-card p,.stat-label,.coach-note-preview,.notification-help,.notification-time,.notification-card p,.client-review-filter p,.nutrition-home small,.nutrition-home-values em,.nutrition-water-total > span,.nutrition-method p,.nutrition-profile-calories > span,.nutrition-profile-macros dt,.nutrition-profile-macros dd span) { color:#a8b9cf; }
html[data-theme="night"] :is(.main-shell,dialog,.login-card,.access-card) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),select,textarea) { background-color:var(--night-field);color:#e7effa;border-color:#4b627c; }
html[data-theme="night"] :is(input,textarea)::placeholder { color:#9eb0c7; }
html[data-theme="night"] :is(input,textarea,select):focus { border-color:var(--palette-90b8df,#90b8df);box-shadow:0 0 0 3px var(--palette-90b8df20,#90b8df20); }
html[data-theme="night"] select { background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23c1d7ef' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
html[data-theme="night"] :is(.main-shell,dialog,.login-card,.access-card) :is(.btn-primary,.btn-dark) { background:var(--palette-315c86,#315c86);color:#fff;border-color:#6489af;box-shadow:none; }
html[data-theme="night"] :is(.main-shell,dialog,.login-card,.access-card) :is(.btn-secondary,.filter-chip,.self-booking-slot,.booking-date-grid button,.action-menu-items .btn,.action-menu-items .text-link) { background:var(--palette-20354d,#20354d);color:#d9e9fc;border-color:#4b627c;box-shadow:none; }
html[data-theme="night"] :is(.main-shell,dialog) :is(.btn-primary,.btn-dark,.btn-secondary):hover { background:var(--palette-3a6085,#3a6085); }
html[data-theme="night"] :is(.main-shell,dialog) :is(.filter-chip.selected,.self-booking-slot[aria-pressed="true"],.booking-date-grid button[aria-pressed="true"]:not(:disabled)) { background:var(--palette-355777,#355777);color:#fff;border-color:var(--palette-88aaca,#88aaca); }
html[data-theme="night"] :is(.section-tabs,.calendar-view-toggle,.client-filter-tabs,.screen-tab-picker,.search-field) { background:var(--night-field);border-color:var(--line); }
html[data-theme="night"] .main-shell .section-tabs { background:var(--night-field);border-color:var(--line); }
html[data-theme="night"] .main-shell .section-tabs button { color:#afc3dd; }
html[data-theme="night"] :is(.section-tabs button[aria-selected="true"],.calendar-view-toggle button[aria-pressed="true"]) { background:var(--palette-355777,#355777);color:#fff; }
html[data-theme="night"] :is(.tag-blue,.schedule-status,.plan-card-icon,.nutrition-home-icon,.coach-specialties span) { background:var(--palette-284360,#284360);color:var(--palette-c7def8,#c7def8);border-color:#506b87; }
html[data-theme="night"] .main-shell .plan-card-top .tag { background:var(--palette-284360,#284360);color:var(--palette-c7def8,#c7def8);border-color:#506b87; }
html[data-theme="night"] :is(.main-shell,#modal) :is(.tag,.empty-icon) { background:var(--palette-284360,#284360);color:var(--palette-c7def8,#c7def8);border-color:#506b87; }
html[data-theme="night"] :is(.status-overdue,.availability-warning) { background:#443524;color:#f6d5a1; }
html[data-theme="night"] :is(.text-link,.back-link,.eyebrow,.conversation-profile,.self-booking-selection) { color:var(--palette-adcff4,#adcff4); }
html[data-theme="night"] :is(th,td,.booking-card,.notebook-entry,.nutrition-water-entry,.nutrition-water-history,.client-row,.exercise-row,.plan-workout,.workspace-fold,.page-footer) { border-color:var(--line); }
html[data-theme="night"] :is(thead,th,.table-header) { background:var(--night-raised);color:var(--palette-b8cce5,#b8cce5); }
html[data-theme="night"] :is(tbody tr:hover,.conversation:hover,.conversation.selected) { background:var(--palette-243b56,#243b56); }
html[data-theme="night"] :is(.conversation-list,.message-thread,.message-composer,.message-header,.action-menu-items,.notebook-entry,.booking-date-picker,.booking-date-picker > summary) { background:var(--night-surface);color:var(--ink);border-color:var(--line); }
html[data-theme="night"] .message-bubble.incoming { background:var(--night-raised);color:#e7effa;border-color:#435871; }
html[data-theme="night"] .message-bubble.outgoing { background:var(--navigation-surface,var(--palette-315579,#315579));color:#fff; }
html[data-theme="night"] dialog { background:var(--night-surface);color:var(--ink);border-color:#4b627c;box-shadow:0 20px 70px #00000080; }
html[data-theme="night"] #modal { background:var(--night-surface);color:var(--ink);border-color:#4b627c; }
html[data-theme="night"] #modal :is(label,legend,h2,h3) { color:#e7effa; }
html[data-theme="night"] #modal :is(.modal-description,.fine-print,.optional) { color:#a8b9cf; }
html[data-theme="night"] dialog::backdrop { background:#020813ba; }
html[data-theme="night"] dialog .modal-header { background:var(--night-raised);color:#edf4ff;border-color:#496783; }
html[data-theme="night"] :is(.notebook-context,.notebook-meta,.notebook-empty,.notebook-task small) { color:#aec1da; }
html[data-theme="night"] .notebook-task { background:var(--night-raised);border-color:#4b6581;color:#e1edfc; }
html[data-theme="night"] #plan-form :is(.builder-plan-info,.builder-day-tools,.builder-basic-targets,.builder-exercise-summary) { background:var(--night-raised);color:#e0e9f5;border-color:#415873; }
html[data-theme="night"] #plan-form .training-builder-card { background:var(--night-surface);color:#e0e9f5;border-color:#415873; }
html[data-theme="night"] #plan-form .builder-tabs .filter-chip { background:var(--palette-20354d,#20354d);color:var(--palette-c6d9ef,#c6d9ef);border-color:#4b627c; }
html[data-theme="night"] #plan-form .builder-tabs .filter-chip.selected { background:linear-gradient(115deg,var(--palette-13283f,#13283f),var(--palette-355777,#355777));color:#fff;border-color:#7999ba; }
html[data-theme="night"] #plan-form :is(.builder-section-label,.builder-description summary,.builder-options > summary,.builder-search-options > summary,.builder-section-heading small,.builder-exercise-summary small,.builder-target-details > summary) { color:var(--palette-b3c9e2,#b3c9e2); }
html[data-theme="night"] #plan-form .builder-exercise-list-heading > span { color:var(--palette-b3c9e2,#b3c9e2); }
html[data-theme="night"] #plan-form .builder-workout-section > [data-action="builder-add-exercise"] { background:var(--palette-20354d,#20354d);color:var(--palette-c6d9ef,#c6d9ef);border-color:#6f8dab; }
html[data-theme="night"] :is(.login-form-area,.login-card,.access-card,.demo-access,.coach-public) { background:var(--night-surface);color:var(--ink);border-color:var(--line); }
html[data-theme="night"] :is(.week-calendar,.week-axis,.week-day-heading,.week-axis-heading,.week-day-column,.week-hour-label,.month-grid,.month-day,.month-weekday,.calendar-day) { background:var(--night-surface);color:#dbe8fa;border-color:#34465e; }
html[data-theme="night"] .week-slot { background:var(--night-surface);border-color:#34465e; }
html[data-theme="night"] .week-slot:hover { background:var(--palette-28415e,#28415e); }
html[data-theme="night"] :is(.week-day-today,.week-day-today .week-slot,.calendar-day-today,.month-today) { background:var(--palette-233c59,#233c59); }
html[data-theme="night"] :is(.week-unavailable,.week-time-off,.week-slot-unavailable) { background:#482633; }
html[data-theme="night"] .week-event { background:var(--palette-27496c,#27496c);color:#edf5ff;border-color:var(--palette-789abf,#789abf); }
html[data-theme="night"] .booking-date-grid button:disabled { background:var(--night-surface);color:#73859b;border-color:transparent; }
html[data-theme="night"] .coach-workload-track progress,
html[data-theme="night"] .coach-workload-track progress::-webkit-progress-bar { background:var(--palette-2a405b,#2a405b); }
html[data-theme="night"] .statistics-followups a { background:var(--night-raised);border-color:#415873; }
html[data-theme="night"] .nutrition-profile-summary:hover { border-color:var(--palette-86a7ca,#86a7ca); }
html[data-theme="night"] :is(.week-column-headings,.week-time-axis,.month-cell,.month-heading,.month-weekdays,.builder-set-targets fieldset,.app-invite-preview,.exercise-card,.intake-answer,.intake-section,.coached-start-preview) { background:var(--night-surface);color:#e0e9f5;border-color:#34465e; }
html[data-theme="night"] .week-timeline-scroll { background:var(--night-surface);border-color:#34465e; }
html[data-theme="night"] :is(.week-today-column,.week-day-heading-today,.month-cell.month-today) { background:var(--palette-233c59,#233c59); }
html[data-theme="night"] .week-working-hours { background:#482633; }
html[data-theme="night"] .week-available-band { background:var(--night-surface); }
html[data-theme="night"] .week-today-column .week-available-band { background:var(--palette-233c59,#233c59); }
html[data-theme="night"] .week-slot { background:transparent; }
html[data-theme="night"] .week-day-heading-today strong { background:var(--palette-355777,#355777);color:#fff; }
html[data-theme="night"] .month-today .month-date { background:var(--palette-355777,#355777);color:#fff; }
html[data-theme="night"] .week-closed-dot { background:#8c4658; }
html[data-theme="night"] :is(.avatar,.stat-icon,.notification-icon,.conversation-all .avatar) { background:var(--palette-2b4563,#2b4563);color:#dcecff; }
html[data-theme="night"] .main-shell .stat-card .stat-icon { background:var(--palette-2b4563,#2b4563);color:var(--palette-c5dcf6,#c5dcf6); }
html[data-theme="night"] #toast { background:var(--palette-274461,#274461);color:#fff; }
html[data-theme="night"] .access-layout { background:radial-gradient(ellipse at top left,var(--palette-203752,#203752),#0b1422 65%); }
html[data-theme="night"] .danger-panel { background:#35282c;border-color:#785055; }
html[data-theme="night"] :is(.form-error,.danger-panel h3,.danger-panel h2) { color:#ffc2b7; }

.palette-picker { position:relative;flex:1;min-width:0; }
.palette-picker summary { display:flex;align-items:center;min-height:44px;padding:8px 12px;border:1px solid #3c526c;border-radius:10px;background:var(--palette-101d2e,#101d2e);color:#e4effb;cursor:pointer;list-style:none; }
.palette-picker summary::-webkit-details-marker { display:none; }
.palette-picker summary::after { content:'⌄';margin-left:auto; }
.colour-swatch { display:inline-block;width:16px;height:16px;flex:0 0 16px;border-radius:50%;background:var(--swatch);box-shadow:inset 0 0 0 1px #ffffff40; }
.palette-current { display:none;align-items:center;gap:10px; }
.palette-options { position:absolute;bottom:calc(100% + 6px);left:0;right:0;max-height:min(420px,60vh);overflow:auto;z-index:10;padding:5px;background:var(--navigation-surface,var(--palette-102238,#102238));border:1px solid #ffffff35;border-radius:10px;box-shadow:0 8px 24px #0005; }
.palette-options button { display:flex;align-items:center;gap:10px;width:100%;min-height:44px;padding:9px 12px;border:0;border-radius:7px;background:transparent;color:#fff;text-align:left;font-size:12px; }
.palette-options button:hover,.palette-options button[aria-pressed="true"] { background:#ffffff18; }
.palette-options button[aria-pressed="true"]::after { content:'✓';margin-left:auto; }
.palette-picker summary:focus-visible,.palette-options button:focus-visible { outline:2px solid #fff;outline-offset:2px; }
html[data-accent="blue"] [data-colour-preview="blue"] { display:flex; }
html[data-accent="green"] [data-colour-preview="green"] { display:flex; }
html[data-accent="gold"] [data-colour-preview="gold"] { display:flex; }
html[data-accent="orange"] [data-colour-preview="orange"] { display:flex; }
html[data-accent="red"] [data-colour-preview="red"] { display:flex; }
html[data-accent="pink"] [data-colour-preview="pink"] { display:flex; }
html[data-accent="salmon"] [data-colour-preview="salmon"] { display:flex; }
html[data-accent="purple"] [data-colour-preview="purple"] { display:flex; }
html[data-accent="slate"] [data-colour-preview="slate"] { display:flex; }

/* Swatches use stylesheet rules so they work with the app content security policy. */
.colour-swatch.swatch-075bff { background:#075bff; }
.colour-swatch.swatch-007c34 { background:#007c34; }
.colour-swatch.swatch-edc00c { background:#edc00c; }
.colour-swatch.swatch-ff8228 { background:#ff8228; }
.colour-swatch.swatch-ef3838 { background:#ef3838; }
.colour-swatch.swatch-ed72b0 { background:#ed72b0; }
.colour-swatch.swatch-f48f7a { background:#f48f7a; }
.colour-swatch.swatch-a100fe { background:#a100fe; }
.colour-swatch.swatch-5a6d87 { background:#5a6d87; }

/* Standard filled actions and selected view tabs share the Book session palette. */
:root {
  --primary-action-fill:linear-gradient(var(--palette-1877f2,#1877f2),var(--palette-075be5,#075be5));
  --primary-action-border:var(--palette-075be5,#075be5);
  --primary-action-hover:var(--palette-0755d6,#0755d6);
}
html .main-shell[data-page] :is(.section-tabs button[aria-selected="true"],.calendar-view-toggle button[aria-pressed="true"]) {
  background:var(--primary-action-fill);
  color:#fff;
  box-shadow:0 3px 8px var(--palette-075bff22,#075bff22),inset 0 1px 0 #ffffff26;
}
html .main-shell[data-page] :is(.section-tabs button[aria-selected="true"],.calendar-view-toggle button[aria-pressed="true"]):hover { background:var(--primary-action-hover); }

/* Compact appearance choices share one row in More. */
.sidebar-bottom .appearance-controls { display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px;align-items:center; }
.sidebar-bottom .appearance-controls .theme-switch { margin:0;gap:2px;padding:3px;min-width:0; }
.sidebar-bottom .appearance-controls .theme-switch button { min-height:36px;padding:5px 4px;gap:4px;font-size:11px; }
.sidebar-bottom .appearance-controls .theme-switch button span { font-size:15px; }
.sidebar-bottom .appearance-controls .palette-control { min-width:0;gap:0; }
.sidebar-bottom .appearance-controls .palette-control > span { display:none; }
.sidebar-bottom .appearance-controls .palette-picker summary { min-height:44px;padding:7px 9px;font-size:11px; }
.sidebar-bottom .appearance-controls .palette-current { gap:6px; }
.sidebar-bottom .appearance-controls .colour-swatch { width:13px;height:13px;flex-basis:13px; }
.sidebar-bottom .appearance-controls .palette-options { min-width:140px;left:auto;right:0; }
@media(max-width:960px) and (max-height:500px) {
  .sidebar-bottom .appearance-controls { flex:0 0 280px; }
}

.sidebar-bottom .appearance-controls .loading-preview-trigger { grid-column:1 / -1;justify-self:start;padding:4px 0;border:0;background:transparent;color:#dbe5ef;font-size:11px;text-decoration:underline;text-underline-offset:3px;cursor:pointer; }
.loading-preview { position:fixed;inset:0;width:100vw;max-width:none;height:100dvh;max-height:none;margin:0;padding:0;border:0;border-radius:0; }
.loading-preview .boot-screen { position:relative;width:100%;height:100%;min-height:100%; }
.loading-preview-close { position:absolute;top:max(16px,env(safe-area-inset-top));right:max(16px,env(safe-area-inset-right));margin:0; }
.loading-preview-close button { display:grid;place-items:center;width:44px;height:44px;padding:0;background:#ffffff14;border:1px solid #ffffff50;border-radius:10px;color:#fff;font-size:28px;cursor:pointer; }
.loading-preview-close button:focus-visible { outline:2px solid #fff;outline-offset:3px; }

html[data-theme="night"] .main-shell :is(.profile-heading,.next-workout-card,.coached-start-preview) { background:linear-gradient(120deg,var(--night-surface),var(--night-raised)); }
html[data-theme="night"] #workout-form :is(.training-exercise,.session-summary) { background:var(--night-surface); }

/* Plain headings and weekday labels belong to the page, without separate background strips. */
html[data-theme="night"] .main-shell .page-heading { background:transparent; }
html[data-theme="night"] .main-shell :is(.month-weekdays,.month-weekday) { background:transparent; }
