/* ============================================================
   DYE ARCHIVE · 设计系统
   主色：白 ｜ 副色：深空灰（Space Gray）
   大标题：粗宋 ｜ 其余：黑体（放大，便于浏览）
   小圆角 · 单层边框 · 克制阴影
   ============================================================ */

:root {
  --background: #FFFFFF;
  --foreground: #18181B;         /* 正文深灰 */
  --space: #29292D;              /* 深空灰 · 副色 */
  --space-hover: #202023;
  --space-soft: #52525B;
  --muted-foreground: #6B6B73;
  --border: #E4E4E7;
  --secondary: #F5F5F6;
  --accent: #F3F3F4;
  --item-surface: #F8F8FA;
  --item-surface-hover: #F6F6F8;
  --item-border: #ECECEF;
  --destructive: #E5484D;

  --primary: var(--space);
  --primary-foreground: #FFFFFF;
  --ring: var(--space);

  --radius: 6px;
  --radius-sm: 4px;
  --radius-lg: 8px;

  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "HarmonyOS Sans SC", sans-serif;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;

  --bar-h: 54px;
  --maxw: 1240px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.08), 0 2px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 30px -6px rgba(0, 0, 0, 0.12);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

::selection { background: var(--space); color: #fff; }

.tabular {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

/* ---------------- 顶部品牌条（深空灰） ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--bar-h);
  background: var(--space);
  color: #fff;
  border-bottom: 1px solid #1F1F22;
}
.topbar__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar__brand {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #fff;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar__brand .mark {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
}
.topbar__brand .rule { color: #6B6B71; }
.topbar__right {
  font-size: 12px;
  color: #B9B9BE;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar a { color: inherit; text-decoration: none; }
.topbar a:hover { color: #fff; }

/* ---------------- 布局 ---------------- */
.shell {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.page-head {
  padding: 72px 0 42px;
  border-bottom: 1px solid var(--border);
}
.page-head__title {
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(48px, 5.1vw, 68px);
  line-height: 1.08;
  letter-spacing: 0.015em;
}
.page-head__sub {
  margin-top: 20px;
  max-width: 760px;
  font-size: 17px;
  line-height: 1.75;
  font-weight: 500;
  color: var(--foreground);
}

/* ---------------- 记录码工具 ---------------- */
.record-tools {
  display: grid;
  grid-template-columns: auto minmax(320px, 620px);
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  max-width: 860px;
}
.record-tools__generate { height: 40px; }
.record-tools__apply {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.record-tools__apply input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--foreground);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.record-tools__apply input:focus {
  border-color: var(--space);
  box-shadow: 0 0 0 3px rgba(44, 44, 46, 0.1);
}
.record-tools__apply input[aria-invalid="true"] {
  border-color: var(--destructive);
}
.record-tools__apply .btn { height: 40px; }
.record-tools__status {
  grid-column: 1 / -1;
  min-height: 20px;
  color: var(--muted-foreground);
  font-size: 12px;
}
.record-tools__status.is-error { color: var(--destructive); }

/* ---------------- 分类 Tabs ---------------- */
.catnav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding-top: 16px;
  border-bottom: 1px solid var(--border);
}
.catnav button {
  appearance: none;
  background: none;
  border: none;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted-foreground);
  position: relative;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s;
}
.catnav button:hover { color: var(--foreground); }
.catnav button[aria-selected="true"] {
  color: var(--foreground);
  border-bottom-color: var(--space);
}
.catnav__count {
  font-size: 12px;
  color: var(--muted-foreground);
  margin-left: 5px;
  font-variant-numeric: tabular-nums;
}

/* ---------------- 分区标题 ---------------- */
.section { padding: 42px 0 8px; }
.section__head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.section__zh {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--foreground);
}
.section__en {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.section__meta {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}

/* ---------------- 道具网格 ---------------- */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ---------------- 道具条目（淡冷灰底、小圆角、无阴影） ---------------- */
.entry {
  padding: 24px;
  background: var(--item-surface);
  border: 1px solid var(--item-border);
  border-radius: var(--radius);
  opacity: 0;
  transform: translateY(8px);
  transition: background-color 0.18s ease, border-color 0.18s ease;
  animation: rise 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

.entry:hover {
  background: var(--item-surface-hover);
  border-color: #DEDEE2;
}

.entry__top {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

.icon-wrap {
  position: relative;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
}
.entry__icon {
  width: 52px;
  height: 52px;
  object-fit: cover;
  background: var(--secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.entry__identity { flex: 1 1 auto; min-width: 0; }
.entry__name {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--foreground);
}
.entry__sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  gap: 6px;
}
.entry__sub .dot { color: var(--border); }
.entry__max {
  margin-top: 7px;
  font-size: 12px;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}

.entry__field { flex: 0 0 auto; width: 160px; }
.entry__field label {
  display: block;
  font-size: 12px;
  color: var(--muted-foreground);
  margin-bottom: 6px;
}
.field { position: relative; }
.field input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border);
  background: var(--card, #fff);
  border-radius: var(--radius);
  padding: 0 32px 0 12px;
  font-size: 17px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  color: var(--foreground);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus {
  border-color: var(--space);
  box-shadow: 0 0 0 3px rgba(44, 44, 46, 0.1);
}
.field input::placeholder { color: #A1A1AA; font-weight: 400; }
.field .suffix {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--muted-foreground);
  pointer-events: none;
}

/* ---------------- 次要指标（弱化） ---------------- */
.entry__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted-foreground);
}
.entry__meta .m-item { display: inline-flex; gap: 6px; align-items: baseline; }
.entry__meta .m-item b {
  font-weight: 600;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}
.entry__meta .m-label { color: var(--muted-foreground); }

/* ---------------- 「还差」强调区 ---------------- */
.entry__remain {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.remain__label {
  font-size: 13px;
  color: var(--muted-foreground);
}
.remain__value {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--space);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.remain__value.zh { font-size: 28px; font-weight: 700; }

.entry__status { margin-bottom: 12px; }

/* ---------------- 进度条 ---------------- */
.progress { flex: 1 1 auto; min-width: 150px; padding-bottom: 5px; }
.progress__track {
  height: 7px;
  background: var(--secondary);
  border-radius: 999px;
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  width: 0;
  background: var(--space);
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.3, 0.7, 0.2, 1);
}
.progress__meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--space-soft);
  font-variant-numeric: tabular-nums;
}
.progress__meta .pct {
  font-weight: 600;
  color: var(--foreground);
}

