/* ==================================================================
   每日工作台 · 视觉系统
   浅色主题 / 卡片式布局 / 响应式（1180 · 820 · 560）
   结构：基础与令牌 → 布局 → 侧栏 → 顶栏 → 卡片 → 控件
        → 表单 → 记录列表 → 看板 → 热图 → 图表 → 日程清单
        → 图片 → 浮层 → 响应式
   ================================================================== */

:root {
  /* 色彩 */
  --bg: #f2f7f7;
  --bg-grad: linear-gradient(180deg, #f8fcfc 0%, #f1f6f6 320px, #f1f6f6 100%);
  --panel: #ffffff;
  --panel-soft: #f6fbfa;
  --panel-tint: #fbfdfd;
  --line: #e2edec;
  --line-soft: #ecf3f2;
  --text: #171b23;
  --text-mid: #4a5a59;
  --text-soft: #88999a;

  --accent: #0ea5a4;
  --accent-deep: #0a7373;
  --accent-soft: #e6f7f6;
  --accent-ring: rgba(14, 165, 164, .16);

  --green: #159c63;
  --green-soft: #e8f7f0;
  --amber: #c9770a;
  --amber-soft: #fff5e6;
  --red: #d64545;
  --red-soft: #fdeeee;

  /* 圆角 */
  --r-lg: 16px;
  --r: 12px;
  --r-sm: 9px;
  --r-xs: 7px;

  /* 阴影 */
  --sh-1: 0 1px 2px rgba(16, 24, 40, .04);
  --sh-2: 0 1px 3px rgba(16, 24, 40, .05), 0 8px 24px -12px rgba(16, 24, 40, .12);
  --sh-3: 0 4px 12px rgba(16, 24, 40, .08), 0 24px 48px -20px rgba(16, 24, 40, .22);

  /* 尺寸与字体 */
  --ctl-h: 34px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

/* 作者样式中的 display 会覆盖 UA 的 [hidden]{display:none}，这里统一兜底 */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; height: 100%; }

body {
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }

::selection { background: rgba(14, 165, 164, .18); }

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: #cfd5e0 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d3d9e4; border: 3px solid transparent; background-clip: content-box; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #b9c2d0; background-clip: content-box; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ==================================================================
   布局
   ================================================================== */
.app { display: flex; min-height: 100vh; }

.main {
  flex: 1;
  min-width: 0;
  padding: 24px 30px 56px;
  max-width: 1440px;
}

.view { display: none; flex-direction: column; gap: 18px; }
.view.is-active { display: flex; animation: viewIn .22s ease-out; }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }

/* ==================================================================
   侧栏
   ================================================================== */
.sidebar {
  width: 252px;
  flex: 0 0 252px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(150%) blur(8px);
  border-right: 1px solid var(--line);
  padding: 22px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px; }

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(140deg, #2fd0c8 0%, #0ea5a4 55%, #0b7c7b 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex: 0 0 38px;
  box-shadow: 0 4px 12px -3px rgba(14, 165, 164, .45);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15px; letter-spacing: -.01em; }
.brand-text span { font-size: 10.5px; color: var(--text-soft); letter-spacing: .08em; text-transform: uppercase; }

.nav-group { display: flex; flex-direction: column; gap: 9px; }

.nav-label {
  font-size: 10.5px;
  letter-spacing: .12em;
  color: var(--text-soft);
  text-transform: uppercase;
  padding-left: 10px;
  font-weight: 600;
}

#mainNav { display: flex; flex-direction: column; gap: 3px; }

.nav-item {
  position: relative;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-mid);
  cursor: pointer;
  transition: background .16s, color .16s;
}

.nav-item:hover { background: #f1f5f5; color: var(--text); }

.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 600;
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.nav-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e0619a;
  margin-left: 7px;
  vertical-align: middle;
  box-shadow: 0 0 0 3px rgba(224, 97, 154, .18);
}

