:root {
  --paper: #EEF1F4;
  --surface: #FFFFFF;
  --ink: #18202E;
  --muted: #5D6878;
  --line: #D7DDE4;
  --late: #B83A27;
  --focus: #2C5BD4;

  --r-s: 6px;
  --r-m: 12px;

  color-scheme: light dark;
  font-family: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

/* Dark mode follows the device unless Settings > Theme picks one. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #11151C;
    --surface: #1A2029;
    --ink: #E7EBF0;
    --muted: #98A3B3;
    --line: #2B3340;
    --late: #F07A66;
    --focus: #7EA2FF;
  }
}
:root[data-theme="dark"] {
  --paper: #11151C;
  --surface: #1A2029;
  --ink: #E7EBF0;
  --muted: #98A3B3;
  --line: #2B3340;
  --late: #F07A66;
  --focus: #7EA2FF;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

/* Accent colors (Settings > Appearance). Each has a light-mode and a dark-mode
   highlighter (--marker) and a stronger shade for ticked boxes (--deep).
   Any element can carry data-accent, which is how the study section shows in
   the study app's color. */
[data-accent="blue"]   { --marker-l: #85B7EB; --marker-d: #185FA5; --deep-l: #185FA5; --deep-d: #85B7EB; }
[data-accent="violet"] { --marker-l: #AFA9EC; --marker-d: #534AB7; --deep-l: #534AB7; --deep-d: #AFA9EC; }
[data-accent="yellow"] { --marker-l: #F2CF3A; --marker-d: #8F7517; --deep-l: #854F0B; --deep-d: #F2CF3A; }
[data-accent="teal"]   { --marker-l: #5DCAA5; --marker-d: #0F6E56; --deep-l: #0F6E56; --deep-d: #5DCAA5; }
[data-accent="coral"]  { --marker-l: #F0997B; --marker-d: #993C1D; --deep-l: #993C1D; --deep-d: #F0997B; }
[data-accent="pink"]   { --marker-l: #ED93B1; --marker-d: #993556; --deep-l: #993556; --deep-d: #ED93B1; }
[data-accent="green"]  { --marker-l: #97C459; --marker-d: #3B6D11; --deep-l: #3B6D11; --deep-d: #97C459; }

:root, [data-accent] {
  --marker: var(--marker-l, #85B7EB);
  --deep: var(--deep-l, #185FA5);
  --on-marker: #18202E;
  --on-deep: #FFFFFF;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]), :root:not([data-theme="light"]) [data-accent] {
    --marker: var(--marker-d, #185FA5);
    --deep: var(--deep-d, #85B7EB);
    --on-marker: #FFFFFF;
    --on-deep: #11151C;
  }
}
:root[data-theme="dark"], :root[data-theme="dark"] [data-accent] {
  --marker: var(--marker-d, #185FA5);
  --deep: var(--deep-d, #85B7EB);
  --on-marker: #FFFFFF;
  --on-deep: #11151C;
}

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--paper); color: var(--ink); }

body { min-height: 100dvh; }

button, input, select { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.view {
  max-width: 34rem;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 1.75rem) 1.25rem calc(env(safe-area-inset-bottom, 0px) + 6.5rem);
  outline: none;
}

/* ---------- day header: the one loud thing ---------- */

.day-head { margin-bottom: 1.75rem; }

.day-name {
  display: inline;
  margin: 0;
  font-size: clamp(2.6rem, 12vw, 3.6rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  background: linear-gradient(transparent 58%, var(--marker) 58%, var(--marker) 88%, transparent 88%);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding-inline: 0.06em;
}

.day-sub { margin: 0.55rem 0 0; color: var(--muted); font-size: 1.05rem; }

/* ---------- sections ---------- */

.section-title { font-size: 1.1rem; font-weight: 600; margin: 2rem 0 0.75rem; }

.sub-title { font-size: 0.95rem; font-weight: 500; color: var(--muted); margin: 1.25rem 0 0.5rem; }

.empty { color: var(--muted); margin: 0.25rem 0; }

.notice {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--r-m);
  background: var(--surface);
  border-inline-start: 4px solid var(--marker);
}

.notice .btn { margin-top: 0.6rem; }

/* ---------- timeline ---------- */

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }

.slot { display: grid; grid-template-columns: 3.4rem 1fr; gap: 0.75rem; }

.slot-time {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.65rem 0;
  font-weight: 500;
  align-items: flex-end;
  font-variant-numeric: tabular-nums;
}

.slot-end { color: var(--muted); font-size: 0.85rem; font-weight: 400; }

.slot-body {
  position: relative;
  min-height: max(4.25rem, calc(var(--len) * 1px));
  padding: 0.65rem 0.9rem;
  background: var(--surface);
  border-radius: var(--r-s);
  border-inline-start: 5px solid var(--c);
}

.slot-course { margin: 0; font-weight: 500; }

.slot-meta { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.9rem; }

.slot.is-now .slot-body { box-shadow: inset 0 0 0 2px var(--marker); }

.now-tag {
  position: absolute;
  inset-inline-end: 0.6rem;
  top: 0.6rem;
  padding: 0 0.4rem;
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--marker);
  color: var(--on-marker);
  border-radius: 4px;
}

.gap { color: var(--muted); font-size: 0.85rem; padding-inline-start: 4.15rem; }

/* ---------- checklist ---------- */

.tasks {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border-radius: var(--r-m);
  overflow: hidden;
}

.task + .task { border-top: 1px solid var(--line); }

.task label {
  position: relative;
  display: grid;
  grid-template-columns: 1.5rem 1fr;
  gap: 0.8rem;
  align-items: start;
  padding: 0.85rem 1rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.task input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.check {
  width: 1.4rem;
  height: 1.4rem;
  margin-top: 0.05rem;
  border: 2px solid var(--muted);
  border-radius: 5px;
  display: grid;
  place-items: center;
}

.task input:checked + .check { background: var(--deep); border-color: var(--deep); }

.task input:checked + .check::after {
  content: "";
  width: 0.4rem;
  height: 0.75rem;
  border: solid var(--on-deep);
  border-width: 0 2.5px 2.5px 0;
  transform: translateY(-1px) rotate(45deg);
}

.task input:focus-visible + .check { outline: 2px solid var(--focus); outline-offset: 2px; }

.task-course { display: flex; flex-wrap: wrap; align-items: center; column-gap: 0.5rem; font-weight: 500; }

.task-title { color: var(--muted); font-weight: 400; }

.task-course::before {
  content: "";
  flex: none;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--c);
}

.task-detail { display: block; color: var(--muted); font-size: 0.9rem; margin-top: 0.1rem; }

.task.is-late .task-detail { color: var(--late); font-weight: 500; }

.task.is-done .task-course bdi { color: var(--muted); text-decoration: line-through; }
.task.is-done .task-detail { color: var(--muted); font-weight: 400; }

.plain-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--r-m); }
.plain-list li { padding: 0.8rem 1rem; }
.plain-list li + li { border-top: 1px solid var(--line); }

/* ---------- tabs ---------- */

.tabs {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}

.tabs[hidden] { display: none; }

.tabs a {
  flex: 1;
  max-width: 11rem;
  padding: 0.95rem 0 1.05rem;
  text-align: center;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.tabs a span { position: relative; padding-inline: 0.15em; }

.tabs a[aria-current="page"] { color: var(--ink); }

.tabs a[aria-current="page"] span {
  background: linear-gradient(transparent 55%, var(--marker) 55%, var(--marker) 90%, transparent 90%);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0 1.1rem;
  border: none;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 500;
  cursor: pointer;
}

.btn-secondary { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }

.btn-text {
  min-height: 2.25rem;
  padding: 0 0.5rem;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 6px;
}

.btn-text.danger { color: var(--late); }

.btn:disabled { opacity: 0.5; cursor: default; }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.9rem; }

/* ---------- settings ---------- */

.panel { background: var(--surface); border-radius: var(--r-m); padding: 1rem; }

.panel + .panel { margin-top: 0.6rem; }

.hint { color: var(--muted); font-size: 0.9rem; margin: 0.5rem 0 0; }

.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.75rem; align-items: start; }

.field { display: grid; gap: 0.3rem; align-content: start; min-width: 0; font-size: 0.9rem; color: var(--muted); }

.field input, .field select {
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: 1rem;
}

.field input[type="color"] { padding: 0.25rem; height: 2.75rem; }

.course { background: var(--surface); border-radius: var(--r-m); }
.course + .course { margin-top: 0.6rem; }

.course > summary {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.9rem 1rem;
  list-style: none;
  cursor: pointer;
  font-weight: 500;
}

.course > summary::-webkit-details-marker { display: none; }

.swatch { flex: none; width: 0.9rem; height: 0.9rem; border-radius: 50%; background: var(--c); }

.course-count { margin-inline-start: auto; color: var(--muted); font-size: 0.85rem; font-weight: 400; }

.course-body { padding: 0 1rem 1rem; border-top: 1px solid var(--line); }

.course-body .sub-title:first-child { margin-top: 0.9rem; }

.rows { list-style: none; margin: 0; padding: 0; }

.rows li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0;
}

.rows li + li { border-top: 1px dashed var(--line); }

.row-text { flex: 1; min-width: 0; }

.row-sub { display: block; color: var(--muted); font-size: 0.85rem; }

.course-actions { display: flex; gap: 0.25rem; margin-top: 1rem; padding-top: 0.6rem; border-top: 1px solid var(--line); }

/* ---------- dialog ---------- */

.sheet {
  width: min(30rem, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 2rem);
  padding: 1.25rem;
  border: none;
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
}

.sheet::backdrop { background: rgb(10 14 20 / 0.45); }

.sheet h2 { margin: 0 0 1rem; font-size: 1.2rem; font-weight: 600; }

.form { display: grid; gap: 0.9rem; }

.form-preview { margin: 0; padding: 0.6rem 0.8rem; background: var(--paper); border-radius: 8px; font-size: 0.9rem; }

.form-error { margin: 0; color: var(--late); font-size: 0.9rem; }
.form-error:empty { display: none; }

.form .btn-row { justify-content: flex-end; margin-top: 0.25rem; }

/* ---------- login ---------- */

.login { display: grid; gap: 1rem; max-width: 22rem; margin: 18vh auto 0; }
.login .day-name { justify-self: start; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 4.75rem);
  z-index: 20;
  max-width: calc(100vw - 2rem);
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.95rem;
  transform: translate(-50%, 0.5rem);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}

/* ---------- exams ---------- */

.exams { display: grid; gap: 0.6rem; margin-bottom: 0.5rem; }

.exam {
  padding: 0.85rem 1rem;
  background: var(--surface);
  border-radius: var(--r-m);
  border-inline-start: 5px solid var(--c);
}

.exam p { margin: 0; }

.exam-when { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem; margin-bottom: 0.4rem !important; }

.exam-date { font-weight: 500; }

.exam-countdown { color: var(--muted); font-size: 0.9rem; }

.exam-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.35rem 0.75rem; }

.exam-course { font-size: 1.15rem; font-weight: 600; }

.exam-tags { display: flex; gap: 0.35rem; }

.exam-tag {
  display: inline-block;
  padding: 0 0.45rem;
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--marker);
  color: var(--on-marker);
  border-radius: 4px;
}

.exam-sitting {
  display: inline-block;
  padding: 0 0.45rem;
  font-size: 0.85rem;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1.5px var(--line);
}

.exam-meta { color: var(--muted); margin-top: 0.2rem !important; font-variant-numeric: tabular-nums; }

.exam-note { margin-top: 0.35rem !important; font-size: 0.95rem; }

.exam-actions { display: flex; gap: 0.25rem; margin-top: 0.5rem; margin-inline-start: -0.5rem; }

.exam.is-past { opacity: 0.7; }

.past-exams > summary { cursor: pointer; color: var(--muted); }

/* a class replaced by a test */
.slot.is-blocked .slot-body {
  background-image: repeating-linear-gradient(
    135deg, transparent 0 9px, color-mix(in srgb, var(--line) 70%, transparent) 9px 11px);
}

.slot-test { margin: 0.25rem 0 0; font-size: 0.9rem; }

/* ---------- notification settings ---------- */

.notify-days { list-style: none; margin: 0; padding: 0; }

.notify-day { display: grid; gap: 0.35rem; padding: 0.7rem 0; }

.notify-day + .notify-day { border-top: 1px dashed var(--line); }

.notify-day-name { font-weight: 500; }

.notify-day-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1.25rem; }

.toggles { display: grid; gap: 0.5rem; }

.toggle { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.25rem; cursor: pointer; }

.toggle input { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--deep); }

