/* ==========================================================================
   课搭子 · 校园信息协作站
   纯手写 CSS，没有用任何框架
   ========================================================================== */

:root {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --ink: #1e2328;
  --ink-2: #3d444b;
  --muted: #737a82;
  --line: #e7e1d5;
  --line-strong: #d5cec0;
  --accent: #2f6b57;
  --accent-strong: #24543f;
  --accent-soft: #e8f1ec;
  --danger: #a9422c;
  --danger-soft: #fbeae4;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(31, 35, 40, .04), 0 10px 30px -18px rgba(31, 35, 40, .35);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button { font-family: inherit; }
::selection { background: #cfe3d9; }

/* ------------------------------ 顶栏 ------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(244, 241, 234, .88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex: 1;
  min-width: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(145deg, #3a7d64, #24543f);
  display: grid;
  place-items: center;
  color: #fff;
  flex: none;
  box-shadow: 0 4px 12px -4px rgba(36, 84, 63, .65);
}
.brand-mark svg { width: 19px; height: 19px; }
.brand-mark.big { width: 46px; height: 46px; border-radius: 14px; }
.brand-mark.big svg { width: 24px; height: 24px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text b { font-size: 16.5px; letter-spacing: .04em; }
.brand-text small { font-size: 10.5px; color: var(--muted); letter-spacing: .1em; }

.tabs {
  display: flex;
  gap: 3px;
  padding: 4px;
  border-radius: 12px;
  background: #eae5da;
  flex: none;
}
.tab {
  padding: 7px 15px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  color: #5d6168;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, color .15s, box-shadow .15s;
}
.tab:hover { color: var(--ink); }
.tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}

.user {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.user-name {
  font-size: 13px;
  font-weight: 600;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex: none;
  user-select: none;
}
.avatar.sm { width: 26px; height: 26px; font-size: 12px; }

/* ------------------------------ 通用控件 ------------------------------ */

.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 26px 24px 72px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.btn:hover {
  background: var(--surface-2);
  border-color: #c8c0b0;
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .6; cursor: default; transform: none; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px -3px rgba(47, 107, 87, .55);
}
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 11.5px; border-radius: 7px; }
.btn-block { width: 100%; height: 42px; font-size: 14px; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #8f3522; border-color: #8f3522; }
.btn-danger-ghost { color: var(--danger); border-color: #eccfc6; background: var(--surface); }
.btn-danger-ghost:hover { background: var(--danger-soft); border-color: #e0b7aa; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line); }

.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex: none;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: rgba(30, 35, 40, .07); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }

.chip {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 7px;
  border-radius: 6px;
  vertical-align: 2px;
}

.spacer { flex: 1; }
.hidden { display: none !important; }

/* ------------------------------ 页面头部 ------------------------------ */

.page { animation: fade-up .28s ease both; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.page-title h1 {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.page-title .sub {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

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

.sync {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  margin-right: 2px;
  white-space: nowrap;
}
.sync .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4f9a72;
  box-shadow: 0 0 0 3px rgba(79, 154, 114, .16);
}
.sync.offline .dot { background: #b9b2a4; box-shadow: 0 0 0 3px rgba(185, 178, 164, .2); }

.count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 2px;
  border-radius: 9px;
  background: #ece7db;
  color: #5d5344;
  font-size: 10.5px;
  font-weight: 700;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-bottom: 14px;
  font-size: 12.5px;
  color: var(--muted);
}
.stats b { color: var(--ink); font-size: 14px; margin-right: 3px; }
.stats .sep-dot { color: var(--line-strong); margin: 0 -8px; }

/* 周切换条 */

.weekbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.week-title { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.week-title b { font-size: 14px; font-weight: 700; }
.week-title span { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.week-arrow {
  width: 34px;
  height: 34px;
  font-size: 21px;
  line-height: 1;
  color: var(--ink-2);
}
.week-arrow:hover { background: var(--accent-soft); color: var(--accent); }
.week-arrow:disabled { opacity: .3; cursor: default; }
.week-arrow:disabled:hover { background: transparent; color: var(--ink-2); }

.back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 10px;
}
.back:hover { color: var(--ink); }

/* ------------------------------ 卡片 ------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.card-head h2 { font-size: 15px; font-weight: 700; }
.card-head p { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ------------------------------ 课表 ------------------------------ */

.tt-card { padding: 0; overflow: hidden; margin-bottom: 20px; }

.empty-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  background: #fdf8e9;
  border-bottom: 1px solid #f0e6cb;
  font-size: 12.5px;
  color: #7c6524;
}

.tt-scroll { overflow-x: auto; }

.timetable {
  display: grid;
  grid-template-columns: 78px repeat(7, minmax(116px, 1fr));
  min-width: 920px;
}

.timetable > div {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.timetable > div:nth-child(8n) { border-right: 0; }
.timetable > div:nth-last-child(-n + 8) { border-bottom: 0; }

.tt-corner {
  background: var(--surface-2);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  color: #9a9384;
  padding: 9px 0;
}

.tt-day {
  position: relative;
  background: var(--surface-2);
  padding: 9px 8px 8px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
}
.tt-day span {
  display: block;
  font-size: 10.5px;
  font-weight: 500;
  color: #a49c8c;
  margin-top: 1px;
}
.tt-day.weekend { color: #8b6b4a; }
.tt-day.today {
  background: #e9f2fa;
  color: #1f5f8b;
  box-shadow: inset 0 -2px 0 #8fbad8;
}
.tt-day.today span { color: #5b88a8; }
.today-dot {
  position: absolute;
  top: 7px;
  right: 9px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #3b82b8;
}

.tt-slot {
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-size: 12px;
  font-weight: 600;
  color: #9a9384;
  padding: 6px 2px;
  min-height: 96px;
}
.tt-slot b { font-size: 12.5px; font-weight: 700; color: #7f7768; }
.tt-slot span { font-size: 8.5px; font-weight: 500; color: #aaa292; letter-spacing: .01em; }

.tt-cell {
  position: relative;
  padding: 4px 5px;
  min-height: 96px;
  background: #fff;
  cursor: pointer;
  transition: background .14s;
}
.tt-cell.weekend { background: #fcfbf7; }
.tt-cell.today { background: #fbfdff; }
.tt-cell:hover { background: #f7f5ee; }
.tt-cell.today:hover { background: #f3f8fd; }
.tt-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.tt-slot.sep, .tt-cell.sep { box-shadow: inset 0 2px 0 #ded7c8; }

.add-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 19px;
  font-weight: 300;
  color: #c6beac;
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s;
}
.tt-cell:hover .add-hint { opacity: 1; }

.course {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  margin: 2px 0;
  padding: 5px 7px 6px;
  border: 0;
  border-left: 3px solid var(--c-ink);
  border-radius: 7px;
  background: var(--c-bg);
  color: var(--c-ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.course:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -5px rgba(30, 35, 40, .45);
}
.course-title {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.28;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.course-meta, .course-weeks {
  font-size: 10.5px;
  opacity: .85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.course-weeks { opacity: .68; font-size: 10px; }

/* ------------------------------ DDL 列表 ------------------------------ */

.ev-card { padding: 0; overflow: hidden; }

.ev-list { display: block; }

.ev {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  transition: background .14s;
}
.ev + .ev { border-top: 1px solid var(--line); }
.ev:hover { background: var(--surface-2); }

.check {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  position: relative;
  flex: none;
  transition: background .15s, border-color .15s;
}
.check:hover { border-color: #a9c4b8; }
.check:checked { background: var(--accent); border-color: var(--accent); }
.check:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1.5px;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: 0;
  border-left: 0;
  transform: rotate(45deg);
}

.ev-main { min-width: 0; cursor: pointer; }
.ev-title {
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ev-meta {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ev.is-done .ev-main { opacity: .55; }
.ev.is-done .ev-title { text-decoration: line-through; }

.kind {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.kind-hw { background: #e8f0fb; color: #2b5b8a; }
.kind-exam { background: #fbe9e4; color: #a2462c; }
.kind-act { background: #e9f2e8; color: #3d6b34; }
.kind-other { background: #f0eeea; color: #6b6f76; }

.due {
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 7px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.due-over { background: var(--danger-soft); color: var(--danger); }
.due-today { background: #fdeee6; color: #a04a2b; }
.due-soon { background: #fdf5e2; color: #8a621c; }
.due-far { background: #f1efe9; color: #6f737a; }
.due-done { background: #eef3ee; color: #5d7a63; }

/* ------------------------------ DDL 看板 ------------------------------ */

.ev-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.ev-filters { display: flex; gap: 5px; flex-wrap: wrap; }

.chip-filter {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .14s, color .14s, border-color .14s;
}
.chip-filter:hover { background: #f0ece2; color: var(--ink); }
.chip-filter.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #cfe2d8;
}

.ev-search {
  width: 190px;
  height: 32px;
  padding: 0 11px;
  font-size: 12.5px;
  border-radius: 9px;
}

.ev-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }

.ev-col {
  padding: 12px 14px 16px;
  border-right: 1px solid var(--line);
  min-height: 128px;
}
.ev-col:last-child { border-right: 0; }

.ev-col-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
}
.ev-col-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #f0ece2;
  color: #6b6353;
  font-size: 10.5px;
}
.ev-col-today .ev-col-head { color: #a0492c; }
.ev-col-empty { padding: 18px 0 10px; font-size: 12px; color: #b3aa99; }

.task {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 24px;
  gap: 8px;
  padding: 9px 10px;
  margin-bottom: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--task-color, var(--line-strong));
  border-radius: 10px;
  cursor: pointer;
  transition: box-shadow .14s, transform .14s, background .14s;
}
.task:hover {
  box-shadow: 0 4px 12px -6px rgba(30, 35, 40, .35);
  transform: translateY(-1px);
}
.task.overdue { background: #fffaf8; border-color: #eed6cd; }
.task.done { opacity: .55; }
.task.done .task-title { text-decoration: line-through; }

.task-main { min-width: 0; }
.task-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.task-title {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.task-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 3px;
}
.task-meta {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.task .due { font-size: 10.5px; padding: 3px 7px; flex: none; }
.task .kind { font-size: 10px; padding: 2px 6px; flex: none; }
.task .check { width: 16px; height: 16px; margin-top: 2px; }

.task-edit {
  align-self: center;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #b0a99b;
  cursor: pointer;
  opacity: .5;
  transition: opacity .14s, background .14s, color .14s;
}
.task-edit svg { width: 15px; height: 15px; }
.task:hover .task-edit { opacity: 1; }
.task-edit:hover { background: var(--accent-soft); color: var(--accent); }

/* 查看弹窗 */

.view-modal .modal-body { max-height: 68vh; }
.view-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-bottom: 14px;
}
.view-chip {
  font-size: 11.5px;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 3px 8px;
  border-radius: 7px;
}
.view-note {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink-2);
  min-height: 48px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
}
.view-empty { color: #b0a99b; }
.view-images {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.view-image {
  display: block;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f4f1ea;
}
.view-image img {
  display: block;
  width: 100%;
  height: 110px;
  object-fit: cover;
  transition: transform .2s;
}
.view-image:hover img { transform: scale(1.03); }

/* 备注图片上传 */

.note-images { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.note-images:empty { display: none; }
.note-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f4f1ea;
}
.note-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.note-thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 24, 28, .65);
  color: #fff;
  font-size: 13px;
  line-height: 20px;
  cursor: pointer;
}
.note-thumb-remove:hover { background: rgba(169, 66, 44, .9); }
.note-tools { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.note-upload { cursor: pointer; }
.note-upload svg { width: 15px; height: 15px; }
.note-hint { font-size: 11px; color: var(--muted); }

.ev-done-wrap { border-top: 1px solid var(--line); }
.ev-done-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  border: 0;
  background: var(--surface-2);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.ev-done-toggle:hover { background: #f3efe5; color: var(--ink); }
.ev-done-toggle span { margin-left: auto; font-weight: 500; }
.ev-done-list {
  padding: 10px 14px 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  background: var(--surface-2);
}
.ev-done-list .task { margin-bottom: 0; }

.quick-add {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  flex-wrap: wrap;
}
.quick-add input[name="title"] { flex: 1 1 220px; height: 34px; font-size: 12.5px; }
.quick-add input[type="date"] { width: 140px; height: 34px; font-size: 12px; }
.quick-add select { width: 80px; height: 34px; font-size: 12px; padding: 0 8px; }
.quick-add .btn { height: 34px; }

.ev-empty { padding: 34px 18px; }

@media (max-width: 900px) {
  .ev-columns { grid-template-columns: 1fr; }
  .ev-col { border-right: 0; border-bottom: 1px solid var(--line); }
  .ev-col:last-child { border-bottom: 0; }
  .ev-col.is-empty { display: none; }
  .ev-done-list { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .ev-toolbar { padding: 9px 12px; }
  .ev-search { width: 100%; }
  .task-title { font-size: 12.5px; }
  .task .kind { display: inline-block; }
  .task-edit { opacity: .8; }
  .view-images { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .view-image img { height: 92px; }
  .quick-add input[name="title"] { flex: 1 1 100%; }
  .quick-add input[type="date"] { flex: 1; }
}

/* ------------------------------ 编辑历史抽屉 ------------------------------ */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(24, 27, 29, .38);
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  width: min(430px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  box-shadow: -24px 0 70px rgba(20, 24, 28, .18);
  transform: translateX(102%);
  transition: transform .28s cubic-bezier(.22, .61, .36, 1);
}
.drawer.open { transform: none; }

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 18px 15px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 { font-size: 16px; font-weight: 700; }
.drawer-head p { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.drawer-body { flex: 1; overflow-y: auto; padding-bottom: 20px; }

.hist {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid #f0ece3;
}
.hist.undone { opacity: .5; }
.hist-main { flex: 1; min-width: 0; }
.hist-line { font-size: 12.5px; line-height: 1.45; color: var(--ink-2); word-break: break-word; }
.hist-line b { color: var(--ink); font-weight: 700; margin-right: 3px; }
.hist-time { font-size: 11px; color: #9aa0a6; margin-top: 3px; }

/* ------------------------------ 我的工作区 ------------------------------ */

.boards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(252px, 1fr));
  gap: 16px;
}

.board-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .16s, box-shadow .16s;
}
.board-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(31, 35, 40, .04), 0 18px 34px -20px rgba(31, 35, 40, .45);
}
.board-card h3 {
  font-size: 16.5px;
  font-weight: 700;
  margin-top: 4px;
  word-break: break-word;
}
.board-meta { font-size: 12.5px; color: var(--ink-2); }
.board-sub { font-size: 11.5px; color: var(--muted); }
.board-card footer {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.tile-new {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 7px;
  min-height: 172px;
  padding: 20px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .55);
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  font: inherit;
  transition: border-color .15s, background .15s, transform .15s;
}
.tile-new:hover {
  border-color: var(--accent);
  background: #fbfdfb;
  transform: translateY(-2px);
}
.tile-new .plus {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 20px;
  font-weight: 400;
  margin-bottom: 2px;
}
.tile-new b { font-size: 14.5px; }
.tile-new small { font-size: 12px; color: var(--muted); line-height: 1.45; }

.empty {
  padding: 36px 18px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.loading { padding: 90px 20px; text-align: center; font-size: 13px; color: var(--muted); }

/* ------------------------------ 登录 / 注册 ------------------------------ */

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(430px, .94fr);
}

.auth-art {
  position: relative;
  overflow: hidden;
  padding: 58px 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #eaf2ec;
  background:
    radial-gradient(120% 110% at 0% 0%, #2f6b57 0%, #1a4034 52%, #112b23 100%);
}
.auth-art::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 58px 58px;
  opacity: .7;
  pointer-events: none;
}

.art-inner { position: relative; max-width: 520px; }

.art-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .06em;
  margin-bottom: 42px;
}
.art-brand .brand-mark { box-shadow: none; background: rgba(255, 255, 255, .14); }
.art-brand span {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .16em;
  color: rgba(234, 242, 236, .55);
}

.auth-art h1 {
  font-size: clamp(30px, 3.4vw, 44px);
  line-height: 1.22;
  font-weight: 800;
  letter-spacing: -.01em;
  color: #f4f8f4;
}
.auth-art > .art-inner > p {
  margin-top: 16px;
  font-size: 14px;
  line-height: 1.75;
  color: rgba(234, 242, 236, .7);
  max-width: 400px;
}

.art-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin: 32px 0 26px;
  max-width: 340px;
}
.art-grid span {
  height: 36px;
  border-radius: 7px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .05);
}
.art-grid .blk {
  background: rgba(126, 196, 164, .3);
  border-color: rgba(126, 196, 164, .35);
}
.art-grid .blk-a { background: rgba(240, 196, 134, .32); border-color: rgba(240, 196, 134, .38); }
.art-grid .blk-b { background: rgba(168, 194, 235, .3); border-color: rgba(168, 194, 235, .36); }

.art-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.art-points li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: rgba(234, 242, 236, .72);
}
.art-points li::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: none;
  border-radius: 50%;
  background: rgba(126, 196, 164, .18);
  box-shadow: inset 0 0 0 1px rgba(126, 196, 164, .5);
  background-image: radial-gradient(circle, #9ed3b8 0 2.5px, transparent 3px);
}

.auth-side {
  display: grid;
  place-items: center;
  padding: 42px 24px;
  background:
    radial-gradient(80% 60% at 100% 100%, rgba(47, 107, 87, .07), transparent 60%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 404px;
  padding: 30px 28px 26px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 2px 4px rgba(31, 35, 40, .03), 0 30px 60px -34px rgba(31, 35, 40, .5);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.auth-brand h1 { font-size: 20px; font-weight: 800; letter-spacing: .04em; }
.auth-brand p { font-size: 12px; color: var(--muted); margin-top: 2px; }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 4px;
  border-radius: 11px;
  background: #f0ece2;
  margin-bottom: 20px;
}
.auth-tabs button {
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #61656b;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, box-shadow .15s, color .15s;
}
.auth-tabs button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}

.auth-form { display: flex; flex-direction: column; }
.auth-hint {
  margin-top: 16px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
  text-align: center;
}
.form-error {
  min-height: 20px;
  font-size: 12px;
  color: var(--danger);
  margin: -2px 0 8px;
}

/* ------------------------------ 表单 / 弹窗 ------------------------------ */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field > span i { font-style: normal; color: var(--danger); }

input, select, textarea {
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #b0a99b; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 107, 87, .14);
}
textarea { resize: vertical; min-height: 62px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.swatches { display: flex; gap: 9px; flex-wrap: wrap; padding-top: 2px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch span {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--c-bg);
  box-shadow: inset 0 0 0 3px var(--c-ink);
  transition: transform .12s, box-shadow .12s;
}
.swatch:hover span { transform: scale(1.06); }
.swatch input:checked + span {
  box-shadow: inset 0 0 0 3px var(--c-ink), 0 0 0 2px #fff, 0 0 0 3.5px var(--c-ink);
}

dialog.modal {
  width: min(468px, calc(100vw - 24px));
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 40px 90px -20px rgba(20, 24, 28, .5);
}
dialog.modal::backdrop {
  background: rgba(22, 26, 29, .44);
  backdrop-filter: blur(3px);
}
dialog.modal[open] { animation: pop .18s cubic-bezier(.22, .61, .36, 1); }
@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.modal-form { display: flex; flex-direction: column; max-height: min(88vh, 780px); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 16px; font-weight: 700; }
.modal-body { padding: 17px 20px 5px; overflow-y: auto; }
.modal-desc { font-size: 12.5px; color: var(--muted); line-height: 1.65; margin-bottom: 14px; }
.modal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 18px 18px;
}

/* ------------------------------ 提示条 ------------------------------ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  z-index: 120;
  transform: translate(-50%, 16px);
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  background: #22272b;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 12px 30px -10px rgba(20, 24, 28, .6);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #8e3524; }

/* ------------------------------ 响应式 ------------------------------ */

@media (max-width: 1080px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-side { min-height: 100vh; }
}

@media (max-width: 860px) {
  .page-head { align-items: flex-start; }
  .page-actions { width: 100%; }
  .sync { order: 3; width: 100%; }
}

@media (max-width: 720px) {
  .topbar-inner { padding: 0 14px; gap: 10px; height: 58px; }
  .brand { flex: none; }
  .brand-text small { display: none; }
  .brand-text b { font-size: 15px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 10px; }
  .tabs { margin-left: auto; padding: 3px; }
  .tab { padding: 6px 11px; font-size: 12.5px; }
  .user { flex: none; }
  .user-name { display: none; }
  .main { padding: 18px 14px 60px; }
  .page-title h1 { font-size: 23px; }
  .page-actions .btn { flex: 1 1 auto; }
  .sync { margin-right: 0; }
  .weekbar { padding: 9px 12px; gap: 8px; }
  .week-title { flex: 1 1 130px; }
  .week-title b { font-size: 13px; }
  .week-title span { font-size: 11px; }
  .week-arrow { width: 30px; height: 30px; }
  .ev { grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; padding: 12px 14px; }
  .kind { display: none; }
  .card-head { padding: 13px 14px; }
  .tt-card { border-radius: 14px; }
  .boards { grid-template-columns: 1fr; }
  .drawer { width: 100vw; }
  .modal-body { padding: 15px 16px 4px; }
  .modal-head { padding: 14px 16px; }
  .modal-foot { padding: 12px 16px; }
  .modal-foot .btn { flex: 1; }
  .modal-foot .spacer { display: none; }
  .auth-side { padding: 24px 14px; }
  .auth-card { padding: 24px 20px 22px; border-radius: 18px; }
}

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