/* ---------------- 徽章 ---------------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--space);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  line-height: 1.6;
}
.tag--ghost {
  background: transparent;
  color: var(--muted-foreground);
  border: 1px solid var(--border);
}
.tag[hidden] { display: none; }
.entry__status[hidden] { display: none; }

/* ---------------- 展开档位表 ---------------- */
.entry__toggle {
  margin-top: 16px;
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--space-soft);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s;
}
.entry__toggle:hover { color: var(--foreground); }
.entry__toggle .arrow { transition: transform 0.2s; font-size: 10px; }
.entry.open .entry__toggle .arrow { transform: rotate(180deg); }

.tier-panel {
  display: none;
  margin-top: 18px;
}
.entry.open .tier-panel { display: block; animation: fade 0.25s ease; }
.tier-panel__title {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-bottom: 10px;
}

/* 表格（shadcn Table） */
.ttable { width: 100%; border-collapse: collapse; font-size: 14px; }
.ttable th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}
.ttable th.num { text-align: right; }
.ttable td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--secondary);
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}
.ttable td.num { text-align: right; }
.ttable td.tier-no { color: var(--muted-foreground); }
.ttable tr.current td { background: var(--secondary); }
.ttable tr.current td:first-child { box-shadow: inset 2px 0 0 var(--space); }
.ttable tr.next td { color: var(--muted-foreground); }
.ttable .marker {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--space);
  border-radius: 999px;
  margin-right: 7px;
  vertical-align: 1px;
}
.ttable__wrap { max-height: 300px; overflow: auto; -webkit-overflow-scrolling: touch; }

/* ---------------- 悬浮面板（popover） ---------------- */
.tooltip {
  position: absolute;
  left: 100%;
  top: 0;
  margin-left: 12px;
  z-index: 30;
  width: 260px;
  background: #fff;
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 16px 18px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  pointer-events: none;
}
.icon-wrap:hover .tooltip,
.icon-wrap:focus-within .tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.tooltip__name { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.tooltip__type { font-size: 12px; color: var(--muted-foreground); margin-bottom: 8px; }
.tooltip__desc { font-size: 13px; color: var(--muted-foreground); line-height: 1.6; margin-bottom: 10px; }
.tooltip__divider { height: 1px; background: var(--border); margin-bottom: 8px; }
.tooltip__row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted-foreground);
}
.tooltip__row b { color: var(--foreground); font-weight: 600; }

