/* 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;
}

/* Dock selection uses a fill and top marker, never the warm controls' outline. */
html[data-theme] nav.screen-dock [aria-current] {
  box-shadow: none !important;
}

/* Available calendar slots stay discoverable on touch screens without hovering. */
.calendar-create-actions:empty {
  display: none;
}
@media (max-width: 760px) {
  .main-shell .page-heading .calendar-create-actions .btn:only-child {
    grid-column: 2;
  }
}
html[data-theme] .week-slot[data-action^='book-slot:']:not(:disabled) > span {
  color: var(--muted);
  opacity: 0.32;
}
.week-slot:is([data-action^='book-slot:'], [data-action^='book-calendar-time:']):not(:disabled)
  > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.week-slot:is([data-action^='book-slot:'], [data-action^='book-calendar-time:']) > span > .icon {
  width: 16px;
  height: 16px;
}
.client-calendar-slot.client-slot-open > span > .icon {
  opacity: 0.8;
}
.week-slot:is([data-action^='book-slot:'], [data-action^='book-calendar-time:']):not(:disabled) {
  cursor: pointer;
}

/* Past time is a solid neutral; unavailable time uses a pattern, not colour alone. */
html[data-theme] {
  --week-elapsed-surface: #e7ebf0;
  --week-blocked-stripe: #a4afbf55;
}
html[data-theme='night'] .upcoming-session {
  --upcoming-person-ink: #8ab8f5;
}
html[data-theme='night'] .main-shell .upcoming-session-person {
  color: var(--upcoming-person-ink);
}
html[data-theme='night'] .main-shell .home-group-session .upcoming-session-person {
  color: var(--group-ink);
}
html[data-theme='night'] .main-shell .upcoming-session-content small {
  color: var(--muted);
}
html[data-theme='night'] {
  --week-elapsed-surface: #292e37;
  --week-blocked-stripe: #a4afbf30;
}
html[data-theme] #app :is(button.week-slot-past, button.client-slot-past, .week-past-dot) {
  background: var(--week-elapsed-surface) !important;
}
html[data-theme] #app :is(button.week-slot-blocked, button.client-slot-blocked, .week-blocked-dot) {
  background:
    repeating-linear-gradient(135deg, transparent 0 6px, var(--week-blocked-stripe) 6px 7px),
    var(--calendar-unavailable-bg) !important;
}
html[data-theme] #app :is(.week-day-past, .week-day-ended) {
  background: var(--week-elapsed-surface) !important;
  color: var(--ink);
  opacity: 1;
}
html[data-theme] #app .week-day-blocked {
  background:
    repeating-linear-gradient(135deg, transparent 0 6px, var(--week-blocked-stripe) 6px 7px),
    var(--calendar-unavailable-bg) !important;
  color: var(--ink);
  opacity: 1;
}
/* Coach availability uses the original solid grey, including its legend. */
html[data-theme]
  #app
  .main-shell:has(.week-slot[data-action^='book-slot:'])
  :is(.week-slot-blocked, .week-day-blocked, .week-blocked-dot) {
  background: var(--calendar-unavailable-bg) !important;
}
/* Only time cells are hatched; date tiles and existing session cards stay clear. */
html[data-theme] #app .client-calendar-inactive .week-slot {
  background:
    repeating-linear-gradient(135deg, transparent 0 6px, var(--week-blocked-stripe) 6px 7px),
    var(--calendar-unavailable-bg) !important;
  opacity: 1;
}
@media (max-width: 760px) {
  #app .week-day-heading:is(.week-day-past, .week-day-ended, .week-day-blocked) {
    gap: 0;
    padding-block: 2px;
  }
  #app .week-day-heading:is(.week-day-past, .week-day-ended, .week-day-blocked) strong {
    width: 20px;
    height: 20px;
  }
  #app .week-day-heading:is(.week-day-past, .week-day-ended, .week-day-blocked) small {
    display: block;
    font-size: 8px;
    line-height: 10px;
  }
}
.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: var(--ui-radius);
}
@media (max-width: 960px) and (max-height: 500px) {
  .sidebar .appearance-controls {
    flex: 0 0 170px;
    margin: 0;
  }
  .sidebar .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: var(--ui-radius);
}
.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: var(--ui-radius);
  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'] {
  --calendar-unavailable-bg: #292d34;
  --calendar-past-bg: #242830;
  --calendar-unavailable-border: #3b3d42;
  --calendar-available-bg: var(--night-surface);
  --calendar-available-border: var(--palette-506b87, #506b87);
  --calendar-session-bg: var(--palette-27496c, #27496c);
  --calendar-session-border: var(--palette-789abf, #789abf);
  --calendar-session-ink: #edf5ff;
  color-scheme: dark;
  --ink: #e0e9f5;
  --muted: #b7c6db;
  --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);
  --section-heading-background: linear-gradient(110deg, var(--night-raised), var(--night-surface));
}
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,
    .workspace-link 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,
    .workspace-link,
    .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:where(html:not([data-touch-input]) *)
  ) {
  background: var(--night-raised);
  color: var(--ink);
  border-color: var(--line);
}
html[data-theme='night']
  .main-shell[data-page]
  :is(.panel-heading, .workspace-fold > summary, .workspace-link) {
  background: var(--section-heading-background);
}
html[data-theme='night'] .main-shell[data-page] .workspace-fold .workspace-fold > summary,
html[data-theme='night'] .main-shell[data-page] .account-item .panel-heading {
  background: transparent;
}
html[data-theme='night']
  .main-shell
  :is(
    h1,
    h2,
    h3,
    .workspace-fold > summary strong,
    .workspace-link 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:not([multiple]) {
  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'] select[aria-expanded='true'] {
  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 15 6-6 6 6'/%3E%3C/svg%3E") !important;
}
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:where(html:not([data-touch-input]) *) {
  background: var(--palette-3a6085, #3a6085);
}
html[data-theme='night'] :is(.main-shell, dialog) .filter-choice > .filter-chip {
  background: var(--night-field);
  color: var(--muted);
  border-color: var(--line);
}
html[data-theme='night']
  :is(.main-shell, dialog)
  :is(
    .filter-chip.selected,
    .filter-choice input:checked + .filter-chip,
    .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'] :is(.main-shell, dialog) .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 !important;
}
html[data-theme='night'] .main-shell .calendar-setting-status {
  background: var(--night-raised);
  color: #a8b9cf;
}
html[data-theme='night'] .main-shell .calendar-setting-status.is-enabled {
  background: var(--palette-284360, #284360);
  color: var(--palette-c7def8, #c7def8);
}
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:where(html:not([data-touch-input]) *),
    .conversation:hover:where(html:not([data-touch-input]) *),
    .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-day-tools,
    .builder-basic-targets,
    .builder-exercise-summary:not(.builder-task-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
  .training-builder-card[open]:not(.builder-task-card)
  > .builder-exercise-summary {
  background: var(--night-raised);
  color: var(--ink);
  border-color: var(--line);
}
html[data-theme='night'] #plan-form .builder-exercise-summary .builder-basic-targets {
  background: transparent;
}
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:where(html:not([data-touch-input]) *) {
  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: var(--calendar-unavailable-bg);
}
html[data-theme='night'] .week-event {
  background: var(--calendar-session-bg);
  color: var(--calendar-session-ink);
  border-color: var(--calendar-session-border);
}
html[data-theme='night']
  :is(.main-shell, dialog, .login-card, .access-card)
  .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:where(html:not([data-touch-input]) *) {
  border-color: var(--palette-86a7ca, #86a7ca);
}
html[data-theme='night'] .main-shell .checkin-reminder.checkin-overdue {
  background: #352725;
  border-color: #795149;
  border-left-color: #d78b77;
}
html[data-theme='night'] .checkin-overdue strong {
  color: #f7d2c8;
}
html[data-theme='night'] .checkin-overdue p {
  color: #d9b8af;
}
html[data-theme='night'] .checkin-overdue > .icon {
  color: #efa591;
}
html[data-theme='night'] .main-shell .checkin-overdue > .btn {
  background: #463532;
  border-color: #a97769;
  color: #ffe9e2;
}
html[data-theme='night']
  .main-shell
  .checkin-overdue
  > .btn:hover:where(html:not([data-touch-input]) *) {
  background: #59403a;
}
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) {
  background: var(--palette-233c59, #233c59);
}
html[data-theme='night'] .month-cell.month-today {
  background: var(--calendar-available-bg);
}
html[data-theme='night'] .week-working-hours {
  background: var(--calendar-unavailable-bg);
}
html[data-theme='night'] .month-cell.month-day-off {
  background: var(--calendar-unavailable-bg);
  border-color: var(--calendar-unavailable-border);
}
html[data-theme='night'] .month-cell.month-past {
  background: var(--calendar-past-bg);
}
html[data-theme='night'] .month-cell.month-empty {
  border-color: var(--calendar-unavailable-border);
}
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:not(.client-slot-open) {
  background: transparent;
}
html[data-theme='night'] button.week-slot:disabled,
html[data-theme='night'] button.week-slot:disabled:hover:where(html:not([data-touch-input]) *) {
  background: var(--calendar-unavailable-bg);
}
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: var(--danger-soft);
  border-color: var(--danger-border);
}
html[data-theme='night'] {
  --danger: #f0a0a8;
  --danger-soft: #38232a;
  --danger-border: #7b3b47;
}
html[data-theme='night'] .danger-panel :is(h2, h3) {
  color: var(--danger);
}
html[data-theme='night'] .form-error {
  color: #ffc2b7;
}
html[data-theme='night'] .package-editor-calculation .package-calculation-saving {
  color: #b5e8cb;
}
html[data-theme='night'] .package-editor-calculation .package-calculation-warning {
  color: #f6d5a1;
}
html[data-theme='night'] .main-shell .package-test-warning {
  background: var(--night-raised);
  color: var(--ink);
}
html[data-theme='night'] .main-shell .package-notice > strong {
  color: var(--ink);
}
html[data-theme='night'] .main-shell .package-card .package-savings {
  background: #193d2e;
  color: #c3f4d8;
}
html[data-theme='night'] .preference-toggle small {
  color: var(--muted);
}

.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: var(--ui-radius);
  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;
  margin-right: 3px;
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-1.5px) rotate(45deg);
  transition: transform 0.15s ease;
}
.palette-picker[open] summary::after {
  transform: translateY(1.5px) rotate(225deg);
}
.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: var(--ui-radius);
  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: var(--ui-radius);
  background: transparent;
  color: #fff;
  text-align: left;
  font-size: 12px;
}
.palette-options button:hover:where(html:not([data-touch-input]) *),
.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(
    color-mix(in srgb, var(--palette-1877f2, #1877f2) 88%, black),
    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:where(html:not([data-touch-input]) *) {
  background: var(--primary-action-hover);
}

/* Secondary copy follows the surface's day/night token, including older account rows. */
html[data-appearance-switching] *,
html[data-appearance-switching] *::before,
html[data-appearance-switching] *::after {
  transition-duration: 0s !important;
  transition-delay: 0s !important;
}

html[data-theme]
  :is(
    .workspace-fold > summary small,
    .plan-workout > summary small,
    .workspace-link small,
    .current-plan-link small,
    .current-plan-link span,
    .client-details dt
  ) {
  color: var(--muted);
}

html[data-theme]
  #plan-form
  :is(
    .builder-section-label,
    .builder-description summary,
    .builder-options > summary,
    .builder-exercise-list-heading > span,
    .builder-linked-heading span,
    .training-builder-card[open] .builder-basic-scope
  ) {
  color: var(--muted);
}

/* A numeric notification badge must not inherit the surrounding header's ink. */
html[data-theme='day'] .main-shell .plan-card-top .tag {
  color: #24364f;
}

html[data-theme] .topbar .notification-badge {
  background: #f2f6fc !important;
  color: #14243a !important;
  border-color: #14243a !important;
}

/* A slightly cooler red avoids a copper cast while retaining readable labels. */
html[data-accent='red'][data-theme='day'] {
  --warm-ink: #320b05;
  --warm-start: #dc5e55;
  --warm-surface: #dc5e55;
  --warm-end: #d75a52;
}
html[data-accent='red'][data-theme='night'] {
  --warm-night: #442126;
  --warm-night-ink: #ffdbd5;
}

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

.sidebar-demo-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.sidebar-demo-tools .demo-switch {
  width: auto;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 6px 0;
  font-size: 11px;
}
.sidebar-demo-tools .loading-preview-trigger {
  grid-column: 2;
  min-width: 0;
  min-height: 44px;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 11px;
  text-align: right;
  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: var(--ui-radius);
  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, .profile-plan) {
  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;
}

/* More reflects Day immediately, even while it covers the workspace on mobile.
   Keep its light surfaces together so warm palettes cannot restore dark controls. */
html[data-theme='day'] #sidebar {
  --more-ink: var(--warm-ink, #24364f);
  --more-surface: color-mix(in srgb, var(--palette-075bff, #075bff) 5%, #f7f9fc);
  --more-control: #ffffff;
  --more-active: color-mix(in srgb, var(--palette-075bff, #075bff) 12%, #ffffff);
  --more-line: color-mix(in srgb, var(--more-ink) 22%, #ffffff);
  background: var(--more-surface) !important;
  color: var(--more-ink) !important;
}
html[data-theme='day'] #sidebar :is(h2, p, small, span, strong, a, button, summary, .icon) {
  color: var(--more-ink) !important;
}
html[data-theme='day'] #sidebar :is(.theme-switch, .palette-picker summary, .palette-options) {
  background: var(--more-control) !important;
  border-color: var(--more-line) !important;
}
html[data-theme='day'] #sidebar :is(.nav-link, .sidebar-close, .sidebar-logout, .user-card) {
  border-color: var(--more-line) !important;
}
html[data-theme='day'] #sidebar :is(.nav-link.active, button[aria-pressed='true']) {
  background: var(--more-active) !important;
  border-color: var(--more-line) !important;
}
html[data-theme='day'] #sidebar .nav-count {
  background: var(--more-active) !important;
  color: var(--more-ink) !important;
}
html[data-theme='day'] #sidebar :is(a, button, summary):focus-visible {
  outline-color: var(--more-ink);
}
