:root{
  --bg-page:#f5f7fb;
  --surface-0:#ffffff;
  --surface-1:#eef2f9;
  --border:#e1e6f0;
  --border-strong:#c9d2e3;
  --blue:#1f5fd1;
  --blue-dark:#123a7a;
  --blue-tint:#eaf1ff;
  --blue-glow: rgba(31,95,209,0.18);
  --gold:#b8863c;
  --gold-tint:#faf3e6;
  --text-primary:#12172b;
  --text-secondary:#5b6478;
  --text-muted:#98a1b8;
}
*{box-sizing:border-box;}
body{
  margin:0;
  font-family:'Inter',sans-serif;
  background: var(--bg-page);
  color:var(--text-primary);
}

/* ---------- LOGIN ---------- */
.login-wrap{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  background:
    radial-gradient(circle at 20% 10%, var(--blue-tint), transparent 45%),
    linear-gradient(160deg, #ffffff 0%, #eef2f9 100%);
  padding:40px;
}
.login-card{
  width:100%;
  max-width:380px;
  background:var(--surface-0);
  border:1px solid var(--border);
  border-radius:18px;
  padding:40px 36px;
  box-shadow:0 20px 60px rgba(18,58,122,0.08);
}
.login-logo{ display:flex; justify-content:center; margin-bottom:24px;}
.login-logo img{ height:46px; display:block; }
.login-card h1{
  font-family:'Inter',sans-serif;
  font-size:19px;
  font-weight:600;
  text-align:center;
  margin:0 0 6px;
  color:var(--text-primary);
}
.login-card p.sub{
  text-align:center;
  color:var(--text-secondary);
  font-size:13px;
  margin:0 0 28px;
}
.field{ margin-bottom:16px; }
.field label{ display:block; font-size:12px; color:var(--text-secondary); margin-bottom:6px;}
.field input{
  width:100%;
  padding:12px 14px;
  border-radius:10px;
  border:1px solid var(--border-strong);
  background:#fff;
  color:var(--text-primary);
  font-size:14px;
}
.field input:focus{ outline:none; border-color:var(--blue); box-shadow:0 0 0 3px var(--blue-glow);}
.btn-primary{
  width:100%;
  padding:13px;
  margin-top:10px;
  border:none;
  border-radius:10px;
  background:linear-gradient(135deg, var(--blue), var(--blue-dark));
  color:#fff;
  font-weight:600;
  font-size:14px;
  cursor:pointer;
  box-shadow:0 10px 26px var(--blue-glow);
}
.forgot{ display:block; text-align:center; margin-top:16px; font-size:12px; color:var(--text-muted); text-decoration:none;}
.msg-erro{ background:#fdecec; border:1px solid #f4c2c2; color:#b23a3a; font-size:13px; padding:10px 14px; border-radius:8px; margin-bottom:18px;}

/* ---------- APP LAYOUT ---------- */
.app{ display:flex; min-height:100vh; background:var(--bg-page); }
.sidebar{
  width:230px;
  flex-shrink:0;
  background: var(--surface-0);
  border-right:1px solid var(--border);
  padding:24px 16px;
  display:flex;
  flex-direction:column;
  min-height:100vh;
}
.sb-logo{ display:flex; justify-content:center; margin-bottom:32px; padding:0 8px; }
.sb-logo img{ height:34px; display:block; }
.sb-nav{ display:flex; flex-direction:column; gap:4px; }
.sb-item{
  display:flex; align-items:center; gap:12px;
  padding:11px 14px;
  border-radius:10px;
  color:var(--text-secondary);
  font-size:14px;
  font-weight:500;
  cursor:pointer;
  transition:.2s;
  text-decoration:none;
  border-left:3px solid transparent;
}
.sb-item svg{ width:18px; height:18px; opacity:.85; flex-shrink:0; }
.sb-item:hover{ background:var(--surface-1); color:var(--text-primary); }
.sb-item.active{
  background:var(--blue-tint);
  color:var(--blue-dark);
  border-left:3px solid var(--blue);
  font-weight:600;
}
.sb-bottom{ margin-top:auto; }
.sb-user{
  display:flex; align-items:center; gap:10px;
  padding:12px 10px;
  border-top:1px solid var(--border);
  margin-top:16px;
  padding-top:16px;
  font-size:12px;
  color:var(--text-muted);
}
.avatar{
  width:32px;height:32px;border-radius:50%;
  background:linear-gradient(135deg,var(--blue),var(--blue-dark));
  display:flex;align-items:center;justify-content:center;
  font-size:13px;font-weight:700;color:#fff;flex-shrink:0;
}

.main{ flex:1; padding:36px 44px; }
.main-header{ margin-bottom:28px; }
.eyebrow{ font-size:12px; letter-spacing:.08em; text-transform:uppercase; color:var(--gold); font-weight:600; margin:0 0 6px;}
.main-header h1{ font-family:'Inter',sans-serif; font-size:26px; font-weight:700; margin:0 0 6px; color:var(--text-primary);}
.main-header p{ color:var(--text-secondary); font-size:14px; margin:0; }

/* ---------- HERO institucional (topo da home) ---------- */
.hero{
  background: linear-gradient(120deg, var(--blue-dark) 0%, var(--blue) 100%);
  border-radius:18px;
  padding:38px 42px;
  color:#fff;
  margin-bottom:36px;
  position:relative;
  overflow:hidden;
}
.hero .hero-content{ max-width:600px; position:relative; z-index:2; }
.hero .eyebrow-white{ font-size:12px; letter-spacing:.08em; text-transform:uppercase; color:#bcd4ff; font-weight:600; margin:0 0 10px;}
.hero h2{ font-family:'Inter',sans-serif; font-size:24px; font-weight:700; margin:0 0 14px; line-height:1.3;}
.hero p{ font-size:14px; line-height:1.7; color:#e3ecff; margin:0 0 10px; }
.crack-line{ width:120px; height:14px; margin:16px 0 20px; opacity:.9; }
.hero-graphic{
  position:absolute; right:-30px; top:50%; transform:translateY(-50%);
  width:220px; height:220px; opacity:.16; z-index:1;
}

/* ---------- VIDEO GRID (Netflix style, tema claro) ---------- */
.section-title{ font-size:15px; font-weight:600; color:var(--text-primary); margin:0 0 16px; }
.video-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(230px,1fr));
  gap:22px;
}
.vcard{
  cursor:pointer;
  border-radius:12px;
  overflow:hidden;
  background:var(--surface-0);
  border:1px solid var(--border);
  transition:transform .2s, box-shadow .2s;
  position:relative;
  text-decoration:none;
  color:inherit;
  display:block;
}
.vcard:hover{ transform: translateY(-4px); box-shadow:0 16px 34px rgba(18,58,122,0.14); border-color:var(--blue); }
.vthumb{
  height:130px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  position:relative;
  display:flex; align-items:center; justify-content:center;
}
.vthumb .playbtn{
  width:46px;height:46px;border-radius:50%;
  background:rgba(255,255,255,0.2);
  border:1px solid rgba(255,255,255,0.5);
  display:flex;align-items:center;justify-content:center;
  opacity:0; transform:scale(.8); transition:.25s;
  color:#fff;
}
.vcard:hover .playbtn{ opacity:1; transform:scale(1); }
.vthumb .playbtn svg{ width:18px; height:18px; margin-left:2px; }
.vthumb .duration{
  position:absolute; bottom:8px; right:10px;
  font-size:11px; color:#fff;
  background:rgba(0,0,0,0.35); padding:2px 7px; border-radius:5px;
}
.vinfo{ padding:12px 14px 14px; }
.vinfo h3{ font-size:14px; font-weight:600; margin:0 0 4px; color:var(--text-primary);}
.vinfo span{ font-size:12px; color:var(--text-muted); }

/* ---------- PLAYER (theater mode - permanece escuro, padrão de player de vídeo) ---------- */
.theater{
  background:#000;
  min-height:100vh;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  position:relative;
}
.theater .close-btn{
  position:absolute; top:24px; right:28px;
  width:38px;height:38px;border-radius:50%;
  background:rgba(255,255,255,0.1);
  border:1px solid rgba(255,255,255,0.2);
  display:flex;align-items:center;justify-content:center;
  cursor:pointer; color:#fff; text-decoration:none;
}
.theater .videobox{
  width:min(78vw, 980px);
  aspect-ratio:16/9;
  background:#000;
  border-radius:8px;
  position:relative;
  overflow:hidden;
}
.theater video{ width:100%; height:100%; }
.theater .watermark{
  position:absolute; bottom:14px; right:18px;
  font-size:11px; color:rgba(255,255,255,0.4);
  pointer-events:none;
  z-index:5;
}

/* ---------- CERTIFICADO ---------- */
.cert-card{
  max-width:640px;
  background:var(--surface-0);
  border:1px solid var(--border);
  border-radius:16px;
  padding:36px;
  text-align:center;
  box-shadow:0 10px 34px rgba(18,58,122,0.06);
}
.cert-badge{
  width:64px;height:64px;border-radius:50%;
  background:linear-gradient(135deg, var(--gold), #8a6a2f);
  display:flex;align-items:center;justify-content:center;
  margin:0 auto 18px;
}
.cert-card h2{ font-family:'Inter',sans-serif; font-size:20px; margin:0 0 8px; }
.cert-card p{ color:var(--text-secondary); font-size:14px; margin:0 0 24px; }
.cert-preview{
  background:#fff; color:#111; border-radius:10px; padding:26px;
  font-family:'Inter',sans-serif; margin-bottom:26px;
  text-align:center; border:6px solid var(--gold);
}
.cert-preview .cp-title{ font-size:11px; letter-spacing:.15em; color:#8a6a2f; text-transform:uppercase; margin-bottom:10px;}
.cert-preview .cp-name{ font-size:20px; font-weight:700; margin-bottom:8px; }
.cert-preview .cp-desc{ font-size:12px; color:#555; }
.btn-gold{
  background:linear-gradient(135deg, var(--gold), #a97f3d);
  color:#fff; border:none; font-weight:700;
  padding:13px 26px; border-radius:10px; font-size:14px; cursor:pointer;
  box-shadow:0 10px 26px rgba(184,134,60,0.3);
  text-decoration:none; display:inline-block;
}

/* ---------- ADMIN ---------- */
.stat-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:16px; margin-bottom:32px; }
.stat-card{
  background:var(--surface-0); border:1px solid var(--border); border-radius:12px; padding:18px 20px;
}
.stat-card .label{ font-size:12px; color:var(--text-secondary); margin-bottom:8px; }
.stat-card .value{ font-size:26px; font-weight:700; font-family:'Inter',sans-serif; color:var(--text-primary);}
.stat-card.blue .value{ color:var(--blue); }
.stat-card.gold .value{ color:var(--gold); }
.stat-card.red .value{ color:#c94b4b; }

.panel{
  background:var(--surface-0); border:1px solid var(--border); border-radius:14px; padding:22px;
  margin-bottom:24px;
}
.panel-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; }
.panel-head h3{ font-size:15px; font-weight:600; margin:0; color:var(--text-primary);}
.btn-outline{
  background:#fff; border:1px solid var(--border-strong); color:var(--text-primary);
  padding:8px 14px; border-radius:8px; font-size:12px; cursor:pointer; display:flex; align-items:center; gap:6px;
}
.btn-outline:hover{ border-color:var(--blue); color:var(--blue); }
table{ width:100%; border-collapse:collapse; font-size:13px; }
th{ text-align:left; color:var(--text-muted); font-weight:500; padding:8px 10px; border-bottom:1px solid var(--border); font-size:11px; text-transform:uppercase; letter-spacing:.04em;}
td{ padding:10px; border-bottom:1px solid var(--border); color:var(--text-primary);}
.status-pill{ font-size:11px; padding:3px 9px; border-radius:20px; font-weight:600; }
.status-pill.ok{ background:var(--blue-tint); color:var(--blue-dark); }
.status-pill.no{ background:#fdecec; color:#b23a3a; }
.row-actions{ display:flex; gap:8px; }
.icon-btn{ width:28px;height:28px;border-radius:6px; background:var(--surface-1); border:1px solid var(--border); display:flex;align-items:center;justify-content:center; cursor:pointer; color:var(--text-secondary); }
.icon-btn:hover{ color:var(--blue); border-color:var(--blue); }

.import-box{
  border:1.5px dashed var(--border-strong); border-radius:12px; padding:26px;
  text-align:center; color:var(--text-secondary); font-size:13px;
}
.import-box svg{ width:28px;height:28px; margin-bottom:8px; opacity:.7;}
.map-row{ display:flex; align-items:center; gap:12px; margin-top:14px; font-size:12px; color:var(--text-secondary);}
.map-row .col-src{ background:var(--surface-1); padding:6px 12px; border-radius:6px; width:140px; }
.map-row select{ background:#fff; color:var(--text-primary); border:1px solid var(--border-strong); border-radius:6px; padding:6px 10px; font-size:12px; flex:1; }

.grid-4-campos{ display:grid; grid-template-columns:2fr 1fr 1fr 1fr; gap:14px; margin-bottom:14px; }

::-webkit-scrollbar{ width:8px; }
::-webkit-scrollbar-thumb{ background:var(--border-strong); border-radius:4px; }

/* ================= RESPONSIVO / MOBILE ================= */

/* Botão hambúrguer e overlay - ficam ocultos no desktop */
.menu-toggle{ display:none; }
.sidebar-overlay{ display:none; }

@media (max-width: 880px){
  .app{ position:relative; }

  .menu-toggle{
    display:flex;
    position:fixed;
    top:14px; left:14px;
    z-index:1002;
    width:42px; height:42px;
    border-radius:10px;
    background:var(--surface-0);
    border:1px solid var(--border);
    box-shadow:0 4px 14px rgba(18,58,122,0.12);
    align-items:center;
    justify-content:center;
    cursor:pointer;
  }
  .menu-toggle svg{ width:20px; height:20px; color:var(--text-primary); }

  .sidebar-overlay.ativa{
    display:block;
    position:fixed;
    inset:0;
    background:rgba(12,16,30,0.45);
    z-index:1000;
  }

  .sidebar{
    position:fixed;
    top:0; left:0;
    height:100vh;
    width:250px;
    min-height:auto;
    flex-direction:column;
    flex-wrap:nowrap;
    border-right:1px solid var(--border);
    border-bottom:none;
    padding:24px 16px;
    gap:0;
    z-index:1001;
    transform:translateX(-100%);
    transition:transform .28s ease;
  }
  .sidebar.aberta{ transform:translateX(0); }

  .sb-logo{ justify-content:center; margin:0 0 28px; padding:0; }
  .sb-logo img{ height:30px; }
  .sb-nav{ flex-direction:column; flex-wrap:nowrap; gap:4px; flex:none; }
  .sb-item{
    padding:11px 14px;
    font-size:14px;
    border-left:3px solid transparent;
    border-radius:10px;
  }
  .sb-item.active{ border-left:3px solid var(--blue); }
  .sb-bottom{ display:block; margin-top:auto; }

  .main{ padding:76px 16px 20px; }
  .main-header h1{ font-size:20px; }
  .main-header p{ font-size:13px; }

  .video-grid{ grid-template-columns:repeat(auto-fill, minmax(140px,1fr)); gap:14px; }
  .vthumb{ height:100px; }

  .stat-grid{ grid-template-columns:repeat(2,1fr); gap:12px; }
  .stat-card .value{ font-size:20px; }

  .panel{ padding:16px; }
  .panel-head{ flex-wrap:wrap; gap:10px; align-items:flex-start; }
  .panel-head h3{ font-size:14px; }

  table{ font-size:12px; }
  .panel{ overflow-x:auto; }
  table#tabela-usuarios{ min-width:640px; }

  .map-row{ flex-wrap:wrap; }
  .map-row .col-src{ width:100%; }
  .map-row select{ width:100%; }

  .cert-card{ padding:24px 18px; max-width:100%; }
  .login-card{ padding:28px 22px; }

  .theater .videobox{ width:94vw; }
  .theater .close-btn{ top:14px; right:14px; }
  .theater .watermark{ font-size:10px; }

  .stat-grid > .stat-card{ min-width:0; }

  .grid-4-campos{ grid-template-columns:1fr 1fr; }
}

@media (max-width: 480px){
  .main-header h1{ font-size:18px; }
  .video-grid{ grid-template-columns:repeat(auto-fill, minmax(120px,1fr)); }
  .stat-grid{ grid-template-columns:1fr 1fr; }
  .login-card{ padding:24px 18px; }
}

