/* 慢半拍 · 后台样式 */

:root {
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --bg: #fbfbfc;
  --panel: #ffffff;
  --soft: #f4f4f6;
  --text: #17171a;
  --text-2: #55555e;
  --faint: #8a8a93;
  --line: #e6e6ea;
  --accent: #b3402c;
  --accent-soft: rgba(179, 64, 44, 0.09);
  --green: #1f7a4d;
  --green-soft: rgba(31, 122, 77, 0.1);
  --amber: #96650a;
  --amber-soft: rgba(150, 101, 10, 0.12);
  --danger: #b32b2b;
  --danger-soft: rgba(179, 43, 43, 0.08);
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e11;
    --panel: #15151a;
    --soft: #1c1c22;
    --text: #ececf0;
    --text-2: #a5a5ae;
    --faint: #76767f;
    --line: #27272f;
    --accent: #e0795f;
    --accent-soft: rgba(224, 121, 95, 0.13);
    --green: #57c08c;
    --green-soft: rgba(87, 192, 140, 0.14);
    --amber: #d8a851;
    --amber-soft: rgba(216, 168, 81, 0.14);
    --danger: #f07470;
    --danger-soft: rgba(240, 116, 112, 0.12);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

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

/* ------------------------------ 启动 / 登录 ------------------------------ */

.boot {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--bg);
}
.boot-mark, .auth-mark {
  width: 42px; height: 42px; border-radius: 13px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  font-size: 21px; font-weight: 700;
}
.boot-mark { animation: breathe 1.6s ease-in-out infinite; }
.boot-mark.has-img, .auth-mark.has-img { background: transparent; }
.boot-mark.has-img img, .auth-mark.has-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.boot-mark.is-two, .auth-mark.is-two { font-size: 16px; letter-spacing: -0.02em; }
@keyframes breathe { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
.boot-text { font-size: 12px; color: var(--faint); }

.auth {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 372px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 18px 50px rgba(0, 0, 0, 0.06);
}
.auth-head { display: flex; align-items: center; gap: 13px; }
.auth-title { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.auth-sub { margin: 2px 0 0; font-size: 10.5px; color: var(--faint); letter-spacing: 0.06em; }
.auth-form { margin-top: 24px; display: flex; flex-direction: column; gap: 14px; }
.auth-back { margin-top: 10px; height: 38px; color: var(--text-2); }
.auth-back:hover { color: var(--text); }
.auth-error {
  margin: 0; padding: 8px 12px;
  background: var(--danger-soft); color: var(--danger);
  border-radius: 8px; font-size: 12.5px;
}
.auth-foot { margin: 18px 0 0; font-size: 10.5px; color: var(--faint); text-align: center; }

/* ------------------------------ 框架 ------------------------------ */

.shell { display: flex; min-height: 100vh; }

.side {
  width: 216px; flex: none;
  position: fixed; inset: 0 auto 0 0;
  display: flex; flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
  z-index: 40;
}
.side-brand {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  font-size: 14px; font-weight: 700;
  overflow: hidden; flex: none; letter-spacing: 0;
}
.brand-mark.has-img { background: transparent; }
.brand-mark.has-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-mark.is-two { font-size: 10.5px; letter-spacing: -0.02em; }
.side-tag { font-size: 9px; letter-spacing: 0.14em; color: var(--faint); }

.side-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.side-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px;
  font-size: 13.5px; color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}
.side-nav a:hover { background: var(--soft); color: var(--text); }
.side-nav a.is-on { background: var(--soft); color: var(--text); font-weight: 500; }
.side-nav a.is-on .si { color: var(--accent); }
.si { width: 16px; text-align: center; font-size: 13px; color: var(--faint); }

.side-foot { padding: 14px 18px 18px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.side-link {
  background: none; border: 0; padding: 0;
  text-align: left; font-size: 12px; color: var(--faint);
  cursor: pointer;
}
.side-link:hover { color: var(--accent); }
.side-user { margin: 6px 0 0; font-size: 10.5px; color: var(--faint); }

.main {
  flex: 1; min-width: 0;
  margin-left: 216px;
  display: flex; flex-direction: column;
}

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 28px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-id { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-title { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -0.015em; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.view { padding: 26px 28px 80px; max-width: 1120px; width: 100%; }

/* ------------------------------ 通用控件 ------------------------------ */

.icon-btn {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid transparent; background: transparent;
  color: var(--text-2); display: inline-grid; place-items: center;
  cursor: pointer; font-size: 14px;
}
.icon-btn:hover { background: var(--soft); color: var(--text); }
.menu-btn { display: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px;
  border-radius: 9px;
  background: var(--text); color: var(--bg);
  border: 1px solid var(--text);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
}
.btn:hover { opacity: 0.9; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--text); opacity: 1; }
.btn-danger { color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: var(--danger-soft); border-color: transparent; opacity: 1; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }
.btn-block { width: 100%; height: 40px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.field-hint { font-size: 11px; color: var(--faint); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="url"], input[type="email"], input[type="search"], textarea, select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text);
  font: inherit; font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.7; }
textarea.code { font-family: var(--mono); font-size: 12.5px; min-height: 220px; }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--accent); }

.search-box { position: relative; }
.search-box input { padding-left: 30px; width: 200px; }
.search-box::before {
  content: "⌕"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--faint); font-size: 14px; pointer-events: none;
}

