/* SAM TV OFICIAL — Painel administrativo */
:root {
  --bg: #070A14;
  --bg-2: #10162A;
  --bg-3: #182039;
  --line: #2A3354;
  --purple: #741BFF;
  --purple-2: #A020F0;
  --blue: #1677FF;
  --text: #FFFFFF;
  --text-2: #B7BED4;
  --ok: #3FBF7F;
  --warn: #E5A93B;
  --err: #E5534B;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
a { color: #9B8CFF; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.25; }
h1 { font-size: 20px; }
h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
h2 i { color: var(--purple-2); }
h3 { font-size: 14px; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; margin-top: 20px; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); letter-spacing: .02em; }
.upper { text-transform: uppercase; }
.break { word-break: break-all; }
.accent { color: var(--purple-2); }
.pos { color: var(--ok); font-weight: 600; }
.neg { color: var(--err); font-weight: 600; }

/* ---------- estrutura ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex-shrink: 0; background: var(--bg-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand strong { display: block; letter-spacing: .06em; }
.brand small { display: block; color: var(--text-2); font-size: 12px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--purple-2) 50%, var(--blue)); font-size: 18px;
}
.brand.big { justify-content: center; padding-bottom: 22px; }
.brand-logo { width: 38px; height: 38px; flex-shrink: 0; }
.brand.big .brand-logo { width: 46px; height: 46px; }
.brand.big strong { font-size: 18px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a, .logout button {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px;
  color: var(--text-2); font: inherit; background: none; border: 0; cursor: pointer; width: 100%; text-align: left;
}
.sidebar nav a:hover, .logout button:hover { background: var(--bg-3); color: var(--text); text-decoration: none; }
.sidebar nav a.active { background: rgba(116, 27, 255, .22); color: #fff; box-shadow: inset 3px 0 0 var(--purple-2); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1px solid var(--line);
  background: rgba(7, 10, 20, .9); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(6px);
}
.topbar h1 { flex: 1; margin: 0; }
.who { display: flex; gap: 8px; flex-wrap: wrap; }
.menu-toggle { display: none; background: none; border: 0; color: var(--text); font-size: 24px; cursor: pointer; }
.content { padding: 22px 24px; flex: 1; }
.foot { padding: 14px 24px; color: var(--text-2); font-size: 12px; border-top: 1px solid var(--line); }

/* ---------- blocos ---------- */
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.grid-2.wide-left { grid-template-columns: 1.6fr 1fr; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; color: var(--text);
}
.stat:hover { text-decoration: none; border-color: var(--purple); }
.stat i { grid-row: span 2; font-size: 22px; color: var(--purple-2); align-self: center; }
.stat b { font-size: 22px; }
.stat span { color: var(--text-2); font-size: 13px; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--bg-3); font-size: 13px; }
.chip.muted { color: var(--text-2); }
dl.info { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0 0 14px; }
dl.info dt { color: var(--text-2); }
dl.info dd { margin: 0; }
ol.steps { padding-left: 20px; color: var(--text-2); }
ol.steps li { margin-bottom: 6px; }

/* ---------- tabelas ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid rgba(42, 51, 84, .55); vertical-align: middle; }
.table.compact td { padding: 7px 8px; }
.table tbody tr:hover { background: rgba(24, 32, 57, .6); }
.row-link { cursor: pointer; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-ok { background: rgba(63, 191, 127, .16); color: var(--ok); }
.badge-warn { background: rgba(229, 169, 59, .16); color: var(--warn); }
.badge-err { background: rgba(229, 83, 75, .16); color: var(--err); }
.badge-muted { background: var(--bg-3); color: var(--text-2); }
.pager { display: flex; gap: 6px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.pager a { padding: 4px 10px; border-radius: 8px; background: var(--bg-3); color: var(--text); }
.pager a.current { background: var(--purple); }

/* ---------- formulários ---------- */
.form { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--text-2); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; width: 100%;
}
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--purple); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(116, 27, 255, .6); outline-offset: 0; border-color: var(--purple); }
input:disabled { opacity: .6; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: end; }
.form-actions { display: flex; gap: 8px; }
.inline { display: inline; }
.inline-form { flex-direction: row; align-items: center; flex-wrap: wrap; }
.inline-form select, .inline-form input { width: auto; flex: 1; min-width: 160px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters input { flex: 1; min-width: 220px; width: auto; }
.filters select { width: auto; }
.push-right { margin-left: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-3); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { border-color: var(--purple); text-decoration: none; }
.btn-primary { background: linear-gradient(135deg, var(--purple), var(--purple-2)); border-color: transparent; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-danger { color: #ffb3ae; }
.btn-danger:hover { border-color: var(--err); }
.btn-sm { padding: 5px 9px; font-size: 13px; }
.btn-block { width: 100%; }

.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; }
.alert-ok { background: rgba(63, 191, 127, .1); border-color: rgba(63, 191, 127, .4); }
.alert-error { background: rgba(229, 83, 75, .1); border-color: rgba(229, 83, 75, .45); }

/* ---------- login/instalação ---------- */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 16px;
  background: radial-gradient(circle at 20% 10%, rgba(116, 27, 255, .25), transparent 40%), radial-gradient(circle at 90% 90%, rgba(22, 119, 255, .18), transparent 40%), var(--bg); }
.auth-card { width: 100%; max-width: 380px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; padding: 26px; display: flex; flex-direction: column; gap: 14px; }
.auth-card.wide { max-width: 480px; }

/* ---------- celular ---------- */
@media (max-width: 900px) {
  .grid-2, .grid-2.wide-left { grid-template-columns: 1fr; }
  .row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; left: -260px; z-index: 20; transition: left .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.6); }
  .sidebar.open { left: 0; }
  .menu-toggle { display: block; }
  .content { padding: 16px; }
  .topbar { padding: 10px 14px; }
  .who .chip.muted { display: none; }
  .row-2 { grid-template-columns: 1fr; }
  dl.info { grid-template-columns: 110px 1fr; }
}
[hidden] { display: none !important; }

