/* ============ Tokens ============ */
:root {
  --bg: #eef2f8;
  --bg-glow-1: rgba(59, 130, 246, .16);
  --bg-glow-2: rgba(139, 92, 246, .12);
  --card: #ffffff;
  --card-2: #f7f9fc;
  --card-3: #eef2f9;
  --text: #172033;
  --text-soft: #33405a;
  --muted: #67738c;
  --line: #e3e8f1;
  --line-strong: #cfd8e8;
  --shadow: 0 18px 44px rgba(24, 38, 66, .10);
  --shadow-sm: 0 4px 16px rgba(24, 38, 66, .07);
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, .13);
  --accent-ring: rgba(59, 130, 246, .34);
  --accent-ink: #ffffff;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --radius: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --header-h: 74px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0b1019;
  --bg-glow-1: rgba(59, 130, 246, .18);
  --bg-glow-2: rgba(139, 92, 246, .14);
  --card: #141c29;
  --card-2: #101724;
  --card-3: #1a2433;
  --text: #e9effb;
  --text-soft: #c6d1e5;
  --muted: #93a2bc;
  --line: #243146;
  --line-strong: #33445e;
  --shadow: 0 22px 54px rgba(0, 0, 0, .45);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, .3);
  --accent-soft: rgba(59, 130, 246, .22);
  --accent-ring: rgba(59, 130, 246, .46);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 12% -8%, var(--bg-glow-1), transparent 62%),
    radial-gradient(900px 560px at 92% 4%, var(--bg-glow-2), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

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

/* ============ Layout ============ */
.app-shell { min-height: 100vh; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(16px, 4vw, 46px);
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}

.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }

.logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -.5px;
  color: #fff;
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #101a2e));
  box-shadow: 0 8px 20px var(--accent-ring);
  flex: none;
}

.logo--lg { width: 62px; height: 62px; border-radius: 19px; font-size: 23px; }

.brand-text { min-width: 0; }
.brand-text h1 { margin: 0; font-size: 19px; font-weight: 750; letter-spacing: -.3px; }
.brand-text p { margin: 1px 0 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.header-actions { display: flex; align-items: center; gap: 10px; flex: none; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.status-pill[data-state="ok"] .dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(22, 163, 74, .14); }
.status-pill[data-state="warn"] .dot { background: var(--warn); box-shadow: 0 0 0 4px rgba(217, 119, 6, .14); }
.status-pill[data-state="error"] .dot { background: var(--err); box-shadow: 0 0 0 4px rgba(220, 38, 38, .14); }
.status-pill[data-state="loading"] .dot { background: var(--accent); animation: pulse 1s ease-in-out infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.8); } }

.app-main {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 26px clamp(14px, 4vw, 38px) 80px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 15px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  transition: background .16s ease, border-color .16s ease, transform .12s ease, box-shadow .16s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; }

.btn-ghost { border-color: var(--line); background: var(--card); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { border-color: var(--line-strong); background: var(--card-2); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 8px 20px var(--accent-ring);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.btn-icon { width: 40px; height: 40px; padding: 0; border-color: var(--line); background: var(--card); box-shadow: var(--shadow-sm); }
.btn-icon:hover { background: var(--card-2); }
.btn-sm { min-height: 34px; padding: 6px 11px; font-size: 12.5px; border-radius: 10px; }

.link-btn {
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 650;
  padding: 2px 4px;
  border-radius: 6px;
}
.link-btn:hover { text-decoration: underline; }

.btn.is-loading .ico { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Section heads ============ */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.section-kicker { font-size: 11px; font-weight: 750; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); }
.section-hint { font-size: 12px; color: var(--muted); }

/* ============ Class bar ============ */
.class-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  overflow-x: auto;
  padding: 3px 2px 7px;
  scrollbar-width: thin;
}
.class-bar::-webkit-scrollbar { height: 6px; }
.class-bar::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }

