:root {
  --ground: #f5f5f1; --surface: #ffffff; --line: #e2e2dc; --line-strong: #cfcfc7;
  --ink: #1a1a17; --ink-2: #4f4f49; --ink-3: #6b6b64;
  --accent: #0e6b63; --accent-ink: #0a4f49; --accent-soft: #e3f1ef; --accent-line: #bfdcd8;
  --warn: #c25e1f; --warn-ink: #8a3409; --warn-soft: #fbeadf;
  --info-ink: #1e3a8a; --info-soft: #e6edfb;
  --nav: #1f1f1c; --nav-active: #33332e; --nav-ink: #d6d6ce;
  font-family: "IBM Plex Sans", "Noto Sans SC", "PingFang SC", -apple-system, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font-size: 14px; line-height: 1.5; }
a { color: var(--accent); } a:hover { color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.mono { font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }

.layout { display: flex; flex-wrap: wrap; min-height: 100vh; }
nav.side { flex: 1 1 220px; max-width: 100%; background: var(--nav); color: #f5f5f1; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; }
nav.side .brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; font-weight: 600; font-size: 15px; }
nav.side .logo { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); display: inline-block; }
nav.side a { padding: 10px 12px; border-radius: 8px; color: var(--nav-ink); text-decoration: none; }
nav.side a.active { background: var(--nav-active); color: #fff; font-weight: 500; }
nav.side .who { margin-top: auto; padding: 12px; font-size: 13px; color: #b5b5ad; }
nav.side .who button { background: none; border: 0; color: #d6d6ce; text-decoration: underline; padding: 0; }
main { flex: 999 1 560px; min-width: 0; padding: 28px 32px 48px; }
.wrap { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
h1 { margin: 0; font-size: 24px; font-weight: 600; }
h2 { margin: 0 0 12px; font-size: 16px; font-weight: 600; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; }
.banner { padding: 12px 16px; border-radius: 10px; background: var(--warn-soft); color: var(--warn-ink); }
.banner.ok { background: var(--accent-soft); color: var(--accent-ink); }

.btn { height: 38px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.warn { border-color: var(--warn); color: var(--warn-ink); font-weight: 500; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 0 4px; height: auto; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 160px; }
.field label { font-size: 12px; color: var(--ink-2); }
.field input, .field select, .field textarea, input.inp { height: 38px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.field textarea { height: auto; padding: 8px 10px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.tile .n { font-size: 26px; font-weight: 600; font-family: "IBM Plex Mono", ui-monospace, monospace; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.mcard { display: flex; flex-direction: column; border-radius: 10px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.mcard .cover { position: relative; aspect-ratio: 9 / 13; background: #d6d6ce center / cover no-repeat; }
.mcard .cover .pill { position: absolute; left: 8px; top: 8px; }
.mcard .cover .dur { position: absolute; right: 8px; bottom: 8px; padding: 1px 6px; border-radius: 4px; background: rgba(26,26,23,.78); color: #fff; font-size: 12px; }
.mcard .body { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.pickable { position: relative; display: flex; flex-direction: column; }
.pickable .mcard { flex: 1; }
.pick { position: absolute; right: 8px; top: 8px; z-index: 1; display: flex; padding: 6px; border-radius: 6px; background: rgba(255,255,255,.92); cursor: pointer; }
.pick input { width: 18px; height: 18px; margin: 0; cursor: pointer; }
.mcard .body .t { font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; background: #ededE8; color: #3f3f3a; }
.pill.ready { background: var(--accent); color: #fff; }
.pill.processing { background: var(--info-soft); color: var(--info-ink); }
.pill.failed, .pill.no_usable, .pill.excluded, .pill.offline { background: var(--warn-soft); color: var(--warn-ink); }
.pill.selected, .pill.ingest { background: var(--accent-soft); color: var(--accent-ink); }
.pill.manual { border: 1px dashed #8a8a82; }
.pill.admin { background: var(--ink); color: #fff; }
.pill.editor { background: var(--info-soft); color: var(--info-ink); }
.pill.collector { background: var(--accent-soft); color: var(--accent-ink); }

.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--ink-2); background: #fafaf7; }
th, td { padding: 11px 14px; border-bottom: 1px solid #ededE8; vertical-align: top; }
tr.sel td { background: #f1f7f6; }
tr.clickable { cursor: pointer; }

.detail { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.detail .preview { flex: 1 1 300px; max-width: 340px; display: flex; flex-direction: column; gap: 10px; }
.detail .preview video, .detail .preview .ph { width: 100%; aspect-ratio: 9 / 16; border-radius: 10px; background: #3a3a35; }
.detail .preview .ph { display: flex; align-items: center; justify-content: center; color: #cfcfc7; }
.detail .info { flex: 999 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
dl.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 16px; margin: 0; font-size: 13px; }
dl.kv dt { color: var(--ink-2); } dl.kv dd { margin: 0; overflow-wrap: anywhere; }
ul.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
ul.plain li { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 8px; background: var(--ground); }
.seg { display: inline-flex; padding: 3px; border-radius: 8px; background: #ededE8; }
.seg button { height: 32px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-2); }
.seg button.on { background: #fff; color: var(--ink); font-weight: 500; }
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; }
.error { color: var(--warn-ink); }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: 420px; padding: 12px 16px; border-radius: 10px; background: var(--ink); color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.key-once { padding: 12px 14px; border-radius: 8px; border: 1px solid var(--accent-line); background: #f1f7f6; overflow-wrap: anywhere; }
@media (max-width: 640px) { main { padding: 20px 16px 40px; } dl.kv { grid-template-columns: 1fr; } }
.stack .field { flex: none; }
/* 输入框下拉建议 */
.combo-list { position: fixed; z-index: 20; margin: 0; padding: 4px; list-style: none; max-height: 280px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.combo-list[hidden] { display: none; }
.combo-list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 10px; border-radius: 6px; cursor: pointer; }
.combo-list li:hover, .combo-list li.on { background: var(--accent-soft); color: var(--accent-ink); }
.combo-list li .meta { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.combo-list li.empty { color: var(--ink-3); cursor: default; background: none; }
