/* ============================================================
   StepScore · base.css
   设计令牌 / 重置 / 基础排版 / 通用工具类
   ============================================================ */

:root {
  /* 画布与表面 */
  --bg: #f5f6f2;
  --bg-tint: #eef1ea;
  --surface: #ffffff;
  --surface-2: #fafbf7;
  --surface-3: #f2f4ee;
  --ink: #14211c;
  --ink-2: #33453d;
  --ink-3: #3e5249;
  --ink-4: #4d6158;
  --line: #e3e7df;
  --line-2: #d4dad1;

  /* 品牌：墨绿 + 陶土 */
  --brand: #0e6b57;
  --brand-deep: #0a4f41;
  --brand-ink: #083e33;
  --brand-soft: #e6f1ec;
  --brand-soft-2: #d5e9e1;
  --brand-line: #b9d9cd;
  --accent: #c2762c;
  --accent-deep: #9d5a1c;
  --accent-soft: #fbefdf;

  /* 语义色 */
  --ok: #1d7a4e;
  --ok-soft: #e7f4ec;
  --ok-line: #bfe2cf;
  --warn: #a56a0b;
  --warn-soft: #fbf2e0;
  --warn-line: #efd9ac;
  --bad: #b03a32;
  --bad-soft: #fbeae8;
  --bad-line: #f0c9c4;
  --info: #35689e;
  --info-soft: #e9f1f9;
  --info-line: #c8dcef;
  --violet: #6b5aa6;
  --violet-soft: #f0edf9;

  /* 数据可视化顺序色 */
  --c1: #0e6b57;
  --c2: #c2762c;
  --c3: #35689e;
  --c4: #9c5b8b;
  --c5: #7c8f3c;
  --c6: #b03a32;

  /* 阴影和圆角 */
  --shadow-xs: 0 1px 2px rgba(20, 40, 30, 0.05);
  --shadow-sm: 0 2px 6px -2px rgba(20, 40, 30, 0.1);
  --shadow-md: 0 10px 28px -14px rgba(20, 40, 30, 0.22);
  --shadow-lg: 0 28px 70px -28px rgba(20, 40, 30, 0.34);
  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 999px;

  /* 字体 */
  --font: "Inter", "SF Pro Text", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", "Cascadia Code", Consolas, "Liberation Mono", monospace;

  /* 尺寸 */
  --sidebar-w: 248px;
  --topbar-h: 64px;
  --page-max: 1500px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  font-feature-settings: "tnum" 1, "cv05" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1100px 520px at 88% -12%, rgba(194, 118, 44, 0.075), transparent 60%),
    radial-gradient(900px 480px at 4% 0%, rgba(14, 107, 87, 0.06), transparent 55%);
  z-index: 0;
}

h1, h2, h3, h4, h5, p { margin: 0; }
h1, h2, h3, h4 { font-weight: 650; letter-spacing: -0.012em; color: var(--ink); }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
svg { display: block; }
table { border-collapse: collapse; }
pre { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 0; }

::selection { background: var(--brand-soft-2); color: var(--brand-ink); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #cfd6cd;
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: #b6c0b5; background-clip: padding-box; border: 3px solid transparent; }

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 200;
  padding: 10px 16px;
  border: 0;
  background: var(--ink);
  color: #fff;
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  transition: top 0.18s var(--ease);
}
.skip-link:focus { top: 12px; }
#view:focus,
.login-panel:focus,
#password-title:focus {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

/* ---------- 工具类 ---------- */
.mono { font-family: var(--mono); font-size: 0.92em; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.muted { color: var(--ink-3); }
.faint { color: #3f5148; }
.strong { font-weight: 650; }
.tiny { font-size: 12px; }
.small { font-size: 12.5px; }
.micro { font-size: 11px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex1 { flex: 1 1 auto; min-width: 0; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

.row { display: flex; align-items: center; gap: 10px; }
.row-top { display: flex; align-items: flex-start; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.col { display: flex; flex-direction: column; }
.wrap { flex-wrap: wrap; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; }
.gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.gap-20 { gap: 20px; } .gap-24 { gap: 24px; }

.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }
.mb-4 { margin-bottom: 4px; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; } .mb-20 { margin-bottom: 20px; }

.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 10px; }

.ic { flex: none; }

kbd, .kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1;
}

/* ---------- 动画 ---------- */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in {
  0% { opacity: 0; transform: scale(0.96); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
@keyframes draw-line {
  from { stroke-dashoffset: var(--len, 600); }
  to { stroke-dashoffset: 0; }
}

.anim-in { animation: fade-up 0.42s var(--ease) both; }
.anim-in-fast { animation: fade-in 0.3s var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .sidebar, .topbar, .page-actions, .toast-root, .overlay { display: none !important; }
  body { background: #fff; }
  .app-shell { display: block; }
  .view { padding: 0; }
}