.class-group { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.class-group + .class-group { padding-left: 14px; border-left: 1px solid var(--line); }

@media (min-width: 900px) {
  .class-bar:not(.class-bar--compact) { flex-wrap: wrap; overflow: visible; row-gap: 8px; }
  .class-bar:not(.class-bar--compact) .class-group { flex-wrap: wrap; }
}

.class-chip {
  min-width: 45px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
  text-align: center;
  transition: all .15s ease;
  box-shadow: 0 1px 2px rgba(20, 33, 58, .04);
}
.class-chip:hover { border-color: var(--accent); color: var(--accent); }
.class-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 6px 16px var(--accent-ring);
}
.class-bar--compact { gap: 9px; overflow: visible; flex-wrap: wrap; padding-bottom: 2px; }
.class-bar--compact .class-group { flex-wrap: wrap; }
.class-bar--compact .class-group + .class-group { border-left: 0; padding-left: 0; }

/* ============ Week strip ============ */
.week-strip {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 3px 2px 9px;
  scrollbar-width: thin;
}
.week-strip::-webkit-scrollbar { height: 6px; }
.week-strip::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }

.day-card {
  position: relative;
  flex: 1 0 96px;
  max-width: 150px;
  min-width: 88px;
  padding: 10px 10px 9px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  text-align: center;
  transition: all .16s ease;
}
.day-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.day-card.is-active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 8px 18px var(--accent-ring); }
.day-card .day-name { display: block; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.day-card .day-num { display: block; font-size: 24px; font-weight: 800; letter-spacing: -1px; line-height: 1.15; margin-top: 2px; }
.day-card .day-month { display: block; font-size: 11.5px; color: var(--muted); }
.day-card.is-active .day-name, .day-card.is-active .day-month { color: var(--text-soft); }
.day-card .today-tag {
  position: absolute;
  top: -7px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: var(--accent-ink);
  font-size: 9.5px; font-weight: 750; letter-spacing: .5px; text-transform: uppercase;
  padding: 2px 7px; border-radius: 99px; white-space: nowrap;
}
.day-card .update-dot {
  position: absolute; top: 8px; right: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--warn); box-shadow: 0 0 0 3px rgba(217, 119, 6, .16);
}

/* ============ Cards ============ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ============ Viewer ============ */
.viewer { overflow: hidden; }

.viewer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px;
  flex-wrap: wrap;
}

.viewer-title { min-width: 0; }
.viewer-day { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.viewer-day h2 { margin: 0; font-size: 21px; font-weight: 780; letter-spacing: -.4px; }
.viewer-title p { margin: 3px 0 0; font-size: 13px; }

.badge {
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: .6px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fde68a;
}
[data-theme="dark"] .badge { color: #fcd34d; background: rgba(217, 119, 6, .16); border-color: rgba(217, 119, 6, .35); }

.viewer-tools { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.tools-right { display: flex; align-items: center; gap: 8px; }

.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 12px;
  background: var(--card-2);
  border: 1px solid var(--line);
}
.seg-btn {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--muted);
  transition: all .15s ease;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.is-active { background: var(--card); color: var(--accent); box-shadow: var(--shadow-sm); }

.zoom {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card-2);
}
.zoom-btn {
  width: 28px; height: 28px;
  border: 0; background: transparent;
  border-radius: 8px;
  font-size: 17px; font-weight: 600; line-height: 1;
  color: var(--text-soft);
}
.zoom-btn:hover { background: var(--card); color: var(--accent); }
.zoom-label { min-width: 44px; text-align: center; font-size: 11.5px; font-weight: 650; color: var(--muted); font-variant-numeric: tabular-nums; }

.viewer-body {
  position: relative;
  min-height: 300px;
  max-height: min(70vh, 820px);
  overflow: auto;
  padding: 16px;
  background:
    linear-gradient(var(--card-2), var(--card-2)) padding-box,
    repeating-linear-gradient(45deg, transparent 0 14px, color-mix(in srgb, var(--line) 40%, transparent) 14px 15px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}
.viewer-body::-webkit-scrollbar { width: 9px; height: 9px; }
.viewer-body::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }

.schedule-canvas { display: block; margin: 0 auto; border-radius: 8px; background: #fff; box-shadow: 0 10px 26px rgba(15, 26, 45, .13); }
.schedule-full { display: block; margin: 0 auto; border-radius: 8px; background: #fff; box-shadow: 0 10px 26px rgba(15, 26, 45, .13); max-width: none; }
.schedule-canvas[hidden], .schedule-full[hidden] { display: none; }

.viewer-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13.5px;
  background: color-mix(in srgb, var(--card-2) 82%, transparent);
  backdrop-filter: blur(2px);
}
.viewer-loading[hidden] { display: none; }

.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}

.empty-state {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 28px;
  background: color-mix(in srgb, var(--card-2) 88%, transparent);
  backdrop-filter: blur(3px);
}
.empty-state[hidden] { display: none; }
.empty-state .empty-icon { font-size: 38px; }
.empty-state h3 { margin: 4px 0 0; font-size: 17px; }
.empty-state p { margin: 0 0 10px; color: var(--muted); font-size: 13px; max-width: 340px; }

.viewer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px 15px;
  flex-wrap: wrap;
}
.viewer-note { margin: 0; font-size: 12.5px; color: var(--muted); max-width: 640px; }
.viewer-source { font-size: 11.5px; color: var(--muted); }

