/* base.css —— 设计令牌 + 全局布局 + 通用组件 */
:root {
  --text: #1A1B1C;
  --text-secondary: #6B7280;
  --bg: #F4F3EE;
  --card: #FFFFFF;
  --border: rgba(0, 0, 0, 0.08);
  --accent: #EAA7B2;
  --accent-soft: rgba(234, 167, 178, 0.18);
  --accent-text: #A84E63;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  --font: 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  transition: background 0.4s ease;
}

/* 背景层：主题渐变由 themes.css 定义在 body 上 */
body[data-theme] {
  background-size: cover;
  background-attachment: fixed;
  background-position: center;
}

/* ===== 顶栏（电脑端） ===== */
.topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .brand { font-size: 16px; font-weight: 700; color: var(--accent-text); }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  min-height: 36px;
  line-height: 24px;
}
.topbar nav a.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.topbar .icon-btn {
  border: none; background: var(--accent-soft); color: var(--accent-text);
  width: 40px; height: 40px; border-radius: 50%; font-size: 18px; cursor: pointer;
}

/* ===== 移动端顶栏 ===== */
.mobile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.mobile-top .brand { font-size: 15px; font-weight: 700; color: var(--accent-text); }
.mobile-top .icon-btn {
  border: none; background: var(--accent-soft); color: var(--accent-text);
  width: 40px; height: 40px; border-radius: 50%; font-size: 18px; cursor: pointer;
}

/* ===== 底部 Tab（移动端） ===== */
.tabbar {
  display: flex;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  z-index: 20;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1;
  text-align: center;
  padding: 8px 0 6px;
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  min-height: 48px;
  line-height: 20px;
}
.tabbar a.active { color: var(--accent-text); font-weight: 600; }

/* ===== 主内容区 ===== */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 14px 90px;
  min-height: 100vh;
}

/* ===== 通用组件 ===== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.card-title .hint { font-size: 12px; color: var(--text-secondary); font-weight: 400; }

.btn {
  display: inline-block;
  border: none;
  border-radius: 22px;
  padding: 9px 18px;
  font-size: 14px;
  font-family: var(--font);
  background: var(--accent-soft);
  color: var(--accent-text);
  cursor: pointer;
  min-height: 42px;
  line-height: 24px;
}
.btn-primary { background: var(--accent); color: #FFFFFF; font-weight: 600; }
.btn-danger { background: rgba(234, 102, 104, 0.12); color: #C0392B; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

input[type="text"], input[type="number"], input[type="date"], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: var(--font);
  background: var(--card);
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  background: var(--accent-soft);
  color: var(--accent-text);
}

.empty { text-align: center; color: var(--text-secondary); font-size: 13px; padding: 24px 0; }

.modal-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--card);
  border-radius: 16px;
  padding: 18px;
  width: 100%;
  max-width: 420px;
  max-height: 86vh;
  overflow-y: auto;
}
.modal h3 { font-size: 15px; margin-bottom: 12px; color: var(--text); }
.modal .field { margin-bottom: 12px; }
.modal .field label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

.toast {
  position: fixed;
  left: 50%; bottom: 90px;
  transform: translateX(-50%);
  background: rgba(26, 27, 28, 0.85);
  color: #FFFFFF;
  padding: 9px 18px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 200;
  display: none;
  max-width: 80vw;
}
.toast.show { display: block; }

.banner {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  margin-bottom: 12px;
}
.banner-warn { background: rgba(250, 173, 20, 0.12); color: #8A6A0C; border: 1px solid rgba(250, 173, 20, 0.3); }

/* 桌面断点 */
@media (min-width: 720px) {
  .topbar { display: flex; }
  .mobile-top { display: none; }
  .tabbar { display: none; }
  main { padding-top: 22px; }
}
