:root {
  --bg: #f4f7fa; --panel: #fff; --ink: #14212b; --muted: #5d6b78; --line: #dbe3ea;
  --accent: #0a6fb5; --accent-ink: #fff; --ok: #1d8a4f; --warn: #b7791f; --err: #c0392b;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--accent); }
header.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 12px 20px; background: #0b3954; color: #fff; }
header.top a { color: #fff; text-decoration: none; }
.brand { font-weight: 700; font-size: 17px; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav a { padding: 6px 12px; border-radius: 6px; opacity: .85; }
nav a.active, nav a:hover { background: rgba(255,255,255,.15); opacity: 1; }
.who { margin-left: auto; font-size: 14px; opacity: .9; }
main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 24px; margin: 4px 0 16px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 16px; }
.card.narrow { max-width: 420px; margin: 40px auto; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 10px; }
input, select { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; background: #fff; }
input[type=checkbox] { display: inline; width: auto; margin: 0; }
.num { width: 110px; }
.title-input { font-size: 18px; font-weight: 600; max-width: 420px; }
.code-input { text-transform: uppercase; letter-spacing: 3px; font-family: ui-monospace, Consolas, monospace; }
.inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.inline input:not([type=checkbox]) { width: auto; flex: 1 1 220px; margin: 0; }
.inline label { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 14px; align-items: end; }
.btn { display: inline-block; padding: 8px 16px; font: inherit; font-weight: 600; border: 0; border-radius: 6px; background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; margin-bottom: 10px; }
.btn.small { padding: 5px 10px; font-size: 13px; margin: 0; }
.btn.ghost { background: #e8eef3; color: var(--ink); }
.btn.danger { background: #fbe9e7; color: var(--err); }
.btn:disabled { opacity: .35; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash.ok { background: #e6f4ec; color: var(--ok); }
.flash.err { background: #fbe9e7; color: var(--err); }
.err-text { color: var(--err); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; vertical-align: middle; }
.badge.on { background: #e6f4ec; color: var(--ok); }
.badge.off { background: #eceff2; color: var(--muted); }
.badge.warn { background: #fdf3e1; color: var(--warn); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.stat b { display: block; font-size: 28px; }
.stat span { color: var(--muted); font-size: 14px; }
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
table.items input { margin: 0; }
.filters { display: flex; gap: 6px; margin: 4px 0 14px; }
.filters a { padding: 5px 12px; border-radius: 99px; background: #e8eef3; color: var(--ink); text-decoration: none; font-size: 14px; }
.filters a.active { background: var(--accent); color: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.tile .rename input { margin: 0; font-weight: 600; border-color: transparent; padding: 4px 6px; }
.tile .rename input:focus { border-color: var(--line); }
.thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #0b1a24; border-radius: 6px; }
.mini { width: 96px; aspect-ratio: 16/9; object-fit: cover; background: #0b1a24; border-radius: 4px; display: block; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.pick { display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; color: var(--ink); margin: 0; }
.pick:has(input:checked) { border-color: var(--accent); background: #eef6fc; }
.pick .mini { width: 100%; }
.pick span { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone { position: relative; border: 2px dashed var(--line); border-radius: 10px; padding: 28px; text-align: center; color: var(--muted); cursor: pointer; }
.dropzone.over { border-color: var(--accent); background: #eef6fc; }
.dropzone input { display: none; }
.upload-row { display: grid; grid-template-columns: 1fr 160px 110px; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; }
.upload-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-row progress { width: 100%; }
.upload-row.failed .state { color: var(--err); }
.upload-row.done .state { color: var(--ok); }
code { background: #eef2f5; padding: 1px 6px; border-radius: 4px; }
@media (max-width: 600px) {
  .who { margin-left: 0; width: 100%; }
  .upload-row { grid-template-columns: 1fr 80px; }
  .upload-row progress { display: none; }
}
