/* =========================================================
   TVLATAM Panel — Design tokens
   ========================================================= */
:root{
  --bg:            #0B0F1A;
  --surface:       #131A2A;
  --surface-2:     #1B2436;
  --border:        rgba(231,236,245,0.08);
  --text:          #E7ECF5;
  --text-muted:    #8A93A8;
  --accent:        #FF5A36;
  --accent-2:      #FFB199;
  --teal:          #26D9C6;
  --danger:        #FF6B6B;
  --radius:        14px;
  --radius-sm:     10px;
  --shadow:        0 20px 60px -20px rgba(0,0,0,0.6);
  --ff-display:    'Space Grotesk', sans-serif;
  --ff-body:       'Inter', sans-serif;
}

:root[data-theme="light"]{
  --bg:            #F4F5F8;
  --surface:       #FFFFFF;
  --surface-2:     #EEF0F5;
  --border:        rgba(11,15,26,0.08);
  --text:          #10131C;
  --text-muted:    #5B6272;
  --shadow:        0 20px 60px -25px rgba(11,15,26,0.25);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:var(--ff-body);
  font-size:15px;
  line-height:1.5;
  transition:background .25s ease, color .25s ease;
}
h1,h2,h3,h4,.brand{ font-family:var(--ff-display); }
a{ color:inherit; }
button{ font-family:var(--ff-body); }

/* =========================================================
   Login screen
   ========================================================= */
.auth-screen{
  min-height:100vh;
  display:flex;
}
.auth-form-side{
  flex:1 1 50%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:40px 24px;
}
.auth-card{
  width:100%;
  max-width:400px;
}
.auth-card .logo{
  display:block;
  margin:0 auto 40px;
  height:40px;
  width:auto;
}
.auth-card h1{
  font-size:22px;
  font-weight:700;
  margin:0 0 6px;
  text-align:center;
}
.auth-card .sub{
  color:var(--text-muted);
  text-align:center;
  margin:0 0 32px;
  font-size:14px;
}

.field{ margin-bottom:18px; }
.field label{
  display:block;
  font-size:12px;
  font-weight:600;
  letter-spacing:.03em;
  text-transform:uppercase;
  color:var(--text-muted);
  margin-bottom:8px;
}
.field .control{ position:relative; }
.field input{
  width:100%;
  background:var(--surface-2);
  border:1px solid var(--border);
  color:var(--text);
  border-radius:var(--radius-sm);
  padding:13px 14px;
  font-size:14.5px;
  outline:none;
  transition:border-color .15s ease, box-shadow .15s ease;
}
.field input::placeholder{ color:var(--text-muted); }
.field input:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(255,90,54,0.18);
}
.field .toggle-pass{
  position:absolute;
  right:12px; top:50%; transform:translateY(-50%);
  background:none; border:0; color:var(--text-muted);
  cursor:pointer; font-size:12px; padding:4px;
}
.field-error{
  color:var(--danger);
  font-size:12.5px;
  margin-top:6px;
  display:none;
}
.field.has-error input{ border-color:var(--danger); }
.field.has-error .field-error{ display:block; }

.form-alert{
  display:none;
  background:rgba(255,107,107,0.12);
  border:1px solid rgba(255,107,107,0.35);
  color:#FFB9B9;
  padding:11px 14px;
  border-radius:var(--radius-sm);
  font-size:13.5px;
  margin-bottom:18px;
}
.form-alert.show{ display:block; }

.btn-primary{
  width:100%;
  border:0;
  background:linear-gradient(135deg,var(--accent),#FF7A52);
  color:#fff;
  font-weight:700;
  font-size:14.5px;
  letter-spacing:.02em;
  padding:14px;
  border-radius:var(--radius-sm);
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  transition:filter .15s ease, transform .1s ease;
}
.btn-primary:hover{ filter:brightness(1.08); }
.btn-primary:active{ transform:translateY(1px); }
.btn-primary:disabled{ opacity:.7; cursor:default; }

.spinner{
  width:16px; height:16px;
  border-radius:50%;
  border:2px solid rgba(255,255,255,.4);
  border-top-color:#fff;
  animation:spin .7s linear infinite;
  display:none;
}
.btn-primary.loading .spinner{ display:inline-block; }
.btn-primary.loading .btn-label{ opacity:.85; }
@keyframes spin{ to{ transform:rotate(360deg); } }

.auth-foot{
  margin-top:22px;
  text-align:center;
  font-size:13px;
  color:var(--text-muted);
}
.auth-foot a{ color:var(--accent); text-decoration:none; font-weight:600; }
.auth-foot a:hover{ text-decoration:underline; }

/* Hero / broadcast side */
.auth-hero-side{
  flex:1 1 50%;
  position:relative;
  overflow:hidden;
  display:none;
  align-items:center;
  justify-content:center;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,90,54,0.25), transparent 45%),
    radial-gradient(circle at 80% 70%, rgba(38,217,198,0.18), transparent 45%),
    linear-gradient(160deg,#0B0F1A 0%,#161022 100%);
}
@media(min-width:992px){ .auth-hero-side{ display:flex; } }

