/* 考研规划 · 样式（原生 CSS，无构建）
   设计令牌与三站统一，只换主色。 */

:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1c2130;
  --muted: #8a91a3;
  --line: #e8eaf1;
  --accent: #5b7cfa;
  --accent-soft: #eef2ff;
  --danger: #e5484d;
  --ok: #22c55e;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 10px 30px -18px rgba(16, 24, 40, 0.35);
  --font: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

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

.boot {
  padding: 80px 20px;
  text-align: center;
  color: var(--muted);
}

/* ---------- 骨架 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(245, 246, 250, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 18px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(135deg, #5b7cfa, #8b5cf6);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 17px;
  box-shadow: 0 6px 16px -8px rgba(91, 124, 250, 0.9);
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-user {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 6px;
}

.tab {
  padding: 8px 16px 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: color 0.15s;
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 18px 18px 120px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  margin: 2px 0 14px;
}

/* ---------- 卡片 / 通用 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(232, 234, 241, 0.9);
  padding: 16px;
}

.card + .card {
  margin-top: 14px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .sub {
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
}

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

.small {
  font-size: 12px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 34px 16px;
  font-size: 14px;
  line-height: 1.8;
}

.empty strong {
  display: block;
  color: var(--text);
  font-size: 15px;
  margin-bottom: 4px;
}

/* ---------- 统计 ---------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(232, 234, 241, 0.9);
  padding: 14px 12px;
  text-align: center;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.stat-value span {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

/* ---------- 搜索 ---------- */
.search {
  position: relative;
  margin-bottom: 12px;
}

.search input {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  padding: 0 40px 0 38px;
  outline: none;
  box-shadow: var(--shadow);
}

.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search .search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 15px;
}

.search .clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--muted);
  display: none;
  place-items: center;
  font-size: 15px;
}

.search.has-value .clear {
  display: grid;
}

/* ---------- 课程色块（单行横滑） ---------- */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  padding: 2px 2px 12px;
  margin: 0 -2px;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: all 0.15s;
}

.chip.active {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex: 0 0 auto;
}

/* ---------- 分组（可折叠） ---------- */
.group {
  margin-bottom: 12px;
}

.group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid rgba(232, 234, 241, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-weight: 700;
  text-align: left;
}

.group-head .chevron {
  color: var(--muted);
  font-size: 11px;
  transition: transform 0.18s;
  width: 12px;
}

.group.open .group-head .chevron {
  transform: rotate(90deg);
}

