/* ============================================================
   时迹 · base.css
   设计令牌（CSS 变量）+ 轻量 reset + 排版 + 通用控件
   目标：克制的浅色界面，参考 Outlook 日历的信息密度，不做复杂功能
   ============================================================ */

:root {
  /* 页面基底：暖白调，轻盈不刺眼 */
  --bg: #f6f4f0;
  --surface: #ffffff;
  --surface-soft: #faf8f4;
  --surface-hover: #f3f0ea;

  /* 文字：暖调中性色，由深到浅构成层级 */
  --text: #2b2a27;
  --text-muted: #6b6660;
  --text-faint: #9c968d;

  /* 线条：米灰，进一步降低存在感 */
  --border: #eeebe4;
  --border-strong: #ded9cf;

  /* 主色：保留原来的蓝（语义色），只把浅底调暖一点 */
  --accent: #2f6fd0;
  --accent-soft: #e9f1fc;

  /* 反馈色（仅用于中性提示，绝不用于“未完成/失败”评价） */
  --ok: #3d9169;
  --danger: #b4453c;
  --danger-soft: #fbeceb;

  /* 任务颜色板：保留原有 8 色与语义，整体降饱和、提亮一档，
     避免时间轴里出现大块高饱和色 */
  --c-blue-soft: #eaf1fb;   --c-blue-line: #6d95d8;
  --c-teal-soft: #e6f4f3;   --c-teal-line: #55a8a3;
  --c-green-soft: #eaf5ee;  --c-green-line: #63a87c;
  --c-amber-soft: #fbf3e4;  --c-amber-line: #c19a55;
  --c-orange-soft: #fbeee6; --c-orange-line: #cb8a68;
  --c-red-soft: #fbedeb;    --c-red-line: #c47c73;
  --c-violet-soft: #f2edfa; --c-violet-line: #9781cb;
  --c-slate-soft: #efeeea;  --c-slate-line: #93999f;

  /* 尺寸：适度放大的圆角，让卡片更柔和、少一点“后台面板感” */
  --radius: 14px;        /* 卡片、弹窗、大块容器 */
  --radius-sm: 10px;     /* 行、按钮、输入框、色块 */
  --radius-pill: 999px;
  --gap: 16px;           /* 卡片之间 */
  --pad: 18px;           /* 卡片内部 */
  --gap-tight: 10px;     /* 同一区块内的元素间距 */
  --shell: 1180px;

  /* 字号阶梯：只保留这几档，避免 12/12.5/13 混用 */
  --fs-lg: 20px;         /* 日期 */
  --fs-md: 15px;         /* 卡片标题、列标题、弹窗标题 */
  --fs-base: 13px;       /* 正文、任务名、备注 */
  --fs-sm: 12px;         /* 辅助说明、提示 */
  --fs-xs: 11px;         /* 时间轴刻度、极小注释 */

  /* 行高 */
  --lh-tight: 1.35;
  --lh-base: 1.6;

  /* 时间轴尺度（后续时间轴模块共用，保证左右两列对齐） */
  --hour-h: 56px;
  --gutter-w: 62px;

  /* 阴影：暖调、更柔，避免冷硬的重投影 */
  --shadow: 0 1px 2px rgba(80, 68, 52, .04), 0 4px 10px -4px rgba(80, 68, 52, .06),
            0 14px 30px -18px rgba(80, 68, 52, .12);
  --shadow-pop: 0 12px 32px rgba(80, 68, 52, .14);
  --focus-ring: 0 0 0 3px rgba(47, 111, 208, .14);
  --font: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC",
          "Hiragino Sans GB", "Source Han Sans SC", sans-serif;
  --font-num: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

/* hidden 属性必须真的能隐藏元素。
   组件里给按钮/标签写了 display（如 .btn/.checkbox 的 inline-flex），
   作者样式的优先级高于浏览器默认的 [hidden]{display:none}，会导致
   “JS 明明设了 hidden，元素却还在、还能点”。这里统一兜住。 */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

input, textarea, select {
  font: inherit;
  color: inherit;
}

/* ---------- 表单控件：默认 / hover / focus / disabled ---------- */
input[type="text"],
input[type="time"],
input[type="date"],
input[type="search"],
textarea,
select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}

input[type="text"]:hover,
input[type="time"]:hover,
input[type="date"]:hover,
input[type="search"]:hover,
textarea:hover,
select:hover {
  border-color: var(--border-strong);
}

input[type="text"]:focus,
input[type="time"]:focus,
input[type="date"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

input[type="text"]:disabled,
input[type="time"]:disabled,
textarea:disabled,
select:disabled {
  background: var(--surface-soft);
  border-color: var(--border);
  color: var(--text-faint);
  cursor: not-allowed;
}

::placeholder { color: var(--text-faint); opacity: 1; }

/* 键盘可达性：所有可交互元素都有统一的焦点圈 */
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

textarea { resize: vertical; }

/* ---------- 按钮体系 ----------
   主要按钮 .btn-primary（实心）
   次要按钮 .btn（浅底、无边框）
   图标按钮 .btn-icon（默认透明，hover 才出底色）
   文字按钮 .btn-ghost（无底色）
   危险按钮 .btn-danger（浅红底）/ .btn-danger-left（默认像文字、hover 才变红底） */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 500;
  line-height: 1.25;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { background: var(--surface-hover); }
.btn:active { background: #e9e5dd; }
.btn:focus-visible { border-color: var(--accent); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(47, 111, 208, .24);
}
.btn-primary:hover { background: #2a63ba; }
.btn-primary:active { background: #2559a8; }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-ghost:active { background: #e9e5dd; }

.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #f7dedc; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  transition: background .15s, color .15s;
}
.btn-icon:hover { background: var(--surface-hover); color: var(--text); }
.btn-icon:active { background: #e9e5dd; }
.btn-icon.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- 通用小元素 ---------- */
.mark {
  font-weight: 700;
  color: var(--c-amber-line);
  letter-spacing: -1px;
}

/* 数字徽标：中性灰而非强调色，避免数字抢过标题 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: rgba(80, 68, 52, .055);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 400;
  line-height: 18px;
}

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- 滚动条：细、淡、暖 ---------- */
* { scrollbar-width: thin; scrollbar-color: #ded8ce transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb {
  background: #ded8ce;
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: #c8c1b5; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }
