/* ============================================================
 * 岳总工作台 · Daily Town 风格主题
 * 暖色 · 圆角卡片 · 粗边框 · 轻量游戏化
 * ============================================================ */

:root {
  --bg-cream: #fefcf5;
  --bg-panel: #fffbe6;
  --bg-card: #ffffff;
  --bg-sky: #a8d8f0;
  --bg-grass: #8fd68f;
  --ink: #4a3b2a;
  --ink-light: #7d6e5d;
  --border: #4a3b2a;
  --accent-green: #8fd68f;
  --accent-yellow: #ffe08a;
  --accent-pink: #ffb7b2;
  --accent-blue: #a8d8f0;
  --accent-orange: #ffb56b;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow: 4px 4px 0 var(--border);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg-cream);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
}

.hidden { display: none !important; }

/* ================= 登录页 ================= */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(var(--bg-sky) 0%, var(--bg-sky) 55%, var(--bg-grass) 55%, var(--bg-grass) 100%);
}
.login-card {
  background: var(--bg-panel);
  border: 3px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 36px 32px;
  width: 380px;
  max-width: 92vw;
  position: relative;
  z-index: 2;
}
.login-logo { font-size: 48px; text-align: center; }
.login-card h1 { text-align: center; font-size: 26px; margin-top: 8px; }
.login-sub { text-align: center; color: var(--ink-light); font-size: 13px; margin: 6px 0 20px; }
.login-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tab-btn {
  flex: 1;
  padding: 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-light);
}
.tab-btn.active { background: var(--accent-yellow); color: var(--ink); }
.auth-form { display: flex; flex-direction: column; gap: 6px; }
.auth-form label { font-size: 13px; font-weight: 600; margin-top: 8px; }
.auth-form input {
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  background: var(--bg-card);
  outline: none;
}
.auth-form input:focus { box-shadow: 0 0 0 3px var(--accent-blue); }
.auth-msg { color: #c0392b; font-size: 13px; min-height: 20px; margin-top: 6px; }
.btn-block { width: 100%; margin-top: 14px; }

/* ================= 按钮 ================= */
.btn-primary {
  background: var(--accent-green);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--border);
  transition: transform .08s, box-shadow .08s;
}
.btn-primary:hover { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--border); }
.btn-primary:active { transform: translate(3px, 3px); box-shadow: none; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-secondary {
  background: var(--accent-yellow);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--border);
}
.btn-secondary:hover { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--border); }
.btn-danger {
  background: var(--accent-pink);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
}
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
}
.btn-icon:hover { background: rgba(0,0,0,.06); }

/* ================= 主布局 ================= */
.app-view { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px;
  background: var(--bg-panel);
  border-right: 3px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 50;
  transition: transform .2s;
}
.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 2px solid var(--border);
}
.sidebar-logo { font-size: 28px; }
.sidebar-title { font-size: 16px; font-weight: 800; }
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  border: 2px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.7); }
.nav-item.active {
  background: var(--bg-card);
  border: 2px solid var(--border);
  box-shadow: 2px 2px 0 var(--border);
}
.nav-icon { font-size: 17px; width: 22px; text-align: center; }
.sidebar-foot {
  padding: 12px;
  border-top: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mini-level {
  background: var(--accent-yellow);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  padding: 4px;
  font-weight: 800;
  font-size: 14px;
}
.btn-logout {
  background: none;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-light);
}
.btn-logout:hover { background: var(--accent-pink); color: var(--ink); }

.main {
  flex: 1;
  margin-left: 230px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: var(--bg-panel);
  border-bottom: 3px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.menu-btn { display: none; font-size: 22px; background: none; border: none; cursor: pointer; }
.topbar-title { font-size: 20px; font-weight: 800; flex: 1; }
.topbar-badges { display: flex; gap: 8px; }
.badge {
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 2px 2px 0 var(--border);
}
.badge-level { background: var(--accent-yellow); }
.badge-streak { background: var(--accent-pink); }

.content {
  flex: 1;
  padding: 24px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

/* ================= 卡片 ================= */
.card {
  background: var(--bg-card);
  border: 3px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}
.card-title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.card-grid.cols-4 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.card-grid.cols-5 { grid-template-columns: repeat(5, 1fr); gap: 12px; }
@media (max-width: 900px) { .card-grid.cols-5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .card-grid.cols-5 { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--bg-card);
  border: 3px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px;
  text-align: center;
}
.stat-card .stat-icon { font-size: 28px; }
.stat-card .stat-value { font-size: 26px; font-weight: 800; margin-top: 4px; }
.stat-card .stat-label { font-size: 12px; color: var(--ink-light); }

/* ================= 表单 ================= */
.form-row { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.form-row input, .form-row select {
  padding: 9px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: var(--bg-card);
  outline: none;
  flex: 1;
  min-width: 120px;
}
.form-row input:focus, .form-row select:focus { box-shadow: 0 0 0 3px var(--accent-blue); }
textarea.input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: var(--bg-card);
  outline: none;
  resize: vertical;
  font-family: var(--font);
}

/* ================= 列表 ================= */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 6px;
  border-bottom: 2px dashed #e8ddc8;
}
.list-item:last-child { border-bottom: none; }
.check-circle {
  width: 24px; height: 24px;
  border: 2px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  background: var(--bg-card);
}
.check-circle.done { background: var(--accent-green); }
.item-body { flex: 1; min-width: 0; }
.item-title { font-weight: 600; }
.item-title.done { text-decoration: line-through; color: var(--ink-light); }
.item-meta { font-size: 12px; color: var(--ink-light); display: flex; gap: 8px; flex-wrap: wrap; }
.tag {
  background: var(--accent-yellow);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
}

/* ================= 进度条 ================= */
.progress {
  height: 14px;
  background: #f0e9d8;
  border: 2px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent-green);
  border-radius: 999px;
  transition: width .4s;
}

