/* ============================================================
   掌灯 Beacon · 纸墨风主题
   手工纸底 + 墨线 + 印章红，克制而不失性格
   ============================================================ */

:root {
  --paper: #F1E9DA;
  --paper-2: #E8DCC4;
  --paper-3: #FAF4E6;
  --ink: #221D16;
  --ink-soft: #6B6355;
  --ink-faint: #9B9180;
  --stamp: #C8402A;
  --stamp-deep: #A93320;
  --moss: #35503A;
  --line: rgba(34, 29, 22, 0.14);
  --line-strong: rgba(34, 29, 22, 0.32);
  --shadow: 0 1px 0 rgba(255,255,255,0.5) inset, 0 10px 24px -14px rgba(34,29,22,0.45);
  --font-display: "KaiTi", "STKaiti", "楷体", "Kaiti SC", "Ma Shan Zheng", cursive;
  --font-body: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  --font-mono: "SF Mono", "Consolas", "JetBrains Mono", "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(120% 90% at 20% -10%, #FBF6EA 0%, transparent 55%),
    radial-gradient(100% 80% at 110% 10%, #EFE3C8 0%, transparent 50%),
    var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 纸张颗粒（静态，避免闪烁） */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.10'/%3E%3C/svg%3E");
}

/* ---------- 布局 ---------- */
.app-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px clamp(16px, 4vw, 40px) 90px;
  position: relative;
  z-index: 1;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

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

.brand-mark {
  width: 54px; height: 54px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--paper-3);
  box-shadow: 3px 3px 0 var(--ink);
  overflow: hidden;
  display: grid; place-items: center;
  transform: rotate(-2deg);
}
.brand-mark img { width: 44px; height: 44px; display: block; }

.brand-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0.5px;
}
.brand-en {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--stamp);
  margin-left: 10px;
  vertical-align: 2px;
}
.brand-tag {
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  letter-spacing: 0.3px;
}

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

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 10px;
  padding: 10px 16px;
  border: 2px solid var(--ink);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:active { transform: translate(2px, 2px); box-shadow: none !important; }
.btn .ico { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.btn-primary {
  background: var(--ink);
  color: var(--paper-3);
  box-shadow: 3px 3px 0 var(--stamp);
}
.btn-primary:hover { background: #3a3023; }

.btn-ghost {
  background: var(--paper-3);
  color: var(--ink);
  box-shadow: 3px 3px 0 rgba(34,29,22,0.25);
}
.btn-ghost:hover { background: #fff; }

.icon-btn {
  position: relative;
  width: 42px; height: 42px;
  display: inline-grid; place-items: center;
  background: var(--paper-3);
  border: 2px solid var(--ink);
  border-radius: 11px;
  cursor: pointer;
  color: var(--ink);
  box-shadow: 2px 2px 0 rgba(34,29,22,0.22);
  transition: transform .12s ease;
}
.icon-btn:active { transform: translate(1px,1px); }
.icon-btn .ico { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .dot {
  position: absolute; top: 8px; right: 9px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--stamp); display: none;
}
.icon-btn .dot.on { display: block; }

/* ---------- 导航 ---------- */
.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 26px;
}
.tab {
  position: relative;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-soft);
  background: none;
  border: none;
  padding: 12px 18px;
  cursor: pointer;
  border: 2px solid transparent;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
}
.tab:hover { color: var(--ink); }
.tab.is-active {
  color: var(--ink);
  background: var(--paper-3);
  border-color: var(--ink);
  margin-bottom: -2px;
}
.tab-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--stamp);
  margin-left: 4px;
}

/* ---------- 视图通用 ---------- */
.view { animation: rise .4s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 400; letter-spacing: 1px;
}
.section-sub { font-size: 12px; color: var(--ink-soft); font-family: var(--font-mono); }

/* ---------- 工作台 ---------- */
.hero { margin-bottom: 26px; }
.hero-date { font-family: var(--font-mono); font-size: 12px; color: var(--stamp); letter-spacing: 1px; }
.hero-line { font-family: var(--font-display); font-size: clamp(26px, 5vw, 38px); font-weight: 400; margin: 6px 0 4px; }

