/* =========================================================
 * app.css — 公共设计系统（移动端优先，纯静态无外链）
 * 色板/圆角/阴影/字号为全项目统一规格，后续页面单只读引用。
 * ========================================================= */

/* ---------- 设计令牌 ---------- */
:root {
  --bg: #F2F6FC;            /* 页面底色 */
  --card: #FFFFFF;          /* 卡片 */
  --primary: #2F6FED;       /* 主色 */
  --primary-light: #E8F1FD; /* 浅蓝 */
  --ok: #22C55E;            /* 已安排·绿 */
  --wait: #F59E0B;          /* 待执行·橙 */
  --bad: #EF4444;           /* 冲突·红 */
  --text: #1F2937;          /* 正文 */
  --muted: #6B7280;         /* 次要文字 */
  --radius: 12px;
  --shadow: 0 2px 8px rgba(47, 111, 237, .08);
  --nav-h: 58px;
}

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

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* App 视图：手机满宽，≥1024px 居中收窄 */
.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 520px;
  margin: 0 auto;
}

/* ---------- 顶栏（白底 sticky） ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--card);
  padding: 12px 16px 10px;
  box-shadow: 0 1px 0 rgba(31, 41, 55, .06);
}
.topbar-title { font-size: 17px; font-weight: 700; }
.topbar-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* 顶栏齿轮入口（JS 注入，仅非设置页） */
.topbar-gear {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  border-radius: 8px;
}
.topbar-gear:hover { background: var(--primary-light); }
.topbar-gear svg { width: 20px; height: 20px; }
/* 列表页顶栏右侧已有「新增」按钮，预留齿轮空间避免重叠 */
.topbar-row { padding-right: 42px; }

/* ---------- 内容区 ---------- */
.content {
  flex: 1;
  padding: 12px 12px calc(var(--nav-h) + 24px); /* 预留底部导航高度 */
}

/* ---------- 日期条 ---------- */
.datebar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px 10px;
  margin-bottom: 12px;
}
.datebtn {
  width: 32px; height: 32px;
  border: none; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.datebtn svg { width: 18px; height: 18px; }
.datetitle {
  flex: 1;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.todaybtn {
  flex: none;
  border: none;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  background: var(--primary);
  color: #fff;
}

/* ---------- 快捷入口 ---------- */
.quick-entry {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.entry {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text);
}
.entry svg { width: 20px; height: 20px; color: var(--primary); }
.entry.primary { background: var(--primary); color: #fff; }
.entry.primary svg { color: #fff; }

/* ---------- 区块与统计卡 ---------- */
.section { margin-bottom: 12px; }
.section-title {
  font-size: 15px;
  font-weight: 700;
  margin: 4px 2px 8px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
}
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 22px; font-weight: 700; margin-top: 2px; }
.stat-value small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.stat-card.c-blue  .stat-value { color: var(--primary); }
.stat-card.c-green .stat-value { color: var(--ok); }
.stat-card.c-orange .stat-value { color: var(--wait); }
.stat-card.c-gray  .stat-value { color: var(--muted); }

/* ---------- 时间轴 ---------- */
.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tl-item {
  display: grid;
  grid-template-columns: 84px 20px 1fr;
  align-items: stretch;
}
.tl-time {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;   /* 等宽感 */
  padding-top: 14px;
  text-align: left;
  white-space: nowrap;
}
/* 蓝色竖轴 + 圆点 */
.tl-axis {
  position: relative;
  display: flex;
  justify-content: center;
}
.tl-axis::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--primary-light);
}
.tl-item:first-child .tl-axis::before { top: 18px; }
.tl-item:last-child .tl-axis::before { bottom: calc(100% - 18px); }
.tl-dot {
  position: relative;
  z-index: 1;
  width: 10px; height: 10px;
  margin-top: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--primary-light);
  flex: none;
}
.tl-main { padding-left: 8px; }
.tl-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
}
.tl-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.tl-title { font-size: 15px; font-weight: 700; }
.tl-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text);
  margin-top: 3px;
}
.tl-row svg { width: 15px; height: 15px; color: var(--primary); flex: none; }

/* ---------- 状态徽章 ---------- */
.badge {
  flex: none;
  font-size: 12px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 999px;
  margin-top: 1px;
}
.badge-ok    { color: var(--ok);   background: rgba(34, 197, 94, .12); }
.badge-wait  { color: var(--wait); background: rgba(245, 158, 11, .12); }
.badge-bad   { color: var(--bad);  background: rgba(239, 68, 68, .12); }
.badge-other { color: var(--muted); background: rgba(107, 114, 128, .12); }
.badge-primary { color: var(--primary); background: rgba(47, 111, 237, .12); }

/* ---------- 空状态 ---------- */
.empty {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.empty svg { width: 34px; height: 34px; color: var(--muted); opacity: .6; }
.empty p { margin-top: 8px; }
/* 空状态内嵌按钮（默认不渲染，仅当 UI.emptyState 传入 opts.action） */
.empty-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.empty-action svg { width: 16px; height: 16px; color: #fff; opacity: 1; }

/* ---------- 演示数据提示 ---------- */
.demo-note {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  background: var(--primary-light);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-top: 4px;
}

/* ---------- 底部导航（固定） ---------- */
.nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--card);
  box-shadow: 0 -1px 0 rgba(31, 41, 55, .06);
  display: flex;
  z-index: 30;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--primary); font-weight: 700; }

/* ---------- 桌面端（≥1024px）：App 视图居中留白 ---------- */
@media (min-width: 1024px) {
  body {
    background:
      linear-gradient(var(--bg), var(--bg)) padding-box,
      var(--bg);
  }
  .app {
    box-shadow: 0 0 0 1px rgba(47, 111, 237, .06), 0 8px 32px rgba(47, 111, 237, .10);
    border-radius: 0 0 var(--radius) var(--radius);
  }
  .nav { border-radius: 0 0 var(--radius) var(--radius); }
}