.toggle.is-disabled { color: var(--muted); cursor: default; }

.toggle-time { display: inline-flex; align-items: center; gap: 0.6rem; }

.time-input {
  width: 5.5em;
  min-height: 2.25rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.95rem;
}

.time-input:disabled { opacity: 0.45; }

.panel select, .panel .field select { max-width: 100%; }

/* ---------- course code and notes ---------- */

.slot-notes {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.slot.is-now .slot-notes { padding-inline-end: 3.5rem; }

.course-info { padding-top: 0.9rem; }

.course-info p { margin: 0; }

.course-code { color: var(--muted); font-size: 0.9rem; }

.course-notes { margin-top: 0.35rem !important; white-space: pre-line; overflow-wrap: anywhere; }

.field textarea {
  width: 100%;
  min-width: 0;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  resize: vertical;
}

/* ---------- date picker ---------- */

.date-input {
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  text-align: start;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.date-placeholder { color: var(--muted); }

.date-sheet { width: min(21rem, calc(100vw - 1.5rem)); padding: 1rem; }

.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }

.cal-title { margin: 0 !important; font-size: 1.1rem; font-weight: 600; }

.cal-nav {
  width: 2.75rem;
  height: 2.75rem;
  border: none;
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; text-align: center; }

.cal-wd { padding: 0.25rem 0; font-size: 0.8rem; color: var(--muted); }

.cal-day {
  min-height: 2.6rem;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--ink);
  font: inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.cal-day.is-today { font-weight: 600; box-shadow: inset 0 0 0 1.5px var(--line); }

.cal-day.is-selected { background: var(--ink); color: var(--paper); box-shadow: none; }

.cal-foot { justify-content: flex-end; align-items: center; margin-top: 0.75rem; }

.exam-notify { margin-top: 1.25rem; padding-top: 0.25rem; border-top: 1px solid var(--line); }

/* ---------- schedule ---------- */

.seg {
  display: inline-flex;
  padding: 3px;
  margin-bottom: 1rem;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.seg-btn {
  min-height: 2.25rem;
  padding: 0 0.95rem;
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.seg-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.wk-nav { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.9rem; }

.wk-range { display: grid; justify-items: center; text-align: center; font-weight: 600; }

.wk-this { color: var(--muted); font-size: 0.85rem; font-weight: 400; }

.wk-range .btn-text { min-height: 1.75rem; font-size: 0.85rem; }

.wk {
  --wk-axis: 2.6rem;
  background: var(--surface);
  border-radius: var(--r-m);
  overflow: hidden;
}

.wk-row { display: grid; grid-template-columns: var(--wk-cols); }

.wk-head { border-bottom: 1px solid var(--line); }

.wk-day { display: grid; justify-items: center; padding: 0.45rem 0 0.4rem; min-width: 0; }

.wk-wd { font-size: 0.78rem; color: var(--muted); }

.wk-date { font-weight: 600; font-variant-numeric: tabular-nums; padding: 0 0.3rem; border-radius: 4px; }

.wk-day.is-today .wk-wd { color: var(--ink); font-weight: 500; }

.wk-day.is-today .wk-date { background: var(--marker); color: var(--on-marker); }

.wk-allday { border-bottom: 1px solid var(--line); }

.wk-allday-cell { display: grid; gap: 2px; padding: 3px 1px; min-width: 0; }

.wk-chip {
  display: block;
  width: 100%;
  padding: 2px 3px;
  border: none;
  border-radius: 4px;
  border-inline-start: 3px solid var(--c);
  background: color-mix(in srgb, var(--marker) 25%, var(--surface));
  color: var(--ink);
  font: inherit;
  font-size: 0.7rem;
  line-height: 1.25;
  text-align: start;
  overflow: hidden;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.wk-chip .exam-tag { font-size: 0.65rem; padding: 0 0.25rem; }

.wk-body { position: relative; }

.wk-axis { position: relative; }

.wk-hour {
  position: absolute;
  inset-inline: 0;
  transform: translateY(-50%);
  font-size: 0.68rem;
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.wk-hour.is-first { transform: none; }
.wk-hour.is-last { transform: translateY(-100%); }

.wk-col {
  position: relative;
  min-width: 0;
  border-inline-start: 1px solid var(--line);
  background-image: linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 100% var(--hour);
}

.wk-col.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: repeating-linear-gradient(
    135deg, transparent 0 7px, color-mix(in srgb, var(--line) 60%, transparent) 7px 9px);
  background-size: auto;
}

.wk-off {
  writing-mode: vertical-rl;
  padding: 0.5rem 0;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--surface);
  border-radius: 4px;
  max-height: 100%;
  overflow: hidden;
}

.wk-block {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 3px 3px 3px 4px;
  border: none;
  border-radius: 4px;
  border-inline-start: 3px solid var(--c);
  background: color-mix(in srgb, var(--c) 16%, var(--surface));
  color: var(--ink);
  font: inherit;
  text-align: start;
  overflow: hidden;
  cursor: pointer;
}

.wk-block.is-exam { background: color-mix(in srgb, var(--marker) 30%, var(--surface)); }

.wk-block.is-blocked {
  background-image: repeating-linear-gradient(
    135deg, transparent 0 6px, color-mix(in srgb, var(--line) 80%, transparent) 6px 8px);
}

.wk-name {
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.2;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}

.wk-time { font-size: 0.66rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.wk-tag {
  padding: 0 0.2rem;
  font-size: 0.6rem;
  font-weight: 600;
  background: var(--marker);
  color: var(--on-marker);
  border-radius: 3px;
}

.wk-now {
  position: absolute;
  inset-inline: 0;
  height: 2px;
  background: var(--late);
  pointer-events: none;
  z-index: 2;
}

.detail { display: grid; gap: 0.4rem; margin-bottom: 1rem; }
.detail p { margin: 0; }
.detail-time { font-variant-numeric: tabular-nums; }
.detail-note { white-space: pre-line; color: var(--muted); overflow-wrap: anywhere; }
.detail .exam-tags { display: flex; gap: 0.35rem; }

/* five tabs: keep labels on one line on narrow phones */
.tabs a { white-space: nowrap; }

@media (max-width: 420px) {
  .tabs a { font-size: 0.85rem; padding-inline: 0.15rem; }
}

/* ---------- appearance ---------- */

.swatches { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.swatch-btn {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--marker-l);
  cursor: pointer;
}

.swatch-btn[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--ink); }

.panel .seg { margin: 0; }

/* ---------- study section (blocks from the study app) ---------- */

.study-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }

.study-link { font-size: 0.9rem; font-weight: 500; color: var(--deep); text-decoration: none; padding: 0.4rem 0; }

.study-foot { margin: 0.6rem 0.1rem 0; color: var(--muted); font-size: 0.9rem; }

.study .notice { border-inline-start-color: var(--deep); margin-top: 0.75rem; }

.plan-rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--r-m); }

