:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1b2430;
  --muted: #7b8798;
  --line: #e6eaf2;
  --primary: #2f6bff;
  --primary-soft: #eaf0ff;
  --danger: #e5484d;
  --warn: #f59e0b;
  --ok: #12b76a;
  --radius: 14px;
  --shadow: 0 6px 20px rgba(31, 56, 120, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--primary); text-decoration: none; }

.hidden { display: none !important; }
.error { color: var(--danger); font-size: 13px; margin: 8px 0 0; min-height: 18px; }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.6; margin: 8px 0 0; }

/* ---------------- 登录 ---------------- */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #dbe6ff 0%, var(--bg) 55%);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 30px 26px 22px;
}

.brand { text-align: center; margin-bottom: 22px; }
.brand img { width: 64px; height: 64px; border-radius: 16px; }
.brand h1 { margin: 12px 0 4px; font-size: 21px; letter-spacing: 1px; }
.brand p { margin: 0; color: var(--muted); font-size: 13px; }

/* ---------------- 布局 ---------------- */
.shell { min-height: 100vh; padding-bottom: 78px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
  background: rgba(244, 246, 251, 0.88);
  backdrop-filter: blur(12px);
  font-size: 17px;
  font-weight: 600;
}

.topbar-left { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--card);
  box-shadow: 0 2px 8px rgba(31, 56, 120, 0.06);
  font-size: 16px;
}
.icon-btn.on { background: var(--primary-soft); }

#main { padding: 4px 16px 24px; max-width: 760px; margin: 0 auto; }

.view { display: none; }
.view.active { display: block; animation: fade 0.18s ease; }
.login-view.active { display: flex; }

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

/* ---------------- 首页 ---------------- */
.hello {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 8px 4px 16px;
}
.hello-title { font-size: 22px; font-weight: 700; }
.hello-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.hello-date { color: var(--muted); font-size: 13px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 10px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.stat-num { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--muted); }

.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 4px; }
.quick-btn {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text);
}
.quick-icon { font-size: 20px; }

.section { margin-top: 20px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 2px;
}
.section-head h2 { font-size: 15.5px; margin: 0; font-weight: 600; }
.link-btn { color: var(--primary); font-size: 13px; padding: 2px 4px; }

/* ---------------- 卡片列表 ---------------- */
.list { display: flex; flex-direction: column; gap: 10px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.card:active { transform: scale(0.99); }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-title { font-weight: 600; font-size: 14.5px; line-height: 1.45; }
.card-amount { font-weight: 700; color: var(--primary); white-space: nowrap; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.card-foot { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 8px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11.5px;
  background: #f1f4fa;
  color: #5c6b80;
}
.badge.s1 { background: #fff3e0; color: #b26a00; }
.badge.s5 { background: var(--primary-soft); color: var(--primary); }
.badge.s3 { background: #e6f8ef; color: var(--ok); }
.badge.due { background: #ffeaea; color: var(--danger); }

.empty { text-align: center; color: var(--muted); font-size: 13px; padding: 26px 10px; }

/* ---------------- 搜索 / 筛选 ---------------- */
.search-row { display: flex; gap: 8px; margin: 6px 0 12px; }
.search-input {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}
.search-input:focus { border-color: var(--primary); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; }
.chip {
  flex: none;
  padding: 6px 14px;
  border-radius: 99px;
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
  border: 1px solid var(--line);
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.load-more-wrap { padding: 14px 0; }

/* ---------------- 表单 ---------------- */
.form { display: block; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.field > span i { color: var(--danger); font-style: normal; }
.field input, .field select, .field textarea, .textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.1);
}
.field input.ai-hit { border-color: var(--primary); background: #f7faff; }
.textarea { resize: vertical; line-height: 1.6; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row { display: flex; align-items: center; }
.row.gap { gap: 10px; margin-top: 10px; }

.tag-box { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-box label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 99px;
  padding: 5px 11px;
  font-size: 12.5px;
  color: var(--muted);
}
.tag-box input { width: auto; margin: 0; }
.tag-box label:has(input:checked) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.form-actions { padding: 8px 0 24px; }

/* ---------------- 按钮 ---------------- */
.btn {
  border-radius: 11px;
  padding: 11px 16px;
  font-size: 14.5px;
  font-weight: 600;
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.btn:active { transform: scale(0.99); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:disabled { opacity: 0.55; }
.btn.ghost { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.btn.danger-ghost { background: #fff; color: var(--danger); border: 1px solid #ffd9da; }
.btn.block { width: 100%; }

/* ---------------- 详情 ---------------- */
.detail-head { display: flex; justify-content: space-between; align-items: center; margin: 6px 0 12px; }
.detail-title { font-size: 19px; font-weight: 700; margin: 4px 0 10px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-item {
  background: var(--card);
  border-radius: 12px;
  padding: 11px 13px;
  box-shadow: var(--shadow);
}
.detail-item .k { font-size: 12px; color: var(--muted); }
.detail-item .v { font-size: 14px; margin-top: 4px; word-break: break-all; }
.detail-item.wide { grid-column: span 2; }

/* ---------------- 会议 ---------------- */
.todo-item {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 13px 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.todo-main { min-width: 0; }
.todo-name { font-weight: 600; font-size: 14px; }
.todo-notes { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.todo-time { color: var(--primary); font-size: 12.5px; margin-top: 5px; }
.todo-actions { display: flex; flex-direction: column; gap: 6px; flex: none; }
.mini-btn {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  white-space: nowrap;
}
.mini-btn.gray { background: #f1f4fa; color: var(--muted); }
.todo-item.overdue { border-left: 3px solid var(--danger); }

/* ---------------- 我的 ---------------- */
.profile {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-top: 8px;
}
.avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2f6bff, #6f9bff);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
}
.profile-name { font-size: 17px; font-weight: 700; }
.profile-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---------------- 底部导航 ---------------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  max-width: 760px;
  margin: 0 auto;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
  padding: 4px 0;
}
.tab span { font-size: 19px; line-height: 1; }
.tab em { font-style: normal; }
.tab.active { color: var(--primary); font-weight: 600; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  background: rgba(27, 36, 48, 0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  z-index: 100;
  max-width: 80vw;
  text-align: center;
}

/* ---------------- 提醒横幅 ---------------- */
.alert {
  background: #fff8e6;
  border: 1px solid #ffe2a8;
  color: #8a5a00;
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 10px 0;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

@media (max-width: 380px) {
  .grid2, .detail-grid { grid-template-columns: 1fr; }
  .detail-item.wide { grid-column: span 1; }
}
