/* ===========================================================
   拾记 · 样式表
   浅色为默认，深色由 html[data-theme="dark"] 覆盖
   =========================================================== */

:root {
  color-scheme: light;
  --bg: #f5f5f1;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --surface-3: #f0efe9;
  --text: #1e1e1b;
  --muted: #6f6f68;
  --faint: #9b9b92;
  --border: #e7e6df;
  --border-strong: #d3d2c9;
  --accent: #4c5bd4;
  --accent-soft: #eceefb;
  --accent-line: rgba(76, 91, 212, .32);
  --accent-wash: rgba(76, 91, 212, .05);
  --accent-text: #ffffff;
  --danger: #c8443c;
  --shadow: 0 1px 2px rgba(28, 28, 24, .05), 0 10px 30px rgba(28, 28, 24, .08);
  --shadow-item: 0 8px 20px rgba(28, 28, 24, .11), 0 1px 2px rgba(28, 28, 24, .06);
  --radius: 14px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131312;
  --surface: #1b1b19;
  --surface-2: #202020;
  --surface-3: #262624;
  --text: #ecece6;
  --muted: #a3a39a;
  --faint: #77776f;
  --border: #2c2c29;
  --border-strong: #3a3a36;
  --accent: #7b86f0;
  --accent-soft: #23253c;
  --accent-line: rgba(123, 134, 240, .42);
  --accent-wash: rgba(123, 134, 240, .08);
  --accent-text: #0d0e14;
  --danger: #e06a62;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 36px rgba(0, 0, 0, .45);
  --shadow-item: 0 8px 20px rgba(0, 0, 0, .5), 0 1px 2px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body.is-locked { overflow: hidden; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.app {
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 18px 80px;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 -18px;
  padding: 14px 18px 12px;
  background: var(--bg);
}

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

.brand-mark {
  width: 34px; height: 34px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .5px;
}
.brand-mark.big { width: 52px; height: 52px; border-radius: 15px; font-size: 24px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-size: 15px; letter-spacing: .5px; }
.brand-text span {
  font-size: 11.5px; color: var(--faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.searchbox { position: relative; flex: 1 1 220px; max-width: 380px; }
.searchbox svg {
  position: absolute; left: 11px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  fill: none; stroke: var(--faint); stroke-width: 1.8; stroke-linecap: round;
  pointer-events: none;
}
.searchbox input {
  width: 100%;
  padding: 8px 12px 8px 33px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13.5px;
}
.searchbox input::placeholder { color: var(--faint); }

.top-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: scale(.985); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--surface-2); border-color: var(--danger); }
.btn.wide { width: 100%; }

.icon-btn {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.link-btn {
  border: 0; background: transparent; padding: 0;
  color: var(--accent); font-size: 12px;
  text-decoration: underline; text-underline-offset: 2px;
}

.muted { color: var(--muted); }
.hint { margin: 6px 0 0; font-size: 12px; color: var(--faint); }
.spacer { flex: 1; }

/* ---------- 视图切换 ---------- */

.tabs {
  display: inline-flex;
  gap: 4px;
  margin: 2px 0 16px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 16px;
  border: 0; border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
}
.tab:hover { color: var(--text); }
.tab.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .07);
}
.tab-count { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }

.view.is-hidden { display: none; }

.view-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  margin: 4px 0 12px;
}
.view-toolbar h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: .3px; }
.toolbar-actions { display: flex; align-items: center; gap: 6px; }

/* ---------- 快速添加 ---------- */

