:root {
  --bg: #f5f6f8; --card: #fff; --ink: #14202e; --muted: #687587; --line: #e3e7ed;
  --brand: #f5b301; --brand-ink: #0b1f3a; --ok: #1f9d55; --warn: #c77700; --bad: #d64545; --info: #2f6fd6;
  --r: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--ink); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--bad); min-height: 1.2em; }
h1, h2, h3 { margin: 0 0 8px; }
h2 { font-size: 18px; } h3 { font-size: 15px; }
a { color: var(--info); }

.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; }
.btn:hover { border-color: #c7ced8; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.bad { color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.sm { padding: 5px 10px; font-size: 12px; }

input, textarea, select { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; color: var(--ink); }
textarea { resize: vertical; min-height: 70px; }
label { display: block; font-weight: 600; font-size: 12px; color: #3b4757; margin: 10px 0 4px; }
label > input, label > textarea, label > select { margin-top: 4px; font-weight: 400; }

.brand-mark { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); font-weight: 800; }
.brand-mark.sm { width: 28px; height: 28px; border-radius: 7px; font-size: 12px; }

.login { min-height: 100vh; display: grid; place-items: center; }
.login-card { background: #fff; padding: 32px; border-radius: 14px; width: 340px; box-shadow: 0 8px 30px rgba(0,0,0,.06); }
.login-card .btn { width: 100%; margin-top: 16px; padding: 10px; }

.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 18px; padding: 10px 20px; background: #fff; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.topbar .logo { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.topbar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topbar nav button { background: none; border: 0; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted); }
.topbar nav button.active { background: #fff6dc; color: var(--brand-ink); }
.topbar .right { display: flex; align-items: center; gap: 10px; }
.count { background: var(--brand); color: var(--brand-ink); border-radius: 10px; padding: 0 7px; font-size: 11px; margin-left: 4px; }
.count:empty { display: none; }

main { padding: 20px; max-width: 1400px; margin: 0 auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; cursor: pointer; transition: box-shadow .15s; }
.card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.07); }
.card .thumb { aspect-ratio: 1; background: #e9edf2 center/cover no-repeat; display: grid; place-items: center; color: var(--muted); }
.card .body { padding: 10px 12px; }
.card .title { font-weight: 700; margin: 4px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); background: #fff; border: 1px dashed var(--line); border-radius: var(--r); }

.chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; text-transform: uppercase; letter-spacing: .02em; }
.chip.draft { background: #fff3cd; color: #8a6100; }
.chip.generating, .chip.publishing { background: #e3edfd; color: var(--info); }
.chip.scheduled { background: #ede7fb; color: #6a3fc7; }
.chip.published { background: #ddf3e6; color: var(--ok); }
.chip.partial { background: #fdebd3; color: var(--warn); }
.chip.failed { background: #fbe1e1; color: var(--bad); }
.chip.rejected { background: #eceff3; color: var(--muted); }

.spinner { width: 28px; height: 28px; border: 3px solid #cfd6df; border-top-color: var(--brand); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal { position: fixed; inset: 0; background: rgba(15, 23, 35, .55); z-index: 20; display: flex; align-items: flex-start; justify-content: center; padding: 24px; overflow: auto; }
.modal-box { background: #fff; border-radius: 14px; width: min(1180px, 100%); padding: 20px; position: relative; }
.modal-box.narrow { width: min(520px, 100%); }
.modal-close { position: absolute; top: 12px; right: 12px; }

.editor { display: grid; grid-template-columns: minmax(300px, 460px) 1fr; gap: 24px; }
@media (max-width: 900px) { .editor { grid-template-columns: 1fr; } }
.poster { width: 100%; border-radius: 10px; border: 1px solid var(--line); display: block; background: #e9edf2; aspect-ratio: 1; object-fit: cover; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.section { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.section h3 { display: flex; justify-content: space-between; align-items: center; }
.ptabs { display: flex; gap: 4px; margin-bottom: 8px; flex-wrap: wrap; }
.ptabs button { border: 1px solid var(--line); background: #fff; padding: 5px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 600; }
.ptabs button.active { background: var(--brand-ink); color: #fff; border-color: var(--brand-ink); }
.counter { font-size: 12px; text-align: right; color: var(--muted); }
.counter.over { color: var(--bad); font-weight: 700; }
.checks { display: flex; gap: 14px; flex-wrap: wrap; }
.checks label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; }
.checks input { width: auto; }
.notice { background: #fff8e6; border: 1px solid #f3dd9b; padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }
.notice.bad { background: #fdeeee; border-color: #f2c4c4; color: #8f2424; white-space: pre-wrap; }
.log { font-size: 12px; color: var(--muted); max-height: 160px; overflow: auto; }
.log div { padding: 3px 0; border-bottom: 1px dashed var(--line); }

.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); }
.scroll { max-height: 320px; overflow: auto; }
.logo-preview { max-height: 60px; max-width: 220px; background: #f2f4f7; padding: 6px; border-radius: 6px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--bad); }
.status-dot.on { background: var(--ok); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--brand-ink); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 40; max-width: 90vw; }
.toast.bad { background: var(--bad); }
