:root {
  --bg: #0b0d10;
  --bg-soft: #12151b;
  --panel: #151922;
  --panel2: #1b2030;
  --line: #2a3142;
  --line-strong: #3a4458;
  --text: #eef1f6;
  --muted: #8e98ab;
  --accent: #e05548;
  --accent-soft: rgba(224, 85, 72, 0.18);
  --accent-hover: #ff6f5f;
  --ok: #3ecf8e;
  --ok-soft: rgba(62, 207, 142, 0.16);
  --danger: #f07178;
  --danger-soft: rgba(240, 113, 120, 0.16);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 16px 40px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --radius-sm: 10px;
  --side-w: 232px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --scroll: #3a4458;
  --input-bg: #0e1117;
}

* { box-sizing: border-box; }
html {
  margin: 0;
  padding: 0;
  color-scheme: dark;
  background: var(--bg);
}
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  color-scheme: dark;
}
body::-webkit-scrollbar,
.nav::-webkit-scrollbar,
.panel-bd::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
body::-webkit-scrollbar-thumb,
.nav::-webkit-scrollbar-thumb,
.panel-bd::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  background: var(--scroll);
  border-radius: 4px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.shell {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

/* —— 侧边栏 —— */
.side {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 1px 0 0 rgba(42,36,28,0.02);
}

.brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel2) 100%);
}
.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(145deg, #c94a3c, #8f2a22);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  letter-spacing: -0.02em;
  box-shadow: 0 4px 14px rgba(224, 85, 72, 0.4);
}
.brand-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
  line-height: 1.2;
}
.brand-title small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.brand-out {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.brand-out:hover {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(224, 85, 72, 0.35);
}
.brand-who {
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-soft);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 12px 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll) transparent;
}
.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 4px; }

.nav .sec {
  margin: 14px 6px 6px;
  padding: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}
.nav .sec:first-child { margin-top: 4px; }
.nav .sec-name {
  font-size: 11px;
  font-weight: 700;
  color: #6b7588;
  letter-spacing: 0.08em;
}
.nav .sec-hint {
  font-size: 10px;
  color: #5a6478;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  margin: 2px 0;
  border-radius: 10px;
  color: #a8b0c0;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.3;
  transition: background 0.15s ease, color 0.15s ease;
  word-break: break-all;
}
.nav a::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3d4758;
  flex-shrink: 0;
}
.nav a:hover {
  background: var(--bg-soft);
  color: var(--text);
}
.nav a:hover::before { background: #6b7588; }
.nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav a.active::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(224, 85, 72, 0.22);
}

/* —— 主区 —— */
.main {
  padding: 28px 32px 40px;
  max-width: 1180px;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 22px;
  gap: 12px;
  padding-bottom: 0;
  border-bottom: 0;
}
.topbar h1 {
  font-size: 26px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--text);
}
.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* —— 按钮 —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 10px;
  padding: 9px 16px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s ease;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(224, 85, 72, 0.35);
}
.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  filter: none;
}
.btn-ghost {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  color: var(--text);
}
.btn-ghost:hover {
  border-color: var(--line-strong);
  background: var(--panel2);
  color: var(--text);
}
.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(240, 113, 120, 0.4);
  padding: 5px 10px;
  font-size: 12px;
}
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* —— 栅格 / 卡片 —— */
.grid { display: grid; gap: 14px; }
.grid-3 { grid-template-columns: repeat(4, 1fr); }
.grid-2 {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
}
.grid-2 > .card { width: 100%; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.card-hd {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel2);
  color: var(--text);
}
.card-bd { padding: 16px 18px; }

