/* 嘉禾 · 默认图后台 —— 单文件主题（无框架、无外链） */

:root {
  --bg: #141414;
  --panel: #1e1e1e;
  --panel-2: #242424;
  --panel-3: #2a2a2a;
  --line: #303030;
  --text: #e9e6e1;
  --muted: #9b968e;
  --gold: #c8a76a;
  --gold-soft: rgba(200, 167, 106, .14);
  --bad: #e0685f;
  --ok: #6bbf7b;
  --warn: #e0a94f;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: #e6cf9d; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace; }
code { font-size: 12.5px; color: #cfc6b4; }
h1, h2, h3 { margin: 0 0 .4em; font-weight: 600; letter-spacing: .02em; }
h1 { font-size: 22px; }
h2 { font-size: 15px; color: var(--gold); margin-top: 0; }
h3 { font-size: 14px; }
p { margin: .4em 0; }
img { max-width: 100%; }

/* ───────── 顶栏 ───────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
  padding: 0 20px;
  background: rgba(20, 20, 20, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid rgba(200, 167, 106, .5);
  color: var(--gold);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .06em;
  background: linear-gradient(160deg, rgba(200, 167, 106, .18), rgba(200, 167, 106, .02));
}
.brand__text strong { display: block; font-size: 14px; }
.brand__text small { display: block; color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.topbar__tools { display: flex; align-items: center; gap: 14px; }
.tool { color: var(--muted); font-size: 13px; }
.tool:hover { color: var(--text); }
.tool--exit { color: #b98b84; }
.who {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--gold);
  font-size: 12px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ───────── 骨架 ───────── */
.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 24px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px 20px 60px;
}
.sidebar { position: sticky; top: 82px; align-self: start; }
.zones { display: flex; flex-direction: column; gap: 4px; margin-bottom: 18px; }
.zone {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
  border: 1px solid transparent;
  font-size: 14px;
}
.zone svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.zone:hover { background: var(--panel); color: var(--text); }
.zone.is-active {
  color: var(--gold);
  background: var(--gold-soft);
  border-color: rgba(200, 167, 106, .35);
}
.pages { border-top: 1px solid var(--line); padding-top: 12px; }
.pages__head { color: var(--muted); font-size: 11px; letter-spacing: .12em; margin: 0 12px 8px; text-transform: uppercase; }
.page-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 8px;
  color: #c7c3bb;
  font-size: 13px;
}
.page-link:hover { background: var(--panel); color: var(--text); }
.page-link.is-active { background: var(--panel-2); color: var(--gold); }
.page-link em {
  font-style: normal;
  min-width: 20px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  background: var(--panel-3);
  border-radius: 99px;
  padding: 1px 6px;
}
.page-link em.is-zero { background: transparent; }

.main { min-width: 0; }

/* ───────── 标题区 ───────── */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.crumbs { color: var(--muted); font-size: 12px; display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--gold); }
.path-chip { color: var(--muted); font-size: 12px; margin-top: 4px; }
.page-head__stats { display: flex; gap: 10px; }
.stat {
  min-width: 82px;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: center;
}
.stat strong { display: block; font-size: 18px; color: var(--gold); font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--muted); }