/* ---------------- 页脚 ---------------- */
.footer {
  margin-top: 52px;
  padding: 30px 0 60px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.footer__note { font-size: 13px; color: var(--muted-foreground); }
.footer__actions { display: flex; gap: 22px; }
.footer__actions button {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  color: var(--muted-foreground);
  transition: color 0.15s;
}
.footer__actions button:hover { color: var(--foreground); }
.footer__actions a {
  font-size: 13px;
  color: var(--muted-foreground);
  text-decoration: none;
}
.footer__actions a:hover { color: var(--foreground); }

/* ---------------- 空状态 ---------------- */
.empty {
  padding: 56px 0;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 14px;
}

/* ---------------- 动画 ---------------- */
@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.fade-out {
  opacity: 0 !important;
  filter: blur(2px);
  transition: opacity 0.18s ease, filter 0.18s ease;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 960px) {
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .shell, .topbar__inner { padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 640px) {
  .topbar__right { display: none; }
  .topbar__brand > span:last-child { display: none; }
  .page-head { padding: 46px 0 30px; }
  .page-head__title { font-size: clamp(38px, 12vw, 48px); }
  .page-head__sub { margin-top: 16px; font-size: 15px; line-height: 1.7; }
  .record-tools { grid-template-columns: 1fr; margin-top: 20px; }
  .record-tools__generate { width: 100%; }
  .record-tools__apply { grid-template-columns: minmax(0, 1fr) auto; }
  .record-tools__status { grid-column: 1; }
  .catnav { padding-top: 10px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .catnav::-webkit-scrollbar { display: none; }
  .catnav button { flex: 0 0 auto; }
  .entry { padding: 20px 16px; }
  .entry__top { flex-wrap: wrap; }
  .entry__field { width: 100%; order: 3; }
  .entry__remain { flex-direction: column; align-items: stretch; }
  .remain__value { font-size: 38px; }
  .progress { min-width: 0; }
  .tooltip { display: none; }
  .footer { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* shadcn 式中性焦点，不使用蓝紫色光晕 */
:where(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

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

/* ============================================================
   组件（shadcn 风格）
   ============================================================ */

/* 按钮 */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--space);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--space-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--outline,
.btn--ghost {
  background: #fff;
  border-color: var(--border);
  color: var(--foreground);
}
.btn--ghost { border-color: transparent; }
.btn--ghost:hover { background: var(--accent); }
.btn--outline:hover { background: var(--accent); }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn--danger {
  background: #fff;
  border-color: var(--border);
  color: var(--destructive);
}
.btn--danger:hover { background: var(--destructive); border-color: var(--destructive); color: #fff; }

/* 输入控件 */
.form-field { margin-bottom: 18px; }
.form-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 7px;
}
.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius);
  padding: 0 12px;
  font-size: 14px;
  color: var(--foreground);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-field textarea { height: auto; min-height: 92px; padding: 9px 12px; resize: vertical; }
.form-field select { appearance: auto; }
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  border-color: var(--space);
  box-shadow: 0 0 0 3px rgba(44, 44, 46, 0.1);
}
.form-field .help { font-size: 12px; color: var(--muted-foreground); margin-top: 5px; }
.form-error {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #DC2626;
  font-size: 13px;
  padding: 9px 12px;
  border-radius: var(--radius);
  margin-bottom: 14px;
}
.form-success {
  background: var(--secondary);
  border: 1px solid var(--border);
  color: var(--foreground);
  font-size: 13px;
  padding: 9px 12px;
  border-radius: var(--radius);
  margin-bottom: 14px;
}

/* ============================================================
   后台
   ============================================================ */
.admin-body { background: var(--background); }
.admin-shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px 100px;
}
.admin-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 44px 0 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.admin-head h1 {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 34px;
  letter-spacing: 0;
}
.admin-head .sub { font-size: 13px; color: var(--muted-foreground); margin-top: 6px; }

.admin-nav {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}
.admin-nav button {
  appearance: none;
  background: none;
  border: none;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted-foreground);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  position: relative;
  transition: color 0.15s;
}
.admin-nav button:hover { color: var(--foreground); }
.admin-nav button[aria-selected="true"] {
  color: var(--foreground);
  border-bottom-color: var(--space);
}

.hint-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--secondary);
  font-size: 13px;
  color: var(--muted-foreground);
  margin-bottom: 14px;
}
.hint-bar .lead {
  font-size: 12px;
  font-weight: 600;
  color: var(--foreground);
  white-space: nowrap;
}