a.card.stat {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
a.card.stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(42, 36, 28, 0.08);
  color: inherit;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.panel:last-child { margin-bottom: 0; }
.panel-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: var(--panel2);
  border-bottom: 1px solid var(--line);
}
.panel-hd h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.panel-desc {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.panel-bd { padding: 16px 18px; }

.split {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
}
.split-form {
  padding: 14px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.split-list { min-width: 0; width: 100%; }

.board-form .form-row { margin-bottom: 10px; }
.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 12px;
}
.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px 12px;
}
.panel-bd.table-pad0 { padding: 0; }
.panel-bd.table-pad0 .table-wrap { border-radius: 0; }

.form-upload .hint {
  margin-left: 6px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}
.upload-box {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--panel2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
}
.upload-preview {
  width: 72px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}
.upload-box input[type=file] {
  flex: 1;
  min-width: 180px;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
}

.inline-form { margin-bottom: 12px; }
.inline-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: end;
}
.inline-fields .grow { flex: 1 1 220px; min-width: 180px; }
.inline-fields .w-sort { flex: 0 0 100px; }
.inline-fields .form-actions-inline { flex: 0 0 auto; margin-bottom: 12px; }
.inline-fields .form-row { margin-bottom: 0; }

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}
.option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  margin-bottom: 4px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
  padding-top: 4px;
}
.form-check .check-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 9px 0;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
.form-check .check-line input { width: auto; }

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(224, 85, 72, 0.35);
  color: #f0a098;
  font-size: 13px;
}
.chip-meta { color: var(--muted); font-size: 11px; }
.chip-del {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--muted);
  background: rgba(42,36,28,0.04);
  line-height: 1;
}
.chip-del:hover { color: var(--danger); background: var(--danger-soft); }

.empty-hint, .empty-cell {
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0 0;
  text-align: center;
}
.empty-cell { padding: 28px 12px !important; }

.cell-title { font-weight: 600; color: var(--text); }
.cell-sub { margin-top: 3px; color: var(--muted); font-size: 12px; }
.col-num, .col-ans, .col-idx { width: 64px; text-align: center !important; }
.col-actions { width: 132px; text-align: right !important; }
.row-actions {
  display: inline-flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
table.data tr.is-active td {
  background: var(--accent-soft);
}
table.data td.col-actions { white-space: nowrap; }

.stat { padding: 18px 18px; }
.stat .label { color: var(--muted); font-size: 12px; font-weight: 500; }
.stat .num {
  font-size: 28px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--text);
  letter-spacing: -0.03em;
}

table.data { width: 100%; border-collapse: collapse; }
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table.data th, table.data td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 13px;
}
table.data th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  background: var(--panel2);
}
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: var(--bg-soft); }
table.data code {
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 7px;
  border-radius: 6px;
}

.thumb {
  width: 64px;
  height: 36px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}

.form-row { margin-bottom: 14px; }
.form-row label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.form-row input,
.form-row textarea,
.form-row select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  background: var(--input-bg);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-row select option,
.form-row select optgroup {
  background: var(--panel);
  color: var(--text);
}
.form-row input::placeholder,
.form-row textarea::placeholder {
  color: #6b7588;
}
.form-row input:-webkit-autofill,
.form-row input:-webkit-autofill:hover,
.form-row input:-webkit-autofill:focus,
.form-row textarea:-webkit-autofill,
.form-row select:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset;
  transition: background-color 99999s ease-out;
  caret-color: var(--text);
}
.form-row input[type=file] {
  color: var(--muted);
}
.form-row input[type=file]::file-selector-button {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 6px 10px;
  margin-right: 10px;
  cursor: pointer;
}
.form-row textarea { min-height: 96px; resize: vertical; }
.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
  outline: none;
  border-color: #d48a82;
  box-shadow: 0 0 0 3px rgba(224, 85, 72, 0.2);
}
.form-row input:disabled { opacity: 0.55; background: var(--bg-soft); }

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.tag-on { background: var(--ok-soft); color: var(--ok); }
.tag-off { background: var(--bg-soft); color: var(--muted); }

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
  font-size: 13px;
  background: rgba(90, 140, 220, 0.12);
  border: 1px solid rgba(90, 140, 220, 0.35);
  color: #9db8e8;
}
.alert-err {
  background: var(--danger-soft);
  border-color: rgba(240, 113, 120, 0.4);
  color: #f0a0a6;
}

