/* ============================================================
   恒元智造演示素材 · 共享设计系统
   零 CDN / 零外部字体 / 零框架 —— 断网双击即可打开
   ============================================================ */

:root {
  /* 墨色阶：标题与正文，不用纯黑，避免厚重 */
  --ink-1: #0E2230;
  --ink-2: #3A5261;
  --ink-3: #6B8494;
  --ink-4: #9BAFBA;

  /* 主色系：同色系渐进，米→浅→主→深，不设第二强调色 */
  --brand-1: #EAF6F0;
  --brand-2: #C3E8D5;
  --brand-3: #7FCBA6;
  --brand-4: #2FA374;
  --brand-5: #157A54;
  --brand-6: #0C5238;

  /* 功能色：只在真需要警示时用 */
  --warn-bg: #FDF3E3;
  --warn-fg: #9A6512;
  --risk-bg: #FBECEA;
  --risk-fg: #B03A2E;
  --info-bg: #ECF3F8;
  --info-fg: #2C6284;

  --bg: #F5F8FA;
  --bg-2: #EDF2F5;
  --card: #FFFFFF;
  --line: #E1E9EE;
  --line-2: #CFDCE4;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 22px;

  --sh-1: 0 1px 2px rgba(14, 34, 48, .04), 0 2px 8px rgba(14, 34, 48, .05);
  --sh-2: 0 2px 6px rgba(14, 34, 48, .06), 0 12px 28px rgba(14, 34, 48, .08);
  --sh-3: 0 8px 20px rgba(14, 34, 48, .10), 0 28px 60px rgba(14, 34, 48, .12);

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
          "Hiragino Sans GB", "Source Han Sans SC", "Noto Sans CJK SC",
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;

  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink-1);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.6;
  font-size: 15px;
}

/* 顶部那条极细的品牌色带，所有页面共用 */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-5), var(--brand-3) 55%, var(--brand-2));
  z-index: 999;
}

