:root {
  color-scheme: light;
  --bg: #f6f7f3;
  --surface: #ffffff;
  --surface-soft: #eef4ef;
  --ink: #1e2824;
  --muted: #66736d;
  --line: #d9e1dc;
  --green: #287a5a;
  --green-dark: #175d42;
  --blue: #2f6fae;
  --red: #c34339;
  --yellow: #e4b544;
  --shadow: 0 18px 45px rgba(42, 55, 47, 0.13);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.75), rgba(246,247,243,0.9)),
    url("../img/study-bg.svg");
  background-size: cover;
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 26px 22px;
  background: rgba(255, 255, 255, 0.9);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: white;
  font-size: 24px;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.2;
}

h2 {
  font-size: 24px;
  line-height: 1.25;
}

.brand-block p,
.progress-note,
.focus-panel p,
.import-box p {
  color: var(--muted);
}

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

.nav-tab {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 0 12px;
}

.nav-tab.is-active {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--green-dark);
  font-weight: 700;
}

.icon {
  font-size: 18px;
}

.side-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.small-label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
}

.progress-ring {
  position: relative;
  display: grid;
  width: 142px;
  height: 142px;
  place-items: center;
  margin: 12px auto;
}

.progress-ring svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.progress-ring circle {
  fill: none;
  stroke-width: 12;
}

.ring-bg {
  stroke: #e4eae6;
}

.ring-value {
  stroke: var(--green);
  stroke-linecap: round;
  stroke-dasharray: 301.6;
  stroke-dashoffset: 301.6;
  transition: stroke-dashoffset 200ms ease;
}

.progress-ring strong {
  font-size: 28px;
}

.quick-links {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.quick-links a {
  display: flex;
  align-items: center;
  min-height: 38px;
  border-radius: 8px;
  padding: 0 12px;
  background: #f1f5f2;
  color: var(--green-dark);
  font-weight: 800;
}

.quick-links a:hover {
  background: #e7f1ed;
}

.primary-action,
.ghost-action,
.danger-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  font-weight: 700;
}

.primary-action {
  background: var(--green);
  color: white;
}

.primary-action:hover {
  background: var(--green-dark);
}

