/* ===== 主题变量（清新治愈风：浅鼠尾草绿 + 奶油白 + 柔和米黄） ===== */
:root {
  --bg: #f2f0e6;           /* 柔和米黄底 */
  --app-bg: #fffdf8;       /* 奶油白 */
  --main-bg: #faf8f1;      /* 奶油白主区 */
  --panel: #ffffff;
  --panel-2: #f1efe4;      /* 米黄浅底 */
  --accent-tint: #fbfaf3;  /* 极浅奶油 */
  --text: #33402c;         /* 深鼠尾草墨绿 */
  --text-muted: #7c8570;
  --border: #e7e5d6;
  --accent: #7a9a67;       /* 浅鼠尾草绿 */
  --accent-deep: #48602f;  /* 深鼠尾草 */
  --accent-soft: #e9f1e0;
  --shadow: 0 8px 24px rgba(90, 110, 80, .08);
  --shadow-lg: 0 16px 40px rgba(90, 110, 80, .15);
  --radius: 22px;
}

[data-theme="dark"] {
  --bg: #14180f;
  --app-bg: #1a2014;
  --main-bg: #161b10;
  --panel: #20271a;
  --panel-2: #262e1f;
  --accent-tint: #1c2216;
  --text: #e9eee0;
  --text-muted: #a3ad93;
  --border: #33402a;
  --accent: #9dba86;
  --accent-deep: #d8e6c8;
  --accent-soft: #2a3320;
  --shadow: 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .5);
}

/* ===== 基础 ===== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
    "PingFang SC", "Hiragino Sans GB", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background .25s ease, color .25s ease;
}

button { font-family: inherit; cursor: pointer; }

/* ===== 整体容器（圆角浮层） ===== */
.app {
  display: flex;
  max-width: 1280px;
  min-height: calc(100vh - 48px);
  margin: 24px auto;
  background: var(--app-bg);
  border-radius: 26px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* ===== 侧边栏 ===== */
.sidebar {
  width: 258px;
  flex-shrink: 0;
  background: var(--app-bg);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  z-index: 40;
  transition: transform .25s ease, background .25s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 22px;
}

.brand-logo { font-size: 22px; color: var(--accent); }
.brand-name { font-size: 16px; font-weight: 800; letter-spacing: .3px; }

.nav-label {
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 12px 8px;
  font-weight: 600;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 11px 13px;
  border-radius: 13px;
  font-size: 14.5px;
  text-align: left;
  transition: background .18s ease, color .18s ease;
}

.nav-item:hover { background: var(--panel-2); color: var(--text); }

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.nav-icon { font-size: 17px; width: 22px; text-align: center; }

.sidebar-footer { padding-top: 14px; }

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 11px 13px;
  border-radius: 13px;
  font-size: 14px;
  transition: background .18s ease;
}

.theme-toggle:hover { background: var(--border); }

/* ===== 主区域 ===== */
.main {
  flex: 1;
  min-width: 0;
  background: var(--main-bg);
  display: flex;
  flex-direction: column;
  transition: background .25s ease;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 28px;
}

.menu-btn {
  display: none;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 12px;
  font-size: 18px;
  padding: 7px 12px;
}

.search {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 15px;
  flex: 1;
  min-width: 0;
  max-width: 460px;
  box-shadow: var(--shadow);
}

.search-icon { font-size: 14px; opacity: .6; }

.search input {
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  width: 100%;
  font-family: inherit;
}

