:root {
  --bg: #0a0a0a;
  --s1: #111111;
  --s2: #161616;
  --s3: #1c1c1c;
  --border: #262626;
  --border-2: #333333;
  --text: #ededed;
  --muted: #8f8f8f;
  --faint: #5e5e5e;
  --blue: #3b82f6;
  --green: #22c55e;
  --amber: #f5a524;
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.12);
  --ring: 0 0 0 1px #0a0a0a, 0 0 0 3px rgba(255, 255, 255, 0.28);
  --r: 8px;
  --r-lg: 12px;
  --sans: Inter, "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --side: 240px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
b, strong { font-weight: 600; }
.mono, code, pre { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
[hidden] { display: none !important; }
::selection { background: rgba(59, 130, 246, 0.35); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
svg.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side); display: flex; flex-direction: column;
  background: var(--bg); border-right: 1px solid var(--border); padding: 14px 10px; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.logo { width: 26px; height: 26px; border-radius: 7px; background: #fff; color: #000; display: grid; place-items: center; flex: none; }
.logo svg { width: 13px; height: 13px; }
.brand-name { font-weight: 600; letter-spacing: -0.01em; font-size: 15px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; flex: none; }
.brand .dot { margin-left: auto; }
.dot.ok { background: var(--green); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15); }
.dot.busy { background: var(--blue); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18); }
.dot.bad { background: var(--red); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18); }
#nav { display: flex; flex-direction: column; gap: 2px; }
#nav a {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 6px;
  color: var(--muted); font-size: 13.5px; transition: background .15s, color .15s; white-space: nowrap;
}
#nav a:hover { background: var(--s2); color: var(--text); }
#nav a.on { background: var(--s3); color: var(--text); }
#nav a:focus-visible { outline: none; box-shadow: var(--ring); }
.nav-badge { margin-left: auto; font: 11px var(--mono); color: var(--muted); background: var(--s2); border: 1px solid var(--border); padding: 0 6px; border-radius: 20px; }
.nav-badge:empty { display: none; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.run-ind { border: 1px solid var(--border); background: var(--s1); border-radius: var(--r); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.meter { height: 4px; border-radius: 4px; background: var(--border); overflow: hidden; margin-top: 8px; }
.meter > span { display: block; height: 100%; width: 0; background: var(--blue); transition: width 0.4s ease; }
.meter.indet > span { width: 35% !important; animation: meter-slide 1.2s ease-in-out infinite; }
@keyframes meter-slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.dl-note { display: block; border: 1px solid var(--border); background: var(--s1); border-radius: var(--r); padding: 10px; font-size: 12px; color: var(--muted); text-decoration: none; }
.dl-note.err { border-color: rgba(239, 68, 68, 0.4); color: #f87171; }
.dl-note .meter { margin-top: 6px; }
.run-ind.stopping { border-color: rgba(239, 68, 68, 0.4); }
.run-top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; overflow: hidden; }
.run-top .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-bottom { display: flex; align-items: center; justify-content: space-between; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); flex: none; animation: pulse 1.6s infinite; }
.stopping .pulse { background: var(--red); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, .55); } 70% { box-shadow: 0 0 0 7px rgba(59, 130, 246, 0); } 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); } }
.side-meta { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; font-size: 12px; }
.side-meta form { margin: 0; }