/* 保存成功 / 失败大提示 */
.flash-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  margin: 0 0 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  position: sticky;
  top: 12px;
  z-index: 30;
  animation: flash-in 0.28s ease;
}
.flash-ok {
  background: var(--ok-soft);
  border-color: rgba(62, 207, 142, 0.45);
  color: #7de0b8;
}
.flash-fail {
  background: var(--danger-soft);
  border-color: rgba(240, 113, 120, 0.45);
  color: #f0a0a6;
}
.flash-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  flex-shrink: 0;
  line-height: 1;
}
.flash-ok .flash-icon {
  background: #2f9e5b;
  color: #fff;
}
.flash-fail .flash-icon {
  background: #d64545;
  color: #fff;
}
.flash-body { flex: 1; min-width: 0; }
.flash-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0 0 4px;
  letter-spacing: 0.02em;
}
.flash-msg {
  font-size: 13.5px;
  line-height: 1.5;
  opacity: 0.92;
}
.flash-close {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.55;
}
.flash-close:hover { opacity: 1; }
.flash-out {
  opacity: 0;
  transform: translateY(-8px);
  transition: 0.4s ease;
}
@keyframes flash-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .flash-banner {
    top: 58px;
  }
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.media-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.media-item img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
  background: var(--bg-soft);
}
.media-item .media-url { display: none; }
.media-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 10px;
  font-size: 12px;
  color: var(--muted);
}

/* —— 登录 —— */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(700px 380px at 12% 8%, rgba(224, 85, 72, 0.22), transparent 55%),
    radial-gradient(600px 360px at 90% 85%, rgba(224, 85, 72, 0.12), transparent 50%),
    linear-gradient(165deg, #0e1116 0%, #171c24 100%);
}
.login-card {
  width: min(400px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.login-card h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.login-card .sub {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 13px;
}

.config-fit .card-bd { padding-top: 12px; padding-bottom: 12px; }
.config-fit .form-row { margin-bottom: 0; }
.config-fit .field-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 14px;
  margin-bottom: 12px;
}
.config-fit .field-grid.tabs {
  grid-template-columns: repeat(6, 1fr);
}
.config-fit .field-grid.maint {
  grid-template-columns: 1fr auto;
  align-items: end;
  margin-bottom: 0;
}
.config-fit .sec-label {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  margin: 4px 0 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-weight: 700;
}
.topbar:has(+ .alert),
.main:has(.config-fit) .topbar p { display: none; }
.main:has(.config-fit) .topbar { margin-bottom: 10px; padding-bottom: 8px; }
.main:has(.config-fit) { padding-bottom: 12px; }

@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { flex-direction: column; }
  .split { flex-direction: column; }
  .option-grid, .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr 1fr; }
  .config-fit .field-grid { grid-template-columns: repeat(2, 1fr); }
  .config-fit .field-grid.tabs { grid-template-columns: repeat(3, 1fr); }
  .shell { grid-template-columns: 210px 1fr; }
  .main { padding: 22px 20px 32px; }
}

