/* ═══ RangePorts · Painel Premium ═══════════════════════════════════════ */
:root {
  --bg: #07030f;
  --bg-2: #0d0618;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-strong: rgba(255, 255, 255, 0.07);
  --panel-border: rgba(255, 255, 255, 0.09);
  --text: #f2edff;
  --muted: #a79ec4;
  --faint: #6d6590;
  --gold: #f5d67b;
  --gold-2: #c9a227;
  --violet: #8b5cf6;
  --fuchsia: #e879f9;
  --emerald: #34d399;
  --rose: #fb7185;
  --sky: #38bdf8;
  --font: 'Inter', system-ui, sans-serif;
  --disp: 'Sora', 'Inter', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --grad-gold: linear-gradient(120deg, #f7e08c, #e9c25c 40%, #c9a227 80%, #f5d67b);
  --grad-brand: linear-gradient(120deg, #8b5cf6, #d946ef 55%, #fb7185);
  --shadow-gold: 0 10px 32px rgba(233, 194, 92, 0.28);
  --shadow-brand: 0 10px 32px rgba(217, 70, 239, 0.28);
  /* Fundo dos inputs: escuro "afundado", com contraste contra o card de vidro */
  --input-bg:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)),
    linear-gradient(rgba(8, 4, 22, 0.68), rgba(8, 4, 22, 0.68));
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(233, 194, 92, 0.35); }
/* Scrollbar fina e temática (WebKit + Firefox) */
* { scrollbar-width: thin; scrollbar-color: rgba(139, 92, 246, 0.55) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, rgba(139, 92, 246, 0.5), rgba(217, 70, 239, 0.5)); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, var(--gold), var(--gold-2)); }
::-webkit-scrollbar-corner { background: transparent; }

.hidden { display: none !important; }
.gold {
  background: var(--grad-gold);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(245, 214, 123, 0.35));
}

/* ─── Fundo animado: aurora, orbes, grid, estrelas ─────────────────── */
.bg {
  position: fixed; inset: 0; z-index: -4;
  background:
    radial-gradient(55% 45% at 12% 8%, rgba(139, 92, 246, 0.22), transparent 60%),
    radial-gradient(45% 40% at 88% 15%, rgba(217, 70, 239, 0.14), transparent 60%),
    radial-gradient(60% 50% at 50% 105%, rgba(233, 194, 92, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  animation: aurora 22s ease-in-out infinite alternate;
}
@keyframes aurora {
  0% { filter: hue-rotate(0deg) brightness(1); }
  50% { filter: hue-rotate(-14deg) brightness(1.05); }
  100% { filter: hue-rotate(18deg) brightness(1.1); }
}
.grid-overlay {
  position: fixed; inset: 0; z-index: -3; pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 0%, black 30%, transparent 75%);
}
.stars {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(255,255,255,0.75), transparent),
    radial-gradient(1px 1px at 70% 12%, rgba(255,255,255,0.55), transparent),
    radial-gradient(1.5px 1.5px at 85% 62%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 40% 82%, rgba(255,255,255,0.45), transparent),
    radial-gradient(1px 1px at 8% 68%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.2px 1.2px at 55% 38%, rgba(255,255,255,0.4), transparent);
  animation: twinkle 7s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.65; } to { opacity: 1; } }
