/* ── Settings ── */
.settings-section {
  margin-bottom: 18px;
}
.settings-section-primary {
  margin-top: 2px;
}
.settings-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 2px 9px;
}
.settings-section-head .section-label {
  margin: 0 0 4px;
}
.settings-card,
.settings-group {
  background: var(--material-raised);
  border: 1px solid var(--separator-soft);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius);
  overflow: hidden;
}
body:not(.light) .settings-card,
body:not(.light) .settings-group {
  background:
    linear-gradient(180deg, rgba(255,255,255,.026), rgba(255,255,255,.01)),
    color-mix(in srgb, var(--surface) 60%, var(--bg2) 40%);
  border-color: color-mix(in srgb, rgba(255,255,255,.11) 46%, transparent);
  box-shadow:
    0 1px 0 rgba(255,255,255,.035) inset,
    0 10px 26px rgba(4, 5, 12, .13);
}
.settings-section-primary .settings-card {
  background: var(--material-raised);
  border-color: color-mix(in srgb, var(--accent) 20%, var(--separator));
}
body:not(.light) .settings-section-primary .settings-card {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent-light) 18%, transparent), transparent 76%),
    color-mix(in srgb, var(--surface) 58%, var(--bg2) 42%);
  border-color: color-mix(in srgb, var(--accent) 16%, rgba(255,255,255,.09));
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid var(--separator-soft);
  gap: 12px;
}
.settings-row:last-child { border-bottom: none; }
.settings-row span, .settings-row > div > div:first-child { color: var(--text); }
.settings-row-stack {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
.settings-row-stack .accent-picker {
  justify-content: flex-start;
}
.prominent-row {
  min-height: 74px;
}
.danger-row {
  background: linear-gradient(90deg, transparent, var(--danger-light));
}
.settings-hint {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--text3);
}
.settings-row--stacked {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
.settings-push-note {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text2);
}
.settings-push-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent);
  background: color-mix(in srgb, var(--accent-light) 64%, var(--material-raised));
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: opacity var(--tr), transform var(--tr);
}
.settings-push-btn:active:not(:disabled):not(.is-disabled) {
  transform: scale(0.98);
  opacity: 0.92;
}
.settings-push-btn:disabled,
.settings-push-btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-style: dashed;
}
.settings-permission-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}
.permission-status {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-left: 6px;
  padding: 0 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text3) 12%, transparent);
  color: var(--text3);
  font-size: 11px;
  font-weight: 720;
  vertical-align: 1px;
}
.permission-status-ok {
  background: color-mix(in srgb, var(--success, #2f9e6b) 14%, transparent);
  color: var(--success, #2f9e6b);
}
.permission-status-warn {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}
.permission-status-blocked {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}
.settings-select,
.settings-number,
.settings-text {
  flex: 0 0 auto;
  min-width: 104px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 92%, var(--material-raised) 8%);
  border: 1px solid var(--separator);
  color: var(--text);
  font-size: 13px;
  text-align: right;
}
.settings-number {
  width: 68px;
}
.settings-text {
  width: min(42vw, 178px);
  font-weight: 700;
  -webkit-appearance: none;
  appearance: none;
  background-color: color-mix(in srgb, var(--surface) 92%, var(--material-raised) 8%);
  box-shadow: 0 1px 0 rgba(255,255,255,.55) inset;
}
body:not(.light) .settings-select,
body:not(.light) .settings-number,
body:not(.light) .settings-text {
  background: color-mix(in srgb, var(--bg3) 54%, var(--surface) 46%);
  background-color: color-mix(in srgb, var(--bg3) 54%, var(--surface) 46%);
  border-color: color-mix(in srgb, rgba(255,255,255,.12) 56%, transparent);
  box-shadow: 0 1px 0 rgba(255,255,255,.035) inset;
}
body.light .settings-text {
  background: #fff;
  background-color: #fff;
}
.settings-version {
  text-align: center;
  font-size: 11px;
  color: var(--text3);
  margin-top: 20px;
  letter-spacing: .04em;
}

/* Mode pill → 统一为 setting-action */
.setting-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 0;
  background: none;
  border: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity var(--tr);
}
.setting-action:active { opacity: .6; }
.setting-action.danger { color: var(--danger); }
.primary-action {
  min-height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 760;
}
body:not(.light) .primary-action {
  background: color-mix(in srgb, var(--accent) 82%, var(--surface) 18%);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 18%, transparent);
}
body:not(.light) .icon-sun  { display: none !important; }
body:not(.light) .icon-moon { display: block !important; }
body.light       .icon-moon { display: none !important; }
body.light       .icon-sun  { display: block !important; }

