:root {
  color-scheme: dark;
  --bg: #09100f;
  --panel: #111b19;
  --panel-2: #172522;
  --line: #2b3d38;
  --text: #eef8f4;
  --muted: #9db0aa;
  --accent: #4de0a7;
  --accent-soft: rgba(77, 224, 167, .12);
  --warn: #f3bd52;
  --danger: #ff746c;
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at 12% -10%, #17382e 0, transparent 36%), var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { border: 1px solid var(--accent); border-radius: 8px; padding: .58rem .9rem; color: #052117; background: var(--accent); cursor: pointer; font-weight: 700; }
button:hover { filter: brightness(1.08); }
button.secondary { color: var(--text); background: transparent; border-color: var(--line); }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 2rem; padding: 2rem clamp(1rem, 4vw, 4rem); border-bottom: 1px solid var(--line); background: rgba(9, 16, 15, .82); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 3; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .35rem; font-size: clamp(1.6rem, 4vw, 2.5rem); }
h2 { margin-bottom: 0; font-size: 1.15rem; }
.eyebrow { margin-bottom: .35rem; color: var(--accent); font-size: .72rem; letter-spacing: .16em; font-weight: 800; }
.muted { color: var(--muted); }
.status { border: 1px solid; border-radius: 999px; padding: .5rem .85rem; white-space: nowrap; }
.status-ok { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.status-warn { color: var(--warn); border-color: var(--warn); }
.status-error { color: var(--danger); border-color: var(--danger); }
main { width: min(1500px, 100%); margin: 0 auto; padding: 1.25rem clamp(1rem, 4vw, 4rem) 4rem; }
.summary-grid { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); gap: .8rem; margin-bottom: .8rem; }
.metric, .panel { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(23,37,34,.96), rgba(13,23,21,.96)); border-radius: 12px; }
.metric { padding: 1rem; min-height: 92px; display: flex; flex-direction: column; justify-content: space-between; }
.metric span { color: var(--muted); font-size: .82rem; }
.metric strong { font-size: 1.45rem; }
.panel { padding: 1rem; margin-bottom: .8rem; overflow: hidden; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.inline-controls { display: flex; align-items: center; gap: .6rem; }
.inline-controls input { width: 11rem; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.two-column .panel { margin-bottom: 0; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { border-bottom: 1px solid var(--line); padding: .75rem .6rem; text-align: left; font-size: .86rem; }
th { color: var(--muted); font-weight: 600; }
.empty { color: var(--muted); text-align: center; }
label { display: flex; flex-direction: column; gap: .4rem; color: var(--muted); font-size: .82rem; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: .65rem; background: #08110f; color: var(--text); }
textarea { resize: vertical; font-family: "Cascadia Mono", Consolas, monospace; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid button { align-self: end; }
.compact { margin-bottom: 0; }
.field-list { margin: .75rem 0 0; padding: .8rem; min-height: 220px; max-height: 430px; overflow: auto; background: #07100e; border: 1px solid var(--line); border-radius: 8px; }
.field-row { display: grid; grid-template-columns: 7.5rem 1fr; gap: .55rem .8rem; padding: .45rem 0; border-bottom: 1px solid rgba(200, 226, 217, 0.08); }
.field-row:last-child { border-bottom: 0; }
.field-row dt { margin: 0; color: #8fb3a6; font-size: .85rem; }
.field-row dd { margin: 0; color: #e7f6ef; white-space: pre-wrap; overflow-wrap: anywhere; }
.data-view.small { min-height: 90px; }
/* hidden 属性必须压过下方 image-panel/image-placeholder 的 display，否则占位框与图片会同时显示 */
[hidden] { display: none !important; }
.image-panel img, .image-placeholder { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #050908; border-radius: 8px; border: 1px solid var(--line); }
.user-thumb { width: 96px; aspect-ratio: 4 / 3; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; background: #050908; }
details { margin-top: 1rem; }
summary { cursor: pointer; color: var(--accent); margin-bottom: .6rem; }
.image-placeholder { display: grid; place-items: center; color: var(--muted); }
.danger-panel { border-color: rgba(255,116,108,.45); }
.event-log { margin: 0; padding-left: 1.5rem; max-height: 360px; overflow: auto; }
.event-log li { padding: .48rem; border-bottom: 1px solid var(--line); font-family: "Cascadia Mono", Consolas, monospace; font-size: .78rem; overflow-wrap: anywhere; }
#toast { position: fixed; right: 1rem; bottom: 1rem; max-width: min(430px, calc(100vw - 2rem)); padding: .8rem 1rem; border-radius: 8px; background: #22332e; border: 1px solid var(--accent); box-shadow: 0 12px 40px rgba(0,0,0,.35); opacity: 0; transform: translateY(10px); transition: .2s; pointer-events: none; }
#toast.visible { opacity: 1; transform: translateY(0); }
#toast.error { border-color: var(--danger); }

@media (max-width: 1050px) {
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
  .two-column { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { position: static; align-items: flex-start; flex-direction: column; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .inline-controls { width: 100%; align-items: stretch; flex-direction: column; }
  .inline-controls input { width: 100%; }
}
