:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-soft: #eef3f1;
  --ink: #1d2b2a;
  --muted: #5d6d69;
  --line: #dbe4e1;
  --teal: #0d7a68;
  --teal-strong: #0a5f52;
  --teal-soft: #e1efeb;
  --coral: #c25f45;
  --coral-soft: #f8e7e1;
  --gold: #a67c1e;
  --gold-soft: #f6eed7;
  --blue: #3c6e99;
  --blue-soft: #e4edf5;
  --shadow: 0 6px 20px rgba(29, 43, 42, 0.08);
  --radius: 8px;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(244, 247, 246, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--ink);
  color: #f7f2e8;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 700;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  font-size: 16px;
  letter-spacing: 0;
}

.brand-text span {
  font-size: 11px;
  color: var(--muted);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 8px 12px;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.nav-btn:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.nav-btn.active {
  color: var(--teal-strong);
  background: var(--teal-soft);
  border-color: rgba(13, 122, 104, 0.25);
  font-weight: 600;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 260px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--muted);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-box:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 122, 104, 0.12);
}

.search-box .search-icon svg {
  width: 16px;
  height: 16px;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 10px 0;
}

.search-box input::placeholder {
  color: #8c9a97;
}

.app {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.hero-band {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 8px 0 26px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}

.hero-title {
  margin: 0;
  font-size: 28px;
  line-height: 1.3;
  font-weight: 700;
}

.hero-title .accent {
  color: var(--teal);
}

.hero-date {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.hero-summary {
  max-width: 380px;
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

.stats-band {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
  margin-bottom: 28px;
}

.stat-cell {
  padding: 18px 22px;
  border-right: 1px solid var(--line);
}

.stat-cell:last-child {
  border-right: 0;
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.stat-label svg {
  width: 15px;
  height: 15px;
  color: var(--teal);
}

.stat-value {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
}

.stat-note {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.section {
  margin-bottom: 34px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.section-sub {
  color: var(--muted);
  font-size: 13px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 22px;
  align-items: start;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  min-width: 0;
}

.grid-2 > *,
.grid-3 > * {
  min-width: 0;
}

.panel-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
}

.panel-note {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
}

.shuffle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  color: var(--muted);
  padding: 6px 11px;
  font-size: 12px;
  margin-bottom: 12px;
}

.shuffle-btn:hover {
  color: var(--teal-strong);
  border-color: var(--teal);
}

.shuffle-btn svg {
  width: 14px;
  height: 14px;
}

.ai-insight {
  font-size: 14px;
  line-height: 1.8;
  color: var(--ink);
  border-left: 3px solid var(--gold);
  padding: 4px 0 4px 14px;
}

.heatmap-scroll {
  overflow-x: auto;
  padding-bottom: 8px;
}

.heatmap {
  display: inline-flex;
  gap: 4px;
}

.heat-col {
  display: grid;
  grid-template-rows: repeat(7, 12px);
  gap: 4px;
}

.heat-cell {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: #e8eeec;
}

.heat-cell[data-level="1"] {
  background: #bfded5;
}

.heat-cell[data-level="2"] {
  background: #7fc0b1;
}

.heat-cell[data-level="3"] {
  background: #3d9a86;
}

.heat-cell[data-level="4"],
.heat-cell[data-level="5"] {
  background: var(--teal-strong);
}

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

.heatmap-legend .legend-swatches {
  display: inline-flex;
  gap: 3px;
  margin-left: 4px;
}

.heatmap-legend span[data-level] {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: #e8eeec;
}

.heatmap-legend span[data-level="1"] {
  background: #bfded5;
}

.heatmap-legend span[data-level="3"] {
  background: #3d9a86;
}

.heatmap-legend span[data-level="5"] {
  background: var(--teal-strong);
}

.month-bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 170px;
}

.bar-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
}

.bar-track {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: flex-end;
  min-height: 0;
}

.bar {
  width: 100%;
  background: var(--teal);
  border-radius: 4px 4px 0 0;
  min-height: 3px;
  transition: opacity 0.15s;
}

.bar-col:hover .bar {
  opacity: 0.8;
}

.bar-value {
  font-size: 11px;
  color: var(--muted);
  line-height: 1;
}

.bar-label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.stacked-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 170px;
}

.stack-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
}

