/* ===== Tema ===== */
:root {
  --bg:#0b0b0e; --panel:#141419; --panel2:#1a1a21; --line:#262630; --line2:#33333f;
  --text:#ececf1; --muted:#8d8d9a; --accent:#ff4d4f;
  --ok:#34d399; --warn:#fbbf24; --bad:#f87171;
  --shadow:0 14px 40px rgba(0,0,0,.5); --radius:12px;
  --accent-soft:color-mix(in srgb, var(--accent) 14%, transparent);
  color-scheme:dark;
}
:root[data-theme="light"] {
  --bg:#f3f4f7; --panel:#ffffff; --panel2:#f6f7f9; --line:#e4e6ec; --line2:#d3d6df;
  --text:#1a1b21; --muted:#6a6e7c;
  --ok:#059669; --warn:#b45309; --bad:#dc2626;
  --shadow:0 14px 40px rgba(20,20,40,.14);
  color-scheme:light;
}
* { box-sizing:border-box; }
html { -webkit-text-size-adjust:100%; }
body { margin:0; background:var(--bg); color:var(--text); font:14px/1.45 Inter,Roboto,system-ui,-apple-system,"Segoe UI",sans-serif; }
a { color:var(--accent); }
h1,h2,h3 { margin:0; font-weight:650; letter-spacing:-.01em; }
.muted { color:var(--muted); }
small, .small { font-size:12px; }
.grow { flex:1; }
.ic { width:18px; height:18px; flex:none; }
[hidden] { display:none !important; }

