:root {
  --bg: #0f1115; --surface: #171a21; --raised: #1e222b; --line: #2a303b;
  --ink: #e8eaf0; --muted: #9aa3b2; --accent: #6ea8fe; --ok: #4cc38a; --warn: #f0b429; --err: #f2666b;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--ink); font-size: 17px; }
.top nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.top nav a { padding: 5px 10px; border-radius: 7px; color: var(--muted); white-space: nowrap; }
.top nav a[aria-current="page"] { background: var(--raised); color: var(--ink); }
.top nav a:hover { text-decoration: none; color: var(--ink); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--err); }

main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 80px; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 20px 0 10px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.stack > * + * { margin-top: 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
input.grow { flex: 1 1 220px; }

button, .btn { font: inherit; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--raised); color: var(--ink); cursor: pointer; }
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: #0b0d11; font-weight: 600; }
button.danger { color: var(--err); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); outline: none; }
label.check { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border: 1px solid var(--line); border-radius: 99px; cursor: pointer; }
label.check input { accent-color: var(--accent); }

.list a.item { display: block; color: inherit; }
.list a.item:hover { text-decoration: none; border-color: var(--muted); }
.item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chip { font-size: 12px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.ready, .chip.queued, .chip.running, .chip.accepted { color: var(--accent); border-color: var(--accent); }
.chip.published { color: var(--ok); border-color: var(--ok); }
.chip.failed, .chip.attention, .chip.unconfirmed { color: var(--err); border-color: var(--err); }
.chip.skip, .chip.canceled, .chip.removed { opacity: .6; }

.editor { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 860px) { .editor { grid-template-columns: 1fr; } }
textarea.source { width: 100%; min-height: 60vh; resize: vertical; font: 14px/1.55 Consolas, "Cascadia Mono", monospace; tab-size: 2; }
.net { border-top: 1px solid var(--line); padding-top: 10px; }
.net:first-child { border-top: 0; padding-top: 0; }
.meter { height: 4px; background: var(--raised); border-radius: 2px; overflow: hidden; margin: 6px 0; }
.meter > i { display: block; height: 100%; background: var(--ok); }
.meter.over > i { background: var(--err); }
.issue { font-size: 13px; margin: 2px 0; }
.issue.error { color: var(--err); } .issue.warning { color: var(--warn); }
.media { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.media .file { background: var(--raised); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; font-size: 12px; }
.media .file img, .media .file .ph { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #0b0d11; }
.media .file .ph { display: grid; place-items: center; color: var(--muted); font-size: 22px; }
.media .file .meta { padding: 6px 8px; word-break: break-all; }
.drop { border: 1px dashed var(--line); border-radius: 10px; padding: 14px; text-align: center; color: var(--muted); }
.drop.over { border-color: var(--accent); color: var(--ink); }
.progress { font-size: 13px; }
.progress progress { width: 100%; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { color: var(--muted); font-weight: 500; }
td.actions { white-space: nowrap; }
td.actions button { padding: 3px 9px; font-size: 13px; }
.scroll { overflow-x: auto; }

dialog { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 18px; max-width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .6); }

#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--raised); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; max-width: calc(100vw - 32px); opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.show { opacity: 1; }
#toast.err { border-color: var(--err); }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
@media (max-width: 600px) { .top { gap: 10px; padding: 8px 12px; } main { padding: 14px 12px 60px; } .hide-sm { display: none; } }