.stack-track {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 0;
  background: var(--surface-soft);
  border-radius: 4px;
  overflow: hidden;
  gap: 1px;
}

.stack-seg {
  width: 100%;
  min-height: 3px;
}

.stack-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 14px;
}

.stack-legend .legend-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.stack-legend .legend-row strong {
  font-weight: 600;
  color: var(--ink);
}

.reading-rhythm {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.rhythm-cell {
  flex: 1;
  background: var(--surface-soft);
  border-radius: 8px;
  padding: 10px 6px;
  text-align: center;
}

.rhythm-cell strong {
  display: block;
  font-size: 17px;
  color: var(--ink);
  line-height: 1.3;
}

.rhythm-cell span {
  font-size: 11px;
  color: var(--muted);
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 22px;
}

.donut {
  width: 138px;
  height: 138px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.donut-center {
  position: absolute;
  width: 138px;
  height: 138px;
  border-radius: 50%;
  background: var(--surface);
  display: grid;
  place-items: center;
  text-align: center;
  font-weight: 700;
  font-size: 20px;
  line-height: 1.2;
}

.donut-center small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}

.donut-legend {
  display: grid;
  gap: 10px;
  flex: 1;
}

.donut-legend .legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-row strong {
  margin-left: auto;
  font-weight: 600;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.tag-chip small {
  color: var(--muted);
  font-size: 11px;
}

.tag-chip:hover,
.tag-chip.active {
  background: var(--teal-soft);
  border-color: rgba(13, 122, 104, 0.4);
  color: var(--teal-strong);
}

.insight-list {
  display: grid;
  gap: 10px;
}

.insight-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--ink);
}

.insight-item .insight-icon {
  color: var(--teal);
  flex-shrink: 0;
  margin-top: 2px;
}

.insight-item .insight-icon svg {
  width: 15px;
  height: 15px;
}

.insight-item b {
  font-weight: 600;
}

.recent-list {
  display: grid;
  gap: 12px;
}

.note-card {
  display: block;
  width: 100%;
  cursor: pointer;
  text-align: left;
  border: 1px solid var(--line);
  border-left: 3px solid var(--type-color, var(--teal));
  border-radius: 8px;
  background: var(--surface);
  padding: 14px 18px;
  transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
}

.note-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  border-color: #c9d6d2;
}

.note-card[data-type="reading"] {
  --type-color: var(--teal);
}

.note-card[data-type="diary"] {
  --type-color: var(--coral);
}

.note-card[data-type="memo"] {
  --type-color: var(--blue);
}

.note-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  padding: 3px 8px;
  background: var(--surface-soft);
  color: var(--ink);
}

.badge.teal {
  background: var(--teal-soft);
  color: var(--teal-strong);
}

.badge.coral {
  background: var(--coral-soft);
  color: var(--coral);
}

.badge.gold {
  background: var(--gold-soft);
  color: var(--gold);
}

.badge.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.note-date {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.note-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-line;
  overflow: hidden;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
}

.note-text-empty {
  color: var(--muted);
  font-style: italic;
}

.note-card.expanded .note-text {
  display: block;
}

.note-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.mini-tag {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 0;
}

.mini-tag:hover {
  color: var(--teal-strong);
  text-decoration: underline;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13px;
}

.filter-chip small {
  opacity: 0.7;
}

.filter-chip:hover,
.filter-chip.active {
  color: var(--teal-strong);
  background: var(--teal-soft);
  border-color: rgba(13, 122, 104, 0.35);
}

.book-group {
  margin-bottom: 30px;
}

.book-group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

.book-group-head h3 {
  margin: 0;
  font-size: 16px;
}

.book-group-head .count {
  color: var(--muted);
  font-size: 12px;
}

.book-notes {
  display: grid;
  gap: 12px;
}

.category-notes {
  display: grid;
  gap: 16px;
}

.book-item-block {
  min-width: 0;
}

.book-item-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 8px;
}

.book-item-head h4 {
  margin: 0;
  font-size: 14px;
}

.book-item-head .count {
  color: var(--muted);
  font-size: 12px;
}

.category-notes .month-group {
  margin-bottom: 16px;
}

.month-group {
  margin-bottom: 30px;
}

.month-group-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.month-group-head h3 {
  margin: 0;
  font-size: 16px;
}