.ghost-action {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.ghost-action:hover {
  background: var(--surface-soft);
}

.danger-action {
  background: #fff4f2;
  border-color: #f2c8c3;
  color: var(--red);
}

.main-area {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.date-title {
  margin-top: 4px;
  font-size: 30px;
  font-weight: 800;
}

.clock-box {
  min-width: 220px;
  padding: 18px 24px;
  border: 2px solid rgba(40, 122, 90, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  text-align: right;
  box-shadow: 0 18px 45px rgba(40, 122, 90, 0.18);
}

.clock-box span {
  display: block;
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
  color: var(--green-dark);
}

.clock-box small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.view {
  display: none;
}

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

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

.task-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.overview-panel {
  grid-column: 1 / -1;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 20px 0;
}

.estimate-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.estimate-line span {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  background: #f1f5f2;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.status-pill,
.count-chip,
.type-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: #e7f1ed;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.is-live {
  background: #fff2c9;
  color: #825d00;
}

.status-pill.is-late,
.type-chip.is-required {
  background: #ffe4df;
  color: var(--red);
}

.timeline,
.checklist,
.class-list,
.overview-list,
.review-list {
  display: grid;
  gap: 12px;
  padding: 18px 20px 20px;
}

.empty-state {
  padding: 28px 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.task-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.overview-item,
.review-item {
  display: grid;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.overview-item {
  grid-template-columns: 112px minmax(0, 1fr) auto;
}

.review-item {
  grid-template-columns: minmax(0, 1fr) auto;
  border-color: #efaaa2;
  background: #fff7f5;
}

.review-item p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.55;
}

.review-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.overview-time {
  color: var(--green-dark);
  font-weight: 800;
}

.overview-body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.overview-body strong,
.overview-body span {
  overflow-wrap: anywhere;
}

.overview-body span {
  color: var(--muted);
  line-height: 1.45;
}

.day-nav-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px 20px;
}

.day-nav-actions .ghost-action {
  min-width: 120px;
}

.timeline .task-item {
  grid-template-columns: 84px minmax(0, 1fr) auto;
}

.task-item.is-current {
  border-color: var(--yellow);
  background: #fff9e8;
}

.task-item.is-class,
.overview-item.is-class {
  border-color: #b8d4ee;
  background: #f5faff;
}

.task-item.is-done {
  opacity: 0.68;
}

.task-item.is-late {
  border-color: #efaaa2;
}

.task-item.is-attention,
.overview-item.is-attention {
  outline: 3px solid rgba(228, 181, 68, 0.45);
}

.time-block {
  display: grid;
  gap: 3px;
  color: var(--green-dark);
  font-weight: 800;
}

.task-body {
  min-width: 0;
}

.task-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.status-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.complete-action {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--green-dark);
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(40, 122, 90, 0.22);
}

.complete-action:hover {
  background: var(--green-dark);
}

.task-title {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.task-note {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.task-meta {
  margin-top: 7px;
  color: #466783;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.task-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.link-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid #c6d7e8;
  border-radius: 8px;
  background: #fff;
  color: var(--blue);
  padding: 0 10px;
  font-weight: 700;
  text-decoration: none;
}

.link-action:hover {
  background: #eef6ff;
}

.link-action.is-meeting {
  border-color: #9bc3ec;
  background: #eaf4ff;
}

.page-head {
  padding: 0;
  margin-bottom: 18px;
}

.date-tools {
  display: flex;
  gap: 10px;
}

.date-tools input,
.task-form input,
.task-form select,
.task-form textarea,
#listDateFilter {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.day-name,
.calendar-day {
  border-radius: 8px;
}

.day-name {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.calendar-day {
  min-height: 118px;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
}

.calendar-day.is-muted {
  opacity: 0.42;
}

.calendar-day.is-today {
  border-color: var(--green);
  box-shadow: inset 0 0 0 2px rgba(40, 122, 90, 0.12);
}

.day-number {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
}

.day-tasks {
  display: grid;
  gap: 5px;
  margin-top: 10px;
}

.day-task-dot {
  display: block;
  min-height: 22px;
  border-radius: 6px;
  padding: 3px 6px;
  background: #eaf2f9;
  color: #224f7b;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-task-dot.is-timed {
  background: #e7f1ed;
  color: var(--green-dark);
}

.day-task-dot.is-class {
  background: #eaf4ff;
  color: #245f99;
}

.day-more {
  color: var(--muted);
  font-size: 12px;
}

.manage-layout {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 18px;
}

.task-form {
  display: grid;
  gap: 14px;
  padding: 18px 20px 20px;
}

.task-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

.task-form textarea {
  resize: vertical;
}

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

.class-extra-fields {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid #cfe0ef;
  border-radius: 8px;
  background: #f6fbff;
}

.class-extra-fields[hidden] {
  display: none;
}

.import-box {
  display: grid;
  gap: 12px;
  padding: 18px 20px 20px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.compact-head {
  margin-top: 10px;
}

.task-table {
  display: grid;
  gap: 10px;
  padding: 18px 20px 20px;
}

.table-row {
  display: grid;
  grid-template-columns: 112px 90px minmax(0, 1fr) 92px;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.summary-table {
  display: grid;
  gap: 10px;
}

.summary-group {
  display: grid;
  gap: 8px;
}

.summary-row {
  display: grid;
  grid-template-columns: 128px 86px 92px minmax(120px, 1fr) 120px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.summary-row.is-head {
  background: #f1f5f2;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.summary-row.is-complete {
  border-color: #bdddcf;
  background: #f5fbf8;
}

.summary-bar {
  height: 10px;
  border-radius: 999px;
  background: #e4eae6;
  overflow: hidden;
}

.summary-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.summary-detail-button {
  min-height: 30px;
  border: 1px solid #c6d7e8;
  border-radius: 8px;
  background: #fff;
  color: var(--blue);
  padding: 0 10px;
  font-weight: 800;
}

.summary-detail-button:hover {
  background: #eef6ff;
}

.summary-detail {
  display: grid;
  gap: 8px;
  margin-left: 24px;
}

.summary-detail[hidden] {
  display: none;
}

.summary-task {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 40px;
  border: 1px solid #efd4ad;
  border-radius: 8px;
  background: #fffaf0;
  padding: 8px 12px;
  text-align: left;
}

.summary-task span {
  color: #825d00;
  font-weight: 800;
}

.summary-task strong {
  overflow-wrap: anywhere;
}

.table-row strong {
  overflow-wrap: anywhere;
}

.table-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 32px));
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  border-radius: 8px;
  background: #1e2824;
  color: #fff;
  padding: 13px 16px;
  box-shadow: var(--shadow);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1060px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: 1fr;
  }

  .nav-tabs {
    grid-template-columns: repeat(4, 1fr);
  }

  .side-panel {
    display: none;
  }

  .today-grid,
  .manage-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .main-area,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .section-head,
  .page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .date-title {
    font-size: 24px;
  }

  .clock-box {
    text-align: left;
  }

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

  .day-name {
    display: none;
  }

  .calendar-day {
    min-height: auto;
  }

  .timeline .task-item,
  .task-item,
  .table-row,
  .summary-row,
  .summary-task {
    grid-template-columns: 1fr;
  }

  .table-actions {
    justify-content: flex-start;
  }

  .date-tools,
  .form-row,
  .day-nav-actions {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .day-nav-actions .ghost-action {
    width: 100%;
  }

  .overview-item,
  .review-item {
    grid-template-columns: 1fr;
  }

  .review-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