/* 列表 */
.list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list__group { margin: 0; }
.group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--secondary);
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
}
.group-head span {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted-foreground);
}
.list__row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  transition: background 0.12s;
}
.list__row:last-child { border-bottom: none; }
.list__row:hover { background: var(--secondary); }
.list__row.dragging { opacity: 0.5; }
.list__grip { color: var(--muted-foreground); cursor: grab; font-size: 15px; user-select: none; }
.list__thumb {
  width: 38px; height: 38px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex: 0 0 auto;
}
.list__main { flex: 1 1 auto; min-width: 0; }
.list__name { font-weight: 500; font-size: 14px; }
.list__name small { font-weight: 400; color: var(--muted-foreground); margin-left: 6px; font-size: 12px; }
.list__meta { font-size: 12px; color: var(--muted-foreground); margin-top: 2px; }
.list__actions { display: flex; gap: 6px; flex: 0 0 auto; }
.badge {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
  border: 1px solid var(--border);
  padding: 2px 9px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.badge--off { color: var(--destructive); border-color: #FECACA; background: #FEF2F2; }

/* 弹层（Dialog） */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 90;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.modal {
  background: #fff;
  width: 100%;
  max-width: 620px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 26px;
  transform: translateY(8px);
  transition: transform 0.2s;
}
.overlay.show .modal { transform: translateY(0); }
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.modal__head h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.modal__close {
  appearance: none;
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--muted-foreground);
  padding: 4px;
  border-radius: var(--radius-sm);
}
.modal__close:hover { color: var(--foreground); background: var(--accent); }
.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

/* 档位编辑器 */
.tier-editor { display: flex; flex-direction: column; gap: 18px; }
.tier-table-editor { width: 100%; border-collapse: collapse; font-size: 14px; }
.tier-table-editor th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.tier-table-editor th.num { text-align: right; }
.tier-table-editor td { padding: 6px 10px; border-bottom: 1px solid var(--secondary); }
.tier-table-editor input {
  width: 100%;
  height: 32px;
  border: 1px solid transparent;
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 0 8px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--foreground);
  outline: none;
  transition: border-color 0.15s;
}
.tier-table-editor input:hover { border-color: var(--border); }
.tier-table-editor input:focus { border-color: var(--space); }
.tier-table-editor input.num { text-align: right; }
.tier-table-editor .tier-no {
  font-variant-numeric: tabular-nums;
  color: var(--muted-foreground);
  font-size: 13px;
  width: 38px;
}
.tier-table-editor .row-del {
  appearance: none;
  background: none;
  border: none;
  color: var(--muted-foreground);
  font-size: 16px;
  padding: 0 4px;
}
.tier-table-editor .row-del:hover { color: var(--destructive); }
.tier-table-editor .grip { color: var(--muted-foreground); cursor: grab; }

.import-box {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.import-box textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 120px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  padding: 8px 10px;
  line-height: 1.7;
  outline: none;
  resize: vertical;
}
.import-box textarea:focus { border-color: var(--space); }
.import-box .row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.import-preview {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 10px;
}
.import-preview table { width: 100%; border-collapse: collapse; }
.import-preview th, .import-preview td {
  font-size: 13px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--secondary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.import-preview th:first-child, .import-preview td:first-child { text-align: left; }
.import-preview th {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted-foreground);
}

/* 上传 */
.upload-row { display: flex; align-items: center; gap: 14px; }
.upload-preview {
  width: 64px; height: 64px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.upload-actions { display: flex; flex-direction: column; gap: 6px; }

/* 登录 */
.login {
  max-width: 380px;
  margin: 14vh auto;
  padding: 0 20px;
}
.login__title {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 34px;
  letter-spacing: 0;
  margin: 0 0 4px;
}
.login__sub { font-size: 13px; color: var(--muted-foreground); margin-bottom: 24px; }
.login__rule { display: none; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--space);
  color: #fff;
  font-size: 13px;
  padding: 11px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 640px) {
  .admin-shell { padding: 0 14px 80px; }
  .list__row { flex-wrap: wrap; gap: 10px; }
  .list__actions { width: 100%; justify-content: flex-end; }
  .modal { padding: 18px 16px; }
  .admin-head { flex-direction: column; align-items: flex-start; gap: 10px; }
}
