:root {
  --ink: #10253f;
  --ink-soft: #3d5168;
  --teal: #0f766e;
  --teal-deep: #0b5f59;
  --teal-soft: #e6f4f2;
  --coral: #c45c3e;
  --bg: #eef2f6;
  --surface: #ffffff;
  --line: #d7e0ea;
  --ok: #15803d;
  --warn: #b45309;
  --danger: #b91c1c;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(16, 37, 63, 0.08);
  --font: "Noto Sans SC", "DM Sans", system-ui, sans-serif;
  --display: "DM Sans", "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #d8efe9 0%, transparent 55%),
    radial-gradient(900px 420px at 100% 0%, #dce7f5 0%, transparent 50%),
    var(--bg);
}
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 36px 32px;
}
.login-brand {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0 0 6px;
}
.login-sub { margin: 0 0 28px; color: var(--ink-soft); font-size: 14px; }
.field { display: grid; gap: 8px; margin-bottom: 16px; }
.field label { font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fbfcfe;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}
.field textarea { min-height: 96px; resize: vertical; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 600;
  transition: transform .12s, background .15s, opacity .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-deep); }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn-danger { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.btn-block { width: 100%; }
.err { color: var(--danger); font-size: 13px; margin: 8px 0 0; }

.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  /* 侧栏 sticky 需要：否则侧栏被拉高到与主区同高，滚动时会跟着走 */
  align-items: start;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #0f2740 0%, #163553 100%);
  color: #e8eef5;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
}
.side-brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  padding: 4px 12px 22px;
  letter-spacing: 0.03em;
}
.side-brand span { display: block; font-size: 12px; font-weight: 500; opacity: .65; margin-top: 4px; }
.nav-item {
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.1); }
.nav-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  flex-shrink: 0;
}
.nav-item.publish {
  background: var(--teal);
  color: #fff;
  font-weight: 700;
  margin: 8px 0 16px;
}
.nav-item.publish:hover, .nav-item.publish.active { background: #0d8a80; }
.side-foot { margin-top: auto; padding: 12px; font-size: 12px; opacity: .7; }

.main { padding: 28px 32px 48px; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.topbar h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 26px;
  font-weight: 700;
}
.topbar p { margin: 6px 0 0; color: var(--ink-soft); font-size: 14px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
}
.stat .k { font-size: 13px; color: var(--ink-soft); }
.stat .v { margin-top: 8px; font-family: var(--display); font-size: 28px; font-weight: 700; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}
.nav-cats {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.nav-cat {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.nav-cat:hover { color: var(--ink); background: #f3f6f9; }
.nav-cat.on {
  color: #fff;
  background: var(--teal);
  font-weight: 700;
}
.toolbar input, .toolbar select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 180px;
  background: #fbfcfe;
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th {
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  background: #f7f9fc;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--teal-soft);
  color: var(--teal-deep);
}
.tag.off { background: #f3f4f6; color: #6b7280; }
.tag.warn { background: #fff7ed; color: var(--warn); }
.tag.danger { background: #fef2f2; color: var(--danger); }
.tag.ok { background: #ecfdf5; color: var(--ok); }
.pager { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; align-items: center; color: var(--ink-soft); font-size: 13px; flex-wrap: wrap; }
.pager-num { min-width: 36px; padding: 0 8px; }
.pager-num.on { background: var(--brand, #1a3a2f); color: #fff; border-color: var(--brand, #1a3a2f); }
.pager-ellipsis { min-width: 24px; text-align: center; color: var(--ink-soft); user-select: none; }
.cover-thumb { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: #eef2f6; }
.user-cell { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.user-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: #eef2f6; flex-shrink: 0; }

.publish-page {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 16px;
  align-items: start;
}
/* fieldset / 提示不占独立网格列，主表单在左、详情在右 */
.publish-page > p {
  grid-column: 1 / -1;
  margin: 0;
}
.publish-page > fieldset {
  display: contents;
  border: 0;
  margin: 0;
  padding: 0;
  min-inline-size: 0;
}
.publish-main, .publish-side { min-width: 0; }
.publish-page .sticky-actions { grid-column: 1 / -1; }
.publish-page--readonly .cover-add,
.publish-page--readonly .img-grid__add,
.publish-page--readonly .cover-del {
  display: none;
}
.sec-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sec-row h2 { margin: 0; }
.req { color: #e11d48; font-size: 12px; font-weight: 600; }
.cover-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.cover-add, .cover-item, .img-grid__add, .img-grid__item {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 12px;
  overflow: hidden;
  flex: 0 0 auto;
}
.cover-add, .img-grid__add {
  border: 1px dashed #b7c7d6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  cursor: pointer;
  background: #f7fafc;
}
.cover-item { border: 2px solid transparent; cursor: pointer; }
.cover-item.on { border-color: var(--teal-deep); }
.cover-item img, .img-grid__item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,.55);
  color: #fff;
  cursor: pointer;
  line-height: 18px;
}
.custom-cat__row { display: flex; gap: 8px; margin-top: 10px; }
.custom-cat__row input { flex: 1; }
.ticket-card {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}
.stepper { display: inline-flex; align-items: center; gap: 8px; }
.stepper button {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}
.img-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.check-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.publish-page textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font: inherit; }
.form-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.form-section h2 {
  margin: 0 0 16px;
  font-size: 16px;
  font-family: var(--display);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.cats { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
}
.cat-chip.on { background: var(--teal-soft); border-color: #99d5cf; color: var(--teal-deep); font-weight: 600; }
.cover-box {
  border: 1px dashed #b7c7d6;
  border-radius: 14px;
  min-height: 180px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #f7fafc;
  cursor: pointer;
  position: relative;
}
.cover-box img { width: 100%; height: 220px; object-fit: cover; }
.cover-box .hint { color: var(--ink-soft); font-size: 13px; text-align: center; padding: 20px; }
.ticket-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}
.sticky-actions {
  position: sticky;
  bottom: 16px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  z-index: 50;
  box-shadow: var(--shadow);
}
.muted { color: var(--ink-soft); font-size: 13px; }

.circle-admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.btn-circle-add {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: #1a1f2e;
  color: #fff;
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow:
    0 0 0 6px rgba(245, 36, 67, 0.14),
    0 4px 14px rgba(26, 31, 46, 0.22);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-circle-add:hover {
  transform: scale(1.04);
  box-shadow:
    0 0 0 7px rgba(245, 36, 67, 0.18),
    0 6px 16px rgba(26, 31, 46, 0.28);
}
.btn-circle-add:active {
  transform: scale(0.96);
}
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
  padding: 20px;
}
.modal-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.modal-card__close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.modal-card__close:hover {
  background: #f3f6f9;
  color: var(--ink);
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; align-items: stretch; }
  .publish-page { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    max-height: none;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    padding: 14px;
  }
  .side-brand, .side-foot { width: 100%; }
  .stats, .publish-grid, .grid-2, .grid-3, .ticket-row { grid-template-columns: 1fr; }
}
