/* ==========================================================================
   Qi House · 管理后台样式
   --------------------------------------------------------------------------
   与官网同源：直接复用 ../assets/css/tokens.css 的宣纸 / 砚墨 / 朱砂三色
   与 Didot × Jost × 宋体字族，品牌材质不变。

   差异：官网是杂志式长页排版（大留白、超大序号），后台是密集数据界面。
   因此本文件不加载 main.css，改为收紧间距、引入表格 / 抽屉 / 表单 /
   分页等管理端组件，并保持"发丝线分隔 + 近乎直角 + 朱砂只落关键动作"。

   响应式三档：>=1200 常驻侧栏 / 768–1199 抽屉侧栏 / <768 单列
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. 重置
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--cinnabar);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.sr {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* --------------------------------------------------------------------------
   1. 外壳布局
   -------------------------------------------------------------------------- */
.admin {
  --sidebar-w: 244px;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* ---- 侧边栏 ---- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-3) var(--s-3);
  background: var(--ink-bg);
  color: var(--ink-text);
  border-right: 1px solid var(--ink-rule);
  overflow-y: auto;
  z-index: var(--z-header);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--ink-rule);
}

.sidebar__brand img { height: 17px; width: auto; }

.sidebar__brand small {
  display: block;
  margin-top: 5px;
  font-size: 10px;
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--ink-muted);
}

.sidebar__group {
  padding: 0 var(--s-2);
  font-size: 10px;
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: var(--s-2);
}

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px var(--s-2);
  border-radius: var(--r-2);
  color: var(--ink-muted);
  font-size: var(--fs-sm);
  text-align: left;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}

.nav__item svg { width: 16px; height: 16px; flex: none; }

.nav__item:hover { background: rgba(244, 240, 232, 0.07); color: var(--ink-text); }

.nav__item.is-active {
  background: rgba(244, 240, 232, 0.1);
  color: var(--ink-text);
}

/* 选中项左侧朱砂短划 —— 品牌记忆点 */
.nav__item.is-active::before {
  content: '';
  position: absolute;
  margin-left: -12px;
  width: 2px;
  height: 15px;
  background: var(--cinnabar-lift);
}

.nav__item { position: relative; }

.nav__count {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: rgba(244, 240, 232, 0.12);
  font-size: 11px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.sidebar__foot {
  margin-top: auto;
  padding-top: var(--s-3);
  border-top: 1px solid var(--ink-rule);
  font-size: var(--fs-xs);
  color: var(--ink-muted);
}

.sidebar__foot a { display: block; padding: 6px var(--s-2); border-radius: var(--r-2); }
.sidebar__foot a:hover { background: rgba(244, 240, 232, 0.07); color: var(--ink-text); }

/* ---- 主区 ---- */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 0 var(--gutter);
  height: 60px;
  background: rgba(247, 244, 237, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
  z-index: var(--z-overlay);
}

.topbar__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: var(--ls-tight);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); }

.who {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 10px 5px 5px;
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  max-width: 240px;
}

.who__badge {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  flex: none;
  border-radius: var(--r-pill);
  background: var(--cinnabar);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.who__text { min-width: 0; line-height: 1.2; }
.who__text b { display: block; font-weight: 500; font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who__text small { color: var(--muted); font-size: 11px; }

.menu-btn {
  display: none;
  width: 34px; height: 34px;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: var(--r-2);
  flex: none;
}
.menu-btn svg { width: 17px; height: 17px; }

.content {
  padding: var(--s-4) var(--gutter) var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  min-width: 0;
}

.page-head { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); align-items: flex-end; }
.page-head p { color: var(--muted); font-size: var(--fs-sm); max-width: 62ch; }
.page-head__actions { margin-left: auto; display: flex; gap: var(--s-2); }

/* --------------------------------------------------------------------------
   2. 按钮
   -------------------------------------------------------------------------- */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-bd: var(--rule-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 15px;
  border: 1px solid var(--btn-bd);
  border-radius: var(--r-2);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--fs-xs);
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              opacity var(--dur-fast) var(--ease-out);
}

