/* ============================================================
   GEO-CMS 基础层：reset + typography + primitives
   所有类均使用 token，不出现硬编码尺寸
   ============================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + var(--sp-4));
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-relaxed);
  color: var(--c-ink-800);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg, video { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: none; padding: 0; cursor: pointer; }
table { border-collapse: collapse; width: 100%; }
ul, ol { list-style: none; padding: 0; }
a { color: var(--c-brand-600); text-decoration: none; transition: color var(--dur-fast) var(--ease-out); }
a:hover { color: var(--c-brand-700); }
:focus-visible { outline: 2px solid var(--c-brand-500); outline-offset: 2px; border-radius: var(--r-xs); }

::selection { background: var(--c-brand-100); color: var(--c-brand-900); }

/* ---------- 排版 ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--c-ink-900);
  letter-spacing: var(--ls-wide);
}
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

.serif { font-family: var(--font-serif); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* 数字用等宽数字，价格/规格对齐更整齐 */
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- 布局工具 ---------- */
.container {
  width: 100%;
  max-width: var(--layout-max);
  margin-inline: auto;
  padding-inline: var(--layout-gutter);
}
.container--prose { max-width: calc(var(--layout-prose) + var(--layout-gutter) * 2); }

.stack > * + * { margin-top: var(--sp-4); }
.stack-lg > * + * { margin-top: var(--sp-7); }
/* 关键：作为 grid/flex 子项时必须 min-width:0，
   否则子项默认 min-width:auto，内容（如长英文名）会撑破容器造成整页横向溢出。
   这不是理论问题——后台「企业信息」页 390px 下实测 scrollW 537。 */
.stack, .stack-lg, .editor-grid > *, .admin-content > * { min-width: 0; }
.row { display: flex; align-items: center; gap: var(--sp-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

/* ---------- 文本工具 ---------- */
.t-xs { font-size: var(--fs-xs); }
.t-sm { font-size: var(--fs-sm); }
.t-md { font-size: var(--fs-md); }
.t-lg { font-size: var(--fs-lg); }
.t-muted { color: var(--c-ink-500); }
.t-subtle { color: var(--c-ink-400); }
.t-fw-med { font-weight: var(--fw-medium); }
.t-fw-sb { font-weight: var(--fw-semibold); }
.t-lh-normal { line-height: var(--lh-normal); }
.t-accent { color: var(--c-brand-600); }
.t-gold { color: var(--c-gold-700); }

.eyebrow {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--c-brand-500);
}

/* 正文内容：限制行长，中文可读性 */
.prose { line-height: var(--lh-relaxed); }
.prose > * + * { margin-top: var(--sp-4); }
.prose h2 { margin-top: var(--sp-8); }
.prose h3 { margin-top: var(--sp-6); }
.prose ul { list-style: disc; padding-left: var(--sp-5); }
.prose ul li + li { margin-top: var(--sp-2); }

/* ---------- 按钮 ----------
   高度由 token 严格规定，禁止自定义高度 */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2);
  height: var(--ctl-h-lg);
  padding-inline: var(--ctl-px-lg);
  font-size: var(--ctl-font);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-normal);
  border-radius: var(--ctl-radius);
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
  user-select: none;
}
.btn:active { transform: translateY(.5px); }
.btn:focus-visible { outline: none; box-shadow: var(--sh-focus); }
.btn[disabled], .btn[aria-disabled="true"] {
  opacity: .5; cursor: not-allowed; transform: none; pointer-events: none;
}

.btn--primary { background: var(--c-brand-700); color: #fff; box-shadow: var(--sh-xs); }
.btn--primary:hover { background: var(--c-brand-600); box-shadow: var(--sh-sm); }

.btn--secondary { background: var(--c-bg-elevated); color: var(--c-ink-800); border-color: var(--c-border-strong); }
.btn--secondary:hover { border-color: var(--c-brand-400); color: var(--c-brand-700); background: var(--c-brand-050); }

.btn--ghost { background: transparent; color: var(--c-ink-600); }
.btn--ghost:hover { background: var(--c-ink-050); color: var(--c-ink-900); }

.btn--danger { background: var(--c-danger-600); color: #fff; }
.btn--danger:hover { background: #8E2220; }

/* 金色按钮：底色必须用 gold-700（白字 5.02:1，WCAG AA 达标）。
   实测 gold-600 只有 3.45:1，不合格——不要为了「更亮更好看」退回 600。 */
.btn--gold { background: var(--c-gold-700); color: #fff; }
.btn--gold:hover { background: #75591F; }

/* 尺寸变体 */
.btn--sm { height: var(--ctl-h-sm); padding-inline: var(--ctl-px-sm); font-size: var(--fs-xs); }
.btn--xs { height: var(--ctl-h-xs); padding-inline: var(--ctl-px-xs); font-size: var(--fs-2xs); gap: var(--sp-1); }
.btn--lg { height: var(--ctl-h-xl); padding-inline: var(--ctl-px-xl); font-size: var(--fs-md); }
.btn--block { width: 100%; }

/* ---------- 表单 ----------
   标签在上，输入在下，符合国内表单习惯（英文习惯是左标签） */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field__label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--c-ink-700);
  display: flex; align-items: center; gap: var(--sp-1);
}
.field__label .req { color: var(--c-danger-600); }
.field__hint { font-size: var(--fs-2xs); color: var(--c-ink-400); line-height: var(--lh-normal); }
.field__error { font-size: var(--fs-2xs); color: var(--c-danger-600); }

.input, .textarea, .select {
  width: 100%;
  height: var(--ctl-h-md);
  padding-inline: var(--ctl-px-md);
  font-size: var(--ctl-font);
  color: var(--c-ink-900);
  background: var(--c-bg-elevated);
  border: var(--ctl-border);
  border-radius: var(--ctl-radius);
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.textarea { height: auto; min-height: calc(var(--ctl-h-md) * 2.6); padding-block: var(--sp-2); line-height: var(--lh-normal); resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--c-ink-300); }
.input:hover, .textarea:hover, .select:hover { border-color: var(--c-brand-300); }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--c-brand-500); box-shadow: var(--sh-focus);
}
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--c-danger-600); }
.input:disabled, .textarea:disabled, .select:disabled {
  background: var(--c-ink-050); color: var(--c-ink-400); cursor: not-allowed;
}
.select {
  appearance: none;
  padding-right: calc(var(--ctl-px-md) + 20px);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%235F7168' stroke-width='1.6' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--ctl-px-sm) center;
  cursor: pointer;
}
.input--sm { height: var(--ctl-h-sm); font-size: var(--fs-xs); }

