:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #f1f3f6;
  --line: #e2e5ea;
  --text: #15181d;
  --muted: #5d6573;
  --faint: #8b93a1;
  --accent: #2f6fed;
  --accent-ink: #ffffff;
  --ok: #1f9d55;
  --warn: #b7791f;
  --bad: #d64545;
  --warn-bg: #fff8e6;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --radius: 12px;
  --font: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --panel: #171a21; --panel-2: #1e222b; --line: #2a2f3a; --text: #e8eaee;
    --muted: #a3aab7; --faint: #737b89; --accent: #5b8cff; --warn-bg: #2b2414; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --panel: #171a21; --panel-2: #1e222b; --line: #2a2f3a; --text: #e8eaee;
  --muted: #a3aab7; --faint: #737b89; --accent: #5b8cff; --warn-bg: #2b2414; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: 12px; }
.hidden, [hidden] { display: none !important; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 12px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--faint); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:disabled { opacity: .6; cursor: default; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); }
input[type=text], input[type=password], input[type=number], select {
  border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 9px 11px; min-width: 0; outline: none;
}
input:focus, select:focus { border-color: var(--accent); }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; color: var(--text); }
.brand .dot { width: 10px; height: 10px; border-radius: 3px; background: linear-gradient(135deg, var(--accent), #e4572e); }
.spacer { flex: 1; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { color: var(--ok); }
.pill.bad { color: var(--bad); }
.pill.run { color: var(--accent); }
.days { font-weight: 700; color: var(--text); }

/* ---------------- login ---------------- */
.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 360px; padding: 28px; }
.login h1 { font-size: 20px; margin-bottom: 6px; }
.login form { display: grid; gap: 10px; margin-top: 18px; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; }

/* ---------------- home ---------------- */
.wrap { max-width: 1040px; margin: 0 auto; padding: 24px 16px 60px; }
.hero h1 { font-size: 24px; letter-spacing: -.02em; }
.hero p { margin: 6px 0 18px; color: var(--muted); max-width: 680px; }
.search { display: grid; grid-template-columns: 1fr 190px auto; gap: 8px; }
.adv { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; color: var(--muted); font-size: 13px; align-items: center; }
.adv label { display: flex; gap: 6px; align-items: center; }
.adv input { width: 76px; padding: 5px 8px; }
.cands { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; margin-top: 16px; }
.cand { display: flex; gap: 12px; align-items: center; padding: 12px; cursor: pointer; text-align: left; }
.cand:hover { border-color: var(--accent); }
.cand img, .avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--panel-2); flex: none; }
.cand .n { font-weight: 600; }
.cand .s { font-size: 12px; color: var(--muted); }
.jobs { margin-top: 32px; }
.jobs h2 { font-size: 15px; margin-bottom: 10px; }
.job { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.job:last-child { border-bottom: 0; }
.job .t { font-weight: 600; }
.job .m { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job .acts { display: flex; gap: 6px; align-items: center; }
.bar { height: 4px; background: var(--panel-2); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.bar > i { display: block; height: 100%; background: var(--accent); transition: width .4s; }

/* ---------------- report ---------------- */
.rep-head { display: flex; gap: 12px; align-items: center; min-width: 0; }
.rep-head .title { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rep-head .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notice { margin: 12px 16px 0; padding: 10px 14px; border-radius: 10px; background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); font-size: 13px; }
.notice summary { cursor: pointer; font-weight: 600; }
.notice ul { margin: 8px 0 0; padding-left: 18px; }
.progress-box { margin: 12px 16px 0; padding: 12px 14px; }
.progress-box .log { font-family: var(--mono); font-size: 11px; color: var(--muted); max-height: 120px; overflow: auto; margin-top: 8px; white-space: pre-wrap; }

.layout { display: grid; grid-template-columns: minmax(340px, 420px) 1fr; gap: 16px; padding: 12px 16px 40px; align-items: start; }
.pane-left { position: sticky; top: 64px; max-height: calc(100vh - 76px); display: flex; flex-direction: column; min-width: 0; }
.list-tools { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px; border-bottom: 1px solid var(--line); align-items: center; }
.list-tools select { padding: 5px 8px; font-size: 12px; }
.list-tools .count { font-size: 12px; color: var(--muted); margin-left: auto; }
.ad-list { overflow: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; }
.ad-item { flex: none; width: 100%; display: grid; grid-template-columns: 6px 76px 1fr; gap: 10px; padding: 8px 10px 8px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); cursor: pointer; text-align: left; overflow: hidden; }
.ad-item:hover { border-color: var(--faint); }
.ad-item.sel { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.spine { width: 6px; align-self: stretch; border-radius: 0; background: var(--faint); margin: -8px 0; }
.thumb { width: 76px; height: 96px; border-radius: 6px; object-fit: cover; background: var(--panel-2); position: relative; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .ph { width: 100%; height: 100%; display: grid; place-items: center; font-size: 10px; color: var(--faint); text-align: center; padding: 4px; }
.thumb .play { position: absolute; right: 4px; bottom: 4px; background: rgba(0,0,0,.65); color: #fff; font-size: 10px; border-radius: 4px; padding: 1px 5px; }
.ad-meta { min-width: 0; display: grid; gap: 3px; align-content: start; }
.ad-meta .row1 { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.ad-meta .hl { font-weight: 600; font-size: 13px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ad-meta .pt { font-size: 12px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ad-meta .dst { font-size: 11px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pane-right { min-width: 0; }
.section { padding: 16px; margin-bottom: 16px; }
.section h2 { font-size: 15px; margin-bottom: 4px; }
.section .lead { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { padding: 12px 14px; }
.stat .v { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.stat .l { font-size: 12px; color: var(--muted); }

.ladder { display: grid; gap: 6px; }
.rung { display: grid; grid-template-columns: 6px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px 10px 0; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; overflow: hidden; background: var(--panel); }
.rung:hover { border-color: var(--faint); }
.rung .spine { margin: -10px 0; }
.rung .price { font-weight: 700; font-size: 15px; text-align: right; }
.rung .what { font-size: 13px; min-width: 0; }
.rung .what .u { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.dest-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--panel); display: flex; flex-direction: column; }
.dest-card:hover { border-color: var(--faint); }
.dest-card .top { height: 6px; }
.dest-card .shot { height: 220px; background: var(--panel-2); overflow: hidden; }
.dest-card .shot img { width: 100%; object-fit: cover; object-position: top; }
.dest-card .shot .ph { height: 100%; display: grid; place-items: center; color: var(--faint); font-size: 12px; padding: 12px; text-align: center; }
.dest-card .body { padding: 10px 12px; display: grid; gap: 4px; }
.dest-card .host { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* pair view */
.pair-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.pair { border-left: 6px solid var(--faint); border-radius: var(--radius); }
.ad-detail { display: grid; grid-template-columns: minmax(220px, 320px) 1fr; gap: 18px; padding: 16px; }
.creative video, .creative img { width: 100%; border-radius: 10px; background: #000; }
.creative .ph { aspect-ratio: 4/5; display: grid; place-items: center; background: var(--panel-2); border-radius: 10px; color: var(--muted); font-size: 13px; padding: 16px; text-align: center; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.copy { white-space: pre-wrap; font-size: 13px; background: var(--panel-2); border-radius: 8px; padding: 10px 12px; overflow-wrap: anywhere; }
.verbatim { white-space: pre-wrap; font-size: 13px; border-left: 3px solid var(--accent); padding: 6px 10px; background: var(--panel-2); border-radius: 0 8px 8px 0; overflow-wrap: anywhere; }
.subh { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 16px 0 6px; }
.frames { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.frame { font-size: 11px; }
.frame img { border-radius: 6px; width: 100%; aspect-ratio: 9/16; object-fit: cover; background: #000; }
.frame.h img { aspect-ratio: 16/9; }
.frame .ts { font-weight: 700; margin-top: 3px; }
.frame .tx { color: var(--text); }
.frame .sh { color: var(--muted); }
.cards-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.cards-row img { width: 110px; height: 110px; object-fit: cover; border-radius: 6px; flex: none; }

.divider { display: flex; align-items: center; gap: 10px; padding: 12px 16px; font-size: 13px; font-weight: 600; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); background: var(--panel-2); }
.divider .arrow { font-size: 18px; line-height: 1; }
.land-detail { display: grid; grid-template-columns: 390px 1fr; gap: 18px; padding: 16px; align-items: start; }
.phone { width: 390px; max-width: 100%; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--panel-2); }
.phone .scroll { max-height: 844px; overflow-y: auto; }
.phone .ph { height: 300px; display: grid; place-items: center; color: var(--muted); padding: 16px; text-align: center; font-size: 13px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); }
.others { padding: 16px; border-top: 1px solid var(--line); }
.others .row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.other { width: 96px; flex: none; cursor: pointer; font-size: 11px; }
.other img, .other .ph { width: 96px; height: 120px; object-fit: cover; border-radius: 6px; background: var(--panel-2); }
.other .ph { display: grid; place-items: center; color: var(--faint); }
details.more summary { cursor: pointer; color: var(--accent); font-size: 13px; margin-top: 8px; }
.tag-ai { font-size: 10px; font-weight: 700; color: var(--accent); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; margin-left: 4px; vertical-align: 1px; }

.mobile-back { display: none; }

@media (max-width: 1100px) {
  .ad-detail, .land-detail { grid-template-columns: 1fr; }
  .phone { margin: 0 auto; }
}
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; padding: 12px 16px 40px; }
  .pane-left { position: static; max-height: none; }
  .ad-list { overflow: visible; }
  body.pair-open .pane-left { display: none; }
  body:not(.pair-open) .pane-right .pair-view { display: none; }
  .search { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dt { margin-top: 6px; }
  .creative { max-width: 360px; }
}
#right { scroll-margin-top: 72px; }
