* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #080c09; --bg2: #0e1611; --bg3: #16231a;
  --line: rgba(233,242,233,.10); --line2: rgba(233,242,233,.18);
  --leaf: #5aae30; --leafhi: #84d24a; --gold: #e7c485;
  --cloud: #edf3eb; --mist: #8fa496;
}
body { font-family: 'Poppins', sans-serif; background: var(--bg); color: var(--cloud); }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; border: none; border-radius: 9px; font-weight: 600; }
.primary { background: linear-gradient(120deg,#0f6f5c,#13a07f); color: #fff; padding: 10px 18px; }
.primary:hover { filter: brightness(1.08); }
.ghost { background: var(--bg3); color: var(--cloud); padding: 9px 14px; border: 1px solid var(--line2); }
.ghost:hover { border-color: var(--leaf); }
input, select { font-family: inherit; background: var(--bg2); border: 1px solid var(--line2);
  color: var(--cloud); padding: 10px 12px; border-radius: 9px; width: 100%; font-size: 13px; }
input:focus, select:focus { outline: none; border-color: var(--leafhi); }
label { display: block; font-size: 12px; color: var(--mist); margin: 14px 0 5px; }
.logo { font-weight: 800; font-size: 24px; letter-spacing: .5px; }
.logo span { color: var(--leafhi); }
.logo.small { font-size: 18px; }

/* gate */
.gate { position: fixed; inset: 0; display: grid; place-items: center;
  background: radial-gradient(900px 600px at 50% -10%, #11321f, #060b08); }
.gate-card { width: 360px; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 18px; padding: 32px; box-shadow: 0 30px 60px rgba(0,0,0,.4); }
.gate-sub { color: var(--mist); font-size: 13px; margin-top: 2px; margin-bottom: 8px; }
.gate-card button { width: 100%; margin-top: 20px; }
.gate-msg { font-size: 12.5px; margin-top: 12px; min-height: 16px; }
.gate-msg.err { color: #ff7a6b; }
.gate-msg.ok { color: var(--leafhi); }

/* app shell */
.app { display: flex; min-height: 100vh; }
.side { width: 230px; background: var(--bg2); border-right: 1px solid var(--line);
  padding: 26px 18px; display: flex; flex-direction: column; }
.side nav { margin-top: 28px; display: flex; flex-direction: column; gap: 4px; }
.side nav a { padding: 11px 13px; border-radius: 10px; color: var(--mist);
  font-size: 13.5px; font-weight: 500; cursor: pointer; }
.side nav a:hover { background: var(--bg3); color: var(--cloud); }
.side nav a.active { background: var(--bg3); color: var(--cloud); border: 1px solid var(--line2); }
.side-foot { margin-top: auto; font-size: 12px; color: var(--mist); }
.side-foot button { width: 100%; margin-top: 10px; }

/* main */
.main { flex: 1; padding: 30px 38px; overflow-y: auto; }
.head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.head h1 { font-size: 24px; font-weight: 700; }
.head > div { display: flex; gap: 10px; align-items: center; }
.head select { width: auto; }
.hint { color: var(--mist); font-size: 12.5px; margin-bottom: 16px; }
.msg { font-size: 12.5px; margin-top: 12px; min-height: 16px; color: var(--leafhi); }
.msg.err { color: #ff7a6b; }

.panel { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 22px; margin-bottom: 18px; }
.panel h3 { font-size: 14px; font-weight: 600; margin-bottom: 14px; color: var(--gold); }

/* kpis */
.kpis { display: flex; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.kpi { flex: 1; min-width: 150px; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 14px; padding: 18px 20px; }
.kpi .n { font-size: 30px; font-weight: 800; }
.kpi .l { font-size: 12px; color: var(--mist); margin-top: 2px; }

/* bars */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.bar-row .lbl { width: 150px; color: var(--cloud); }
.bar-row .track { flex: 1; height: 12px; background: var(--bg3); border-radius: 6px; overflow: hidden; }
.bar-row .fill { height: 100%; background: linear-gradient(90deg,#13a07f,#84d24a); }
.bar-row .val { width: 50px; text-align: right; color: var(--mist); }
.empty { color: var(--mist); font-size: 13px; }

/* lists (ads + schedule) */
.list { display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: 13px; padding: 16px 18px; }
.card .grid { display: grid; gap: 10px; }
.card .grid.ad { grid-template-columns: 1fr 1fr; }
.card .grid.prog { grid-template-columns: 1fr 1fr 90px 110px 1fr; }
.card .row1 { grid-column: 1 / -1; }
.card .del { background: transparent; color: #ff7a6b; border: 1px solid rgba(255,122,107,.4);
  padding: 6px 12px; font-size: 12px; justify-self: start; margin-top: 6px; }
@media (max-width: 760px) {
  .card .grid.ad, .card .grid.prog { grid-template-columns: 1fr; }
}

/* --- role-based CMS additions --- */
.side nav a.locked { display: none; }
.role {
  font-size: 11px;
  color: #7a8a6f;
  margin: 2px 0 8px;
  font-weight: 600;
}
.adv { margin-top: 14px; }
.adv summary { cursor: pointer; color: #7a8a6f; font-size: 12px; }
.adv label { margin-top: 8px; }

/* --- video upload progress --- */
.upload-prog {
  margin: 6px 0 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #12261a;
  border: 1px solid #21402c;
  color: #cfe0d3;
  font-size: 13px;
  line-height: 1.5;
}
.upload-prog.ok { border-color: #2e7d4f; }
.upload-prog.err { border-color: #9c3b3b; color: #f7b7b7; }
.upload-prog .track { margin-top: 8px; }

/* --- logo lockup --- */
.brand-lockup { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; }
.brand-logo-sm { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; }
.brand-name { font-size: 22px; font-weight: 800; color: #fff; }
.brand-name b { color: #84d24a; }
.brand-name-sm { font-size: 17px; font-weight: 800; color: #fff; }
.side-brand { margin-bottom: 8px; }

/* --- section headers in a tab --- */
.section-h { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: #7a8a6f; margin: 22px 0 10px; font-weight: 700; }
.tiny { padding: 2px 8px !important; font-size: 12px !important; }

/* --- video library grid --- */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.vcard { background: #12261a; border: 1px solid #21402c; border-radius: 12px; overflow: hidden; padding-bottom: 10px; }
.vthumb { aspect-ratio: 16/9; background-size: cover; background-position: center; background-color: #0e1f14; position: relative; }
.vstatus { position: absolute; top: 8px; left: 8px; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; }
.vstatus.ok { background: #2e7d4f; }
.vstatus.proc { background: #a9791f; }
.vlen { position: absolute; bottom: 8px; right: 8px; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 5px; background: rgba(0,0,0,.65); color: #fff; }
.vtitle { font-size: 13px; font-weight: 600; color: #e8f0e8; padding: 10px 10px 3px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vmeta { font-size: 11px; color: #7a8a6f; padding: 0 10px 8px; }
.add-sched { margin: 0 10px; width: calc(100% - 20px); }
.add-sched[disabled] { opacity: .5; cursor: default; }

/* --- delete button on video cards --- */
.vdel {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px; border-radius: 8px; border: none;
  background: rgba(0,0,0,.55); color: #fff; cursor: pointer;
  font-size: 14px; line-height: 1; display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.vdel:hover { background: #b23b3b; }
.vdel:disabled { opacity: .5; cursor: default; }

/* simplified schedule row (uploader/editor — no URL/type fields) */
.grid.prog.simple { grid-template-columns: 2fr 2fr 90px auto !important; }

/* share-link button on video cards */
.vshare { margin: 6px 10px 0; width: calc(100% - 20px); }
.vshare:disabled { opacity: .5; cursor: default; }