/* 复选/单选：原生 input 视觉隐藏，用 label 承载全部命中区 */
.check { display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; min-height: var(--tap-min); font-size: var(--ctl-font); }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check__box {
  width: 18px; height: 18px; flex: none;
  border: 1.5px solid var(--c-border-strong);
  border-radius: var(--r-xs);
  background: var(--c-bg-elevated);
  display: grid; place-items: center;
  transition: all var(--dur-fast) var(--ease-out);
}
.check__box::after {
  content: ""; width: 10px; height: 10px;
  background: #fff;
  clip-path: polygon(14% 47%, 0 60%, 39% 100%, 100% 22%, 84% 8%, 37% 68%);
  transform: scale(0);
  transition: transform var(--dur-fast) var(--ease-out);
}
.check input:checked + .check__box { background: var(--c-brand-600); border-color: var(--c-brand-600); }
.check input:checked + .check__box::after { transform: scale(1); }
.check input:focus-visible + .check__box { box-shadow: var(--sh-focus); }
.check--radio .check__box { border-radius: 50%; }
.check--radio .check__box::after {
  clip-path: none; width: 8px; height: 8px; border-radius: 50%;
}

/* 开关 */
.switch { display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; min-height: var(--tap-min); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  width: 40px; height: 22px; flex: none;
  background: var(--c-ink-200);
  border-radius: var(--r-pill);
  padding: 2px;
  transition: background var(--dur-base) var(--ease-out);
}
.switch__thumb {
  width: 18px; height: 18px;
  background: #fff; border-radius: 50%;
  box-shadow: var(--sh-xs);
  transition: transform var(--dur-base) var(--ease-out);
}
.switch input:checked + .switch__track { background: var(--c-brand-600); }
.switch input:checked + .switch__track .switch__thumb { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { box-shadow: var(--sh-focus); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--c-bg-elevated);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
  transition: box-shadow var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out),
              transform var(--dur-base) var(--ease-out);
}
.card--pad { padding: var(--sp-6); }
.card--pad-sm { padding: var(--sp-4); }
.card--hover:hover { box-shadow: var(--sh-md); border-color: var(--c-border-brand); transform: translateY(-2px); }
.card__head {
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  min-height: var(--ctl-h-xl);
}
.card__title { font-family: var(--font-serif); font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--c-ink-900); }
.card__body { padding: var(--sp-6); }
.card__foot { padding: var(--sp-4) var(--sp-6); border-top: 1px solid var(--c-border); background: var(--c-ink-050); border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  height: 22px; padding-inline: var(--sp-2);
  font-size: var(--fs-2xs); font-weight: var(--fw-semibold);
  border-radius: var(--r-xs);
  background: var(--c-ink-100); color: var(--c-ink-700);
  white-space: nowrap;
}
.badge--brand { background: var(--c-brand-050); color: var(--c-brand-700); }
.badge--gold { background: var(--c-gold-050); color: var(--c-gold-700); }
.badge--success { background: var(--c-success-050); color: var(--c-success-600); }
.badge--warn { background: var(--c-warn-050); color: var(--c-warn-600); }
.badge--danger { background: var(--c-danger-050); color: var(--c-danger-600); }
.badge--info { background: var(--c-info-050); color: var(--c-info-600); }
.badge--dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--c-border); background: var(--c-bg-elevated); }
.table { font-size: var(--fs-sm); }
.table thead th {
  background: var(--c-bg-sunken);
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--c-ink-600);
  white-space: nowrap;
  border-bottom: 1px solid var(--c-border);
}
.table tbody td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--c-ink-050);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--dur-fast) var(--ease-out); }
.table tbody tr:hover { background: var(--c-brand-050); }
.table--num td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 提示条 ---------- */
.notice {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-4);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  border: 1px solid transparent;
}
.notice--info { background: var(--c-info-050); color: var(--c-info-600); border-color: rgba(31,95,139,.18); }
.notice--success { background: var(--c-success-050); color: var(--c-success-600); border-color: rgba(30,122,77,.18); }
.notice--warn { background: var(--c-warn-050); color: var(--c-warn-600); border-color: rgba(154,106,22,.20); }
.notice--danger { background: var(--c-danger-050); color: var(--c-danger-600); border-color: rgba(168,42,40,.18); }
.notice__icon { flex: none; font-size: var(--fs-md); line-height: 1.4; }

/* ---------- 分隔 ---------- */
.divider { height: 1px; background: var(--c-border); border: none; }
.divider--v { width: 1px; height: var(--sp-5); background: var(--c-border); }

/* ---------- 无障碍隐藏 ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; top: -100px; left: var(--sp-4);
  z-index: var(--z-tooltip);
  background: var(--c-brand-700); color: #fff;
  padding: var(--sp-2) var(--sp-4); border-radius: var(--r-sm);
  transition: top var(--dur-base) var(--ease-out);
}
.skip-link:focus { top: var(--sp-2); color: #fff; }