/* 新一的羊毛小助手 · 运营后台
   视觉基调：Apple 风格浅色系统。色卡沿用 V1.0.0（蓝 #0f5fd6 / #1677ff、
   浅蓝 #eef5ff、墨 #172033、灰 #56647a、红 #b42318、橙 #ff9f1a）。
   仅使用同源样式，不引入外部字体或图片（服务端 CSP: style-src 'self'）。 */
:root {
  color-scheme: light;
  --page: #f5f7fb;
  --card: #fff;
  --card-subtle: #f8fbff;
  --ink: #172033;
  --ink-2: #3b4a61;
  --muted: #56647a;
  --muted-2: #8a97a9;
  --line: #dfe6f1;
  --line-soft: #eaf0f8;
  --line-strong: #cbd9ea;
  --action: #0f5fd6;
  --action-bright: #1677ff;
  --action-soft: #eaf3ff;
  --danger: #b42318;
  --warn: #ff9f1a;
  --ok: #1a7f5a;
  --blue-grad: linear-gradient(135deg, #3b95ff, #0f5fd6);
  --r-sm: 8px;
  --r-md: 11px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(23, 49, 82, .04), 0 6px 20px rgba(23, 49, 82, .045);
  --shadow-2: 0 2px 6px rgba(23, 49, 82, .06), 0 18px 44px rgba(23, 49, 82, .11);
  --shadow-3: 0 30px 80px rgba(23, 49, 82, .24);
  --ring: 0 0 0 3px rgba(15, 95, 214, .15);
  --ease: cubic-bezier(.22, .61, .36, 1);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--page); }