/* ===== Marca / botões ===== */
.brand { display:inline-flex; align-items:center; gap:10px; color:var(--text); text-decoration:none; font-weight:750; font-size:17px; letter-spacing:-.01em; min-width:0; }
.brand i { width:32px; height:32px; border-radius:10px; background:var(--accent); color:#fff; display:grid; place-items:center; flex:none; box-shadow:0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent); }
.brand i .ic { width:15px; height:15px; margin-left:1px; }
.brand span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.btn { display:inline-flex; align-items:center; justify-content:center; gap:7px; border:1px solid var(--line2); background:var(--panel); color:var(--text); padding:8px 14px; border-radius:10px; cursor:pointer; font:inherit; font-weight:550; text-decoration:none; transition:background .15s,border-color .15s,transform .05s; white-space:nowrap; }
.btn:hover { border-color:var(--muted); background:var(--panel2); }
.btn:active { transform:translateY(1px); }
.btn.primary { background:var(--accent); border-color:var(--accent); color:#fff; }
.btn.primary:hover { filter:brightness(1.08); background:var(--accent); }
.btn.danger { color:var(--bad); }
.btn.danger:hover { border-color:var(--bad); background:color-mix(in srgb, var(--bad) 10%, transparent); }
.btn.ghost { background:transparent; border-color:transparent; }
.btn.ghost:hover { background:var(--panel2); }
.btn.sm { padding:5px 9px; font-size:12px; border-radius:8px; gap:5px; }
.btn.sm .ic { width:14px; height:14px; }
.btn.block { width:100%; padding:11px; margin-top:18px; }
.icon-btn { width:36px; height:36px; display:inline-grid; place-items:center; border-radius:10px; border:1px solid var(--line2); background:var(--panel); color:var(--text); cursor:pointer; text-decoration:none; flex:none; }
.icon-btn:hover { border-color:var(--muted); background:var(--panel2); }
[data-theme-toggle] .i-moon { display:none; }
:root[data-theme="light"] [data-theme-toggle] .i-moon { display:inline-flex; }
:root[data-theme="light"] [data-theme-toggle] .i-sun { display:none; }

/* ===== Formulários ===== */
label { display:block; font-size:12px; font-weight:550; color:var(--muted); margin:14px 0 5px; }
input:not([type=checkbox]):not([type=file]):not([type=color]), select, textarea {
  width:100%; padding:10px 12px; border-radius:10px; border:1px solid var(--line2); background:var(--bg); color:var(--text); outline:none; font:inherit; }
input:focus, select:focus, textarea:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
input[readonly] { opacity:.65; }
input[type=checkbox] { accent-color:var(--accent); width:16px; height:16px; }
input[type=color] { width:46px; height:40px; padding:2px; border-radius:10px; border:1px solid var(--line2); background:var(--bg); cursor:pointer; }
.hint { font-size:12px; color:var(--muted); margin-top:5px; }
.check { display:flex; align-items:center; gap:8px; color:var(--text); font-size:14px; font-weight:500; margin:14px 0 0; cursor:pointer; }
.fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 16px; }
.fields .full { grid-column:1 / -1; }
.chips-row { display:flex; gap:6px; flex-wrap:wrap; margin-top:8px; }
.alert { padding:11px 14px; border-radius:10px; margin-bottom:16px; font-size:13.5px; border:1px solid; }
.alert.ok { background:color-mix(in srgb, var(--ok) 11%, transparent); border-color:color-mix(in srgb, var(--ok) 40%, transparent); color:var(--ok); }
.alert.err { background:color-mix(in srgb, var(--bad) 11%, transparent); border-color:color-mix(in srgb, var(--bad) 40%, transparent); color:var(--bad); }
.alert.warn { background:color-mix(in srgb, var(--warn) 12%, transparent); border-color:color-mix(in srgb, var(--warn) 40%, transparent); color:var(--warn); }

/* ===== Badges ===== */
.badge { display:inline-flex; align-items:center; gap:5px; padding:3px 9px; border-radius:999px; font-size:11.5px; font-weight:600; border:1px solid; white-space:nowrap; }
.badge.ok   { color:var(--ok);   background:color-mix(in srgb, var(--ok) 12%, transparent);   border-color:color-mix(in srgb, var(--ok) 35%, transparent); }
.badge.warn { color:var(--warn); background:color-mix(in srgb, var(--warn) 12%, transparent); border-color:color-mix(in srgb, var(--warn) 35%, transparent); }
.badge.bad  { color:var(--bad);  background:color-mix(in srgb, var(--bad) 12%, transparent);  border-color:color-mix(in srgb, var(--bad) 35%, transparent); }
.badge.gray { color:var(--muted); background:var(--panel2); border-color:var(--line); }
.badge.acc  { color:var(--accent); background:var(--accent-soft); border-color:color-mix(in srgb, var(--accent) 35%, transparent); }

/* ===== Login ===== */
body.auth-page { min-height:100vh; display:grid; place-items:center; padding:16px;
  background:radial-gradient(900px 500px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.auth-theme { position:fixed; top:14px; right:14px; }
.auth-card { width:100%; max-width:400px; background:var(--panel); border:1px solid var(--line); border-radius:16px; padding:28px; box-shadow:var(--shadow); }
.auth-brand { margin-bottom:18px; }
.auth-card h1 { font-size:21px; }
.auth-card p { margin:4px 0 6px; }

/* ===== Cabeçalho (telas do usuário) ===== */
header.top { display:flex; align-items:center; gap:10px; padding:12px 20px; position:sticky; top:0; z-index:20; background:color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter:blur(10px); border-bottom:1px solid var(--line); }
.search { position:relative; flex:1; max-width:520px; margin:0 auto; min-width:120px; }
.search .ic { position:absolute; left:13px; top:50%; transform:translateY(-50%); color:var(--muted); width:16px; height:16px; }
.search input { padding-left:38px !important; border-radius:999px !important; background:var(--panel) !important; }
main { padding:20px; max-width:1400px; margin:0 auto; }
main.narrow { max-width:520px; }

/* ===== Grade de canais ===== */
.chips { display:flex; gap:8px; overflow-x:auto; padding:2px 0 8px; scrollbar-width:thin; }
.chip { border:1px solid var(--line2); background:var(--panel); color:var(--text); padding:7px 14px; border-radius:999px; cursor:pointer; font:inherit; font-size:13px; font-weight:550; white-space:nowrap; }
.chip:hover { border-color:var(--muted); }
.chip.on { background:var(--accent); border-color:var(--accent); color:#fff; }
h2.cat-title { font-size:17px; margin:26px 0 12px; display:flex; align-items:center; gap:10px; }
h2.cat-title small { color:var(--muted); font-weight:500; }
.grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:14px; }
.card { background:var(--panel); border:1px solid var(--line); border-radius:14px; overflow:hidden; cursor:pointer; position:relative; transition:transform .15s,border-color .15s,box-shadow .15s; }
.card:hover { transform:translateY(-3px); border-color:var(--accent); box-shadow:0 12px 28px rgba(0,0,0,.25); }
.thumb { aspect-ratio:16/9; display:flex; align-items:center; justify-content:center; padding:16px; background:radial-gradient(circle at 50% 35%, var(--panel2), var(--bg)); position:relative; }
.thumb img { max-width:68%; max-height:82%; object-fit:contain; }
.thumb .ph { font-size:28px; font-weight:800; color:var(--line2); letter-spacing:.04em; }
.thumb .play { position:absolute; inset:0; display:grid; place-items:center; background:rgba(0,0,0,.45); opacity:0; transition:opacity .15s; }
.thumb .play span { width:46px; height:46px; border-radius:50%; background:var(--accent); color:#fff; display:grid; place-items:center; }
.thumb .play .ic { width:18px; height:18px; margin-left:2px; }
.card:hover .play { opacity:1; }
.name { padding:10px 12px; font-size:13px; font-weight:550; border-top:1px solid var(--line); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.empty { color:var(--muted); text-align:center; padding:60px 20px; }
.empty .ic { width:34px; height:34px; opacity:.6; margin-bottom:8px; }

/* ===== Player ===== */
.modal { position:fixed; inset:0; background:rgba(0,0,0,.82); display:none; align-items:center; justify-content:center; z-index:50; padding:16px; }
.modal.open { display:flex; }
.pbox { background:#000; border:1px solid var(--line2); border-radius:16px; width:100%; max-width:1000px; overflow:hidden; }
.pbar { display:flex; align-items:center; gap:8px; padding:10px 14px; background:var(--panel); color:var(--text); }
.pbar .t { flex:1; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#pwrap video { width:100%; max-height:75vh; display:block; background:#000; }
#perr { color:var(--warn); font-size:13px; padding:8px 14px; display:none; background:var(--panel); }

/* ===== Painel (admin) ===== */
.app { display:grid; grid-template-columns:248px minmax(0,1fr); min-height:100vh; }
.side { position:sticky; top:0; height:100vh; display:flex; flex-direction:column; gap:4px; padding:16px 12px; background:var(--panel); border-right:1px solid var(--line); }
.side-top { padding:4px 8px 16px; }
.side nav { display:flex; flex-direction:column; gap:3px; }
.nav { display:flex; align-items:center; gap:11px; padding:10px 12px; border-radius:10px; color:var(--muted); text-decoration:none; font-weight:550; }
.nav:hover { background:var(--panel2); color:var(--text); }
.nav.on { background:var(--accent-soft); color:var(--accent); }
.side-bot { margin-top:auto; display:flex; flex-direction:column; gap:3px; border-top:1px solid var(--line); padding-top:12px; }
.side-user { display:flex; align-items:center; gap:10px; padding:8px 6px 0; }
.side-user .who { flex:1; min-width:0; line-height:1.2; }
.side-user b { display:block; overflow:hidden; text-overflow:ellipsis; }
.avatar { width:34px; height:34px; border-radius:50%; background:var(--accent-soft); color:var(--accent); display:grid; place-items:center; font-weight:700; flex:none; text-transform:uppercase; }
.content { padding:26px 30px 60px; min-width:0; max-width:1250px; width:100%; }
.page-head { display:flex; align-items:center; gap:12px; margin-bottom:22px; flex-wrap:wrap; }
.page-head h1 { font-size:24px; }
.page-head p { margin:2px 0 0; color:var(--muted); }
.page-head .titles { flex:1; min-width:200px; }
.panel { background:var(--panel); border:1px solid var(--line); border-radius:14px; }
.panel-pad { padding:20px; }
.panel h3 { font-size:15px; margin-bottom:12px; }
.panel-head { display:flex; align-items:center; gap:10px; padding:16px 20px 0; }
.panel-head h3 { margin:0; flex:1; }

.stats { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:14px; margin-bottom:18px; }
.stat { background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:16px 18px; display:flex; gap:14px; align-items:center; }
.stat .ico { width:42px; height:42px; border-radius:12px; display:grid; place-items:center; background:var(--accent-soft); color:var(--accent); flex:none; }
.stat .ico .ic { width:20px; height:20px; }
.stat b { display:block; font-size:24px; line-height:1.1; letter-spacing:-.02em; }
.stat span { color:var(--muted); font-size:12.5px; }
.two { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }

.toolbar { display:flex; align-items:center; gap:10px; padding:14px 16px; border-bottom:1px solid var(--line); flex-wrap:wrap; }
.toolbar .search { margin:0; max-width:340px; flex:1 1 220px; }
.toolbar select { width:auto; min-width:170px; }
.bulkbar { display:flex; align-items:center; gap:8px; padding:10px 16px; background:var(--accent-soft); border-bottom:1px solid var(--line); flex-wrap:wrap; }
.bulkbar input { width:210px !important; padding:6px 10px !important; }

.tablewrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; }
th, td { text-align:left; padding:11px 14px; border-bottom:1px solid var(--line); vertical-align:middle; }
th { color:var(--muted); font-weight:600; font-size:11.5px; text-transform:uppercase; letter-spacing:.05em; background:var(--panel); white-space:nowrap; }
tbody tr:hover { background:var(--panel2); }
tbody tr:last-child td { border-bottom:0; }
tr.off td:not(.act):not(.chk) { opacity:.5; }
td.chk, th.chk { width:36px; padding-right:0; }
td.lg { width:64px; }
td.lg img { height:30px; max-width:52px; object-fit:contain; display:block; }
td.lg .noimg { width:40px; height:30px; border-radius:6px; background:var(--panel2); display:grid; place-items:center; font-size:10px; font-weight:700; color:var(--muted); }
td.act { text-align:right; white-space:nowrap; }
td.act .btn { vertical-align:middle; }
td.act .btn + .btn, td.act .btn + form { margin-left:4px; }
.cell-user { display:flex; align-items:center; gap:10px; }
.url { display:block; color:var(--muted); font-size:12px; max-width:340px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.row-empty { text-align:center; color:var(--muted); padding:40px; }

.list { list-style:none; margin:0; padding:0; }
.list li { display:flex; align-items:center; gap:10px; padding:10px 0; border-top:1px solid var(--line); }
.list li:first-child { border-top:0; }
.list .grow { min-width:0; }

/* seletor de cor */
.swatch { width:26px; height:26px; border-radius:50%; border:2px solid var(--panel); box-shadow:0 0 0 1px var(--line2); cursor:pointer; padding:0; }
.swatch:hover { transform:scale(1.12); }

/* upload */
.drop { display:flex; flex-direction:column; align-items:center; gap:8px; text-align:center; padding:32px 16px; border:2px dashed var(--line2); border-radius:14px; cursor:pointer; color:var(--muted); background:var(--panel2); }
.drop:hover, .drop.over { border-color:var(--accent); color:var(--text); }
.drop .ic { width:30px; height:30px; color:var(--accent); }
.drop b { color:var(--text); }
.drop input { display:none; }
.steps { margin:0; padding-left:18px; color:var(--muted); }
.steps li { margin:4px 0; }
code { background:var(--panel2); border:1px solid var(--line); padding:1px 6px; border-radius:6px; font-size:12px; }

/* diálogos */
dialog { border:1px solid var(--line2); border-radius:16px; padding:0; background:var(--panel); color:var(--text); width:min(560px, calc(100vw - 24px)); box-shadow:var(--shadow); }
dialog::backdrop { background:rgba(0,0,0,.65); backdrop-filter:blur(2px); }
dialog form { padding:22px; }
dialog h3 { font-size:18px; margin-bottom:4px; }
.dlg-foot { display:flex; justify-content:flex-end; gap:8px; margin-top:22px; }

@media (max-width: 880px) {
  .app { display:block; }
  .side { position:sticky; top:0; z-index:30; height:auto; flex-direction:row; align-items:center; gap:6px; padding:8px 10px; overflow-x:auto; border-right:0; border-bottom:1px solid var(--line); }
  .side-top { padding:0 6px 0 0; }
  .side nav { flex-direction:row; }
  .nav { padding:8px 10px; white-space:nowrap; }
  .side-bot { margin:0 0 0 auto; flex-direction:row; border:0; padding:0; align-items:center; }
  .side-bot .nav span, .side-user .who, .side .brand span { display:none; }
  .side-user { padding:0; }
  .content { padding:18px 14px 50px; }
  .two { grid-template-columns:1fr; }
  .fields { grid-template-columns:1fr; }
}
@media (max-width: 520px) { header.top .brand span { display:none; } }
@media (max-width: 640px) {
  .hide-sm { display:none; }
  header.top { padding:10px 12px; }
  main { padding:14px 12px; }
  .grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
}

/* ===== Categorias em menu lateral (tela de canais) ===== */
.browse.has-side { display:grid; grid-template-columns:252px minmax(0,1fr); align-items:start; }
.browse main { max-width:none; margin:0; min-width:0; }
.cats { position:sticky; top:61px; height:calc(100vh - 61px); overflow-y:auto; padding:16px 12px 28px; border-right:1px solid var(--line); background:var(--panel); display:flex; flex-direction:column; gap:2px; scrollbar-width:thin; }
.cats-title { font-size:11.5px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); font-weight:600; padding:4px 10px 8px; }
.cats .chip { display:flex; align-items:center; justify-content:space-between; gap:10px; width:100%; text-align:left; border:0; background:transparent; border-radius:10px; padding:9px 12px; color:var(--muted); font-weight:550; white-space:normal; }
.cats .chip:hover { background:var(--panel2); color:var(--text); }
.cats .chip.on { background:var(--accent-soft); color:var(--accent); }
.cats .chip small { flex:none; font-size:11.5px; color:var(--muted); background:var(--panel2); border-radius:999px; padding:1px 8px; }
.cats .chip.on small { background:var(--accent); color:#fff; }
@media (max-width: 880px) {
  .browse.has-side { display:block; }
  .cats { top:57px; height:auto; z-index:10; flex-direction:row; gap:6px; overflow-x:auto; overflow-y:hidden; padding:8px 12px; border-right:0; border-bottom:1px solid var(--line); }
  .cats-title { display:none; }
  .cats .chip { width:auto; white-space:nowrap; border:1px solid var(--line2); border-radius:999px; padding:6px 12px; }
  .cats .chip.on { border-color:var(--accent); }
}

/* ===== EPG nos cards ===== */
.name b { display:block; font-weight:550; overflow:hidden; text-overflow:ellipsis; }
.name .epg { display:block; margin-top:2px; min-height:15px; font-size:11.5px; font-weight:450; color:var(--muted); overflow:hidden; text-overflow:ellipsis; }
.prog { position:absolute; left:0; right:0; bottom:0; height:3px; }
.prog i { display:block; height:100%; width:0; background:var(--accent); }

/* ===== Eventos ao vivo ===== */
.events-wrap { margin-bottom:6px; }
.ev-head { display:flex; align-items:center; gap:8px; }
.ev-row { display:flex; gap:14px; overflow-x:auto; scroll-snap-type:x proximity; padding:2px 2px 10px; scrollbar-width:none; }
.ev-row::-webkit-scrollbar { display:none; }
.ev { flex:0 0 310px; scroll-snap-align:start; background:var(--panel); border:1px solid var(--line); border-radius:14px; overflow:hidden; display:flex; flex-direction:column; }
.ev-top { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:13px 14px 0; font-size:12.5px; font-weight:600; }
.ev-time { display:inline-flex; align-items:center; gap:6px; white-space:nowrap; }
.ev-time .ic { width:14px; height:14px; }
.ev-league { color:var(--muted); font-weight:550; text-align:right; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ev-teams { flex:1; display:flex; align-items:center; justify-content:space-around; gap:8px; padding:18px 10px 20px; }
.tm { display:flex; flex-direction:column; align-items:center; gap:8px; flex:1; min-width:0; text-align:center; font-size:12.5px; font-weight:600; }
.tm .tl { width:54px; height:54px; object-fit:contain; }
.tm span { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.tm.solo .tl { width:46px; height:46px; }
.tm.solo span { white-space:normal; font-size:14px; }
.vs { color:var(--muted); font-size:12px; font-weight:700; }
.ev-foot { display:flex; border-top:1px solid var(--line); }
.ev-btn { flex:1; min-width:0; display:flex; align-items:center; justify-content:center; gap:7px; border:0; background:var(--accent); color:#fff; padding:11px 10px; font:inherit; font-size:12.5px; font-weight:700; cursor:pointer; text-transform:uppercase; letter-spacing:.03em; }
.ev-btn + .ev-btn { border-left:1px solid rgba(255,255,255,.35); }
.ev-btn:hover { filter:brightness(1.1); }
.ev-btn .ic { width:13px; height:13px; }
.ev-btn span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.live { display:inline-flex; align-items:center; gap:6px; color:var(--bad); font-weight:800; letter-spacing:.05em; }
.live i { width:8px; height:8px; border-radius:50%; background:var(--bad); animation:pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow:0 0 0 0 color-mix(in srgb, var(--bad) 55%, transparent); } 100% { box-shadow:0 0 0 8px transparent; } }
@media (max-width: 640px) { .ev { flex-basis:84%; } }
