/* =========================================================
   课表打卡 · Semester OS
   Dark, mobile-first personal timetable / check-in PWA
   ========================================================= */

:root {
  --bg: #090d12;
  --bg-soft: #0d1319;
  --panel: #111921;
  --panel-2: #151f28;
  --panel-3: #192530;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #edf3ec;
  --text-soft: #c3cdc5;
  --muted: #8795a2;
  --faint: #5d6a76;
  --accent: #c8f56d;
  --accent-strong: #aff148;
  --accent-ink: #172006;
  --accent-soft: rgba(200, 245, 109, 0.1);
  --accent-line: rgba(200, 245, 109, 0.3);
  --cyan: #77d8f5;
  --orange: #ffad66;
  --pink: #ff8094;
  --purple: #ae9bff;
  --yellow: #f2d36b;
  --danger: #ff7482;
  --danger-soft: rgba(255, 116, 130, 0.1);
  --success: #9ce7b0;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.2);
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 15px;
  --radius-sm: 10px;
  --sidebar-w: 252px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  background:
    radial-gradient(1100px 600px at 85% -10%, rgba(88, 139, 70, 0.13), transparent 62%),
    radial-gradient(850px 500px at 12% 105%, rgba(57, 113, 132, 0.1), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

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

button {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--accent);
  text-decoration: none;
}

svg {
  display: block;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

::selection {
  color: var(--accent-ink);
  background: var(--accent);
}

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

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 9px;
  transform: translateY(-150%);
  transition: transform 0.2s;
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------- shell ---------- */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: var(--sidebar-w);
  height: 100dvh;
  padding: 27px 19px 20px;
  background: rgba(10, 15, 20, 0.78);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  color: var(--text);
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 11px;
  box-shadow: 0 7px 24px rgba(200, 245, 109, 0.18);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.1;
}

.brand-copy strong {
  font-size: 17px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.brand-copy small {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
}

.semester-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 15px 15px 13px;
  overflow: hidden;
  background:
    linear-gradient(150deg, rgba(200, 245, 109, 0.075), transparent 62%),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.semester-card::after {
  position: absolute;
  top: -34px;
  right: -25px;
  width: 90px;
  height: 90px;
  content: "";
  background: radial-gradient(circle, rgba(200, 245, 109, 0.13), transparent 67%);
  pointer-events: none;
}

.mini-label {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.semester-card strong {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 650;
}

.semester-meta {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 11.5px;
}

.semester-meta span + span::before {
  margin-right: 7px;
  content: "·";
  color: var(--faint);
}

.term-track {
  height: 3px;
  margin-top: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
}

.term-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.45s var(--ease);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  position: relative;
  display: flex;
  gap: 11px;
  align-items: center;
  width: 100%;
  padding: 10px 11px;
  color: var(--muted);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  transition: color 0.18s, background 0.18s, border-color 0.18s;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  opacity: 0.9;
}

.nav-item span {
  font-size: 13.5px;
  font-weight: 600;
}

.nav-item kbd {
  margin-left: auto;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
  background: transparent;
  border: 0;
  opacity: 0;
  transition: opacity 0.18s;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
}

.nav-item:hover kbd {
  opacity: 1;
}

.nav-item.is-active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  border-color: var(--line);
}

.nav-item.is-active::before {
  position: absolute;
  top: 50%;
  left: -20px;
  width: 3px;
  height: 18px;
  content: "";
  background: var(--accent);
  border-radius: 0 4px 4px 0;
  transform: translateY(-50%);
}

.nav-item.is-active svg {
  color: var(--accent);
  opacity: 1;
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.sync-card {
  display: flex;
  gap: 9px;
  align-items: center;
  width: 100%;
  padding: 9px 10px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}

.sync-card:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line);
}

.sync-indicator {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  background: var(--faint);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.025);
}

.sync-indicator.is-synced {
  background: var(--accent);
}

.sync-indicator.is-syncing {
  background: var(--cyan);
  animation: pulse-dot 1.2s ease-in-out infinite;
}

.sync-indicator.is-error {
  background: var(--danger);
}

.sync-indicator.is-attention {
  background: var(--orange);
}

.sync-indicator.is-local {
  background: var(--faint);
}

.sync-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  line-height: 1.25;
}