.scanline{
  position:absolute;
  left:0; right:0; height:2px;
  background:linear-gradient(90deg,transparent,var(--teal),transparent);
  opacity:.6;
  animation:scan 5s linear infinite;
}
@keyframes scan{
  0%{ top:-2%; }
  100%{ top:102%; }
}

.hero-content{
  position:relative;
  z-index:2;
  max-width:420px;
  padding:40px;
  text-align:center;
}
.hero-content .eyebrow{
  color:var(--teal);
  font-size:12px;
  font-weight:700;
  letter-spacing:.12em;
  text-transform:uppercase;
  margin-bottom:18px;
}
.hero-content h2{
  color:#fff;
  font-size:32px;
  line-height:1.2;
  margin:0 0 14px;
}
.hero-content p{
  color:#B7BECF;
  font-size:14.5px;
  margin:0;
}
.hero-bars{
  display:flex;
  gap:6px;
  justify-content:center;
  margin-top:34px;
  height:36px;
  align-items:flex-end;
}
.hero-bars span{
  width:6px;
  border-radius:3px;
  background:linear-gradient(180deg,var(--accent),var(--accent-2));
  animation:bar 1.4s ease-in-out infinite;
}
.hero-bars span:nth-child(1){ height:14px; animation-delay:.0s; }
.hero-bars span:nth-child(2){ height:26px; animation-delay:.1s; }
.hero-bars span:nth-child(3){ height:36px; animation-delay:.2s; }
.hero-bars span:nth-child(4){ height:20px; animation-delay:.3s; }
.hero-bars span:nth-child(5){ height:30px; animation-delay:.4s; }
.hero-bars span:nth-child(6){ height:16px; animation-delay:.5s; }
@keyframes bar{
  0%,100%{ transform:scaleY(.6); opacity:.7; }
  50%{ transform:scaleY(1); opacity:1; }
}

/* Theme toggle (pill switch) */
.theme-toggle{
  position:absolute;
  top:24px; right:24px;
  z-index:3;
  display:flex;
  align-items:center;
  gap:8px;
  background:rgba(255,255,255,0.06);
  border:1px solid var(--border);
  padding:6px 10px;
  border-radius:999px;
  cursor:pointer;
  color:var(--text-muted);
  font-size:12.5px;
  user-select:none;
}
.theme-toggle svg{ width:14px; height:14px; }

/* =========================================================
   Dashboard shell
   ========================================================= */
.app-shell{
  display:flex;
  min-height:100vh;
}
.sidebar{
  width:250px;
  flex:0 0 250px;
  background:var(--surface);
  border-right:1px solid var(--border);
  display:flex;
  flex-direction:column;
  padding:24px 16px;
}
.sidebar .logo{ height:30px; margin:0 8px 32px; }
.nav-group-label{
  font-size:11px;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:var(--text-muted);
  margin:18px 12px 8px;
}
.nav-link{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 12px;
  border-radius:var(--radius-sm);
  color:var(--text-muted);
  text-decoration:none;
  font-size:14px;
  font-weight:500;
  margin-bottom:2px;
}
.nav-link:hover{ background:var(--surface-2); color:var(--text); }
.nav-link.active{
  background:rgba(255,90,54,0.12);
  color:var(--accent);
}
.nav-link .dot{
  width:6px; height:6px; border-radius:50%;
  background:currentColor; opacity:.5;
}

.main{
  flex:1 1 auto;
  display:flex;
  flex-direction:column;
  min-width:0;
}
.topbar{
  height:64px;
  flex:0 0 64px;
  border-bottom:1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 24px;
}
.topbar h1{ font-size:17px; margin:0; }
.topbar .user{
  display:flex; align-items:center; gap:10px;
  font-size:13.5px; color:var(--text-muted);
}
.avatar{
  width:32px; height:32px; border-radius:50%;
  background:linear-gradient(135deg,var(--accent),var(--teal));
  display:flex; align-items:center; justify-content:center;
  color:#fff; font-weight:700; font-size:13px;
}

.content{ padding:28px; flex:1 1 auto; }
.kpi-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(200px,1fr));
  gap:16px;
  margin-bottom:24px;
}
.kpi-card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:20px;
}
.kpi-card .label{
  font-size:12px; color:var(--text-muted);
  text-transform:uppercase; letter-spacing:.05em;
  margin-bottom:8px;
}
.kpi-card .value{ font-size:26px; font-weight:700; }
.kpi-card .delta{ font-size:12.5px; margin-top:6px; }
.kpi-card .delta.up{ color:var(--teal); }
.kpi-card .delta.down{ color:var(--danger); }

.panel{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:24px;
}
.panel h2{ font-size:15px; margin:0 0 16px; }
.placeholder-note{
  border:1px dashed var(--border);
  border-radius:var(--radius-sm);
  padding:18px;
  color:var(--text-muted);
  font-size:13.5px;
}

@media(max-width:900px){
  .sidebar{ display:none; }
}