main { flex: 1; margin-left: var(--side); min-width: 0; padding: 32px 40px 96px; }
.view { display: none; max-width: 1240px; margin: 0 auto; animation: fade .18s ease; }
.view.on { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.page-head h1 { margin: 0 0 4px; font-size: 24px; font-weight: 600; letter-spacing: -0.025em; }
.page-head p { margin: 0; color: var(--muted); font-size: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- cards */
.card { background: var(--s1); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 20px; margin-bottom: 16px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; min-height: 28px; flex-wrap: wrap; }
.card-head.pad { padding: 14px 18px; margin: 0; border-bottom: 1px solid var(--border); }
.card h3 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.005em; }
.card .desc { margin: -6px 0 14px; color: var(--muted); font-size: 13px; }
.card-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); align-items: center; flex-wrap: wrap; }
.card-foot.spread { justify-content: space-between; }
.cards-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.cards-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; margin-bottom: 16px; }
.cards-2 > .card, .cards-3 > .card { margin: 0; }
.cards-2 { margin-bottom: 16px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-gap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- overview */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 16px; }
.stat { background: var(--s1); padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-height: 148px; min-width: 0; }
.stat-label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat-value { font-size: 18px; font-weight: 600; letter-spacing: -0.015em; min-height: 28px; display: flex; align-items: center; }
.stat-sub { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-actions { margin-top: auto; padding-top: 8px; display: flex; gap: 8px; align-items: center; }
.stat-job.running { background: linear-gradient(180deg, rgba(59, 130, 246, 0.07), transparent 70%), var(--s1); }
.stat-job.stopping { background: linear-gradient(180deg, rgba(239, 68, 68, 0.08), transparent 70%), var(--s1); }
.elapsed { font-family: var(--mono); font-size: 13px; color: var(--muted); margin-left: 10px; font-weight: 400; }
.split { display: grid; grid-template-columns: minmax(260px, 1fr) 2.2fr; gap: 16px; align-items: stretch; }
.split > .card { margin: 0; display: flex; flex-direction: column; min-height: 0; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-top: 1px solid var(--border); font-size: 13px; min-width: 0; }
.list-item:first-child { border-top: 0; }
.list-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .id { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.terminal {
  margin: 0; flex: 1; min-height: 340px; max-height: 460px; overflow: auto; background: #050505; border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px 14px; line-height: 1.6; color: #d4d4d4; white-space: pre-wrap; word-break: break-word;
}
.terminal .ln { display: block; }
.terminal .t { color: #555; margin-right: 8px; }
.terminal .j { color: #60a5fa; margin-right: 6px; }
.terminal .er { color: #f87171; }
.terminal .ok { color: #4ade80; }
.terminal .wr { color: #fbbf24; }
.terminal .empty-log { color: var(--faint); }

/* ---------- empty / skeleton */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 28px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.empty-title { color: var(--text); font-weight: 500; font-size: 13.5px; }
.skel { height: 14px; border-radius: 4px; background: linear-gradient(90deg, #161616 25%, #1f1f1f 50%, #161616 75%); background-size: 200% 100%; animation: skel 1.2s infinite linear; margin: 10px 0; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  font: 500 13.5px var(--sans); color: var(--text); background: var(--s2); border: 1px solid var(--border);
  border-radius: 7px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, opacity .15s, transform .05s;
}
.btn:hover { background: #1f1f1f; border-color: var(--border-2); }
.btn:active { transform: translateY(0.5px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: #ededed; color: #0a0a0a; border-color: #ededed; }
.btn.primary:hover { background: #fff; border-color: #fff; }
.btn.danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn.danger:hover { background: #dc2626; border-color: #dc2626; }
.btn.danger-ghost { background: transparent; color: #f87171; border-color: transparent; }
.btn.danger-ghost:hover { background: var(--red-bg); }
.btn.warn { color: var(--amber); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--s2); color: var(--text); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 6px; }
.btn.xs { height: 24px; padding: 0 8px; font-size: 12px; border-radius: 5px; }
.btn.lg { height: 38px; padding: 0 18px; }
.icon-btn { padding: 0 6px; }
.icon-btn span { display: none; }
.spin { width: 12px; height: 12px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot .6s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- inputs */
.input, .table.edit input:not([type=checkbox]), .table.edit select {
  height: 34px; width: 100%; padding: 0 10px; background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 7px; font: 13.5px var(--sans); transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.input.mono { font-family: var(--mono); font-size: 12.5px; }
.input.sm { height: 28px; font-size: 12.5px; width: auto; min-width: 150px; border-radius: 6px; }
.input.narrow, .field.narrow { max-width: 110px; min-width: 0; }
.input.file { padding: 5px 6px; height: auto; color: var(--muted); }
.input.file::file-selector-button { font: 500 12.5px var(--sans); color: var(--text); background: var(--s2); border: 1px solid var(--border); border-radius: 5px; padding: 3px 10px; margin-right: 10px; cursor: pointer; }
.input:hover, .table.edit input:not([type=checkbox]):hover, .table.edit select:hover { border-color: var(--border-2); }
.input:focus, .table.edit input:focus, .table.edit select:focus { outline: none; border-color: #555; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.07); }
select.input, .table.edit select {
  appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238f8f8f' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
::placeholder { color: var(--faint); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; flex: 1; min-width: 0; }
.field > label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.field-row { display: flex; gap: 10px; }
.field-switch { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); }
.fs-title { font-weight: 500; font-size: 13.5px; }
.fs-desc { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.inline-switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }

/* switch */
.switch { position: relative; display: inline-block; width: 32px; height: 18px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: #2a2a2a; border: 1px solid #3a3a3a; border-radius: 20px; transition: background .18s, border-color .18s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #a1a1a1; transition: transform .18s, background .18s; }
.switch input:checked + span { background: #ededed; border-color: #ededed; }
.switch input:checked + span::after { transform: translateX(14px); background: #0a0a0a; }
.switch input:focus-visible + span { box-shadow: var(--ring); }
.switch input:disabled + span { opacity: .45; }
.switch.lg { width: 38px; height: 22px; }
.switch.lg span::after { width: 16px; height: 16px; }
.switch.lg input:checked + span::after { transform: translateX(16px); }

/* segmented */
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 2px; gap: 2px; }
.seg button { height: 26px; padding: 0 12px; border: 0; background: transparent; color: var(--muted); font: 500 12.5px var(--sans); border-radius: 6px; cursor: pointer; transition: background .15s, color .15s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--s3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-2); }
.seg button:focus-visible { outline: none; box-shadow: var(--ring); }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 20px; font: 500 12px var(--sans); border: 1px solid var(--border); background: var(--s2); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.green { color: #4ade80; background: rgba(34, 197, 94, 0.1); border-color: rgba(34, 197, 94, 0.25); }
.pill.blue { color: #60a5fa; background: rgba(59, 130, 246, 0.1); border-color: rgba(59, 130, 246, 0.28); }
.pill.red { color: #f87171; background: var(--red-bg); border-color: rgba(239, 68, 68, 0.3); }
.pill.amber { color: #fbbf24; background: rgba(245, 165, 36, 0.1); border-color: rgba(245, 165, 36, 0.28); }
.pill.grey { color: #a1a1a1; }
.pill.beat::before { animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .3; } }

/* tables */
.table-wrap { overflow: auto; max-height: 560px; }
.table-wrap.tall { max-height: calc(100vh - 250px); min-height: 200px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th { position: sticky; top: 0; z-index: 2; background: var(--s1); text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.table tbody tr:last-child td { border-bottom: 0; }
.card:not(.flush) .table th { background: var(--s1); }
.card:not(.flush) .table td:first-child, .card:not(.flush) .table th:first-child { padding-left: 0; }
.table td.c, .table th.c { text-align: center; }
.table .nowrap { white-space: nowrap; }
.table td.r, .table th.r { text-align: right; }
.table code { color: #b5b5b5; }
.table .q { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--border-2); font-size: 9.5px; color: var(--faint); margin-left: 3px; cursor: help; vertical-align: 1px; }
.table th .th-in { display: inline-flex; align-items: center; gap: 4px; }
.table th .bulk { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-weight: 400; font-size: 11.5px; color: var(--faint); cursor: pointer; }
.table.edit input:not([type=checkbox]), .table.edit select { height: 30px; background: transparent; border-color: transparent; font-size: 13px; }
.table.edit tr:hover input:not([type=checkbox]), .table.edit tr:hover select { border-color: var(--border); }
.table.edit input:focus, .table.edit select:focus { background: var(--bg) !important; }
.table.edit .name-in { font-weight: 500; }
.table tr.off td { opacity: .5; }
.table tr.off td:last-child { opacity: 1; }
.table .clip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.table tr.running { background: rgba(59, 130, 246, 0.06); }
.rowmsg { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; min-width: 64px; }
.rowmsg.good { color: #4ade80; }
.rowmsg.bad { color: #f87171; }

/* posting / settings bits */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.steps { margin: 0 0 14px; padding: 0; list-style: none; display: flex; gap: 8px; flex-wrap: wrap; counter-reset: s; }
.steps li { counter-increment: s; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; padding-right: 8px; }
.steps li::before { content: counter(s); width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--border-2); display: grid; place-items: center; font-size: 11px; color: var(--text); }
.live { border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--s1); min-height: 300px; display: grid; }
.clip-text { width: 100%; min-height: 70px; resize: vertical; margin: 6px 0 10px; font-family: inherit; }
.live iframe { width: 100%; height: 72vh; border: 0; background: #000; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 12px; }
.thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }

.settings { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; align-items: start; }
.subnav { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 2px; }
.subnav button { display: flex; justify-content: space-between; align-items: center; text-align: left; height: 32px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font: 13.5px var(--sans); cursor: pointer; transition: background .15s, color .15s; }
.subnav button:hover { background: var(--s2); color: var(--text); }
.subnav button.on { background: var(--s3); color: var(--text); }
.subnav button:focus-visible { outline: none; box-shadow: var(--ring); }
.subnav .badge { font: 11px var(--mono); color: var(--amber); }
.set-group { scroll-margin-top: 24px; }
.set-group .card-head { margin-bottom: 4px; }
.opt { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 24px; align-items: center; padding: 14px 0; border-top: 1px solid var(--border); position: relative; }
.opt:first-of-type { border-top: 0; }
.opt.wide { grid-template-columns: 1fr; gap: 8px; }
.opt .lbl { font-size: 13.5px; font-weight: 500; }
.opt .help { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.opt .key { font: 11px var(--mono); color: var(--faint); margin-left: 6px; }
.opt .ctl { display: flex; justify-content: flex-end; }
.opt.dirty::before { content: ""; position: absolute; left: -20px; top: 14px; bottom: 14px; width: 2px; border-radius: 2px; background: var(--amber); }
.save-bar {
  position: fixed; left: calc(var(--side) + 50%); bottom: 20px; transform: translate(-50%, 140%); display: flex; align-items: center; gap: 10px;
  background: var(--s2); border: 1px solid var(--border-2); border-radius: 10px; padding: 8px 8px 8px 16px; z-index: 30;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .6); transition: transform .25s cubic-bezier(.2, .8, .2, 1), opacity .2s; opacity: 0; pointer-events: none;
}
.save-bar.has { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.save-bar #save-count { font-size: 13px; margin-right: 8px; color: var(--amber); }
#main .save-bar { left: calc(var(--side) / 2 + 50%); }

/* drawer + modal */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer-bg, .modal { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px); }
.drawer-bg { position: absolute; inset: 0; animation: fadein .15s; }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: 400px; max-width: 100%; background: var(--s1); border-left: 1px solid var(--border); padding: 20px 22px; animation: slidein .2s cubic-bezier(.2, .8, .2, 1); overflow: auto; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.drawer-head h2, .modal h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.drawer .lead { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.drawer .card-foot { margin-top: 20px; }
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadein { from { opacity: 0; } }
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; animation: fadein .12s; }
.modal-box { width: 420px; max-width: calc(100% - 32px); background: var(--s1); border: 1px solid var(--border-2); border-radius: var(--r-lg); padding: 22px 22px 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); animation: pop .16s cubic-bezier(.2, .8, .2, 1); }
.modal-box p { color: var(--muted); font-size: 13.5px; margin: 8px 0 20px; white-space: pre-line; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }

/* toasts */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; min-width: 260px; max-width: 380px; padding: 12px 14px;
  background: var(--s2); border: 1px solid var(--border-2); border-radius: 10px; font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  animation: toastin .22s cubic-bezier(.2, .8, .2, 1); transition: opacity .2s, transform .2s;
}
.toast.out { opacity: 0; transform: translateY(6px); }
.toast .ti { width: 16px; height: 16px; border-radius: 50%; flex: none; margin-top: 1px; display: grid; place-items: center; background: #ededed; color: #000; }
.toast.bad .ti { background: var(--red); color: #fff; }
.toast .ti svg { width: 10px; height: 10px; stroke-width: 3; }
@keyframes toastin { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* login */
body.login { display: grid; place-items: center; min-height: 100vh; background: radial-gradient(ellipse 80% 50% at 50% -10%, #1a1a1a, var(--bg)); }
.login-box { width: 360px; max-width: calc(100% - 32px); }
.login-box .logo { width: 40px; height: 40px; border-radius: 10px; margin: 0 auto 20px; }
.login-box .logo svg { width: 19px; height: 19px; }
.login-box h1 { text-align: center; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 6px; }
.login-box .sub { text-align: center; color: var(--muted); margin: 0 0 24px; font-size: 14px; }
.login-box form { background: var(--s1); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.login-box .btn { width: 100%; height: 38px; }
.login-box .err { background: var(--red-bg); color: #fca5a5; border: 1px solid rgba(239, 68, 68, .3); padding: 8px 12px; border-radius: 7px; font-size: 13px; }

/* responsive */
@media (max-width: 1100px) {
  :root { --side: 60px; }
  .sidebar { padding: 14px 8px; align-items: center; }
  .brand { padding: 4px 0 18px; justify-content: center; }
  .brand-name, .brand .dot { display: none; }
  .logo { position: relative; }
  #nav a { width: 40px; padding: 0; justify-content: center; font-size: 0; gap: 0; position: relative; }
  #nav a .nav-badge { position: absolute; top: -2px; right: -4px; font-size: 9.5px; padding: 0 4px; }
  .run-ind { padding: 6px; align-items: center; }
  .dl-note { padding: 6px; width: 44px; }
  #dl-label { display: none; }
  .run-top .mono, .run-bottom .mono { display: none; }
  .run-ind .btn { padding: 0 6px; font-size: 11px; }
  .side-meta { flex-direction: column; gap: 6px; }
  #side-version { display: none; }
  main { padding: 24px 24px 96px; }
  .stats, .cards-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .cards-2 { grid-template-columns: 1fr; }
  .opt { grid-template-columns: 1fr 200px; }
}
@media (max-width: 720px) {
  .stats, .cards-3 { grid-template-columns: 1fr; }
  .settings { grid-template-columns: 1fr; }
  .subnav { position: static; flex-direction: row; flex-wrap: wrap; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .opt { grid-template-columns: 1fr; }
  .opt .ctl { justify-content: flex-start; }
  main { padding: 20px 14px 96px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
#jobs-table td:last-child, #jobs-table th:last-child { position: sticky; right: 0; background: var(--s1); }
#jobs-table tr.running td:last-child { background: linear-gradient(rgba(59, 130, 246, 0.06), rgba(59, 130, 246, 0.06)), var(--s1); }
#jobs-table th:last-child { z-index: 3; }

.upload-box { border: 1px solid var(--border); background: var(--s1); border-radius: var(--r); padding: 12px; margin: 4px 0 14px; }
.upload-box .meter { margin: 8px 0; }
.upload-box .meter > span { transition: width 0.2s linear; }
.upload-box.done .meter > span { background: var(--green, #22c55e); }
.upload-box.err .meter > span { background: #ef4444; }
.upload-line { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
#mp-summary { margin-top: 8px; line-height: 1.6; }
#mp-summary b { font-weight: 600; }
#media-card.drop { outline: 2px dashed var(--blue); outline-offset: -6px; }

/* overview: live screen on its own row, queue + log below */
.ov-live-card { display: flex; flex-direction: column; margin-bottom: 16px; }
.ov-live-card h3, .ov-grid h3 { display: flex; align-items: center; gap: 8px; }
.ov-live { position: relative; aspect-ratio: 16 / 9; max-height: 68vh; min-height: 240px; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: #050505; display: grid; }
.ov-live iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.ov-live .empty { align-self: center; }
.ov-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: stretch; margin-bottom: 16px; }
.ov-grid > .card { margin: 0; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.ov-grid .queue-card .list { flex: 1 1 0; min-height: 120px; max-height: 420px; overflow: auto; }
.ov-grid .terminal { min-height: 0; max-height: none; }
.ov-grid .logs-card .terminal { flex: 1 1 0; min-height: 320px; max-height: 420px; }

.log-title { margin: 0; display: flex; align-items: center; gap: 6px; }
.btn.xs.log-toggle { width: 28px; height: 28px; min-width: 28px; padding: 0; justify-content: center; align-items: center; border-radius: 8px; color: var(--text); margin-left: -6px; }
.btn.log-toggle:hover { background: rgba(255,255,255,.08); }
.log-toggle:focus-visible { outline: 2px solid var(--accent, #60a5fa); outline-offset: 1px; }
.log-toggle svg.chev { width: 16px; height: 16px; display: block; transition: transform .18s ease; }
.log-last { display: none; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
.log-last .t { color: #555; margin-right: 8px; }
.log-last.er { color: #f87171; } .log-last.ok { color: #4ade80; } .log-last.wr { color: #fbbf24; }
.ov-grid[data-log="collapsed"] { grid-template-columns: 1fr; }
.ov-grid[data-log="collapsed"] .logs-card { padding-top: 8px; padding-bottom: 8px; }
.ov-grid[data-log="collapsed"] .logs-card .card-head { margin: 0; flex-wrap: nowrap; }
.ov-grid[data-log="collapsed"] .logs-card .terminal,
.ov-grid[data-log="collapsed"] .logs-card .toolbar { display: none; }
.ov-grid[data-log="collapsed"] .log-last { display: block; }
.ov-grid[data-log="collapsed"] .log-toggle .chev { transform: rotate(-90deg); }
@media (max-width: 900px) { .ov-grid { grid-template-columns: 1fr; } }
#view-live .page-head { align-items: center; }
#view-live .actions { align-items: center; }
#view-live .actions .input { width: auto; min-width: 140px; }
.head-steps { margin: 6px 0 0; }
.actions-sep { width: 1px; align-self: stretch; background: var(--border); margin: 2px 4px; }
@media (min-width: 1200px) { #view-live .actions { flex-wrap: nowrap; flex-shrink: 0; } #view-live .page-head > div:first-child { min-width: 0; } }

/* ---------- proxy helper */
.pbanner {
  display: flex; align-items: center; gap: 14px; max-width: 1240px; margin: 0 auto 20px; padding: 12px 14px 12px 16px;
  border: 1px solid rgba(239, 68, 68, .35); border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(239, 68, 68, .10), rgba(239, 68, 68, .05)); animation: fade .18s ease;
}
.pbanner-icon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--red-bg); color: #f87171; }
.pbanner-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pbanner-text b { font-size: 13.5px; }
.pbanner-text span { color: #fca5a5; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbanner-actions { display: flex; gap: 8px; flex: none; }
@media (max-width: 760px) { .pbanner { flex-wrap: wrap; } .pbanner-actions { width: 100%; } .pbanner-actions .btn { flex: 1; } }

.hdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; margin-right: 7px; vertical-align: 1px; background: var(--faint); }
.hdot.ok { background: var(--green); box-shadow: 0 0 0 3px rgba(34, 197, 94, .15); }
.hdot.bad { background: var(--red); box-shadow: 0 0 0 3px rgba(239, 68, 68, .15); }
.hdot.amber { background: var(--amber); box-shadow: 0 0 0 3px rgba(245, 165, 36, .15); }
#helper-sub { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pgate-box { width: 480px; text-align: center; padding: 28px 26px 18px; }
.pgate-box h2 { font-size: 18px; letter-spacing: -0.02em; }
.pgate-box > p { margin: 8px auto 20px; max-width: 380px; }
.pgate-glyph { width: 44px; height: 44px; margin: 0 auto 14px; border-radius: 12px; display: grid; place-items: center; background: var(--red-bg); color: #f87171; border: 1px solid rgba(239, 68, 68, .3); }
.pgate-glyph svg { width: 22px; height: 22px; }
.pgate-cta { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.pgate-cta .btn { width: 100%; justify-content: center; height: 40px; font-size: 14px; }
.pgate-status { min-height: 20px; font-size: 13px; color: var(--muted); margin: 4px 0 10px; }
.pgate-hint { font-size: 12px; color: var(--faint); margin: 0 0 18px; }
.pgate-note { text-align: left; font-size: 13px; color: var(--muted); background: var(--bg); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; margin-bottom: 16px; line-height: 1.55; }
.pgate-box .modal-foot { border-top: 1px solid var(--border); padding-top: 14px; align-items: center; }
.modal-foot .grow { flex: 1; }

.drawer-panel.wide { width: 560px; }
.hp-status { display: flex; align-items: flex-start; gap: 4px; padding: 14px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); margin: 10px 0 12px; }
.hp-status .hdot { margin-top: 6px; }
.hp-status div { display: flex; flex-direction: column; min-width: 0; }
.hp-status span { color: var(--muted); font-size: 12.5px; }
.hp-use { margin-bottom: 18px; }
.hp-tabs { display: flex; width: 100%; margin-bottom: 16px; }
.hp-tabs button { flex: 1; }
.hp-actions { display: flex; gap: 8px; margin-bottom: 14px; }
.hp-actions .btn { flex: 1; justify-content: center; height: 36px; }
.hp-steps { margin: 0 0 16px; padding-left: 20px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.hp-steps li { margin-bottom: 6px; padding-left: 2px; }
.hp-steps b { color: var(--text); font-weight: 500; }
.hp-label { font-size: 12px; color: var(--muted); font-weight: 500; margin: 14px 0 6px; }
.code-box { display: flex; align-items: center; gap: 6px; background: #050505; border: 1px solid var(--border); border-radius: var(--r); padding: 8px 8px 8px 12px; }
.code-box code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; color: #d4d4d4; font-size: 12px; scrollbar-width: thin; }
.code-box .btn { flex: none; }
.hp-row { display: flex; gap: 8px; }
.hp-row .input { flex: 1; min-width: 0; }
.hp-result { min-height: 20px; font-size: 13px; color: var(--muted); margin: 10px 0 6px; }
.hp-pair { margin-top: 22px; border-top: 1px solid var(--border); padding-top: 14px; }
.hp-pair summary { cursor: pointer; font-size: 13px; font-weight: 500; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 6px; }
.hp-pair summary::before { content: "›"; display: inline-block; transition: transform .15s; font-size: 16px; line-height: 1; }
.hp-pair[open] summary::before { transform: rotate(90deg); }
.hp-pair summary:hover { color: var(--text); }
.kv { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 12.5px; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.kv td { padding: 6px 10px; border-bottom: 1px solid var(--border); color: var(--text); }
.kv tr:last-child td { border-bottom: 0; }
.kv td:first-child { color: var(--muted); width: 38%; background: var(--bg); }
.hdot.beat { animation: blink 1.2s infinite; }
.hp-you { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--blue, #3b82f6); margin-left: 6px; vertical-align: 2px; }

/* sticky-IP banner */
.ipbanner { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.ipbanner[hidden] { display: none; }
.ipb-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid rgba(245, 165, 36, .35); background: rgba(245, 165, 36, .07); border-radius: var(--r-lg); }
.ipb-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ipb-text b { font-size: 13.5px; }
.ipb-text > span { color: var(--muted); font-size: 12.5px; }
@media (max-width: 760px) { .ipb-row { flex-wrap: wrap; } .ipb-row .btn { width: 100%; } }

/* exit pool */
#pool-box { margin: 10px 0 22px; }
.pool-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.pool-head > div { display: flex; flex-direction: column; gap: 2px; }
.pool-add { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: 8px; margin-bottom: 10px; }
.pool-add[hidden] { display: none; }
.pool-list, .acc-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--bg); }
.pool-row { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-top: 1px solid var(--border); transition: background .15s; }
.pool-row:first-child, .acc-row:first-child { border-top: 0; }
.pool-row:hover { background: rgba(255, 255, 255, .025); }
.pool-row.active { box-shadow: inset 2px 0 0 var(--green); }
.pool-row.off .pool-main { opacity: .5; }
.pool-row.dragging { opacity: .4; }
.pool-grip { color: var(--faint); cursor: grab; font-size: 11px; letter-spacing: -2px; user-select: none; }
.pool-prio { width: 18px; height: 18px; border-radius: 5px; border: 1px solid var(--border); font-size: 11px; display: grid; place-items: center; color: var(--muted); flex: none; }
.pool-row .hdot { margin-right: 0; }
.pool-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pool-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pool-name b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pool-name .tag { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; white-space: nowrap; }
.pool-meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pool-meta .sep { font-style: normal; margin: 0 6px; color: var(--faint); }
.pool-ctl { display: flex; align-items: center; gap: 2px; flex: none; }
.pool-ctl .switch { margin-left: 8px; }
.ib { width: 26px; height: 26px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; display: grid; place-items: center; }
.ib:hover:not(:disabled) { background: rgba(255, 255, 255, .07); color: var(--text); }
.ib.danger:hover { color: #f87171; }
.ib:disabled { opacity: .25; cursor: default; }
.pool-empty { padding: 18px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--r); font-size: 13px; }
.acc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-top: 1px solid var(--border); }
.acc-row > div { display: flex; flex-direction: column; min-width: 0; }
.acc-row .field-switch { align-items: center; gap: 8px; margin: 0; padding: 0; border: 0; background: none; cursor: pointer; }
.switch.sm { width: 28px; height: 16px; }
.switch.sm span::after { width: 10px; height: 10px; }
.switch.sm input:checked + span::after { transform: translateX(12px); }
.hp-add { display: flex; flex-direction: column; gap: 2px; padding-top: 16px; border-top: 1px solid var(--border); margin-bottom: 10px; }
@media (max-width: 640px) {
  .pool-add { grid-template-columns: 1fr; }
  .pool-row { flex-wrap: wrap; }
  .pool-ctl { width: 100%; justify-content: flex-end; }
  .pool-grip { display: none; }
}
