:root {
  --navy: #123041;
  --navy-2: #1b4256;
  --paper: #f7f5ef;
  --surface: #fffefa;
  --ink: #172127;
  --muted: #687276;
  --line: #deded7;
  --line-soft: #ecebe5;
  --coral: #ef654a;
  --coral-dark: #da4f35;
  --sage: #5d986d;
  --orange: #ee9a21;
  --blue: #2875c7;
  --red: #df503d;
  --shadow: 0 18px 48px rgba(25, 42, 47, 0.06);
  --radius: 14px;
  --sidebar-width: 224px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

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

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(40, 117, 199, 0.28);
  outline-offset: 2px;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 38px 14px 30px;
  overflow: hidden;
  background: var(--navy);
  color: white;
}

.sidebar::after {
  position: absolute;
  right: -55px;
  bottom: -82px;
  width: 250px;
  height: 180px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 48% 52% 0 0;
  content: "";
  transform: rotate(-12deg);
  box-shadow:
    -42px -22px 0 -40px rgba(255,255,255,.14),
    -78px -52px 0 -76px rgba(255,255,255,.18);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 9px;
  margin: 0 18px 40px;
  color: inherit;
  text-decoration: none;
}

.brand span {
  font-family: "STSong", "SimSun", serif;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 4px;
}

.brand small {
  font-size: 15px;
  letter-spacing: 3px;
}

.primary-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  position: relative;
  display: flex;
  width: 100%;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(255,255,255,.78);
  cursor: pointer;
  font-size: 16px;
  text-align: left;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.nav-item:hover {
  color: white;
  transform: translateX(2px);
}

.nav-item.is-active {
  background: rgba(255,255,255,.1);
  color: white;
}

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

.nav-badge {
  min-width: 22px;
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--coral);
  color: white;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.sidebar-note {
  position: relative;
  z-index: 1;
  margin: auto 16px 90px;
  color: rgba(255,255,255,.66);
  font-size: 13px;
  line-height: 1.9;
}

.sidebar-note strong {
  display: block;
  margin-top: 12px;
  color: #ff765d;
  font-size: 14px;
  line-height: 1.7;
}

.mobile-header {
  display: none;
}

.content {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 38px clamp(24px, 4vw, 62px) 64px;
}

.view {
  display: none;
  max-width: 1420px;
  margin: 0 auto;
  animation: view-in .24s ease;
}

.view.is-active {
  display: block;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.page-header.compact {
  align-items: end;
  margin-bottom: 32px;
}

.page-header h1 {
  margin: 0 0 8px;
  font-family: "STSong", "SimSun", serif;
  font-size: clamp(30px, 3vw, 42px);
  line-height: 1.2;
  letter-spacing: .04em;
}

.page-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.date-switcher {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
}

.date-switcher time {
  min-width: 145px;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.secondary-button,
.primary-button,
.filter-button,
.mini-button,
.text-button,
.add-button {
  border: 0;
  cursor: pointer;
}

.secondary-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}

.secondary-button {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.64);
}

.secondary-button:hover {
  background: white;
}

.secondary-button.backup-due {
  border-color: #e7a63d;
  background: #fff7e7;
  color: #8a5b12;
}

.secondary-button svg {
  width: 17px;
  height: 17px;
}

.primary-button {
  background: var(--coral);
  color: white;
  box-shadow: 0 9px 22px rgba(239, 101, 74, .22);
}

.primary-button:hover {
  background: var(--coral-dark);
  transform: translateY(-1px);
}

.primary-button.small {
  min-height: 42px;
  padding-inline: 18px;
}

.file-button {
  position: relative;
  cursor: pointer;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.mini-button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
}

.mini-button:hover {
  background: white;
}

.text-button {
  padding: 4px 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.text-button:hover {
  color: var(--coral);
}

.launch-notice {
  margin: -8px 0 22px;
  padding: 12px 16px;
  border-left: 3px solid var(--orange);
  background: rgba(238, 154, 33, .08);
  color: #79541d;
  font-size: 14px;
  line-height: 1.6;
}

.dashboard-top {
  display: grid;
  grid-template-columns: minmax(520px, 1.65fr) minmax(280px, .88fr) minmax(260px, .8fr);
  gap: 22px;
  align-items: start;
}

.dashboard-bottom {
  display: grid;
  grid-template-columns: minmax(500px, 1.45fr) minmax(330px, 1fr);
  gap: 22px;
  margin-top: 22px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 254, 250, .88);
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: .03em;
}

.section-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.task-panel {
  overflow: hidden;
}