a { color: var(--brand-5); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── 版式 ───────────────────────────────────────────────── */
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
.wrap-wide { max-width: 1520px; margin: 0 auto; padding: 0 32px; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; letter-spacing: .12em;
  color: var(--brand-5); text-transform: uppercase;
}
.eyebrow::before {
  content: ""; width: 22px; height: 2px; background: var(--brand-4);
  border-radius: 2px;
}

.h1 { font-size: 40px; font-weight: 800; letter-spacing: -.5px; line-height: 1.25; margin: 14px 0 0; }
.h2 { font-size: 26px; font-weight: 700; letter-spacing: -.3px; margin: 0; }
.h3 { font-size: 17px; font-weight: 700; margin: 0; }
.lead { font-size: 16px; color: var(--ink-2); margin: 12px 0 0; max-width: 76ch; }
.sub { font-size: 13px; color: var(--ink-3); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -.2px; }

/* ── 顶栏（demo 页共用）────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  display: flex; align-items: center; gap: 16px;
  height: 58px;
}
.topbar .logo {
  display: flex; align-items: center; gap: 9px;
  font-weight: 800; font-size: 15px; letter-spacing: -.2px;
}
.logo-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, var(--brand-4), var(--brand-6));
  color: #fff; display: grid; place-items: center;
  font-size: 13px; font-weight: 800;
}
.topbar .crumb { color: var(--ink-3); font-size: 13px; }
.topbar .spacer { flex: 1; }
.back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--ink-2); padding: 6px 12px;
  border: 1px solid var(--line-2); border-radius: 999px; background: #fff;
  transition: all .18s var(--ease);
}
.back:hover { border-color: var(--brand-3); color: var(--brand-5); text-decoration: none; }

/* ── 卡片 ───────────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-1);
}
.card-pad { padding: 22px 24px; }
.card-hover { transition: transform .22s var(--ease), box-shadow .22s var(--ease); }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--sh-3); }

.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }

/* ── KPI ────────────────────────────────────────────────── */
.kpi-label { font-size: 12px; color: var(--ink-3); font-weight: 600; letter-spacing: .04em; }
.kpi-val { font-size: 30px; font-weight: 800; letter-spacing: -1px; margin-top: 4px; }
.kpi-unit { font-size: 14px; font-weight: 600; color: var(--ink-3); margin-left: 3px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700;
         padding: 2px 7px; border-radius: 5px; }
.delta.up { background: var(--brand-1); color: var(--brand-6); }
.delta.down { background: var(--risk-bg); color: var(--risk-fg); }
.delta.flat { background: var(--bg-2); color: var(--ink-3); }

/* ── 标签 / 徽章 ───────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700; padding: 3px 9px;
  border-radius: 999px; background: var(--bg-2); color: var(--ink-2);
  white-space: nowrap;
}
.tag.brand { background: var(--brand-1); color: var(--brand-6); }
.tag.warn { background: var(--warn-bg); color: var(--warn-fg); }
.tag.risk { background: var(--risk-bg); color: var(--risk-fg); }
.tag.info { background: var(--info-bg); color: var(--info-fg); }
.tag.ghost { background: transparent; border: 1px solid var(--line-2); color: var(--ink-3); }

/* ── 按钮 ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 18px; border-radius: 10px;
  font-size: 14px; font-weight: 700; font-family: inherit;
  border: 1px solid transparent; cursor: pointer;
  transition: all .18s var(--ease); white-space: nowrap;
}
.btn-primary { background: var(--brand-5); color: #fff; box-shadow: 0 2px 8px rgba(21, 122, 84, .24); }
.btn-primary:hover { background: var(--brand-6); transform: translateY(-1px); }
.btn-ghost { background: #fff; border-color: var(--line-2); color: var(--ink-1); }
.btn-ghost:hover { border-color: var(--brand-3); color: var(--brand-5); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ── 表单 ───────────────────────────────────────────────── */
select, input[type=text], input[type=search] {
  font-family: inherit; font-size: 13.5px; color: var(--ink-1);
  padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 9px;
  background: #fff; outline: none; transition: border-color .16s var(--ease);
}
select:focus, input:focus { border-color: var(--brand-4); box-shadow: 0 0 0 3px var(--brand-1); }
label.field { display: block; font-size: 12px; font-weight: 600; color: var(--ink-3); margin-bottom: 5px; }

input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 5px;
  border-radius: 4px; background: var(--bg-2); outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 3px solid var(--brand-4); cursor: pointer;
  box-shadow: 0 2px 6px rgba(14, 34, 48, .18);
}
input[type=range]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 3px solid var(--brand-4); cursor: pointer;
}

/* ── 表格 ───────────────────────────────────────────────── */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--line);
  background: var(--bg); position: sticky; top: 0; white-space: nowrap;
}
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.tbl tbody tr { transition: background .14s var(--ease); }
table.tbl tbody tr:hover { background: var(--brand-1); }
table.tbl td.r, table.tbl th.r { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl tr.clickable { cursor: pointer; }

/* ── 图表通用 ───────────────────────────────────────────── */
svg text { font-family: var(--font); }
.axis-line { stroke: var(--line); stroke-width: 1; }
.grid-line { stroke: var(--bg-2); stroke-width: 1; }
.axis-txt { fill: var(--ink-4); font-size: 11px; }
.bar { transition: opacity .16s var(--ease); }
.bar:hover { opacity: .78; }

/* ── 动效 ───────────────────────────────────────────────── */
.rise { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.rise.in { opacity: 1; transform: none; }
.draw { stroke-dasharray: var(--len, 2000); stroke-dashoffset: var(--len, 2000);
        transition: stroke-dashoffset 1.4s var(--ease); }
.draw.in { stroke-dashoffset: 0; }

@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }
.pulse { animation: pulse 1.1s ease-in-out infinite; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }
.fadein { animation: fadein .3s var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── 页脚 ───────────────────────────────────────────────── */
.foot {
  margin-top: 56px; padding: 22px 0 40px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--ink-4);
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
}
.foot .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-4); }

/* ── 响应式 ─────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .g3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .wrap, .wrap-wide { padding: 0 18px; }
  .h1 { font-size: 30px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
}

@media print {
  body { background: #fff; }
  .topbar, .back, .btn { display: none !important; }
  .card { box-shadow: none; break-inside: avoid; }
}