.plan-rows li { display: grid; grid-template-columns: 6.2rem 1fr; gap: 0.6rem; padding: 0.8rem 1rem; }

.plan-rows li + li { border-top: 1px solid var(--line); }

.plan-time { font-weight: 500; font-variant-numeric: tabular-nums; font-size: 0.95rem; }

.plan-rows .task-course::before { margin-top: 0; }

.task-add { margin-top: 0.5rem; }

/* =================== study app =================== */

a.btn { text-decoration: none; }

.label { margin: 0; font-size: 0.9rem; color: var(--muted); }

.notice.deep { border-inline-start-color: var(--deep); }
.notice-title { margin: 0; font-weight: 600; font-size: 1.05rem; }
.notice-body { margin: 0.25rem 0 0; color: var(--muted); }

.foot-note { margin: 0.6rem 0.1rem 0; color: var(--muted); font-size: 0.9rem; }

.section-title .aside { font-size: 0.9rem; font-weight: 400; color: var(--muted); }
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }

/* exam countdowns */
.exams-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; margin: 0 0 0.5rem; }
.exams-grid .exam { padding: 0.75rem 0.9rem; }
.exams-grid .exam-course { font-size: 1.05rem; }
.exams-grid .exam-tags { margin: 0.35rem 0 !important; }
.exam-line { color: var(--muted); font-size: 0.88rem; }

