:root {
  --fg: #1d2129; --muted: #86909c; --line: #e5e6eb; --bg: #f4f5f7; --card: #fff;
  --accent: #3370ff; --accent-weak: #e8f0ff; --danger: #f54a45; --ok: #00a870;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--fg); background: var(--bg);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
code, .mono { font-family: ui-monospace, "SF Mono", Consolas, "Cascadia Mono", monospace; }

header {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 18px;
  height: 56px; padding: 0 28px; background: var(--card); border-bottom: 1px solid var(--line);
}
header .brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; margin-right: 12px; }
header .who { margin-left: auto; }
header a.cur { color: var(--accent); background: var(--accent-weak); }
header .brand::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
header a { color: var(--fg); text-decoration: none; padding: 4px 10px; border-radius: 6px; }
header a:hover { background: var(--bg); }
header .who { color: var(--muted); }

main { max-width: 960px; margin: 28px auto; padding: 0 28px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
h2 { margin: 0 0 16px; font-size: 18px; font-weight: 600; }

.login { max-width: 380px; margin: 16vh auto 0; padding: 32px; }
.login h1 { margin: 0 0 20px; font-size: 22px; font-weight: 600; }
.login input { width: 100%; margin-bottom: 12px; }
.login button { width: 100%; }

input {
  font: inherit; height: 34px; padding: 0 12px; color: var(--fg); background: #fff;
  border: 1px solid var(--line); border-radius: 6px; outline: none;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
button {
  font: inherit; height: 34px; padding: 0 16px; color: var(--fg); background: #fff;
  border: 1px solid var(--line); border-radius: 6px; cursor: pointer;
}
button:hover { border-color: var(--accent); color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { opacity: .9; color: #fff; }

button.link { height: auto; padding: 2px 8px; border: 0; background: none; color: var(--accent); border-radius: 4px; }
button.link:hover { background: var(--accent-weak); }
button.link.danger { color: var(--danger); }
button.link.danger:hover { background: #fff1f0; }

.err { color: var(--danger); min-height: 22px; margin: 6px 0; }
.add { display: flex; gap: 10px; margin-bottom: 4px; }
.add input[name=name] { width: 200px; }
.add input[name=prefix] { width: 100px; text-transform: uppercase; }

table { width: 100%; border-collapse: collapse; table-layout: fixed; }
col.c-name { width: 22%; } col.c-prefix { width: 12%; } col.c-state { width: 14%; }
h3 { margin: 28px 0 4px; font-size: 15px; font-weight: 600; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
th { text-align: left; padding: 10px 12px; color: var(--muted); font-weight: 500; font-size: 13px; border-bottom: 1px solid var(--line); }
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: #fafbfc; }
tr.off td:not(:last-child) { color: var(--muted); }
td.actions { text-align: right; white-space: nowrap; }
td input { width: 100%; height: 30px; }

.badge { display: inline-block; padding: 0 8px; margin-left: 8px; border-radius: 10px; font-size: 12px; line-height: 20px; background: var(--accent-weak); color: var(--accent); }
.badge.gray { background: var(--bg); color: var(--muted); margin-left: 0; }
.badge.green { background: #e8fff3; color: var(--ok); margin-left: 0; }

.keybox {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 16px; padding: 12px 14px;
  background: #fffbe8; border: 1px solid #f7e08a; border-radius: 8px;
}
.keybox code { font-size: 15px; letter-spacing: .5px; user-select: all; }
.keybox[hidden] { display: none; }

/* 素材登记与列表 */
.form { display: grid; gap: 12px; max-width: 560px; margin-bottom: 8px; }
.form label { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.form input, .form textarea { width: 100%; color: var(--fg); font-size: 14px; }
.form input[type=file] { height: auto; padding: 6px; }
textarea {
  font: inherit; padding: 8px 12px; color: var(--fg); background: #fff; resize: vertical;
  border: 1px solid var(--line); border-radius: 6px; outline: none;
}
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
details summary { cursor: pointer; margin-bottom: 8px; color: var(--fg); font-weight: 500; }
details > label { margin-bottom: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cover-preview { max-width: 160px; border-radius: 8px; border: 1px solid var(--line); }
.cover-preview[hidden] { display: none; }
.ok { margin: 8px 0; color: var(--ok); }
.ok code { color: var(--fg); font-size: 15px; }
.hint { color: var(--muted); font-size: 13px; font-weight: 400; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.asset { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.asset img { display: block; width: 100%; aspect-ratio: 9 / 16; object-fit: cover; background: var(--bg); cursor: pointer; }
.asset-info { padding: 8px 10px 10px; }
.asset-code { display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.asset-title { margin-top: 2px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-tags { margin-top: 2px; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

dialog { width: min(560px, 92vw); border: 0; border-radius: var(--radius); padding: 24px; box-shadow: 0 12px 40px rgba(0,0,0,.2); }
dialog::backdrop { background: rgba(0,0,0,.35); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* 平台图标、报表上传、广告列表 */
.plat { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; white-space: nowrap; }
.plat img { display: block; }
.tabs { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.tabs button.on { border-color: var(--accent); color: var(--accent); background: var(--accent-weak); }
.hintbox { background: var(--bg); border-radius: 8px; padding: 12px 16px; margin: 8px 0 16px; font-size: 13px; }
.hintbox ul { margin: 6px 0 0; padding-left: 20px; }
.hintbox li { margin: 2px 0; }
.drop { border: 1px dashed var(--line); border-radius: 8px; padding: 18px; text-align: center; color: var(--muted); }
.drop.over { border-color: var(--accent); background: var(--accent-weak); }
.sum { display: flex; gap: 24px; flex-wrap: wrap; margin: 12px 0; }
.sum b { display: block; font-size: 20px; }
.sum span { color: var(--muted); font-size: 12px; }
select { font: inherit; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.warn { color: #b26b00; margin: 6px 0; }
.list { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.list div { padding: 6px 12px; border-bottom: 1px solid var(--line); font-size: 13px; display: flex; gap: 10px; align-items: center; }
.list div:last-child { border-bottom: 0; }
table.wide { table-layout: auto; }
.group { margin: 20px 0 6px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.sub { margin: 10px 0 2px 4px; color: var(--muted); font-size: 13px; }
td.num, th.num { text-align: right; white-space: nowrap; }
.chip { display: inline-block; padding: 0 8px; margin-right: 4px; border-radius: 10px; font-size: 12px; line-height: 20px; background: var(--accent-weak); color: var(--accent); }
.chip.claim { background: #e8fff3; color: var(--ok); }
.overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; text-align: center; background: rgba(51,112,255,.88); color: #fff; border: 4px dashed #fff; }
.overlay[hidden] { display: none; }
.overlay .big { font-size: 32px; font-weight: 600; margin-bottom: 8px; }