.sync-copy strong {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-copy small {
  overflow: hidden;
  color: var(--faint);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-card > svg {
  width: 14px;
  height: 14px;
  color: var(--faint);
}

.install-link {
  display: flex;
  gap: 7px;
  align-items: center;
  width: fit-content;
  padding: 3px 4px;
  color: var(--muted);
  font-size: 11px;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.install-link:hover {
  color: var(--accent);
}

.install-link svg {
  width: 15px;
  height: 15px;
}

.sidebar-footnote {
  padding: 1px 4px;
  color: #46515c;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.main-wrap {
  min-width: 0;
}

.mobile-topbar {
  display: none;
}

.view-root {
  width: 100%;
  max-width: 1370px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 42px 43px 90px;
}

.bottom-nav {
  display: none;
}

/* ---------- common controls ---------- */

.button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 39px;
  padding: 8px 14px;
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s, background 0.18s, border-color 0.18s, color 0.18s;
}

.button:hover {
  color: var(--text);
  background: var(--panel-3);
  border-color: rgba(255, 255, 255, 0.2);
}

.button:active {
  transform: translateY(1px);
}

.button svg {
  width: 16px;
  height: 16px;
}

.button-primary {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.button-primary:hover {
  color: var(--accent-ink);
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.button-ghost {
  background: transparent;
}

.button-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(255, 116, 130, 0.2);
}

.button-danger:hover {
  color: #fff;
  background: rgba(255, 116, 130, 0.2);
  border-color: rgba(255, 116, 130, 0.4);
}

.button-small {
  min-height: 31px;
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 8px;
}

.button-wide {
  width: 100%;
}

.icon-btn {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  padding: 0;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  place-items: center;
  transition: color 0.18s, background 0.18s, border-color 0.18s;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--panel-2);
  border-color: var(--line-strong);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.icon-btn.is-accent {
  color: var(--accent);
}

.pill {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 4px 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.pill-accent {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.dot {
  width: 5px;
  height: 5px;
  background: currentColor;
  border-radius: 50%;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

/* ---------- page header ---------- */

.page-header {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 23px;
}

.page-kicker {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.page-kicker .accent-text {
  color: var(--accent);
}

.page-title {
  color: var(--text);
  font-size: clamp(29px, 3.5vw, 42px);
  font-weight: 720;
  line-height: 1.1;
  letter-spacing: -0.045em;
}

.page-title .weekday {
  display: inline-block;
  margin-left: 9px;
  color: var(--muted);
  font-size: 0.56em;
  font-weight: 500;
  letter-spacing: 0;
  transform: translateY(-2px);
}

.page-subtitle {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12.5px;
}

.header-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.date-switcher {
  display: flex;
  align-items: center;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.date-switcher .icon-btn {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
  background: transparent;
  border: 0;
  border-radius: 7px;
}

.date-switcher .icon-btn:hover {
  background: rgba(255, 255, 255, 0.055);
}

.today-button {
  padding: 4px 8px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.today-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
}

/* ---------- today hero ---------- */

.today-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(278px, 0.8fr);
  gap: 14px;
  margin-bottom: 14px;
}

.must-card {
  position: relative;
  display: flex;
  min-height: 236px;
  flex-direction: column;
  justify-content: space-between;
  padding: 26px 28px;
  overflow: hidden;
  background:
    linear-gradient(118deg, rgba(200, 245, 109, 0.13), rgba(200, 245, 109, 0.018) 47%, transparent 72%),
    linear-gradient(160deg, #17221a, #10171d 74%);
  border: 1px solid rgba(200, 245, 109, 0.19);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
}

.must-card::before {
  position: absolute;
  top: -90px;
  right: -20px;
  width: 260px;
  height: 260px;
  content: "";
  background: radial-gradient(circle, rgba(200, 245, 109, 0.12), transparent 64%);
  pointer-events: none;
}

.must-card::after {
  position: absolute;
  right: 27px;
  bottom: -35px;
  color: rgba(200, 245, 109, 0.035);
  font-family: Georgia, serif;
  font-size: 230px;
  font-weight: 700;
  line-height: 1;
  content: "✓";
  pointer-events: none;
}

.must-card.is-complete {
  border-color: var(--line);
  background:
    linear-gradient(150deg, rgba(156, 231, 176, 0.055), transparent 65%),
    var(--panel);
}

.must-card.is-complete::after {
  color: rgba(156, 231, 176, 0.035);
}

.must-kicker {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.must-kicker .pulse {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(200, 245, 109, 0.08);
  animation: pulse-dot 2.8s ease-in-out infinite;
}

.must-content {
  position: relative;
  z-index: 1;
  max-width: 88%;
  margin: 15px 0 17px;
}

.must-title {
  color: #f5f9ec;
  font-size: clamp(23px, 2.7vw, 33px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.must-detail {
  max-width: 630px;
  margin-top: 10px;
  color: #aebbaa;
  font-size: 12.5px;
  line-height: 1.7;
}

.must-footer {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.must-meta {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}

.must-check {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 36px;
  padding: 7px 13px;
  color: var(--accent-ink);
  font-size: 11.5px;
  font-weight: 700;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.18s, transform 0.15s;
}

.must-check:hover {
  background: var(--accent-strong);
}

.must-check:active {
  transform: translateY(1px);
}

.must-check.is-done {
  color: var(--success);
  background: rgba(156, 231, 176, 0.1);
  border-color: rgba(156, 231, 176, 0.18);
}

.must-check svg {
  width: 15px;
  height: 15px;
}

.hero-side {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 14px;
  min-width: 0;
}

.progress-card {
  display: flex;
  gap: 17px;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  background:
    radial-gradient(180px 130px at 100% 0%, rgba(119, 216, 245, 0.065), transparent 72%),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
}

.progress-ring {
  position: relative;
  display: grid;
  width: 112px;
  height: 112px;
  flex: 0 0 112px;
  place-items: center;
  background: conic-gradient(var(--accent) calc(var(--progress, 0) * 1%), rgba(255, 255, 255, 0.07) 0);
  border-radius: 50%;
}

.progress-ring::before {
  position: absolute;
  width: 91px;
  height: 91px;
  content: "";
  background: var(--panel);
  border-radius: 50%;
}

.progress-ring-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.progress-ring-value {
  color: var(--text);
  font-family: var(--mono);
  font-size: 23px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.06em;
}

.progress-ring-value small {
  font-size: 11px;
  letter-spacing: 0;
}

.progress-ring-label {
  margin-top: 2px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.11em;
}

.progress-copy {
  min-width: 0;
  flex: 1;
}

.progress-copy .mini-label {
  margin-bottom: 5px;
}

.progress-copy h3 {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.progress-copy p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px;
}

.progress-stats {
  display: flex;
  gap: 15px;
  margin-top: 12px;
}

.mini-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.mini-stat strong {
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 550;
}

.mini-stat span {
  color: var(--faint);
  font-size: 9px;
}

.streak-strip {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 13px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.streak-icon {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  color: var(--orange);
  background: rgba(255, 173, 102, 0.09);
  border: 1px solid rgba(255, 173, 102, 0.13);
  border-radius: 9px;
  place-items: center;
}

.streak-icon svg {
  width: 16px;
  height: 16px;
}

.streak-strip strong {
  display: block;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}

.streak-strip span {
  color: var(--faint);
  font-size: 10px;
}

.streak-strip .streak-number {
  margin-left: auto;
  color: var(--orange);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.06em;
}

/* ---------- content layout / panels ---------- */

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(262px, 0.72fr);
  gap: 14px;
  align-items: start;
}

.stack {
  display: grid;
  gap: 14px;
}

.panel {
  min-width: 0;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.panel-header {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 17px 19px 14px;
}

.panel-heading {
  min-width: 0;
}

.panel-title {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.panel-title > svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  color: var(--accent);
  opacity: 0.9;
}

.panel-title .count {
  display: inline-grid;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 5px;
  place-items: center;
}

.panel-sub {
  margin-top: 3px;
  color: var(--faint);
  font-size: 10.5px;
}

.panel-body {
  padding: 0 19px 19px;
}

.panel-header + .panel-body {
  padding-top: 2px;
}

.section-head {
  display: flex;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-title {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.section-title .line {
  width: 13px;
  height: 1px;
  background: var(--accent);
}

.section-note {
  color: var(--faint);
  font-size: 9.5px;
}

.day-section + .day-section {
  margin-top: 22px;
}

/* ---------- timeline / task rows ---------- */

.timeline {
  position: relative;
}

.task-row {
  display: grid;
  grid-template-columns: 47px 16px minmax(0, 1fr);
  gap: 7px;
  min-width: 0;
}

.task-time {
  padding-top: 13px;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  text-align: right;
}

.task-time small {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 8.5px;
}

.task-rail {
  position: relative;
  display: flex;
  justify-content: center;
}

.task-rail::before {
  position: absolute;
  top: 19px;
  bottom: -4px;
  width: 1px;
  content: "";
  background: var(--line);
}

.task-row:last-child .task-rail::before {
  bottom: 20px;
}

.task-dot {
  position: relative;
  z-index: 1;
  width: 7px;
  height: 7px;
  margin-top: 17px;
  background: var(--panel-3);
  border: 1px solid #46535f;
  border-radius: 50%;
}

.task-row.is-done .task-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(200, 245, 109, 0.055);
}

.task-row.is-now .task-dot {
  background: var(--orange);
  border-color: var(--orange);
  box-shadow: 0 0 0 4px rgba(255, 173, 102, 0.075);
}

.task-card {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-width: 0;
  margin-bottom: 8px;
  padding: 12px 13px;
  background: var(--panel-2);
  border: 1px solid transparent;
  border-radius: 12px;
  transition: background 0.17s, border-color 0.17s, opacity 0.17s;
}

.task-card:hover {
  background: #17232d;
  border-color: var(--line);
}

.task-row.is-done .task-card {
  background: rgba(255, 255, 255, 0.025);
}

.task-card.kind-block {
  background:
    linear-gradient(100deg, rgba(200, 245, 109, 0.04), transparent 45%),
    var(--panel-2);
}

.task-card.kind-block::before {
  position: absolute;
  top: 13px;
  bottom: 13px;
  left: 0;
  width: 2px;
  content: "";
  background: var(--accent);
  border-radius: 0 4px 4px 0;
}

.task-card.kind-cleanup {
  border-style: dashed;
  border-color: var(--line);
  background: transparent;
}

.task-card.is-skipped {
  opacity: 0.75;
}

.check-btn {
  display: grid;
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  margin-top: 1px;
  padding: 0;
  color: transparent;
  background: transparent;
  border: 1.5px solid #3f4d58;
  border-radius: 6px;
  cursor: pointer;
  place-items: center;
  transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.15s;
}

.check-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.05);
}

.check-btn svg {
  width: 13px;
  height: 13px;
  opacity: 0;
}

.check-btn.is-checked {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.check-btn.is-checked svg {
  opacity: 1;
}

.task-main {
  min-width: 0;
  flex: 1;
}

.task-topline {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
}

.task-title {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.45;
  transition: color 0.17s;
}

.task-row.is-done .task-title {
  color: var(--faint);
  text-decoration: line-through;
  text-decoration-color: rgba(135, 149, 162, 0.45);
}

.task-edit {
  display: flex;
  gap: 4px;
  align-items: center;
  flex: 0 0 auto;
  padding: 2px 4px;
  color: var(--faint);
  font-size: 9px;
  background: transparent;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  opacity: 0;
  transition: color 0.15s, opacity 0.15s, background 0.15s;
}

.task-card:hover .task-edit,
.task-edit:focus-visible {
  opacity: 1;
}

.task-edit:hover {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.05);
}

.task-edit svg {
  width: 12px;
  height: 12px;
}

.task-detail {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.task-row.is-done .task-detail {
  color: var(--faint);
}

.task-meta {
  display: flex;
  gap: 5px;
  align-items: center;
  margin-top: 7px;
  flex-wrap: wrap;
}

.type-chip,
.cat-chip,
.time-chip {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 2px 6px;
  font-size: 8.5px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  border-radius: 4px;
}

.type-chip {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.055);
}

.type-chip.is-water {
  color: var(--cyan);
  background: rgba(119, 216, 245, 0.065);
  border-color: rgba(119, 216, 245, 0.1);
}

.type-chip.is-major {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.type-chip.is-skip {
  color: var(--pink);
  background: rgba(255, 128, 148, 0.07);
  border-color: rgba(255, 128, 148, 0.1);
}

.cat-chip {
  color: var(--cat, var(--muted));
  background: color-mix(in srgb, var(--cat, var(--muted)) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--cat, var(--muted)) 16%, transparent);
}

.time-chip {
  color: var(--faint);
  background: transparent;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-weight: 500;
}

.must-star {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  color: var(--yellow);
  font-size: 8.5px;
  font-weight: 600;
}

.must-star svg {
  width: 9px;
  height: 9px;
}

.now-badge {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  color: var(--orange);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.now-badge::before {
  width: 4px;
  height: 4px;
  content: "";
  background: currentColor;
  border-radius: 50%;
}

/* ---------- side cards ---------- */

.cleanup-card {
  padding: 18px;
  background:
    radial-gradient(220px 130px at 100% 0%, rgba(255, 173, 102, 0.06), transparent 66%),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.cleanup-top {
  display: flex;
  gap: 9px;
  align-items: flex-start;
}

.cleanup-icon {
  display: grid;
  width: 29px;
  height: 29px;
  flex: 0 0 29px;
  color: var(--orange);
  background: rgba(255, 173, 102, 0.075);
  border-radius: 8px;
  place-items: center;
}

.cleanup-icon svg {
  width: 15px;
  height: 15px;
}

.cleanup-title {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}

.cleanup-time {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
}

.cleanup-text {
  margin: 9px 0 12px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.6;
}

.cleanup-action {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.cleanup-action span {
  color: var(--faint);
  font-size: 9.5px;
}

.cleanup-action .check-btn {
  margin: 0;
}

.quick-card {
  padding: 17px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.quick-title {
  margin-bottom: 10px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.quick-list {
  display: grid;
  gap: 3px;
}

.quick-action {
  display: flex;
  gap: 9px;
  align-items: center;
  width: 100%;
  padding: 7px 6px;
  color: var(--muted);
  font-size: 10.5px;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.quick-action:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
}

.quick-action svg {
  width: 14px;
  height: 14px;
  color: var(--faint);
}

.quick-action:hover svg {
  color: var(--accent);
}

.quote-card {
  position: relative;
  padding: 18px 19px;
  overflow: hidden;
  background:
    radial-gradient(180px 100px at 100% 100%, rgba(200, 245, 109, 0.07), transparent 68%),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

/* Classic quotation card: random Marx / Engels / Lenin / Stalin / Mao */
.classic-quote-card {
  position: relative;
  padding: 17px 18px 14px;
  overflow: hidden;
  background:
    radial-gradient(240px 150px at 105% 0%, rgba(255, 173, 102, 0.075), transparent 68%),
    linear-gradient(160deg, rgba(255, 173, 102, 0.025), transparent 58%),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.classic-quote-card::after {
  position: absolute;
  right: 13px;
  bottom: -35px;
  color: rgba(255, 173, 102, 0.055);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 132px;
  line-height: 1;
  content: "“";
  pointer-events: none;
}

.classic-quote-card.is-historical {
  background:
    radial-gradient(240px 150px at 105% 0%, rgba(232, 209, 110, 0.06), transparent 68%),
    linear-gradient(160deg, rgba(232, 209, 110, 0.022), transparent 58%),
    var(--panel);
  border-color: rgba(232, 209, 110, 0.12);
}

.classic-quote-card.is-historical::after {
  color: rgba(232, 209, 110, 0.05);
}

.classic-quote-card.is-historical .classic-quote-label,
.classic-quote-card.is-historical .classic-quote-meta strong {
  color: var(--yellow);
}

.classic-quote-card.is-paraphrase {
  background:
    radial-gradient(240px 150px at 105% 0%, rgba(119, 216, 245, 0.05), transparent 68%),
    linear-gradient(160deg, rgba(119, 216, 245, 0.018), transparent 58%),
    var(--panel);
  border-color: rgba(119, 216, 245, 0.1);
}

.classic-quote-card.is-paraphrase .classic-quote-label,
.classic-quote-card.is-paraphrase .classic-quote-meta strong {
  color: var(--cyan);
}

.classic-quote-card.is-paraphrase::after {
  color: rgba(119, 216, 245, 0.045);
}

.classic-quote-card.is-long .classic-quote-text {
  font-size: 12.5px;
  line-height: 1.72;
}

.classic-quote-actions {
  display: flex;
  gap: 2px;
  align-items: center;
  flex: 0 0 auto;
}

.classic-quote-head {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.classic-quote-label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--orange);
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.classic-quote-label .dot {
  width: 4px;
  height: 4px;
  background: currentColor;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(255, 173, 102, 0.055);
}

.classic-quote-refresh,
.classic-quote-library {
  position: relative;
  z-index: 1;
  display: inline-flex;
  gap: 3px;
  align-items: center;
  padding: 2px 3px;
  color: var(--faint);
  font-size: 8.5px;
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  transition: color 0.16s, background 0.16s;
}

.classic-quote-refresh:hover {
  color: var(--orange);
  background: rgba(255, 173, 102, 0.06);
}

.classic-quote-library:hover {
  color: var(--cyan);
  background: rgba(119, 216, 245, 0.055);
}

.classic-quote-refresh svg,
.classic-quote-library svg {
  width: 10px;
  height: 10px;
}

.classic-quote-text {
  position: relative;
  z-index: 1;
  margin: 12px 0 10px;
  padding: 0;
  color: var(--text-soft);
  font-family: "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
  font-size: 13.5px;
  line-height: 1.8;
  letter-spacing: 0.015em;
}

.classic-quote-meta {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 6px;
  align-items: baseline;
  flex-wrap: wrap;
  font-size: 10px;
}

.classic-quote-meta strong {
  color: var(--orange);
  font-weight: 600;
}

.classic-quote-meta span {
  color: var(--faint);
}

.classic-quote-cycle {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.quote-cycle-progress {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.quote-interval-control {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  color: var(--faint);
  font-family: var(--font);
  font-size: 8px;
  cursor: pointer;
}

.quote-interval-select {
  width: auto;
  padding: 2px 16px 2px 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  appearance: none;
  cursor: pointer;
  background-color: var(--bg-soft);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 7px) calc(50% - 1px),
    calc(100% - 4px) calc(50% - 1px);
  background-size: 3px 3px, 3px 3px;
  background-repeat: no-repeat;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.quote-interval-select:hover {
  border-color: var(--line-strong);
}

.classic-quote-foot {
  position: relative;
  z-index: 1;
  margin-top: 6px;
  color: #46515c;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.02em;
}

/* Quote library modal */
.quote-library-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 9px 10px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.6;
  background: rgba(255, 255, 255, 0.028);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.quote-library-note svg {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  margin-top: 1px;
  color: var(--cyan);
}

.quote-library {
  display: grid;
  gap: 8px;
  margin-top: 13px;
}

.quote-library-group {
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.quote-library-group summary {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.quote-library-group summary::-webkit-details-marker {
  display: none;
}

.quote-library-group summary::before {
  width: 5px;
  height: 5px;
  content: "";
  background: var(--orange);
  border-radius: 50%;
}

.quote-library-group summary span {
  flex: 1;
}

.quote-library-group summary em {
  min-width: 21px;
  padding: 1px 5px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8px;
  font-style: normal;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
}

.quote-library-group[open] summary {
  border-bottom: 1px solid var(--line);
}

.quote-library-item {
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.quote-library-item:last-child {
  border-bottom: 0;
}

.quote-library-item p {
  color: var(--text-soft);
  font-family: "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
  font-size: 12.5px;
  line-height: 1.8;
}

.quote-library-meta {
  display: flex;
  gap: 7px;
  align-items: baseline;
  flex-wrap: wrap;
  margin-top: 7px;
  color: var(--faint);
  font-size: 9px;
}

.quote-library-meta strong {
  color: var(--orange);
  font-weight: 600;
}

.quote-library-meta span {
  color: var(--faint);
}

.quote-translated {
  padding: 1px 4px;
  color: var(--cyan);
  font-size: 8px;
  font-style: normal;
  background: rgba(119, 216, 245, 0.06);
  border: 1px solid rgba(119, 216, 245, 0.14);
  border-radius: 3px;
}

@media (max-width: 760px) {
  .quote-library-item {
    padding: 11px;
  }

  .quote-library-item p {
    font-size: 12px;
  }
}

.quote-mark {
  color: var(--accent);
  font-family: Georgia, serif;
  font-size: 27px;
  line-height: 0.8;
  opacity: 0.6;
}

.quote-text {
  margin-top: 3px;
  color: var(--text-soft);
  font-size: 11.5px;
  line-height: 1.65;
}

.quote-author {
  margin-top: 7px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
}

.empty-state {
  display: grid;
  padding: 29px 15px;
  color: var(--faint);
  font-size: 11px;
  text-align: center;
  place-items: center;
}

.empty-state svg {
  width: 30px;
  height: 30px;
  margin-bottom: 8px;
  opacity: 0.5;
}

.empty-state strong {
  color: var(--muted);
  font-weight: 550;
}

/* ---------- week view ---------- */

.week-toolbar {
  display: flex;
  gap: 13px;
  align-items: center;
  margin-left: auto;
}

.week-scroll {
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(134px, 1fr));
  gap: 7px;
  min-width: 990px;
}

.week-day {
  display: flex;
  min-width: 0;
  min-height: 465px;
  flex-direction: column;
  padding: 10px 8px 9px;
  background: rgba(17, 25, 33, 0.66);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color 0.18s, background 0.18s;
}

.week-day.is-today {
  background:
    linear-gradient(180deg, rgba(200, 245, 109, 0.045), transparent 20%),
    rgba(17, 25, 33, 0.8);
  border-color: rgba(200, 245, 109, 0.22);
}

.week-day.is-weekend {
  background: rgba(15, 22, 29, 0.48);
}

.week-day.is-other-month {
  opacity: 0.55;
}

.week-day-head {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: space-between;
  padding: 2px 3px 10px;
  border-bottom: 1px solid var(--line);
}

.week-day-name {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

.week-day.is-today .week-day-name {
  color: var(--accent);
}

.week-date-badge {
  display: inline-grid;
  min-width: 23px;
  height: 21px;
  padding: 0 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  background: rgba(255, 255, 255, 0.045);
  border-radius: 5px;
  place-items: center;
}

.week-day.is-today .week-date-badge {
  color: var(--accent-ink);
  background: var(--accent);
}

.week-progress {
  display: flex;
  gap: 4px;
  align-items: center;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8px;
}

.week-progress-dot {
  width: 5px;
  height: 5px;
  background: var(--faint);
  border-radius: 50%;
}

.week-progress-dot.is-complete {
  background: var(--accent);
}

.week-items {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  padding-top: 7px;
}

.week-class,
.week-block {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 7px 7px 9px;
  text-align: left;
  background: var(--panel-2);
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.week-class:hover,
.week-block:hover {
  background: var(--panel-3);
  border-color: var(--line);
}

.week-class::before,
.week-block::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 0;
  width: 2px;
  content: "";
  background: var(--cat, var(--muted));
  border-radius: 0 2px 2px 0;
  opacity: 0.75;
}

.week-class.is-skipped {
  opacity: 0.52;
}

.week-class.is-skipped .week-item-title {
  text-decoration: line-through;
}

.week-class.is-done,
.week-block.is-done {
  opacity: 0.48;
}

.week-class.is-done .week-item-title,
.week-block.is-done .week-item-title {
  text-decoration: line-through;
  text-decoration-color: rgba(135, 149, 162, 0.45);
}

.button[disabled],
.button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.button[disabled]:hover,
.button:disabled:hover {
  color: var(--text-soft);
  background: var(--panel-2);
  border-color: var(--line-strong);
}

.week-block {
  background: rgba(200, 245, 109, 0.045);
  border-color: rgba(200, 245, 109, 0.08);
}

.week-block::before {
  background: var(--accent);
}

.week-item-time {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
  font-variant-numeric: tabular-nums;
}

.week-item-title {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.week-item-type {
  color: var(--faint);
  font-size: 8.5px;
  line-height: 1.3;
}

.week-empty {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  color: #3f4b56;
  font-size: 9px;
}

.week-add {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 6px;
  padding: 6px 3px;
  color: #4c5964;
  font-size: 9px;
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.07);
  border-radius: 7px;
  cursor: pointer;
}

.week-add:hover {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.week-add svg {
  width: 11px;
  height: 11px;
}

.week-legend {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 12px;
  color: var(--faint);
  font-size: 9.5px;
}

.legend-item {
  display: flex;
  gap: 5px;
  align-items: center;
}

.legend-swatch {
  width: 6px;
  height: 6px;
  border-radius: 2px;
}

/* ---------- stats ---------- */

.stats-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stat-card {
  position: relative;
  min-width: 0;
  padding: 17px 18px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.stat-card::after {
  position: absolute;
  top: -40px;
  right: -35px;
  width: 100px;
  height: 100px;
  content: "";
  background: radial-gradient(circle, var(--tint, rgba(200, 245, 109, 0.06)), transparent 70%);
  pointer-events: none;
}

.stat-label {
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.stat-value {
  margin-top: 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.07em;
  line-height: 1;
}

.stat-value small {
  margin-left: 2px;
  color: var(--muted);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
}

.stat-foot {
  margin-top: 7px;
  color: var(--faint);
  font-size: 9.5px;
}

.stats-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(270px, 0.65fr);
  gap: 14px;
  align-items: start;
}

.heatmap-card {
  padding: 19px;
  overflow: hidden;
}

.heatmap-header {
  display: flex;
  gap: 15px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 17px;
}

.heatmap-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

.heatmap-sub {
  margin-top: 3px;
  color: var(--faint);
  font-size: 10px;
}

.heatmap-wrap {
  display: flex;
  gap: 8px;
  width: 100%;
  overflow-x: auto;
  padding: 2px 1px 7px;
}

.heatmap-days {
  display: grid;
  grid-template-rows: repeat(7, 13px);
  gap: 4px;
  padding-top: 1px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 7px;
  line-height: 13px;
  text-align: right;
}

.heatmap-days span {
  width: 13px;
}

.heatmap-main {
  min-width: 0;
}

.heatmap-months {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 13px;
  gap: 4px;
  height: 17px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 7px;
  white-space: nowrap;
}

.heatmap-months span {
  grid-row: 1;
  transform: translateX(-1px);
}

.heatmap-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 13px);
  grid-auto-columns: 13px;
  gap: 4px;
  width: max-content;
}

.heat-cell {
  position: relative;
  width: 13px;
  height: 13px;
  padding: 0;
  background: rgba(255, 255, 255, 0.037);
  border: 0;
  border-radius: 3px;
  cursor: default;
  transition: transform 0.12s, box-shadow 0.12s;
}

.heat-cell:hover {
  z-index: 2;
  box-shadow: 0 0 0 1px var(--line-strong);
  transform: scale(1.28);
}

.heat-cell[data-level="1"] {
  background: rgba(200, 245, 109, 0.16);
}

.heat-cell[data-level="2"] {
  background: rgba(200, 245, 109, 0.32);
}

.heat-cell[data-level="3"] {
  background: rgba(200, 245, 109, 0.55);
}

.heat-cell[data-level="4"] {
  background: var(--accent);
}

.heat-cell[data-level="0"].is-missed {
  background: rgba(255, 116, 130, 0.055);
}

.heat-cell.is-today {
  box-shadow: 0 0 0 1px var(--orange);
}

.heat-cell.is-future {
  opacity: 0.28;
}

.heat-legend {
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 11px;
  color: var(--faint);
  font-size: 8px;
}

.heat-legend .heat-cell {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.heat-range {
  margin-top: 8px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8px;
}

.heatmap-quote {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 15px;
  padding-top: 13px;
  color: var(--muted);
  font-size: 10px;
  border-top: 1px solid var(--line);
}

.heatmap-quote svg {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  color: var(--accent);
}

.category-card {
  padding: 19px;
}

.category-list {
  display: grid;
  gap: 13px;
  margin-top: 16px;
}

.category-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 37px;
  gap: 9px;
  align-items: center;
}

.category-name {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--text-soft);
  font-size: 10.5px;
}

.category-dot {
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  background: var(--cat);
  border-radius: 50%;
}

.category-track {
  height: 5px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.055);
  border-radius: 9px;
}

.category-fill {
  width: var(--value, 0%);
  height: 100%;
  background: var(--cat);
  border-radius: inherit;
  transition: width 0.4s var(--ease);
}

.category-count {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
  text-align: right;
}

.weekly-card {
  padding: 19px;
}

.week-bars {
  display: flex;
  gap: 7px;
  align-items: flex-end;
  height: 125px;
  margin-top: 18px;
  padding: 0 3px;
}

.week-bar-item {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.week-bar-value {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8px;
}

.week-bar-track {
  display: flex;
  width: 100%;
  max-width: 24px;
  flex: 1;
  align-items: flex-end;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.035);
  border-radius: 5px;
}

.week-bar-fill {
  width: 100%;
  height: var(--height, 0%);
  min-height: 2px;
  background: linear-gradient(to top, rgba(200, 245, 109, 0.45), var(--accent));
  border-radius: 5px;
  opacity: 0.9;
}

.week-bar-item.is-current .week-bar-fill {
  background: linear-gradient(to top, rgba(119, 216, 245, 0.4), var(--cyan));
}

.week-bar-label {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8px;
}

.week-bar-item.is-current .week-bar-label {
  color: var(--cyan);
}

.week-bar-item.is-empty {
  opacity: 0.42;
}

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

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.setting-card {
  min-width: 0;
  padding: 19px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.setting-card.span-2 {
  grid-column: span 2;
}

.setting-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 15px;
}

.setting-title {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.setting-title svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.setting-description {
  margin-top: 4px;
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.55;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label,
.field-label {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
}

.field-hint {
  color: var(--faint);
  font-size: 9px;
  line-height: 1.5;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 11.5px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(200, 245, 109, 0.06);
}

.input::placeholder,
.textarea::placeholder {
  color: #4a5661;
}

.input[type="time"] {
  color-scheme: dark;
}

.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) calc(50% - 1px),
    calc(100% - 10px) calc(50% - 1px);
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  padding-right: 25px;
}

.textarea {
  min-height: 90px;
  line-height: 1.6;
  resize: vertical;
}

.textarea.code-area {
  min-height: 150px;
  font-family: var(--mono);
  font-size: 10.5px;
}

.inline-fields {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-fields .field {
  flex: 1;
}

.switch-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.switch-row:last-child {
  border-bottom: 0;
}

.switch-copy strong {
  display: block;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 550;
}

.switch-copy span {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 9px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 35px;
  height: 20px;
  flex: 0 0 35px;
  cursor: pointer;
}

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

.switch-track {
  position: absolute;
  inset: 0;
  background: #26333e;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 20px;
  transition: background 0.18s, border-color 0.18s;
}

.switch-track::before {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  content: "";
  background: #768491;
  border-radius: 50%;
  transition: transform 0.18s var(--ease), background 0.18s;
}

.switch input:checked + .switch-track {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.switch input:checked + .switch-track::before {
  background: var(--accent);
  transform: translateX(15px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.reminder-list {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.reminder-row {
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.reminder-row.is-off {
  opacity: 0.55;
}

.reminder-time {
  width: 99px;
  flex: 0 0 99px;
  padding-right: 3px;
  font-family: var(--mono);
  font-size: 10.5px;
}

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

.reminder-actions {
  display: flex;
  gap: 3px;
  align-items: center;
}

.reminder-actions .icon-btn {
  width: 27px;
  height: 27px;
  flex-basis: 27px;
  font-size: 14px;
  background: transparent;
  border-color: transparent;
}

.notice {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 11px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.6;
  background: rgba(255, 255, 255, 0.028);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.notice + .notice {
  margin-top: 8px;
}

.notice svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  margin-top: 1px;
  color: var(--muted);
}

.notice-info {
  color: #a5c4cc;
  background: rgba(119, 216, 245, 0.045);
  border-color: rgba(119, 216, 245, 0.1);
}

.notice-warn {
  color: #d6b79d;
  background: rgba(255, 173, 102, 0.045);
  border-color: rgba(255, 173, 102, 0.1);
}

.notice-warn svg {
  color: var(--orange);
}

.notice-code {
  display: block;
  margin-top: 4px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
}

.notification-status {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 10px;
  margin-bottom: 9px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.notification-status .status-dot {
  width: 6px;
  height: 6px;
  background: var(--faint);
  border-radius: 50%;
}

.notification-status.is-granted .status-dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(200, 245, 109, 0.06);
}

.notification-status.is-denied .status-dot {
  background: var(--danger);
}

.notification-status strong {
  display: block;
  color: var(--text-soft);
  font-size: 10.5px;
  font-weight: 550;
}

.notification-status span {
  display: block;
  color: var(--faint);
  font-size: 9px;
}

.notification-status .button {
  margin-left: auto;
}

.cloud-status {
  display: flex;
  gap: 6px;
  align-items: center;
  min-height: 28px;
  margin-top: 10px;
  color: var(--faint);
  font-size: 9.5px;
}

.cloud-status .sync-indicator {
  width: 5px;
  height: 5px;
  flex-basis: 5px;
}

.cloud-status strong {
  color: var(--muted);
  font-weight: 550;
}

.action-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.details {
  margin-top: 10px;
  border-top: 1px solid var(--line);
}

.details summary {
  padding: 10px 0 0;
  color: var(--muted);
  font-size: 9.5px;
  cursor: pointer;
  user-select: none;
}

.details summary:hover {
  color: var(--text-soft);
}

.code-block {
  position: relative;
  max-height: 290px;
  margin: 9px 0 0;
  padding: 11px;
  overflow: auto;
  color: #b4c8b9;
  font-family: var(--mono);
  font-size: 8.5px;
  line-height: 1.65;
  white-space: pre;
  background: #0a1015;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.copy-code {
  position: sticky;
  float: right;
  top: 0;
  padding: 4px 7px;
  color: var(--muted);
  font-size: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  cursor: pointer;
}

.copy-code:hover {
  color: var(--accent);
}

.danger-zone {
  padding: 12px;
  margin-top: 10px;
  border: 1px dashed rgba(255, 116, 130, 0.23);
  border-radius: 9px;
}

.danger-zone strong {
  color: var(--danger);
  font-size: 10px;
}

.danger-zone p {
  margin: 3px 0 8px;
  color: var(--faint);
  font-size: 9px;
}

.install-steps {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.install-step {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.install-step-number {
  display: inline-grid;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 8px;
  background: var(--accent-soft);
  border-radius: 5px;
  place-items: center;
}

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 7, 10, 0.72);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  animation: fade-in 0.16s ease both;
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(100%, 540px);
  max-height: min(90dvh, 850px);
  overflow: hidden;
  background: #121b23;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  box-shadow: var(--shadow);
  animation: modal-in 0.25s var(--ease) both;
}

.modal-wide {
  width: min(100%, 760px);
}

.modal-header {
  display: flex;
  gap: 15px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 21px 14px;
  border-bottom: 1px solid var(--line);
}

.modal-header-copy {
  min-width: 0;
}

.modal-kicker {
  margin-bottom: 4px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.modal-title {
  color: var(--text);
  font-size: 18px;
  font-weight: 680;
  letter-spacing: -0.025em;
}

.modal-subtitle {
  margin-top: 3px;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.5;
}

.modal-close {
  display: grid;
  width: 29px;
  height: 29px;
  flex: 0 0 29px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  place-items: center;
}

.modal-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.modal-close svg {
  width: 14px;
  height: 14px;
}

.modal-body {
  padding: 17px 21px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-footer {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  padding: 13px 21px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.08);
}

.modal-footer .button-danger {
  margin-right: auto;
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 17px;
}

/* ---------- import ---------- */

.import-tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  margin-bottom: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.import-tab {
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 31px;
  padding: 5px 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.import-tab svg {
  width: 13px;
  height: 13px;
}

.import-tab:hover {
  color: var(--text-soft);
}

.import-tab.is-active {
  color: var(--text);
  background: var(--panel-2);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.15);
}

.import-pane {
  display: none;
}

.import-pane.is-active {
  display: block;
}

.import-help {
  margin-bottom: 8px;
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.65;
}

.file-drop {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 142px;
  padding: 16px;
  text-align: center;
  background: var(--bg-soft);
  border: 1px dashed rgba(255, 255, 255, 0.13);
  border-radius: 11px;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}

.file-drop:hover,
.file-drop.is-dragover {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.file-drop.has-file {
  min-height: 80px;
}

.file-drop svg {
  width: 24px;
  height: 24px;
  color: var(--faint);
}

.file-drop strong {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 550;
}

.file-drop span {
  color: var(--faint);
  font-size: 9px;
}

.file-drop img {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 7px;
}

.ocr-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 9px;
}

.ocr-progress {
  display: none;
  flex: 1 1 120px;
  min-width: 90px;
  height: 5px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 9px;
}

.ocr-progress.is-active {
  display: block;
}

.ocr-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.25s;
}

.ocr-status {
  margin-top: 6px;
  color: var(--faint);
  font-size: 9px;
}

.import-preview {
  margin-top: 15px;
  border-top: 1px solid var(--line);
}

.import-preview-head {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 11px 1px 8px;
}

.import-preview-title {
  color: var(--text-soft);
  font-size: 10.5px;
  font-weight: 600;
}

.import-preview-title span {
  color: var(--faint);
  font-weight: 400;
}

.import-options {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--faint);
  font-size: 9px;
}

.import-options .select {
  min-height: 27px;
  width: auto;
  padding: 4px 25px 4px 8px;
  font-size: 9px;
}

.preview-wrap {
  max-height: 230px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9px;
}

.preview-table th {
  position: sticky;
  z-index: 1;
  top: 0;
  padding: 7px 8px;
  color: var(--faint);
  font-size: 8px;
  font-weight: 600;
  text-align: left;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}

.preview-table td {
  padding: 7px 8px;
  color: var(--muted);
  line-height: 1.45;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
}

.preview-table tr:last-child td {
  border-bottom: 0;
}

.preview-table .preview-course {
  color: var(--text-soft);
  font-weight: 550;
}

.preview-table .preview-action {
  max-width: 260px;
}

.preview-empty {
  padding: 20px;
  color: var(--faint);
  font-size: 9.5px;
  text-align: center;
}

.import-note {
  margin-top: 8px;
  color: var(--faint);
  font-size: 9px;
  line-height: 1.55;
}

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

.toast-region {
  position: fixed;
  z-index: 200;
  right: 22px;
  bottom: 22px;
  display: flex;
  width: min(calc(100vw - 36px), 345px);
  flex-direction: column;
  gap: 7px;
  pointer-events: none;
}

.toast {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 11px 13px;
  color: var(--text-soft);
  font-size: 10.5px;
  line-height: 1.5;
  background: rgba(21, 31, 40, 0.96);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  pointer-events: auto;
  animation: toast-in 0.25s var(--ease) both;
}

.toast.is-leaving {
  animation: toast-out 0.2s ease both;
}

.toast-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  margin-top: 5px;
  background: var(--accent);
  border-radius: 50%;
}

.toast-error .toast-dot {
  background: var(--danger);
}

.toast-info .toast-dot {
  background: var(--cyan);
}

.toast strong {
  display: block;
  margin-bottom: 1px;
  color: var(--text);
  font-size: 10.5px;
  font-weight: 600;
}

.offline-banner {
  position: fixed;
  z-index: 90;
  top: 0;
  right: 0;
  left: 0;
  display: none;
  gap: 7px;
  align-items: center;
  justify-content: center;
  min-height: 31px;
  color: #d7bd9d;
  font-size: 10px;
  background: #2b2018;
  border-bottom: 1px solid rgba(255, 173, 102, 0.15);
}

.offline-banner .status-dot,
.connection-dot {
  width: 5px;
  height: 5px;
  background: var(--orange);
  border-radius: 50%;
}

body.is-offline .offline-banner {
  display: flex;
}

body.is-offline .app-shell {
  padding-top: 31px;
}

body.is-offline .sidebar {
  height: calc(100dvh - 31px);
}

body.is-offline .mobile-topbar {
  top: 31px;
}

body.is-offline .connection-dot {
  background: var(--orange);
}

.connection-dot {
  display: inline-block;
  background: var(--accent);
}

.noscript {
  position: fixed;
  z-index: 300;
  right: 20px;
  bottom: 20px;
  left: 20px;
  padding: 16px;
  color: var(--text);
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
}

/* ---------- animations ---------- */

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(5px);
  }
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
}

.view-root.is-entering > * {
  animation: rise 0.35s var(--ease) both;
}

.view-root.is-entering > *:nth-child(2) {
  animation-delay: 0.035s;
}

.view-root.is-entering > *:nth-child(3) {
  animation-delay: 0.06s;
}

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

/* ---------- responsive ---------- */

@media (max-width: 1180px) {
  .view-root {
    padding-right: 27px;
    padding-left: 27px;
  }

  .today-hero {
    grid-template-columns: minmax(0, 1.45fr) minmax(255px, 0.8fr);
  }

  .progress-card {
    gap: 11px;
    padding: 17px;
  }

  .progress-ring {
    width: 94px;
    height: 94px;
    flex-basis: 94px;
  }

  .progress-ring::before {
    width: 77px;
    height: 77px;
  }

  .progress-ring-value {
    font-size: 20px;
  }
}

@media (max-width: 1020px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .mobile-topbar {
    display: flex;
    position: sticky;
    z-index: 30;
    top: 0;
    align-items: center;
    justify-content: space-between;
    min-height: calc(61px + env(safe-area-inset-top));
    padding: calc(11px + env(safe-area-inset-top)) 19px 11px;
    background: rgba(9, 13, 18, 0.82);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .brand-mobile .brand-mark {
    width: 31px;
    height: 31px;
    flex-basis: 31px;
    border-radius: 9px;
  }

  .brand-mobile .brand-mark svg {
    width: 18px;
    height: 18px;
  }

  .brand-mobile .brand-copy strong {
    font-size: 14px;
  }

  .brand-mobile .brand-copy small {
    font-size: 7px;
  }

  .mobile-topbar-right {
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .mobile-date {
    color: var(--faint);
    font-family: var(--mono);
    font-size: 9px;
  }

  .connection-dot {
    width: 6px;
    height: 6px;
  }

  .view-root {
    max-width: 900px;
    min-height: calc(100dvh - 61px);
    padding: 25px 19px calc(92px + env(safe-area-inset-bottom));
  }

  .bottom-nav {
    position: fixed;
    z-index: 40;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 5px 7px calc(5px + env(safe-area-inset-bottom));
    background: rgba(12, 18, 24, 0.91);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }

  .bottom-nav-item {
    display: flex;
    gap: 3px;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    min-height: 48px;
    padding: 4px;
    color: var(--faint);
    font-size: 8.5px;
    font-weight: 550;
    background: transparent;
    border: 0;
    border-radius: 9px;
    cursor: pointer;
  }

  .bottom-nav-item svg {
    width: 20px;
    height: 20px;
  }

  .bottom-nav-item.is-active {
    color: var(--accent);
    background: rgba(200, 245, 109, 0.045);
  }

  .toast-region {
    right: 18px;
    bottom: calc(77px + env(safe-area-inset-bottom));
  }

  .week-grid {
    grid-template-columns: 1fr;
    min-width: 0;
    gap: 9px;
  }

  .week-scroll {
    overflow: visible;
  }

  .week-day {
    min-height: 0;
  }

  .week-items {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .week-empty {
    grid-column: 1 / -1;
    min-height: 38px;
  }

  .week-add {
    grid-column: 1 / -1;
    margin-top: 0;
  }
}

@media (max-width: 760px) {
  .page-header {
    display: block;
    margin-bottom: 18px;
  }

  .page-title {
    font-size: 31px;
  }

  .page-subtitle {
    font-size: 11.5px;
  }

  .header-tools {
    margin-top: 15px;
    justify-content: space-between;
  }

  .date-switcher {
    order: 1;
  }

  .header-tools > .button {
    order: 2;
  }

  .today-hero {
    grid-template-columns: 1fr;
  }

  .must-card {
    min-height: 214px;
    padding: 21px 20px;
    border-radius: 20px;
  }

  .must-content {
    max-width: 100%;
    margin: 13px 0 15px;
  }

  .must-title {
    font-size: 25px;
  }

  .must-detail {
    font-size: 11.5px;
  }

  .must-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .must-check {
    width: 100%;
    justify-content: center;
  }

  .hero-side {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }

  .progress-card {
    padding: 17px;
  }

  .progress-ring {
    width: 103px;
    height: 103px;
    flex-basis: 103px;
  }

  .progress-ring::before {
    width: 85px;
    height: 85px;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .side-stack {
    display: grid;
    grid-template-columns: 1fr;
  }

  .quote-card {
    display: none;
  }

  .panel-header {
    padding: 15px 15px 12px;
  }

  .panel-body {
    padding: 0 15px 15px;
  }

  .task-row {
    grid-template-columns: 42px 13px minmax(0, 1fr);
    gap: 5px;
  }

  .task-time {
    padding-top: 12px;
    font-size: 9.5px;
  }

  .task-card {
    padding: 11px;
  }

  .task-title {
    font-size: 12px;
  }

  .task-detail {
    font-size: 10px;
  }

  .task-edit {
    opacity: 0.65;
  }

  .task-rail::before {
    top: 17px;
  }

  .task-dot {
    margin-top: 15px;
  }

  .stats-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card {
    padding: 14px;
  }

  .stat-value {
    font-size: 24px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .heatmap-card {
    padding: 15px;
  }

  .heatmap-header {
    margin-bottom: 12px;
  }

  .heatmap-wrap {
    margin-right: -7px;
    padding-right: 7px;
  }

  .heatmap-quote {
    align-items: flex-start;
    font-size: 9.5px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .setting-card.span-2 {
    grid-column: auto;
  }

  .setting-card {
    padding: 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .field.full {
    grid-column: auto;
  }

  .inline-fields {
    align-items: stretch;
    flex-direction: column;
  }

  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: 92dvh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 20px 20px 0 0;
    animation: sheet-in 0.28s var(--ease) both;
  }

  .modal-header {
    padding: 17px 17px 12px;
  }

  .modal-body {
    padding: 14px 17px 18px;
  }

  .modal-footer {
    padding: 12px 17px calc(12px + env(safe-area-inset-bottom));
  }

  .modal-title {
    font-size: 17px;
  }

  .toast-region {
    right: 12px;
    bottom: calc(75px + env(safe-area-inset-bottom));
    width: calc(100vw - 24px);
  }

  .week-items {
    grid-template-columns: 1fr;
  }

  @keyframes sheet-in {
    from {
      opacity: 0;
      transform: translateY(28px);
    }
  }
}

@media (max-width: 380px) {
  .view-root {
    padding-right: 13px;
    padding-left: 13px;
  }

  .mobile-topbar {
    padding-right: 13px;
    padding-left: 13px;
  }

  .page-title {
    font-size: 28px;
  }

  .progress-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .progress-copy {
    width: 100%;
  }

  .reminder-row {
    flex-wrap: wrap;
  }

  .reminder-text {
    flex-basis: calc(100% - 90px);
  }

  .reminder-actions {
    margin-left: auto;
  }
}

/* ---------- print ---------- */

@media print {
  body {
    color: #111;
    background: #fff;
  }

  .sidebar,
  .mobile-topbar,
  .bottom-nav,
  .toast-region,
  .header-tools,
  .task-edit,
  .quick-card,
  .quote-card,
  .offline-banner {
    display: none !important;
  }

  .app-shell,
  .today-hero,
  .content-grid,
  .stats-grid,
  .settings-grid {
    display: block;
  }

  .view-root {
    max-width: 100%;
    padding: 0;
  }

  .must-card,
  .panel,
  .progress-card,
  .streak-strip,
  .stat-card,
  .setting-card,
  .week-day {
    color: #111;
    background: #fff !important;
    border-color: #ddd;
    box-shadow: none;
    break-inside: avoid;
  }

  .must-title,
  .page-title,
  .task-title,
  .stat-value {
    color: #111;
  }

  .must-detail,
  .task-detail,
  .page-subtitle,
  .stat-label {
    color: #555;
  }
}

.plan-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.plan-stack {
  gap: 16px;
}

.direction-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.direction-card,
.study-group-card {
  padding: 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.direction-top {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.direction-top > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.direction-top strong {
  font-size: 13px;
}

.direction-count {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.plan-track {
  height: 5px;
  margin: 11px 0 9px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}

.plan-track span {
  display: block;
  height: 100%;
  background: var(--plan-color, var(--accent));
  border-radius: inherit;
}

.direction-detail {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.direction-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 8px;
  color: var(--faint);
  font-size: 10px;
}

.direction-card .action-row {
  margin-top: 10px;
}

.plan-course-head,
.plan-course-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(120px, .8fr) minmax(120px, .8fr) 96px 70px;
  gap: 9px;
  align-items: center;
}

.plan-course-head {
  padding: 8px 10px;
  color: var(--faint);
  font-size: 10px;
  border-bottom: 1px solid var(--line);
}

.plan-course-list {
  max-height: 420px;
  overflow: auto;
}

.plan-course-row {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .045);
}

.plan-course-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.plan-course-main strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-course-main span {
  overflow: hidden;
  color: var(--faint);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-select {
  width: 100%;
  min-width: 0;
  height: 29px;
  padding: 0 7px;
  font-size: 10px;
}

.plan-status {
  font-size: 10px;
  text-align: center;
  white-space: nowrap;
}

.plan-review-btn {
  min-height: 28px;
  padding: 0 6px;
  font-size: 9.5px;
  white-space: nowrap;
}

.plan-status.is-done { color: var(--accent); }
.plan-status.is-pending { color: #ffbd7a; }

.study-group-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.keyword-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.keyword-chip {
  padding: 3px 7px;
  color: var(--muted);
  font-size: 10px;
  background: rgba(255, 255, 255, .05);
  border-radius: 6px;
}

.keyword-empty {
  color: var(--faint);
  font-size: 10px;
}

.plan-import-meta {
  margin-left: 9px;
  color: var(--faint);
  font-size: 10px;
}

@media (max-width: 980px) {
  .plan-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .study-group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .plan-summary { grid-template-columns: 1fr; }
  .direction-grid,
  .study-group-grid { grid-template-columns: 1fr; }
  .plan-course-head { display: none; }
  .plan-course-row {
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }
  .plan-course-main { grid-column: 1 / -1; }
  .plan-status { text-align: left; }
}

.review-suggestion-list {
  display: grid;
  gap: 8px;
  max-height: 430px;
  margin-top: 10px;
  overflow: auto;
}

.review-suggestion-row {
  padding: 10px;
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.review-suggestion-row > div {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
}

.review-suggestion-row strong {
  color: var(--accent);
  font-size: 11px;
  white-space: nowrap;
}

.review-suggestion-row span {
  font-size: 12px;
  font-weight: 600;
  text-align: right;
}

.review-suggestion-row p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.6;
}

.pdf-course-list {
  display: grid;
  gap: 6px;
  max-height: 440px;
  margin-top: 10px;
  overflow: auto;
}

.pdf-course-row {
  display: flex;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
  padding: 8px 10px;
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.pdf-course-row strong {
  font-size: 11px;
}

.pdf-course-row span {
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.manual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.manual-grid section {
  padding: 12px;
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.manual-grid h3 {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 12px;
}

.manual-grid p {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.7;
}

@media (max-width: 720px) {
  .manual-grid { grid-template-columns: 1fr; }
}