/* Accent picker */
.accent-picker { display: flex; gap: 9px; flex-wrap: wrap; }
.accent-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; transition: transform var(--tr), border-color var(--tr); }
.accent-swatch:active { transform: scale(.85); }
.accent-swatch.active { border-color: var(--text); transform: scale(1.1); }
body:not(.light) .accent-swatch.active {
  border-color: color-mix(in srgb, #fff 72%, var(--accent) 28%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-light) 58%, transparent);
}


/* ── 作息设置 ── */
.sched-summary {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; gap: 10px;
}
.settings-card .sched-summary {
  border: none;
  border-radius: 0;
  background: transparent;
}
.sched-summary-text { font-size: 13px; color: var(--text2); flex: 1; line-height: 1.5; }
.sched-input-wrap { display: flex; flex-direction: column; gap: 8px; }
.settings-card .sched-input-wrap {
  padding: 0 14px 16px;
  gap: 11px;
}
.sched-time-list {
  display: grid;
  gap: 8px;
}
.sched-core-times {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.sched-time-row {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  --schedule-card-bg-start: color-mix(in srgb, var(--accent-light) 54%, var(--bg3));
  --schedule-card-bg-end: color-mix(in srgb, var(--accent) 16%, var(--bg3));
  --schedule-card-glow: color-mix(in srgb, var(--accent) 28%, transparent);
  width: 100%;
  min-height: 82px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  padding: 13px 13px 14px;
  border: 0;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,.18)),
    radial-gradient(circle at 88% 46%, var(--schedule-card-glow), transparent 56%),
    linear-gradient(135deg, var(--schedule-card-bg-start), var(--schedule-card-bg-end));
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.52);
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.sched-time-row::before,
.sched-time-row::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.sched-time-row::before {
  background-position: center;
  background-size: 100% 100%;
  opacity: .00001;
  filter: grayscale(1) contrast(.96);
}
.sched-time-row::after {
  display: none;
}
.sched-time-row[data-sched-time="wakeUp"] {
  --schedule-card-bg-start: color-mix(in srgb, var(--accent-light) 42%, #fbfdff);
  --schedule-card-bg-end: color-mix(in srgb, var(--accent) 9%, #fff8ed);
  --schedule-card-glow: color-mix(in srgb, var(--accent) 15%, rgba(255,218,154,.38));
}
.sched-time-row[data-sched-time="sleep"] {
  --schedule-card-bg-start: color-mix(in srgb, var(--accent-light) 34%, #f5f7ff);
  --schedule-card-bg-end: color-mix(in srgb, var(--accent) 13%, #edf1ff);
  --schedule-card-glow: color-mix(in srgb, var(--accent) 18%, rgba(172,184,255,.32));
}
.sched-time-row[data-sched-time="wakeUp"]::before {
  background-image: url("../../../assets/schedule-wake-card-level.jpg");
  background-position: center;
}
.sched-time-row[data-sched-time="sleep"]::before {
  background-image: url("../../../assets/schedule-sleep-card-level.jpg");
  background-position: center;
}
.sched-time-row span {
  position: relative;
  z-index: 1;
  color: var(--text2);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -.012em;
}
.sched-time-row b {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  padding: 7px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-light) 70%, transparent);
  color: var(--accent);
  font-size: 16px;
  font-weight: 760;
  letter-spacing: -.018em;
  line-height: 1;
  text-align: center;
}
.sched-time-row:active {
  transform: scale(.99);
  background: color-mix(in srgb, var(--accent-light) 28%, var(--bg3));
}
body:not(.light) .sched-time-row {
  --schedule-card-bg-start: color-mix(in srgb, var(--accent) 10%, rgba(255,255,255,.05));
  --schedule-card-bg-end: color-mix(in srgb, var(--accent) 18%, rgba(255,255,255,.035));
  --schedule-card-glow: color-mix(in srgb, var(--accent) 20%, transparent);
  background:
    linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.025)),
    radial-gradient(circle at 86% 42%, var(--schedule-card-glow), transparent 50%),
    linear-gradient(135deg, var(--schedule-card-bg-start), var(--schedule-card-bg-end));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.052);
}
body:not(.light) .sched-time-row[data-sched-time="wakeUp"] {
  --schedule-card-bg-start: color-mix(in srgb, var(--accent) 12%, rgba(255,255,255,.055));
  --schedule-card-bg-end: color-mix(in srgb, var(--accent) 22%, rgba(255,255,255,.04));
}
body:not(.light) .sched-time-row[data-sched-time="sleep"] {
  --schedule-card-bg-start: color-mix(in srgb, var(--accent) 8%, rgba(255,255,255,.04));
  --schedule-card-bg-end: color-mix(in srgb, var(--accent) 20%, rgba(255,255,255,.032));
}
body:not(.light) .sched-time-row::before {
  opacity: .10;
  filter: grayscale(1) brightness(.9) contrast(1.04);
}
body:not(.light) .sched-time-row::after {
  display: none;
}
body:not(.light) .sched-time-row b {
  background: color-mix(in srgb, var(--accent) 13%, rgba(255,255,255,.07));
}
.sched-rhythm-head {
  margin: 2px 2px -2px;
  color: var(--text3);
  font-size: 11px;
  font-weight: 720;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.sched-meal-tags {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.sched-meal-chip {
  min-width: 0;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  padding: 9px 10px;
  border: 0;
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg3) 78%, rgba(255,255,255,.54));
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.48);
  -webkit-tap-highlight-color: transparent;
}
.sched-meal-chip span {
  color: var(--text2);
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -.01em;
}
.sched-meal-chip b {
  color: var(--accent);
  font-size: 13px;
  font-weight: 760;
  line-height: 1.1;
  letter-spacing: -.012em;
}
.sched-meal-chip.is-muted {
  background: color-mix(in srgb, var(--bg3) 68%, transparent);
  opacity: .58;
}
.sched-meal-chip.is-muted b {
  color: var(--text3);
}
.sched-meal-chip:active {
  transform: scale(.98);
}
body:not(.light) .sched-meal-chip {
  background: color-mix(in srgb, var(--accent) 8%, rgba(255,255,255,.065));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.052);
}
body:not(.light) .sched-meal-chip.is-muted {
  background: rgba(255,255,255,.045);
  opacity: .52;
}
.sched-templates { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.sched-tpl-label { font-size: var(--font-caption-2); color: var(--text3); }
.sched-tpl {
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--material-field) 88%, transparent);
  color: var(--text2);
  border: 1px solid var(--separator-soft);
  font-size: var(--font-caption);
  font-weight: var(--weight-caption);
  transition: background var(--tr), color var(--tr), transform var(--tr-fast);
}
.sched-tpl:active { transform: scale(.96); background: var(--accent-light); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 34%, transparent); }
.sched-textarea-wrap {
  overflow: hidden;
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 92%, var(--material-raised) 8%);
  border: 1px solid var(--separator);
  box-shadow: 0 1px 0 rgba(255,255,255,.55) inset;
}
body:not(.light) .sched-textarea-wrap {
  background: color-mix(in srgb, var(--bg3) 48%, var(--surface) 52%);
  border-color: color-mix(in srgb, rgba(255,255,255,.12) 54%, transparent);
  box-shadow: 0 1px 0 rgba(255,255,255,.035) inset;
}
.sched-textarea-wrap:focus-within {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--separator));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-light) 62%, transparent);
}
.sched-textarea-wrap textarea {
  display: block;
  width: 100%;
  min-height: 92px;
  padding: 13px 14px;
  border: none;
  border-radius: 0;
  background: transparent !important;
  background-color: transparent !important;
  color: var(--text);
  font-size: var(--font-callout);
  line-height: 1.48;
  resize: none;
  -webkit-appearance: none;
  appearance: none;
}
body.light .sched-textarea-wrap {
  background: #fff;
  background-color: #fff;
}
.sched-textarea-wrap textarea::placeholder {
  color: color-mix(in srgb, var(--text3) 82%, transparent);
}
.sched-save-btn {
  width: 100%;
  min-height: 48px;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  font-size: var(--font-callout);
  font-weight: var(--weight-body-strong);
  text-align: center;
  transition: opacity var(--tr), transform var(--tr-fast);
}
.sched-save-btn:active:not(:disabled) { transform: scale(.985); opacity: .92; }
.sched-save-btn:disabled {
  background: color-mix(in srgb, var(--text3) 46%, transparent);
  color: rgba(255,255,255,.82);
  opacity: 1;
}
.settings-sched-time-picker {
  z-index: 680;
  background: rgba(12, 14, 20, .20);
  backdrop-filter: blur(12px) saturate(.96);
  -webkit-backdrop-filter: blur(12px) saturate(.96);
}
.settings-sched-time-sheet {
  max-height: min(64dvh, 440px);
  padding-bottom: 0;
  background: color-mix(in srgb, var(--material-base) 94%, rgba(255,255,255,.72));
}
.settings-sched-time-picker .choice-picker-header {
  justify-content: space-between;
  gap: 16px;
  padding: 10px 22px 8px;
  border-bottom: 0;
}
.settings-sched-time-picker .choice-picker-header strong {
  color: var(--text);
  font-size: 18px;
  font-weight: 720;
  letter-spacing: -.025em;
}
.settings-sched-current {
  flex: 0 0 auto;
  min-width: 86px;
  padding: 7px 13px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-light) 64%, rgba(255,255,255,.62));
  color: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.44);
  font-size: 18px;
  font-weight: 760;
  letter-spacing: -.02em;
  line-height: 1;
  text-align: center;
}
.settings-sched-picker-body {
  padding: 6px 18px calc(12px + var(--safe-bottom));
}
.settings-sched-skip {
  width: 100%;
  min-height: 38px;
  margin: 0 0 10px;
  border: 0;
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg3) 78%, rgba(255,255,255,.58));
  color: var(--text2);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -.012em;
}
.settings-sched-skip:active {
  transform: scale(.99);
  opacity: .86;
}
body:not(.light) .settings-sched-skip {
  background: rgba(255,255,255,.06);
  color: var(--text2);
}
.settings-sched-picker-stage {
  --settings-sched-stage-bg: color-mix(in srgb, var(--bg2) 84%, rgba(255,255,255,.70));
  position: relative;
  overflow: hidden;
  padding: 8px 14px;
  border-radius: 26px;
  background: var(--settings-sched-stage-bg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.46), inset 0 -1px 0 rgba(20,28,40,.04);
}
.settings-sched-wheel-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  height: 188px;
  overflow: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  contain: layout paint;
}
.settings-sched-wheel-row::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    var(--settings-sched-stage-bg) 0%,
    color-mix(in srgb, var(--settings-sched-stage-bg) 86%, transparent) 18%,
    rgba(255,255,255,0) 30%,
    rgba(255,255,255,0) 70%,
    color-mix(in srgb, var(--settings-sched-stage-bg) 86%, transparent) 82%,
    var(--settings-sched-stage-bg) 100%
  );
}
.settings-sched-wheel-wrap {
  position: relative;
  min-width: 0;
  height: 188px;
}
.settings-sched-wheel-wrap::before {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 50%;
  z-index: 0;
  height: 44px;
  transform: translateY(-50%);
  border-radius: 15px;
  background: rgba(255,255,255,.58);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.72), inset 0 -1px 0 rgba(20,28,40,.045), 0 8px 18px rgba(20,28,40,.045);
}
.settings-sched-wheel {
  position: relative;
  z-index: 1;
  height: 188px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  overscroll-behavior-x: none;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-radius: 16px;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.settings-sched-wheel::-webkit-scrollbar {
  display: none;
}
.settings-sched-wheel-spacer {
  height: 72px;
}
.settings-sched-wheel-item {
  width: 100%;
  min-width: 0;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  scroll-snap-align: center;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: var(--text3);
  font-size: 28px;
  font-weight: 620;
  letter-spacing: -.02em;
  text-align: center;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--tr-fast) var(--ease-standard), opacity var(--tr-fast) var(--ease-standard);
}
.settings-sched-wheel-item.active {
  color: var(--text);
  font-weight: 760;
  opacity: 1;
}
.settings-sched-wheel-item:not(.active) {
  opacity: .34;
}
.settings-sched-wheel-colon {
  position: relative;
  z-index: 1;
  color: var(--text);
  font-size: 26px;
  font-weight: 720;
  text-align: center;
}
.settings-sched-save {
  width: 100%;
  margin-top: 20px;
}
body:not(.light) .settings-sched-time-sheet {
  background: rgba(38,38,40,.92);
}
body:not(.light) .settings-sched-current {
  background: color-mix(in srgb, var(--accent) 13%, rgba(255,255,255,.09));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.075);
}
body:not(.light) .settings-sched-picker-stage {
  --settings-sched-stage-bg: rgba(24,24,27,.70);
  background: var(--settings-sched-stage-bg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.055), inset 0 -1px 0 rgba(0,0,0,.16);
}
body:not(.light) .settings-sched-wheel-wrap::before {
  background: color-mix(in srgb, var(--accent) 10%, rgba(255,255,255,.09));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), inset 0 -1px 0 rgba(0,0,0,.18), 0 10px 22px rgba(0,0,0,.18);
}

/* ── Toggle Switch ── */
.toggle { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--bg4); border-radius: 99px; cursor: pointer; transition: background var(--tr); }
.toggle-slider::before { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform var(--tr); box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

.task-item.pressing {
  transform: scale(.97);
  box-shadow: 0 0 0 2px var(--accent);
  transition: transform .48s ease, box-shadow .48s ease;
}