.task-panel > .section-heading {
  padding: 21px 22px 16px;
}

#task-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.task-list {
  min-height: 300px;
}

.task-group {
  position: relative;
  display: grid;
  grid-template-columns: 94px 1fr;
  border-top: 1px solid var(--line-soft);
}

.task-group::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--subject-color);
  content: "";
}

.task-group-label {
  padding: 16px 12px 12px 18px;
  color: var(--subject-color);
  font-size: 14px;
  font-weight: 800;
}

.task-group-items {
  min-width: 0;
}

.task-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 49px;
  padding: 6px 14px 6px 4px;
  border-bottom: 1px solid var(--line-soft);
}

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

.task-check {
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  border: 1.5px solid #a4abad;
  border-radius: 4px;
  background: white;
  cursor: pointer;
}

.task-check::after {
  width: 8px;
  height: 4px;
  border-bottom: 2px solid white;
  border-left: 2px solid white;
  content: "";
  opacity: 0;
  transform: translateY(-1px) rotate(-45deg);
}

.task-check.is-done {
  border-color: var(--sage);
  background: var(--sage);
}

.task-check.is-done::after {
  opacity: 1;
}

.task-title {
  overflow: hidden;
  font-size: 13px;
  line-height: 1.45;
  text-overflow: ellipsis;
}

.task-row.is-done .task-title {
  color: #899092;
  text-decoration: line-through;
}

.video-label {
  margin-left: 4px;
  color: var(--orange);
  font-size: 10px;
  font-weight: 700;
}

.priority-label {
  margin-left: 5px;
  color: #74807c;
  font-size: 10px;
  font-weight: 700;
}

.priority-label.rest {
  color: var(--sage);
}

.task-duration {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.task-focus,
.task-delete {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #8b9395;
  cursor: pointer;
}

.task-focus:hover {
  background: rgba(239,101,74,.1);
  color: var(--coral);
}

.task-delete:hover {
  background: rgba(223,80,61,.08);
  color: var(--red);
}

.task-focus svg,
.task-delete svg {
  width: 14px;
  height: 14px;
}

.task-actions {
  display: flex;
  min-width: 26px;
  justify-content: flex-end;
}

.empty-state {
  display: grid;
  min-height: 260px;
  place-items: center;
  padding: 34px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.quick-add {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 72px 40px;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--line-soft);
  background: #fbfaf6;
}

.quick-add input,
.quick-add select,
.form-grid input,
.form-grid select,
.form-grid textarea {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
}

.quick-add input,
.quick-add select {
  height: 36px;
  padding: 0 9px;
  font-size: 12px;
}

.add-button {
  border-radius: 7px;
  background: var(--navy);
  color: white;
  font-size: 20px;
}

.panel-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12px;
}

.discipline-rule {
  color: var(--sage);
  font-weight: 700;
}

.timer-panel {
  padding: 21px 22px 18px;
  text-align: center;
}

.timer-panel .section-heading {
  text-align: left;
}

.timer-ring {
  --progress: 0deg;
  position: relative;
  display: flex;
  width: min(220px, 90%);
  aspect-ratio: 1;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  margin: 26px auto 16px;
  border-radius: 50%;
  background: conic-gradient(var(--coral) var(--progress), #ebecea 0);
}

.timer-ring::before {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--surface);
  content: "";
}

.timer-time,
.timer-subject {
  position: relative;
  z-index: 1;
}

.timer-time {
  color: var(--navy);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: clamp(40px, 4.3vw, 58px);
  font-weight: 750;
  letter-spacing: -3px;
}

.timer-subject {
  display: flex;
  align-items: center;
  gap: 5px;
}

.timer-subject select {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.timer-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: -4px 0 12px;
  text-align: left;
}

.timer-settings label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
}

.timer-settings select {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  padding: 0 8px;
  color: var(--ink);
  font-size: 12px;
}

.linked-task {
  margin: 0 0 10px;
  padding: 8px 10px;
  overflow: hidden;
  border-left: 2px solid var(--coral);
  background: #fff3f0;
  color: #74534c;
  font-size: 10px;
  line-height: 1.4;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subject-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sage);
}

.duration-tabs {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 8px 0 17px;
}