/* ================= 空状态 / 加载 / 错误 ================= */
.empty-state { text-align: center; padding: 40px 0; color: var(--ink-light); }
.empty-icon { font-size: 44px; margin-bottom: 8px; }
.page-loading { text-align: center; padding: 60px 0; color: var(--ink-light); }
.page-error { text-align: center; padding: 40px; color: #c0392b; }

/* ================= Toast ================= */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 999;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  transition: opacity .25s, transform .25s;
  opacity: 1;
}
.toast.hidden { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(10px); }
.toast-error { background: #c0392b; }

/* ================= 游戏化 ================= */
.level-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, var(--accent-yellow), #ffd56b);
  border: 3px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.level-banner .lv-big { font-size: 42px; font-weight: 900; line-height: 1; }
.level-banner .lv-info { flex: 1; }
.level-banner .lv-info .lv-name { font-size: 15px; font-weight: 800; }
.xp-fly {
  position: fixed;
  z-index: 1000;
  font-weight: 800;
  color: #c07800;
  background: var(--bg-panel);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  box-shadow: 2px 2px 0 var(--border);
  pointer-events: none;
  animation: xpFly 1.3s ease-out forwards;
  white-space: nowrap;
}
@keyframes xpFly {
  0% { opacity: 1; transform: translateY(0) scale(0.9); }
  30% { transform: translateY(-14px) scale(1.05); }
  100% { opacity: 0; transform: translateY(-70px) scale(1.15); }
}

/* 升级弹窗 */
.level-up-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(74, 59, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .25s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.level-up-card {
  background: var(--bg-panel);
  border: 3px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 34px 48px;
  text-align: center;
  animation: levelUpPop .45s cubic-bezier(.34,1.56,.64,1);
}
@keyframes levelUpPop {
  0% { transform: scale(.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.level-up-emoji { font-size: 56px; animation: levelUpSpin 1.2s ease-in-out infinite; }
@keyframes levelUpSpin {
  0%, 100% { transform: rotate(-8deg) scale(1); }
  50% { transform: rotate(8deg) scale(1.12); }
}
.level-up-title { font-size: 22px; font-weight: 900; margin-top: 8px; }
.level-up-lv { font-size: 46px; font-weight: 900; color: #c07800; margin: 6px 0; }
.level-up-sub { font-size: 13px; color: var(--ink-light); margin-bottom: 16px; }

/* 连击火焰（习惯打卡） */
.check-circle { position: relative; }
.combo-flame {
  position: absolute;
  right: -10px;
  top: -12px;
  font-size: 18px;
  pointer-events: none;
  animation: flameUp .85s ease-out forwards;
}
.combo-flame-big { font-size: 26px; animation: flameUp 1s ease-out forwards; }
@keyframes flameUp {
  0% { opacity: 0; transform: translateY(6px) scale(.6) rotate(-12deg); }
  30% { opacity: 1; transform: translateY(-2px) scale(1.15) rotate(4deg); }
  100% { opacity: 0; transform: translateY(-22px) scale(.9) rotate(-6deg); }
}

/* ================= 应用卡片 ================= */
.app-card {
  background: var(--bg-card);
  border: 3px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: transform .1s;
}
.app-card:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--border); }
.app-card .app-icon { font-size: 30px; }
.app-card .app-name { font-weight: 800; font-size: 15px; }
.app-card .app-desc { font-size: 12px; color: var(--ink-light); flex: 1; }
.app-card .app-foot { display: flex; justify-content: space-between; align-items: center; }
.status-badge { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; border: 1.5px solid var(--border); }
.status-online { background: var(--accent-green); }
.status-local { background: #e8e0d0; color: var(--ink-light); }
.status-beta { background: var(--accent-blue); }
.status-disabled { background: #ddd; color: #888; }

/* ================= 新闻 ================= */
.news-item {
  padding: 12px 6px;
  border-bottom: 2px dashed #e8ddc8;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
}
.news-item:last-child { border-bottom: none; }
.news-item .news-title { font-weight: 700; }
.news-item.unread .news-title { color: #2c6e49; }
.news-item .news-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-green); margin-top: 8px; flex-shrink: 0; }
.news-item.read .news-dot { background: #d8d0c0; }

/* ================= 记账 ================= */
.month-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.amount-income { color: #2c6e49; font-weight: 800; }
.amount-expense { color: #c0392b; font-weight: 800; }

/* 财务看板深度融合版 */
.acc-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.acc-month { font-size: 17px; font-weight: 800; }
.acc-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 768px) { .acc-grid2 { grid-template-columns: 1fr; } }
.acc-bar-row { margin-bottom: 12px; }
.acc-bar-row:last-child { margin-bottom: 0; }
.acc-bar-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.acc-trend { display: flex; justify-content: space-around; align-items: flex-end; padding: 8px 0; }
.acc-trend-col { text-align: center; }
.acc-trend-bars { display: flex; gap: 4px; align-items: flex-end; justify-content: center; height: 84px; }
.acc-bar-in { width: 14px; background: linear-gradient(180deg,#8fd68f,#2c6e49); border-radius: 4px 4px 0 0; border: 1.5px solid var(--border); border-bottom: none; }
.acc-bar-exp { width: 14px; background: linear-gradient(180deg,#ffb7b2,#c0392b); border-radius: 4px 4px 0 0; border: 1.5px solid var(--border); border-bottom: none; }
.acc-trend-m { font-size: 11px; color: var(--ink-light); margin-top: 4px; }
.acc-ai-oneliner { background: #fff8ec; border: 2px solid var(--border); border-radius: 12px; padding: 10px 14px; font-weight: 700; margin-bottom: 12px; }
.acc-ai-sec { font-weight: 800; font-size: 14px; margin: 14px 0 8px; }
.acc-ai-item { border: 2px dashed #e8ddc8; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.acc-ai-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.acc-ai-why { font-size: 13px; color: var(--ink); }
.acc-ai-how { font-size: 13px; color: #2c6e49; font-weight: 600; margin-top: 4px; }
.acc-checklist { padding-left: 22px; font-size: 13px; }
.acc-checklist li { margin-bottom: 4px; }

/* ================= 响应式 ================= */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 250px;
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-btn { display: block; }
  .content { padding: 14px; }
  .topbar { padding: 12px 14px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* 表格（体重等） */
table.simple {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.simple th, table.simple td {
  padding: 8px 10px;
  border-bottom: 2px dashed #e8ddc8;
  text-align: left;
}
table.simple th { font-weight: 700; color: var(--ink-light); font-size: 12px; }

/* ================= 抖音图文复盘 ================= */
.dy-summary { display: flex; gap: 8px; flex-wrap: wrap; }
.dy-stat { flex: 1; min-width: 90px; text-align: center; background: #fff8ec; border: 2px solid var(--border); border-radius: 12px; padding: 10px 6px; }
.dy-stat-num { font-size: 20px; font-weight: 800; }
.dy-stat-label { font-size: 12px; color: var(--ink-light); margin-top: 2px; }
.dy-sync-ok { background: var(--accent-green, #b8e6c9); }
.dy-sync-off { background: #f0d9d9; }
.dy-table-wrap { overflow-x: auto; }
.dy-table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
.dy-table th, .dy-table td { padding: 8px 10px; border-bottom: 2px dashed #e8ddc8; text-align: left; }
.dy-table th { font-weight: 700; color: var(--ink-light); font-size: 12px; }
.dy-topic { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.dy-badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 8px; font-weight: 600; }
.dy-badge-ok { background: #b8e6c9; color: #1d5c38; }
.dy-badge-pending { background: #f5e3b3; color: #7a5a12; }
.dy-badge-fail { background: #f0c9c9; color: #8a2222; cursor: help; }
.dy-mask { position: fixed; inset: 0; background: rgba(60,50,30,.45); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.dy-editor { background: #fffdf6; border: 3px solid var(--border); border-radius: 18px; box-shadow: 6px 6px 0 var(--border); padding: 18px; width: 100%; max-width: 680px; max-height: 88vh; overflow-y: auto; }
.dy-form-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px 10px; margin-top: 10px; }
.dy-form-grid label { font-size: 12px; font-weight: 600; display: flex; flex-direction: column; gap: 3px; }
.dy-form-grid input { padding: 7px 9px; border: 2px solid var(--border); border-radius: 9px; font-size: 13px; background: #fff; }
.dy-editor textarea.input { width: 100%; margin-top: 4px; }
.dy-editor-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
@media (max-width: 640px) {
  .dy-form-grid { grid-template-columns: 1fr 1fr; }
  .dy-stat { min-width: 72px; }
}