.quickadd {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 9px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.quickadd input[type="text"] {
  flex: 1 1 220px; min-width: 0;
  border: 0; background: transparent;
  padding: 6px 8px;
  font-size: 14.5px;
}
.quickadd input[type="text"]::placeholder { color: var(--faint); }
.quickadd input[type="date"] {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 5px 8px;
  font-size: 12.5px;
  color: var(--muted);
}
.quickadd select {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 5px 8px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- 筛选 ---------- */

.filterbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.is-active { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip-n { font-size: 10.5px; opacity: .65; font-variant-numeric: tabular-nums; }

/* ---------- 清单 ---------- */

.group-head {
  display: flex; align-items: center; gap: 8px;
  padding: 16px 2px 8px;
}
.group-title { font-size: 12.5px; font-weight: 600; letter-spacing: .3px; }
.group-count { font-size: 11px; color: var(--faint); }
.group-head .link-btn { margin-left: auto; }

.items {
  list-style: none;
  margin: 0; padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.item { display: flex; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--border); }
.item:first-child { border-top: 0; }
.item:hover { background: var(--surface-2); }

.check {
  width: 20px; height: 20px; flex: none;
  margin-top: 1px; padding: 0;
  display: grid; place-items: center;
  border: 1.6px solid var(--border-strong);
  border-radius: 50%;
  background: transparent;
  transition: background .15s, border-color .15s;
}
.check:hover { border-color: var(--accent); }
.check svg { width: 11px; height: 11px; opacity: 0; color: var(--accent-text); }
.is-done .check { background: var(--accent); border-color: var(--accent); }
.is-done .check svg { opacity: 1; }

.item-body { flex: 1; min-width: 0; cursor: pointer; }
.item-title {
  font-size: 14.5px;
  line-height: 1.5;
  word-break: break-word;
}
.item.is-done .item-title { color: var(--faint); text-decoration: line-through; }
.item-note {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.item.is-done .item-note { color: var(--faint); }

.item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 5px; }

.pin {
  margin-left: 6px;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--faint);
  vertical-align: 1px;
}

.due { font-size: 12px; color: var(--muted); white-space: nowrap; }
.due.is-today { color: var(--accent); font-weight: 600; }
.due.is-overdue { color: var(--danger); font-weight: 600; }

.tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--c-soft, var(--surface-3));
  color: var(--c, var(--muted));
  font-size: 11.5px;
  white-space: nowrap;
}