/* progress */
.prog { margin: 1.4rem 0 0; }
.progmeta { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.5rem; font-size: 0.9rem; color: var(--muted); }
.progmeta b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.progbar { height: 8px; background: var(--surface); border-radius: 99px; overflow: hidden; }
.progfill { height: 100%; background: var(--deep); border-radius: 99px; transition: width 0.3s; }

.review-box { margin-top: 1rem; padding: 0.75rem 1rem; background: var(--surface); border-radius: var(--r-m); font-size: 0.95rem; }
.review-box b { display: block; margin-bottom: 0.1rem; font-size: 0.85rem; font-weight: 500; color: var(--muted); }

/* plan */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; margin-top: 1.25rem; }
.stat { padding: 0.75rem 0.9rem; background: var(--surface); border-radius: var(--r-m); }
.stat b { display: block; font-size: 1.5rem; font-weight: 500; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 0.88rem; }

.band { display: flex; align-items: center; gap: 0.75rem; margin: 1.6rem 0 0.1rem; font-size: 0.85rem; font-weight: 500; color: var(--muted); }
.band::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.fold {
  display: grid; grid-template-columns: auto 1fr auto; gap: 0.75rem; align-items: center;
  width: 100%; margin-top: 0.6rem; padding: 0.8rem 1rem;
  border: none; border-radius: var(--r-m); background: var(--surface); color: var(--ink);
  font: inherit; text-align: start; cursor: pointer;
}
.ok-dot { width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--deep); display: grid; place-items: center; }
.ok-dot::after {
  content: ""; width: 0.32rem; height: 0.65rem;
  border: solid var(--on-deep); border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg);
}
.fold-title { display: block; font-weight: 500; }
.fold-sub { display: block; color: var(--muted); font-size: 0.88rem; }
.fold-chev { color: var(--deep); font-size: 0.9rem; font-weight: 500; }
.fold-list { list-style: none; margin: 0.25rem 0 0; padding: 0.25rem 1rem; background: var(--surface); border-radius: var(--r-m); font-size: 0.9rem; color: var(--muted); }
.fold-list li { padding: 0.4rem 0; }
.fold-list li + li { border-top: 1px dashed var(--line); }

