/* AI Studio — same look as teaminsta.pro / threads.teaminsta.pro (getmysocial dashboard: Geist, dark, violet) */
@import url("https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&display=swap");
:root {
  --bg: #0D0D10; --bg-1: #17171A; --bg-2: #202023; --bg-3: #2a2a2e; --line: #27272A; --line-2: #333335;
  --text: #EAEAED; --text-2: #A1A1A4; --text-3: #8A8A8D; --accent: #7767E2; --accent-2: #8A7BE6; --accent-bg: #232132;
  --up: #22c55e; --warn: #eab308; --down: #f97316; --red: #ef4444; --r: 16px; --side: 221px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text); }
body { font-family: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; line-height: 1.5; min-height: 100vh; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
img, video { display: block; max-width: 100%; }
.muted { color: var(--text-3); } .small { font-size: 12px; } .nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- shell */
.side { position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--bg); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px; z-index: 40; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -.3px; padding: 4px 10px 18px; }
.logo i { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; font-style: normal; font-size: 13px; color: #fff; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); padding: 12px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; color: var(--text-2); padding: 8px 10px; border-radius: 8px; font-weight: 500; text-decoration: none; }
.nav a:hover { background: var(--bg-2); color: var(--text); }
.nav a.on { background: var(--accent-bg); color: var(--accent-2); }
.nav a svg { width: 17px; height: 17px; flex: none; }
.nav a .badge { margin-left: auto; }
.side .bottom { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.mtop { display: none; }
main { margin-left: var(--side); padding: 16px 20px 120px; max-width: 1640px; }
.scrim { display: none; }

@media (max-width: 900px) {
  .side { transform: translateX(-100%); transition: transform .2s; width: 260px; }
  body.drawer .side { transform: none; }
  body.drawer .scrim { display: block; position: fixed; inset: 0; background: #0009; z-index: 39; }
  .mtop { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; height: 56px; padding: 0 16px; background: var(--bg); border-bottom: 1px solid var(--line); z-index: 30; font-weight: 700; }
  .mtop button { background: none; border: 0; font-size: 22px; cursor: pointer; width: 32px; }
  main { margin-left: 0; padding: 12px 12px 140px; }
}

/* ---------- building blocks */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 12px 12px 20px; margin-bottom: 12px; min-height: 54px; }
.topbar h1 { font-size: 20px; font-weight: 700; letter-spacing: -.5px; }
.topbar .acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 12px; }
.card > .head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 10px; flex-wrap: wrap; }
.card > .head h2 { font-size: 15px; font-weight: 600; letter-spacing: -.3px; }
.card > .body { padding: 0 20px 18px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text); border-radius: 8px; padding: 7px 14px; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--bg-3); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: #fca5a5; }
.btn.ghost { background: none; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--bg-2); color: var(--text); }
.btn.sm { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.icon-btn { background: #0008; border: 0; color: #fff; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; display: inline-grid; place-items: center; font-size: 14px; }
.icon-btn:hover { background: #000c; }
.link { background: none; border: 0; color: var(--accent-2); cursor: pointer; font-size: 12px; font-weight: 500; padding: 0; }
.link:hover { text-decoration: underline; }
.badge { display: inline-flex; align-items: center; gap: 4px; background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text-2); border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 500; }
.badge.ok { color: #86efac; border-color: #14532d; background: #0f2a1a; }
.badge.run { color: var(--accent-2); border-color: #3b3470; background: var(--accent-bg); }
.badge.wait { color: #fde68a; border-color: #4d3d0a; background: #2a2208; }
.badge.bad { color: #fca5a5; border-color: #5b1d1d; background: #2a1010; }
input[type=text], input[type=password], input[type=number], textarea, select { width: 100%; background: var(--bg); border: 1px solid var(--line-2); color: var(--text); border-radius: 10px; padding: 9px 12px; font: inherit; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; line-height: 1.45; }
label.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.seg { display: inline-flex; flex-wrap: wrap; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { background: none; border: 0; color: var(--text-2); padding: 6px 12px; border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 500; }
.seg button.on { background: var(--accent-bg); color: var(--accent-2); }
.seg button:hover:not(.on) { color: var(--text); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.field { margin-bottom: 14px; }
.field > .lab { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.warn-line { color: #fde68a; font-size: 12px; }
.err-line { color: #fca5a5; font-size: 12px; }
.empty { text-align: center; color: var(--text-3); padding: 40px 20px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line-2); border-top-color: var(--accent-2); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* banner */
.banner { border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: 13px; }
.banner.credits, .banner.rate { background: #2a2208; border: 1px solid #4d3d0a; color: #fde68a; }
.banner.auth { background: #2a1010; border: 1px solid #5b1d1d; color: #fca5a5; }

/* thumbs */
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { position: relative; width: 74px; height: 98px; border-radius: 10px; overflow: hidden; background: var(--bg-2); border: 1px solid var(--line-2); flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .num { position: absolute; left: 4px; top: 4px; background: #000b; color: #fff; font-size: 11px; font-weight: 600; border-radius: 6px; padding: 0 6px; }
.thumb .x { position: absolute; right: 3px; top: 3px; width: 22px; height: 22px; border-radius: 6px; background: #000b; color: #fff; border: 0; cursor: pointer; font-size: 13px; line-height: 1; }
.thumb.dropped img { opacity: .3; filter: grayscale(1); }
.thumb.dropped::after { content: ""; position: absolute; left: -10%; right: -10%; top: 50%; border-top: 2px solid var(--red); transform: rotate(-52deg); }
.thumb.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.thumb.state { display: grid; place-items: center; text-align: center; font-size: 11px; color: var(--text-3); padding: 4px; }
.thumb .role { position: absolute; left: 3px; right: 3px; bottom: 3px; font-size: 11px; padding: 1px 2px; border-radius: 6px; background: #000c; color: #fff; border: 0; width: auto; }
.thumb.add { display: grid; place-items: center; color: var(--text-3); cursor: pointer; border-style: dashed; font-size: 12px; text-align: center; }
.thumb.add:hover { color: var(--accent-2); border-color: var(--accent); }
.thumb.drag { opacity: .4; }

/* ---------- launch */
.links-box { position: relative; }
.links-box textarea { min-height: 150px; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12.5px; }
.links-box.over textarea { border-color: var(--accent); background: var(--accent-bg); }
.counter { font-size: 13px; color: var(--text-2); margin-top: 8px; }
.counter b { color: var(--text); font-weight: 600; }
.counter .bad { color: #fca5a5; } .counter .dup { color: #fde68a; } .counter .done { color: var(--accent-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 3px 4px 3px 8px; font-size: 12px; max-width: 100%; }
.chip .bar { width: 60px; height: 4px; background: var(--line-2); border-radius: 2px; overflow: hidden; }
.chip .bar i { display: block; height: 100%; background: var(--accent); }
.chip.bad { border-color: #5b1d1d; color: #fca5a5; }
.chip button { background: none; border: 0; color: var(--text-3); cursor: pointer; padding: 0 4px; font-size: 14px; }
.chars { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.char-card { background: var(--bg); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px; cursor: pointer; text-align: left; }
.char-card:hover { border-color: var(--text-3); }
.char-card.on { border-color: var(--accent); background: var(--accent-bg); }
.char-card .mini { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; margin-bottom: 8px; aspect-ratio: 4 / 1.4; }
.char-card .mini span { background: var(--bg-2) center / cover no-repeat; border-radius: 5px; }
.char-card b { display: block; font-size: 13px; }
.char-card small { color: var(--text-3); font-size: 12px; }
.prompt-line { background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; color: var(--text-2); white-space: pre-wrap; max-height: 4.4em; overflow: hidden; cursor: pointer; position: relative; }
.prompt-line.open { max-height: none; }
.prompt-line:not(.open)::after { content: ""; position: absolute; inset: auto 0 0 0; height: 1.6em; background: linear-gradient(transparent, var(--bg)); }
.ins { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.opts-sum { cursor: pointer; display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 14px 20px; }
.opts-sum span { color: var(--text-2); font-size: 13px; }
.opt-grid { display: grid; gap: 14px; padding: 0 20px 18px; }
.footer { position: fixed; left: var(--side); right: 0; bottom: 0; background: #0D0D10ee; backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding: 12px 20px; display: flex; align-items: center; gap: 14px; z-index: 20; }
.footer .sum { font-weight: 600; } .footer .why { color: var(--text-3); font-size: 13px; flex: 1; }
@media (max-width: 900px) { .footer { left: 0; padding: 10px 12px; flex-wrap: wrap; } .footer .why { flex-basis: 100%; order: 3; } .footer .btn { margin-left: auto; } }
fieldset.frozen { pointer-events: none; opacity: .6; }
fieldset { border: 0; min-width: 0; }

/* ---------- review */
.rv-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.rv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.rv { position: relative; background: #000; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; aspect-ratio: 9 / 16; }
.rv.focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.rv.selected { border-color: var(--accent-2); box-shadow: 0 0 0 2px var(--accent-2) inset; }
.rv video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.rv .top { position: absolute; inset: 6px 6px auto 6px; display: flex; justify-content: space-between; gap: 4px; }
.rv .bot { position: absolute; inset: auto 6px 6px 6px; display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.rv .sel-box { width: 26px; height: 26px; border-radius: 7px; border: 2px solid #fffa; background: #0006; cursor: pointer; display: grid; place-items: center; color: #fff; font-size: 14px; }
.rv.selected .sel-box { background: var(--accent); border-color: var(--accent); }
.rv .keep { background: #166534e0; } .rv .rej { background: #991b1be0; }
.kbd { font-size: 11px; color: var(--text-3); }
.kbd kbd { background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 5px; font-family: inherit; color: var(--text-2); }

/* ---------- jobs */
.batch .head .meta { color: var(--text-3); font-size: 12px; }
.jrow { display: grid; grid-template-columns: 44px minmax(0, 1.4fr) minmax(0, 1fr) 110px auto; gap: 12px; align-items: center; padding: 8px 20px; border-top: 1px solid var(--line); }
.jrow .pv { width: 44px; height: 64px; border-radius: 7px; background: var(--bg-2) center / cover no-repeat; }
.jrow .src { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.jrow .st { font-size: 13px; }
.jrow .st .err { color: #fca5a5; font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; }
.jrow .nums { font-size: 12px; color: var(--text-2); }
.jrow .acts { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.st-done { color: #86efac; } .st-failed { color: #fca5a5; } .st-run { color: var(--accent-2); } .st-wait { color: #fde68a; }
@media (max-width: 900px) {
  .jrow { grid-template-columns: 44px minmax(0, 1fr); padding: 10px 12px; }
  .jrow .st, .jrow .nums, .jrow .acts { grid-column: 2; }
  .jrow .acts { justify-content: flex-start; }
}

/* ---------- modals */
.modal-wrap { position: fixed; inset: 0; background: #000b; z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r); width: min(920px, 100%); max-height: calc(100vh - 32px); overflow: auto; position: relative; }
.modal.full { width: 100%; height: 100%; max-height: none; border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; }
.modal .mh { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg-1); z-index: 2; flex-wrap: nowrap; }
.modal .mh h3 { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.modal .mh .steps { flex-wrap: nowrap; }
@media (max-width: 700px) { .modal .mh .steps { display: none; } }
.modal > .mb { padding: 16px 18px; }
.modal.player { width: auto; background: #000; }
.modal.player video { max-height: calc(100vh - 120px); max-width: calc(100vw - 40px); }
@media (max-width: 900px) { .modal-wrap { padding: 0; } .modal { max-height: 100vh; border-radius: 0; } }

/* detail timeline */
.tl { list-style: none; border-left: 2px solid var(--line-2); margin-left: 6px; }
.tl li { position: relative; padding: 0 0 12px 16px; }
.tl li::before { content: ""; position: absolute; left: -6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.tl li.bad::before { background: var(--red); }
.tl .when { color: var(--text-3); font-size: 12px; }
.pre { background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; white-space: pre-wrap; word-break: break-word; color: var(--text-2); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--text-3); }

/* prepare panel */
.prep { display: grid; grid-template-columns: minmax(0, 1fr) 300px; flex: 1; min-height: 0; }
.prep .main { overflow: auto; padding: 16px 18px 24px; }
.prep .hist { border-left: 1px solid var(--line); overflow: auto; padding: 12px; }
.frames { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.frame { position: relative; border-radius: 10px; overflow: hidden; border: 2px solid transparent; cursor: pointer; background: var(--bg-2); aspect-ratio: 9 / 16; }
.frame img { width: 100%; height: 100%; object-fit: cover; }
.frame span { position: absolute; left: 4px; bottom: 4px; background: #000b; border-radius: 6px; padding: 0 6px; font-size: 11px; }
.frame.on { border-color: var(--accent); }
.stage-img { background: #000; border-radius: 12px; display: grid; place-items: center; min-height: 300px; max-height: 62vh; overflow: hidden; }
.stage-img img { max-height: 62vh; object-fit: contain; }
.ver { display: flex; gap: 10px; padding: 8px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.ver:hover { background: var(--bg-2); }
.ver.on { border-color: var(--accent); background: var(--accent-bg); }
.ver .tn { width: 46px; height: 66px; border-radius: 7px; background: var(--bg-2) center / cover no-repeat; flex: none; display: grid; place-items: center; }
.ver .meta { font-size: 12px; min-width: 0; }
.ver .meta p { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; }
.steps span { font-size: 12px; color: var(--text-3); padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-2); }
.steps span.on { color: var(--accent-2); border-color: var(--accent); background: var(--accent-bg); }
.models { display: flex; flex-wrap: wrap; gap: 6px; }
.note { font-size: 12px; color: #fde68a; background: #2a2208; border: 1px solid #4d3d0a; border-radius: 8px; padding: 6px 10px; }
@media (max-width: 900px) { .prep { grid-template-columns: 1fr; overflow: auto; } .prep .hist { border-left: 0; border-top: 1px solid var(--line); } .prep .main { overflow: visible; } }

/* editor */
.ed-video { background: #000; border-radius: 12px; display: grid; place-items: center; }
.ed-video video { max-height: 56vh; }
.track { position: relative; height: 46px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; margin: 12px 0 6px; cursor: crosshair; user-select: none; touch-action: none; overflow: hidden; }
.track .cut { position: absolute; top: 0; bottom: 0; background: #ef444466; border-left: 2px solid var(--red); border-right: 2px solid var(--red); }
.track .head { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; pointer-events: none; }
.track .ticks { position: absolute; inset: auto 0 2px 0; display: flex; justify-content: space-between; padding: 0 6px; font-size: 10px; color: var(--text-3); pointer-events: none; }

/* characters */
.ch-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 12px; align-items: start; }
.ch-list .item { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.ch-list .item:hover { background: var(--bg-2); }
.ch-list .item.on { background: var(--accent-bg); color: var(--accent-2); }
.ch-list .item .av { width: 34px; height: 34px; border-radius: 9px; background: var(--bg-2) center / cover no-repeat; flex: none; }
.photos { display: flex; flex-wrap: wrap; gap: 10px; }
.photos .thumb { width: 104px; height: 138px; cursor: grab; }
.dropzone { border: 1px dashed var(--line-2); border-radius: 12px; padding: 14px; text-align: center; color: var(--text-3); cursor: pointer; font-size: 13px; }
.dropzone.over, .dropzone:hover { border-color: var(--accent); color: var(--accent-2); background: var(--accent-bg); }
@media (max-width: 900px) { .ch-layout { grid-template-columns: 1fr; } .photos .thumb { width: 88px; height: 118px; } }

/* toasts */
#toasts { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 80; width: max-content; max-width: calc(100vw - 24px); }
.toast { background: var(--bg-3); border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 14px; display: flex; gap: 14px; align-items: center; box-shadow: 0 8px 30px #0008; font-size: 13px; }
.toast.bad { border-color: #5b1d1d; color: #fca5a5; }
.toast button { background: none; border: 0; color: var(--accent-2); font-weight: 600; cursor: pointer; }
.rules { font-size: 12px; color: var(--text-3); }