.month-group-head .count {
  color: var(--muted);
  font-size: 12px;
}

.month-group-head .mood-summary {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

.diary-entry {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.diary-entry:last-child {
  border-bottom: 0;
}

.diary-date {
  color: var(--muted);
  font-size: 13px;
}

.diary-date .weekday {
  display: block;
  font-size: 11px;
  color: #8c9a97;
}

.diary-body .note-text {
  -webkit-line-clamp: 6;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 56px 24px;
  text-align: center;
  color: var(--muted);
}

.empty-state .empty-icon {
  margin: 0 auto 10px;
  width: 34px;
  height: 34px;
  color: #9aaba7;
}

.empty-state .empty-icon svg {
  width: 34px;
  height: 34px;
}

.result-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.result-bar .clear-filters {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  color: var(--muted);
  padding: 3px 9px;
  font-size: 12px;
}

.result-bar .clear-filters:hover {
  color: var(--coral);
  border-color: var(--coral);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 32, 30, 0.48);
}

.modal-panel {
  position: relative;
  width: min(640px, 100%);
  max-height: min(720px, 86vh);
  overflow: auto;
  background: var(--surface);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(20, 32, 30, 0.28);
  padding: 26px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  color: var(--muted);
}

.modal-close:hover {
  color: var(--ink);
}

.modal-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-right: 44px;
  margin-bottom: 14px;
}

.modal-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.8;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 18px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 8px 13px;
  font-size: 13px;
  color: var(--muted);
}

.action-btn:hover {
  color: var(--teal-strong);
  border-color: var(--teal);
}

