:root {
  --bg: #eef1f2;
  --panel: #ffffff;
  --ink: #172127;
  --muted: #6b7881;
  --line: #dfe5e8;
  --line-strong: #c8d1d6;
  --sidebar: #14232c;
  --side-text: #a8b8c0;
  --accent: #2c6e6a;
  --accent-soft: #e3efed;
  --accent-ink: #1d4f4c;
  --blue: #2e5f8a;
  --blue-soft: #e7eff6;
  --good: #2c7a58;
  --good-soft: #e5f2eb;
  --warn: #a56a1c;
  --warn-soft: #f7eddc;
  --bad: #a83b34;
  --bad-soft: #f7e6e3;
  --violet: #6b5b95;
  --violet-soft: #eeebf6;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.7; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.admin { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--side-text); padding: 18px 12px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: #eaf4f2; display: grid; place-items: center; font-family: var(--mono); font-size: 13px; font-weight: 700; }
.brand b { display: block; color: #eef4f6; font-size: 13.5px; }
.brand span { display: block; font-size: 10.5px; color: #7f929c; letter-spacing: .1em; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a { display: flex; align-items: center; gap: 10px; color: var(--side-text); padding: 9px 10px; border-radius: 7px; font-size: 13px; }
.nav a:hover { background: rgba(255,255,255,.05); color: #e9f1f4; }
.nav a.active { background: rgba(255,255,255,.09); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.side-foot { margin-top: auto; padding: 10px 8px 0; border-top: 1px solid rgba(255,255,255,.08); font-size: 10.5px; color: #72868f; line-height: 1.7; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 60px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 20; }
.crumb { display: flex; align-items: baseline; gap: 8px; }
.crumb b { font-size: 15px; }
.crumb span { color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.content { padding: 22px 26px 40px; max-width: 1440px; width: 100%; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 21px; }
.page-head p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn { border: 1px solid transparent; background: var(--accent); color: #fff; padding: 7px 13px; border-radius: 6px; font-size: 12.5px; line-height: 1.2; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; text-decoration: none; }
.btn:hover { filter: brightness(.96); }
.btn.ghost { background: var(--panel); border-color: var(--line-strong); color: var(--ink); }
.btn.soft { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.btn.good { background: var(--good); }
.btn.danger { background: var(--bad); }
.btn.sm { padding: 4px 9px; font-size: 11.5px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.card-pad { padding: 16px 18px; }
.card h3 { margin: 0 0 10px; font-size: 13px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 10px; }
.section-title h2 { margin: 0; font-size: 15px; }
.section-title span { color: var(--muted); font-size: 12px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.stat .k { font-size: 11px; color: var(--muted); letter-spacing: .05em; }
.stat .v { font-family: var(--mono); font-size: 24px; font-weight: 600; margin-top: 2px; }
.stat .d { font-size: 11px; color: var(--muted); margin-top: 2px; }
.stat .d.warn { color: var(--warn); }
.stat .d.up { color: var(--good); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 4px; font-size: 10.5px; line-height: 1.5; white-space: nowrap; }
.b-good { background: var(--good-soft); color: var(--good); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-bad { background: var(--bad-soft); color: var(--bad); }
.b-blue { background: var(--blue-soft); color: var(--blue); }
.b-gray { background: #eef1f2; color: var(--muted); }
.b-violet { background: var(--violet-soft); color: var(--violet); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 10.5px; letter-spacing: .06em; padding: 9px 12px; background: #f7f9f9; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fafcfc; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.tiny { font-size: 11px; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.chip { border: 1px solid var(--line); background: var(--panel); color: var(--muted); padding: 4px 10px; border-radius: 20px; font-size: 11.5px; }
.chip.on { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.search { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 6px 10px; font-size: 12px; min-width: 180px; }

.flash { padding: 9px 12px; border-radius: 7px; margin-bottom: 14px; font-size: 12px; background: var(--accent-soft); color: var(--accent-ink); }
.flash.error { background: var(--bad-soft); color: var(--bad); }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 10.5px; color: var(--muted); letter-spacing: .06em; margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; background: #fbfcfc; font-size: 12px; }
.field textarea { min-height: 160px; line-height: 1.8; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.entry-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.panel-head { padding: 12px 15px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.panel-head b { font-size: 12.5px; }
.panel-body { padding: 14px 15px; }
.upload-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 4px 0 8px; }
.upload-grid img, .upload-grid .add { width: 100%; aspect-ratio: 3/4; object-fit: cover; border: 1px solid var(--line); border-radius: 5px; display: grid; place-items: center; }
.upload-grid .add { border-style: dashed; border-color: var(--line-strong); font-size: 10.5px; color: var(--muted); }
.entry-preview img { width: 100%; display: block; border: 1px solid var(--line); border-radius: 5px; }
.checks { display: flex; flex-direction: column; gap: 5px; margin-top: 12px; }
.check-line { display: flex; gap: 7px; align-items: center; font-size: 11.5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }
.dot.g { background: var(--good); }
.dot.y { background: var(--warn); }
.dot.r { background: var(--bad); }
.gen-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

.content-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.content-card img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; background: #f3f5f5; }
.content-card .body { padding: 10px 12px 12px; }
.content-card .title { font-size: 13px; font-weight: 600; line-height: 1.5; }
.content-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.content-meta { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.content-card .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }

.review-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.review-images { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.review-images img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; }
.review-text { white-space: pre-wrap; font-size: 13px; line-height: 1.9; }

.login-page { min-height: 100vh; display: grid; place-items: center; background: var(--sidebar); padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 12px; padding: 28px; }
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card p { margin: 0 0 20px; color: var(--muted); font-size: 12px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 6px; }

@media (max-width: 1100px) {
  .entry-grid, .review-grid { grid-template-columns: 1fr; }
  .content-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .admin { grid-template-columns: 68px minmax(0, 1fr); }
  .brand b, .brand span, .nav a span, .side-foot { display: none; }
  .nav a { justify-content: center; padding: 10px 0; }
  .content { padding: 16px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { padding: 0 14px; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 560px) {
  .content-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
}

.portal-top { background: #fff; border-bottom: 1px solid var(--line); height: 62px; display: flex; align-items: center; gap: 18px; padding: 0 24px; position: sticky; top: 0; z-index: 20; }
.portal-brand { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.portal-brand .brand-mark { width: 30px; height: 30px; font-size: 11px; border-radius: 7px; }
.portal-nav { display: flex; gap: 16px; }
.portal-nav a { font-size: 13px; color: var(--muted); padding: 19px 0 17px; border-bottom: 2px solid transparent; }
.portal-nav a.on { color: var(--accent-ink); border-bottom-color: var(--accent); }
.portal-user { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--muted); }
.portal-content { max-width: 1200px; margin: 0 auto; padding: 22px 24px 60px; }
.copy-row { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.copy-row .grow { flex: 1; min-width: 0; }
.copy-row .k { font-size: 9.5px; color: var(--muted); letter-spacing: .06em; }
.copy-row .v { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portal-images { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.portal-images img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border: 1px solid var(--line); border-radius: 5px; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs a { font-size: 13px; color: var(--muted); padding: 8px 2px; margin-right: 18px; border-bottom: 2px solid transparent; }
.tabs a.on { color: var(--accent-ink); border-bottom-color: var(--accent); }
.tpl-hero { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.tpl-hero .shot { border: 1px solid var(--line); background: #fff; padding: 8px; }
.tpl-hero img { display: block; width: 100%; border: 1px solid var(--line); }
.tpl-hero .cap { padding: 6px 2px 2px; font-size: 10.5px; color: var(--muted); }
.tpl-hero .cap b { display: block; color: var(--ink); font-size: 11.5px; }
.layout-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.layout-card { border: 1px solid var(--line); background: #fff; padding: 8px; }
.layout-mini { aspect-ratio: 3/4; background: linear-gradient(150deg, #e8f0ee, #f8f3e9); border: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; gap: 5px; }
.layout-mini b { font-size: 11px; line-height: 1.5; }
.layout-mini span { display: block; height: 4px; border-radius: 2px; background: rgba(23,33,39,.13); }
.layout-mini span.short { width: 62%; }
.layout-mini .code { margin-top: auto; font-family: var(--mono); font-size: 8px; color: var(--muted); }
.layout-mini.has-preview { padding: 0; overflow: hidden; position: relative; background: #111; }
.layout-mini.has-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.layout-mini .code.on-image { position: absolute; left: 7px; bottom: 6px; margin: 0; background: rgba(255,255,255,.86); color: #17212b; padding: 2px 5px; border-radius: 3px; }
.layout-card .cap { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 7px 2px 0; font-size: 11px; }
.bg-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.bg-card { border: 1px solid var(--line); background: #fff; padding: 8px; }
.bg-card img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; border: 1px solid var(--line); }
.bg-card .cap { padding: 7px 2px 3px; font-size: 10.5px; color: var(--muted); line-height: 1.5; }
.bg-card .cap b { display: block; color: var(--ink); font-size: 11.5px; }
.bg-card .row { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding-top: 4px; }
.brand-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.swatches { display: flex; gap: 6px; align-items: center; }
.swatch { width: 26px; height: 26px; border-radius: 5px; border: 1px solid rgba(0,0,0,.12); }
@media (max-width: 1100px) { .layout-grid { grid-template-columns: repeat(3, 1fr); } .bg-grid { grid-template-columns: repeat(2, 1fr); } .brand-grid { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .tpl-hero { grid-template-columns: 1fr; } .layout-grid { grid-template-columns: repeat(2, 1fr); } .bg-grid { grid-template-columns: 1fr; } }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.pager-info { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.pager-links { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.pager-links .btn { min-width: 30px; justify-content: center; }
.pager-links .btn.disabled { opacity: .4; cursor: default; }
.pager-gap { color: var(--muted); font-size: 11px; padding: 0 4px; }
