:root {
  color-scheme: dark;
  --bg: #0b0c0e;
  --panel: #14161a;
  --panel-2: #1b1e23;
  --line: #262a31;
  --line-2: #323741;
  --text: #eceef1;
  --muted: #8b919c;
  --faint: #5d636d;
  --accent: #ff9548;
  --accent-ink: #1a0d03;
  --ok: #3ecf8e;
  --err: #ff6363;
  --warn: #f5b84a;
  --info: #7ab7ff;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--text); }
img, video { max-width: 100%; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 10; background: rgba(11, 12, 14, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: 18px; padding: 10px 20px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: .14em; text-decoration: none; flex: none; }
.brand svg { width: 20px; height: 20px; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--muted); text-decoration: none; padding: 7px 12px; border-radius: 8px; white-space: nowrap; }
.nav a:hover { color: var(--text); background: var(--panel); }
.nav a.on { color: var(--text); background: var(--panel-2); }
.logout button { background: none; border: 0; color: var(--faint); cursor: pointer; padding: 6px; font: inherit; }
.logout button:hover { color: var(--text); }

main { max-width: 1240px; margin: 0 auto; padding: 22px 20px 60px; }
h1 { font-size: 22px; margin: 4px 0 18px; letter-spacing: -.01em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 34px 0 12px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
h2 .count { color: var(--faint); font-weight: 500; }
h3 { font-size: 15px; margin: 0 0 10px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.faint { color: var(--faint); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }

/* ---------- flashes & notices ---------- */
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 10px; border: 1px solid var(--line); background: var(--panel); }
.flash.ok { border-color: rgba(62, 207, 142, .35); }
.flash.err { border-color: rgba(255, 99, 99, .45); color: #ffd0d0; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); margin-bottom: 12px; }
.notice.warn { border-color: rgba(245, 184, 74, .4); }
.notice.err { border-color: rgba(255, 99, 99, .45); }
.notice .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 8px; flex: none; background: var(--warn); }
.notice.err .dot { background: var(--err); }

/* ---------- hero status ---------- */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; margin-bottom: 8px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.next-label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.next-time { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin: 4px 0 2px; }
.platform-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; display: block; }
.tile:hover { border-color: var(--line-2); }
.tile .v { font-size: 22px; font-weight: 700; }
.tile .l { color: var(--muted); font-size: 12px; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; background: var(--panel-2); border: 1px solid var(--line); white-space: nowrap; color: var(--muted); }
.chip.ok, .chip.posted, .chip.ready { color: var(--ok); border-color: rgba(62, 207, 142, .3); }
.chip.approved { color: var(--info); border-color: rgba(122, 183, 255, .35); }
.chip.warn { color: var(--warn); border-color: rgba(245, 184, 74, .45); }
.chip.err, .chip.failed { color: var(--err); border-color: rgba(255, 99, 99, .35); }
.chip.rejected { color: var(--faint); }
.chip.queued, .chip.rendering, .chip.posting, .chip.processing { color: var(--accent); border-color: rgba(255, 149, 72, .35); }
.chip.next { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
a.chip { text-decoration: none; }
a.chip:hover { border-color: var(--line-2); }
.chip.lang { color: var(--text); font-weight: 600; letter-spacing: .04em; }
button.chip { padding: 2px 9px; border-radius: 99px; font: 600 12px/1.5 inherit; font-family: inherit; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
button.chip:hover { border-color: var(--line-2); filter: none; }
.lang-slots { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 6px; }

/* ---------- buttons & forms ---------- */
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 9px; padding: 9px 16px; font: 600 14px/1.2 inherit; font-family: inherit; cursor: pointer; text-decoration: none; white-space: nowrap; }
button:hover, .btn:hover { filter: brightness(1.07); }
button:disabled { opacity: .55; cursor: progress; }
button.ghost, .btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line-2); font-weight: 500; }
button.ghost:hover, .btn.ghost:hover { background: var(--panel-2); filter: none; }
button.danger { background: transparent; color: var(--err); border: 1px solid rgba(255, 99, 99, .35); font-weight: 500; }
button.sm, .btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
form.inline { display: inline; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
input[type=text], input[type=password], input[type=number], input[type=time], select, textarea {
  width: 100%; background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 9px;
  padding: 9px 11px; font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(255, 149, 72, .5); outline-offset: 0; border-color: transparent; }
textarea { min-height: 96px; resize: vertical; }
input[type=file] { color: var(--muted); font: inherit; max-width: 100%; }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width: 17px; height: 17px; vertical-align: -3px; }
.check { display: flex; gap: 9px; align-items: center; color: var(--text); font-size: 14px; margin: 6px 0; }
.field { margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--faint); margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }

/* ---------- video cards ---------- */
.videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.vcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.vcard .media { position: relative; aspect-ratio: 9 / 16; background: #000; }
.vcard video, .vcard .media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vcard .media .placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; padding: 20px; }
.vcard .badges { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; gap: 6px; flex-wrap: wrap; pointer-events: none; }
.vcard .badges .chip { background: rgba(11, 12, 14, .78); backdrop-filter: blur(6px); }
.vcard .badges .chip.next { background: var(--accent); }
.vcard .body { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.vcard .quote { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.vcard .slot { font-size: 13px; color: var(--accent); }
.quote-edit { display: flex; gap: 6px; }
.quote-edit input[type=text] { flex: 1; min-width: 0; font-weight: 600; padding: 7px 9px; font-size: 14px; }
.vcard .meta { font-size: 12px; color: var(--muted); }
.vcard .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.vcard .err-text { font-size: 12px; color: var(--err); overflow-wrap: anywhere; }
.spin { width: 22px; height: 22px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- images ---------- */
.upload { display: grid; grid-template-columns: 1fr 220px auto; gap: 10px; align-items: end; }
.dropzone { border: 1.5px dashed var(--line-2); border-radius: var(--radius); padding: 16px; background: var(--panel); }
.dropzone.drag { border-color: var(--accent); background: rgba(255, 149, 72, .06); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.thumb { position: relative; border-radius: 10px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); }
.thumb img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; display: block; }
.thumb.off img { opacity: .3; filter: grayscale(1); }
.thumb .uses { position: absolute; top: 6px; left: 6px; }
.thumb details { position: absolute; top: 4px; right: 4px; }
.thumb summary { list-style: none; cursor: pointer; width: 28px; height: 28px; border-radius: 8px; background: rgba(11, 12, 14, .75); display: grid; place-items: center; color: var(--text); font-weight: 700; }
.thumb summary::-webkit-details-marker { display: none; }
.thumb .menu { position: absolute; right: 0; top: 32px; width: 200px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px; z-index: 5; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 12px 30px rgba(0, 0, 0, .5); }
.thumb .menu form { display: flex; gap: 6px; }
.thumb .menu button { width: 100%; }

/* ---------- tables / lists ---------- */
.list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.item { display: flex; gap: 12px; align-items: center; padding: 11px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.item:first-child { border-top: 0; }
.item.off { opacity: .5; }
.item .grow { flex: 1; min-width: 200px; }
.item input[type=text] { background: transparent; border-color: transparent; padding: 6px 8px; }
.item input[type=text]:hover { border-color: var(--line-2); }
.events { font-size: 13px; }
.events .item { padding: 8px 14px; gap: 10px; flex-wrap: nowrap; align-items: baseline; }
.events time { color: var(--faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.events .lvl { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; transform: translateY(-1px); }
.events .lvl.warn { background: var(--warn); }
.events .lvl.error { background: var(--err); }
.events .msg { overflow-wrap: anywhere; }
audio { width: 100%; max-width: 320px; height: 36px; }

/* ---------- settings ---------- */
.settings { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.preview-box { position: sticky; top: 76px; }
.preview-box img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); background: #000; display: block; }
.range-row { display: grid; grid-template-columns: 1fr 44px; gap: 10px; align-items: center; }
.range-row output { font-variant-numeric: tabular-nums; color: var(--muted); text-align: right; font-size: 13px; }
details.help { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 10px 0 16px; }
details.help summary { cursor: pointer; color: var(--muted); }
details.help ol { padding-left: 20px; margin: 10px 0 4px; }
details.help li { margin-bottom: 6px; }
code { background: var(--panel-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font-size: 13px; }

/* ---------- video detail ---------- */
.detail { display: grid; grid-template-columns: 340px 1fr; gap: 24px; align-items: start; }
.detail video { width: 100%; aspect-ratio: 9 / 16; background: #000; border-radius: var(--radius); display: block; }
.slides { display: flex; gap: 6px; flex-wrap: wrap; }
.slides img { width: 62px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.carousel { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.carousel img { width: 150px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); scroll-snap-align: start; display: block; }

/* ---------- accounts / server browser ---------- */
.vnc-wrap { background: #000; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
#vnc { width: 100%; aspect-ratio: 1280 / 900; }
#vnc canvas { outline: none; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 14px; }
.shots a { display: block; text-decoration: none; color: var(--muted); font-size: 12px; }
.shots img { width: 100%; aspect-ratio: 1280 / 820; object-fit: cover; object-position: top; border-radius: 8px; border: 1px solid var(--line); display: block; margin-bottom: 4px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login form { width: 100%; max-width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.login .brand { justify-content: center; margin-bottom: 22px; font-size: 18px; }
.login button { width: 100%; margin-top: 6px; }

@media (max-width: 900px) {
  .hero, .settings, .detail { grid-template-columns: 1fr; }
  .preview-box { position: static; max-width: 300px; }
  .detail > :first-child { max-width: 340px; }
}
@media (max-width: 640px) {
  .top-inner { padding: 8px 14px; gap: 10px; }
  .brand span { display: none; }
  main { padding: 16px 14px 50px; }
  .upload { grid-template-columns: 1fr; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .videos { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .thumbs { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .vcard .body { padding: 10px; }
  .next-time { font-size: 24px; }
}
.thumb .tags { position: absolute; left: 6px; right: 6px; bottom: 6px; font-size: 10.5px; line-height: 1.3; color: #fff; background: rgba(11, 12, 14, .72); border-radius: 6px; padding: 2px 6px; pointer-events: none; }
.perf { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.perf .tile { background: var(--panel-2); }
@media (max-width: 640px) { .perf { grid-template-columns: 1fr; } }