/* ------------------------------ 概览 ------------------------------ */

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat {
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.stat-k { font-size: 11.5px; color: var(--faint); letter-spacing: 0.04em; }
.stat-v { margin-top: 6px; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.stat-sub { margin-top: 2px; font-size: 11px; color: var(--faint); }
.stat a { color: var(--accent); }

.panel {
  margin-top: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-title { margin: 0; font-size: 13.5px; font-weight: 600; }
.panel-body { padding: 18px; }
.panel-body.flush { padding: 0; }

.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.quick a, .quick button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel);
  font-size: 12.5px; color: var(--text-2);
  cursor: pointer;
}
.quick a:hover, .quick button:hover { border-color: var(--accent); color: var(--accent); }

/* ------------------------------ 列表 ------------------------------ */

.list-tools {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.list-tools-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.list-count { font-size: 11.5px; color: var(--faint); }

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px; font-weight: 500; letter-spacing: 0.06em;
  color: var(--faint);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--soft); }

.cell-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.thumb {
  width: 42px; height: 42px; flex: none;
  border-radius: 8px; object-fit: cover;
  background: var(--soft); border: 1px solid var(--line);
}
.cell-title { font-size: 13.5px; font-weight: 500; }
.cell-sub { font-size: 11px; color: var(--faint); margin-top: 1px; }
.cell-title, .cell-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }

.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 500;
}
.badge-live { background: var(--green-soft); color: var(--green); }
.badge-draft { background: var(--amber-soft); color: var(--amber); }
.badge-cat { background: var(--soft); color: var(--text-2); }

.row-actions { display: flex; justify-content: flex-end; gap: 4px; }
.row-actions button {
  border: 0; background: transparent; color: var(--faint);
  font-size: 12px; padding: 4px 8px; border-radius: 6px; cursor: pointer;
}
.row-actions button:hover { background: var(--soft); color: var(--text); }
.row-actions button.danger:hover { color: var(--danger); background: var(--danger-soft); }

.empty-state {
  padding: 64px 20px; text-align: center; color: var(--faint);
}
.empty-state p { margin: 0 0 14px; font-size: 13px; }

/* ------------------------------ 照片 ------------------------------ */

.photos-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.photo-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 14px;
}
.photo-card {
  margin: 0;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column;
  height: 100%;
}
.photo-card.is-draft { opacity: 0.62; }
.photo-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--soft); }
.photo-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.photo-title { font-size: 12.5px; font-weight: 500; }
.photo-meta { font-size: 10.5px; color: var(--faint); }
.photo-tools {
  display: flex; align-items: center; gap: 2px;
  flex-wrap: nowrap;
  border-top: 1px solid var(--line);
  padding: 4px 6px;
}
.photo-tools button {
  border: 0; background: transparent; cursor: pointer;
  color: var(--faint); font-size: 11px; padding: 5px 8px; border-radius: 6px;
  white-space: nowrap; flex: none;
}
.photo-tools button:hover { background: var(--soft); color: var(--text); }
.photo-tools .grow { flex: 1; }

/* ------------------------------ 抽屉编辑器 ------------------------------ */

.drawer {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 10, 12, 0.36);
  display: flex; justify-content: flex-end;
  opacity: 0; transition: opacity 0.2s;
}
.drawer.is-open { opacity: 1; }
.drawer[hidden] { display: none; }
.drawer-panel {
  width: min(560px, 100%);
  height: 100%;
  background: var(--panel);
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  transform: translateX(24px);
  transition: transform 0.24s ease;
}
.drawer.is-open .drawer-panel { transform: none; }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.drawer-title { margin: 0; font-size: 15px; font-weight: 600; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.drawer-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.drawer-foot-right { display: flex; gap: 8px; }

.form-section {
  padding-top: 6px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}
.form-section:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.form-section-title {
  margin: 0 0 10px;
  font-size: 10.5px; letter-spacing: 0.1em;
  color: var(--faint); text-transform: uppercase;
}

/* 媒体选择 */
.media { display: flex; flex-direction: column; gap: 8px; }
.media-row { display: flex; gap: 6px; }
.media-row input { flex: 1; font-family: var(--mono); font-size: 11.5px; }
.media-preview {
  border: 1px dashed var(--line); border-radius: 9px;
  padding: 8px; min-height: 54px;
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; color: var(--faint);
}
.media-preview img { height: 46px; width: auto; max-width: 120px; object-fit: cover; border-radius: 6px; }
.media-preview video { height: 54px; border-radius: 6px; max-width: 140px; }
.upload-bar {
  height: 3px; border-radius: 999px; background: var(--soft); overflow: hidden;
}
.upload-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.15s; }

/* 设置页 */
.set-group {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 16px; overflow: hidden;
}
.set-head { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.set-head h3 { margin: 0; font-size: 13.5px; font-weight: 600; }
.set-head p { margin: 3px 0 0; font-size: 11.5px; color: var(--faint); }
.set-body { padding: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.set-body .full { grid-column: 1 / -1; }
.set-foot { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

/* ------------------------------ 提示 ------------------------------ */

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 200;
  transform: translateX(-50%);
  padding: 10px 18px; border-radius: 999px;
  background: var(--text); color: var(--bg);
  font-size: 12.5px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}
.toast.is-error { background: var(--danger); color: #fff; }

/* ------------------------------ 响应式 ------------------------------ */

@media (max-width: 860px) {
  .side { transform: translateX(-100%); transition: transform 0.22s; box-shadow: 0 0 40px rgba(0, 0, 0, 0.12); }
  .side.is-open { transform: none; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .view { padding: 20px 18px 72px; }
  .topbar { padding: 12px 18px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .set-body { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
  .table th:nth-child(3), .table td:nth-child(3) { display: none; }
  .cell-title, .cell-sub { max-width: 46vw; }
  .search-box input { width: 140px; }
  .drawer-panel { width: 100%; }
}