:root[data-theme="dark"] .tag { color: color-mix(in srgb, var(--c, #999) 62%, #fff); }

.tag-editor { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-editor .tag { padding-right: 4px; }
.tag-editor .tag button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0 2px;
  font-size: 13px;
  line-height: 1;
  opacity: .55;
}
.tag-editor .tag button:hover { opacity: 1; }

.empty {
  padding: 52px 20px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.empty-icon { font-size: 26px; color: var(--faint); margin-bottom: 6px; }
.empty p { margin: 4px 0; font-size: 13.5px; }

/* ---------- 日历 ---------- */

.cal-month {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.cal-weekhead {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.cal-weekhead span {
  padding: 7px 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }

.cal-cell {
  min-height: 104px;
  padding: 6px 7px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: background .12s;
}
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.is-other { background: var(--surface-2); }
.cal-cell.is-other .cal-daynum { color: var(--faint); }
.cal-cell.is-today { background: var(--accent-soft); }
.cal-cell.is-today:hover { background: var(--accent-soft); }

.cal-daynum { font-size: 11.5px; font-weight: 600; margin-bottom: 5px; }
.cal-cell.is-today .cal-daynum { color: var(--accent); }

.cal-evs { display: flex; flex-direction: column; gap: 3px; }
.cal-ev {
  display: block;
  padding: 2px 5px;
  border-radius: 5px;
  font-size: 11px;
  line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
}
.cal-ev.is-course {
  background: var(--c-soft);
  border-left: 2px solid var(--c);
  color: var(--text);
}
.cal-ev.is-task { color: var(--text); }
.cal-ev.is-task:hover { background: var(--surface-3); }
.cal-ev.is-task.is-done { color: var(--faint); text-decoration: line-through; }
.dot {
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--c, var(--faint));
  vertical-align: 1px;
}
.cal-more { font-size: 10.5px; color: var(--faint); padding-left: 2px; }

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

.tt-scroll {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.tt-board { min-width: 700px; }

.tt-headrow {
  display: grid;
  grid-template-columns: 58px repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.tt-headcell {
  padding: 8px 4px;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
  border-left: 1px solid var(--border);
}
.tt-headcell.is-today { color: var(--accent); font-weight: 650; }
.tt-headcell.is-today .tt-md { color: var(--accent); }
.tt-wd { display: block; }
.tt-md { font-size: 10.5px; color: var(--faint); }

.tt-bodyrow {
  display: grid;
  grid-template-columns: 58px repeat(7, minmax(0, 1fr));
  position: relative;
}
.tt-timecol { position: relative; border-right: 1px solid var(--border); }
.tt-timelabel {
  position: absolute; left: 0; right: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 9.5px;
  color: var(--faint);
  line-height: 1.25;
}
.tt-timelabel b { font-size: 11px; font-weight: 600; color: var(--muted); }

.tt-daycol {
  position: relative;
  border-left: 1px solid var(--border);
  cursor: pointer;
}
.tt-daycol:hover { background: var(--surface-2); }

.tt-stripe { position: absolute; left: 0; right: 0; pointer-events: none; }
.tt-stripe.is-alt { background: var(--surface-2); }

.tt-course {
  position: absolute;
  left: 3px; right: 3px;
  display: flex; flex-direction: column; gap: 1px;
  padding: 5px 7px;
  text-align: left;
  border: 0;
  border-left: 3px solid var(--c);
  border-radius: 7px;
  background: var(--c-soft);
  overflow: hidden;
  font-size: 11.5px;
  line-height: 1.35;
  z-index: 1;
}
.tt-course:hover { filter: brightness(.97); }
.tt-cname { font-weight: 600; word-break: break-word; }
.tt-cloc, .tt-ctime {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tt-range { margin-left: 8px; font-size: 12px; font-weight: 400; color: var(--faint); }

/* ---------- 弹层 ---------- */

.modal-root { position: fixed; inset: 0; z-index: 60; display: none; }
.modal-root.is-open { display: block; }
.modal-layer {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-scrim {
  position: absolute; inset: 0;
  background: rgba(18, 18, 14, .42);
  backdrop-filter: blur(3px);
}
.modal {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow: auto;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  animation: pop .16s ease-out;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(6px) scale(.99); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 16px;
}
.modal-head h2 { margin: 0; font-size: 17px; font-weight: 650; }
.modal-head h2 .muted { font-size: 12px; font-weight: 400; margin-left: 6px; }

.modal-foot {
  display: flex; align-items: center; gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ---------- 表单 ---------- */

.field { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; margin-bottom: 12px; }
.field > span { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  font-size: 14px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  background: var(--surface);
  outline: none;
}
.field textarea { resize: vertical; min-height: 64px; }

.field-row { display: flex; gap: 10px; flex-wrap: wrap; }
.field-row .field { flex: 1 1 120px; }

.switch-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px;
  padding: 6px 0;
  cursor: pointer;
}
.switch-row input { width: 16px; height: 16px; accent-color: var(--accent); }

.seg {
  display: inline-flex; gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.seg label {
  position: relative;
  display: inline-flex; align-items: center;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .07);
}

.swatches { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 2px; }
.swatch {
  width: 24px; height: 24px;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--c);
  padding: 0;
}
.swatch.is-on { border-color: var(--text); box-shadow: inset 0 0 0 2px var(--surface); }

.period-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.period-row { display: flex; align-items: center; gap: 6px; }
.period-idx {
  width: 18px;
  font-size: 11px;
  color: var(--faint);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.period-row input {
  flex: 1; min-width: 0;
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  font-size: 12.5px;
}
.period-sep { color: var(--faint); font-size: 11px; }

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

/* ---------- 日程详情 ---------- */

.day-section { margin-bottom: 16px; }
.day-section h3 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .4px;
}
.day-course, .day-task {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 13.5px;
}
.day-course:hover, .day-task:hover { background: var(--surface-2); }
.day-course i {
  width: 4px; height: 26px;
  border-radius: 2px;
  background: var(--c);
  flex: none;
}
.day-course > div { display: flex; flex-direction: column; min-width: 0; }
.day-course span { font-size: 11.5px; color: var(--muted); }
.day-task.is-done span { color: var(--faint); text-decoration: line-through; }
.day-task .check { width: 18px; height: 18px; margin-top: 0; }

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

.toast {
  position: fixed;
  left: 50%; bottom: 28px;
  z-index: 90;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 锁屏 ---------- */

.lock {
  position: fixed; inset: 0;
  z-index: 100;
  display: grid; place-items: center;
  padding: 24px;
  background: var(--bg);
}
.lock-card {
  width: 100%; max-width: 300px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center;
}
.lock-card h1 { margin: 2px 0 0; font-size: 20px; letter-spacing: 1px; }
.lock-card p { margin: 0; font-size: 13px; }
.lock-card input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  text-align: center;
  letter-spacing: 3px;
  font-size: 16px;
}
.lock-error { color: var(--danger); font-size: 12px; }
.lock-hint { margin-top: 6px; font-size: 11px; color: var(--faint); }

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

@media (max-width: 720px) {
  .app { padding: 0 12px 64px; }
  .topbar { flex-wrap: wrap; gap: 10px; margin: 0 -12px; padding: 12px 12px 10px; }
  .brand { flex: 1; }
  .brand-text span { display: none; }
  .searchbox { order: 3; flex-basis: 100%; max-width: none; }
  .top-actions { margin-left: 0; }
  .btn { padding: 7px 12px; font-size: 13px; }
  .tabs { display: flex; width: 100%; }
  .tab { flex: 1; justify-content: center; padding: 7px 0; }

  .cal-cell { min-height: 74px; padding: 5px 4px; }
  .cal-daynum { font-size: 11px; margin-bottom: 3px; }
  .cal-ev { font-size: 10px; padding: 1px 3px; }
  .cal-weekhead span { font-size: 11px; }

  .modal-layer { align-items: flex-end; padding: 0; }
  .modal {
    max-width: none;
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  }
  .period-grid { grid-template-columns: 1fr; }

  .item { padding: 11px 12px; gap: 10px; }
  .item-title { font-size: 14px; }
  .quickadd input[type="text"] { flex-basis: 100%; }
  .quickadd .btn { margin-left: auto; }
}

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

/* ===========================================================
   第二批：底气、习惯、排期块、拖动
   =========================================================== */

/* ---------- 底气条 ---------- */

.vibe {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: background .15s;
}
.vibe:hover { background: var(--surface-2); }

.vibe-main { display: flex; align-items: baseline; gap: 6px; flex: none; }
.vibe-num {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: .5px;
  font-variant-numeric: tabular-nums;
}
.vibe-label { font-size: 11.5px; color: var(--faint); }
.vibe-level {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
}

.vibe-track {
  flex: 1;
  min-width: 40px;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.vibe-track i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #8a5cd6);
  transition: width .3s;
}
.vibe-today { flex: none; font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.vibe-big { display: flex; align-items: center; gap: 14px; margin: 6px 0 14px; }
.vibe-big-num {
  font-size: 42px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.vibe-big-side { display: flex; flex-direction: column; gap: 2px; }
.vibe-big-side b { font-size: 15px; }
.vibe-big-side span { font-size: 12px; color: var(--muted); }
.vibe-track.big { height: 8px; margin-bottom: 16px; }

.stat-row { display: flex; gap: 8px; margin-bottom: 12px; }
.stat {
  flex: 1;
  padding: 10px 6px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.stat b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--faint); }

.breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 12.5px;
  color: var(--muted);
}

.ladder-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.ladder {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--faint);
}
.ladder i { font-style: normal; font-size: 10px; opacity: .6; margin-left: 4px; }
.ladder.is-on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- 习惯 ---------- */

.habits {
  display: flex;
  gap: 10px;
  margin-bottom: 2px;
  padding: 2px 2px 10px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.habits::-webkit-scrollbar { height: 6px; }

.habit {
  flex: 0 0 214px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.habit:hover { background: var(--surface-2); }
.habit.is-on { border-color: var(--accent); background: var(--accent-soft); }

.habit-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.habit-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.habit-streak { font-size: 11px; color: var(--danger); white-space: nowrap; }
.habit.is-on .habit-streak { color: var(--accent); }
.habit-sub { font-size: 11px; color: var(--faint); }

.habit-bar { height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.habit-bar i { display: block; height: 100%; background: var(--accent); transition: width .3s; }

.habit-dots { display: flex; gap: 5px; }
.habit-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--surface-3); }
.habit-dots span.on { background: var(--accent); }
.habit-dots span.today { box-shadow: 0 0 0 1.5px var(--accent); }

.habit-check {
  margin-top: 2px;
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  font-size: 12px;
}
.habit-check.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.habit-check:disabled { opacity: .45; cursor: default; }

.habit-add {
  flex: 0 0 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  background: transparent;
  color: var(--faint);
  font-size: 12px;
}
.habit-add:hover { color: var(--text); border-color: var(--border); }

/* ---------- 未排期提示 ---------- */

.hintbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  margin-bottom: 12px;
  background: var(--accent-soft);
  border-radius: 12px;
  font-size: 12.5px;
  color: var(--accent);
}
.hintbar .btn {
  margin-left: auto;
  padding: 5px 12px;
  font-size: 12px;
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}
.hintbar .btn:hover { background: var(--surface); }

/* ---------- 清单里的类型标记 ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .2px;
}
.badge.hw { background: rgba(200, 68, 60, .13); color: var(--danger); }

.item.is-hw { box-shadow: inset 3px 0 0 var(--danger); }

.est { font-size: 11.5px; color: var(--faint); }
.slot-chip {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  white-space: nowrap;
}
.due.is-urgent { color: var(--danger); font-weight: 600; }

.est-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.est-row input[type="number"] {
  width: 76px;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  font-size: 14px;
}
.est-row .unit { font-size: 12px; color: var(--faint); }
.est-chips { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.mini {
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 11.5px;
  color: var(--muted);
}
.mini:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 课程表：图例与安排块 ---------- */

.tt-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 2px 8px;
  font-size: 11.5px;
  color: var(--faint);
}
.lg { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-left: 10px; }
.lg:first-child { margin-left: 0; }
.lg-course { background: rgba(90, 100, 190, .32); }
.lg-item { border: 1px dashed var(--accent); background: var(--accent-soft); }

.tt-item {
  position: absolute;
  left: 3px;
  right: 3px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 7px;
  text-align: left;
  border: 1px dashed var(--accent);
  border-left: 3px solid var(--accent);
  border-radius: 7px;
  background: var(--accent-soft);
  font-size: 11px;
  line-height: 1.35;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.tt-item:hover { filter: brightness(.98); }
.tt-item:active { cursor: grabbing; }
.tt-iname {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tt-itime {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.is-dragging { cursor: grabbing; user-select: none; -webkit-user-select: none; }

.drag-label {
  position: fixed;
  z-index: 200;
  transform: translate(14px, 14px);
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 11.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.drag-hl {
  position: absolute;
  left: 3px;
  right: 3px;
  z-index: 0;
  border: 1.5px dashed var(--accent);
  border-radius: 8px;
  background: var(--accent-soft);
  pointer-events: none;
}

/* ---------- 排期预览 ---------- */

.preview-day { margin: 12px 0 6px; font-size: 12px; color: var(--muted); }
.preview-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 13px;
}
.preview-time {
  font-size: 12px;
  color: var(--accent);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.preview-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 某天详情里的安排 ---------- */

.day-slot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 6px;
  border: 1px dashed var(--accent);
  border-radius: 10px;
  background: var(--accent-soft);
  font-size: 13.5px;
  cursor: pointer;
}
.day-slot-time {
  font-size: 12px;
  color: var(--accent);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
  .vibe { flex-wrap: wrap; gap: 8px; padding: 9px 12px; }
  .vibe-track { order: 3; flex-basis: 100%; }
  .vibe-today { order: 2; margin-left: auto; }
  .habit { flex-basis: 190px; }
  .tt-item { padding: 3px 5px; }
  .est-chips { margin-left: 0; }
}

/* ===========================================================
   第三批：固定头尾的弹窗、休息时段、首次引导
   =========================================================== */

.modal.is-fixed {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.modal.is-fixed .modal-head {
  flex: none;
  margin: 0;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.modal.is-fixed .modal-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px 20px;
}
.modal.is-fixed .modal-foot {
  flex: none;
  margin: 0;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.modal.is-fixed .modal-foot .btn { box-shadow: none; }

/* ---------- 不排期时段 ---------- */

.rest-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
}
.rest-row:last-child { border-bottom: 0; }

.rest-days { display: flex; gap: 3px; }
.rd { position: relative; display: inline-flex; }
.rd input { position: absolute; opacity: 0; pointer-events: none; }
.rd span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.rd:has(input:checked) span {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.rest-row input[type="time"] {
  width: 92px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  font-size: 12px;
}
.rest-sep { color: var(--faint); font-size: 11px; }
.rest-del { width: 28px; height: 28px; font-size: 12px; }

/* ---------- 首次引导 ---------- */

.onboard-block { margin-bottom: 18px; }
.onboard-block h3 { margin: 0 0 6px; font-size: 13px; font-weight: 650; }
.onboard-text {
  margin: 0 0 8px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

.habit-add.wide {
  flex: 0 0 232px;
  align-items: flex-start;
  padding: 14px;
  gap: 4px;
  text-align: left;
}
.habit-add.wide b { font-size: 13.5px; font-weight: 650; color: var(--text); }
.habit-add.wide span { font-size: 11.5px; }

@media (max-width: 720px) {
  .modal.is-fixed .modal-head { padding: 16px 16px 10px; }
  .modal.is-fixed .modal-body { padding: 12px 16px; }
  .modal.is-fixed .modal-foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .rest-row input[type="time"] { width: 84px; }
  .habit-add.wide { flex-basis: 210px; }
}

/* ===========================================================
   第四批：交互质感（悬停淡色、彩色描边、焦点光晕）
   =========================================================== */

/* 按钮 */
.btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}
.btn.primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  filter: brightness(1.06);
}
.btn.danger:hover {
  background: var(--accent-wash);
  border-color: rgba(200, 68, 60, .35);
  color: var(--danger);
}
.icon-btn:hover { background: var(--accent-wash); color: var(--accent); }
.link-btn:hover { text-decoration-thickness: 2px; }

/* 搜索与输入 */
.searchbox input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* 视图切换 */
.tab:hover { background: var(--accent-wash); color: var(--accent); }
.tab.is-active { color: var(--accent); }

/* 筛选与标签 */
.chip:hover {
  background: var(--accent-wash);
  border-color: var(--accent-line);
  color: var(--accent);
}
.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.chip.is-active .chip-n { opacity: .75; }

/* 快速添加 */
.quickadd:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* 清单 */
.item:hover { background: var(--accent-wash); }
.item:not(.is-hw):hover { box-shadow: inset 2px 0 0 var(--accent-line); }

.group-title::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 6px;
  border-radius: 2px;
  background: var(--accent);
  opacity: .8;
  vertical-align: 1px;
}
.group[data-group="overdue"] .group-title::before { background: var(--danger); }
.group[data-group="pinned"] .group-title::before { background: #d9822b; }
.group[data-group="done"] .group-title::before { background: var(--faint); }

/* 习惯卡与灵气条 */
.habit:hover { background: var(--accent-wash); border-color: var(--accent-line); }
.habit.is-on:hover { background: var(--accent-soft); }
.vibe:hover { background: var(--accent-wash); border-color: var(--accent-line); }

/* 日历 */
.cal-cell:hover { background: var(--accent-wash); }
.cal-cell.is-today { box-shadow: inset 0 0 0 1px var(--accent-line); }
.cal-ev.is-task:hover { background: var(--accent-soft); }

/* 课程表块 */
.tt-course:hover,
.tt-item:hover {
  filter: none;
  box-shadow: 0 4px 12px rgba(28, 28, 24, .12);
}
.tt-item:hover { border-color: var(--accent); }

/* 分段选择与复选框 */
.seg label:has(input:checked) {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-line), 0 1px 2px rgba(0, 0, 0, .05);
}
.rd:hover span { border-color: var(--accent-line); color: var(--accent); }

/* 弹窗内的行 */
.preview-row:hover,
.day-course:hover,
.day-slot:hover,
.day-task:hover {
  background: var(--accent-wash);
  border-color: var(--accent-line);
}
.rest-row:hover { background: var(--accent-wash); }

/* 引导 */
.onboard-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.onboard-note { font-size: 11.5px; color: var(--faint); }
.onboard-block h3::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 6px;
  border-radius: 2px;
  background: var(--accent);
  opacity: .8;
  vertical-align: 1px;
}

/* 空状态与品牌 */
.empty-icon { color: var(--accent); opacity: .55; }
.brand-mark { background: linear-gradient(135deg, var(--accent), #8a5cd6); }

/* ===========================================================
   第五批：清单条目改成独立卡片，悬停浮起
   =========================================================== */

.items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: visible;
}

.item {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(28, 28, 24, .04);
  transition: transform .14s ease, box-shadow .16s ease,
    border-color .16s ease, background .16s ease;
}

.item:first-child { border-top: 1px solid var(--border); }

.item.is-done { background: var(--surface-2); box-shadow: none; }

.item:hover {
  background: var(--surface);
  border-color: var(--accent-line);
  transform: translateY(-1px);
  box-shadow: var(--shadow-item);
}

.item:not(.is-hw):hover {
  box-shadow: inset 2px 0 0 var(--accent-line), var(--shadow-item);
}

.item.is-hw { box-shadow: inset 3px 0 0 var(--danger); }

.item.is-hw:hover {
  box-shadow: inset 3px 0 0 var(--danger), var(--shadow-item);
}

.item.is-done:hover {
  background: var(--surface);
  transform: none;
}

.item:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(28, 28, 24, .08);
}

@media (max-width: 720px) {
  .items { gap: 6px; }
  .item { border-radius: 11px; }
}

/* ---------- 引导里的不排期时段（可改时间） ---------- */

.rest-edit {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px 0;
}
.rest-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 92px;
  font-size: 13px;
  cursor: pointer;
}
.rest-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.rest-edit input[type="time"] {
  width: 88px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  font-size: 12px;
}
.rest-edit input[type="time"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}
.rest-edit:has(.rest-check input:not(:checked)) input[type="time"] { opacity: .45; }

@media (max-width: 720px) {
  .rest-check { min-width: 78px; }
  .rest-edit input[type="time"] { width: 80px; }
}

/* ===========================================================
   第六批：导入课表
   =========================================================== */

.toolbar-actions { flex-wrap: wrap; justify-content: flex-end; }

.imp-text {
  width: 100%;
  min-height: 132px;
  margin: 6px 0 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, "PingFang SC", monospace;
  font-size: 12px;
  line-height: 1.6;
  resize: vertical;
}
.imp-text:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

.imp-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 6px;
}

.imp-preview {
  max-height: 240px;
  margin-top: 8px;
  padding-top: 6px;
  overflow: auto;
  border-top: 1px dashed var(--border);
}

.preview-meta {
  max-width: 46%;
  font-size: 11.5px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.imp-replace { margin-bottom: 0; }

@media (max-width: 720px) {
  .preview-meta { max-width: 38%; }
}