.m-bar, .side-mask { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .desktop-only { display: none !important; }

  .m-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 10px 12px;
    padding-top: max(10px, env(safe-area-inset-top));
    background: rgba(18, 21, 26, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
  }
  .m-menu-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--panel);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
  }
  .m-bar-title {
    flex: 1;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
  }
  .m-bar-out {
    font-size: 13px;
    color: var(--muted);
    padding: 8px 10px;
  }

  .side-mask {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(42, 36, 28, 0.35);
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: 0.2s ease;
  }
  body.nav-open .side-mask {
    opacity: 1;
    pointer-events: auto;
  }

  .side {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(82vw, 300px);
    height: 100vh;
    height: 100dvh;
    z-index: 60;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    border-right: 1px solid var(--line);
    box-shadow: 8px 0 32px rgba(42, 36, 28, 0.12);
  }
  body.nav-open .side { transform: translateX(0); }

  .nav { padding: 12px 12px 28px; }
  .nav a { padding: 11px 12px; font-size: 14px; }

  .main {
    padding: 16px 14px 28px;
    padding-bottom: max(28px, env(safe-area-inset-bottom));
    max-width: none;
  }

  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .split { flex-direction: column; }
  .option-grid, .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
  .inline-fields .w-sort { flex: 1 1 100px; }
  .config-fit .field-grid,
  .config-fit .field-grid.tabs,
  .config-fit .field-grid.maint { grid-template-columns: 1fr; }

  .btn, .btn-primary, .btn-ghost {
    min-height: 42px;
    padding: 10px 14px;
    font-size: 14px;
  }
  .form-row input,
  .form-row textarea,
  .form-row select {
    min-height: 42px;
    font-size: 16px;
  }
  .form-row textarea { min-height: 96px; }

  table.data th, table.data td {
    padding: 10px 8px;
    font-size: 13px;
  }
  .card-hd, .card-bd { padding-left: 14px; padding-right: 14px; }

  .media-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  .login-card { width: min(100%, 400px); padding: 28px 20px; }
  .login-wrap { padding: 16px; }
}