.duration-tabs button {
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.duration-tabs button.is-active {
  border-color: #f2c0b7;
  background: #fff2ef;
  color: var(--coral-dark);
}

.timer-panel .primary-button {
  width: 100%;
  min-height: 52px;
  font-size: 17px;
}

.timer-reset {
  margin-top: 10px;
}

.timer-completion {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.timer-completion[hidden] {
  display: none;
}

.timer-completion span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
}

.timer-completion button {
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  cursor: pointer;
  font-size: 11px;
}

.timer-completion button:first-of-type {
  border-color: #bfd7c5;
  background: #f0f7f2;
  color: #397d4c;
}

.right-rail {
  display: grid;
  gap: 22px;
}

.review-panel,
.resource-shortcuts {
  padding: 20px;
}

.review-list {
  margin-top: 9px;
}

.review-item {
  display: grid;
  grid-template-columns: 45px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line-soft);
}

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

.review-cycle {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  color: var(--cycle-color);
  font-size: 13px;
  font-weight: 800;
}

.review-copy {
  min-width: 0;
}

.review-copy strong,
.review-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-copy strong {
  font-size: 13px;
}

.review-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.review-done {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  cursor: pointer;
}

.review-done:hover {
  border-color: var(--sage);
  color: var(--sage);
}

.review-result-actions {
  display: flex;
  gap: 4px;
}

.review-result-actions button {
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 10px;
}

.review-result-actions button:first-child {
  border-color: #bfd7c5;
  color: #397d4c;
}

.review-result-actions button:last-child {
  border-color: #efc1b7;
  color: var(--red);
}

.empty-inline {
  padding: 24px 4px 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.resource-shortcut {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
  color: inherit;
  text-decoration: none;
}

.resource-shortcut:last-child {
  border-bottom: 0;
}

.resource-shortcut:hover strong {
  color: var(--coral);
}

.resource-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  background: var(--icon-color);
  color: white;
  font-size: 12px;
  font-weight: 800;
}

.resource-shortcut strong,
.resource-shortcut small {
  display: block;
}

.resource-shortcut strong {
  font-size: 13px;
}

.resource-shortcut small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.shortcut-arrow {
  color: #9ca2a3;
}

.weekly-panel,
.subject-panel {
  padding: 20px 22px;
}

.weekly-chart {
  display: grid;
  min-height: 210px;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  align-items: end;
  margin-top: 20px;
  padding: 12px 5px 0;
  border-bottom: 1px solid var(--line);
  background-image: linear-gradient(to bottom, rgba(222,222,215,.55) 1px, transparent 1px);
  background-size: 100% 25%;
}

.weekly-heading-actions {
  display: grid;
  justify-items: end;
  gap: 3px;
}

#weekly-detail.is-warning {
  color: var(--red);
  font-weight: 700;
}

.manual-session-form {
  display: grid;
  grid-template-columns: 1.15fr .9fr .9fr .7fr;
  gap: 7px;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: #fbfaf6;
}

.manual-session-form #session-note {
  grid-column: 1 / 4;
}

.manual-session-form[hidden] {
  display: none;
}

.manual-session-form input,
.manual-session-form select {
  min-width: 0;
  height: 35px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  padding: 0 8px;
  font-size: 11px;
}

.manual-session-form button {
  border: 0;
  border-radius: 6px;
  background: var(--navy);
  color: white;
  cursor: pointer;
  font-size: 11px;
}

.session-list {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}

.session-row {
  display: grid;
  grid-template-columns: 72px 60px minmax(0, 1fr) auto auto;
  gap: 9px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 10px;
}

.session-row strong {
  color: var(--ink);
  font-size: 11px;
}

.session-row .delete-button {
  font-size: 10px;
}

.chart-day {
  display: grid;
  height: 188px;
  grid-template-rows: 1fr 20px;
  gap: 8px;
  align-items: end;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.chart-bar-wrap {
  display: flex;
  height: 100%;
  align-items: end;
  justify-content: center;
}

.chart-bar {
  position: relative;
  width: min(24px, 70%);
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  background: var(--sage);
  transition: height .45s ease;
}

.chart-bar span {
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  color: var(--ink);
  font-size: 10px;
  transform: translateX(-50%);
}

.subject-progress-row {
  display: grid;
  grid-template-columns: 78px minmax(90px, 1fr) 112px;
  align-items: center;
  gap: 12px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line-soft);
}

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

.subject-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
}

.subject-mark {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 6px;
  background: var(--subject-color);
  color: white;
  font-size: 10px;
}

.progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 6px;
  background: #ecece7;
}

.progress-fill {
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background: var(--subject-color);
  transition: width .4s ease;
}