.stat-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 26px; }
.stat {
  background: var(--paper-3);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat .n { font-family: var(--font-mono); font-size: 34px; font-weight: 600; line-height: 1; }
.stat .n em { font-style: normal; font-size: 16px; color: var(--ink-faint); margin-left: 3px; }
.stat .l { font-size: 13px; color: var(--ink-soft); margin-top: 8px; }
.stat.stamp .n { color: var(--stamp); }
.stat.moss .n { color: var(--moss); }

.beacon-card {
  position: relative;
  background: var(--paper-3);
  border: 2px solid var(--ink);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: 4px 4px 0 var(--ink);
  margin-bottom: 26px;
  overflow: hidden;
}
.beacon-card::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 6px;
  background: var(--stamp);
}
.beacon-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 2px; color: var(--stamp); text-transform: uppercase; }
.beacon-title { font-family: var(--font-display); font-size: 26px; margin: 6px 0 4px; }
.beacon-meta { font-size: 13px; color: var(--ink-soft); display: flex; gap: 14px; flex-wrap: wrap; }
.beacon-meta .tag {
  font-family: var(--font-mono); font-size: 11px;
  border: 1.5px solid currentColor; border-radius: 6px; padding: 2px 7px;
}

.project-rail { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.mini-card {
  flex: 0 0 210px;
  background: var(--paper-3);
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(34,29,22,0.2);
  position: relative;
}
.mini-card .swatch-dot { position: absolute; top: 13px; right: 13px; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--ink); }
.mini-card h4 { font-size: 15px; margin-bottom: 3px; }
.mini-card p { font-size: 12px; color: var(--ink-soft); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini-card .mini-time { font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint); margin-top: 8px; display: block; }

/* ---------- 项目卡片（便签） ---------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.project-card {
  position: relative;
  background: var(--paper-3);
  border: 2px solid var(--ink);
  border-radius: 6px 14px 14px 14px;
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
  transition: transform .16s ease, box-shadow .16s ease;
  animation: pop .45s ease both;
}
.project-card:nth-child(3n+1) { transform: rotate(-0.7deg); }
.project-card:nth-child(3n+2) { transform: rotate(0.5deg); }
.project-card:nth-child(3n+3) { transform: rotate(-0.3deg); }
.project-card:hover { transform: translateY(-4px) rotate(0deg); box-shadow: 0 18px 30px -16px rgba(34,29,22,0.5); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; } }

.project-card .tape {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%) rotate(-2deg);
  width: 64px; height: 20px;
  background: rgba(240,226,180,0.85);
  border: 1px solid rgba(34,29,22,0.15);
  border-radius: 2px;
}
.project-card .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.project-card .swatch-dot { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--ink); flex-shrink: 0; }
.project-card h3 { font-size: 17px; font-weight: 700; flex: 1; word-break: break-word; }
.project-card .desc { font-size: 12.5px; color: var(--ink-soft); line-height: 1.55; margin: 8px 0 14px; min-height: 20px; }

.status-badge {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.5px;
  border: 1.5px solid var(--ink); border-radius: 5px; padding: 2px 7px;
}
.status-badge.active { color: var(--moss); }
.status-badge.paused { color: var(--ink-soft); }
.status-badge.done { color: var(--ink-faint); text-decoration: line-through; }

.project-card .meta {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1.5px dashed var(--line-strong);
  padding-top: 10px;
}
.project-card .meta .next {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-soft);
  display: flex; align-items: center; gap: 5px;
}
.project-card .card-actions { display: flex; gap: 6px; }
.chip-btn {
  font-size: 12px; font-weight: 600; cursor: pointer;
  background: var(--paper); border: 1.5px solid var(--ink);
  border-radius: 7px; padding: 4px 9px; color: var(--ink);
}
.chip-btn:hover { background: var(--paper-2); }
.chip-btn.danger { color: var(--stamp); }

/* ---------- 提醒列表 ---------- */
.filter-row { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 16px; }
.filter {
  font-size: 13px; font-weight: 600; cursor: pointer;
  background: var(--paper-3); border: 1.5px solid var(--ink);
  border-radius: 999px; padding: 6px 14px; color: var(--ink-soft);
}
.filter.is-active { background: var(--ink); color: var(--paper-3); }

.reminder-list { display: flex; flex-direction: column; gap: 12px; }
.reminder-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--paper-3);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 15px 18px;
  box-shadow: var(--shadow);
  position: relative;
  transition: opacity .2s ease;
}
.reminder-item::before {
  content: ""; position: absolute; left: -2px; top: 12px; bottom: 12px; width: 5px;
  border-radius: 0 3px 3px 0; background: var(--c, var(--stamp));
}
.reminder-item.overdue { box-shadow: 0 0 0 2px var(--stamp), var(--shadow); }
.reminder-item.done { opacity: .55; }
.reminder-item.done .r-title { text-decoration: line-through; }

