:root {
  --bg: #f4f4f2;
  --bg-deep: #ececea;
  --paper: #fafaf8;
  --ink: #111111;
  --ink-soft: #2a2a2a;
  --muted: #6b6b6b;
  --faint: #9a9a9a;
  --line: #d8d8d4;
  --line-strong: #111111;
  --fill: #111111;
  --fill-hover: #2c2c2c;
  --ghost: #ffffff;
  --danger: #1a1a1a;
  --ok-bg: #111111;
  --ok-fg: #fafaf8;
  --warn-bg: #e8e8e4;
  --shadow: 0 1px 0 rgba(17, 17, 17, 0.04);
  --radius: 4px;
  --font: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --display: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  color: var(--ink);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(17, 17, 17, 0.03) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(rgba(17, 17, 17, 0.03) 1px, transparent 1px) 0 0 / 48px 48px,
    var(--bg);
  color: var(--ink);
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }

/* —— Login —— */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 18px;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(17, 17, 17, 0.08), transparent 55%),
    linear-gradient(180deg, #fafaf8 0%, #ececea 100%);
}
.login-card {
  width: min(400px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 3px solid var(--ink);
  padding: 40px 36px 32px;
  box-shadow: var(--shadow);
}
.login-brand {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}
.login-brand .mark {
  width: 44px;
  height: 44px;
}
.login-card h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.15;
}
.login-card .sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.mark {
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--ink);
  background: var(--ink);
  color: #fafaf8;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.mark.outline {
  background: transparent;
  color: var(--ink);
}