.group-head .group-status {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.group-body {
  display: none;
  padding-top: 10px;
}

.group.open .group-body {
  display: block;
}

/* ---------- 任务卡片 ---------- */
.task {
  background: var(--card);
  border: 1px solid rgba(232, 234, 241, 0.9);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px 13px;
  margin-bottom: 10px;
}

.task-main {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

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

.task-title {
  font-size: 15px;
  font-weight: 600;
  word-break: break-word;
  line-height: 1.45;
}

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

.task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.task-meta .course {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.task-progress {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.icon-btn {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 15px;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: #f1f2f7;
  color: var(--danger);
}

/* 勾选框 */
.check {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: 7px;
  border: 1.5px solid #cfd4e3;
  background: #fff;
  display: grid;
  place-items: center;
  color: transparent;
  font-size: 13px;
  transition: all 0.15s;
}

.check:hover {
  border-color: var(--accent);
}

.check.checked {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* 子任务 */
.subtasks {
  margin-top: 10px;
  padding-left: 32px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sub-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 0;
  min-height: 32px;
}

.sub-item .check {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  font-size: 11px;
}

.sub-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  word-break: break-word;
}

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

.sub-item .icon-btn {
  width: 24px;
  height: 24px;
  font-size: 13px;
  opacity: 0;
}

.sub-item:hover .icon-btn {
  opacity: 1;
}

.sub-add {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.sub-add input {
  flex: 1;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  padding: 0 10px;
  outline: none;
  background: #fbfbfd;
  font-size: 13px;
}

.sub-add input:focus {
  border-color: var(--accent);
  background: #fff;
}

.sub-add button {
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

/* ---------- 课程列表 ---------- */
.course-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.course-row:last-child {
  border-bottom: none;
}

.course-row .dot {
  width: 10px;
  height: 10px;
}

.course-name {
  font-weight: 600;
  min-width: 0;
  word-break: break-word;
}

.course-count {
  font-size: 12px;
  color: var(--muted);
  margin-left: 4px;
}

.course-actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.link-btn {
  font-size: 13px;
  color: var(--accent);
  padding: 4px 8px;
  border-radius: 8px;
}

.link-btn.danger {
  color: var(--danger);
}

.link-btn:hover {
  background: #f1f2f7;
}

.add-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.add-row input {
  flex: 1;
  height: 42px;
  border-radius: 11px;
  border: 1px solid var(--line);
  padding: 0 12px;
  outline: none;
}

.add-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------- 按钮 ---------- */
.btn {
  height: 42px;
  padding: 0 18px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 600;
  background: #f1f2f7;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: filter 0.15s, background 0.15s;
}

.btn:active {
  filter: brightness(0.96);
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px -12px var(--accent);
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
}

.btn.block {
  width: 100%;
}

.btn.small {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 9px;
}

.btn.danger {
  background: #fdecec;
  color: var(--danger);
}

/* ---------- 悬浮按钮 ---------- */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  height: 50px;
  padding: 0 20px 0 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #5b7cfa, #7c6bf6);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  box-shadow: 0 14px 30px -12px rgba(91, 124, 250, 0.85);
  z-index: 30;
}

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

/* ---------- 底部弹层 ---------- */
.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 35, 0.42);
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade 0.16s ease-out;
}

.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  animation: slideup 0.2s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.sheet-head {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.sheet-head h3 {
  margin: 0;
  font-size: 17px;
}

.sheet-head .close {
  margin-left: auto;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 18px;
  display: grid;
  place-items: center;
}

.field {
  margin-bottom: 14px;
}

.field > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input[type="text"],
.field input[type="date"],
.field select,
.field textarea {
  width: 100%;
  height: 44px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #fbfbfd;
  padding: 0 12px;
  outline: none;
}

.field textarea {
  height: auto;
  min-height: 80px;
  padding: 10px 12px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.sub-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sub-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sub-row input {
  flex: 1;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fbfbfd;
  padding: 0 12px;
  outline: none;
}

.sub-row input:focus {
  border-color: var(--accent);
  background: #fff;
}

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

.swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.swatch.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--text);
}

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.sheet-actions .btn {
  flex: 1;
}

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px 24px;
  text-align: center;
}

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, #5b7cfa, #8b5cf6);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 26px;
}

.login-card h1 {
  font-size: 19px;
  margin: 0 0 4px;
}

.login-card p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
}

.login-card .field {
  text-align: left;
}

.login-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 8px;
}

/* ---------- 提示条 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translate(-50%, 12px);
  background: rgba(28, 33, 48, 0.94);
  color: #fff;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60;
  max-width: 80vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  background: rgba(196, 43, 47, 0.96);
}

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

@keyframes slideup {
  from {
    transform: translateY(24px);
    opacity: 0.6;
  }
}

/* ---------- 手机 ---------- */
@media (max-width: 640px) {
  .container {
    padding: 14px 14px 120px;
  }

  .topbar-inner {
    padding: 10px 14px 0;
  }

  .brand-name {
    font-size: 16px;
  }

  .stat {
    padding: 12px 8px;
  }

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

  .sheet {
    border-radius: 20px 20px 0 0;
  }

  .subtasks {
    padding-left: 0;
  }

  .sub-item .icon-btn {
    opacity: 1;
  }

  .fab {
    right: 14px;
    bottom: calc(16px + env(safe-area-inset-bottom));
  }
}

@media (min-width: 641px) {
  .sheet-mask {
    align-items: center;
  }

  .sheet {
    border-radius: 20px;
    max-height: 84vh;
  }
}