.note {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-left: 2px solid var(--gold);
  background: var(--gold-soft);
  border-radius: 0 8px 8px 0;
  color: #d9d3c7;
  font-size: 13px;
}
.check-line { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.inline-form { display: inline; }
.muted { color: var(--muted); }
.tiny { font-size: 11.5px; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.warn { color: var(--warn) !important; }
.nowrap { white-space: nowrap; }
.break, code.break { word-break: break-all; }

/* ───────── 卡片 / 网格 ───────── */
.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 16px;
}
.slot {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .18s ease, transform .18s ease;
}
.slot:hover { border-color: rgba(200, 167, 106, .45); transform: translateY(-1px); }
.slot.is-custom { border-color: rgba(200, 167, 106, .35); }
.slot__thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background:
    repeating-conic-gradient(#191919 0 25%, #1d1d1d 0 50%) 50% / 18px 18px;
}
.slot__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot__body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.slot__name { color: var(--muted); font-size: 11.5px; }
.slot h3 { font-size: 14px; margin: 0; }
.slot .meta { color: var(--muted); font-size: 11.5px; margin: 0; }
.slot__actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.slot__actions form { margin: 0; }

.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10.5px;
  background: rgba(0, 0, 0, .66);
  border: 1px solid var(--line);
  color: var(--muted);
  backdrop-filter: blur(4px);
}
.badge--gold { color: #16130d; background: var(--gold); border-color: var(--gold); font-weight: 600; }
.badge--bad { left: auto; right: 8px; color: #fff; background: var(--bad); border-color: var(--bad); }
/* 行内使用（表格、定义列表里）—— 抵消 .badge 的绝对定位 */
.badge--inline { position: static; display: inline-block; vertical-align: middle; }

.empty {
  padding: 44px 24px;
  text-align: center;
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty h2 { color: var(--text); }
.empty p { color: var(--muted); max-width: 560px; margin: 8px auto; }

/* ───────── 详情 ───────── */
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 16px;
  margin-bottom: 16px;
}
.detail-preview, .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.preview-frame {
  display: grid;
  place-items: center;
  min-height: 260px;
  max-height: 460px;
  padding: 10px;
  border-radius: 10px;
  background:
    repeating-conic-gradient(#181818 0 25%, #1c1c1c 0 50%) 50% / 20px 20px;
  overflow: hidden;
}
.preview-frame img { max-height: 440px; width: auto; object-fit: contain; }

.call-url { margin-top: 12px; }
.call-url__label { display: block; color: var(--muted); font-size: 11px; letter-spacing: .06em; margin-bottom: 4px; }
.call-url__value {
  display: block;
  padding: 8px 10px;
  background: #101010;
  border: 1px solid var(--line);
  border-radius: 8px;
  word-break: break-all;
  color: #d9cfb6;
}
.call-url__btns { display: flex; gap: 6px; margin-top: 6px; }

.card { margin-bottom: 16px; }
.card h2 small { font-weight: 400; letter-spacing: 0; }

.kv { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 6px 12px; margin: 0 0 14px; font-size: 13px; }
.kv dt { color: var(--muted); font-size: 12px; }
.kv dd { margin: 0; word-break: break-word; }

/* ───────── 表单 ───────── */
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span { color: var(--muted); font-size: 12px; }
.field--inline { flex-direction: row; align-items: center; gap: 8px; margin-bottom: 0; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  padding: 9px 11px;
  background: #131313;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color .15s ease;
}
input:focus, select:focus, textarea:focus { border-color: rgba(200, 167, 106, .6); }
input[type="number"] { max-width: 180px; }
.check { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.check input { accent-color: var(--gold); }

.file-label {
  display: block;
  padding: 18px 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  background: #161616;
  transition: border-color .15s ease, background .15s ease;
}
.file-label:hover { border-color: var(--gold); background: #191713; color: var(--text); }
.file-label input { display: none; }
.file-label.has-file { border-style: solid; border-color: rgba(200, 167, 106, .5); color: var(--text); }
.upload-form__foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: linear-gradient(160deg, #d8b87c, #b8945a);
  color: #17140e;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: filter .15s ease, transform .15s ease;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--text); font-weight: 500; }
.btn--ghost:hover { border-color: rgba(200, 167, 106, .55); color: var(--gold); }
.btn--sm { padding: 6px 12px; font-size: 12.5px; }
.btn--xs { padding: 3px 9px; font-size: 11.5px; border-radius: 7px; }
.btn--block { width: 100%; }

.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }

/* ───────── 表格 ───────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 500; background: #191919; position: sticky; top: 0; font-size: 11.5px; letter-spacing: .04em; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #1b1b1b; }
.table--compact th, .table--compact td { padding: 7px 10px; }
.detail-cell { max-width: 420px; }
.detail-cell code { word-break: break-all; color: #9d9789; }

/* ───────── 提示 ───────── */
.alert {
  padding: 10px 14px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  margin-bottom: 14px;
  font-size: 13px;
}
.alert--bad { border-color: rgba(224, 104, 95, .45); background: rgba(224, 104, 95, .1); color: #f0b6b1; }
.alert--warn { border-color: rgba(224, 169, 79, .45); background: rgba(224, 169, 79, .1); color: #efd3a3; }
.alert--info { border-color: rgba(200, 167, 106, .35); background: var(--gold-soft); color: #e2d3b3; }

.flash-wrap {
  position: fixed;
  top: 72px;
  right: 20px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(440px, calc(100vw - 40px));
}
.flash {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  background: #232323;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: flash-in .22s ease;
}
.flash--ok { border-color: rgba(107, 191, 123, .5); }
.flash--error { border-color: rgba(224, 104, 95, .5); }
.flash--warn { border-color: rgba(224, 169, 79, .5); }
.flash__close { margin-left: auto; background: transparent; border: 0; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ───────── 其它 ───────── */
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.narrow { max-width: 620px; }
.bullets { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.bullets li { margin: 4px 0; }
.code-block {
  margin: 10px 0;
  padding: 14px;
  background: #101010;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.7;
  color: #d6cdb9;
}
.ops { display: flex; flex-direction: column; gap: 14px; }
.ops__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  flex-wrap: wrap;
}
.ops__item p { margin: 2px 0 0; font-size: 12px; }
.api-rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 10px; }
.api-rule { padding: 12px 14px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; }
.api-rule__tag { display: inline-block; margin-bottom: 6px; padding: 1px 8px; border-radius: 99px; background: var(--gold-soft); color: var(--gold); font-size: 11px; }
.api-rule code { display: block; word-break: break-all; margin-bottom: 6px; color: #d9cfb6; }
.api-rule p { color: var(--muted); font-size: 12px; margin: 0; }
.api-page-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 18px 0 8px; color: #d8d3c9; }
.api-page-title code { color: var(--muted); }

/* ───────── 登录 ───────── */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login-card {
  width: min(420px, 100%);
  padding: 26px 26px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.login-brand strong { display: block; }
.login-brand small { color: var(--muted); font-size: 11.5px; }
.login-form { margin-top: 6px; }
.login-foot { color: var(--muted); font-size: 11.5px; margin: 14px 0 0; }

/* ───────── 手机 ───────── */
.mobile-nav { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding: 16px 14px 92px; }
  .sidebar { position: static; }
  .zones { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .zone { flex: 0 0 auto; }
  .pages { border-top: 0; padding-top: 0; display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; }
  .pages__head { display: none; }
  .page-link { flex: 0 0 auto; background: var(--panel); border: 1px solid var(--line); }
  .detail-grid, .two-col { grid-template-columns: minmax(0, 1fr); }
  .topbar__tools .tool:not(.tool--exit) { display: none; }
  .page-head__stats { width: 100%; }
  .stat { flex: 1 1 0; min-width: 0; }

  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: rgba(20, 20, 20, .96);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .mobile-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 0;
    color: var(--muted);
    font-size: 11px;
    border-radius: 8px;
  }
  .mobile-nav__item svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .mobile-nav__item.is-active { color: var(--gold); background: var(--gold-soft); }
}
