:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #687385;
  --line: #d9e0e8;
  --paper: #f7f8f5;
  --panel: #ffffff;
  --green: #2f7d5c;
  --green-dark: #246149;
  --blue: #2d6cdf;
  --coral: #d8644a;
  --yellow: #f3c969;
  --shadow: 0 14px 45px rgba(32, 42, 54, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    linear-gradient(90deg, rgba(47, 125, 92, 0.08), transparent 34%),
    var(--paper);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
}

.brand,
.topbar,
.section-heading,
.month-controls,
.progress-text,
.task-row,
.schedule-item,
.view-tabs,
.schedule-slot {
  display: flex;
  align-items: center;
}

.brand {
  gap: 13px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--green), var(--blue));
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.28rem;
}

h2 {
  font-size: 1rem;
}

.brand p,
.eyebrow,
.calendar-note,
.task-meta,
.empty-state {
  color: var(--muted);
}

.panel,
.schedule-card,
.calendar-card,
.schedule-day-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.section-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

#scheduleCount,
#planStatus {
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.progress-wrap {
  margin-bottom: 16px;
}

.progress-text {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9edf0;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--yellow));
  transition: width 180ms ease;
}

.task-list {
  display: grid;
  gap: 10px;
  min-height: 52px;
}

.task-row {
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.task-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
  flex: 0 0 auto;
}

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

.task-title {
  display: block;
  line-height: 1.25;
}

.task-row.done .task-title {
  color: var(--muted);
  text-decoration: line-through;
}

.task-delete-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  color: #9c3d2c;
  font-size: 1.05rem;
  font-weight: 900;
  background: #fae5df;
}

.task-meta {
  display: block;
  margin-top: 3px;
  font-size: 0.78rem;
}