/* 类别累计进度 */
.type-progress { display: flex; flex-direction: column; gap: 2px; }

.tp-item {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  align-items: center;
  column-gap: 9px;
  row-gap: 5px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--text-mid);
  font-size: 13px;
  transition: background .16s;
}

.tp-item:hover { background: #f1f5f5; }
.tp-item .dot { width: 8px; height: 8px; border-radius: 50%; }
.tp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-item .tp-count { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); font-size: 12.5px; }

.tp-foot { grid-column: 2 / -1; display: flex; align-items: center; gap: 7px; }

.tp-bar {
  flex: 1;
  height: 4px;
  border-radius: 99px;
  background: #eceff5;
  overflow: hidden;
  min-width: 0;
}

.tp-bar i { display: block; height: 100%; border-radius: 99px; opacity: .9; transition: width .3s ease; }
.tp-foot em { font-style: normal; font-size: 10.5px; color: var(--text-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* 侧栏底部 */
.sidebar-foot {
  margin-top: auto;
  padding: 14px 16px;
  border-radius: var(--r);
  background: linear-gradient(150deg, #eef9f8 0%, #e6f7f6 100%);
  border: 1px solid #e0f4f2;
}

.streak-box { display: flex; align-items: baseline; gap: 6px; }
.streak-num { font-size: 27px; font-weight: 700; color: var(--accent-deep); line-height: 1; font-variant-numeric: tabular-nums; }
.streak-unit { font-size: 12px; color: #5a6480; }
.streak-sub { font-size: 11px; color: #7a8399; margin-top: 6px; }

/* ==================================================================
   顶栏
   ================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: -24px -30px 22px;
  padding: 20px 30px 16px;
  background: rgba(244, 246, 249, .88);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-title h1 { font-size: 21px; letter-spacing: -.02em; }
.topbar-title p { margin: 3px 0 0; color: var(--text-soft); font-size: 12.5px; }

.date-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
  box-shadow: var(--sh-1);
}

.date-nav input[type="date"] {
  border: 0;
  background: transparent;
  padding: 4px 6px;
  font-weight: 500;
  color: var(--text);
  width: 142px;
}

.date-nav input[type="date"]:focus { box-shadow: none; }

/* ==================================================================
   卡片
   ================================================================== */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px;
  box-shadow: var(--sh-2);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  min-height: 26px;
}

.card-head h2 { font-size: 14.5px; letter-spacing: -.01em; }

.hint { font-size: 12px; color: var(--text-soft); line-height: 1.65; }

.badge {
  font-size: 11.5px;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 600;
  white-space: nowrap;
}

.quick-card {
  border-left: 3px solid var(--accent);
  background: linear-gradient(180deg, #fcfdff 0%, #ffffff 42%);
}

.card.danger-card { border-color: #f3d7d7; background: #fffafa; }
.card.danger-card h2 { color: #b8372f; }

.warn-card { border-color: #f2daa8; background: #fffaf0; }
.warn-card h2 { color: #9a6206; }

/* ==================================================================
   按钮
   ================================================================== */
.btn {
  font-family: inherit;
  font-size: 13px;
  border-radius: var(--r-sm);
  padding: 0 14px;
  height: var(--ctl-h);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-mid);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background .16s, border-color .16s, color .16s, box-shadow .16s, transform .06s;
}

.btn:hover { background: #f6f8fb; border-color: #d8dde8; color: var(--text); }
.btn:active { transform: translateY(.5px); }

.btn.primary {
  background: linear-gradient(180deg, #2fbfba 0%, #12b3b1 100%);
  border-color: #12b3b1;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px -1px rgba(14, 165, 164, .4);
}

.btn.primary:hover {
  background: linear-gradient(180deg, #1fb3af 0%, #0a7373 100%);
  border-color: #0a7373;
  color: #fff;
}

.btn.ghost { background: #fff; }
.btn.danger { background: #fff; border-color: #f0cccc; color: var(--red); font-weight: 500; }
.btn.danger:hover { background: var(--red-soft); border-color: #eab6b6; color: #b8372f; }
.btn.icon { padding: 0 11px; font-size: 17px; line-height: 1; }
.btn:disabled { opacity: .55; cursor: default; transform: none; box-shadow: none; }

.file-btn { display: inline-flex; align-items: center; justify-content: center; }
.btn-col { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

.link-btn {
  border: 0;
  background: none;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 12px;
  padding: 3px 7px;
  border-radius: 6px;
  font-family: inherit;
  transition: background .15s, color .15s;
}

.link-btn:hover { background: #ecf3f2; color: var(--text); }
.link-btn.del:hover { background: var(--red-soft); color: #b8372f; }

/* ==================================================================
   类别标签
   ================================================================== */
.type-tabs { display: flex; flex-wrap: wrap; gap: 8px; }

.type-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-mid);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: border-color .16s, background .16s, color .16s, box-shadow .16s;
}

.type-tab:hover { border-color: #cfd6e6; background: #fafbfd; }

.type-tab.is-active {
  border-color: rgba(14, 165, 164, .45);
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(14, 165, 164, .12);
}

.type-tab .dot { width: 7px; height: 7px; border-radius: 50%; }

.type-tab .tab-count {
  font-size: 11px;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, .045);
  border-radius: 99px;
  padding: 0 6px;
}

.type-tab.is-active .tab-count { background: rgba(14, 165, 164, .14); color: var(--accent-deep); }

/* ==================================================================
   表单
   ================================================================== */
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full, .field.wide { grid-column: 1 / -1; }
.field.grow { flex: 1; min-width: 200px; }
.field > span { font-size: 12px; color: var(--text-mid); font-weight: 500; }
.field .unit { color: var(--text-soft); font-weight: 400; }

input[type="text"], input[type="number"], input[type="date"], input[type="time"], select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  border: 1px solid #dde2ec;
  border-radius: var(--r-sm);
  padding: 8px 11px;
  width: 100%;
  transition: border-color .16s, box-shadow .16s;
}

input:hover, select:hover, textarea:hover { border-color: #cbd3e1; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

::placeholder { color: #a9b1c0; }

.textarea { resize: vertical; min-height: 76px; line-height: 1.7; }
.textarea.tall { min-height: 116px; }

input[type="range"] { width: 100%; padding: 0; border: 0; accent-color: var(--accent); height: 20px; }
.range-row { display: flex; align-items: center; gap: 11px; }

.range-val {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--accent-deep);
  font-weight: 600;
  min-width: 46px;
  text-align: right;
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 2px 8px;
}

.form-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; align-items: center; }
.form-actions.right { justify-content: flex-end; }

/* 检索行 */
.filter-row { display: flex; gap: 13px; flex-wrap: wrap; align-items: flex-end; }

.filter-summary {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-soft);
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-mid);
  cursor: pointer;
  line-height: 1.65;
}

.switch-row input { width: 16px; height: 16px; margin-top: 3px; accent-color: var(--accent); cursor: pointer; flex: 0 0 16px; }

/* ==================================================================
   记录列表
   ================================================================== */
.entry-list { display: flex; flex-direction: column; gap: 10px; max-height: 640px; overflow-y: auto; padding-right: 2px; }

.entry {
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--tc, var(--line));
  border-radius: var(--r-sm);
  padding: 13px 15px;
  background: var(--panel-tint);
  transition: box-shadow .18s, border-color .18s, background .18s;
}

.entry:hover { background: #fff; box-shadow: var(--sh-2); border-color: var(--line); }

.entry-top { display: flex; align-items: center; gap: 9px; }

.entry-type {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 99px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}

.entry-title { font-weight: 600; font-size: 14px; flex: 1; min-width: 0; word-break: break-word; letter-spacing: -.01em; }

.entry-meta {
  margin-top: 7px;
  font-size: 12px;
  color: var(--text-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}

.entry-body {
  margin-top: 9px;
  font-size: 13px;
  color: var(--text-mid);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.75;
  padding: 9px 11px;
  background: rgba(0, 0, 0, .018);
  border-radius: var(--r-xs);
}

.entry-actions { display: flex; gap: 2px; opacity: .7; transition: opacity .16s; }
.entry:hover .entry-actions { opacity: 1; }

.empty {
  text-align: center;
  padding: 34px 18px;
  color: var(--text-soft);
  font-size: 13px;
  border: 1px dashed #dfe4ee;
  border-radius: var(--r-sm);
  background: #fbfdfd;
}

/* 候选记录预览 */
.candidate-list { display: flex; flex-direction: column; gap: 11px; margin-top: 16px; }

.candidate {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 13px 15px;
  background: var(--panel-tint);
  display: grid;
  grid-template-columns: 124px 1fr 96px 28px;
  gap: 9px 11px;
  align-items: center;
  transition: box-shadow .18s;
}

.candidate:hover { box-shadow: var(--sh-2); }
.candidate select, .candidate input { padding: 6px 9px; font-size: 13px; }
.candidate .cand-detail { grid-column: 1 / -1; min-height: 56px; font-size: 13px; }
.candidate .cand-chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.chip {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  white-space: nowrap;
}

.chip.warn { background: var(--amber-soft); color: #8a5206; }

.chip.src {
  background: #f1f5f5;
  color: var(--text-soft);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cand-del {
  border: 0;
  background: none;
  color: var(--text-soft);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  border-radius: 7px;
  padding: 2px 7px;
  transition: background .15s, color .15s;
}

.cand-del:hover { background: var(--red-soft); color: #b8372f; }

/* ==================================================================
   看板
   ================================================================== */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

.stat-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 17px 19px;
  box-shadow: var(--sh-2);
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, #4cc6c0, #12b3b1 60%, rgba(14, 165, 164, .25));
}

.stat-label { font-size: 12px; color: var(--text-soft); }
.stat-value { font-size: 27px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat-value small { font-size: 12.5px; color: var(--text-soft); font-weight: 500; margin-left: 3px; }
.stat-foot { font-size: 11.5px; color: var(--text-soft); }

/* 热力图 */
.heatmap-wrap { display: flex; gap: 9px; overflow-x: auto; padding-bottom: 6px; }
.heatmap-days { display: grid; grid-template-rows: repeat(7, 13px); gap: 3px; font-size: 10px; color: var(--text-soft); }
.heatmap-days span { line-height: 13px; }

.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 13px); gap: 3px; }

.hm-cell { width: 13px; height: 13px; border-radius: 3px; background: #ecf3f2; transition: transform .12s; }
.hm-cell:hover { transform: scale(1.25); }
.hm-cell.lv1 { background: #c9ecea; }
.hm-cell.lv2 { background: #a3dddb; }
.hm-cell.lv3 { background: #5cc9c7; }
.hm-cell.lv4 { background: #0b7c7b; }
.hm-cell.blank { background: transparent; }
.hm-cell.today { box-shadow: 0 0 0 2px #171b23 inset; }

.legend { display: flex; align-items: center; gap: 5px; margin-top: 12px; font-size: 11px; color: var(--text-soft); }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend .lv0 { background: #ecf3f2; }
.legend .lv1 { background: #c9ecea; }
.legend .lv2 { background: #a3dddb; }
.legend .lv3 { background: #5cc9c7; }
.legend .lv4 { background: #0b7c7b; }

/* 柱状图 */
.bar-chart { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 76px 1fr 54px; align-items: center; gap: 11px; }
.bar-label { font-size: 13px; color: var(--text-mid); }
.bar-track { background: #f0f4f4; border-radius: 99px; height: 14px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #5cc9c7, #12b3b1); transition: width .35s ease; }
.bar-fill.alt { background: linear-gradient(90deg, #63cfa0, #159c63); }
.bar-num { font-size: 12px; color: var(--text-soft); text-align: right; font-variant-numeric: tabular-nums; }

/* 分类明细表 */
.summary-table { display: flex; flex-direction: column; }

.st-row {
  display: grid;
  grid-template-columns: 104px 1fr 84px 88px 80px;
  gap: 11px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line-soft);
  align-items: center;
  font-size: 13px;
}

.st-row.head { font-size: 11.5px; color: var(--text-soft); border-bottom: 1px solid var(--line); padding-bottom: 9px; }
.st-row:last-child { border-bottom: 0; }
.st-name { display: flex; align-items: center; gap: 9px; font-weight: 500; }
.st-name .dot { width: 8px; height: 8px; border-radius: 50%; }
.st-row .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-mid); }
.st-bar { background: #f0f4f4; height: 8px; border-radius: 99px; overflow: hidden; }
.st-bar i { display: block; height: 100%; border-radius: 99px; transition: width .35s ease; }

/* ==================================================================
   历史归档
   ================================================================== */
.timeline { display: flex; flex-direction: column; gap: 16px; }

.day-block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px 20px;
  box-shadow: var(--sh-2);
}

.day-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.day-date { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.day-week { font-size: 12px; color: var(--text-soft); }
.day-count { margin-left: auto; font-size: 12px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.day-entries { display: flex; flex-direction: column; gap: 10px; }

.day-note {
  margin-top: 12px;
  padding: 11px 14px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-xs);
  font-size: 13px;
  color: #3f4a66;
  white-space: pre-wrap;
  line-height: 1.75;
}

/* 键值列表 */
.kv-list { display: flex; flex-direction: column; }

.kv-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}

.kv-row:last-child { border-bottom: 0; }
.kv-row span { color: var(--text-soft); }
.kv-row strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.kv-list + .hint { margin-top: 10px; }

/* 类别管理 */
.type-manager {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 8px;
}

.tm-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  user-select: none;
}

.tm-item:hover { border-color: var(--line-strong); background: var(--panel-soft); }
.tm-item.is-off { opacity: .5; }
.tm-item.is-off .tm-name { text-decoration: line-through; }

.tm-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  accent-color: var(--brand);
  cursor: pointer;
}

.tm-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 9px;
}

.tm-name { font-size: 13px; font-weight: 500; color: var(--text); }
.tm-count { margin-left: auto; font-size: 12px; color: var(--text-soft); font-variant-numeric: tabular-nums; }

/* ==================================================================
   日程 / 清单
   ================================================================== */
.plan-form { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }

.plan-list { display: flex; flex-direction: column; gap: 9px; margin-top: 8px; max-height: 460px; overflow-y: auto; }

.plan-group {
  font-size: 10.5px;
  color: var(--text-soft);
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 8px 2px 0;
  border-top: 1px solid var(--line-soft);
  margin-top: 5px;
}

.plan-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--panel-tint);
  transition: background .16s, box-shadow .16s;
}

.plan-item:hover { background: #fff; box-shadow: var(--sh-1); }
.plan-item.is-done { opacity: .55; }
.plan-item.is-done .plan-name { text-decoration: line-through; }
.plan-item.is-due { border-color: #f2cfcf; background: #fff8f8; }
.plan-item input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; flex: 0 0 15px; }
.plan-main { flex: 1; min-width: 0; }
.plan-name { font-size: 13.5px; font-weight: 500; word-break: break-word; }
.plan-meta { font-size: 11.5px; color: var(--text-soft); margin-top: 3px; font-variant-numeric: tabular-nums; }
.plan-meta .due-tag { color: #c0392b; font-weight: 600; }
.plan-list.compact .plan-item { padding: 8px 11px; }

/* ==================================================================
   AI 区块
   ================================================================== */
.ai-box {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--panel-tint);
  overflow: hidden;
}

.ai-box summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 15px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--text-mid);
  transition: background .16s;
}

.ai-box summary:hover { background: #f1f4f9; }
.ai-box summary .ai-sum { font-weight: 600; color: var(--text); }
.ai-box summary .badge { margin-left: auto; }
.ai-box[open] summary { border-bottom: 1px solid var(--line); background: #fff; }
.ai-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }

.ai-steps { margin: 0; padding-left: 20px; font-size: 12.5px; color: var(--text-mid); line-height: 1.9; }
.ai-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.ai-paste-head { font-size: 12px; color: var(--text-mid); font-weight: 600; margin-top: 4px; }

.ai-split {
  font-size: 11px;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 2px;
}

.ai-split::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.mono { font-family: var(--mono); font-size: 12px; line-height: 1.75; white-space: pre-wrap; word-break: break-word; }
.tall-x { min-height: 152px; background: #fff; }

.hint code {
  background: #f1f5f5;
  border: 1px solid var(--line-soft);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 11px;
  font-family: var(--mono);
}

/* ==================================================================
   图片
   ================================================================== */
.img-zone { margin-top: 16px; }

.img-drop {
  border: 1.5px dashed #cdd5e4;
  border-radius: var(--r-sm);
  padding: 15px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-soft);
  cursor: pointer;
  background: #fbfdfd;
  transition: border-color .16s, background .16s, color .16s;
}

.img-drop:hover, .img-drop.dragover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-deep); }

.img-thumbs { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 11px; }
.img-thumbs:empty { margin-top: 0; }

.thumb {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f1f5f5;
  box-shadow: var(--sh-1);
}

.thumb img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; transition: transform .2s; }
.thumb img:hover { transform: scale(1.06); }

.thumb-del {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 19px;
  height: 19px;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 22, 28, .6);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background .15s;
}

.thumb-del:hover { background: var(--red); }
.entry-images { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 10px; }

/* ==================================================================
   浮层
   ================================================================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 14px);
  background: #191d26;
  color: #fff;
  padding: 11px 20px;
  border-radius: 99px;
  font-size: 13px;
  box-shadow: var(--sh-3);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 1200;
  max-width: 78vw;
  text-align: center;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(16, 18, 24, .9);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 48px;
  animation: fadeIn .16s ease-out;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .6);
}

.lightbox-close {
  position: absolute;
  top: 22px;
  right: 26px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: background .16s;
}

.lightbox-close:hover { background: rgba(255, 255, 255, .26); }

/* ==================================================================
   响应式
   ================================================================== */
@media (max-width: 1180px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .main { padding: 22px 22px 48px; }
  .topbar { margin: -22px -22px 20px; padding: 18px 22px 14px; }
}

@media (max-width: 820px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex: none;
    height: auto;
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: #fff;
    padding: 16px;
    gap: 16px;
  }
  .main { padding: 18px 16px 44px; }
  .topbar {
    margin: 0 0 18px;
    padding: 2px 0 14px;
    background: transparent;
    backdrop-filter: none;
    border-bottom: 1px solid var(--line);
    position: static;
  }
  .form { grid-template-columns: 1fr; }
  .plan-form { grid-template-columns: 1fr; }
  .st-row { grid-template-columns: 88px 1fr 68px; }
  .st-row .st-hours, .st-row .st-days { display: none; }
  .entry-list, .plan-list { max-height: none; }
  .toast { bottom: 22px; }
}

@media (max-width: 560px) {
  .card { padding: 16px; }
  .stat-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 23px; }
  .candidate { grid-template-columns: 1fr 1fr; }
  .candidate .cand-title { grid-column: 1 / -1; }
  .date-nav { width: 100%; }
  .date-nav input[type="date"] { flex: 1; width: auto; }
  .type-tabs { gap: 6px; }
  .type-tab { padding: 6px 12px; font-size: 12.5px; }
  .lightbox { padding: 20px; }
  .heatmap-wrap { padding-bottom: 10px; }
}

/* NAS 同步状态指示 */
.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  white-space: nowrap;
  background: #e8f6f5;
  color: #0ea5a4;
  border: 1px solid #cbeee9;
}
.sync-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.sync-pill.sync-ok { color: #0f9d58; background: #e7f7ee; border-color: #bfe9d2; }
.sync-pill.sync-busy { color: #b06a00; background: #fdf3e3; border-color: #f3dcb4; }
.sync-pill.sync-err { color: #d23b3b; background: #fdecec; border-color: #f6cccc; }
#syncStatus.sync-ok { color: #0f9d58; }
#syncStatus.sync-busy { color: #b06a00; }
#syncStatus.sync-err { color: #d23b3b; }
@media (max-width: 820px) {
  .sync-pill { margin-left: 0; margin-top: 10px; }
}

/* ==================================================================
   新增组件：顶部搜索 / 标签 / 周报月报
   ================================================================== */
.topbar-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 220px;
  max-width: 340px;
  margin-left: auto;
}
.topbar-search input[type="search"] {
  width: 100%;
  height: var(--ctl-h);
  padding: 0 34px 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  transition: border-color .16s, background .16s, box-shadow .16s;
}
.topbar-search input[type="search"]:focus {
  outline: none;
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.topbar-search input[type="search"]::-webkit-search-cancel-button { display: none; }
.ts-clear {
  position: absolute;
  right: 4px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-soft);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.ts-clear:hover { background: var(--line-soft); color: var(--text-mid); }

.entry-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  line-height: 1.7;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border: 1px solid #cbeee9;
  cursor: pointer;
  white-space: nowrap;
}
.tag-chip::before { content: "#"; opacity: .5; margin-right: 1px; }
.tag-chip:hover { background: #d9f2ef; }

.report-out {
  margin: 0;
  padding: 18px;
  border-radius: var(--r);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12.8px;
  line-height: 1.75;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 62vh;
  overflow: auto;
}

.btn.primary { box-shadow: 0 2px 10px -3px var(--accent-ring); }

/* ==================================================================
   移动端增强：底部 Tab 栏 + iPhone 安全区 + 触屏尺寸
   ================================================================== */
@media (max-width: 820px) {
  .sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    flex: none;
    flex-direction: row;
    align-items: center;
    gap: 0;
    padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .97);
    backdrop-filter: saturate(160%) blur(10px);
    border-right: 0;
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px -16px rgba(16, 24, 40, .3);
    z-index: 60;
    overflow: visible;
  }
  .sidebar .brand,
  .sidebar .nav-label,
  .sidebar #todayProgress,
  .sidebar .sidebar-foot { display: none !important; }

  .sidebar .nav-group { width: 100%; }
  #mainNav { flex-direction: row; gap: 2px; width: 100%; }
  .nav-item {
    flex: 1 1 0;
    min-width: 0;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 6px 2px;
    font-size: 11px;
    line-height: 1.15;
    border-radius: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .nav-item.is-active { background: var(--accent-soft); color: var(--accent-deep); }
  .nav-dot { position: static; margin-left: 3px; }

  .main { padding: 16px 14px calc(96px + env(safe-area-inset-bottom)); }
  .topbar { flex-wrap: wrap; }
  .topbar-search { order: 5; flex: 1 1 100%; max-width: none; margin: 10px 0 0; }

  .btn { min-height: 42px; }
  .input,
  input[type="text"], input[type="search"], input[type="date"], input[type="time"],
  input[type="number"], input[type="password"], input[type="email"], select, textarea {
    font-size: 16px;
  }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
}

@media (max-width: 560px) {
  .nav-item { font-size: 10.5px; }
  .topbar-search input[type="search"] { font-size: 16px; }
}