/* ============ Notes ============ */
.notes { padding: 18px 20px 20px; }
.notes-head h3 { margin: 0 0 8px; font-size: 15px; }
.notes ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.notes li { font-size: 13px; color: var(--text-soft); }

/* ============ Footer ============ */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 6px 4px 0;
  font-size: 12px;
  color: var(--muted);
}
.footer-sep { margin: 0 4px; opacity: .55; }
.footer-link {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--muted) 45%, transparent);
  text-underline-offset: 2px;
}
.footer-link:hover { color: var(--accent); text-decoration-color: currentColor; }

/* ============ Widget ============ */
.widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  width: 306px;
  max-width: calc(100vw - 28px);
  border-radius: 19px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: 0 24px 60px rgba(12, 22, 42, .28);
  overflow: hidden;
  animation: widgetIn .28s ease both;
}
.widget[hidden] { display: none; }
@keyframes widgetIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }

.widget-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 12px 9px 14px;
}
.widget-brand { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 750; color: var(--text-soft); }
.widget-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); animation: pulse 1.8s ease-in-out infinite; }
.widget-controls { display: flex; gap: 2px; }
.widget-btn { border: 0; background: transparent; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.widget-btn:hover { background: var(--card-2); color: var(--text); }

.widget-body { padding: 0 14px 14px; }
.widget-now { font-size: 10.5px; font-weight: 750; letter-spacing: 1.3px; text-transform: uppercase; color: var(--accent); }
.widget-lesson { font-size: 22px; font-weight: 800; letter-spacing: -.6px; margin-top: 1px; }
.widget-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; min-height: 18px; }

.widget-mini {
  margin-top: 11px;
  border-radius: 11px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--card-2);
  max-height: 128px;
}
.widget-mini canvas { display: block; width: 100%; height: auto; }

.widget-open-full {
  width: 100%;
  margin-top: 10px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text-soft);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12.5px;
  font-weight: 650;
}
.widget-open-full:hover { border-color: var(--accent); color: var(--accent); }

.widget.is-collapsed .widget-body { display: none; }
.widget.is-collapsed .widget-top { padding-bottom: 11px; }

