:root {
  --bg: #f5f5f2; --panel: #ffffff; --ink: #1d1d1b; --muted: #6f6f69; --line: #e4e4de; --accent: #2f6df6;
  --accent-ink: #ffffff; --good: #1f9d55; --warn: #c27c0e; --bad: #d64545; --chip: #efefea; --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #151514; --panel: #1f1f1d; --ink: #f1f1ec; --muted: #a1a19a; --line: #34342f; --chip: #2b2b28; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.logo { width: 34px; height: 34px; border-radius: 10px; background: var(--ink); color: var(--panel); display: grid; place-items: center; }
nav { display: flex; flex-direction: column; gap: 2px; }
nav a { padding: 9px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; }
nav a.active { background: var(--chip); font-weight: 600; }
.sidebar-foot { margin-top: auto; color: var(--muted); font-size: 12px; word-break: break-all; }
main { padding: 28px 32px 80px; min-width: 0; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0; }
.muted { color: var(--muted); }
.pad { padding: 24px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tab { border: 1px solid var(--line); background: var(--panel); padding: 7px 14px; border-radius: 999px; cursor: pointer; }
.tab.active { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.row { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--chip); }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.btn { border: 1px solid var(--line); background: var(--panel); padding: 7px 12px; border-radius: 10px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: default; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--chip); font-size: 12px; color: var(--muted); }
.chip.live { background: #e3f5ea; color: var(--good); }
.chip.off { background: var(--chip); }
.chip.wait { background: #fbf0dc; color: var(--warn); }
.chip.ended { background: #fbe4e4; color: var(--bad); }
@media (prefers-color-scheme: dark) { .chip.live { background: #173826; } .chip.wait { background: #3a2c12; } .chip.ended { background: #3d1c1c; } }
.switch { position: relative; width: 40px; height: 24px; border-radius: 999px; border: 0; background: var(--line); cursor: pointer; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch.on { background: var(--good); }
.switch.on::after { transform: translateX(16px); }
.empty { padding: 18px 16px; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.asset { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.asset img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--chip); display: block; }
.asset .meta { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.asset.pick { cursor: pointer; }
.asset.picked { outline: 3px solid var(--accent); }
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); margin-bottom: 16px; cursor: pointer; background: var(--panel); }
.drop.over { border-color: var(--accent); color: var(--accent); }
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
code { background: var(--chip); padding: 1px 6px; border-radius: 6px; font-size: 12px; word-break: break-all; }
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-start; justify-content: center; padding: 30px 16px; overflow-y: auto; z-index: 10; }
.dialog { background: var(--panel); border-radius: 18px; width: min(980px, 100%); padding: 22px; }
.dialog.narrow { width: min(560px, 100%); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 300px; gap: 22px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-content: start; }
.fields .full { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
input, select, textarea { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 8px 10px; font-size: 14px; color: var(--ink); width: 100%; }
textarea { resize: vertical; min-height: 60px; }
.count { align-self: flex-end; font-size: 11px; }
.count.over { color: var(--bad); }
.error { color: var(--bad); font-size: 13px; min-height: 18px; }
.dialog-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.picker { max-height: 280px; overflow-y: auto; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.picker .asset .meta { padding: 4px 6px; }
.phone { width: 280px; height: 560px; border-radius: 32px; border: 8px solid #111; background: #fafaf7; position: relative; overflow: hidden; color: #1d1d1b; margin: 0 auto; }
.phone .bar { height: 26px; }
.phone .screen-title { font-weight: 700; font-size: 18px; padding: 4px 14px 10px; }
.phone .cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 12px; }
.phone .fake { height: 120px; border-radius: 14px; background: #ecebe5; }
.phone .ad-card { border-radius: 14px; background: #fff; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.08); font-size: 11px; }
.phone .ad-card img { width: 100%; height: 72px; object-fit: cover; display: block; background: #ddd; }
.phone .ad-card div { padding: 5px 7px; }
.phone .ad-card b { display: block; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone .ad-card span { color: #888; font-size: 10px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone .banner { margin: 10px 12px; border-radius: 14px; background: #fff; display: flex; gap: 8px; align-items: center; padding: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.08); font-size: 11px; }
.phone .banner img { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; background: #ddd; }
.phone .banner .t { flex: 1; min-width: 0; }
.phone .banner b, .phone .banner span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone .banner span { color: #888; font-size: 10px; }
.phone .banner em { font-style: normal; background: #1d1d1b; color: #fff; border-radius: 999px; padding: 3px 8px; font-size: 10px; }
.phone .splash { position: absolute; inset: 0; display: flex; flex-direction: column; }
.phone .splash img { flex: 1; width: 100%; object-fit: cover; min-height: 0; background: #ddd; }
.phone .splash .foot { height: 74px; background: #fff; display: grid; place-items: center; font-weight: 700; }
.phone .splash .skip { position: absolute; top: 30px; right: 12px; background: rgba(0,0,0,.45); color: #fff; border-radius: 999px; padding: 3px 10px; font-size: 11px; }
.phone .splash .cta { position: absolute; bottom: 96px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.55); color: #fff; border-radius: 999px; padding: 8px 14px; font-size: 12px; white-space: nowrap; max-width: 90%; overflow: hidden; text-overflow: ellipsis; }
.phone .tag { color: #999; font-size: 10px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--panel); padding: 10px 18px; border-radius: 12px; z-index: 20; max-width: calc(100% - 32px); }
.slots-edit { display: flex; flex-direction: column; gap: 8px; }
.slot-line { display: grid; grid-template-columns: 1fr 1fr 130px 80px auto; gap: 8px; align-items: end; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; }
  nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { display: none; }
  main { padding: 18px 16px 60px; }
  .form-grid { grid-template-columns: 1fr; }
  .row { grid-template-columns: 52px 1fr; }
  .row .actions { grid-column: 1 / -1; justify-content: flex-start; }
  .thumb { width: 52px; height: 52px; }
  .fields { grid-template-columns: 1fr; }
  .slot-line { grid-template-columns: 1fr 1fr; }
}
[hidden] { display: none !important; }