body.signed-in { background: linear-gradient(180deg, #eef5ff, var(--page) 340px) fixed; }
[hidden] { display: none !important; }
h1, h2, h3, h4, p { margin: 0 0 12px; overflow-wrap: anywhere; }
h1 { font-size: 25px; line-height: 1.3; letter-spacing: -.025em; font-weight: 750; }
h2 { font-size: 17px; line-height: 1.35; letter-spacing: -.015em; font-weight: 720; }
h3 { font-size: 15px; font-weight: 700; }
a { color: var(--action); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; }
button, a { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }
::selection { background: #cfe2ff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfdbeb; border: 3px solid transparent; background-clip: content-box; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #b3c5de; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 基础控件 ---------- */
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 8px 14px; border: 1px solid var(--line);
  border-radius: var(--r-md); color: var(--ink-2); background: var(--card);
  font-size: 13px; font-weight: 650; line-height: 1.3; white-space: nowrap;
  cursor: pointer; box-shadow: 0 1px 1px rgba(23, 49, 82, .03);
  transition: border-color .18s var(--ease), color .18s var(--ease), background .18s var(--ease),
    box-shadow .18s var(--ease), transform .18s var(--ease);
}
button:hover:not(:disabled) { border-color: #b9cdec; color: var(--action); background: #fbfdff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(23, 49, 82, .07); }
button:active:not(:disabled) { transform: translateY(0) scale(.985); box-shadow: none; }
button:disabled { opacity: .55; cursor: not-allowed; }
button.primary {
  color: #fff; background: var(--blue-grad); border-color: transparent;
  box-shadow: 0 5px 15px rgba(15, 95, 214, .22);
}
button.primary:hover:not(:disabled) { color: #fff; background: linear-gradient(135deg, #2b86ff, #0b53bd); box-shadow: 0 9px 22px rgba(15, 95, 214, .3); }
button.danger { color: var(--danger); border-color: #f0d4d1; background: #fffafa; }
button.danger:hover:not(:disabled) { color: #fff; background: var(--danger); border-color: var(--danger); }
button.danger-solid { color: #fff; background: var(--danger); border-color: var(--danger); }
button.danger-solid:hover:not(:disabled) { color: #fff; background: #8f1c13; }
button.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
button.ghost:hover:not(:disabled) { background: #f1f5fb; border-color: transparent; }
button.icon-button { min-width: 34px; min-height: 34px; padding: 6px; border-radius: 9px; color: var(--muted); }
.icon { width: 17px; height: 17px; flex: none; vertical-align: middle; }
button .icon { width: 16px; height: 16px; flex: none; }

input, select, textarea {
  width: 100%; min-width: 0; min-height: 40px; padding: 9px 12px;
  border: 1px solid #ccd8e8; border-radius: var(--r-md);
  color: var(--ink); background: #fbfcff; font-size: 13.5px; font-weight: 400;
  transition: border-color .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
}
input::placeholder, textarea::placeholder { color: #9aa8ba; }
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: #b3c6df; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--action-bright); background: #fff; box-shadow: var(--ring); }
input:disabled, select:disabled, textarea:disabled { background: #f2f5fa; color: var(--muted); cursor: not-allowed; }
textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, #7f8ea3 50%), linear-gradient(135deg, #7f8ea3 50%, transparent 50%); background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
input[type="checkbox"] { width: 17px; height: 17px; min-height: 0; padding: 0; accent-color: var(--action); cursor: pointer; }
input[type="file"] { min-height: 0; padding: 0; border: 0; background: transparent; font-size: 12px; color: var(--muted); }
input[type="file"]::file-selector-button { min-height: 32px; padding: 5px 12px; margin-right: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink-2); font-weight: 650; font-size: 12px; cursor: pointer; }
input[type="file"]::file-selector-button:hover { border-color: var(--action); color: var(--action); }
input[type="date"], input[type="datetime-local"], input[type="time"] { font-variant-numeric: tabular-nums; }

label { display: grid; gap: 6px; align-content: start; margin: 0 0 10px; min-width: 0; color: var(--ink-2); font-size: 12.5px; font-weight: 680; letter-spacing: .005em; }
label > .field-label { display: block; min-width: 0; color: var(--ink-2); }
label.is-required > .field-label::after { content: " *"; color: var(--danger); font-size: 13px; font-weight: 800; }
label.check { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; min-height: 40px; padding: 8px 11px; margin: 0 0 10px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--card-subtle); cursor: pointer; font-weight: 650; }
label.check:hover { border-color: #bcd0ea; background: #f2f8ff; }
label.check input { flex: none; }
label.check:has(input:checked) { border-color: #bcd8ff; background: #f0f7ff; }
label.check .field-label { flex: 1; }
label:last-child { margin-bottom: 0; }

.field-hint { display: block; color: var(--muted-2); font-size: 11px; font-weight: 500; line-height: 1.45; }
.field-error { display: block; color: var(--danger); font-size: 11.5px; font-weight: 700; line-height: 1.55; }
.field-error::before {
  content: "!"; display: inline-grid; place-items: center; width: 14px; height: 14px; margin-right: 5px;
  border-radius: 50%; background: var(--danger); color: #fff; font-size: 10px; font-weight: 800;
}
label.check .field-hint, label.check .field-error { flex-basis: 100%; }
.field.invalid > .field-label { color: var(--danger); }
.field.invalid input, .field.invalid select, .field.invalid textarea {
  border-color: var(--danger); background: #fff7f6;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, .1);
  animation: field-shake .3s var(--ease);
}
.field.invalid input:focus, .field.invalid select:focus, .field.invalid textarea:focus { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(180, 35, 24, .16); }
.field.empty-required:not(.invalid) input, .field.empty-required:not(.invalid) select, .field.empty-required:not(.invalid) textarea { border-color: #e9c496; background: #fffcf6; }
@keyframes field-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 0 16px; align-items: start; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stack { display: grid; gap: 10px; }
.muted { color: var(--muted); }
.subtle { color: var(--muted-2); }
.error { color: var(--danger); }
.notice { color: var(--action); margin: 0; font-weight: 650; }
.error:empty, .notice:empty { display: none; }
[role="alert"].error:not(:empty) {
  padding: 11px 14px; border: 1px solid #f0d4d1; border-left: 3px solid var(--danger);
  border-radius: var(--r-md); background: #fff4f3; color: #8d2b20;
  white-space: pre-line; line-height: 1.65; font-size: 12.5px; font-weight: 600;
}
.editor-alert:not(:empty) { margin: 0 0 14px; }
.editor-alert { scroll-margin-top: 90px; }
.section-title .err-badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: auto;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 800;
}

/* ---------- 骨架与状态 ---------- */
.skeleton { display: grid; gap: 10px; padding: 4px 0; }
.skeleton span { display: block; height: 14px; border-radius: 7px; background: linear-gradient(90deg, #eef3fa 25%, #e2ebf6 50%, #eef3fa 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; }
.skeleton span:nth-child(2) { width: 72%; }
.skeleton span:nth-child(3) { width: 46%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.empty-state { display: grid; justify-items: center; gap: 10px; padding: 34px 18px; text-align: center; color: var(--muted); }
.empty-state .empty-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; background: var(--action-soft); color: var(--action); }
.empty-state .empty-mark .icon { width: 22px; height: 22px; }
.empty-state strong { color: var(--ink-2); font-size: 14px; }
.empty-state p { margin: 0; font-size: 12.5px; max-width: 280px; }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--r-pill); font-size: 11px; font-weight: 720; line-height: 1.6; background: #eef2f8; color: #5b6a80; white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip.published, .chip.ok { background: #e4f5ec; color: #16734f; }
.chip.scheduled, .chip.warn { background: #fff3de; color: #9a6200; }
.chip.draft { background: #eef2f8; color: #5b6a80; }
.chip.disabled, .chip.error { background: #fbecea; color: #a5433a; }
.chip.role { background: var(--action-soft); color: var(--action); }
.chip.role::before { display: none; }

/* ---------- 布局 ---------- */
.admin-layout { min-height: 100vh; }
.signed-in .admin-layout { display: grid; grid-template-columns: 246px minmax(0, 1fr); }
.main-shell { min-width: 0; display: flex; flex-direction: column; }

.sidebar {
  position: sticky; top: 0; height: 100dvh; overflow: auto;
  display: flex; flex-direction: column; gap: 18px; padding: 22px 14px 16px;
  background: rgba(255, 255, 255, .84); backdrop-filter: blur(24px);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px 18px; border-bottom: 1px solid var(--line-soft); color: var(--ink); font-size: 14px; font-weight: 750; letter-spacing: -.01em; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; flex: none; place-items: center; width: 40px; height: 40px; border-radius: 13px; color: #fff; background: var(--blue-grad); font-size: 19px; font-weight: 800; box-shadow: 0 8px 18px rgba(22, 119, 255, .28); }
.brand small { display: block; margin-top: 1px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .04em; }
.nav-group { margin: 0; }
.nav-group summary { display: flex; align-items: center; gap: 8px; padding: 8px 10px; color: var(--muted-2); font-size: 10.5px; font-weight: 750; letter-spacing: .1em; border-radius: var(--r-sm); list-style: none; cursor: pointer; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary .icon:last-child { margin-left: auto; width: 13px; transform: rotate(-90deg); transition: transform .2s var(--ease); }
.nav-group[open] summary .icon:last-child { transform: none; }
.nav-group summary:hover { background: #f3f6fb; color: var(--muted); }
.nav-links { display: grid; gap: 2px; margin: 4px 0 10px; }
.nav-links button { justify-content: flex-start; width: 100%; min-height: 37px; padding: 8px 12px; border-color: transparent; background: transparent; box-shadow: none; color: var(--ink-2); font-size: 13px; font-weight: 620; border-radius: 9px; }
.nav-links button:hover:not(:disabled) { background: #f2f6fc; border-color: transparent; box-shadow: none; transform: none; }
.nav-links button[aria-current] { background: var(--action-soft); color: var(--action); font-weight: 750; box-shadow: inset 3px 0 0 var(--action); }
.nav-links button[aria-current]:hover { background: #e0edff; color: var(--action); }
.session { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 4px 0; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.session-user { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; }
.session-avatar { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 10px; background: var(--action-soft); color: var(--action); font-weight: 750; font-size: 12px; }
.session-name { min-width: 0; font-weight: 700; color: var(--ink-2); }
.session-role { display: block; font-size: 10.5px; color: var(--muted-2); }
.session button { min-height: 32px; padding: 6px 10px; font-size: 12px; }

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  min-height: 66px; padding: 12px 28px;
  background: rgba(255, 255, 255, .82); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
}
body:not(.signed-in) .topbar { display: none; }
.topbar-copy { min-width: 0; flex: 1; }
.topbar-crumb { display: block; color: var(--muted-2); font-size: 11px; font-weight: 650; letter-spacing: .04em; }
.topbar-title { margin: 1px 0 0; font-size: 18px; font-weight: 750; letter-spacing: -.02em; line-height: 1.3; }
.topbar-aside { display: flex; align-items: center; gap: 10px; flex: none; }
.topbar-time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.dirty-indicator { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-pill); background: #fff5e5; color: #96620a; font-size: 11.5px; font-weight: 700; }
.dirty-indicator::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

main { min-width: 0; }
.signed-in main { width: 100%; max-width: 1400px; margin: 0 auto; padding: 26px 28px 56px; }
.page-title { margin: 0 0 18px; }
.page-intro { margin: -8px 0 20px; color: var(--muted); font-size: 13px; }

/* ---------- 概览卡 ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 18px; }
.stat { position: relative; overflow: hidden; padding: 15px 17px 16px; border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--card); box-shadow: var(--shadow-1); }
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent, #cfdcee); }
.stat-label { display: block; color: var(--muted); font-size: 11.5px; font-weight: 650; }
.stat-value { display: block; margin-top: 4px; font-size: 26px; line-height: 1.15; font-weight: 780; letter-spacing: -.035em; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat-hint { display: block; margin-top: 3px; color: var(--muted-2); font-size: 11px; }

/* ---------- 面板与工作区 ---------- */
.workspace { display: grid; grid-template-columns: minmax(270px, 316px) minmax(0, 1fr); gap: 18px; align-items: start; }
.panel, .login { min-width: 0; background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.panel { padding: 18px; }
.workspace > .panel:first-child { position: sticky; top: 84px; max-height: calc(100dvh - 104px); overflow: auto; }
.workspace > .panel:last-child { padding: 20px; scroll-margin-top: 80px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 14px; }
.panel-head h2 { margin: 0; }
.panel-head button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.panel-caption { margin: -8px 0 14px; color: var(--muted); font-size: 12px; }
.panel-divider { height: 1px; margin: 14px 0; background: var(--line-soft); }

.search-bar { display: grid; gap: 9px; margin-bottom: 14px; }
.search-bar input, .search-bar select { min-height: 38px; }
.search-bar .bar { gap: 8px; }
.search-bar .bar > * { flex: 1; min-width: 0; }
.search-bar button { flex: none !important; }

.list { display: grid; gap: 6px; margin: 0; }
.list button { flex-direction: column; align-items: stretch; justify-content: flex-start; text-align: left; width: 100%; min-height: 0; padding: 10px 12px; overflow-wrap: anywhere; white-space: normal; border-color: transparent; background: transparent; box-shadow: none; border-radius: 10px; line-height: 1.4; }
.list button:hover:not(:disabled) { background: #f4f8fe; border-color: transparent; box-shadow: none; transform: none; }
.list button[aria-current] { background: #eaf3ff; color: var(--action); border-color: #d3e4ff; box-shadow: inset 3px 0 0 var(--action); }
.list button[aria-current]:hover { background: #e2eeff; color: var(--action); }
.list button small { display: block; margin-top: 2px; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.list button[aria-current] small { color: #4d7bc0; }
.list-title { display: block; font-weight: 680; color: var(--ink); }
.list button[aria-current] .list-title { color: var(--action); }
.list-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.list button[data-state] { position: relative; padding-right: 30px; }
.list button[data-state]::after { content: ""; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 7px; height: 7px; border-radius: 50%; background: #a9b7c9; }
.list button[data-state="disabled"]::after { background: var(--danger); }
.list button[data-state="done"]::after { background: var(--ok); }
.list button[data-state="busy"]::after { background: var(--warn); }
.activity-row { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; align-items: center; }
.activity-row > input[type="checkbox"] { margin: 0; }
.category-root { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: start; }
.category-root .add-child { padding: 0; width: 34px; min-height: 34px; text-align: center; }
.category-children { display: grid; gap: 4px; margin: 4px 0 8px 12px; padding-left: 12px; border-left: 1px solid var(--line); }
.category-branch + .category-branch { margin-top: 8px; }
.bulk-bar { margin: 0 0 10px; padding: 9px 11px; border-radius: var(--r-md); background: #fff6e8; border: 1px solid #f5e0bb; }

/* ---------- 表单分区：短字段两列并排，长字段整行 ---------- */
fieldset {
  position: relative; min-width: 0; margin: 0 0 14px; padding: 16px 18px 18px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 4px 16px; align-items: start;
  border: 1px solid var(--line-soft); border-radius: var(--r-lg);
  background: linear-gradient(180deg, #fff, #fcfdff);
}
fieldset > .section-title,
fieldset > .wide,
fieldset > .field-stack,
fieldset > fieldset,
fieldset > .grid,
fieldset > .bar,
fieldset > button,
fieldset > p,
fieldset > details,
fieldset > .feedback-text,
fieldset > .feedback-shots,
fieldset > .upload-preview { grid-column: 1 / -1; }
fieldset > button { justify-self: start; }
fieldset > legend { position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
fieldset > .section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 14px; padding: 0 0 11px; border-bottom: 1px solid var(--line-soft); color: var(--ink); font-size: 14px; font-weight: 750; letter-spacing: -.01em; cursor: pointer; }
fieldset > .section-title::after { content: "−"; display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 7px; color: var(--muted); background: #f1f5fb; font-size: 15px; font-weight: 700; }
fieldset.collapsed > .section-title { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
fieldset.collapsed > .section-title::after { content: "+"; }
fieldset.collapsed > :not(legend):not(.section-title) { display: none !important; }
fieldset + fieldset { margin-top: 0; }
fieldset fieldset { margin: 12px 0; padding: 13px 14px; border-radius: var(--r-md); background: #f8fbff; border-color: var(--line-soft); }
fieldset fieldset > .section-title { margin: 0 0 10px; padding: 0 0 8px; color: var(--muted); font-size: 12px; cursor: default; }
fieldset fieldset > .section-title::after { display: none; }
.field-stack { display: grid; gap: 8px; }
.field-stack label { margin-bottom: 0; }

.editor-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.editor-head h1 { margin: 0; }
.editor-head .editor-sub { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.editor-head-actions { display: flex; align-items: center; gap: 8px; }
.editor-nav {
  position: sticky; top: 76px; z-index: 8; display: flex; gap: 4px;
  margin: 0 0 16px; padding: 5px; overflow-x: auto; scrollbar-width: none;
  border: 1px solid var(--line-soft); border-radius: var(--r-pill);
  background: rgba(246, 250, 255, .94); backdrop-filter: blur(14px);
}
.editor-nav::-webkit-scrollbar { display: none; }
.editor-nav button { flex: 1 0 auto; min-height: 32px; padding: 5px 14px; border-color: transparent; background: transparent; box-shadow: none; color: var(--muted); font-size: 12.5px; border-radius: var(--r-pill); }
.editor-nav button:hover:not(:disabled) { background: #fff; color: var(--action); border-color: transparent; box-shadow: none; transform: none; }
.editor-nav button[aria-current] { background: #fff; color: var(--action); font-weight: 750; box-shadow: 0 1px 5px rgba(23, 49, 82, .1); }
.section-anchor { scroll-margin-top: 128px; }

.upload-zone { position: relative; display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 7px 11px; border: 1px dashed #c8d8ee; border-radius: var(--r-md); background: #f8fbff; transition: border-color .18s var(--ease), background .18s var(--ease); }
.upload-zone:hover, .upload-zone.dragging { border-color: var(--action-bright); background: #eef6ff; }
.upload-zone .upload-input { flex: 1; min-width: 0; }
.upload-hint { flex: none; color: var(--muted-2); font-size: 11.5px; }
.upload-preview { width: 100%; max-height: 168px; object-fit: contain; padding: 8px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: #f8fbff; }
.upload-preview[hidden] { display: none; }

.toolbar {
  position: sticky; bottom: 0; z-index: 9; display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin: 18px -20px -20px; padding: 13px 20px max(13px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(18px); border-top: 1px solid var(--line);
}
.toolbar .bar { flex: 1; justify-content: flex-end; }
.toolbar .error, .toolbar .notice { margin: 0; }
.toolbar .notice { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.toolbar .bar button { min-width: 96px; }
.toolbar-hint { color: var(--muted-2); font-size: 11.5px; }

/* ---------- 表格与记录 ---------- */
.records { padding: 6px 4px 4px; overflow: auto; }
.records table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; font-size: 12.5px; }
.records th { position: sticky; top: 0; z-index: 2; padding: 10px 12px; background: #f5f9ff; color: var(--muted); font-size: 10.5px; font-weight: 750; letter-spacing: .06em; border-bottom: 1px solid var(--line); white-space: nowrap; }
.records td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; color: var(--ink-2); overflow-wrap: anywhere; }
.records tbody tr:hover td { background: #f8fbff; }
.records tbody tr:last-child td { border-bottom: 0; }
.records .num { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
.admin-card { padding: 15px 16px; margin-bottom: 10px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--card-subtle); }
.admin-card > .bar { margin-top: 10px; }
.feedback-text { padding: 13px 15px; margin: 0 0 12px; border-radius: var(--r-md); background: #f6f9fe; color: var(--ink-2); white-space: pre-wrap; line-height: 1.65; font-size: 13px; }
.feedback-shots { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.feedback-shots a { display: block; padding: 7px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 12px; font-weight: 650; }
.feedback-shots a:hover { border-color: var(--action); text-decoration: none; }
.invite-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; letter-spacing: .02em; }

/* ---------- 弹层 ---------- */
dialog {
  width: min(700px, calc(100% - 28px)); max-height: min(86dvh, 900px);
  padding: 0; overflow: hidden; color: var(--ink);
  border: 1px solid rgba(255, 255, 255, .9); border-radius: var(--r-xl);
  box-shadow: var(--shadow-3); background: var(--card);
}
dialog::backdrop { background: rgba(23, 32, 51, .4); backdrop-filter: blur(6px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--line-soft); background: rgba(248, 251, 255, .92); }
.dialog-head h2 { margin: 0; }
.dialog-body { max-height: calc(86dvh - 132px); overflow: auto; padding: 20px 22px; }
.dialog-body > p { color: var(--ink-2); line-height: 1.7; }
.dialog-body h1 { margin-bottom: 8px; }
.dialog-body h3 { margin: 16px 0 6px; }
.dialog-body img { margin: 12px 0; border-radius: var(--r-md); border: 1px solid var(--line-soft); }
.dialog-body ul { padding-left: 20px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 13px 20px; border-top: 1px solid var(--line-soft); background: #fbfdff; }
.dialog-message { margin: 0; color: var(--ink-2); line-height: 1.7; white-space: pre-line; }
.preview-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 16px; }
.preview-lead { font-size: 15px; color: var(--ink-2); }
.preview-notes { padding: 12px 14px; border-radius: var(--r-md); background: #f6f9fe; color: var(--muted); white-space: pre-wrap; }

.toast-stack { position: fixed; z-index: 90; top: 76px; right: 18px; display: grid; gap: 9px; pointer-events: none; max-width: calc(100vw - 36px); }
.toast { display: flex; align-items: center; gap: 10px; min-width: 210px; max-width: 360px; padding: 11px 15px; border: 1px solid var(--line-soft); border-radius: 14px; background: rgba(255, 255, 255, .96); backdrop-filter: blur(20px); box-shadow: var(--shadow-2); font-size: 13px; font-weight: 650; color: var(--ink-2); animation: toast-in .3s var(--ease) both; }
.toast::before { content: ""; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(26, 127, 90, .12); }
.toast.error::before { background: var(--danger); box-shadow: 0 0 0 4px rgba(180, 35, 24, .12); }
.toast.leaving { animation: toast-out .25s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px) scale(.97); } }

/* ---------- 登录 ---------- */
body:not(.signed-in) { background: radial-gradient(circle at 16% 0%, rgba(22, 119, 255, .14), transparent 38%), radial-gradient(circle at 88% 100%, rgba(22, 119, 255, .1), transparent 40%), linear-gradient(180deg, #eef5ff, #f7fbff); }
body:not(.signed-in) main { display: grid; place-items: center; min-height: 100dvh; padding: 28px 18px; }
.login { width: min(420px, 100%); overflow: hidden; border-color: rgba(255, 255, 255, .9); border-radius: var(--r-xl); box-shadow: var(--shadow-2); }
.login-head { display: grid; justify-items: center; text-align: center; gap: 13px; padding: 34px 24px 26px; border-bottom: 1px solid var(--line-soft); background: linear-gradient(165deg, #f1f8ff, #fff 82%); }
.login-head .brand-mark { width: 54px; height: 54px; border-radius: 17px; font-size: 24px; box-shadow: 0 12px 26px rgba(22, 119, 255, .28); }
.login-head h1 { margin: 0; font-size: 21px; }
.login-head p { margin: 0; color: var(--muted); font-size: 12.5px; }
.login-body { display: grid; gap: 15px; padding: 24px 26px 28px; }
.login-body label { margin: 0; }
.login-body input { min-height: 44px; background: #fbfdff; }
.login-body .error { margin: 0; padding: 9px 12px; background: #fff1f1; border-radius: var(--r-md); white-space: pre-line; }
.login-body > button[type="submit"] { min-height: 44px; margin-top: 2px; font-size: 14px; font-weight: 750; }
.login-foot { margin: 0; padding-top: 2px; text-align: center; color: var(--muted-2); font-size: 11.5px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .signed-in main { padding: 22px 20px 48px; }
  .topbar { padding: 12px 20px; }
}
@media (max-width: 960px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .workspace > .panel:first-child { position: static; max-height: none; overflow: visible; }
  .editor-nav { top: 70px; }
  .section-anchor { scroll-margin-top: 118px; }
}
@media (max-width: 720px) {
  .signed-in .admin-layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; padding: 12px 14px; border-right: 0; border-bottom: 1px solid var(--line); gap: 10px; }
  .brand { padding: 0 2px 10px; }
  .brand small { display: none; }
  .nav-group { margin: 0; }
  .nav-group summary { display: none; }
  .nav-links { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
  .nav-links button { width: auto; flex: none; min-height: 34px; padding: 6px 12px; border: 1px solid var(--line); background: #fff; font-size: 12px; }
  .nav-links button[aria-current] { box-shadow: none; border-color: #bfd8ff; }
  .session { margin: 0; padding: 8px 2px 0; }
  .topbar { min-height: 56px; padding: 10px 16px; }
  .topbar-title { font-size: 16px; }
  .topbar-time { display: none; }
  .signed-in main { padding: 18px 14px 44px; }
  .workspace { gap: 14px; }
  .panel, .workspace > .panel:last-child { padding: 15px; }
  .toolbar { flex-direction: column; align-items: stretch; gap: 8px; margin: 16px -15px -15px; padding: 11px 15px max(11px, env(safe-area-inset-bottom)); }
  .toolbar .bar { width: 100%; flex: none; justify-content: stretch; }
  .toolbar .bar button { flex: 1; min-width: 0; padding: 8px 6px; font-size: 12px; }
  .toolbar-hint { display: none; }
  .toolbar .error { order: -2; }
  .toolbar .notice { order: -1; }
  .stats { gap: 9px; }
  .stat { padding: 12px 13px; }
  .stat-value { font-size: 22px; }
  fieldset, .grid { grid-template-columns: minmax(0, 1fr); }
  fieldset { padding: 14px; gap: 2px 0; }
  .editor-alert:not(:empty) { margin-bottom: 12px; }
  .editor-nav { top: 62px; flex-wrap: wrap; overflow: visible; }
  .editor-nav button { flex: 1 1 auto; padding: 5px 12px; }
  .workspace > .panel:last-child { scroll-margin-top: 68px; }
  .section-anchor { scroll-margin-top: 148px; }
  .dialog-body { padding: 16px; }
  .toast-stack { top: auto; bottom: 76px; left: 10px; right: 10px; }
  .toast { max-width: none; }
}
@media (max-width: 420px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar-aside .chip { display: none; }
  .login-body { padding: 20px; }
}
/* ---------- 列表状态、编辑器补充 ---------- */
.stat.a-blue::before { background: var(--action-bright); }
.stat.a-green::before { background: #2fa876; }
.stat.a-amber::before { background: var(--warn); }
.stat.a-gray::before { background: #b9c7da; }
.editor-head-copy { min-width: 0; }
.save-draft.changed { border-color: #e8c98c; background: #fffaf0; color: #8a5b06; }
.save-draft.changed:hover:not(:disabled) { border-color: var(--warn); background: #fff5e2; color: #8a5b06; }
.toolbar-simple { display: flex; justify-content: flex-end; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.job-line { align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line-soft); }
.job-line > .muted:empty { display: none; }
details { margin: 10px 0; }
summary { display: flex; align-items: center; gap: 8px; min-height: 34px; cursor: pointer; font-weight: 700; color: var(--ink-2); }
.version-history { padding: 10px 14px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: #f9fbff; }
.version-history summary { list-style: none; }
.version-history summary::-webkit-details-marker { display: none; }
.version-history .bar { justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.feedback-shots:empty { display: none; }
.records .empty-state { padding: 44px 18px; }
.dialog-body .chip { margin-right: 4px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
