:root {
  --ink: #0a0c11; --ink-2: #151922; --red: #d3182a; --red-d: #a8101e; --green: #3d9a4a; --blue: #1d6fb8;
  --bg: #f3f4f7; --card: #fff; --line: #e2e5ec; --text: #171a21; --muted: #5f6676;
  --radius: 14px; --shadow: 0 1px 2px rgba(10,12,17,.05), 0 8px 24px -12px rgba(10,12,17,.15);
  --font-d: "Manrope", system-ui, sans-serif; --font-b: "Inter", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font: 400 15px/1.55 var(--font-b); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-d); margin: 0; letter-spacing: -.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
.hidden { display: none !important; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font: 700 .88rem var(--font-d); padding: .65rem 1.05rem; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; transition: all .15s; text-decoration: none; color: var(--text); }
.btn:hover { border-color: #aab0be; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.red:hover { background: #e5202f; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: #eceef3; color: var(--text); }
.btn.danger { color: var(--red-d); }
.btn.danger:hover { background: #fdeceb; border-color: #f3b9b4; }
.btn.sm { padding: .42rem .7rem; font-size: .8rem; border-radius: 8px; }

/* auth screens */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(700px 400px at 80% 0, rgba(211,24,42,.18), transparent 60%), var(--ink); }
.auth .box { width: min(420px, 100%); background: #fff; border-radius: 20px; padding: 2rem; box-shadow: 0 30px 80px -30px #000; }
.auth h1 { font-size: 1.5rem; margin: 1rem 0 .3rem; }
.auth p.sub { color: var(--muted); margin: 0 0 1.3rem; font-size: .92rem; }
.logo { display: flex; align-items: center; gap: .7rem; font: 800 1.1rem var(--font-d); }
.logo i { width: 38px; height: 38px; border-radius: 50%; background: conic-gradient(#d3182a, #f5a623, #8cc63f, #1d6fb8, #7b3fb5, #d3182a); display: block; position: relative; }
.logo i::after { content: ""; position: absolute; inset: 11px; border-radius: 50%; background: #fff; }
.logo small { display: block; font: 700 .68rem var(--font-b); letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
label.f { display: grid; gap: .35rem; font: 700 .8rem var(--font-d); margin-bottom: .9rem; }
label.f .help { font: 400 .78rem var(--font-b); color: var(--muted); }
input[type=text], input[type=password], input[type=email], input[type=tel], input[type=url], textarea, select {
  width: 100%; padding: .7rem .85rem; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { outline: 0; border-color: var(--red); box-shadow: 0 0 0 4px rgba(211,24,42,.12); }
textarea { min-height: 84px; resize: vertical; }
.err { color: var(--red-d); font-size: .86rem; min-height: 1.3em; margin: 0 0 .6rem; }

/* shell */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #c9cfdb; padding: 1.4rem 1rem; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: .3rem; }
.side .logo { color: #fff; padding: 0 .6rem 1.2rem; }
.side .logo small { color: #8c94a6; }
.nav { display: flex; align-items: center; gap: .7rem; padding: .7rem .8rem; border-radius: 10px; border: 0; background: none; color: inherit; font: 600 .92rem var(--font-d); cursor: pointer; text-align: left; width: 100%; }
.nav:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav.on { background: var(--red); color: #fff; }
.nav svg { width: 18px; height: 18px; flex: none; }
.side .spacer { flex: 1; }
.main { padding: 2rem clamp(1rem, 3vw, 2.6rem) 4rem; max-width: 1180px; width: 100%; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.6rem; flex-wrap: wrap; }
.top h2 { font-size: 1.7rem; }
.top p { margin: .25rem 0 0; color: var(--muted); max-width: 40rem; }

/* cards & grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.group-title { font: 800 .78rem var(--font-d); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 2rem 0 .8rem; }
.group-title:first-of-type { margin-top: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.slot { overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s, box-shadow .15s; }
.slot.drag { border-color: var(--red); box-shadow: 0 0 0 4px rgba(211,24,42,.15); }
.thumb { aspect-ratio: 16/10; background: repeating-conic-gradient(#eceef3 0 25%, #f7f8fa 0 50%) 0 0 / 18px 18px; display: grid; place-items: center; position: relative; overflow: hidden; }
.thumb img, .thumb video { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; }
.tag { position: absolute; left: .6rem; top: .6rem; font: 700 .68rem var(--font-d); letter-spacing: .08em; text-transform: uppercase; padding: .25rem .55rem; border-radius: 999px; background: rgba(10,12,17,.78); color: #fff; }
.tag.custom { background: var(--green); }
.slot .body { padding: .9rem 1rem 1rem; display: grid; gap: .25rem; flex: 1; align-content: start; }
.slot h3 { font-size: 1rem; }
.slot .where { color: var(--muted); font-size: .82rem; }
.slot .hint { color: #7a8192; font-size: .78rem; }
.slot .acts { display: flex; gap: .5rem; padding: 0 1rem 1rem; flex-wrap: wrap; }
.bar { height: 6px; background: #eceef3; border-radius: 4px; overflow: hidden; margin: 0 1rem 1rem; }
.bar i { display: block; height: 100%; width: 0; background: var(--red); transition: width .15s; }

/* panel (settings) */
.panel { padding: 1.4rem 1.5rem; margin-bottom: 1rem; }
.panel h3 { font-size: 1.05rem; margin-bottom: 1rem; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.2rem; }
.opt { display: flex; align-items: center; gap: .6rem; margin: .4rem 0; cursor: pointer; }
.opt input { accent-color: var(--red); width: 17px; height: 17px; }
.savebar { position: sticky; bottom: 0; background: linear-gradient(180deg, transparent, var(--bg) 40%); padding: 1.2rem 0 .4rem; display: flex; gap: .7rem; align-items: center; }

/* videos */
.addv { padding: 1.4rem 1.5rem; margin-bottom: 1.4rem; }
.seg { display: inline-flex; background: #eceef3; border-radius: 10px; padding: 3px; margin-bottom: 1rem; }
.seg button { border: 0; background: none; padding: .45rem .9rem; border-radius: 8px; font: 700 .83rem var(--font-d); cursor: pointer; color: var(--muted); }
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.vrow { display: grid; grid-template-columns: 220px 1fr auto; gap: 1.2rem; padding: 1rem; margin-bottom: .8rem; align-items: start; }
.vrow .thumb { aspect-ratio: 16/9; border-radius: 10px; background: #0d0f14; }
.vrow .thumb .ph { color: #9aa2b3; font: 700 .8rem var(--font-d); text-align: center; padding: 1rem; }
.vrow .thumb video { object-fit: cover; }
.vrow .meta { display: grid; gap: .6rem; min-width: 0; }
.vrow .acts { display: grid; gap: .4rem; justify-items: stretch; }
.vrow .row2 { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.pill { font: 700 .7rem var(--font-d); letter-spacing: .08em; text-transform: uppercase; padding: .2rem .55rem; border-radius: 999px; background: #eceef3; color: var(--muted); }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }

/* toasts */
#toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: .5rem; z-index: 100; }
.toast { background: var(--ink); color: #fff; padding: .75rem 1.1rem; border-radius: 10px; font: 600 .88rem var(--font-d); box-shadow: 0 14px 30px -10px rgba(0,0,0,.5); animation: in .25s ease; max-width: 340px; }
.toast.bad { background: var(--red-d); }
@keyframes in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: .8rem; gap: .3rem; }
  .side .logo { padding: 0 .6rem 0 .2rem; width: 100%; }
  .side .spacer { display: none; }
  .nav { width: auto; padding: .55rem .8rem; }
  .cols { grid-template-columns: 1fr; }
  .vrow { grid-template-columns: 1fr; }
  .vrow .acts { grid-auto-flow: column; }
}

/* fixes */
.thumb img, .thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.vrow .thumb video { object-fit: cover; }
.cols { align-items: start; }

.help-note { background: #fff7e6; border: 1px solid #f4dcaa; color: #6a4b00; padding: .7rem .9rem; border-radius: 10px; font-size: .84rem; margin: 0 0 1rem; }