label {
  display: block;
  margin: 16px 0 6px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
input[type="text"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="number"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  padding: 11px 12px;
  font: inherit;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea { resize: vertical; min-height: 80px; }
select { appearance: auto; }
input:disabled {
  background: var(--bg-deep);
  color: var(--muted);
  cursor: not-allowed;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}

button, .btn {
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--fill);
  color: #fafaf8;
  font: inherit;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 10px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
button:hover, .btn:hover { background: var(--fill-hover); }
button.full {
  width: 100%;
  margin-top: 22px;
  padding: 13px 16px;
  letter-spacing: 0.12em;
}
button.danger, .btn.danger {
  background: #fff;
  color: var(--ink);
  border-color: var(--ink);
}
button.danger:hover, .btn.danger:hover {
  background: var(--ink);
  color: #fafaf8;
}
button.ghost, .btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
button.ghost:hover, .btn.ghost:hover {
  border-color: var(--ink);
  background: #fff;
}

.alert {
  background: var(--warn-bg);
  color: var(--ink);
  border-left: 3px solid var(--ink);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 13px;
}
.okmsg {
  background: var(--ok-bg);
  color: var(--ok-fg);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  letter-spacing: 0.02em;
}

/* —— Shell —— */
.shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}
.side {
  background: #0e0e0e;
  color: #f2f2f0;
  padding: 28px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  border-right: 1px solid #1c1c1c;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 6px 4px;
}
.brand .mark {
  background: #fafaf8;
  color: #0e0e0e;
  border-color: #fafaf8;
}
.brand strong {
  display: block;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.brand span {
  color: #8a8a8a;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.side nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side a,
.side button.link {
  color: #c8c8c4;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: var(--radius);
  background: transparent;
  text-align: left;
  width: 100%;
  border: 0;
  font: inherit;
  letter-spacing: 0.06em;
  cursor: pointer;
  position: relative;
}
.side a:hover,
.side button.link:hover {
  color: #fafaf8;
  background: rgba(255, 255, 255, 0.05);
}
.side a.active {
  color: #fafaf8;
  background: rgba(255, 255, 255, 0.08);
}
.side a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: #fafaf8;
}
.side form { margin-top: auto; }
.who {
  color: #7a7a7a;
  font-size: 12px;
  padding: 0 12px;
  letter-spacing: 0.04em;
}
.side button.link {
  color: #9a9a9a;
  padding-left: 12px;
}
.side button.link:hover { color: #fafaf8; }

.main {
  padding: 32px 36px 56px;
  max-width: 1100px;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.top h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.top .muted { margin: 6px 0 0; }
.muted { color: var(--muted); }

.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.card, .panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
}
.card {
  border-top: 2px solid var(--ink);
}
.card .muted {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.card b {
  display: block;
  font-size: 30px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-top: 8px;
  letter-spacing: -0.02em;
}
.panel { margin-top: 12px; }
.panel h2 {
  margin: 0 0 14px;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  align-items: end;
  height: 168px;
  padding-top: 8px;
}
.bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
}
.bar i {
  display: block;
  width: 100%;
  max-width: 28px;
  background: var(--ink);
  min-height: 3px;
}
.bar em {
  font-style: normal;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th {
  color: var(--faint);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-bottom-color: var(--ink);
}
tbody tr:hover td { background: rgba(17, 17, 17, 0.02); }
td a { text-decoration: none; border-bottom: 1px solid var(--line); }
td a:hover { border-bottom-color: var(--ink); }

.tools { display: flex; gap: 8px; align-items: center; }
.tools input { width: 240px; }
.pager {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 16px;
  font-size: 13px;
}
.pager a { text-decoration: none; border-bottom: 1px solid var(--ink); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fafaf8;
  font-size: 11px;
  letter-spacing: 0.08em;
}
.badge.off {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}
.badge.warn {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}

.stack-form { display: flex; flex-direction: column; gap: 0; max-width: 560px; }
.stack-form button { align-self: flex-start; margin-top: 16px; }
.tools select { width: auto; min-width: 120px; }

/* —— 入驻轮播上传 UI —— */
.carousel-page { max-width: 920px; }
.carousel-title {
  margin: 0 0 28px;
  font-family: var(--display);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.carousel-label {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.carousel-upload { margin-bottom: 36px; }
.upload-form { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 10px;
  background: #ececec;
  color: #333;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border: 0;
  user-select: none;
}
.upload-btn:hover { background: #e2e2e2; }
.upload-icon { display: inline-flex; }
.upload-meta {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
}
.upload-hint { margin: 4px 0 0; font-size: 13px; }
.preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-start;
}
.preview-card {
  width: min(280px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.preview-card.is-off { opacity: 0.55; }
.preview-media {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  background: #f0f0f0;
  aspect-ratio: 16 / 9;
}
.preview-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.preview-del {
  position: absolute;
  top: 8px;
  right: 8px;
  margin: 0;
}
.preview-del button {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #e53935;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.preview-del button:hover { background: #c62828; }
.preview-fields label {
  margin-top: 8px;
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 12px;
}
.preview-fields label:first-of-type { margin-top: 0; }
.preview-fields input[type="text"] { padding: 8px 10px; }
.preview-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}
.preview-actions button { margin: 0; padding: 8px 14px; }
.sort-label {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  margin: 0 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  color: var(--muted);
  font-size: 12px !important;
}
.sort-label input {
  width: 64px !important;
  padding: 6px 8px !important;
}
.preview-toggle { margin: 0; }
.preview-toggle button { width: 100%; padding: 8px; }

.dl {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 10px 16px;
  margin: 0 0 20px;
}
.dl dt {
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding-top: 2px;
}
.dl dd { margin: 0; }
.apply-dl dd { word-break: break-word; }
.pre-wrap { white-space: pre-wrap; }
.actions { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; }
.actions form { display: flex; gap: 8px; align-items: end; }
.actions input { width: 220px; }
code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  background: var(--bg-deep);
  padding: 2px 6px;
  border-radius: 2px;
}

.footer-brand {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 16px;
  }
  .side nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .side a.active::before { display: none; }
  .side form { margin-top: 0; }
  .who { display: none; }
  .cards { grid-template-columns: 1fr 1fr; }
  .main { padding: 20px 14px 36px; }
  .tools { flex-direction: column; align-items: stretch; }
  .tools input { width: 100%; }
  table { display: block; overflow-x: auto; }
  .top h1 { font-size: 24px; }
}