/* ============ Modals ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(7, 12, 22, .58);
  backdrop-filter: blur(7px);
  animation: fadeIn .18s ease both;
}
.modal-backdrop[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(4, 10, 22, .5);
  animation: modalIn .22s cubic-bezier(.2, .9, .3, 1.1) both;
  scrollbar-width: thin;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.modal--onboarding { width: min(620px, 100%); }
.modal--about { width: min(520px, 100%); }

.about-hero { padding: 26px 24px 0; text-align: center; }
.about-hero .logo { margin: 0 auto 12px; }
.about-hero h2 { margin: 0; font-size: 22px; letter-spacing: -.4px; }
.about-version { margin: 5px 0 0; font-size: 12px; color: var(--muted); }

.about-body { padding: 20px 24px 4px; display: flex; flex-direction: column; gap: 16px; }
.about-author {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card-2);
}
.about-author-label {
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
}
.about-author-name { margin-top: 3px; font-size: 17px; font-weight: 750; }
.about-author-link {
  display: inline-block;
  margin-top: 3px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.about-author-link:hover { text-decoration: underline; }

.about-text { margin: 0; font-size: 13px; line-height: 1.55; color: var(--text-soft); }
.about-text a { color: var(--accent); }

.about-license { border-left: 3px solid var(--accent); padding: 2px 0 2px 12px; }
.about-license-title { font-size: 12.5px; font-weight: 750; }
.about-license p { margin: 4px 0 0; font-size: 12px; line-height: 1.5; color: var(--muted); }

.about-copy { font-size: 11.5px; color: var(--muted); }

.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px 6px; }
.modal-head h2 { margin: 0; font-size: 20px; letter-spacing: -.3px; }

.modal-body { padding: 12px 22px 4px; display: flex; flex-direction: column; gap: 20px; }

.field { display: flex; flex-direction: column; gap: 9px; }
.field-label { font-size: 13px; font-weight: 700; }
.field-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.field-row { flex-direction: row; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--card-2); }

.theme-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.theme-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 10px 8px 9px;
  border-radius: 13px;
  border: 1.5px solid var(--line);
  background: var(--card-2);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
  transition: all .15s ease;
}
.theme-card:hover { border-color: var(--line-strong); }
.theme-card.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.theme-swatch { width: 100%; height: 38px; border-radius: 8px; border: 1px solid var(--line); }
.theme-swatch--light { background: linear-gradient(180deg, #fff 0 55%, #e9eef7 100%); }
.theme-swatch--dark { background: linear-gradient(180deg, #1b2536 0 55%, #0c121c 100%); }
.theme-swatch--system { background: linear-gradient(115deg, #fff 0 49%, #151d2a 51% 100%); }

.accent-options { display: flex; gap: 10px; flex-wrap: wrap; }
.accent-option {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--swatch);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, #fff 55%, transparent);
  transition: transform .12s ease, box-shadow .15s ease;
  position: relative;
}
.accent-option:hover { transform: scale(1.08); }
.accent-option.is-active { box-shadow: 0 0 0 2px var(--card), 0 0 0 5px var(--swatch); }
.accent-option .tick { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 15px; font-weight: 800; opacity: 0; }
.accent-option.is-active .tick { opacity: 1; }

.switch { position: relative; display: inline-flex; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track {
  width: 46px; height: 27px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background .18s ease;
  display: block;
  padding: 3px;
}
.switch-thumb {
  display: block;
  width: 21px; height: 21px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .22);
  transition: transform .18s cubic-bezier(.3, .9, .4, 1.2);
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(19px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--accent-ring); outline-offset: 2px; }

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px 20px;
}

/* ============ Onboarding ============ */
.onboarding-hero { padding: 28px 26px 6px; text-align: center; }
.onboarding-hero .logo { margin: 0 auto 14px; }
.onboarding-hero h2 { margin: 0 0 7px; font-size: 23px; letter-spacing: -.5px; }
.onboarding-hero p { margin: 0 auto; max-width: 430px; color: var(--muted); font-size: 13.5px; }
.onboarding-body { padding: 18px 26px 6px; }
.onboarding-hint { font-size: 12.5px; color: var(--muted); }