/* —— 新手说明（默认折叠） —— */
.howto {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 0;
  overflow: hidden;
  flex-shrink: 0;
}
.howto-sum {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 7px 12px;
  cursor: pointer;
  user-select: none;
  background: var(--panel2);
}
.howto-sum::-webkit-details-marker { display: none; }
.howto-sum strong { font-size: 13px; color: var(--text); }
.howto-sum-where {
  font-size: 12px;
  color: var(--muted);
  flex: 1;
  min-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.howto-sum-more {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  margin-left: auto;
}
.howto[open] .howto-sum-more::after { content: "（收起）"; }
.howto:not([open]) .howto-sum-more::before { content: ""; }
.howto-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  padding: 2px 7px;
  border-radius: 999px;
}
.howto-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 0;
  border-top: 1px solid var(--line);
  max-height: 42vh;
  overflow: auto;
}
.howto-col { padding: 10px 12px; }
.howto-phone-wrap { border-left: 1px solid var(--line); background: var(--bg-soft); }
.howto-h {
  font-size: 11px;
  font-weight: 700;
  color: #6b7588;
  margin: 0 0 6px;
}
.howto-p {
  margin: 0 0 8px;
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.45;
}
.howto-steps { list-style: none; margin: 0 0 8px; padding: 0; }
.howto-steps li {
  display: flex;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.4;
  margin-bottom: 5px;
}
.howto-steps .n {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.howto-tip {
  font-size: 12px;
  line-height: 1.45;
  color: #e8b4a8;
  background: rgba(224, 85, 72, 0.12);
  border: 1px solid rgba(224, 85, 72, 0.28);
  border-radius: 8px;
  padding: 8px 10px;
}
.phone-mock {
  border: 2px solid var(--line-strong);
  border-radius: 14px;
  background: var(--panel);
  padding: 8px;
  max-width: 200px;
  margin: 0 auto;
}
.phone-notch {
  width: 56px;
  height: 6px;
  border-radius: 6px;
  background: var(--line-strong);
  margin: 0 auto 8px;
}
.phone-line {
  font-size: 10.5px;
  color: var(--muted);
  background: var(--bg-soft);
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 4px;
  line-height: 1.35;
}
.phone-line.phone-hi {
  background: var(--accent-soft);
  border: 1px dashed rgba(224, 85, 72, 0.4);
  color: var(--accent);
  font-weight: 600;
}
.phone-tabs {
  margin-top: 6px;
  text-align: center;
  font-size: 9px;
  color: #6b7588;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.kind {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.kind-img { background: rgba(80, 140, 220, 0.18); color: #7eb0f0; }
.kind-txt { background: rgba(62, 207, 142, 0.16); color: #6ed9a8; }
.kind-both { background: rgba(224, 160, 60, 0.16); color: #e0b060; }

.want-table td { vertical-align: middle; }
.want-table .muted-cell { color: var(--muted); font-size: 12px; line-height: 1.35; }
.btn-sm { padding: 4px 10px; font-size: 12px; min-height: 0; }

.pos-quick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}

.upload-now {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.upload-empty { color: var(--accent); font-weight: 600; }

.guide-intro {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
  flex-shrink: 0;
}
.guide-intro p { margin: 0 0 4px; }
.guide-intro p:last-child { margin: 0; }
.guide-blocks { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.guide-block {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--bg-soft);
}
.guide-block-hd {
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.guide-block p { margin: 0 0 4px; font-size: 12px; color: var(--muted); line-height: 1.45; }
.guide-block p:last-child { margin: 0; }
.guide-block a { color: var(--accent); font-weight: 600; }

@media (max-width: 900px) {
  .howto-grid { grid-template-columns: 1fr; }
  .howto-phone-wrap { border-left: 0; border-top: 1px solid var(--line); }
}

/* ========== 一屏铺满：尽量无整页滚动条 ========== */
body.fit-screen {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
body.fit-screen .shell {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
body.fit-screen .side {
  height: 100vh;
  height: 100dvh;
}
body.fit-screen .brand {
  padding: 10px 12px;
}
body.fit-screen .brand-logo {
  width: 28px;
  height: 28px;
  font-size: 13px;
  border-radius: 8px;
}
body.fit-screen .brand-title { font-size: 14px; }
body.fit-screen .brand-title small { display: none; }
body.fit-screen .brand-who {
  margin-top: 6px;
  padding: 4px 8px;
  font-size: 11px;
}
body.fit-screen .nav {
  padding: 6px 8px 12px;
}
body.fit-screen .nav .sec {
  margin: 8px 4px 2px;
}
body.fit-screen .nav a {
  padding: 6px 10px;
  margin: 1px 0;
  font-size: 12.5px;
  border-radius: 8px;
}
body.fit-screen .nav a::before {
  width: 5px;
  height: 5px;
}

body.fit-screen .main {
  height: 100vh;
  height: 100dvh;
  max-width: none;
  padding: 8px 12px 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
body.fit-screen .topbar {
  margin-bottom: 0;
  flex-shrink: 0;
}
body.fit-screen .topbar h1 {
  font-size: 18px;
}
body.fit-screen .topbar p {
  margin: 2px 0 0;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.fit-screen .flash-banner {
  position: static;
  margin: 0;
  padding: 8px 12px;
  flex-shrink: 0;
}
body.fit-screen .flash-icon {
  width: 28px;
  height: 28px;
  font-size: 16px;
}
body.fit-screen .flash-title { font-size: 14px; margin: 0; }
body.fit-screen .flash-msg { font-size: 12px; }

body.fit-screen .page-fit {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  overflow: hidden;
  align-content: stretch;
}
body.fit-screen .page-fit.page-fit-1 {
  grid-template-columns: 1fr;
}
body.fit-screen .page-fit.page-fit-many {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  overflow: auto;
}
body.fit-screen .page-fit > .panel,
body.fit-screen .page-fit > form,
body.fit-screen .page-fit > .card,
body.fit-screen .page-fit > .grid,
body.fit-screen .page-fit > section {
  min-height: 0;
  margin: 0 !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}
body.fit-screen .page-fit > form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}
body.fit-screen .page-fit > form > .panel {
  flex: 1;
  min-height: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.fit-screen .panel {
  margin-bottom: 0;
  border-radius: 10px;
}
body.fit-screen .panel-hd {
  padding: 8px 12px;
  flex-shrink: 0;
}
body.fit-screen .panel-hd h2 { font-size: 13.5px; }
body.fit-screen .panel-desc { font-size: 11px; margin: 1px 0 0; }
body.fit-screen .panel-bd {
  padding: 8px 12px;
  flex: 1;
  min-height: 0;
  overflow: auto;
}
body.fit-screen .panel-bd.table-pad0 {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.fit-screen .panel-bd.table-pad0 .table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 0;
  border-radius: 0;
}
body.fit-screen .card {
  border-radius: 10px;
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
body.fit-screen .card-hd { padding: 8px 12px; font-size: 13px; flex-shrink: 0; }
body.fit-screen .card-bd { padding: 8px 12px; flex: 1; min-height: 0; overflow: auto; }
body.fit-screen .stat { padding: 10px 12px; }
body.fit-screen .stat .num { font-size: 22px; margin-top: 2px; }
body.fit-screen .grid { gap: 8px; }
body.fit-screen .form-row { margin-bottom: 8px; }
body.fit-screen .form-row label { margin-bottom: 3px; font-size: 11px; }
body.fit-screen .form-row input,
body.fit-screen .form-row textarea,
body.fit-screen .form-row select {
  padding: 6px 9px;
  font-size: 13px;
  border-radius: 8px;
  min-height: 0;
}
body.fit-screen .form-row textarea { min-height: 56px; }
body.fit-screen .form-grid-2,
body.fit-screen .form-grid-3,
body.fit-screen .form-grid-4 {
  gap: 6px 10px;
}
body.fit-screen .board-form .form-row { margin-bottom: 6px; }
body.fit-screen .form-actions {
  margin-top: 4px;
  padding-top: 4px;
  gap: 6px;
}
body.fit-screen .btn {
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: 8px;
}
body.fit-screen .btn-sm { padding: 3px 8px; font-size: 11.5px; }
body.fit-screen table.data th,
body.fit-screen table.data td {
  padding: 6px 8px;
  font-size: 12px;
}
body.fit-screen .thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
}
body.fit-screen .upload-preview {
  max-height: 64px;
  width: auto;
  border-radius: 6px;
}
body.fit-screen .upload-box { padding: 8px; }
body.fit-screen .chip-list { margin: 0; gap: 6px; flex-shrink: 0; }
body.fit-screen .inline-form { margin-bottom: 6px; }

@media (max-width: 1100px) {
  body.fit-screen .page-fit {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 900px) {
  body.fit-screen {
    overflow: auto;
    height: auto;
    min-height: 100dvh;
  }
  body.fit-screen .shell,
  body.fit-screen .main {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }
  body.fit-screen .page-fit {
    display: block;
    overflow: visible;
  }
  body.fit-screen .page-fit > .panel,
  body.fit-screen .page-fit > form,
  body.fit-screen .page-fit > .card {
    height: auto;
    margin-bottom: 10px !important;
  }
  body.fit-screen .main { padding-top: 0; }
}

/* ========== 强制全站暗黑（覆盖浏览器默认浅色控件） ========== */
html, body,
.shell, .side, .main, .panel, .card, .howto,
.login-wrap, .login-card {
  background-color: var(--bg);
  color: var(--text);
}
.side, .panel, .card, .login-card, .howto {
  background-color: var(--panel);
}
.panel-hd, .card-hd, .howto-sum {
  background-color: var(--panel2);
}
input, textarea, select, button {
  color-scheme: dark;
}
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]),
textarea, select {
  background-color: var(--input-bg) !important;
  color: var(--text) !important;
  border-color: var(--line-strong);
}
input[type=checkbox],
input[type=radio] {
  accent-color: var(--accent);
}
::selection {
  background: rgba(224, 85, 72, 0.4);
  color: #fff;
}
iframe, embed, object {
  background: var(--bg);
}