.orb {
  position: fixed; z-index: -3; border-radius: 50%; pointer-events: none;
  filter: blur(90px); opacity: 0.5;
}
.orb-1 { width: 380px; height: 380px; top: -120px; right: -80px; background: #7c3aed; animation: drift1 26s ease-in-out infinite alternate; }
.orb-2 { width: 300px; height: 300px; bottom: -100px; left: -60px; background: #c9a227; opacity: 0.28; animation: drift2 32s ease-in-out infinite alternate; }
.orb-3 { width: 240px; height: 240px; top: 40%; left: 55%; background: #d946ef; opacity: 0.22; animation: drift3 24s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(-70px, 90px) scale(1.15); } }
@keyframes drift2 { to { transform: translate(80px, -70px) scale(1.2); } }
@keyframes drift3 { to { transform: translate(-50px, -60px) scale(0.9); } }

/* ─── Glass / cards ────────────────────────────────────────────────── */
.glass {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(18px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.card {
  border-radius: 20px;
  padding: 22px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  animation: rise 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.card::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(600px 200px at 15% 0%, rgba(139, 92, 246, 0.10), transparent 60%);
}
.card-head { margin-bottom: 16px; position: relative; }
.card-head h2 { font-family: var(--disp); font-size: 13px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: #e8e1fb; }
.card.narrow { max-width: 520px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ─── Login ────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  position: relative; overflow: hidden;
}
.login-wrap::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(700px 420px at 12% 0%, rgba(120, 80, 220, 0.16), transparent 60%),
    radial-gradient(600px 380px at 90% 100%, rgba(233, 194, 92, 0.10), transparent 60%);
}
.login-shell {
  position: relative; width: 100%; max-width: 940px; min-height: 560px;
  display: grid; grid-template-columns: 1.05fr 1fr;
  border-radius: 30px; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: linear-gradient(160deg, rgba(22, 12, 44, 0.92), rgba(12, 6, 26, 0.96));
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(26px);
  animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
/* Lado branding (esquerda) */
.login-brand {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(480px 320px at 70% 18%, rgba(233, 194, 92, 0.14), transparent 65%),
    radial-gradient(420px 340px at 12% 88%, rgba(124, 80, 240, 0.22), transparent 60%),
    linear-gradient(160deg, rgba(30, 16, 58, 0.9), rgba(15, 8, 32, 0.94));
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.login-brand::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(520px 380px at 50% 40%, #000 30%, transparent 75%);
}
.login-brand-inner { position: relative; text-align: center; padding: 40px; z-index: 1; }
.login-logo-big {
  width: 84px; height: 84px; margin: 0 auto 22px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 700; font-size: 30px; color: #1a1206;
  border-radius: 24px;
  background: var(--grad-gold);
  box-shadow: var(--shadow-gold);
  animation: pulseGlow 3.2s ease-in-out infinite;
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 22px rgba(245, 214, 123, 0.4); }
  50% { box-shadow: 0 0 46px rgba(245, 214, 123, 0.8); }
}
.login-brand-inner h1 { font-family: var(--disp); font-size: 34px; font-weight: 800; letter-spacing: 0.5px; }
.login-tag { color: var(--muted); font-size: 13px; margin-top: 10px; letter-spacing: 0.4px; }
.login-feats {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 28px;
}
.login-feats span {
  font-size: 11px; font-weight: 600; color: rgba(233, 194, 92, 0.92);
  padding: 6px 12px; border-radius: 99px;
  background: rgba(233, 194, 92, 0.08); border: 1px solid rgba(233, 194, 92, 0.22);
}
.login-brand-glow {
  position: absolute; bottom: -140px; left: 50%; transform: translateX(-50%);
  width: 420px; height: 260px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(124, 80, 240, 0.28), transparent);
  filter: blur(30px); pointer-events: none;
}
/* Form (direita) */
.login-card {
  display: flex; flex-direction: column; justify-content: center;
  padding: 48px 44px; position: relative;
  animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}
.login-logo-sm {
  width: 46px; height: 46px; margin-bottom: 22px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 700; font-size: 17px; color: #1a1206;
  border-radius: 14px;
  background: var(--grad-gold); box-shadow: var(--shadow-gold);
}
.login-card h2 { font-family: var(--disp); font-size: 23px; font-weight: 800; }
.login-card .sub { color: var(--muted); font-size: 12.5px; margin: 6px 0 26px; }
/* Campo de senha com olho (mostrar / ocultar) */
.pass-wrap { position: relative; display: flex; align-items: center; }
.pass-wrap .input, .pass-wrap input { width: 100%; padding-right: 46px; }
.pass-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; cursor: pointer;
  font-size: 16px; color: var(--muted);
  transition: color 0.2s, background 0.2s;
}
.pass-toggle:hover { color: var(--gold); background: rgba(233, 194, 92, 0.1); }
.login-card .field .input { text-align: left; }
.login-submit { margin-top: 8px; }
@media (max-width: 780px) {
  .login-shell { grid-template-columns: 1fr; max-width: 430px; }
  .login-brand { display: none; }
  .login-card { padding: 42px 30px; }
}

/* ─── Layout: sidebar + conteúdo ───────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0;
  display: flex; flex-direction: column;
  padding: 22px 14px 16px;
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  background: linear-gradient(180deg, rgba(16, 8, 32, 0.84), rgba(10, 5, 22, 0.92));
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(22px);
  z-index: 20;
  transition: width 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 20px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }

/* Botão de recolher/expandir (seta) — flutua na borda direita da sidebar
   (desktop) e abre/fecha a gaveta (mobile). Funciona nos dois. */
.side-toggle {
  position: fixed; top: 28px; left: 234px; z-index: 45;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(233, 194, 92, 0.5);
  background: linear-gradient(135deg, #2b1f0a, #171007);
  color: var(--gold); font-size: 16px; line-height: 1; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: left 0.32s cubic-bezier(0.22, 1, 0.36, 1), transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s, color 0.2s;
}
.side-toggle:hover { box-shadow: 0 0 18px rgba(233, 194, 92, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12); color: #fff; }
.shell.collapsed .side-toggle { left: 60px; transform: rotate(180deg); }

/* Fundo escurecido quando a sidebar abre em telas pequenas */
.side-backdrop {
  position: fixed; inset: 0; z-index: 39;
  background: rgba(4, 2, 10, 0.55);
  backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.28s ease;
}
.shell.sidebar-open .side-backdrop { opacity: 1; pointer-events: auto; }

/* ─── Estado recolhido (trilho só com ícones) — desktop e mobile ─── */
.shell.collapsed .sidebar { width: 74px; }
.shell.collapsed .side-brand { justify-content: center; padding: 0 0 18px; }
.shell.collapsed .side-brand-txt { display: none; }
.shell.collapsed .nav-sec { display: none; }
.shell.collapsed .nav-item { justify-content: center; padding: 11px 0; }
.shell.collapsed .nav-item .ni { width: auto; font-size: 16px; }
.shell.collapsed .nav-item .nl { display: none; }
.shell.collapsed .nav-item:hover { transform: none; }
.shell.collapsed .nav-item.active::before { left: 50%; transform: translateX(-50%); top: auto; bottom: -1px; width: 26px; height: 3px; }
.shell.collapsed .side-foot { display: flex; justify-content: center; }
.shell.collapsed .user-chip { flex-direction: column; gap: 9px; padding: 6px; background: none; }
.shell.collapsed .user-info { display: none; }
.shell.collapsed #logout-btn { border: none; background: rgba(255, 255, 255, 0.05); }

/* Tooltip (espécie de alt) dos ícones quando a sidebar está recolhida */
.side-tip {
  position: fixed; z-index: 90;
  transform: translateY(-50%);
  padding: 7px 13px;
  background: linear-gradient(160deg, rgba(43, 31, 10, 0.97), rgba(23, 16, 7, 0.97));
  border: 1px solid rgba(233, 194, 92, 0.5);
  border-radius: 10px;
  color: #f5e7bd; font: 600 12.5px var(--font);
  white-space: nowrap; text-align: left;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55), 0 0 16px rgba(233, 194, 92, 0.18);
  opacity: 0; pointer-events: none;
  transition: opacity 0.16s ease;
}
.side-tip.show { opacity: 1; }
.side-tip::before {
  content: ''; position: absolute; left: -5px; top: 50%;
  width: 9px; height: 9px;
  background: #1c1308;
  border-left: 1px solid rgba(233, 194, 92, 0.5);
  border-bottom: 1px solid rgba(233, 194, 92, 0.5);
  transform: translateY(-50%) rotate(45deg);
}
.brand-logo {
  width: 44px; height: 44px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 800; font-size: 16px; color: #1a1206;
  border-radius: 14px;
  background: var(--grad-gold);
  box-shadow: var(--shadow-gold);
}
.side-brand h1 { font-family: var(--disp); font-size: 17px; font-weight: 800; letter-spacing: 0.02em; }
.side-brand p { color: var(--faint); font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; margin-top: 2px; }
.side-nav { flex: 1; overflow-y: auto; padding-top: 14px; }
.nav-sec {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--faint); padding: 14px 10px 7px; margin-top: 4px;
}
.nav-item {
  width: 100%; display: flex; align-items: center; gap: 11px;
  background: none; border: none; cursor: pointer;
  color: var(--muted); font: 600 13px var(--font);
  padding: 10px 12px; border-radius: 12px;
  margin-bottom: 2px; position: relative;
  transition: all 0.22s ease;
}
.nav-item .ni { font-size: 15px; width: 20px; text-align: center; opacity: 0.85; transition: transform 0.22s; }
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); transform: translateX(3px); }
.nav-item:hover .ni { transform: scale(1.15); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(100deg, rgba(139, 92, 246, 0.28), rgba(217, 70, 239, 0.12));
  box-shadow: inset 0 0 0 1px rgba(217, 70, 239, 0.35), 0 6px 20px rgba(217, 70, 239, 0.16);
}
.nav-item.active::before {
  content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 99px;
  background: var(--grad-gold);
  box-shadow: 0 0 14px rgba(245, 214, 123, 0.8);
}
.side-foot { border-top: 1px solid rgba(255, 255, 255, 0.06); padding-top: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); }
.avatar {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--disp); font-weight: 800; font-size: 14px; color: #1a1206;
  background: var(--grad-gold);
}
.user-info { flex: 1; min-width: 0; }
.user-info b { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info small { color: var(--faint); font-size: 10.5px; }
#logout-btn { background: rgba(255,255,255,0.05); border: 1px solid var(--panel-border); }

.content { flex: 1; min-width: 0; padding: 26px 30px 70px; max-width: 1320px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; animation: rise 0.4s ease both; }
.page-head h2 { font-family: var(--disp); font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.sub { color: var(--muted); font-size: 12.5px; }

/* ─── Botões ───────────────────────────────────────────────────────── */
.btn {
  border: none; cursor: pointer;
  font: 600 13px var(--font);
  border-radius: 12px;
  padding: 10px 18px;
  position: relative; overflow: hidden;
  transition: all 0.22s ease;
  display: inline-flex; align-items: center; gap: 7px;
}
.btn-gold {
  color: #241a05;
  background: var(--grad-gold);
  background-size: 180% 180%;
  box-shadow: var(--shadow-gold);
  animation: goldShift 6s ease infinite;
}
@keyframes goldShift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.btn-gold::after {
  content: ''; position: absolute; top: 0; left: -80%;
  width: 50%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-20deg);
  animation: shine 3.6s ease-in-out infinite;
}
@keyframes shine { 0%, 55% { left: -80%; } 85%, 100% { left: 130%; } }
.btn-gold:hover { transform: translateY(-2px); filter: brightness(1.07); box-shadow: 0 14px 40px rgba(233, 194, 92, 0.4); }
.btn-gold:active { transform: translateY(0); }
.btn-ghost { color: var(--text); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--panel-border); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.11); transform: translateY(-1px); }
.btn-danger { color: #fda4af; background: rgba(244, 63, 94, 0.12); border: 1px solid rgba(244, 63, 94, 0.35); }
.btn-danger:hover { background: rgba(244, 63, 94, 0.24); transform: translateY(-1px); }
.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 9px; }
.w-full { width: 100%; justify-content: center; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mt { margin-top: 14px; }
.back { margin-bottom: 14px; }
.icon-btn {
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.09); border-radius: 9px;
  color: var(--muted); cursor: pointer; padding: 5px 9px; font-size: 12px;
  transition: all 0.16s;
}
.icon-btn:hover { color: var(--gold); border-color: rgba(233, 194, 92, 0.45); transform: translateY(-1px); }
.icon-btn.danger:hover { color: #fda4af; border-color: rgba(244, 63, 94, 0.5); }

/* ─── Formulários ──────────────────────────────────────────────────── */
.field { display: block; margin-bottom: 14px; text-align: left; }
.field span { display: block; font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 7px; }
.input, .field input, .field select, .field textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 11px 14px;
  color: var(--text);
  font: 500 13px var(--font);
  outline: none;
  color-scheme: dark; /* calendários/pickers nativos escuros */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), inset 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: border 0.2s, box-shadow 0.2s, background 0.2s;
}
.input:hover, .field input:hover, .field select:hover, .field textarea:hover {
  border-color: rgba(255, 255, 255, 0.26);
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: rgba(233, 194, 92, 0.62);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018)),
    linear-gradient(rgba(12, 6, 30, 0.8), rgba(12, 6, 30, 0.8));
  box-shadow: 0 0 0 3px rgba(233, 194, 92, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.input::placeholder, .field input::placeholder { color: var(--faint); }
.input[readonly], .input:disabled { opacity: 0.6; cursor: not-allowed; }

/* Selects: seta customizada em vez da nativa (combina com o tema) */
select.input, .field select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #a79ec4 50%),
    linear-gradient(135deg, #a79ec4 50%, transparent 50%),
    var(--input-bg);
  background-position: right 18px center, right 13px center, 0 0;
  background-size: 5px 5px, 5px 5px, auto;
  background-repeat: no-repeat;
  padding-right: 36px;
  cursor: pointer;
}
select.input:hover, .field select:hover { background-image:
    linear-gradient(45deg, transparent 50%, #c9b8e8 50%),
    linear-gradient(135deg, #c9b8e8 50%, transparent 50%),
    var(--input-bg);
}
select.input option, .field select option { background: #150b2c; color: var(--text); }

/* Pré-visualização dos vídeos que o cliente recebe */
.vid-chip { cursor: help; font-size: 12px; margin-left: 6px; opacity: 0.85; transition: transform 0.2s; }
.vid-chip:hover { opacity: 1; transform: scale(1.15); }
.vid-preview { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.vp-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
}
.vp-row span { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.vp-row code {
  font-family: var(--mono); font-size: 11px; color: var(--gold); text-align: right;
  max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.user-form .input { width: auto; flex: 1; min-width: 160px; }

/* Lista de grupos de usuários */
.grupos-grid { display: flex; flex-direction: column; gap: 8px; }
.grupo-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 12px; padding: 9px 14px;
}
.grupo-row .grupo-nome { font-weight: 700; flex: 1; min-width: 140px; }
.grupo-count { font-size: 11px; color: var(--faint); }
.grupo-row .btn-row { margin: 0; }
.check { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--gold); }
.stack { display: flex; flex-direction: column; gap: 4px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters .input { width: 230px; }
#chan-category.input { width: auto; min-width: 200px; }
#chan-search.input { width: 260px; }

/* ─── Chips ────────────────────────────────────────────────────────── */
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 14px;
  font: 600 12px var(--font);
  cursor: pointer;
  transition: all 0.2s;
}
.chip:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.2); }
.chip.active {
  color: #241a05; font-weight: 700;
  background: var(--grad-gold);
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(233, 194, 92, 0.3);
}

/* ─── Stat cards ───────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-grid.mini { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--panel-border);
  border-radius: 18px; padding: 18px;
  position: relative; overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: rise 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.stat::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--grad-gold); opacity: 0.7;
}
.stat:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(139, 92, 246, 0.22); }
.stat .num {
  font-family: var(--mono); font-weight: 700; font-size: 28px;
  background: var(--grad-gold);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat .lbl { color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; margin-top: 6px; }
.stat .extra { color: var(--faint); font-size: 11.5px; margin-top: 3px; }
.stat .extra.ok { color: var(--emerald); }
.stat .extra.bad { color: var(--rose); }

/* ─── Tabelas ──────────────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--faint); font-weight: 700; padding: 9px 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}
.tbl td { padding: 11px; border-bottom: 1px solid rgba(255, 255, 255, 0.045); vertical-align: middle; }
.tbl tbody tr { transition: background 0.15s, transform 0.15s; }
.tbl tbody tr:hover { background: rgba(139, 92, 246, 0.09); }
.mono { font-family: var(--mono); font-size: 12px; color: #cfc6ec; }
.feat {
  font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
  border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.feat-scan { background: rgba(56, 189, 248, 0.14); color: #7dd3fc; border: 1px solid rgba(56, 189, 248, 0.32); }
.feat-iptv { background: rgba(52, 211, 153, 0.14); color: #6ee7b7; border: 1px solid rgba(52, 211, 153, 0.32); }
.feat-editor { background: rgba(217, 70, 239, 0.14); color: #f0abfc; border: 1px solid rgba(217, 70, 239, 0.32); }
.empty { color: var(--faint); text-align: center; padding: 28px 0; font-size: 13px; }
.table-scroll { overflow: auto; max-height: 520px; border: 1px solid rgba(255, 255, 255, 0.06); border-radius: 14px; }
.table-scroll .tbl th { position: sticky; top: 0; background: rgba(13, 6, 24, 0.95); z-index: 1; backdrop-filter: blur(8px); }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.code-block {
  margin: 8px 0 0; padding: 12px 14px; border-radius: 10px; overflow: auto;
  font-family: var(--mono); font-size: 12px; line-height: 1.55; color: #cfc6ec;
  background: rgba(10, 5, 20, 0.7); border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Badges de status */
.badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.07em;
  border-radius: 999px; padding: 3px 10px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px;
}
.badge-ok { color: #6ee7b7; background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.35); }
.badge-bad { color: #fda4af; background: rgba(244, 63, 94, 0.12); border: 1px solid rgba(244, 63, 94, 0.35); }
.badge-warn { color: #fde68a; background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.35); }
.badge-gold { color: #241a05; background: var(--grad-gold); border: none; box-shadow: 0 4px 12px rgba(233, 194, 92, 0.3); }

/* Conexões ao vivo (contador ativas/limite) */
.conn-live {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  color: var(--faint);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 999px; padding: 3px 11px;
  transition: all 0.25s ease;
}
.conn-live::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: #6b6487; transition: background 0.25s;
}
.conn-live.hot { color: #6ee7b7; border-color: rgba(52, 211, 153, 0.4); background: rgba(52, 211, 153, 0.08); }
.conn-live.hot::before { background: var(--emerald); animation: pulseDot 1.4s ease-in-out infinite; }
.conn-live.full { color: #fde68a; border-color: rgba(251, 191, 36, 0.45); background: rgba(251, 191, 36, 0.08); }
.conn-live.full::before { background: #fbbf24; animation: pulseDot 1.4s ease-in-out infinite; }
@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.45); }
  50% { box-shadow: 0 0 0 5px rgba(52, 211, 153, 0); }
}
.live-strip { display: flex; gap: 8px; margin: -6px 0 14px; }

/* Canais (cache) */
.group-row td {
  background: rgba(139, 92, 246, 0.12);
  color: #c4b5fd;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 8px 11px;
}
.group-row:hover td { background: rgba(139, 92, 246, 0.12); }
.chan-name { font-weight: 600; }
.rename-badge {
  display: inline-block; font-size: 10px; font-weight: 700; color: #fde68a;
  background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 999px; padding: 1px 7px; margin-left: 6px; white-space: nowrap; vertical-align: middle;
}
.chan-orig { color: var(--faint); font-size: 11px; font-style: italic; margin-top: 2px; }
.cat-chip {
  display: inline-block; font-size: 10.5px; font-weight: 600; color: #c4b5fd;
  background: rgba(99, 102, 241, 0.12); border: 1px solid rgba(99, 102, 241, 0.32);
  border-radius: 999px; padding: 2px 9px; white-space: nowrap;
}
.vod-chip {
  color: #fcd34d; background: rgba(250, 204, 21, 0.1); border-color: rgba(250, 204, 21, 0.35);
}
.vod-sem-pacote { color: #fca5a5; }
.faint { color: var(--faint); }
.sel-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 2px 0 12px; padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
}
.sel-bar .sel-all { color: #d8d2f2; }
.sel-bar .btn-row { margin-left: auto; }
.sel-bar input[type='checkbox'] { accent-color: var(--gold, #fbbf24); width: 15px; height: 15px; cursor: pointer; }
.row-excluded { opacity: 0.55; }
.row-excluded td { background: rgba(239, 68, 68, 0.05); }
.excl-badge {
  color: #fca5a5; background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.4);
}
.faint { color: var(--faint); }

/* ─── Categorias (layout 2 colunas + drag & drop) ──────────────────── */
.cat-layout { display: grid; grid-template-columns: 420px 1fr; gap: 18px; align-items: start; animation: rise 0.45s ease both; }
.picker-col { position: sticky; top: 18px; }
.pick-list { max-height: 520px; overflow-y: auto; margin-top: 14px; display: flex; flex-direction: column; gap: 7px; padding-right: 4px; }
.pick-row {
  display: flex; align-items: center; gap: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 11px; padding: 8px 10px;
  cursor: grab; user-select: none;
  transition: all 0.18s;
}
.pick-row:hover { border-color: rgba(233, 194, 92, 0.4); background: rgba(233, 194, 92, 0.06); transform: translateX(3px); }
.pick-row:active { cursor: grabbing; }
.pick-row.dragging { opacity: 0.45; }
.pick-row .grip { color: var(--faint); font-size: 13px; }
.pick-row .pick-name { flex: 1; min-width: 0; font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-row .pick-cat { font-size: 10px; color: var(--faint); white-space: nowrap; }
.pick-row .add-mini {
  background: none; border: 1px solid rgba(233, 194, 92, 0.35); border-radius: 8px;
  color: var(--gold); cursor: pointer; font-size: 13px; width: 26px; height: 26px; flex-shrink: 0;
  transition: all 0.15s;
}
.pick-row .add-mini:hover { background: var(--grad-gold); color: #241a05; }

.cat-list { display: flex; flex-direction: column; gap: 14px; }
.cat-card {
  border-radius: 18px; padding: 14px;
  transition: border 0.2s, box-shadow 0.2s;
  animation: rise 0.4s ease both;
}
.cat-card.active { border-color: rgba(233, 194, 92, 0.55); box-shadow: 0 0 0 1px rgba(233, 194, 92, 0.35), 0 14px 34px rgba(233, 194, 92, 0.12); }
.cat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; cursor: pointer; }
.cat-title { font-family: var(--disp); font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 9px; }
.cat-title .count {
  font-size: 10.5px; font-weight: 700; color: var(--gold);
  background: rgba(233, 194, 92, 0.12); border: 1px solid rgba(233, 194, 92, 0.35);
  border-radius: 999px; padding: 1px 9px;
}
.cat-actions { display: flex; gap: 6px; }
.cat-channels { display: flex; flex-direction: column; gap: 6px; min-height: 30px; border-radius: 10px; padding: 4px; transition: all 0.2s; }
.cat-channels.drag-over, .cat-head.drag-over {
  outline: 2px dashed rgba(233, 194, 92, 0.7);
  outline-offset: 2px;
  background: rgba(233, 194, 92, 0.06);
}
.cc-row {
  display: flex; align-items: center; gap: 9px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px; padding: 7px 10px;
  cursor: grab; user-select: none;
  transition: all 0.15s;
}
.cc-row:hover { border-color: rgba(139, 92, 246, 0.4); background: rgba(139, 92, 246, 0.08); }
.cc-row.dragging { opacity: 0.4; }
.cc-row .ord { color: var(--faint); font-family: var(--mono); font-size: 11px; width: 20px; text-align: center; }
.cc-row .cc-name { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-row .cc-rm {
  background: none; border: none; color: var(--faint); cursor: pointer; font-size: 13px;
  padding: 2px 5px; border-radius: 7px; transition: all 0.15s;
}
.cc-row .cc-rm:hover { color: #fda4af; background: rgba(244, 63, 94, 0.15); }
.cc-src {
  font-family: var(--mono); font-size: 10.5px; font-weight: 700; color: var(--gold);
  background: rgba(212, 175, 55, 0.12); border-radius: 20px; padding: 2px 8px; flex-shrink: 0;
}
.cc-src.warn { color: #fbbf24; background: rgba(251, 191, 36, 0.14); }
.cc-switch {
  background: none; border: none; color: var(--faint); cursor: pointer; font-size: 13px;
  padding: 2px 5px; border-radius: 7px; transition: all 0.25s; flex-shrink: 0;
}
.cc-switch:hover { color: var(--gold); transform: rotate(180deg); background: rgba(212, 175, 55, 0.12); }
.cat-empty-note { color: var(--faint); font-size: 12px; text-align: center; padding: 14px; border: 1px dashed rgba(255, 255, 255, 0.1); border-radius: 10px; }

/* Criador de canais — buscador de fontes do D1 no modal */
.src-picker { margin-bottom: 4px; }
.src-disp {
  max-height: 210px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
  margin: 10px 0 12px; padding-right: 4px;
}
.src-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px; transition: all 0.15s;
}
.src-opt:hover { border-color: rgba(233, 194, 92, 0.5); background: rgba(212, 175, 55, 0.08); }
.src-opt { flex-wrap: wrap; }
.src-opt-name { flex: 1; min-width: 0; font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-opt-cat { font-size: 11px; color: var(--faint); white-space: nowrap; }
.src-opt-url { width: 100%; font-size: 10.5px; color: var(--faint); opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-opt-url::before { content: '🔗 '; opacity: 0.7; }
.src-opt .add-mini { flex-shrink: 0; }
.src-pager { text-align: center; padding: 4px 0 2px; }
.src-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.src-row { display: flex; gap: 8px; align-items: center; }
.src-row .input { flex: 1; }
.src-row.sel { cursor: default; background: rgba(139, 92, 246, 0.08); border: 1px solid rgba(139, 92, 246, 0.25); }
.src-row .sel-name { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-row .sel-url { font-size: 10.5px; color: var(--faint); max-width: 42%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── Modal ────────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(4, 2, 10, 0.72);
  backdrop-filter: blur(10px);
  animation: fadeIn 0.25s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
  border-radius: 22px; padding: 26px;
  animation: modalPop 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
  position: relative;
}
.modal-card::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 55%; height: 2px; background: var(--grad-gold); box-shadow: 0 0 18px rgba(245, 214, 123, 0.6);
}
@keyframes modalPop { from { opacity: 0; transform: translateY(26px) scale(0.96); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h3 { font-family: var(--disp); font-size: 17px; font-weight: 800; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.modal-body-note { color: var(--faint); font-size: 12px; margin-bottom: 14px; }
.cat-checklist { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; padding: 4px; }
.cat-check {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 11px; padding: 10px 12px; cursor: pointer; transition: all 0.15s;
}
.cat-check:hover { border-color: rgba(233, 194, 92, 0.4); }
.cat-check input { accent-color: var(--gold); }
.cat-check .cc-name { flex: 1; font-size: 13px; font-weight: 600; }
.cat-check .cc-count { font-size: 11px; color: var(--faint); }
.cat-check.checked { border-color: rgba(233, 194, 92, 0.55); background: rgba(233, 194, 92, 0.07); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.link-box {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 11px; padding: 9px 12px; margin: 8px 0;
}
.link-box code { flex: 1; font-family: var(--mono); font-size: 11.5px; color: #cfc6ec; word-break: break-all; }

/* ─── Mensagens / toast ────────────────────────────────────────────── */
.error-msg, .msg { border-radius: 12px; padding: 11px 14px; font-size: 13px; margin-top: 12px; }
.error-msg { color: #fda4af; background: rgba(244, 63, 94, 0.12); border: 1px solid rgba(244, 63, 94, 0.32); }
.msg { color: #6ee7b7; background: rgba(52, 211, 153, 0.1); border: 1px solid rgba(52, 211, 153, 0.32); }
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: rgba(13, 6, 24, 0.95);
  border: 1px solid rgba(233, 194, 92, 0.5);
  color: var(--text); font-size: 13px; font-weight: 600;
  border-radius: 999px; padding: 11px 22px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55), 0 0 24px rgba(233, 194, 92, 0.15);
  z-index: 80;
  animation: rise 0.3s ease;
}

/* Editor */
#editor-categories { margin-bottom: 14px; }

/* ─── Responsivo ───────────────────────────────────────────────────── */
/* Telas médias/pequenas: sidebar vira gaveta lateral esquerda com backdrop */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; height: 100dvh;
    width: 264px;
    transform: none;
    transition: width 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 40;
  }
  /* Fechada = trilho de ícones SEMPRE visível à esquerda (largura do
     estado recolhido); aberta = gaveta expande por cima do conteúdo. */
  .shell.collapsed .sidebar { width: 74px; }
  .side-toggle { top: 14px; left: 60px; transform: rotate(180deg); }
  .shell.sidebar-open .side-toggle { left: 250px; transform: none; }
  /* Título alinhado: recuo do conteúdo para não encostar na seta/trilho */
  .content { padding: 18px 14px 60px 92px; }
  .shell.sidebar-open .content { padding-left: 14px; }
  .page-head { margin-top: 4px; }
  .cat-layout { grid-template-columns: 1fr; }
  .picker-col { position: static; }
  .two-col { grid-template-columns: 1fr; }
}

/* Telas bem pequenas */
@media (max-width: 520px) {
  .content { padding: 14px 10px 56px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-grid.mini { grid-template-columns: 1fr 1fr; }
  .card { padding: 16px; }
  .filters .input { width: 100%; }
  #chan-category.input, #chan-search.input { width: 100%; }
  .page-head h2 { font-size: 20px; }
  .login-card { padding: 32px 22px; }
}

/* ─── Balance (servidores) ──────────────────────────────────────────── */
.bal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.bal-card { border: 1px solid var(--panel-border); border-radius: 16px; padding: 16px 16px 8px; }
.bal-card:hover { border-color: rgba(233, 194, 92, 0.35); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35); }
.bal-head { display: flex; align-items: center; gap: 10px; }
.bal-toggle {
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--panel-border); color: var(--gold);
  width: 28px; height: 28px; border-radius: 9px; cursor: pointer; font-size: 12px; flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), background 0.2s, color 0.2s;
}
.bal-toggle:hover { background: rgba(233, 194, 92, 0.14); }
.bal-toggle.open { transform: rotate(90deg); }
.bal-info { flex: 1; min-width: 0; }
.bal-info b { font-family: var(--disp); font-size: 14.5px; }
.bal-meta { font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bal-pct { font-size: 12px; font-weight: 700; white-space: nowrap; }
.bal-pct.green { color: var(--emerald); }
.bal-pct.amber { color: var(--gold); }
.bal-pct.red { color: var(--rose); }
.bal-bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); margin: 12px 0 4px; overflow: hidden; }
.bal-fill { height: 100%; border-radius: 99px; transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1); }
.bal-fill.green { background: linear-gradient(90deg, var(--emerald), #10b981); }
.bal-fill.amber { background: linear-gradient(90deg, var(--gold-2), var(--gold)); }
.bal-fill.red { background: linear-gradient(90deg, #f43f5e, var(--rose)); }
.bal-chans { margin: 10px 0 6px; border-top: 1px dashed var(--panel-border); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.bal-chan { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.035); }
.bal-chan b { flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bal-chan .btn-row { flex-shrink: 0; }
/* Card do balance colorido pelo status da instalação:
   verde = instalado com sucesso, vermelho = erro, âmbar = instalando */
.bal-card.bal-st-online { border-color: rgba(52, 211, 153, 0.45); box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.12), 0 8px 30px rgba(0, 0, 0, 0.3); }
.bal-card.bal-st-online:hover { border-color: rgba(52, 211, 153, 0.65); box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.2), 0 0 24px rgba(52, 211, 153, 0.12), 0 8px 30px rgba(0, 0, 0, 0.35); }
.bal-card.bal-st-erro { border-color: rgba(251, 113, 133, 0.5); }
.bal-card.bal-st-instalando { border-color: rgba(233, 194, 92, 0.5); }
/* Status de instalação do balance (agente remoto) */
.bal-status {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 99px; white-space: nowrap;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--panel-border); color: var(--muted);
}
.bal-status.online { color: var(--emerald); border-color: rgba(52, 211, 153, 0.4); background: rgba(52, 211, 153, 0.1); }
.bal-status.erro { color: var(--rose); border-color: rgba(251, 113, 133, 0.4); background: rgba(251, 113, 133, 0.1); }
.bal-status.instalando { color: var(--gold); border-color: rgba(233, 194, 92, 0.4); background: rgba(233, 194, 92, 0.1); animation: pulse-dot 1.4s ease-in-out infinite; }
/* Indicador online: ponto que pulsa quando a fonte ativa está respondendo */
.dot-online, .cnl-online {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; display: inline-block;
  background: var(--rose); box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.15);
}
.dot-online.on, .cnl-online.on {
  background: var(--emerald); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18);
  animation: pulse-dot 2.2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.14); }
  50% { box-shadow: 0 0 0 5px rgba(52, 211, 153, 0.28); }
}
.cnl-online { margin-left: 8px; vertical-align: 2px; }
.bal-chip {
  display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 99px;
  font-size: 10.5px; font-weight: 600; color: var(--gold);
  background: linear-gradient(120deg, rgba(233, 194, 92, 0.14), rgba(139, 92, 246, 0.14));
  border: 1px solid rgba(233, 194, 92, 0.3); vertical-align: 2px;
}

.auto-chip { background: rgba(248, 113, 113, 0.12) !important; border-color: rgba(248, 113, 113, 0.4) !important; color: #fca5a5 !important; }
.geo-chip {
  display: inline-block; padding: 2px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 600; color: #a5b4fc; white-space: nowrap;
  background: rgba(99, 102, 241, 0.1); border: 1px solid rgba(129, 140, 248, 0.28);
}

/* Medidor de bitrate por canal */
.br-cell { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.br-bar {
  flex: 1; height: 7px; border-radius: 99px; min-width: 70px;
  background: rgba(255, 255, 255, 0.08); overflow: hidden;
}
.br-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #10b981, #e9c25c, #f472b6);
  box-shadow: 0 0 12px rgba(233, 194, 92, 0.35);
  transition: width 0.5s ease;
}
.br-val { font-size: 12px; font-weight: 600; color: var(--gold); white-space: nowrap; }
/* Chip de consumo por canal (Criador de canais e canais do balance) */
.br-chip {
  display: inline-block; padding: 2px 8px; border-radius: 99px;
  font-size: 10.5px; font-weight: 600; color: var(--gold); white-space: nowrap;
  background: rgba(233, 194, 92, 0.1); border: 1px solid rgba(233, 194, 92, 0.28);
  vertical-align: 2px; min-width: 88px; text-align: center;
}
/* Total de consumo por balance (cabeçalho do card) */
.bal-tot-wrap { flex-shrink: 0; text-align: right; }
.bal-total {
  font-size: 10.5px; color: var(--faint); margin-top: 3px; white-space: nowrap;
}

@media (max-width: 900px) {
  .bal-grid { grid-template-columns: 1fr; }
}

/* ─── Editor de domínios do cliente (modal) ───────────────────────────── */
.dom-editor {
  background: var(--glass, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--bd, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  padding: 12px;
  margin: 0 0 16px;
}
.dom-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.dom-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.35);
  color: var(--gold, #e6c55c);
  font-size: 0.8rem;
}
.dom-x {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  opacity: 0.75;
  padding: 0;
}
.dom-x:hover { opacity: 1; color: #ff6b6b; }
.dom-add-row { display: flex; gap: 8px; }
.dom-add-row .input { flex: 1; }
.dom-extra { color: var(--gold, #e6c55c); font-size: 0.72rem; margin-top: 2px; }

/* ─── Links da lista: teste (painel) e enviar (domínio do cliente) ───── */
.link-box-col { flex-direction: column; align-items: stretch; gap: 4px; }
.link-row { display: flex; align-items: center; gap: 6px; }
.link-row code { flex: 1; min-width: 0; }
.link-tag {
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--gold, #e6c55c); background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.3); border-radius: 6px; padding: 2px 6px;
  white-space: nowrap;
}
.link-row + .link-row .link-tag { color: #7dd3fc; background: rgba(125, 211, 252, 0.1); border-color: rgba(125, 211, 252, 0.3); }

/* ─── IPs permitidos (anti-roubo) ─────────────────────────────────────── */
.ip-extra { color: #7dd3fc; font-size: 0.72rem; margin-top: 2px; }

/* ─── EPG (guia de programação / XMLTV) ───────────────────────────────── */
.epg-add { display: grid; grid-template-columns: minmax(160px, 240px) 1fr auto; gap: 10px; }
.epg-add .input { width: 100%; }
.epg-sugs { display: flex; flex-wrap: wrap; gap: 8px; }
.epg-sugs .chip { cursor: pointer; transition: all 0.18s; }
.epg-sugs .chip:hover { background: rgba(212, 175, 55, 0.22); border-color: rgba(212, 175, 55, 0.6); transform: translateY(-2px); }
.epg-chip { background: rgba(217, 70, 239, 0.12) !important; border-color: rgba(217, 70, 239, 0.35) !important; color: #f0abfc !important; }
.epg-erro { display: block; font-size: 10px; font-weight: 500; color: #fda4af; max-width: 260px; white-space: normal; }
.ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge-err { color: #fda4af; background: rgba(244, 63, 94, 0.12); border: 1px solid rgba(244, 63, 94, 0.35); }
.epg-pick { margin: -4px 0 14px; }
.epg-pick .input { margin-bottom: 8px; }
.src-opt.picked {
  border-color: rgba(52, 211, 153, 0.6);
  background: rgba(52, 211, 153, 0.12);
  box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.3);
}
.src-opt.picked .add-mini { color: #6ee7b7; }

@media (max-width: 720px) {
  .epg-add { grid-template-columns: 1fr; }
}

/* ─── API Xtream (conversor PHP) ──────────────────────────────────────── */
.xt-dl { display: flex; flex-direction: column; gap: 10px; }
.xt-dl-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px; padding: 10px 14px;
  transition: border-color 0.18s, background 0.18s;
}
.xt-dl-row:hover { border-color: rgba(233, 194, 92, 0.35); background: rgba(233, 194, 92, 0.04); }
.xt-dl-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.xt-dl-info b { font-size: 13.5px; color: #f0abfc; }
.xt-dl-info .sub { margin: 0; }
.xt-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--muted, #b9b0d6); font-size: 13px; }
.xt-steps li::marker { color: var(--gold, #e6c55c); font-weight: 700; }

/* ─── Documento (API de revenda) ──────────────────────────────────────── */
.doc-list { margin: 0 0 4px; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 13px; }
.doc-sec { font-family: var(--disp); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #c4b5fd; margin: 18px 0 8px; }
.doc-sec:first-child { margin-top: 0; }
.doc-call {
  display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center;
  padding: 8px 11px; margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.02); border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px; transition: border-color 0.18s, background 0.18s;
}
.doc-call:hover { border-color: rgba(125, 211, 252, 0.35); background: rgba(125, 211, 252, 0.04); }
.doc-method {
  font-size: 10px; font-weight: 800; color: #6ee7b7;
  background: rgba(16, 185, 129, 0.12); border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 6px; padding: 2px 7px;
}
.doc-url { font-size: 12px; word-break: break-all; line-height: 1.5; }
.doc-desc { grid-column: 1 / -1; color: var(--faint); font-size: 12px; }
.doc-code {
  background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px; padding: 12px; overflow: auto;
  font-size: 11.5px; line-height: 1.55; color: #a5f3fc;
}