.progress-number {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.plan-layout {
  display: grid;
  grid-template-columns: minmax(280px, .72fr) minmax(520px, 1.3fr);
  gap: 34px;
}

.current-phase {
  position: sticky;
  top: 30px;
  align-self: start;
  padding: 28px;
  border-color: rgba(18,48,65,.2);
  background: var(--navy);
  color: white;
}

.phase-label {
  color: #99bdc9;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
}

.current-phase h2 {
  margin: 10px 0 8px;
  font-family: "STSong", "SimSun", serif;
  font-size: 28px;
}

.current-phase > p {
  color: rgba(255,255,255,.7);
  line-height: 1.7;
}

.current-phase ul {
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.current-phase li {
  padding: 11px 0;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: 13px;
  line-height: 1.6;
}

.timeline {
  position: relative;
}

.progress-editor {
  margin-top: 26px;
  padding: 25px;
}

.progress-editor-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.progress-edit-card {
  padding: 17px;
  border: 1px solid var(--line-soft);
  border-top: 3px solid var(--subject-color);
  border-radius: 9px;
  background: #fbfaf6;
}

.progress-edit-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.progress-edit-card > p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 11px;
}

.progress-input-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 7px;
}

.progress-input-row input,
.accuracy-input input {
  width: 100%;
  min-width: 0;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  padding: 0 9px;
}

.accuracy-input {
  display: grid;
  grid-template-columns: 1fr 60px auto;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 11px;
}

.progress-save {
  width: 100%;
  margin-top: 11px;
  padding: 8px;
  border: 0;
  border-radius: 7px;
  background: var(--navy);
  color: white;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.timeline::before {
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 12px;
  width: 1px;
  background: #cfcfc8;
  content: "";
}

.phase-card {
  position: relative;
  margin: 0 0 18px 43px;
  padding: 23px 25px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.7);
}

.phase-card::before {
  position: absolute;
  top: 26px;
  left: -37px;
  width: 12px;
  height: 12px;
  border: 4px solid var(--paper);
  border-radius: 50%;
  background: #aeb4b2;
  content: "";
  box-shadow: 0 0 0 1px #aeb4b2;
}

.phase-card.is-current {
  border-color: rgba(239,101,74,.45);
  background: white;
}

.phase-card.is-current::before {
  background: var(--coral);
  box-shadow: 0 0 0 1px var(--coral);
}

.phase-card header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
}

.phase-card h3 {
  margin: 0;
  font-size: 17px;
}

.phase-card time {
  color: var(--muted);
  font-size: 12px;
}

.phase-card > p {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.phase-card ul {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 20px;
  margin: 0;
  padding-left: 18px;
  color: #40494c;
  font-size: 12px;
  line-height: 1.6;
}

.mistake-form {
  margin-bottom: 24px;
  padding: 25px;
}

.form-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.form-heading h2 {
  margin: 0;
  font-size: 19px;
}

.form-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.icon-button:hover {
  background: rgba(0,0,0,.05);
}

.icon-button svg {
  width: 24px;
  height: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid label {
  display: grid;
  gap: 7px;
  color: #465054;
  font-size: 12px;
  font-weight: 700;
}

.form-grid .span-2 {
  grid-column: span 2;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  padding: 10px 11px;
  resize: vertical;
  font-size: 13px;
  font-weight: 400;
}

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

.filter-row {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  overflow-x: auto;
}

.filter-button {
  flex: 0 0 auto;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.filter-button.is-active {
  border-color: var(--navy);
  background: var(--navy);
  color: white;
}

.mistake-list {
  display: grid;
  gap: 12px;
}

.mistake-card {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 310px auto;
  gap: 22px;
  align-items: center;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.72);
}

.mistake-subject {
  color: var(--subject-color);
  font-size: 13px;
  font-weight: 800;
}

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

.mistake-main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mistake-main p {
  display: -webkit-box;
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.review-cycles {
  display: flex;
  gap: 7px;
}

.cycle-button {
  min-width: 67px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
}

.cycle-button strong,
.cycle-button span {
  display: block;
}

.cycle-button strong {
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 11px;
}

.cycle-button.is-done {
  border-color: #bfd7c5;
  background: #f0f7f2;
  color: var(--sage);
}

.cycle-button.is-due:not(.is-done) {
  border-color: #f1aa9b;
  background: #fff4f1;
  color: var(--red);
}

.cycle-slot {
  display: grid;
  min-width: 94px;
  min-height: 59px;
  place-items: center;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-size: 10px;
}

.cycle-slot > strong {
  color: var(--ink);
  font-size: 11px;
}

.cycle-slot.is-done {
  border-color: #bfd7c5;
  background: #f0f7f2;
  color: var(--sage);
}

.cycle-slot.is-due:not(.is-done) {
  border-color: #f1aa9b;
  background: #fff4f1;
}

.cycle-slot > button,
.cycle-result-buttons button {
  padding: 2px 5px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 9px;
}

.cycle-result-buttons {
  display: flex;
  gap: 4px;
}

.cycle-result-buttons button:first-child {
  color: var(--sage);
}

.cycle-result-buttons button:last-child {
  color: var(--red);
}

.delete-button {
  border: 0;
  background: transparent;
  color: #a3a8a9;
  cursor: pointer;
}

.delete-button:hover {
  color: var(--red);
}

.resource-principle {
  display: flex;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 22px;
  padding: 15px 18px;
  border-left: 3px solid var(--coral);
  background: rgba(239,101,74,.07);
  color: #70534c;
  font-size: 13px;
  line-height: 1.6;
}

.resource-principle strong {
  flex: 0 0 auto;
  color: var(--coral-dark);
}

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

.resource-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.72);
}

.resource-card header {
  display: flex;
  gap: 13px;
  align-items: center;
  margin-bottom: 15px;
}

.resource-card h2 {
  margin: 0;
  font-size: 18px;
}

.resource-card header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.resource-links {
  display: grid;
}

.resource-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 3px;
  border-top: 1px solid var(--line-soft);
  color: #364247;
  font-size: 13px;
  text-decoration: none;
}