.btn svg { width: 14px; height: 14px; flex: none; }
.btn:hover { border-color: var(--ink); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:disabled:hover { border-color: var(--btn-bd); }

.btn--primary {
  --btn-bg: var(--cinnabar);
  --btn-fg: #fff;
  --btn-bd: var(--cinnabar);
}
.btn--primary:hover { --btn-bg: var(--cinnabar-deep); --btn-bd: var(--cinnabar-deep); }

.btn--ghost { --btn-bd: transparent; color: var(--muted); }
.btn--ghost:hover { --btn-bd: var(--rule); color: var(--ink); }

.btn--danger { color: var(--cinnabar); --btn-bd: var(--rule); }
.btn--danger:hover { --btn-bg: var(--cinnabar-wash); --btn-bd: var(--cinnabar); }

.btn--sm { padding: 5px 10px; font-size: 12px; }
.btn--block { width: 100%; }

/* --------------------------------------------------------------------------
   3. 卡片
   -------------------------------------------------------------------------- */
.card {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--r-3);
  overflow: hidden;
}

.card--flush { background: transparent; border: none; border-radius: 0; }

.card__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--rule);
}

.card__head h2 {
  font-size: var(--fs-h4);
  font-weight: 500;
  letter-spacing: var(--ls-tight);
}

.card__head .card__actions { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); }
.card__body { padding: var(--s-4); }
.card__foot {
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}

.card__hint { font-size: var(--fs-xs); color: var(--muted); }

/* --------------------------------------------------------------------------
   4. KPI
   -------------------------------------------------------------------------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-3);
}

.kpi {
  position: relative;
  padding: var(--s-4);
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--r-3);
  overflow: hidden;
}

/* 左侧朱砂竖线 —— 与官网引文栏同源的品牌细节 */
.kpi::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--cinnabar);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out);
}
.kpi:hover::before { opacity: 1; }

.kpi__label {
  font-size: 11px;
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--muted);
}

.kpi__value {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3.2vw, 2.5rem);
  line-height: 1.05;
  letter-spacing: var(--ls-display);
  font-variant-numeric: tabular-nums;
}

.kpi__value small { font-size: 0.42em; color: var(--muted); margin-left: 3px; letter-spacing: 0; }

.kpi__foot {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  font-size: var(--fs-xs);
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* --------------------------------------------------------------------------
   5. 表格
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-xs);
}

.table th {
  position: sticky;
  top: 0;
  padding: 10px var(--s-3);
  background: var(--paper-deep);
  border-bottom: 1px solid var(--rule);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  white-space: nowrap;
  z-index: 1;
}

.table td {
  padding: 11px var(--s-3);
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}

.table tbody tr { transition: background var(--dur-fast) var(--ease-out); }
.table tbody tr:hover { background: var(--paper); }
.table tbody tr:last-child td { border-bottom: none; }

.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .col-actions { text-align: right; white-space: nowrap; }
.table .col-actions .btn + .btn { margin-left: 6px; }

.cell-strong { font-weight: 500; }
.cell-sub { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.cell-mono { font-family: var(--font-mono); font-size: 11px; }

.thumb {
  width: 38px; height: 38px;
  flex: none;
  border: 1px solid var(--rule);
  border-radius: var(--r-2);
  object-fit: cover;
  background: var(--paper-deep);
}

.cell-media { display: flex; align-items: center; gap: 10px; min-width: 190px; }

/* --------------------------------------------------------------------------
   6. 标记 / 徽标
   -------------------------------------------------------------------------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-pill);
  font-size: 11px;
  line-height: 1.6;
  white-space: nowrap;
  color: var(--muted);
}

.tag::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.tag--live { color: #2F6B4F; border-color: rgba(47, 107, 79, 0.35); background: rgba(47, 107, 79, 0.06); }
.tag--off { color: var(--muted); }
.tag--wait { color: #8A6A1F; border-color: rgba(138, 106, 31, 0.35); background: rgba(138, 106, 31, 0.06); }
.tag--alert { color: var(--cinnabar); border-color: rgba(176, 58, 42, 0.35); background: var(--cinnabar-wash); }
.tag--plain::before { display: none; }

/* --------------------------------------------------------------------------
   7. 开关
   -------------------------------------------------------------------------- */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }

.switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.switch__track {
  position: relative;
  width: 38px; height: 21px;
  flex: none;
  border-radius: var(--r-pill);
  background: rgba(22, 19, 15, 0.16);
  transition: background var(--dur-fast) var(--ease-out);
}

.switch__track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(52, 40, 26, 0.3);
  transition: transform var(--dur-fast) var(--ease-out);
}

.switch input:checked + .switch__track { background: #2F6B4F; }
.switch input:checked + .switch__track::after { transform: translateX(17px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--cinnabar); outline-offset: 2px; }
.switch input:disabled + .switch__track { opacity: 0.5; }
.switch__label { font-size: var(--fs-xs); color: var(--muted); }

/* --------------------------------------------------------------------------
   8. 表单
   -------------------------------------------------------------------------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3) var(--s-4);
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--wide { grid-column: 1 / -1; }

.field__label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.field__label span { color: var(--cinnabar); margin-left: 2px; }

.input, .select, .textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-2);
  background: #fff;
  font-size: var(--fs-sm);
  transition: border-color var(--dur-fast) var(--ease-out);
}

.input:hover, .select:hover, .textarea:hover { border-color: var(--ink); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--cinnabar); box-shadow: 0 0 0 3px var(--cinnabar-wash); }

.textarea { min-height: 88px; resize: vertical; line-height: 1.6; }
.textarea--tall { min-height: 132px; }

.select {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.field__hint { font-size: 11px; color: var(--muted); }
.field__error { font-size: 11px; color: var(--cinnabar); }

.input[aria-invalid='true'], .textarea[aria-invalid='true'], .select[aria-invalid='true'] {
  border-color: var(--cinnabar);
}

.form-actions {
  display: flex;
  gap: var(--s-2);
  align-items: center;
  padding-top: var(--s-3);
  border-top: 1px solid var(--rule);
  margin-top: var(--s-2);
}
.form-actions .form-actions__spacer { margin-left: auto; }

/* --------------------------------------------------------------------------
   9. 工具栏 / 筛选
   -------------------------------------------------------------------------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}

.toolbar .input, .toolbar .select { width: auto; min-width: 130px; }
.toolbar__search { min-width: 200px; flex: 1 1 200px; max-width: 320px; }
.toolbar__spacer { margin-left: auto; }

.segmented {
  display: inline-flex;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-2);
  overflow: hidden;
}

.segmented button {
  padding: 7px 13px;
  font-size: var(--fs-xs);
  color: var(--muted);
  background: transparent;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.segmented button + button { border-left: 1px solid var(--rule); }
.segmented button:hover { background: var(--paper); color: var(--ink); }
.segmented button.is-active { background: var(--ink); color: var(--paper); }

/* --------------------------------------------------------------------------
   10. 抽屉（表单编辑）
   -------------------------------------------------------------------------- */
.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(620px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-left: 1px solid var(--rule);
  box-shadow: var(--shadow-3);
  z-index: calc(var(--z-overlay) + 10);
  transform: translateX(100%);
  transition: transform var(--dur-base) var(--ease-out);
}

.drawer.is-open { transform: none; }

.drawer__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--rule);
  background: #fff;
}

.drawer__head h2 { font-size: var(--fs-h4); font-weight: 500; }
.drawer__head .btn { margin-left: auto; }

.drawer__body { flex: 1; overflow-y: auto; padding: var(--s-4); }

.drawer__foot {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--rule);
  background: #fff;
}

