:root {
  --bg: #0f1218; --panel: #171b23; --panel2: #1e2330; --line: #2a3040; --text: #e8ebf2; --muted: #8b93a7;
  --green: #22b14c; --green2: #39ff14; --red: #ff3b3b; --blue: #2f6bff; --yellow: #ffde00; --radius: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "Cairo", "Segoe UI", Tahoma, sans-serif; font-size: 15px; }
a { color: inherit; text-decoration: none; }
header { display: flex; align-items: center; gap: 18px; padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
header .brand { font-weight: 800; font-size: 18px; }
header .brand span { color: var(--green2); }
header nav { display: flex; gap: 4px; flex: 1; }
header nav a { padding: 7px 12px; border-radius: 9px; color: var(--muted); }
header nav a.on, header nav a:hover { background: var(--panel2); color: var(--text); }
header .me { color: var(--muted); font-size: 13px; }
main { max-width: 1180px; margin: 0 auto; padding: 22px 16px 60px; }
h1 { font-size: 22px; margin: 0 0 14px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.grid2 { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
label { display: block; color: var(--muted); font-size: 13px; margin: 10px 0 6px; }
input[type=text], input[type=password], textarea, select { width: 100%; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 10px 12px; font: inherit; }
textarea { min-height: 80px; resize: vertical; }
textarea.code { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; min-height: 340px; direction: ltr; text-align: left; }
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--blue); color: #fff; border: 0; border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 700; cursor: pointer; }
.btn.green { background: var(--green); } .btn.ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--line); } .btn.red { background: #8a2222; }
.btn:disabled { opacity: .5; cursor: default; }
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px; text-align: center; color: var(--muted); cursor: pointer; }
.drop.over { border-color: var(--green); color: var(--text); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg label { margin: 0; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); cursor: pointer; }
.seg input:checked + span { color: var(--green2); font-weight: 700; }
table { width: 100%; border-collapse: collapse; }
td, th { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: right; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12.5px; background: var(--panel2); }
.pill.done { background: #123d22; color: #7dff9c; } .pill.error { background: #4a1616; color: #ff9b9b; } .pill.busy { background: #13264d; color: #9cbcff; }
.bar { height: 6px; background: var(--panel2); border-radius: 9px; overflow: hidden; margin-top: 5px; }
.bar i { display: block; height: 100%; background: var(--green); }
.muted { color: var(--muted); font-size: 13px; }
.video-wrap { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
video { width: 330px; max-width: 100%; border-radius: 14px; background: #000; }
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow: auto; padding: 4px; }
.msg { padding: 9px 12px; border-radius: 12px; max-width: 92%; white-space: pre-wrap; line-height: 1.6; }
.msg.user { background: #1d3a7a; align-self: flex-start; }
.msg.assistant { background: var(--panel2); align-self: flex-end; }
.msg.system { background: #3d2f0d; align-self: center; font-size: 13px; }
.msg small { display: block; color: var(--muted); font-size: 11px; }
.caps { max-height: 420px; overflow: auto; }
.caps input { padding: 6px 9px; }
.lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.lib .item { background: var(--panel2); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.lib .thumb { height: 120px; display: flex; align-items: center; justify-content: center; background: #000; }
.lib .thumb img, .lib .thumb video { max-width: 100%; max-height: 120px; }
.lib .meta { padding: 8px; font-size: 12px; }
.lib .meta form { display: flex; gap: 4px; margin-top: 6px; }
.lib .meta input { padding: 4px 6px; font-size: 12px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tabs a { padding: 6px 11px; border-radius: 9px; background: var(--panel2); color: var(--muted); font-size: 13px; }
.tabs a.on { background: var(--green); color: #fff; }
.notice { padding: 10px 14px; border-radius: 10px; background: #3d2f0d; margin-bottom: 14px; }
.login { max-width: 360px; margin: 10vh auto; }
.sheet { width: 100%; border-radius: 10px; margin-top: 10px; }
[hidden] { display: none !important; }

.bitem { display: flex; flex-wrap: nowrap; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.bitem.removed { opacity: .45; } .bitem.changed { border-color: var(--green); }
.bthumb { width: 130px; height: 112px; flex: none; background: #000; border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.bthumb img { width: 100%; height: 100%; object-fit: cover; }
.bnew { position: relative; width: 90px; height: 70px; flex: none; border: 2px solid var(--green); border-radius: 10px; overflow: hidden; }
.bnew img { width: 100%; height: 100%; object-fit: cover; }
.bnew span { position: absolute; top: 3px; right: 3px; background: var(--green); color: #fff; font-size: 11px; border-radius: 6px; padding: 0 6px; }
.binfo { flex: 1; min-width: 0; font-size: 13px; } .bact { display: flex; gap: 6px; flex: none; }
.bact .btn { padding: 6px 10px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 20; display: flex; align-items: flex-start; justify-content: center; padding: 30px 12px; overflow: auto; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; width: min(1000px, 100%); }
.item.pick { cursor: pointer; } .item.pick:hover { border-color: var(--green); }
.thumb { position: relative; } .vbadge { position: absolute; bottom: 6px; left: 6px; background: rgba(0,0,0,.7); border-radius: 6px; padding: 1px 6px; font-size: 12px; }

.vpill { background: #2a2350; color: #c8b8ff; }
.vtabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.vtab { flex: 1; min-width: 120px; display: flex; flex-direction: column; gap: 2px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel2); font-size: 13px; }
.vtab.on { border-color: var(--blue); } .vtab.win { border-color: #e0b400; background: #2b2610; }
.rtable td, .rtable th { text-align: center; } .rtable tr.win td { background: #2b2610; }
.rnote { margin-top: 10px; font-size: 13px; line-height: 1.7; }
.rrec { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: #13264d; line-height: 1.7; }

.analysis { line-height: 1.9; font-size: 14px; max-height: 520px; overflow: auto; }
#ref { width: 100%; max-width: 330px; }
select { min-width: 0; }

.musicbox { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 10px; background: var(--panel2); }
.musicbox .mrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.musicbox input[type=range] { flex: 1; min-width: 140px; accent-color: var(--green); }
.musicbox .btn { padding: 7px 12px; }
.musicbox .m_vid { width: 160px; border-radius: 10px; }

.stylepick { display: flex; gap: 8px; flex-wrap: wrap; }
.stylepick label { margin: 0; display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); cursor: pointer; background: var(--panel2); }
.stylepick input:checked + span { color: var(--green2); font-weight: 700; }
.stylepick label:has(input:checked) { border-color: var(--green); }

/* ads dashboard */
.adbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.adbar select { width: auto; min-width: 150px; }
.adbar .chk { margin: 0; display: inline-flex; gap: 6px; align-items: center; color: var(--text); }
.campgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-top: 14px; }
.campcard { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--panel2); cursor: pointer; display: grid; gap: 4px; }
.campcard div { display: flex; justify-content: space-between; }
.campcard.good { border-color: #1f9d4c; } .campcard.bad { border-color: #b93030; } .campcard.ok { border-color: #b8961e; }
.tablewrap { overflow-x: auto; }
.adtable { width: 100%; border-collapse: collapse; min-width: 980px; }
.adtable th { text-align: right; font-size: 13px; color: var(--muted); padding: 8px 6px; white-space: nowrap; }
.adtable td { padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.adtable td:nth-child(2) { white-space: normal; min-width: 200px; }
.adrow { cursor: pointer; } .adrow:hover { background: var(--panel2); }
.adthumb { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; display: block; }
.cpa.good { color: #3fd27a; } .cpa.bad { color: #ff6b6b; } .cpa.ok { color: #f0c94a; }
.addetail td { background: var(--panel2); white-space: normal; }
.adtext p { white-space: pre-wrap; margin: 6px 0; }
.camplist { display: grid; gap: 6px; margin: 8px 0; }
.campchk { margin: 0; display: flex; gap: 10px; align-items: center; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); color: var(--text); cursor: pointer; }
.thumbwrap { position: relative; width: 54px; }
.playbadge { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 18px; text-shadow: 0 1px 4px #000; }
.addetailgrid { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.advideo { width: 240px; max-width: 100%; border-radius: 12px; background: #000; }
.addetailgrid .adtext { flex: 1; min-width: 260px; }
.permbox { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 10px; border: 1px dashed var(--line); border-radius: 10px; }
.permbox label { margin: 0; display: inline-flex; gap: 6px; align-items: center; color: var(--text); }
.permbox[hidden] { display: none !important; }
.jthumb { position: relative; width: 54px; height: 96px; border-radius: 8px; overflow: hidden; background: var(--panel2); cursor: pointer; display: grid; place-items: center; }
.jthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.jthumb span { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 20px; text-shadow: 0 1px 6px #000; }
.jthumb.empty { cursor: default; font-size: 20px; }
.watch { padding: 4px 10px; margin-top: 6px; font-size: 13px; }
.playerbox { max-width: 440px; display: grid; gap: 10px; }
.playerbox video { width: 100%; max-height: 72vh; border-radius: 12px; background: #000; }
.finalgrid { display: grid; gap: 14px; }
.fcard { display: grid; gap: 10px; }
.fhead { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.fvids { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.fvids > div { display: grid; gap: 8px; justify-items: start; }
.fvids video { width: 220px; max-width: 100%; border-radius: 12px; background: #000; }
.fdrop { width: 220px; height: 390px; border: 2px dashed var(--line); border-radius: 12px; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 10px; }
.adname { font-size: 18px; font-weight: 700; background: var(--panel2); border: 1px solid var(--green); border-radius: 10px; padding: 10px 14px; direction: ltr; text-align: left; unicode-bidi: plaintext; }
.bell { position: relative; margin-left: 10px; text-decoration: none; }
.bell span { position: absolute; top: -8px; left: -10px; background: #d33; color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 6px; }
.alertbar { display: block; background: #5a3a12; border: 1px solid #b8791e; color: #ffd9a0; padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; text-decoration: none; }
.alert.bad { border-color: #b93030; } .alert.warn { border-color: #b8791e; } .alert.info { border-color: #2a6fb8; }
.diskbar { height: 14px; background: var(--panel2); border-radius: 8px; overflow: hidden; margin: 8px 0; }
.diskbar i { display: block; height: 100%; background: var(--green); } .diskbar i.warn { background: #d9a02a; } .diskbar i.bad { background: #d33; }
.adname.vidname { border-color: var(--line); font-size: 15px; font-weight: 600; }
.metabox { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 8px; }
.metarow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.metabox textarea { min-height: 60px; }
.metareqs td { padding: 6px; vertical-align: top; }
/* ads: cards view, filters, totals */
.adhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.viewtoggle { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.viewtoggle button { background: var(--panel2); color: var(--muted); border: 0; padding: 8px 14px; font: inherit; cursor: pointer; }
.viewtoggle button.on { background: var(--green); color: #fff; }
.filters { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--panel2); }
.filters summary { cursor: pointer; font-weight: 700; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 10px; align-items: end; }
.fgrid label { margin: 0; display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.fgrid label.chk { display: flex; align-items: center; gap: 6px; color: var(--text); }
.fgrid input[type=number] { width: 100%; background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 9px 10px; font: inherit; }
.totals { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-top: 12px; }
.totals div { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: grid; }
.totals span { color: var(--muted); font-size: 12px; } .totals b { font-size: 18px; }
.campcard.sel { outline: 2px solid var(--green); }
.adcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.adcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; border-top: 4px solid var(--line); }
.adcard.good { border-top-color: #1f9d4c; } .adcard.ok { border-top-color: #d9a02a; } .adcard.bad { border-top-color: #c63b3b; }
.adcard-top { display: flex; gap: 12px; }
.adcard-media .advideo { width: 130px; }
.thumbwrap.big { width: 130px; height: 230px; border-radius: 12px; overflow: hidden; }
.thumbwrap.big img { width: 100%; height: 100%; object-fit: cover; }
.thumbwrap.big .playbadge { font-size: 30px; }
.thumbwrap.empty { display: grid; place-items: center; background: var(--panel2); font-size: 28px; }
.adcard-head { flex: 1; min-width: 0; display: grid; align-content: start; gap: 2px; }
.adname-t { word-break: break-word; }
.rank { font-size: 12px; color: var(--muted); }
.vbadge { font-size: 12px; padding: 2px 8px; border-radius: 8px; background: var(--panel2); }
.bigcpa { background: var(--panel2); border-radius: 10px; padding: 8px 10px; display: grid; margin: 4px 0; }
.bigcpa span { font-size: 12px; color: var(--muted); } .bigcpa b { font-size: 24px; } .bigcpa small { color: var(--muted); }
.bigcpa.good b { color: #3fd27a; } .bigcpa.bad b { color: #ff6b6b; } .bigcpa.ok b { color: #f0c94a; }
.metricgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.metricgrid div { background: var(--panel2); border-radius: 8px; padding: 6px; display: grid; text-align: center; }
.metricgrid span { font-size: 11px; color: var(--muted); } .metricgrid b { font-size: 14px; }
.adtextbox summary { cursor: pointer; color: var(--muted); }
.adtextbox p { white-space: pre-wrap; }
@media (max-width: 520px) { .metricgrid { grid-template-columns: repeat(3, 1fr); } .adcards { grid-template-columns: 1fr; } }

/* cutting silences / stutters (job page) */
.trimbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.trimbar select { width: auto; flex: 1; min-width: 170px; }
#trimlist { max-height: 360px; overflow: auto; }
.titem { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-size: 14px; cursor: pointer; }
.titem.off { opacity: .5; }
.titem input { width: auto; margin: 0; }
.titem .tlabel { flex: 1; }
.titem .btn { padding: 5px 10px; font-size: 13px; }

.grid2 > div { min-width: 0; }

/* caption editor: click a word to colour it */
.caps .ctime { width: 62px; vertical-align: top; padding-top: 14px; }
.caps .chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.caps .w { padding: 2px 9px; border-radius: 7px; background: var(--panel2); border: 1px solid var(--line); cursor: pointer; font-weight: 700; font-size: 14px; }
.caps .w.red { color: #ff2d2d; border-color: #ff2d2d; } .caps .w.green { color: #39ff14; border-color: #39ff14; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.quick .btn { padding: 6px 11px; font-size: 13px; }
.vset > label { margin-top: 14px; color: var(--text); font-weight: 700; }
.vset .seg label { padding: 6px 11px; font-size: 13.5px; }
.vset > label input[type=checkbox] { width: auto; margin-left: 6px; }
.vsub { margin: 8px 0 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; gap: 8px; }
.vsub[hidden] { display: none; }
.vrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.vrow .btn { padding: 6px 11px; font-size: 13px; }
.vthumb { height: 54px; border-radius: 6px; vertical-align: middle; }
.vrow select { width: auto; flex: 1; min-width: 130px; padding: 7px 9px; }
.caps .cact { display: flex; gap: 4px; margin-top: 6px; }
.caps .cact button { background: var(--panel2); border: 1px solid var(--line); border-radius: 7px; cursor: pointer; padding: 2px 6px; font-size: 13px; color: var(--text); }
.caps .cut { cursor: pointer; padding: 2px 4px; border-radius: 6px; background: #3a2a10; border: 1px dashed var(--yellow); font-size: 13px; }
.vset label.inl { display: inline-flex; align-items: center; gap: 6px; color: var(--text); margin: 6px 0; }
.vset label.inl input { width: auto; margin: 0; }
.fmts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 12px; }
.fmts .btn { padding: 6px 11px; font-size: 13px; }
.codline { margin-top: 6px; padding: 6px 9px; border-radius: 8px; background: #102a22; font-size: 12.5px; line-height: 1.7; }
.hookurl { font-family: ui-monospace, Menlo, monospace; font-size: 12px; direction: ltr; text-align: left; }

/* final edit page: groups of videos made from one upload */
.gcard { padding: 14px; }
.ghead { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.ghead b { font-size: 16px; }
.gacts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; max-width: 620px; }
.gacts .gmsg { width: 100%; }
.btn.mini { padding: 4px 9px; font-size: 12.5px; }
.grows { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 10px; }
.grow { display: grid; grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: start; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel2); }
.grow.ok { border-color: #1f6b3a; }
.grow .gcode { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.grow .gcode b { font-size: 15px; color: var(--green2); }
.grow .gvid { display: flex; flex-direction: column; gap: 4px; align-items: stretch; text-align: center; min-width: 0; }
.grow .gvid video { width: 100%; max-height: 220px; background: #000; border-radius: 8px; }
.grow .gstate { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
.grow .ginfo { grid-column: 2 / -1; }
.grow .ginfo .adname { font-size: 12.5px; }
.grow .fname { font-size: 11px; word-break: break-all; }
.grow .fdrop { min-height: 120px; display: flex; align-items: center; justify-content: center; border: 2px dashed var(--line); border-radius: 8px; width: 100%; color: var(--muted); font-size: 12.5px; }
.grow .gdrop.over .fdrop, .grow .gdrop.over video { outline: 2px solid var(--green); }
.grow .metabox { margin-top: 6px; }