.primary-action,
.secondary-action,
.compact-action,
.icon-button,
.small-icon-button {
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.primary-action,
.secondary-action {
  width: 100%;
  min-height: 44px;
  margin-top: 14px;
}

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

.secondary-action {
  color: var(--green-dark);
  background: #e5f0eb;
}

.compact-action {
  display: inline-grid;
  place-items: center;
  min-width: 54px;
  min-height: 34px;
  padding: 0 12px;
  color: #fff;
  background: var(--blue);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.import-action {
  background: var(--green);
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.import-status {
  min-height: 18px;
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
  min-width: 0;
}

.topbar {
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin-bottom: 3px;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.header-date {
  margin-bottom: 8px;
  color: var(--green-dark);
  font-size: 0.9rem;
  font-weight: 900;
}

.topbar h2 {
  font-size: clamp(1.8rem, 4vw, 3.5rem);
  line-height: 1;
}

.view-tabs {
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.view-tab {
  min-height: 36px;
  border: 0;
  border-radius: 7px;
  padding: 0 16px;
  color: var(--muted);
  font-weight: 900;
  background: transparent;
}

.view-tab.active {
  color: #fff;
  background: var(--green);
}

.calendar-card {
  padding: 14px;
}

#calendarPage .calendar-card {
  max-width: 980px;
}

.month-controls {
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.icon-button {
  width: 42px;
  height: 42px;
  color: var(--ink);
  font-size: 1.6rem;
  background: var(--panel);
  border: 1px solid var(--line);
}

.small-icon-button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: #9c3d2c;
  font-size: 1.1rem;
  background: #fae5df;
}

.class-detail-panel {
  display: grid;
  gap: 8px;
}

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

.class-detail-panel strong {
  line-height: 1.25;
}

.class-detail-panel span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

#monthLabel {
  min-width: 135px;
  text-align: center;
}

.calendar-area {
  width: 100%;
}

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

.weekday-row {
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.calendar-grid {
  gap: 8px;
}

.day-cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 90px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: left;
}

.page-view {
  display: none;
}

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

.today-panel {
  max-width: 720px;
}

.plan-panel {
  max-width: 720px;
  margin-top: 16px;
}

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

.plan-card {
  border: 1px solid var(--line);
  text-align: left;
}

.plan-card {
  min-height: 92px;
  padding: 12px;
  border-radius: 8px;
  color: var(--ink);
  background: #fbfcfd;
}

.plan-card.active {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 125, 92, 0.14);
}

.plan-card strong,
.plan-card span {
  display: block;
}

.plan-card strong {
  margin-bottom: 6px;
}

.plan-card span,
.plan-summary {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.plan-summary {
  margin-top: 12px;
}

.plan-detail {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.plan-detail h3 {
  margin: 0;
  font-size: 0.95rem;
}

.plan-detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.compact-toggle {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 900;
  background: #e5f0eb;
}

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

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

.distribution-row {
  display: grid;
  grid-template-columns: 38px 1fr 24px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.distribution-row div {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9edf0;
}

.distribution-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.plan-upcoming {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.upcoming-task {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  background: #fbfcfd;
}

.upcoming-task span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.upcoming-task strong {
  font-size: 0.84rem;
  line-height: 1.25;
}

.schedule-day-card {
  padding: 18px;
}

.daily-schedule {
  position: relative;
  display: grid;
  grid-template-rows: repeat(24, 48px);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fbfcfd;
}

.schedule-slot {
  align-items: stretch;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
}

.schedule-slot:last-child {
  border-bottom: 0;
}

.schedule-time {
  display: grid;
  align-content: start;
  width: 68px;
  padding: 8px 9px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  background: #f3f6f8;
}

.schedule-hour-line {
  flex: 1;
  background: #fbfcfd;
}

.schedule-event-layer {
  position: absolute;
  inset: 0 10px 0 78px;
  pointer-events: none;
}

.schedule-block {
  position: absolute;
  left: 0;
  right: 0;
  min-width: 0;
  overflow: hidden;
  padding: 8px 11px;
  border-left: 5px solid var(--green);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(32, 42, 54, 0.1);
  pointer-events: auto;
}

.schedule-block.study {
  border-left-color: var(--blue);
}

.schedule-block.review {
  border-left-color: var(--coral);
}

.schedule-block strong {
  display: block;
  margin-bottom: 2px;
  line-height: 1.25;
}

.schedule-block span {
  color: var(--muted);
  font-size: 0.76rem;
}

.day-cell.outside {
  opacity: 0.42;
}

.day-cell.selected {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 125, 92, 0.16);
}

.day-cell.today .day-number {
  color: #fff;
  background: var(--coral);
}

.day-number {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  font-weight: 900;
}

.day-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag {
  max-width: 100%;
  overflow: hidden;
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #eef2f6;
}

.tag[role="button"] {
  cursor: pointer;
}

.tag[role="button"]:focus-visible {
  outline: 3px solid rgba(45, 108, 223, 0.28);
  outline-offset: 2px;
}

.tag[role="button"] {
  cursor: pointer;
}

.tag[role="button"]:focus-visible {
  outline: 3px solid rgba(45, 108, 223, 0.28);
  outline-offset: 2px;
}

.tag[role="button"] {
  cursor: pointer;
}

.tag[role="button"]:focus-visible {
  outline: 3px solid rgba(45, 108, 223, 0.28);
  outline-offset: 2px;
}

.tag.class {
  background: #dfeafc;
}

.tag.study {
  background: #e4f2ea;
}

.tag.review {
  background: #fae5df;
}

.schedule-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding-bottom: 24px;
}

.schedule-card {
  padding: 16px;
}

.schedule-list {
  display: grid;
  gap: 10px;
}

.schedule-item {
  position: relative;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.schedule-item input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
}

.title-input {
  flex: 1 1 190px;
}

.time-input {
  flex: 1 1 120px;
}

.day-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
}

.day-toggle {
  min-width: 38px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
}

.day-toggle.active {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.delete-button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  color: #9c3d2c;
  font-size: 1.25rem;
  font-weight: 900;
  background: #fae5df;
}

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

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

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

  .plan-distribution {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .view-tabs {
    width: 100%;
  }

  .view-tab {
    flex: 1;
  }
}

@media (max-width: 680px) {
  .sidebar,
  .workspace {
    padding: 16px;
  }

  .weekday-row {
    gap: 4px;
    font-size: 0.68rem;
  }

  .calendar-grid {
    gap: 5px;
  }

  .day-cell {
    min-height: 88px;
    padding: 7px;
  }

  .day-tags {
    display: none;
  }

}