.drawer__foot .spacer { margin-left: auto; }

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(20, 17, 13, 0.44);
  backdrop-filter: blur(2px);
  z-index: var(--z-overlay);
  opacity: 0;
  /* 兜底：只有真正展开时才接收点击。遮罩靠 hidden 属性显隐，
     万一某条路径漏了 hidden=true，这里能保证它不会吃掉整页点击。 */
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out);
}

.scrim.is-open { opacity: 1; pointer-events: auto; }

/* --------------------------------------------------------------------------
   11. Toast
   -------------------------------------------------------------------------- */
.toasts {
  position: fixed;
  bottom: var(--s-4);
  right: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 240px;
  max-width: 360px;
  padding: 11px 14px;
  border-radius: var(--r-2);
  background: var(--ink-bg);
  color: var(--ink-text);
  font-size: var(--fs-xs);
  line-height: 1.5;
  box-shadow: var(--shadow-2);
  pointer-events: auto;
  animation: toast-in var(--dur-base) var(--ease-out);
}

.toast::before {
  content: '';
  width: 3px;
  align-self: stretch;
  flex: none;
  border-radius: var(--r-pill);
  background: var(--cinnabar-lift);
}

.toast--ok::before { background: #6FBF95; }
.toast--warn::before { background: #E0B75C; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   12. 分页 / 空态 / 载入
   -------------------------------------------------------------------------- */
.pager {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.pager__info { font-size: var(--fs-xs); color: var(--muted); margin-right: auto; }
.pager__pages { display: flex; gap: 4px; }

.pager__pages button {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--rule);
  border-radius: var(--r-2);
  font-size: var(--fs-xs);
  color: var(--muted);
  transition: all var(--dur-fast) var(--ease-out);
}

.pager__pages button:hover:not(:disabled) { border-color: var(--ink); color: var(--ink); }
.pager__pages button.is-active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.pager__pages button:disabled { opacity: 0.35; cursor: not-allowed; }

.empty {
  padding: var(--s-6) var(--s-4);
  text-align: center;
  color: var(--muted);
}

.empty__mark {
  font-family: var(--font-display);
  font-size: 2.5rem;
  color: var(--faint);
  letter-spacing: var(--ls-display);
  margin-bottom: var(--s-2);
}

.empty p { font-size: var(--fs-sm); }
.empty small { display: block; margin-top: 6px; font-size: var(--fs-xs); color: var(--faint); }

.skeleton {
  height: 13px;
  border-radius: var(--r-1);
  background: linear-gradient(90deg, var(--paper-deep) 25%, var(--paper-warm) 37%, var(--paper-deep) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}

.spinner {
  width: 15px; height: 15px;
  border: 2px solid var(--rule-strong);
  border-top-color: var(--cinnabar);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--s-5) var(--s-4);
  color: var(--muted);
  font-size: var(--fs-xs);
}

/* --------------------------------------------------------------------------
   13. 登录门
   -------------------------------------------------------------------------- */
.gate {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
}

.gate__brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--s-6) var(--gutter);
  background: var(--ink-bg);
  color: var(--ink-text);
  overflow: hidden;
}

.gate__brand img { height: 26px; width: auto; }

.gate__quote {
  position: relative;
  max-width: 30ch;
}

.gate__quote p {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.4vw, 2.6rem);
  line-height: 1.25;
  letter-spacing: var(--ls-display);
}

.gate__quote small {
  display: block;
  margin-top: var(--s-3);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* 朱砂印章 —— 官网记忆点 */
.gate__seal {
  position: absolute;
  right: var(--gutter);
  bottom: var(--s-6);
  display: grid;
  place-items: center;
  width: 74px; height: 74px;
  border: 1px solid rgba(210, 112, 94, 0.5);
  border-radius: var(--r-2);
  color: var(--cinnabar-lift);
  font-family: var(--font-display);
  font-size: 2rem;
}

.gate__panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--s-4);
  padding: var(--s-6) var(--gutter);
  background: var(--paper);
}

.gate__panel h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2.6vw, 2.1rem);
  letter-spacing: var(--ls-display);
}