.day { margin-top: 0.6rem; background: var(--surface); border-radius: var(--r-m); overflow: hidden; }
.day.is-today { box-shadow: inset 0 0 0 2px var(--deep); }
.day-top { display: grid; grid-template-columns: auto 1fr auto; gap: 0.75rem; align-items: baseline; padding: 0.8rem 1rem 0.7rem; border-bottom: 1px solid var(--line); }
.day-n { font-weight: 600; font-size: 0.88rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.day-t { font-weight: 600; min-width: 0; }
.day-d { color: var(--muted); font-size: 0.88rem; white-space: nowrap; }
.tag {
  display: inline-block; margin-inline-start: 0.4rem; padding: 0 0.4rem;
  font-size: 0.78rem; font-weight: 500; border-radius: 4px;
  background: var(--marker); color: var(--on-marker); vertical-align: 0.1em;
}
.tag.plain { background: none; box-shadow: inset 0 0 0 1.5px var(--line); color: var(--muted); }
.day .tasks { border-radius: 0; background: transparent; }
.day .task label { padding: 0.7rem 1rem; }
.day-review { margin: 0; padding: 0.6rem 1rem 0.75rem; border-top: 1px solid var(--line); font-size: 0.88rem; color: var(--muted); }
.day-review b { font-weight: 500; color: var(--ink); margin-inline-end: 0.4rem; }

.gap-row { display: flex; gap: 0.75rem; margin-top: 0.6rem; padding: 0.55rem 1rem; border: 1px dashed var(--line); border-radius: var(--r-m); font-size: 0.88rem; color: var(--muted); }
.gap-row.trip { border-color: var(--deep); color: var(--deep); }
.plan-exam { margin-top: 0.6rem; }

.callout { padding: 0.85rem 1rem; background: var(--surface); border-radius: var(--r-m); border-inline-start: 4px solid var(--late); }
.callout.info { border-inline-start-color: var(--deep); }
.callout + .callout { margin-top: 0.6rem; }
.callout h3 { margin: 0 0 0.3rem; font-size: 1rem; }
.callout p { margin: 0 0 0.4rem; color: var(--muted); }
.callout ul { margin: 0; padding-inline-start: 1.2rem; color: var(--muted); }

/* settings */
.plan-name { margin: 0.1rem 0 0; font-weight: 600; font-size: 1.05rem; }
.stepper { display: inline-flex; align-items: center; margin-top: 0.6rem; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.stepper button { width: 2.75rem; height: 2.75rem; border: none; background: var(--paper); color: var(--ink); font: inherit; font-size: 1.25rem; cursor: pointer; }
.stepper output { min-width: 5rem; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.problems { margin: 0 0 1rem; padding-inline-start: 1.2rem; color: var(--muted); font-size: 0.9rem; max-height: 50vh; overflow: auto; }
.notify-block + .notify-block { margin-top: 0.9rem; padding-top: 0.9rem; border-top: 1px dashed var(--line); }
