@charset "utf-8";

/* ===========================================================
   悠悠时光 · 麦穗原野
   大地色系，刻意不出现绿色。自然感靠材质与暖度，不靠颜色本身。
   =========================================================== */

:root {
  --bg:      #FBF6E9;
  --paper:   #FDFBF3;
  --ink:     #2F2A22;
  --muted:   #6B6259;
  --accent:  #B8873B;
  --accent2: #7A5C3E;
  --line:    #E5DECB;

  --serif: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC",
           "Source Han Serif SC", Georgia, "Times New Roman", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
           "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;

  --wrap: 760px;
}

* { box-sizing: border-box; }

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

body {
  position: relative;
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.7;
}

/* 纸感颗粒：内联 SVG 噪声，不引外部资源 */
.grain {
  position: absolute;
  top: 0; left: 0; right: 0; height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: .55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

.main { padding: 30px 0 56px; }

/* ---------- 站头 ---------- */

.site-head {
  border-bottom: 1px solid var(--line);
  background: rgba(251, 246, 233, .82);
}

.head-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 24px;
  padding-top: 20px;
}

.brand { text-decoration: none; color: var(--ink); display: block; }
.brand-cn {
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: 3px;
  display: block;
}
.brand-sub {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
  margin-top: 2px;
  display: block;
}

/* ---------- 顶部三 tab ---------- */

.tabs {
  display: flex;
  gap: 26px;
  margin-left: auto;
}

.tab {
  position: relative;
  padding: 0 0 8px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  letter-spacing: 2px;
  transition: color .16s ease;
}

.tab:hover { color: var(--accent2); }

.tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 500;
}

/* ---------- 区块 ---------- */

.sec { margin-bottom: 42px; }

.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.sec-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 2px;
}

.sec-note { font-size: 11px; color: var(--muted); letter-spacing: 1px; }

.group-title {
  margin: 26px 0 14px;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 2px;
  color: var(--accent2);
}

/* ---------- 博客摘要 ---------- */

.posts { display: flex; flex-direction: column; gap: 12px; }

.post {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  transition: border-color .16s ease;
}

.post:hover { border-color: var(--accent); }

.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.post-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 1px;
  color: var(--ink);
}

.post-sum {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.75;
}

.tag {
  display: inline-block;
  padding: 0 7px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 10px;
  line-height: 17px;
  letter-spacing: 1px;
}

/* ---------- 表格 ---------- */

.table-wrap { overflow-x: auto; }

table.grid {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}

table.grid th,
table.grid td {
  padding: 9px 11px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  vertical-align: top;
}

table.grid thead th {
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--muted);
  background: #F7F1E2;
}

table.grid tbody tr:last-child td { border-bottom: none; }
table.grid tbody tr:hover { background: #FDF8EC; }

.col-note {
  white-space: normal;
  min-width: 150px;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- 心情圆点 ---------- */

.mood { display: inline-flex; gap: 4px; align-items: center; height: 12px; }
.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #E0D8C4;
  display: inline-block;
}
.dot.on { background: var(--accent); }

/* ---------- 折线图 ---------- */

.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .area { fill: rgba(184, 135, 59, .12); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linejoin: round; }
.chart .dot-end { fill: var(--accent2); }
.chart .axis { fill: var(--muted); font-size: 10px; font-family: var(--sans); }

/* ---------- 指标卡 ---------- */

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.metric {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.metric-label { font-size: 11px; color: var(--muted); letter-spacing: 1px; }

.metric-num {
  font-family: var(--serif);
  font-size: 24px;
  color: var(--ink);
  letter-spacing: 1px;
}

.metric-num i { font-style: normal; font-size: 11px; color: var(--muted); margin-left: 3px; }

/* ---------- 书架 ---------- */

.books { display: flex; flex-direction: column; gap: 16px; }

.book {
  display: flex;
  gap: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
}

.book-cover {
  flex: 0 0 56px;
  height: 78px;
  border-radius: 6px;
  overflow: hidden;
  background: #EFE7D3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.cover-ph {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--accent2);
}

.book-body { flex: 1 1 auto; min-width: 0; }
.book-title {
  margin: 0 0 5px;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 1px;
}
.book-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
}
.book-sum { margin: 8px 0 0; font-size: 13px; color: var(--muted); line-height: 1.75; }

.progress {
  height: 3px;
  background: #EFE7D3;
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0 4px;
}
.progress span { display: block; height: 100%; background: var(--accent); }

.notes { list-style: none; margin: 12px 0 0; padding: 0; }
.note {
  padding: 9px 0 9px 12px;
  border-left: 2px solid var(--line);
  margin-bottom: 8px;
}
.note-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1px;
  margin-bottom: 3px;
}
.kind { color: var(--accent); border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; }
.note-loc { color: var(--accent2); }
.note-body { font-size: 13px; color: var(--ink); line-height: 1.75; white-space: pre-wrap; }

/* ---------- 空态 / 按钮 / 404 ---------- */