.gate__panel > header p { color: var(--muted); font-size: var(--fs-sm); margin-top: 8px; }

.gate__forms { display: flex; flex-direction: column; gap: var(--s-3); }
.gate__forms .field { gap: 7px; }

.gate__tabs {
  display: flex;
  gap: var(--s-3);
  border-bottom: 1px solid var(--rule);
}

.gate__tabs button {
  padding: 0 0 9px;
  font-size: var(--fs-xs);
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.gate__tabs button:hover { color: var(--ink); }
.gate__tabs button.is-active { color: var(--ink); border-bottom-color: var(--cinnabar); }

.gate__note {
  padding: var(--s-3);
  border: 1px solid var(--rule);
  border-radius: var(--r-2);
  background: var(--paper-deep);
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.6;
}

.gate__error {
  padding: 10px 13px;
  border-left: 3px solid var(--cinnabar);
  background: var(--cinnabar-wash);
  color: var(--cinnabar-deep);
  font-size: var(--fs-xs);
  border-radius: var(--r-1);
}

.gate__denied {
  max-width: 46ch;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.gate__denied code {
  display: inline-block;
  padding: 3px 7px;
  border-radius: var(--r-1);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  word-break: break-all;
}

.gate__resend {
  font-size: var(--fs-xs);
  color: var(--muted);
}
.gate__resend button { color: var(--cinnabar); text-decoration: underline; }

/* --------------------------------------------------------------------------
   14. 看板专用
   -------------------------------------------------------------------------- */
.board {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: var(--s-3);
  align-items: start;
}

.bars { display: flex; flex-direction: column; gap: 11px; }

.bar-row { display: grid; grid-template-columns: 128px minmax(0, 1fr) 62px; gap: var(--s-3); align-items: center; }
.bar-row__label { font-size: var(--fs-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row__track { height: 7px; border-radius: var(--r-pill); background: var(--paper-deep); overflow: hidden; }
.bar-row__fill {
  /* 必须显式 block：行内元素上的 height/width 不生效，曾导致填充条整条不可见 */
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--cinnabar);
  transition: width var(--dur-slow) var(--ease-out);
}
.bar-row__value { font-size: var(--fs-xs); text-align: right; font-variant-numeric: tabular-nums; }

.rank-list { display: flex; flex-direction: column; }

.rank-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 11px 0;
  border-bottom: 1px solid var(--rule);
}

.rank-item:last-child { border-bottom: none; }

.rank-item__no {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--faint);
  width: 26px;
  flex: none;
}

.rank-item__main { min-width: 0; flex: 1; }
.rank-item__main b { display: block; font-weight: 500; font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-item__main small { color: var(--muted); font-size: 11px; }

.timeline { display: flex; flex-direction: column; }

.tl-item {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  gap: var(--s-3);
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-size: var(--fs-xs);
  align-items: baseline;
}

.tl-item:last-child { border-bottom: none; }
.tl-item__time { color: var(--faint); font-variant-numeric: tabular-nums; }
.tl-item__main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-item__tag { color: var(--muted); white-space: nowrap; }

/* --------------------------------------------------------------------------
   15. 图片上传
   -------------------------------------------------------------------------- */
.uploader { display: flex; gap: var(--s-3); align-items: flex-start; }

.uploader__preview {
  width: 108px; height: 108px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px dashed var(--rule-strong);
  border-radius: var(--r-2);
  background: var(--paper-deep);
  overflow: hidden;
  color: var(--faint);
  font-size: 11px;
  text-align: center;
}

.uploader__preview img { width: 100%; height: 100%; object-fit: cover; }

.uploader__side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }

/* 拖拽经过时高亮 —— 放在 .uploader 上，由 JS 加类 */
.uploader.is-drag .uploader__preview { border-color: var(--cinnabar); background: var(--cinnabar-wash); }

/* --------------------------------------------------------------------------
   15b. 批量导入
   -------------------------------------------------------------------------- */

/* 文件投递区：与 .uploader 同样是"虚线框 + 拖入高亮"的语言，只是尺寸不同 */
.dropzone {
  display: grid;
  place-items: center;
  gap: var(--s-3);
  padding: var(--s-6) var(--s-4);
  text-align: center;
  border: 1px dashed var(--rule-strong);
  border-radius: var(--r-3);
  background: var(--paper-deep);
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}
.dropzone.is-drag { border-color: var(--cinnabar); background: var(--cinnabar-wash); }
.dropzone__mark { color: var(--faint); }

/* 报告页脚与抽屉页脚一样需要把次要信息推到右侧 */
.card__foot .spacer { margin-left: auto; }

/* --------------------------------------------------------------------------
   16. 响应式
   -------------------------------------------------------------------------- */

/* 中等屏：侧栏收成抽屉 */
@media (max-width: 1199px) {
  .admin { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 264px;
    transform: translateX(-100%);
    transition: transform var(--dur-base) var(--ease-out);
  }

  .sidebar.is-open { transform: none; }

  .menu-btn { display: grid; }

  .board { grid-template-columns: minmax(0, 1fr); }
}

/* 窄屏 */
@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .gate { grid-template-columns: minmax(0, 1fr); }
  .gate__brand { display: none; }

  .form-grid { grid-template-columns: minmax(0, 1fr); }
}