/* ============ Toasts ============ */
.toasts {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(440px, calc(100vw - 28px));
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 15px;
  border-radius: 12px;
  background: var(--text);
  color: var(--card);
  font-size: 13px;
  font-weight: 550;
  box-shadow: 0 14px 34px rgba(5, 12, 24, .34);
  animation: toastIn .22s ease both;
  max-width: 100%;
}
.toast.is-out { animation: toastOut .2s ease both; }
.toast .ico { width: 16px; height: 16px; }
.toast--ok .ico { color: #4ade80; }
.toast--err .ico { color: #f87171; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px) scale(.98); } }

/* ============ Responsive ============ */
@media (max-width: 820px) {
  .app-header { padding: 12px 16px; }
  .brand-text h1 { font-size: 17px; }
  .brand-text p { display: none; }
  .status-pill { display: none; }
  .btn-label { display: none; }
  .viewer-head { padding: 15px 15px 12px; }
  .viewer-day h2 { font-size: 18px; }
  .viewer-tools { width: 100%; justify-content: space-between; }
  .tools-right { margin-left: auto; }
  .viewer-body { padding: 10px; max-height: 64vh; }
  .viewer-foot { padding: 11px 15px 14px; }
  .notes { padding: 15px 16px 17px; }
  .widget { right: 10px; bottom: 10px; width: 270px; }
  .modal-body { padding: 10px 16px 2px; }
  .modal-head { padding: 16px 16px 4px; }
  .modal-foot { padding: 14px 16px 16px; }
  .onboarding-hero { padding: 22px 18px 4px; }
  .onboarding-body { padding: 14px 18px 4px; }
}

@media (max-width: 520px) {
  .app-main { padding-top: 18px; gap: 15px; }
  .week-strip { gap: 7px; }
  .day-card { flex-basis: 78px; min-width: 78px; padding: 8px 7px; }
  .day-card .day-num { font-size: 21px; }
  .seg-btn { padding: 6px 9px; }
  .zoom-label { min-width: 38px; }
  .theme-options { grid-template-columns: repeat(3, 1fr); }
  .widget { width: calc(100vw - 20px); right: 10px; bottom: 10px; }
  .modal-foot { flex-wrap: wrap; }
  .toasts { bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ============ Text schedule (v2) ============ */
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.is-active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.class-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 13px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.logo-img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }

.day-card.is-missing { opacity: .5; }
.day-card.is-missing:hover { opacity: .8; }

.lesson-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 2px;
}

.lesson {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 15px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, transform .12s ease;
}
.lesson:hover { border-color: var(--line-strong); }
.lesson.is-now {
  border-color: var(--accent);
  background: linear-gradient(0deg, var(--accent-soft), var(--accent-soft)), var(--card);
  box-shadow: 0 10px 24px var(--accent-ring);
}

.lesson-num {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.lesson.is-now .lesson-num { background: var(--accent); color: var(--accent-ink); }

.lesson-main { min-width: 0; flex: 1; }
.lesson-subject { font-size: 15.5px; font-weight: 700; letter-spacing: -.2px; overflow-wrap: anywhere; }
.lesson-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.lesson-time { font-variant-numeric: tabular-nums; }
.lesson-room { color: var(--accent); font-weight: 650; }

.empty-actions { display: flex; gap: 9px; flex-wrap: wrap; justify-content: center; }

.icon-picker { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.icon-preview {
  width: 62px;
  height: 62px;
  border-radius: 19px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 23px;
  color: #fff;
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #101a2e));
  box-shadow: 0 8px 20px var(--accent-ring);
  flex: none;
  overflow: hidden;
}
.icon-picker-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.day-toggles { display: flex; flex-direction: column; gap: 8px; }
.day-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.day-toggle:hover { border-color: var(--line-strong); }
.day-toggle-name { color: var(--text-soft); }

@media (max-width: 820px) {
  .class-pill { order: -1; }
  .lesson { padding: 11px 12px; gap: 11px; }
  .lesson-num { width: 36px; height: 36px; font-size: 16px; }
}