.search input::placeholder { color: var(--text-muted); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.date-pill {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7a9a67, #a9c48d);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.content { padding: 6px 28px 28px; max-width: 1140px; width: 100%; }

/* ===== 问候 + 每日概览 ===== */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  background: linear-gradient(120deg, #e4edda 0%, #eff4e8 55%, var(--accent-tint) 100%);
  border-radius: var(--radius);
  padding: 30px 34px;
  margin-bottom: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

[data-theme="dark"] .hero {
  background: linear-gradient(120deg, #232f19 0%, #1e2715 55%, #1c2216 100%);
}

/* 植物装饰：角落的小叶子 */
.hero::before {
  content: "🌿";
  position: absolute;
  right: 24px;
  bottom: 8px;
  font-size: 26px;
  line-height: 1;
  opacity: .55;
  pointer-events: none;
  z-index: 0;
}

.hero::after {
  content: "";
  position: absolute;
  right: -60px;
  bottom: -80px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: rgba(122, 154, 103, .16);
  pointer-events: none;
}

.hero-text { position: relative; z-index: 1; }

.hero h2 {
  margin: 0 0 8px;
  font-size: 27px;
  color: var(--accent-deep);
  letter-spacing: .5px;
}

.hero p { margin: 0; color: #556347; font-size: 14.5px; }

[data-theme="dark"] .hero p { color: #bccaa9; }

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

.hero-card {
  position: relative;
  z-index: 1;
  margin-left: auto;
  background: var(--panel);
  border-radius: 18px;
  padding: 16px 20px;
  min-width: 250px;
  box-shadow: var(--shadow);
}

.hero-card-title { font-size: 13px; font-weight: 700; margin-bottom: 10px; color: var(--text); }

.hero-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.hero-list li { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-muted); }

.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot.indigo { background: #7a9a67; }
.dot.blue { background: #a3ba8c; }
.dot.sky { background: #cdbb95; }

/* ===== 统计卡片 ===== */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: 16px;
  margin-bottom: 26px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 13px;
  background: var(--panel);
  border-radius: 18px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-value { font-size: 19px; font-weight: 800; }

.stat-label { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

/* 图标配色（清新治愈风的鼠尾草绿 / 米黄） */
.stat-icon.blue, .card-icon.blue { background: rgba(122, 154, 103, .20); }
.stat-icon.green, .card-icon.green { background: rgba(142, 170, 122, .20); }
.stat-icon.purple, .card-icon.purple { background: rgba(160, 175, 130, .22); }
.stat-icon.pink, .card-icon.pink { background: rgba(205, 185, 150, .28); }
.stat-icon.orange, .card-icon.orange { background: rgba(200, 175, 130, .24); }
.stat-icon.teal, .card-icon.teal { background: rgba(120, 165, 130, .20); }

/* ===== 区块标题 ===== */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 2px 14px;
}

.section-title { font-size: 16px; font-weight: 800; margin: 0; }

.section-hint { font-size: 12.5px; color: var(--text-muted); }

/* ===== 功能卡片 ===== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr));
  gap: 18px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  text-align: left;
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card.active { border-color: var(--accent); }

.card-top { display: flex; align-items: center; gap: 12px; }

.card-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}

.card-name { font-size: 16px; font-weight: 800; }

.card-desc { margin: 0; color: var(--text-muted); font-size: 13.5px; line-height: 1.65; flex: 1; }

.card-enter {
  align-self: flex-start;
  font-size: 12.5px;
  color: #fff;
  background: var(--accent);
  border: none;
  padding: 7px 16px;
  border-radius: 999px;
  font-weight: 600;
  transition: filter .18s ease;
}

.card:hover .card-enter { filter: brightness(1.08); }

.empty-hint {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 30px;
  background: var(--panel);
  border-radius: 18px;
  border: 1px dashed var(--border);
}

/* ===== 模块信息面板 ===== */
.module-panel {
  margin-top: 22px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 18px;
  padding: 18px 22px;
  box-shadow: var(--shadow);
  animation: fade .25s ease;
}

.module-panel h3 { margin: 0 0 6px; font-size: 17px; }

.module-panel p { margin: 0; color: var(--text-muted); font-size: 14px; line-height: 1.7; }

.module-panel .chip {
  display: inline-block;
  margin-top: 12px;
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 600;
}

@keyframes fade { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ===== 页脚 ===== */
.page-footer { margin: 34px 0 6px; text-align: center; color: var(--text-muted); font-size: 12.5px; }

/* 植物装饰：页脚小叶子 */
.page-footer p::before { content: "🌿 "; opacity: .7; }

/* ===== 轻提示 ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 20px);
  background: var(--text);
  color: var(--panel);
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 80;
  max-width: 88vw;
}

.toast.show { opacity: .96; transform: translate(-50%, 0); }

/* ===== 遮罩（移动端） ===== */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(35, 45, 25, .45);
  z-index: 35;
}

.overlay.show { display: block; }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .app { margin: 0; border-radius: 0; min-height: 100vh; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: inline-flex; }
  .content { padding: 6px 16px 24px; }
  .topbar { padding: 16px; }
  .date-pill { display: none; }
  .hero { flex-direction: column; align-items: flex-start; padding: 24px 20px; }
  .hero-card { margin-left: 0; width: 100%; min-width: 0; }
}

/* ===== 移动端加固：避免横向溢出、便于触摸与输入 ===== */
html, body { max-width: 100%; overflow-x: hidden; }
img, video, canvas, table { max-width: 100%; }

@media (max-width: 640px) {
  .content { padding: 6px 12px 24px; }
  .welcome h2 { font-size: 20px; }
  .hero { padding: 20px 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  button, .nav-item, .theme-toggle, .btn-primary, .btn-ghost, .mini-btn, .filter-tabs button, .home-tile { min-height: 42px; }
  /* !important 用于压过各页 .field input 等类选择器，避免 iOS 聚焦自动放大 */
  input, textarea, select { font-size: 16px !important; }
}