/* 手机 */
@media (max-width: 640px) {
  .topbar { height: 56px; gap: var(--s-2); }
  .who { padding: 4px; }
  .who__text { display: none; }
  .content { padding: var(--s-3) var(--s-3) var(--s-5); gap: var(--s-3); }

  .kpis { grid-template-columns: minmax(0, 1fr); }
  .kpi { padding: var(--s-3); }

  .card__head, .card__body, .card__foot { padding-left: var(--s-3); padding-right: var(--s-3); }

  .drawer { width: 100%; border-left: none; }
  .drawer__body { padding: var(--s-3); }

  .page-head__actions { margin-left: 0; width: 100%; }
  .page-head__actions .btn { flex: 1; }

  .toasts { left: var(--s-3); right: var(--s-3); bottom: var(--s-3); }
  .toast { max-width: none; width: 100%; }

  .bar-row { grid-template-columns: 92px minmax(0, 1fr) 52px; gap: var(--s-2); }
  .tl-item { grid-template-columns: 62px minmax(0, 1fr); }
  .tl-item__tag { grid-column: 2; }
}

/* --------------------------------------------------------------------------
   17. 智能填充（商品表单）
   -------------------------------------------------------------------------- */
.smartfill {
  margin-bottom: var(--s-4);
  padding: var(--s-3);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--cinnabar);
  border-radius: var(--r-2);
  background: var(--cinnabar-wash);
}

.smartfill__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
}

.smartfill__title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--cinnabar-deep);
}

.smartfill__sub { font-size: var(--fs-xs); color: var(--muted); }

.smartfill__text {
  min-height: 132px;
  background: var(--paper);
  font-size: var(--fs-xs);
  line-height: 1.7;
}

.smartfill__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-2);
}

.smartfill__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--muted);
  cursor: pointer;
}

.smartfill__toggle input { accent-color: var(--cinnabar); }

.smartfill__report {
  margin-top: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px dashed var(--rule);
  font-size: var(--fs-xs);
  color: var(--ink-soft);
}

.sf-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}

.sf-line--miss { color: var(--muted); }
.sf-line--done { color: var(--muted); }

.sf-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }

.sf-chip {
  display: inline-block;
  padding: 1px 7px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-pill);
  background: var(--paper);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.sf-notes {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.sf-notes li { margin-bottom: 4px; line-height: 1.6; }

/* 识别写入的控件短暂高亮 —— 让运营一眼看到哪几个框被改了 */
.input.is-filled,
.select.is-filled,
.textarea.is-filled {
  border-color: var(--cinnabar);
  background: var(--cinnabar-wash);
  transition: background var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out);
}

/* --------------------------------------------------------------------------
   18. 动效降级
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