/* ---------- 1.3.0 ---------- */
.bulk-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.bulk-bar select { width: auto; }
.badge-role { background: rgba(116, 27, 255, .18); color: #CDB8FF; }
.badge-sub { background: rgba(22, 119, 255, .16); color: #8EC0FF; }
.impersonate-bar { background: linear-gradient(90deg, #E5A93B, #E5534B); color: #1a0f00; font-weight: 700; padding: 8px 24px; display: flex; gap: 12px; align-items: center; }
.impersonate-bar form { margin-left: auto; }
.impersonate-bar button { background: #1a0f00; color: #fff; border: 0; border-radius: 8px; padding: 5px 12px; font: inherit; cursor: pointer; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: start; }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: 8px; }
.chart .bar { flex: 1; background: linear-gradient(180deg, var(--purple-2), var(--purple)); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.chart .bar:hover::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #000; color: #fff; font-size: 11px; padding: 3px 6px; border-radius: 6px; white-space: nowrap; margin-bottom: 4px; }
.chart-axis { display: flex; justify-content: space-between; color: var(--text-2); font-size: 11px; margin-top: 6px; }
.hbar { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; margin-bottom: 8px; }
.hbar .track { grid-column: 1 / -1; height: 8px; background: var(--bg-3); border-radius: 4px; overflow: hidden; }
.hbar .fill { height: 100%; background: linear-gradient(90deg, var(--purple), var(--blue)); }
.stat.money b { color: #7CF0B0; }
.kpi-note { font-size: 12px; color: var(--text-2); }
.limit-pill { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 999px; background: var(--bg-3); font-size: 13px; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); color: var(--text-2); font-weight: 600; }
.tabs a.active { background: rgba(116, 27, 255, .22); color: #fff; border-color: var(--purple); }
.tabs a:hover { text-decoration: none; color: #fff; }
.qr { background: #fff; padding: 10px; border-radius: 12px; width: 240px; height: 240px; }
.pkg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.pkg { background: var(--bg-3); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.pkg b { font-size: 22px; }
.pkg .price { color: #7CF0B0; font-size: 18px; font-weight: 700; }
textarea.code { font-family: var(--mono); font-size: 12px; }
.swatch { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line); display: inline-block; vertical-align: middle; }
input[type=color] { padding: 2px; height: 40px; }
@media (max-width: 900px) { .grid-3 { grid-template-columns: 1fr; } }

/* barra de envio */
.progress { display: flex; flex-direction: column; gap: 6px; }
.progress .bar-fill { height: 10px; border-radius: 6px; background: linear-gradient(90deg, var(--purple), var(--blue)); transition: width .2s; }
details summary { cursor: pointer; color: var(--text-2); margin: 8px 0; }

/* personalização */
.logo-thumb { width: 72px; height: 72px; object-fit: contain; background: var(--bg-3); border-radius: 12px; padding: 6px; }
.banner-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.banner-list figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.banner-list img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; }
.preview-card { position: sticky; top: 80px; }
.tv-preview { --t-primary: #741BFF; --t-accent: #A020F0; --t-secondary: #1677FF; --t-background: #070A14; --t-surface: #10162A; --t-card: #182039; --t-text: #FFFFFF; --t-text2: #B7BED4; --t-focus: #FFFFFF;
  background: var(--t-background); color: var(--t-text); border-radius: 14px; padding: 14px; aspect-ratio: 16/9; display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--line); }
.tv-top { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.tv-logo { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: linear-gradient(135deg, var(--t-primary), var(--t-accent)); overflow: hidden; font-size: 12px; }
.tv-logo img { width: 100%; height: 100%; object-fit: contain; }
.tv-clock { margin-left: auto; color: var(--t-text2); }
.tv-grid { flex: 1; display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.1fr; grid-template-rows: 1fr 1fr; gap: 7px; font-size: 12px; font-weight: 700; }
.tv-card { border-radius: 9px; display: grid; place-items: center; background: linear-gradient(160deg, color-mix(in srgb, var(--t-primary) 35%, var(--t-card)), var(--t-card)); border: 1px solid rgba(255,255,255,.08); }
.tv-card.big { grid-row: span 2; background: linear-gradient(160deg, var(--t-accent), var(--t-primary) 55%, var(--t-secondary)); }
.tv-card.focus { outline: 2px solid var(--t-focus); }
.tv-side { border-radius: 9px; background: var(--t-surface); display: flex; align-items: center; padding-left: 10px; color: var(--t-text); border: 1px solid rgba(255,255,255,.08); }
.tv-grid .tv-side:nth-of-type(4) { grid-column: 4; grid-row: 1; }
.tv-layout-note { margin: 0; font-size: 11px; color: var(--t-text2); }

/* alturas/larguras de gráficos (CSP não permite style inline) */
.h0{height:0%}.h1{height:1%}.h2{height:2%}.h3{height:3%}.h4{height:4%}.h5{height:5%}.h6{height:6%}.h7{height:7%}.h8{height:8%}.h9{height:9%}.h10{height:10%}.h11{height:11%}.h12{height:12%}.h13{height:13%}.h14{height:14%}.h15{height:15%}.h16{height:16%}.h17{height:17%}.h18{height:18%}.h19{height:19%}.h20{height:20%}.h21{height:21%}.h22{height:22%}.h23{height:23%}.h24{height:24%}.h25{height:25%}.h26{height:26%}.h27{height:27%}.h28{height:28%}.h29{height:29%}.h30{height:30%}.h31{height:31%}.h32{height:32%}.h33{height:33%}.h34{height:34%}.h35{height:35%}.h36{height:36%}.h37{height:37%}.h38{height:38%}.h39{height:39%}.h40{height:40%}.h41{height:41%}.h42{height:42%}.h43{height:43%}.h44{height:44%}.h45{height:45%}.h46{height:46%}.h47{height:47%}.h48{height:48%}.h49{height:49%}.h50{height:50%}.h51{height:51%}.h52{height:52%}.h53{height:53%}.h54{height:54%}.h55{height:55%}.h56{height:56%}.h57{height:57%}.h58{height:58%}.h59{height:59%}.h60{height:60%}.h61{height:61%}.h62{height:62%}.h63{height:63%}.h64{height:64%}.h65{height:65%}.h66{height:66%}.h67{height:67%}.h68{height:68%}.h69{height:69%}.h70{height:70%}.h71{height:71%}.h72{height:72%}.h73{height:73%}.h74{height:74%}.h75{height:75%}.h76{height:76%}.h77{height:77%}.h78{height:78%}.h79{height:79%}.h80{height:80%}.h81{height:81%}.h82{height:82%}.h83{height:83%}.h84{height:84%}.h85{height:85%}.h86{height:86%}.h87{height:87%}.h88{height:88%}.h89{height:89%}.h90{height:90%}.h91{height:91%}.h92{height:92%}.h93{height:93%}.h94{height:94%}.h95{height:95%}.h96{height:96%}.h97{height:97%}.h98{height:98%}.h99{height:99%}.h100{height:100%}
.w0{width:0%}.w1{width:1%}.w2{width:2%}.w3{width:3%}.w4{width:4%}.w5{width:5%}.w6{width:6%}.w7{width:7%}.w8{width:8%}.w9{width:9%}.w10{width:10%}.w11{width:11%}.w12{width:12%}.w13{width:13%}.w14{width:14%}.w15{width:15%}.w16{width:16%}.w17{width:17%}.w18{width:18%}.w19{width:19%}.w20{width:20%}.w21{width:21%}.w22{width:22%}.w23{width:23%}.w24{width:24%}.w25{width:25%}.w26{width:26%}.w27{width:27%}.w28{width:28%}.w29{width:29%}.w30{width:30%}.w31{width:31%}.w32{width:32%}.w33{width:33%}.w34{width:34%}.w35{width:35%}.w36{width:36%}.w37{width:37%}.w38{width:38%}.w39{width:39%}.w40{width:40%}.w41{width:41%}.w42{width:42%}.w43{width:43%}.w44{width:44%}.w45{width:45%}.w46{width:46%}.w47{width:47%}.w48{width:48%}.w49{width:49%}.w50{width:50%}.w51{width:51%}.w52{width:52%}.w53{width:53%}.w54{width:54%}.w55{width:55%}.w56{width:56%}.w57{width:57%}.w58{width:58%}.w59{width:59%}.w60{width:60%}.w61{width:61%}.w62{width:62%}.w63{width:63%}.w64{width:64%}.w65{width:65%}.w66{width:66%}.w67{width:67%}.w68{width:68%}.w69{width:69%}.w70{width:70%}.w71{width:71%}.w72{width:72%}.w73{width:73%}.w74{width:74%}.w75{width:75%}.w76{width:76%}.w77{width:77%}.w78{width:78%}.w79{width:79%}.w80{width:80%}.w81{width:81%}.w82{width:82%}.w83{width:83%}.w84{width:84%}.w85{width:85%}.w86{width:86%}.w87{width:87%}.w88{width:88%}.w89{width:89%}.w90{width:90%}.w91{width:91%}.w92{width:92%}.w93{width:93%}.w94{width:94%}.w95{width:95%}.w96{width:96%}.w97{width:97%}.w98{width:98%}.w99{width:99%}.w100{width:100%}
