/* StudyTick intentional light/dark theme system */
html[data-theme="light"]{color-scheme:light;--sc-bg:#f6f3ed;--sc-surface:#fffdf8;--sc-surface-soft:#f1eee7;--sc-surface-raised:#fffaf3;--sc-text:#1f2b33;--sc-muted:#5f6b68;--sc-border:#d8d4ca;--sc-control-border:#89928d;--sc-accent:#a4efce;--sc-accent-hover:#92e6c0;--sc-accent-strong:#168562;--sc-link:#145f49;--sc-accent-soft:#e3f3ec;--sc-focus:#1d2b3b;--sc-focus-soft:#2b3a4c;--sc-focus-border:#526174;--sc-focus-text:#f7faf8;--sc-focus-muted:#d0daea;--sc-danger:#a51e29;--sc-shadow:0 18px 50px rgba(54,48,39,.08)}
html[data-theme="dark"]{color-scheme:dark;--sc-bg:#171a1d;--sc-surface:#202428;--sc-surface-soft:#262b30;--sc-surface-raised:#2b3035;--sc-text:#eef2ef;--sc-muted:#aab5b0;--sc-border:#465058;--sc-control-border:#65717a;--sc-accent:#a4efce;--sc-accent-hover:#92e6c0;--sc-accent-strong:#78d5b1;--sc-link:#78d5b1;--sc-accent-soft:#263a33;--sc-focus:#1d2b33;--sc-focus-soft:#293943;--sc-focus-border:#657784;--sc-focus-text:#f2f6f3;--sc-focus-muted:#aab9b5;--sc-danger:#f0b4b8;--sc-shadow:0 20px 60px rgba(0,0,0,.22)}
html[data-theme],html[data-theme] body{background:var(--sc-bg);color:var(--sc-text)}
html[data-theme] body{transition:background-color .18s ease,color .18s ease}
html[data-theme] header small,html[data-theme] .settings p,html[data-theme] .schedule-head p,html[data-theme] .time,html[data-theme] .target,html[data-theme] .footer,html[data-theme] .empty,html[data-theme] dialog p{color:var(--sc-muted)}
html[data-theme] .brand span{color:var(--sc-accent-strong)}
html[data-theme] a,html[data-theme] .welcome a,html[data-theme] .resources a,html[data-theme] .guide-links a,html[data-theme] .community details>summary{color:var(--sc-link)}
html[data-theme] button,html[data-theme] select,html[data-theme] input,html[data-theme] textarea,html[data-theme] .actions .action-link{background:var(--sc-surface-raised);color:var(--sc-text);border-color:var(--sc-control-border)}
html[data-theme] input::placeholder,html[data-theme] textarea::placeholder{color:var(--sc-muted);opacity:.82}
html[data-theme] button.primary,html[data-theme] .community button,html[data-theme] .view-switch [aria-pressed=true]{background:var(--sc-accent);border-color:var(--sc-accent);color:#172841}
html[data-theme] button.primary:hover,html[data-theme] .community button:hover{background:var(--sc-accent-hover);border-color:var(--sc-accent-hover)}
html[data-theme] button:focus-visible,html[data-theme] input:focus-visible,html[data-theme] textarea:focus-visible,html[data-theme] select:focus-visible,html[data-theme] a:focus-visible,html[data-theme] summary:focus-visible{outline-color:var(--sc-accent-strong)!important}
html[data-theme] .settings,html[data-theme] .schedule,html[data-theme] .community,html[data-theme] .resources,html[data-theme] article,html[data-theme] .card,html[data-theme] .panel{background:var(--sc-surface);color:var(--sc-text);border-color:var(--sc-border)}
html[data-theme] .welcome{background:var(--sc-accent-soft);color:var(--sc-text)}
html[data-theme] .exam-countdown-card{background:var(--sc-surface-raised);color:var(--sc-text);border-color:var(--sc-border)}
html[data-theme] .capability,html[data-theme] .restart-dialog-note{background:var(--sc-surface-soft);color:var(--sc-text)}
html[data-theme] .row{border-top-color:var(--sc-border)}
html[data-theme] .row.current{background:var(--sc-accent-soft);border-left-color:var(--sc-accent-strong)}
html[data-theme][dir="rtl"] .row.current{border-right-color:var(--sc-accent-strong)}
html[data-theme] .tag{color:var(--sc-link)}
html[data-theme] .repeat-days label{border-color:var(--sc-control-border)}
html[data-theme] dialog{background:var(--sc-surface-raised);color:var(--sc-text);box-shadow:var(--sc-shadow)}
html[data-theme] dialog::backdrop{background:rgba(12,17,20,.66)}
html[data-theme] .settings-dialog-header{background:var(--sc-surface-raised)}
html[data-theme] .skip-link{background:var(--sc-surface-raised);color:var(--sc-text);border-color:var(--sc-accent-strong)}
html[data-theme] .grid-scroll{border-color:var(--sc-control-border);background:var(--sc-surface)}
html[data-theme] .grid-hour{border-top-color:var(--sc-border);color:var(--sc-muted)}
html[data-theme="light"] .grid-block{background:#edf3f1;border-color:#77958a;color:var(--sc-text)}
html[data-theme="light"] .grid-block.is-break{background:#f2ede3;border-color:#93836b}
html[data-theme="light"] .grid-block.is-current{background:#dff3ea;border-color:#168562}
html[data-theme="light"] .grid-block.is-done{background:#ecebe7;border-color:#8c938f}
html[data-theme="dark"] .grid-block{background:#29323b;border-color:#657784;color:var(--sc-text)}
html[data-theme="dark"] .grid-block.is-break{background:#332f29;border-color:#887b68;color:var(--sc-text)}
html[data-theme="dark"] .grid-block.is-current{background:#263a33;border-color:#78d5b1;color:var(--sc-text)}
html[data-theme="dark"] .grid-block.is-done{background:#292d31;border-color:#65717a;color:var(--sc-muted)}
html[data-theme] .grid-now{border-top-color:var(--sc-danger);color:var(--sc-danger)}
html[data-theme] .community-comment{border-top-color:var(--sc-border)}
html[data-theme] .community button:disabled{background:var(--sc-surface-soft);border-color:var(--sc-border);color:var(--sc-muted)}
html[data-theme] .demo-banner{background:var(--sc-accent-soft);border-color:var(--sc-accent-strong);color:var(--sc-text)}
html[data-theme] .restart-strip{background:var(--sc-accent-soft);border-color:var(--sc-border);color:var(--sc-text)}
html[data-theme] .restart-strip p,html[data-theme] .restart-day-note{color:var(--sc-muted)}
html[data-theme] .restart-strip .restart-primary{background:var(--sc-accent-soft);border-color:var(--sc-accent-strong);color:var(--sc-text)}
html[data-theme] .restart-strip.is-restarted{background:var(--sc-surface-soft);border-color:var(--sc-border)}
html[data-theme] .grid-block.is-overdue{border-color:var(--sc-control-border)!important;background:var(--sc-surface-soft)!important;color:var(--sc-muted)!important}
html[data-theme] .focus,html[data-theme] body.focus-view{background:var(--sc-focus);color:var(--sc-focus-text)}
html[data-theme] .focus .eyebrow,html[data-theme] #status{color:var(--sc-accent)}
html[data-theme] .focus .muted,html[data-theme] .focus .timer-label,html[data-theme] .focus .next span,html[data-theme] .focus .note{color:var(--sc-focus-muted)}
html[data-theme] .focus .bar{background:var(--sc-focus-soft)}
html[data-theme] .focus .bar div{background:var(--sc-accent)}
html[data-theme] .focus .next{border-top-color:var(--sc-focus-border)}
html[data-theme] .focus button:not(.primary){background:var(--sc-focus-soft);color:var(--sc-focus-text);border-color:var(--sc-focus-border)}
html[data-theme] .focus-sounds{background:rgba(255,255,255,.055);border-color:var(--sc-focus-border)}
html[data-theme] .focus-sounds-row select{background:var(--sc-focus-soft)!important;color:var(--sc-focus-text)!important;border-color:var(--sc-focus-border)!important}
html[data-theme] .focus-sounds-status,html[data-theme] .brain-dump-label{color:var(--sc-focus-muted)}
html[data-theme] .brain-dump-input{background:rgba(255,255,255,.065);color:var(--sc-focus-text);border-color:var(--sc-focus-border)}
html[data-theme] .brain-dump-input::placeholder{color:var(--sc-focus-muted)}
html[data-theme] .brain-dump-input:focus{border-color:var(--sc-accent);outline-color:var(--sc-accent)}
html[data-theme] .brain-dump-park{background:var(--sc-focus-soft)!important;border-color:var(--sc-focus-border)!important;color:var(--sc-focus-text)!important}
html[data-theme] .brain-dump-status{color:var(--sc-accent)}
html[data-theme] .brain-dump-review{background:var(--sc-surface-raised)!important;color:var(--sc-text)!important;border-color:var(--sc-control-border)!important}
html[data-theme] .brain-dump-item{background:var(--sc-surface-soft);border-color:var(--sc-border)}
html[data-theme] .brain-dump-item-meta{color:var(--sc-muted)}
html[data-theme] .error,html[data-theme] #error{color:var(--sc-danger)}
html[data-theme] .appearance-setting{padding:0 0 18px;margin:0 0 20px;border-bottom:1px solid var(--sc-border)}
html[data-theme] .appearance-setting h3{margin-top:0}
html[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,html[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator{filter:invert(.85)}
@media(prefers-reduced-motion:reduce){html[data-theme] body{transition:none}}
@media(forced-colors:active){html[data-theme] button,html[data-theme] input,html[data-theme] select,html[data-theme] textarea{forced-color-adjust:auto}}

/* Restrained semantic timetable colors: meaning, not subject decoration. */
html[data-theme="light"] .kind-task{--kind-bg:#e7f6ef;--kind-border:#69ad90;--kind-accent:#168562}
html[data-theme="light"] .kind-break{--kind-bg:#eef3e8;--kind-border:#8da17a;--kind-accent:#627b50}
html[data-theme="light"] .kind-exercise{--kind-bg:#eaf0f5;--kind-border:#8298a8;--kind-accent:#526f84}
html[data-theme="light"] .kind-appointment{--kind-bg:#f1ecef;--kind-border:#9a8791;--kind-accent:#765f6b}
html[data-theme="light"] .kind-other{--kind-bg:#f1eee7;--kind-border:#9a9589;--kind-accent:#6c6a63}
html[data-theme="dark"] .kind-task{--kind-bg:#263a33;--kind-border:#78c7a6;--kind-accent:#a4efce}
html[data-theme="dark"] .kind-break{--kind-bg:#2d3529;--kind-border:#81956f;--kind-accent:#b7caa4}
html[data-theme="dark"] .kind-exercise{--kind-bg:#29333b;--kind-border:#71899a;--kind-accent:#aac2d3}
html[data-theme="dark"] .kind-appointment{--kind-bg:#342f38;--kind-border:#8e7a88;--kind-accent:#c6b1be}
html[data-theme="dark"] .kind-other{--kind-bg:#303033;--kind-border:#72777a;--kind-accent:#c0c5c4}
html[data-theme] .row[class*="kind-"]{background:var(--kind-bg);border-inline-start:3px solid var(--kind-border)}
html[data-theme] .row.current{background:var(--kind-bg);border-inline-start:4px solid var(--kind-accent);box-shadow:inset 0 0 0 1px var(--kind-border)}
html[data-theme] .row.done-row{background:var(--sc-surface-soft);border-inline-start-color:var(--sc-border);opacity:.72}
html[data-theme] .row[class*="kind-"] .tag{color:var(--kind-accent)}
html[data-theme] .grid-block[class*="kind-"]{background:var(--kind-bg);border-color:var(--kind-border);border-inline-start:4px solid var(--kind-border);color:var(--sc-text)}
html[data-theme] .grid-block[class*="kind-"].is-current{background:var(--kind-bg);border-color:var(--kind-accent);border-inline-start-color:var(--kind-accent);box-shadow:inset 0 0 0 1px var(--kind-accent)}
html[data-theme] .grid-block[class*="kind-"].is-done{background:var(--sc-surface-soft);border-color:var(--sc-border);border-inline-start-color:var(--sc-border);color:var(--sc-muted);opacity:.76}
html[data-theme] .grid-block[class*="kind-"].is-overdue{background:var(--sc-surface-soft)!important;border-color:var(--sc-control-border)!important;border-inline-start-color:var(--sc-control-border)!important;color:var(--sc-muted)!important}
html[data-theme="light"] body[data-current-kind="task"],html[data-theme="dark"] body[data-current-kind="task"]{--current-kind-accent:#a4efce}
html[data-theme="light"] body[data-current-kind="break"],html[data-theme="dark"] body[data-current-kind="break"]{--current-kind-accent:#b7caa4}
html[data-theme="light"] body[data-current-kind="exercise"],html[data-theme="dark"] body[data-current-kind="exercise"]{--current-kind-accent:#aac2d3}
html[data-theme="light"] body[data-current-kind="appointment"],html[data-theme="dark"] body[data-current-kind="appointment"]{--current-kind-accent:#c6b1be}
html[data-theme="light"] body[data-current-kind="other"],html[data-theme="dark"] body[data-current-kind="other"]{--current-kind-accent:#c0c5c4}
html[data-theme] body[data-current-kind]:not([data-current-kind=""]) .focus .eyebrow{color:var(--current-kind-accent)}
html[data-theme] body[data-current-kind]:not([data-current-kind=""]) .focus .bar div{background:var(--current-kind-accent)}


/* Preview: unified soft mint button language based on the original Low Stimulation control */
html[data-theme="light"]{
  --sc-button-bg:#e3f1eb;
  --sc-button-bg-hover:#d8ebe3;
  --sc-button-border:#8fb8a7;
  --sc-button-text:#174c3a;
}
html[data-theme="dark"]{
  --sc-button-bg:#263a33;
  --sc-button-bg-hover:#2d443b;
  --sc-button-border:#5f9d84;
  --sc-button-text:#d7f2e6;
}
html[data-theme] button,
html[data-theme] .actions .action-link,
html[data-theme] .view-switch button,
html[data-theme] .community button,
html[data-theme] .focus button,
html[data-theme] #exitFocus{
  background:var(--sc-button-bg)!important;
  border:1px solid var(--sc-button-border)!important;
  color:var(--sc-button-text)!important;
  border-radius:10px!important;
  box-shadow:none!important;
}
html[data-theme] button:hover,
html[data-theme] .actions .action-link:hover,
html[data-theme] .view-switch button:hover,
html[data-theme] .community button:hover,
html[data-theme] .focus button:hover,
html[data-theme] #exitFocus:hover{
  background:var(--sc-button-bg-hover)!important;
  border-color:var(--sc-button-border)!important;
  color:var(--sc-button-text)!important;
  filter:none!important;
}
html[data-theme] button.primary,
html[data-theme] .community button,
html[data-theme] .view-switch [aria-pressed="true"],
html[data-theme] .restart-strip .restart-primary{
  background:var(--sc-button-bg)!important;
  border-color:var(--sc-button-border)!important;
  color:var(--sc-button-text)!important;
}
html[data-theme] button:disabled,
html[data-theme] .community button:disabled{
  background:var(--sc-surface-soft)!important;
  border-color:var(--sc-border)!important;
  color:var(--sc-muted)!important;
  opacity:.68;
}
html[data-theme="light"] .low-stim-toggle{
  background:#f7faf8!important;
  border-color:#b9c8c1!important;
  color:#21483b!important;
}
html[data-theme="light"] .low-stim-toggle[aria-pressed="true"]{
  background:#e3f1eb!important;
  border-color:#8fb8a7!important;
  color:#174c3a!important;
}
html[data-theme="light"] .low-stim-toggle .low-stim-dot{display:block!important;background:#8b99a8!important}
html[data-theme="light"] .low-stim-toggle[aria-pressed="true"] .low-stim-dot{background:#31876a!important}
html[data-theme="dark"] .low-stim-toggle{
  background:#252e2a!important;
  border-color:#536b61!important;
  color:#d7e7df!important;
}
html[data-theme="dark"] .low-stim-toggle[aria-pressed="true"]{
  background:#263a33!important;
  border-color:#5f9d84!important;
  color:#d7f2e6!important;
}
html[data-theme="dark"] .low-stim-toggle .low-stim-dot{display:block!important;background:#81958c!important}
html[data-theme="dark"] .low-stim-toggle[aria-pressed="true"] .low-stim-dot{background:#78d5b1!important}

/* Focus View: keep exam countdown on Today, hide it only during distraction-free focus */
body.focus-view .today-exam,body.focus-view .exam-countdown-card{display:none!important}


/* Preview refinement: Exam Countdown keeps the same compact header footprint in setup and saved states. */
html[data-theme] .today-exam{
  height:122px!important;
  min-height:122px!important;
  max-height:122px!important;
  box-sizing:border-box!important;
}
html[data-theme] .today-exam.is-exam-setup{
  display:block!important;
  padding:15px 16px!important;
}
html[data-theme] .today-exam.is-exam-setup .chime-exam-ring{display:none!important}
html[data-theme] .today-exam.is-exam-setup h3{
  display:block!important;
  margin:0 0 8px!important;
  font-size:.70rem!important;
  line-height:1.1!important;
}
html[data-theme] .today-exam.is-exam-setup .exam-setup-form{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto!important;
  gap:6px!important;
  align-items:end!important;
  margin:0!important;
}
html[data-theme] .today-exam.is-exam-setup .exam-field{min-width:0!important}
html[data-theme] .today-exam.is-exam-setup .exam-field label{
  display:block!important;
  margin:0 0 3px!important;
  font-size:.70rem!important;
  line-height:1.1!important;
  font-weight:650!important;
  white-space:nowrap!important;
}
html[data-theme] .today-exam.is-exam-setup .exam-field input{
  display:block!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  height:34px!important;
  box-sizing:border-box!important;
  margin:0!important;
  padding:6px 8px!important;
  border-radius:8px!important;
  font-size:.78rem!important;
}
html[data-theme] .today-exam.is-exam-setup .exam-save{
  width:auto!important;
  height:34px!important;
  align-self:end!important;
  justify-self:end!important;
  margin:0!important;
  padding:6px 10px!important;
  white-space:nowrap!important;
  font-size:.76rem!important;
}
html[data-theme] .today-exam.is-exam-setup #homeExamResult{
  display:none!important;
}
@media(max-width:480px){
  html[data-theme] .today-exam{
    height:122px!important;
    min-height:122px!important;
    max-height:122px!important;
  }
  html[data-theme] .today-exam.is-exam-setup{padding:13px 11px!important}
  html[data-theme] .today-exam.is-exam-setup .exam-setup-form{
    grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto!important;
    gap:5px!important;
  }
  html[data-theme] .today-exam.is-exam-setup .exam-field label{font-size:.64rem!important}
  html[data-theme] .today-exam.is-exam-setup .exam-field input{
    height:34px!important;
    min-height:34px!important;
    padding:5px 6px!important;
    font-size:.72rem!important;
  }
  html[data-theme] .today-exam.is-exam-setup .exam-save{
    height:34px!important;
    padding:5px 7px!important;
    font-size:.69rem!important;
  }
}


/* Exam Countdown saved-state fix: keep the approved 122px card and fully remove setup controls after Save. */
html[data-theme] .exam-countdown-card .exam-setup-form[hidden]{display:none!important}
html[data-theme] .today-exam.is-exam-configured{
  display:grid!important;
  grid-template-columns:76px minmax(0,1fr)!important;
  grid-template-rows:auto auto!important;
  column-gap:16px!important;
  row-gap:0!important;
  align-content:center!important;
  align-items:center!important;
  height:122px!important;
  min-height:122px!important;
  max-height:122px!important;
  padding:16px 22px!important;
  overflow:hidden!important;
}
html[data-theme] .today-exam.is-exam-configured h3{display:none!important}
html[data-theme] .today-exam.is-exam-configured .chime-exam-ring{
  display:grid!important;grid-column:1!important;grid-row:1 / 3!important;align-self:center!important
}
html[data-theme] .today-exam.is-exam-configured #homeExamResult{
  display:block!important;grid-column:2!important;grid-row:1!important;align-self:end!important;min-width:0!important;margin:0!important
}
html[data-theme] .today-exam.is-exam-configured .exam-countdown-main{
  margin:0 0 3px!important;font-size:1.02rem!important;line-height:1.2!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important
}
html[data-theme] .today-exam.is-exam-configured .exam-countdown-date{
  margin:0!important;font-size:.80rem!important;line-height:1.2!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important
}
html[data-theme] .today-exam.is-exam-configured .exam-edit{
  display:inline-block!important;grid-column:2!important;grid-row:2!important;justify-self:start!important;align-self:start!important;
  width:auto!important;min-width:0!important;min-height:0!important;height:auto!important;margin:5px 0 0!important;padding:0!important;
  border:0!important;border-radius:0!important;box-shadow:none!important;background:transparent!important
}
html[data-theme] .today-exam.is-exam-configured .exam-edit[hidden]{display:none!important}
@media(max-width:480px){
  html[data-theme] .today-exam.is-exam-configured{grid-template-columns:64px minmax(0,1fr)!important;column-gap:11px!important;padding:13px 14px!important}
  html[data-theme] .today-exam.is-exam-configured .chime-exam-ring{--ring-size:58px!important}
  html[data-theme] .today-exam.is-exam-configured .exam-countdown-main{font-size:.92rem!important}
  html[data-theme] .today-exam.is-exam-configured .exam-countdown-date{font-size:.72rem!important}
}


/* Mobile audit 2026-10-07: narrow-screen reflow, touch targets, and safe areas. */
@media(max-width:480px){
  /* Keep the approved compact 122px exam card without squeezing 3 controls into one row. */
  html[data-theme] .today-exam.is-exam-setup{
    height:122px!important;
    min-height:122px!important;
    max-height:122px!important;
    padding:9px 11px!important;
    overflow:hidden!important;
  }
  html[data-theme] .today-exam.is-exam-setup h3{
    position:absolute!important;
    width:1px!important;
    height:1px!important;
    padding:0!important;
    margin:-1px!important;
    overflow:hidden!important;
    clip:rect(0,0,0,0)!important;
    white-space:nowrap!important;
    border:0!important;
  }
  html[data-theme] .today-exam.is-exam-setup .exam-setup-form{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
    grid-template-rows:auto 34px!important;
    gap:5px 7px!important;
    align-items:end!important;
    width:100%!important;
    height:auto!important;
    margin:0!important;
  }
  html[data-theme] .today-exam.is-exam-setup .exam-field{
    min-width:0!important;
    overflow:hidden!important;
  }
  html[data-theme] .today-exam.is-exam-setup .exam-field label{
    display:block!important;
    margin:0 0 2px!important;
    font-size:.68rem!important;
    line-height:1.1!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  html[data-theme] .today-exam.is-exam-setup .exam-field input{
    display:block!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    height:34px!important;
    min-height:34px!important;
    margin:0!important;
    padding:4px 6px!important;
    font-size:16px!important;
    line-height:1!important;
    box-sizing:border-box!important;
  }
  html[data-theme] .today-exam.is-exam-setup .exam-save{
    grid-column:1 / -1!important;
    width:100%!important;
    min-width:0!important;
    height:34px!important;
    min-height:34px!important;
    margin:0!important;
    padding:5px 10px!important;
    font-size:.78rem!important;
    line-height:1!important;
    white-space:nowrap!important;
  }

  /* Saved countdown remains compact but Edit is a usable touch target. */
  html[data-theme] .today-exam.is-exam-configured .exam-edit{
    min-width:44px!important;
    min-height:30px!important;
    height:30px!important;
    margin:2px 0 0!important;
    padding:5px 8px!important;
    line-height:20px!important;
    text-align:center!important;
  }

  /* Phone dialogs and long secondary actions should not create cramped rows. */
  html[data-theme] dialog .actions{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:8px!important;
  }
  html[data-theme] dialog .actions > button,
  html[data-theme] dialog .actions > .action-link{
    width:100%!important;
    min-width:0!important;
  }

  /* Brain-dump metadata can wrap rather than forcing horizontal overflow. */
  html[data-theme] .brain-dump-item-meta{
    flex-wrap:wrap!important;
    align-items:flex-start!important;
  }

  /* Respect notches/home indicators for fixed Focus and undo controls. */
  html[data-theme] #exitFocus{
    top:max(12px,env(safe-area-inset-top,0px))!important;
    right:max(12px,env(safe-area-inset-right,0px))!important;
  }
  html[data-theme] .planning-undo{
    bottom:max(14px,env(safe-area-inset-bottom,0px))!important;
    width:calc(100vw - 24px)!important;
    max-width:calc(100vw - 24px)!important;
    flex-wrap:wrap!important;
    justify-content:center!important;
  }
  html[data-theme] body.focus-view .focus{
    min-height:100dvh!important;
    padding-top:calc(68px + env(safe-area-inset-top,0px))!important;
    padding-bottom:calc(22px + env(safe-area-inset-bottom,0px))!important;
  }
}


/* Mobile exam setup symmetry: equal field columns and identical controls. */
@media(max-width:480px){
  html[data-theme] .today-exam.is-exam-setup .exam-setup-form{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
  html[data-theme] .today-exam.is-exam-setup .exam-field{
    width:100%!important;min-width:0!important;max-width:none!important;margin:0!important;
  }
  html[data-theme] .today-exam.is-exam-setup .exam-field input,
  html[data-theme] .today-exam.is-exam-setup #homeExamDate{
    width:100%!important;min-width:0!important;max-width:none!important;
    height:34px!important;min-height:34px!important;box-sizing:border-box!important;
    -webkit-appearance:none;appearance:none;
  }
  html[data-theme] .today-exam.is-exam-setup input[type="date"]::-webkit-date-and-time-value{text-align:left}
}

/* Compact StudyTick settings system */
#settingsDialog.settings-dialog-modern{width:min(620px,calc(100vw - 24px));max-width:620px;max-height:calc(100dvh - 24px);padding:0;overflow:hidden;border:1px solid var(--sc-border);border-radius:14px}
#settingsDialog .settings-dialog-header{position:sticky;top:0;z-index:3;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:17px 20px;border-bottom:1px solid var(--sc-border)}
#settingsDialog .settings-dialog-header h2{margin:0;font-size:1.18rem;letter-spacing:-.02em}
#settingsDialog #closeSettingsTop{width:36px;min-width:36px;height:36px;min-height:36px;padding:0;border:0;background:transparent;font-size:1.45rem;line-height:1;color:var(--sc-muted)}
#settingsDialog .settings-modern-body{max-height:calc(100dvh - 142px);overflow:auto;padding:0 20px;margin:0;background:var(--sc-surface-raised)}
#settingsDialog .settings-group{padding:19px 0;border-bottom:1px solid var(--sc-border)}
#settingsDialog .settings-group:last-child{border-bottom:0}
#settingsDialog .settings-group h3{margin:0 0 14px;font-size:.76rem;line-height:1.2;letter-spacing:.1em;text-transform:uppercase;color:var(--sc-muted);font-weight:750}
#settingsDialog .settings-control+.settings-control{margin-top:16px}
#settingsDialog .settings-control-label{display:block;margin:0 0 8px;font-size:.92rem;font-weight:650;color:var(--sc-text)}
#settingsDialog .settings-helper{margin:7px 0 0;font-size:.79rem;line-height:1.45;color:var(--sc-muted)}
#settingsDialog .settings-segmented{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));padding:3px;border:1px solid var(--sc-border);border-radius:10px;background:var(--sc-surface-soft);gap:3px}
#settingsDialog .settings-segmented-two{grid-template-columns:repeat(2,minmax(0,1fr))}
#settingsDialog .settings-segmented button{min-height:38px;padding:7px 10px;border:0;border-radius:7px;background:transparent;color:var(--sc-muted);font-size:.84rem;font-weight:600;box-shadow:none}
#settingsDialog .settings-segmented button[aria-pressed="true"]{background:var(--sc-surface-raised);color:var(--sc-text);box-shadow:inset 0 0 0 1px var(--sc-control-border)}
#settingsDialog .settings-theme-segmented button{display:flex;align-items:center;justify-content:center;gap:6px}
#settingsDialog .theme-choice-icon{font-size:.95rem}
#settingsDialog .settings-day-pills{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:6px;margin:12px 0 4px;padding:0;border:0}
#settingsDialog .settings-day-pills label{position:relative;display:block;margin:0;padding:0;border:0;background:transparent}
#settingsDialog .settings-day-pills input{position:absolute;inline-size:1px;block-size:1px;opacity:0;pointer-events:none}
#settingsDialog .settings-day-pills label span{display:flex;align-items:center;justify-content:center;min-height:38px;padding:6px 4px;border:1px solid var(--sc-control-border);border-radius:9px;background:var(--sc-surface-raised);color:var(--sc-text);font-size:.78rem;font-weight:600;cursor:pointer}
#settingsDialog .settings-day-pills label:has(input:checked) span{background:var(--sc-accent-soft);border-color:var(--sc-accent-strong);color:var(--sc-text)}
#settingsDialog .settings-day-pills label:has(input:focus-visible) span{outline:3px solid var(--sc-accent-strong);outline-offset:2px}
#settingsDialog .settings-sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
#settingsDialog .settings-sound-head,#settingsDialog .settings-sound-row{display:grid;grid-template-columns:62px minmax(0,1fr) 46px;gap:8px;align-items:center}
#settingsDialog .settings-sound-head{margin-bottom:6px;color:var(--sc-muted);font-size:.72rem}
#settingsDialog .settings-sound-head span:last-child{text-align:center}
#settingsDialog .settings-sound-row{margin:0 0 8px}
#settingsDialog .settings-sound-row label{margin:0;font-size:.86rem;font-weight:650}
#settingsDialog .settings-sound-row select{width:100%;min-width:0;min-height:40px;padding:7px 30px 7px 10px;border-radius:9px;font-size:.84rem}
#settingsDialog .settings-icon-button{width:42px;min-width:42px;height:40px;min-height:40px;padding:0;border-radius:9px;background:var(--sc-surface-raised);color:var(--sc-link);font-size:.82rem;font-weight:500}
#settingsDialog .settings-range{display:grid;grid-template-columns:62px minmax(0,1fr);gap:8px;align-items:center;margin:13px 0 0;font-size:.86rem;font-weight:650}
#settingsDialog .settings-range input{width:100%;min-height:28px;margin:0}
#settingsDialog .settings-toggle-list{display:grid;gap:10px}
#settingsDialog .settings-toggle{display:grid;grid-template-columns:38px minmax(0,1fr);align-items:center;gap:10px;margin:0;font-size:.86rem;cursor:pointer}
#settingsDialog .settings-toggle input{position:absolute;opacity:0;pointer-events:none}
#settingsDialog .settings-toggle-ui{position:relative;width:36px;height:21px;border:1px solid var(--sc-control-border);border-radius:999px;background:var(--sc-surface-soft);transition:.15s ease}
#settingsDialog .settings-toggle-ui::after{content:"";position:absolute;top:3px;left:3px;width:13px;height:13px;border-radius:50%;background:var(--sc-muted);transition:.15s ease}
#settingsDialog .settings-toggle input:checked+.settings-toggle-ui{background:var(--sc-accent-soft);border-color:var(--sc-accent-strong)}
#settingsDialog .settings-toggle input:checked+.settings-toggle-ui::after{transform:translateX(15px);background:var(--sc-accent-strong)}
html[dir="rtl"] #settingsDialog .settings-toggle-ui::after{left:auto;right:3px}
html[dir="rtl"] #settingsDialog .settings-toggle input:checked+.settings-toggle-ui::after{transform:translateX(-15px)}
#settingsDialog .settings-toggle input:focus-visible+.settings-toggle-ui{outline:3px solid var(--sc-accent-strong);outline-offset:2px}
#settingsDialog .settings-indent{margin-left:48px}
html[dir="rtl"] #settingsDialog .settings-indent{margin-left:0;margin-right:48px}
#settingsDialog .settings-secondary-action{min-height:40px;margin-top:12px;padding:8px 12px;border-radius:9px;background:var(--sc-surface-raised);font-size:.82rem;font-weight:550}
#settingsDialog .settings-live-status:empty{display:none}
#settingsDialog .settings-data-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:12px}
#settingsDialog .settings-data-actions button{width:100%;min-height:40px;padding:8px 12px;border-radius:9px;background:var(--sc-surface-raised);font-size:.84rem;font-weight:550}
#settingsDialog .settings-modern-footer{position:sticky;bottom:0;z-index:3;display:flex;justify-content:flex-end;padding:12px 20px;border-top:1px solid var(--sc-border);background:var(--sc-surface-raised)}
#settingsDialog .settings-modern-footer button{min-height:40px;padding:8px 16px;border-radius:9px;background:var(--sc-surface-raised);font-size:.84rem;font-weight:600}
.settings-confirm-dialog{width:min(420px,calc(100vw - 24px));padding:22px;border:1px solid var(--sc-border);border-radius:14px}
.settings-confirm-dialog h2{font-size:1.08rem}
.settings-confirm-actions{justify-content:flex-end}
@media(max-width:560px){
 #settingsDialog.settings-dialog-modern{width:calc(100vw - 16px)!important;max-height:calc(100dvh - 16px);margin:8px auto!important}
 #settingsDialog .settings-dialog-header{padding:14px 15px}
 #settingsDialog .settings-modern-body{max-height:calc(100dvh - 128px);padding:0 15px}
 #settingsDialog .settings-group{padding:16px 0}
 #settingsDialog .settings-day-pills{grid-template-columns:repeat(4,minmax(0,1fr))}
 #settingsDialog .settings-sound-head{display:none}
 #settingsDialog .settings-sound-row{grid-template-columns:58px minmax(0,1fr) 42px}
 #settingsDialog .settings-range{grid-template-columns:58px minmax(0,1fr)}
 #settingsDialog .settings-modern-footer{padding:10px 15px}
}
@media(max-width:360px){
 #settingsDialog .settings-segmented{grid-template-columns:1fr}
 #settingsDialog .settings-segmented-two{grid-template-columns:1fr 1fr}
 #settingsDialog .settings-day-pills{grid-template-columns:repeat(3,minmax(0,1fr))}
 #settingsDialog .settings-sound-row{grid-template-columns:1fr 42px}
 #settingsDialog .settings-sound-row label{grid-column:1/-1}
 #settingsDialog .settings-range{grid-template-columns:1fr}
}

/* Active time format is distinctly colored; inactive stays neutral. */
html[data-theme] #settingsDialog #timeFormatSegment button[aria-pressed="false"]{background:var(--sc-surface-raised)!important;border:1px solid transparent!important;color:var(--sc-muted)!important;box-shadow:none!important}
html[data-theme] #settingsDialog #timeFormatSegment button[aria-pressed="false"]:hover{background:var(--sc-surface-soft)!important;color:var(--sc-text)!important}
html[data-theme="light"] #settingsDialog #timeFormatSegment button[aria-pressed="true"]{background:#236b53!important;border:1px solid #236b53!important;color:#fff!important;box-shadow:none!important}
html[data-theme="dark"] #settingsDialog #timeFormatSegment button[aria-pressed="true"]{background:#8adcb8!important;border:1px solid #8adcb8!important;color:#173c2d!important;box-shadow:none!important}

/* Header controls: match the Focus view button in both themes. */
html[data-theme] header .group-timer-nav,
html[data-theme] header #focusView,
html[data-theme] header #lowStimulationToggle,
html[data-theme] header #openSettings {
  background:var(--sc-button-bg)!important;
  border:1px solid var(--sc-button-border)!important;
  color:var(--sc-button-text)!important;
  border-radius:10px!important;
  box-shadow:none!important;
}
html[data-theme] header .group-timer-nav:hover,
html[data-theme] header #focusView:hover,
html[data-theme] header #lowStimulationToggle:hover,
html[data-theme] header #openSettings:hover {
  background:var(--sc-button-bg-hover)!important;
  border-color:var(--sc-button-border)!important;
  color:var(--sc-button-text)!important;
  filter:none!important;
}
html[data-theme] header .group-timer-nav:focus-visible,
html[data-theme] header #focusView:focus-visible,
html[data-theme] header #lowStimulationToggle:focus-visible,
html[data-theme] header #openSettings:focus-visible {
  outline:2px solid var(--sc-accent-strong)!important;
  outline-offset:2px;
}

/* Focus view: show only the current-task timer. Keep Today/Timetable data intact. */
html[data-theme] body.today-dashboard-preview.focus-view .today-signature-head,
html[data-theme] body.today-dashboard-preview.focus-view .today-progress-card,
html[data-theme] body.today-dashboard-preview.focus-view .today-timeline-card,
html[data-theme] body.today-dashboard-preview.focus-view .today-manage-heading,
html[data-theme] body.today-dashboard-preview.focus-view .today-exam,
html[data-theme] body.today-dashboard-preview.focus-view .exam-countdown-card,
html[data-theme] body.today-dashboard-preview.focus-view .welcome-exam-only,
html[data-theme] body.today-dashboard-preview.focus-view .layout {
  display: none !important;
}
html[data-theme] body.today-dashboard-preview.focus-view .today-signature {
  grid-template-columns: minmax(0,1fr);
  gap: 0;
}

/* Prevent completion controls from widening narrow phone layouts. */
@media(max-width:480px){
  .today-dashboard-preview .today-timeline-item .today-timeline-actions{min-width:0;max-width:100%;width:100%;flex-direction:column;align-items:flex-start}
  .today-dashboard-preview .today-timeline-item .today-complete-btn{white-space:normal;max-width:100%;overflow-wrap:anywhere;text-align:left}
}