.cbox {
  width: 22px; height: 22px; flex-shrink: 0; cursor: pointer;
  accent-color: var(--moss);
}
.r-time {
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft);
  min-width: 88px; flex-shrink: 0; line-height: 1.3;
}
.r-time b { display: block; font-size: 16px; color: var(--ink); font-weight: 600; }
.r-time.over { color: var(--stamp); }
.r-time.over b { color: var(--stamp); }

.r-body { flex: 1; min-width: 0; }
.r-title { font-size: 15px; font-weight: 700; }
.r-note { font-size: 12px; color: var(--ink-soft); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-project {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-soft);
  margin-top: 6px;
}
.r-project .swatch-dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--ink); }
.r-repeat { font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint); border: 1px solid var(--line-strong); border-radius: 5px; padding: 1px 6px; }

.r-del { background: none; border: none; cursor: pointer; color: var(--ink-faint); font-size: 18px; padding: 4px; }
.r-del:hover { color: var(--stamp); }

/* ---------- 空状态 ---------- */
.empty {
  text-align: center; padding: 52px 20px;
  border: 2px dashed var(--line-strong); border-radius: 18px;
}
.empty .big { font-family: var(--font-display); font-size: 26px; margin-bottom: 8px; }
.empty p { font-size: 13px; color: var(--ink-soft); margin-bottom: 18px; }

/* ---------- 抽屉 ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(34,29,22,0.42);
  backdrop-filter: blur(2px);
  transition: opacity .25s ease;
}
.scrim[hidden] { display: block; opacity: 0; pointer-events: none; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 100;
  width: min(420px, 92vw);
  background: var(--paper-3);
  border-left: 2px solid var(--ink);
  box-shadow: -6px 0 30px -10px rgba(34,29,22,0.45);
  transform: translateX(105%);
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px; border-bottom: 2px solid var(--ink);
}
.drawer-head h2 { font-family: var(--font-display); font-size: 24px; font-weight: 400; }
.drawer-body { padding: 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.drawer-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.field em { color: var(--stamp); font-style: normal; }
.field input, .field select, .field textarea {
  font-family: var(--font-body); font-size: 15px; color: var(--ink);
  background: #fff; border: 2px solid var(--ink); border-radius: 10px;
  padding: 11px 13px; width: 100%;
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  box-shadow: 3px 3px 0 var(--stamp);
}
.field textarea { resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-btn {
  font-size: 13px; font-weight: 600; cursor: pointer;
  background: #fff; border: 1.5px solid var(--ink); border-radius: 8px;
  padding: 7px 13px; color: var(--ink-soft);
}
.seg-btn.is-active { background: var(--ink); color: var(--paper-3); }

.swatches { display: flex; gap: 9px; flex-wrap: wrap; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  background: var(--c); border: 2px solid var(--ink);
  transition: transform .12s ease;
}
.swatch[data-selected="true"] { transform: scale(1.18); box-shadow: 0 0 0 2px var(--paper-3), 0 0 0 4px var(--ink); }
.swatch:hover { transform: scale(1.1); }

/* ---------- 轻提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 120;
  transform: translate(-50%, 20px);
  background: var(--ink); color: var(--paper-3);
  font-size: 14px; padding: 12px 20px; border-radius: 12px;
  box-shadow: 4px 4px 0 var(--stamp);
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 页脚 ---------- */
.foot {
  margin-top: 40px; padding-top: 16px;
  border-top: 1.5px dashed var(--line-strong);
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-faint);
}
.foot-mono { font-family: var(--font-mono); }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .brand-title { font-size: 25px; }
  .brand-tag { display: none; }
  .topbar-actions { width: 100%; justify-content: flex-end; }
  .btn-primary span, .btn-ghost span { display: none; }
  .stat-strip { grid-template-columns: 1fr 1fr; }
  .stat:last-child { grid-column: span 2; }
  .stat .n { font-size: 28px; }
  .tabs { overflow-x: auto; }
  .tab { white-space: nowrap; }
  .reminder-item { flex-wrap: wrap; }
  .r-time { min-width: auto; }
}

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