.empty { color: var(--muted); font-size: 13px; margin: 0; }
.empty.small { font-size: 12px; margin-top: 10px; }

.btn {
  display: inline-block;
  padding: 7px 18px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 2px;
}
.btn:hover { background: var(--accent); color: #FDFBF3; }

.notfound { text-align: center; padding: 40px 0; }
.notfound h1 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 3px;
  margin: 0 0 10px;
}
.notfound p { color: var(--muted); margin: 0 0 22px; }

/* ---------- 页脚 ---------- */

.site-foot {
  border-top: 1px solid var(--line);
  padding: 20px 0;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 2px;
  text-align: center;
}

/* ===========================================================
   后台
   =========================================================== */

.admin { max-width: 880px; }

.admin-head { margin-bottom: 8px; }
.admin-head h1 {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 2px;
  margin: 0;
}
.admin-sub { font-size: 12px; color: var(--muted); margin: 4px 0 22px; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 18px;
}

.card h2 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 2px;
}

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; letter-spacing: 1px; }

input[type="text"], input[type="password"], input[type="number"], input[type="date"],
select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #FFFDF7;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.6;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}
textarea { min-height: 120px; resize: vertical; }
textarea.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.75;
}

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1 1 160px; margin-bottom: 14px; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.btn-solid, .btn-ghost {
  display: inline-block;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 1px;
  text-decoration: none;
  border: 1px solid var(--accent);
}
.btn-solid { background: var(--accent); color: #FDFBF3; border-color: var(--accent); }
.btn-ghost { color: var(--accent); }
.btn-solid:hover { background: var(--accent2); border-color: var(--accent2); }
.btn-ghost:hover { background: #F3EADA; }

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: none; }
.list-row .lr-main { min-width: 0; }
.list-row .lr-title { font-size: 13px; }
.list-row .lr-meta { font-size: 11px; color: var(--muted); letter-spacing: 1px; }
.list-row .lr-act { display: flex; gap: 8px; flex: 0 0 auto; }
.accent-link { color: var(--accent); text-decoration: none; font-size: 12px; }
.accent-link:hover { color: var(--accent2); text-decoration: underline; }
.danger-link { color: #A32D2D; text-decoration: none; font-size: 12px; }
.danger-link:hover { text-decoration: underline; }

.flash {
  padding: 9px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid var(--accent);
  background: #F7EFDD;
  color: var(--accent2);
}
.flash.err { border-color: #E24B4A; background: #FCEBEB; color: #A32D2D; }
.flash.ok  { border-color: #1D9E75; background: #E1F5EE; color: #0F6E56; }

/* 字段下的一行小字说明 */
.field .hint { font-size: 11px; color: var(--muted); margin: 5px 0 0; line-height: 1.6; }
.field .hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #F3EADA;
  padding: 0 3px;
  border-radius: 3px;
  font-size: 10.5px;
}

/* 正文渲染预览（后台编辑器内置，一期前台无详情页） */
.preview {
  margin: -4px 0 14px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 8px 12px;
}
.preview summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--accent2);
  letter-spacing: 1px;
  list-style: none;
}
.preview summary::-webkit-details-marker { display: none; }
.preview summary::before { content: "► "; font-size: 9px; }
.preview[open] summary::before { content: "▼ "; }
.preview-body {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--ink);
}
.preview-body h1, .preview-body h2 { font-size: 15px; margin: 14px 0 6px; }
.preview-body p { margin: 0 0 10px; }
.preview-body ul, .preview-body ol { margin: 0 0 10px; padding-left: 20px; }
.preview-body blockquote {
  margin: 0 0 10px;
  padding-left: 10px;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}
.preview-body pre {
  background: #F3EADA;
  padding: 8px 10px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 12px;
}

.login-card { max-width: 340px; margin: 28px auto 60px; }

/* ---------- 页脚登录 ---------- */

.site-foot .foot-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.site-foot .foot-sep { opacity: .55; }

.foot-login {
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 2px;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}

.foot-login:hover { border-bottom-color: var(--accent); }

/* ---------- 登录弹层 ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* hidden 属性必须压过上面的 display:flex，否则弹层常驻 */
.modal[hidden] { display: none; }

.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(38, 30, 22, .42);
  cursor: default;
}

.modal-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 320px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px 22px 18px;
  box-shadow: 0 18px 44px rgba(38, 30, 22, .18);
}

.modal-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 2px;
  margin: 0 0 6px;
}

.modal-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
  margin: 0 0 16px;
}

.modal-box .btn-row { justify-content: flex-end; margin-top: 16px; }

body.modal-open { overflow: hidden; }

@media (max-width: 620px) {
  .wrap { padding: 0 16px; }
  .head-inner { padding-top: 16px; }
  .tabs { gap: 18px; }
  .tab { font-size: 13px; letter-spacing: 1px; }
  .book { flex-direction: column; gap: 12px; }
  .book-cover { flex: 0 0 auto; height: 60px; width: 44px; }
}