.modal-images {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.modal-images img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.missing-image {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: var(--surface-soft);
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.footer-inner {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 22px 0 28px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

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

.seg-control {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 3px;
  gap: 3px;
  flex-shrink: 0;
}

.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13px;
}

.seg-btn:hover {
  color: var(--ink);
}

.seg-btn.active {
  background: var(--teal-soft);
  color: var(--teal-strong);
  font-weight: 600;
}

.seg-btn svg {
  width: 15px;
  height: 15px;
}

.stats-band.many {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.stats-band.many .stat-cell {
  border-bottom: 1px solid var(--line);
}

.stats-band.many .stat-cell:last-child {
  border-right: 0;
  border-bottom: 0;
}

.review-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.review-period {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}

.step-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  color: var(--muted);
  flex-shrink: 0;
}

.step-btn:hover {
  color: var(--teal-strong);
  border-color: var(--teal);
}

.step-btn svg {
  width: 16px;
  height: 16px;
}

.source-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.source-row:last-child {
  border-bottom: 0;
}

.source-row .count {
  color: var(--muted);
  font-size: 12px;
  flex-shrink: 0;
}

.mood-bars {
  display: grid;
  gap: 11px;
}

.mood-row {
  display: grid;
  grid-template-columns: 64px 1fr 30px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.mood-track {
  height: 10px;
  background: var(--surface-soft);
  border-radius: 999px;
  overflow: hidden;
}

.mood-fill {
  height: 100%;
  background: var(--coral);
  border-radius: 999px;
}

.mood-count {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.day-block {
  margin-bottom: 22px;
}

.day-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.day-head h3 {
  margin: 0;
  font-size: 15px;
}

.day-head .count {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 960px) {
  .header-inner {
    flex-wrap: wrap;
    padding: 12px 0;
    gap: 12px;
  }

  .brand {
    margin-right: auto;
  }

  .main-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .nav-btn {
    flex-shrink: 0;
  }

  .search-box {
    width: min(300px, 100%);
  }

  .hero-band {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-summary {
    text-align: left;
  }

  .stats-band {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-cell:nth-child(2) {
    border-right: 0;
  }

  .stat-cell:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .grid-3 {
    grid-template-columns: 1fr;
  }

  .month-bars,
  .stacked-chart {
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .bar-col,
  .stack-col {
    min-width: 30px;
  }

  .reading-rhythm {
    overflow-x: auto;
  }

  .rhythm-cell {
    flex: none;
    min-width: 88px;
  }

  .donut-wrap {
    flex-direction: column;
    align-items: center;
  }

  .donut-legend {
    width: 100%;
  }

  .filter-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .filter-chip {
    flex-shrink: 0;
  }
}

@media (max-width: 720px) {
  .header-inner {
    min-height: 54px;
    gap: 10px;
  }

  .brand-text span {
    display: none;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    font-size: 15px;
  }

  .search-box {
    width: auto;
    flex: 1;
    min-width: 0;
  }

  .search-box input {
    font-size: 16px;
  }

  .main-nav {
    position: fixed;
    left: 20px;
    right: 20px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 50;
    order: 0;
    width: auto;
    display: flex;
    justify-content: space-around;
    gap: 0;
    padding: 6px 4px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(10px);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(29, 43, 42, 0.14);
  }

  .nav-btn {
    flex: 1;
    flex-direction: column;
    gap: 3px;
    min-height: 46px;
    padding: 5px 2px;
    font-size: 11px;
    border-radius: 10px;
  }

  .nav-btn .nav-icon svg {
    width: 20px;
    height: 20px;
  }

  body {
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .app {
    padding: 20px 0 10px;
  }

  .site-footer {
    padding-bottom: calc(84px + env(safe-area-inset-bottom));
  }

  .review-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .seg-control {
    width: 100%;
  }

  .seg-btn {
    flex: 1;
    justify-content: center;
  }

  .review-period {
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .header-inner,
  .app,
  .footer-inner {
    width: min(100% - 28px, 1180px);
  }

  .main-nav {
    left: 14px;
    right: 14px;
  }

  .hero-title {
    font-size: 24px;
  }

  .stats-band {
    grid-template-columns: 1fr 1fr;
  }

  .stat-cell {
    padding: 14px 16px;
  }

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

  .diary-entry {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .modal {
    padding: 0;
    place-items: end center;
  }

  .modal-panel {
    width: 100%;
    max-height: 88vh;
    border-radius: 16px 16px 0 0;
    padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  }

  .section {
    padding: 18px 0;
  }

  .panel {
    padding: 16px 14px;
  }

  .book-item-head,
  .month-group-head {
    flex-wrap: wrap;
  }
}

/* 导入视图 */
.import-wrap {
  max-width: 720px;
}

.import-desc {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  margin: 10px 0 18px;
}

.import-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 4px 0 22px;
}

.import-step {
  display: flex;
  gap: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.step-num {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.import-step strong {
  display: block;
  font-size: 13px;
}

.import-step span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 2px;
}

.drop-zone {
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 34px 20px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.drop-zone.dragover {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.drop-icon {
  color: var(--muted);
  margin: 0 auto 10px;
  width: 40px;
  height: 40px;
}

.drop-icon svg {
  width: 40px;
  height: 40px;
}

.drop-main {
  font-size: 15px;
  font-weight: 600;
}

.drop-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.pick-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.file-summary:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  background: var(--surface-soft);
}

.file-summary .file-check {
  color: var(--teal-strong);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.file-summary .file-check svg {
  width: 18px;
  height: 18px;
}

.file-summary .file-meta {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-summary .file-count {
  color: var(--muted);
  flex-shrink: 0;
  font-size: 12px;
}

.import-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.action-btn.primary {
  background: var(--teal-strong);
  border-color: var(--teal-strong);
  color: #fff;
  font-weight: 600;
}

.action-btn.primary:hover:not(:disabled) {
  background: #0a5f52;
  border-color: #0a5f52;
  color: #fff;
}

.action-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.progress-track {
  height: 8px;
  border-radius: 4px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  overflow: hidden;
  margin-top: 18px;
}

.progress-track[hidden] {
  display: none;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: var(--teal);
  transition: width 0.2s;
}

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

.progress-label[hidden] {
  display: none;
}

.import-result {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
}

.import-result.ok {
  border-color: rgba(13, 122, 104, 0.4);
  background: var(--teal-soft);
}

.import-result.err {
  border-color: rgba(194, 95, 69, 0.4);
  background: rgba(194, 95, 69, 0.07);
}

.result-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
}

.result-head svg {
  width: 20px;
  height: 20px;
}

.import-result.ok .result-head svg {
  color: var(--teal-strong);
}

.import-result.err .result-head svg {
  color: var(--coral);
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.result-stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
}

.result-stat b {
  display: block;
  font-size: 20px;
  color: var(--teal-strong);
}

.result-stat span {
  font-size: 11px;
  color: var(--muted);
}

.result-detail {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
}

.result-warning {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--coral);
}

.result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.import-hint {
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 720px) {
  .import-steps {
    grid-template-columns: 1fr;
  }

  .result-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 自媒体文案视图 */
.pick-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border: 1px dashed var(--line);
  background: var(--surface-soft);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 18px;
}

.pick-bar-info {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.pick-bar-info svg {
  width: 15px;
  height: 15px;
  color: var(--coral);
}

.pick-bar-info b {
  color: var(--teal-strong);
  font-weight: 700;
}

.pick-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  margin-left: auto;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.pick-btn svg {
  width: 14px;
  height: 14px;
}

.pick-btn:hover,
.pick-btn.remove:hover {
  color: var(--coral);
  border-color: var(--coral);
}

.pick-btn.picked {
  background: var(--coral-soft);
  border-color: rgba(194, 95, 69, 0.4);
  color: var(--coral);
  font-weight: 600;
}

.note-top .pick-btn + .note-date {
  margin-left: 0;
}

.copy-intro {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  margin: -4px 0 18px;
}

.copy-material {
  margin-bottom: 22px;
}

.copy-material-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.material-list {
  display: grid;
  gap: 10px;
}

.copy-cards {
  grid-template-columns: repeat(2, 1fr);
}

.copy-card {
  display: flex;
  flex-direction: column;
}

.copy-card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.copy-card-head .panel-title {
  font-size: 15px;
}

.copy-card-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--teal-soft);
  color: var(--teal-strong);
}

.copy-card-icon svg {
  width: 18px;
  height: 18px;
}

.copy-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 34px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: var(--surface-soft);
  flex: 1;
}

.copy-output {
  width: 100%;
  min-height: 200px;
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.75;
  resize: vertical;
  white-space: pre-wrap;
}

.copy-output:focus {
  outline: 0;
  border-color: var(--teal);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(13, 122, 104, 0.12);
}

.copy-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.copy-empty-picks .empty-icon {
  color: var(--coral);
}

.copy-empty-actions {
  margin-top: 16px;
  display: flex;
  justify-content: center;
}

@media (max-width: 960px) {
  .copy-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .pick-btn span:last-child {
    display: none;
  }

  .pick-btn {
    padding: 4px 8px;
  }

  .copy-material-head {
    flex-direction: column;
  }
}

/* AI 润色 */
.section-head-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.action-btn.ai {
  background: var(--blue-soft);
  border-color: rgba(60, 110, 153, 0.35);
  color: var(--blue);
}

.action-btn.ai:hover {
  color: var(--blue);
  border-color: var(--blue);
  background: #dbe8f3;
}

.action-btn.danger {
  color: var(--coral);
  border-color: rgba(194, 95, 69, 0.4);
}

.action-btn.danger:hover {
  color: var(--coral);
  border-color: var(--coral);
}

.copy-badge {
  display: inline-flex;
  margin-left: 8px;
  vertical-align: middle;
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  background: var(--gold-soft);
  border-radius: 999px;
  padding: 2px 8px;
}

.copy-badge.ai {
  color: var(--blue);
  background: var(--blue-soft);
}

.ai-form {
  padding-top: 2px;
}

.ai-form-desc {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  margin: 4px 0 16px;
}

.ai-field {
  display: block;
  margin-bottom: 14px;
}

.ai-field span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.ai-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  background: var(--surface-soft);
  color: var(--ink);
}

.ai-field input:focus {
  outline: 0;
  border-color: var(--teal);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(13, 122, 104, 0.12);
}

.ai-form-status {
  margin-top: 4px;
  font-size: 13px;
  min-height: 20px;
  color: var(--muted);
}

.ai-form-status.ok {
  color: var(--teal-strong);
}

.ai-form-status.err {
  color: var(--coral);
}

/* AI 洞察 */
.ai-insight-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.ai-insight.ai-result {
  white-space: pre-line;
}

.ai-insight.ai-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--coral);
  border-left-color: var(--coral);
  font-size: 13px;
}

.ai-insight.ai-error svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 3px;
}

.ai-insight.ai-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.ai-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--teal-soft);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: ai-spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes ai-spin {
  to {
    transform: rotate(360deg);
  }
}