.resource-link:hover {
  color: var(--coral);
}

.resource-link span:last-child {
  color: #a3a9aa;
}

.toast-region {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  display: grid;
  gap: 8px;
  width: min(340px, calc(100vw - 48px));
}

.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 16px;
  border-radius: 9px;
  background: var(--navy);
  color: white;
  box-shadow: 0 12px 35px rgba(0,0,0,.2);
  font-size: 13px;
  line-height: 1.5;
  animation: toast-in .25s ease;
}

.toast button {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid rgba(255,255,255,.38);
  border-radius: 6px;
  background: transparent;
  color: white;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.toast.is-error {
  background: #8b3227;
}

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

@media (max-width: 1450px) {
  .dashboard-top {
    grid-template-columns: minmax(500px, 1.45fr) minmax(280px, .8fr);
  }

  .right-rail {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }

  .review-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }

  .review-item {
    border: 0;
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar-width: 0px;
  }

  .sidebar {
    top: 66px;
    width: 250px;
    padding-top: 22px;
    transform: translateX(-105%);
    transition: transform .22s ease;
  }

  body.menu-open .sidebar {
    transform: translateX(0);
  }

  .sidebar .brand {
    display: none;
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    height: 66px;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: var(--navy);
    color: white;
  }

  .mobile-header .brand {
    margin: 0;
  }

  .mobile-header .brand span {
    font-size: 24px;
  }

  .content {
    margin-left: 0;
    padding: 28px 20px 48px;
  }

  .dashboard-top,
  .dashboard-bottom,
  .plan-layout {
    grid-template-columns: 1fr;
  }

  .right-rail {
    grid-column: auto;
  }

  .current-phase {
    position: static;
  }

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

  .mistake-card {
    grid-template-columns: 80px minmax(0, 1fr);
  }

  .manual-session-form {
    grid-template-columns: repeat(3, 1fr);
  }

  #session-note {
    grid-column: span 2;
  }

  .review-cycles {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .content {
    padding-inline: 12px;
  }

  .page-header,
  .page-header.compact {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-header h1 {
    font-size: 29px;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions > * {
    flex: 1;
  }

  .dashboard-top,
  .dashboard-bottom,
  .right-rail,
  .resource-grid {
    grid-template-columns: 1fr;
  }

  .review-list {
    grid-template-columns: 1fr;
  }

  .task-group {
    grid-template-columns: 1fr;
  }

  .task-group-label {
    padding-bottom: 4px;
  }

  .task-row {
    padding-left: 18px;
  }

  .quick-add {
    grid-template-columns: 1fr 70px 40px;
  }

  .quick-add select {
    grid-column: 1 / -1;
  }

  .panel-footer {
    flex-direction: column;
  }

  .phase-card ul {
    grid-template-columns: 1fr;
  }

  .progress-editor-grid {
    grid-template-columns: 1fr;
  }

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

  .form-grid .span-2 {
    grid-column: span 1;
  }

  .mistake-card {
    grid-template-columns: 1fr auto;
    gap: 12px;
  }

  .mistake-main {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .review-cycles {
    grid-column: 1 / -1;
    grid-row: 3;
    overflow-x: auto;
  }

  .resource-principle {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

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

  #session-note {
    grid-column: 1 / -1;
  }
}

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