/* ─── Google Fonts ──────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Orbitron:wght@700;900&display=swap');

/* ─── Variáveis — Tema Padrão (Cyber Dark) ───────────────────────────────────── */
:root {
  --bg:        #040c18;
  --surface:   #071020;
  --surface-2: #0b1829;
  --border:    rgba(0,200,255,0.12);
  --text:      #ddeeff;
  --muted:     rgba(160,200,240,0.5);
  --accent:    #c1121f;
  --accent-2:  #7f0000;
  --highlight: #00c8ff;
  --neon:      #00c8ff;
  --neon-dim:  rgba(0,200,255,0.18);
  --red-glow:  rgba(193,18,31,0.45);
  --papaya-whip: #ddeeff;
  --steel-blue:  #00b4d8;
  --brick-red:   #c1121f;
  --molten-lava: #7f0000;
  --deep-space-blue: #040c18;

  --radius: 10px;
  --shadow: 0 8px 40px rgba(0,0,0,0.7);
  --glow-sm: 0 0 8px rgba(0,200,255,0.5);
  --glow-md: 0 0 20px rgba(0,200,255,0.3), 0 0 50px rgba(0,200,255,0.1);
  --glow-red: 0 0 12px rgba(193,18,31,0.6), 0 0 30px rgba(193,18,31,0.2);
}

/* ─── Temas ──────────────────────────────────────────────────────────────────── */
body[data-theme="1"] {
  --bg:        #0e1505;
  --surface:   #162008;
  --surface-2: #1e2d0a;
  --border:    rgba(140,200,80,0.12);
  --text:      #f0f8e0;
  --muted:     rgba(200,230,160,0.5);
  --accent:    #bc6c25;
  --accent-2:  #8a4e1a;
  --highlight: #9acd32;
  --neon:      #9acd32;
  --neon-dim:  rgba(154,205,50,0.15);
  --papaya-whip: #f0f8e0;
}
body[data-theme="2"] {
  --bg:        #060f1e;
  --surface:   #0c1830;
  --surface-2: #122040;
  --border:    rgba(100,180,220,0.15);
  --text:      #f0f9ff;
  --muted:     rgba(200,230,250,0.5);
  --accent:    #e63946;
  --accent-2:  #a0222c;
  --highlight: #4fc3f7;
  --neon:      #4fc3f7;
  --neon-dim:  rgba(79,195,247,0.15);
  --papaya-whip: #f0f9ff;
}
body[data-theme="3"] {
  --bg:        #081418;
  --surface:   #0d1e24;
  --surface-2: #122830;
  --border:    rgba(0,200,180,0.12);
  --text:      #e0f8f4;
  --muted:     rgba(160,230,220,0.5);
  --accent:    #3c6e71;
  --accent-2:  #284b63;
  --highlight: #00e5cc;
  --neon:      #00e5cc;
  --neon-dim:  rgba(0,229,204,0.15);
  --papaya-whip: #e0f8f4;
}
body[data-theme="4"] {
  --bg:        #0a0908;
  --surface:   #14110f;
  --surface-2: #1e1a16;
  --border:    rgba(200,180,140,0.15);
  --text:      #ede0d0;
  --muted:     rgba(220,200,170,0.5);
  --accent:    #c6ac8f;
  --accent-2:  #5e503f;
  --highlight: #d4a96a;
  --neon:      #d4a96a;
  --neon-dim:  rgba(212,169,106,0.15);
  --papaya-whip: #ede0d0;
}
body[data-theme="5"] {
  --bg:        #0d0e1a;
  --surface:   #14162a;
  --surface-2: #1c1f38;
  --border:    rgba(130,140,200,0.15);
  --text:      #edf2f4;
  --muted:     rgba(200,205,230,0.5);
  --accent:    #ef233c;
  --accent-2:  #d80032;
  --highlight: #9b8fe8;
  --neon:      #9b8fe8;
  --neon-dim:  rgba(155,143,232,0.15);
  --papaya-whip: #edf2f4;
}
body[data-theme="6"] {
  --bg:        #00101a;
  --surface:   #001825;
  --surface-2: #002035;
  --border:    rgba(0,180,240,0.15);
  --text:      #e8f8ff;
  --muted:     rgba(150,220,255,0.5);
  --accent:    #007ea7;
  --accent-2:  #003459;
  --highlight: #00c8ff;
  --neon:      #00c8ff;
  --neon-dim:  rgba(0,200,255,0.15);
  --papaya-whip: #e8f8ff;
}
body[data-theme="7"] {
  --bg:        #141618;
  --surface:   #1c1f22;
  --surface-2: #252829;
  --border:    rgba(100,180,220,0.12);
  --text:      #d8e4ec;
  --muted:     rgba(180,210,230,0.5);
  --accent:    #1985a1;
  --accent-2:  #4c5c68;
  --highlight: #38bdf8;
  --neon:      #38bdf8;
  --neon-dim:  rgba(56,189,248,0.15);
  --papaya-whip: #d8e4ec;
}
body[data-theme="8"] {
  --bg:        #f5f3d8;
  --surface:   #eceac2;
  --surface-2: #e0ddb0;
  --border:    rgba(63,13,18,0.15);
  --text:      #2a0a0e;
  --muted:     rgba(63,13,18,0.5);
  --accent:    #a71d31;
  --accent-2:  #d5bf86;
  --highlight: #a71d31;
  --neon:      #a71d31;
  --neon-dim:  rgba(167,29,49,0.12);
  --glow-sm:   none;
  --glow-md:   none;
  --glow-red:  none;
  --papaya-whip: #2a0a0e;
}

/* ─── Reset & Base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* Grid animado no fundo */
body {
  background-image:
    linear-gradient(rgba(0,200,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,200,255,0.025) 1px, transparent 1px);
  background-size: 50px 50px;
}
body[data-theme="8"] {
  background-image: none;
}

input, textarea, button, select { font-family: inherit; font-size: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--highlight); text-decoration: none; }
textarea { resize: vertical; }

/* ─── Screens ─────────────────────────────────────────────────────────────────── */
.screen { display: none; }
.screen.active { display: flex; }

/* ─── AUTH ─────────────────────────────────────────────────────────────────────── */
#screen-auth {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(0,150,255,0.12) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 80% 80%, rgba(193,18,31,0.08) 0%, transparent 60%),
    var(--bg);
  position: relative;
  overflow: hidden;
}

/* Linhas decorativas HUD */
#screen-auth::before,
#screen-auth::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--highlight), transparent);
  opacity: 0.3;
  pointer-events: none;
}
#screen-auth::before { top: 15%; }
#screen-auth::after  { bottom: 15%; }

.auth-wrapper {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: relative;
  z-index: 1;
}

.auth-brand { text-align: center; }
.auth-logo  { font-size: 52px; margin-bottom: 14px; filter: drop-shadow(0 0 16px rgba(0,200,255,0.4)); display: flex; align-items: center; justify-content: center; color: var(--highlight); }
.auth-brand h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--papaya-whip);
  letter-spacing: -0.02em;
}
.auth-brand p { color: var(--muted); margin-top: 6px; font-size: 13px; }

.auth-card {
  background: rgba(7,16,32,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow), 0 0 0 1px rgba(0,200,255,0.04) inset;
  position: relative;
}
.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--highlight), transparent);
  opacity: 0.6;
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
}
.auth-tab {
  flex: 1;
  padding: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}
.auth-tab.active {
  color: var(--highlight);
  border-bottom-color: var(--highlight);
  text-shadow: var(--glow-sm);
}
.auth-tab:hover { color: var(--text); }

.auth-form { display: none; padding: 24px; flex-direction: column; gap: 14px; }
.auth-form.active { display: flex; }

/* ─── Campos ────────────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.req { color: var(--brick-red); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="date"],
input[type="url"],
select,
textarea {
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--highlight);
  box-shadow: 0 0 0 3px rgba(0,200,255,0.08), var(--glow-sm);
}
select option { background: var(--surface-2); color: var(--text); }

/* ─── Botões ──────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn.primary {
  background: linear-gradient(135deg, #00c8ff 0%, #0077b6 100%);
  color: #fff;
  box-shadow: 0 0 14px rgba(0,200,255,0.45);
  border: 1px solid rgba(0,200,255,0.25);
}
.btn.primary:hover {
  background: linear-gradient(135deg, #33d6ff 0%, #00a8d8 100%);
  box-shadow: 0 0 22px rgba(0,200,255,0.75), 0 0 40px rgba(0,200,255,0.2);
  transform: translateY(-1px);
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}
.btn.ghost:hover {
  border-color: var(--highlight);
  color: var(--highlight);
  box-shadow: 0 0 12px rgba(0,200,255,0.15);
  background: rgba(0,200,255,0.04);
}

.btn.danger {
  background: linear-gradient(135deg, var(--brick-red), var(--molten-lava));
  color: #fff;
  box-shadow: var(--glow-red);
  border: 1px solid rgba(255,80,80,0.2);
}
.btn.danger:hover {
  box-shadow: 0 0 20px rgba(193,18,31,0.7);
  transform: translateY(-1px);
}

.btn.full     { width: 100%; justify-content: center; }
.btn.mini     { padding: 6px 12px; font-size: 12px; }

/* ─── Erros / Mensagens ─────────────────────────────────────────────────────── */
.form-error {
  background: rgba(193,18,31,0.12);
  border: 1px solid rgba(193,18,31,0.4);
  color: #ff7070;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
}

/* ─── App layout ─────────────────────────────────────────────────────────────── */
#screen-app {
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* ─── Sidebar ─────────────────────────────────────────────────────────────────── */
#sidebar {
  width: 234px;
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(5,12,24,0.98) 0%, rgba(7,16,32,0.96) 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
}
/* Linha luminosa à direita da sidebar */
#sidebar::after {
  content: '';
  position: absolute;
  top: 0; right: -1px; bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, transparent, var(--highlight), transparent);
  opacity: 0.25;
}

/* Botão "Menu principal" — visível em AMBOS mobile e desktop */
.sidebar-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #e0f0ff;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 14px;
  margin: 10px 10px 6px;
  border-radius: 8px;
  background: rgba(0,200,255,0.1);
  border: 1px solid rgba(0,200,255,0.35);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  letter-spacing: 0.01em;
}
.sidebar-menu-btn:hover { background: rgba(0,200,255,0.2); border-color: rgba(0,200,255,0.6); color: #fff; }
.sidebar-menu-btn:active { background: rgba(0,200,255,0.25); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 18px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.brand-icon {
  display: flex;
  align-items: center;
  color: var(--highlight);
  filter: drop-shadow(0 0 8px rgba(0,200,255,0.5));
}
.brand-icon svg { width: 20px; height: 20px; }
.brand-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--papaya-whip);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.18s;
  text-align: left;
  width: 100%;
  border-left: 2px solid transparent;
  position: relative;
}
.nav-item:hover {
  background: rgba(0,200,255,0.06);
  color: var(--text);
  border-left-color: rgba(0,200,255,0.3);
}
.nav-item.active {
  background: linear-gradient(90deg, rgba(0,200,255,0.1) 0%, rgba(0,200,255,0.03) 100%);
  color: var(--highlight);
  font-weight: 700;
  border-left: 2px solid var(--highlight);
  box-shadow: inset 0 0 16px rgba(0,200,255,0.04);
}
.nav-item.active .nav-icon {
  filter: drop-shadow(0 0 6px var(--highlight));
}
.nav-icon { display: flex; align-items: center; flex-shrink: 0; }
.nav-icon svg { width: 16px; height: 16px; }

.badge {
  margin-left: auto;
  background: var(--brick-red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
  box-shadow: var(--glow-red);
  animation: badge-pulse-glow 2s ease-in-out infinite;
}

@keyframes badge-pulse-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(193,18,31,0.6); }
  50%       { box-shadow: 0 0 16px rgba(193,18,31,0.9), 0 0 30px rgba(193,18,31,0.3); }
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.2);
}
.user-info    { flex: 1; display: flex; align-items: center; gap: 9px; overflow: hidden; }
.user-avatar  {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brick-red), var(--molten-lava));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(193,18,31,0.4);
}
.user-name         { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.user-email-small  { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── Main content ────────────────────────────────────────────────────────────── */
#main-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  position: relative;
}
#main-content::-webkit-scrollbar { width: 5px; }
#main-content::-webkit-scrollbar-track { background: transparent; }
#main-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

.view { display: none; }
.view.active { display: block; }

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  position: relative;
  padding-bottom: 20px;
}
.view-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--highlight), transparent);
  opacity: 0.25;
}
.view-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--papaya-whip);
  letter-spacing: -0.01em;
}
.view-header h2::before {
  content: '// ';
  color: var(--highlight);
  font-family: 'Orbitron', monospace;
  font-size: 14px;
  opacity: 0.7;
  margin-right: 2px;
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 24px 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

/* ─── Stats Grid ──────────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

.stat-card {
  background: linear-gradient(135deg, rgba(0,200,255,0.04) 0%, rgba(7,16,32,0.9) 60%);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-top: 2px solid var(--highlight);
  border-radius: 12px;
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
  cursor: default;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: -50%; right: -20%;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(0,200,255,0.08) 0%, transparent 70%);
  pointer-events: none;
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,200,255,0.2);
  border-color: rgba(0,200,255,0.35);
}
.stat-value {
  font-family: 'Orbitron', 'Inter', monospace;
  font-size: 32px;
  font-weight: 900;
  color: var(--highlight);
  line-height: 1;
  text-shadow: 0 0 20px rgba(0,200,255,0.5);
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ─── Cards de Alerta ─────────────────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert-card {
  background: linear-gradient(135deg, rgba(0,10,25,0.9) 0%, rgba(7,16,32,0.85) 100%);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brick-red);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 12px;
  transition: transform 0.22s, box-shadow 0.22s, border-color 0.22s;
  animation: fadeInUp 0.3s ease both;
  position: relative;
  overflow: hidden;
}
.alert-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, rgba(193,18,31,0.03) 0%, transparent 40%);
  pointer-events: none;
}
.alert-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 36px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,200,255,0.15);
  border-color: rgba(0,200,255,0.25);
  border-left-color: var(--brick-red);
}
.alert-card.novo {
  border-left-color: #22c55e;
}
.alert-card.novo::before {
  background: linear-gradient(90deg, rgba(34,197,94,0.04) 0%, transparent 40%);
}
.alert-card.lido {
  border-left-color: rgba(150,170,200,0.3);
  opacity: 0.55;
}

.alert-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.alert-card-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--papaya-whip);
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.alert-card.lido .alert-card-title { color: var(--muted); }

.alert-card-badge  {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 99px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.badge-novo {
  background: rgba(34,197,94,0.12);
  color: #22c55e;
  border: 1px solid rgba(34,197,94,0.4);
  box-shadow: 0 0 8px rgba(34,197,94,0.2);
}
.badge-lido {
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  border: 1px solid rgba(255,255,255,0.1);
}

.alert-card-row {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
  display: flex;
  gap: 6px;
}
.alert-card-row strong { color: var(--steel-blue); }

.alert-card-objeto {
  font-size: 13px;
  color: var(--text);
  margin: 8px 0 10px;
  line-height: 1.6;
}

.alert-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}
.alert-card-time   { font-size: 11px; color: var(--muted); }
.alert-card-link   { font-size: 12px; color: var(--highlight); font-weight: 600; }
.alert-card-link:hover { text-decoration: underline; text-shadow: var(--glow-sm); }

.alert-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.alert-card-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.3);
  color: var(--muted);
  transition: all 0.18s;
  text-decoration: none;
}
.alert-card-btn:hover {
  border-color: var(--highlight);
  color: var(--highlight);
  background: rgba(0,200,255,0.06);
  box-shadow: 0 0 10px rgba(0,200,255,0.12);
}
.alert-card-btn-link  { color: var(--steel-blue); border-color: rgba(0,180,216,0.25); }
.btn-marcar-lido      { color: #22c55e; border-color: rgba(34,197,94,0.3); }
.btn-marcar-lido:hover {
  border-color: #22c55e;
  color: #22c55e;
  background: rgba(34,197,94,0.06);
  box-shadow: 0 0 10px rgba(34,197,94,0.2);
}

/* ─── Matches (palavras-chave) ────────────────────────────────────────────────── */
.alert-matches {
  margin: 10px 0 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0,0,0,0.2);
}
.match-group {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.match-group:last-child { border-bottom: none; }
.match-keyword {
  font-size: 11px;
  font-weight: 700;
  color: var(--highlight);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-shadow: var(--glow-sm);
}
.match-count {
  background: rgba(0,200,255,0.1);
  border: 1px solid rgba(0,200,255,0.25);
  color: var(--highlight);
  border-radius: 99px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}
.match-context {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  padding: 6px 0;
  border-top: 1px dashed rgba(0,200,255,0.08);
  white-space: pre-wrap;
  word-break: break-word;
}
.match-context:first-of-type { border-top: none; }

/* ─── Estados Grid ────────────────────────────────────────────────────────────── */
.estados-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  gap: 8px;
}
.estado-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 8px;
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  user-select: none;
}
.estado-item:hover {
  border-color: var(--highlight);
  background: rgba(0,200,255,0.05);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,200,255,0.1);
}
.estado-item.active {
  border-color: var(--brick-red);
  background: rgba(193,18,31,0.1);
  box-shadow: 0 0 12px rgba(193,18,31,0.2);
}
.estado-item input  { accent-color: var(--brick-red); width: 16px; height: 16px; cursor: pointer; }
.estado-sigla { font-size: 14px; font-weight: 800; color: var(--papaya-whip); letter-spacing: 0.03em; }

/* ─── Busca ───────────────────────────────────────────────────────────────────── */
.search-bar-wrapper { position: relative; max-width: 500px; margin-bottom: 10px; }
.search-input {
  width: 100%;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 16px;
  color: var(--text);
  font-size: 14px;
  transition: all 0.2s;
}
.search-input:focus {
  outline: none;
  border-color: var(--highlight);
  box-shadow: 0 0 0 3px rgba(0,200,255,0.08), var(--glow-sm);
}
.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.search-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: rgba(0,200,255,0.07); }
.search-item-nome { font-size: 13px; color: var(--text); }
.search-item-uf   { font-size: 11px; color: var(--highlight); font-weight: 700; }

/* ─── Config Cards ────────────────────────────────────────────────────────────── */
.config-sections { display: flex; flex-direction: column; gap: 18px; max-width: 960px; }
.config-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  align-items: start;
}
.config-card-wide { grid-column: 1 / -1; }
@media (max-width: 760px) {
  .config-grid { grid-template-columns: 1fr; }
  .config-card-wide { grid-column: auto; }
}
.config-card {
  background: linear-gradient(135deg, rgba(0,200,255,0.02) 0%, rgba(7,16,32,0.9) 100%);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}
.config-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--highlight), transparent);
  border-radius: 12px 12px 0 0;
  opacity: 0.35;
}
.config-card h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--papaya-whip);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.02em;
}

/* ─── Radio Group ─────────────────────────────────────────────────────────────── */
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s;
}
.radio-opt:hover { border-color: var(--highlight); background: rgba(0,200,255,0.04); }
.radio-opt:has(input:checked) {
  border-color: var(--brick-red);
  background: rgba(193,18,31,0.07);
  box-shadow: 0 0 12px rgba(193,18,31,0.1);
}
.radio-opt input[type="radio"] { width: 16px; height: 16px; accent-color: var(--brick-red); flex-shrink: 0; cursor: pointer; }
.radio-content { display: flex; flex-direction: column; gap: 2px; }
.radio-content strong { font-size: 13px; font-weight: 700; color: var(--papaya-whip); }
.radio-content span   { font-size: 11px; color: var(--muted); line-height: 1.4; }

/* ─── Theme Picker ────────────────────────────────────────────────────────────── */
.theme-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px;
}
.theme-option {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.theme-option:hover { border-color: var(--highlight); transform: translateY(-2px); }
.theme-option.ativo {
  border-color: var(--highlight);
  box-shadow: 0 0 12px rgba(0,200,255,0.2);
}
.theme-swatches {
  display: flex;
  gap: 2px;
  width: 100%;
  height: 22px;
  border-radius: 6px;
  overflow: hidden;
}
.theme-swatches span { flex: 1; }
.theme-name { font-size: 10px; color: var(--muted); font-weight: 700; white-space: nowrap; letter-spacing: 0.04em; text-transform: uppercase; }

/* ─── Alerta Visual Popup ─────────────────────────────────────────────────────── */
.visual-alert {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 420px;
  max-height: 80vh;
  background: rgba(4,12,24,0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(193,18,31,0.5);
  border-radius: 14px;
  box-shadow: 0 12px 50px rgba(0,0,0,0.7), var(--glow-red);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.visual-alert::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--brick-red), transparent);
}
.visual-alert.hidden { display: none; }

@keyframes slideIn {
  from { transform: translateX(120%) scale(0.95); opacity: 0; }
  to   { transform: translateX(0) scale(1); opacity: 1; }
}

.alert-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(193,18,31,0.9) 0%, rgba(127,0,0,0.8) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
}
.alert-header button { color: #fff; font-size: 16px; opacity: 0.8; transition: opacity 0.15s; }
.alert-header button:hover { opacity: 1; }

.alert-body { padding: 14px 16px; overflow-y: auto; flex: 1; }
.alert-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  background: rgba(0,0,0,0.2);
}

/* ─── Jornais ─────────────────────────────────────────────────────────────────── */
.jornais-filtro { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.filtro-btn {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.3);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  letter-spacing: 0.03em;
}
.filtro-btn:hover { border-color: var(--highlight); color: var(--text); background: rgba(0,200,255,0.05); }
.filtro-btn.ativo {
  background: linear-gradient(135deg, var(--brick-red), var(--molten-lava));
  color: #fff;
  border-color: transparent;
  box-shadow: var(--glow-red);
}

.jornais-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.jornais-table th {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.jornais-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  transition: background 0.15s;
}
.jornais-table tbody tr:hover { background: rgba(0,200,255,0.03); }

.j-link { color: var(--highlight); text-decoration: none; font-weight: 500; transition: text-shadow 0.2s; }
.j-link:hover { text-decoration: underline; text-shadow: var(--glow-sm); }
.j-uf {
  display: inline-block;
  background: rgba(0,200,255,0.08);
  border: 1px solid rgba(0,200,255,0.2);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--highlight);
}
.j-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.j-status.ok      { background: rgba(34,197,94,0.1); color: #22c55e; border: 1px solid rgba(34,197,94,0.25); }
.j-status.error   { background: rgba(239,68,68,0.1);  color: #ef4444; border: 1px solid rgba(239,68,68,0.25); }
.j-status.waiting { background: rgba(234,179,8,0.1);  color: #eab308; border: 1px solid rgba(234,179,8,0.25); }
.j-countdown { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; font-family: 'Orbitron', monospace; }
.j-error { color: #ef4444; font-size: 12px; cursor: help; }

/* ─── URL Cards ───────────────────────────────────────────────────────────────── */
.url-card {
  background: linear-gradient(135deg, rgba(0,200,255,0.02) 0%, rgba(7,16,32,0.9) 100%);
  border: 1px solid var(--border);
  border-left: 3px solid var(--highlight);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 10px;
  transition: all 0.22s;
  display: block;
}
.url-card:hover {
  border-color: rgba(0,200,255,0.35);
  border-left-color: var(--highlight);
  box-shadow: 0 8px 28px rgba(0,0,0,0.3);
}
.url-card-label { font-size: 14px; font-weight: 700; color: var(--papaya-whip); }
.url-card-url   { font-size: 11px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 400px; }
.url-card-info  { flex: 1; min-width: 0; }
.url-card-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
}
.url-card-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid rgba(34,197,94,0.3);
  color: #22c55e;
  background: rgba(34,197,94,0.08);
}
.url-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.url-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.url-btn-remover { color: #ef4444 !important; }
.url-btn-remover:hover { border-color: #ef4444 !important; background: rgba(239,68,68,0.08) !important; }
.url-card-time { font-size: 11px; color: var(--muted); }

/* URL card badge animations */
@keyframes badge-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(1.08); }
}
@keyframes badge-fadeout {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}
.url-card-badge.pulse   { animation: badge-pulse 0.8s ease-in-out infinite; }
.url-card-badge.fadeout { animation: badge-fadeout 1s ease forwards; }

/* ─── Plataformas ─────────────────────────────────────────────────────────────── */
.plataforma-card {
  background: linear-gradient(135deg, rgba(0,200,255,0.02) 0%, rgba(7,16,32,0.9) 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 10px;
  transition: all 0.22s;
}
.plataforma-card:hover {
  border-color: rgba(0,200,255,0.22);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.4);
}

/* ─── Empty State ─────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.empty-icon {
  font-size: 44px;
  margin-bottom: 8px;
  filter: grayscale(0.4) opacity(0.6);
}

/* ─── Paginação ───────────────────────────────────────────────────────────────── */
.paginacao { display: flex; gap: 8px; justify-content: center; margin-top: 20px; }
.paginacao button {
  padding: 7px 14px;
  border-radius: 7px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.18s;
}
.paginacao button:hover {
  border-color: var(--highlight);
  color: var(--highlight);
  background: rgba(0,200,255,0.06);
}
.paginacao button.active, .paginacao button[disabled] {
  border-color: var(--highlight);
  color: var(--highlight);
  background: rgba(0,200,255,0.1);
}

/* ─── Utilitários ─────────────────────────────────────────────────────────────── */
.hidden  { display: none !important; }
.muted   { color: var(--muted); }
.small   { font-size: 12px; }

/* ─── Filtros de alertas ──────────────────────────────────────────────────────── */
.alerta-filtros {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.alerta-filtro-btn {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  letter-spacing: 0.02em;
}
.alerta-filtro-btn:hover { border-color: var(--highlight); color: var(--text); }
.alerta-filtro-btn.ativo {
  border-color: var(--highlight);
  background: rgba(0,200,255,0.1);
  color: var(--highlight);
}

/* ─── Badge marcar não lido ───────────────────────────────────────────────────── */
.btn-marcar-nao-lido {
  color: var(--muted);
  border-color: var(--border);
  font-size: 11px;
}
.btn-marcar-nao-lido:hover { border-color: var(--highlight); color: var(--highlight); }

/* ─── Toast notification ──────────────────────────────────────────────────────── */
.app-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 22px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  z-index: 9999;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}
.app-toast.visible { transform: translateX(-50%) translateY(0); opacity: 1; }
.app-toast-success { border-color: rgba(34,197,94,0.4); color: #22c55e; }
.app-toast-error   { border-color: rgba(239,68,68,0.4);  color: #ef4444; }

/* ─── Confirm modal ───────────────────────────────────────────────────────────── */
#app-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
#app-confirm-overlay.visible { opacity: 1; pointer-events: all; }
.app-confirm-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 36px;
  max-width: 400px;
  width: 92%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  gap: 18px;
  transform: scale(0.92);
  transition: transform 0.2s;
}
#app-confirm-overlay.visible .app-confirm-box { transform: scale(1); }
.app-confirm-icon { font-size: 36px; text-align: center; }
.app-confirm-msg  { font-size: 14px; color: var(--text); line-height: 1.65; text-align: center; }
.app-confirm-btns { display: flex; gap: 10px; justify-content: flex-end; }

/* ─── URL Histórico modal ─────────────────────────────────────────────────────── */
#url-historico-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 9997;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
#url-historico-overlay.visible { opacity: 1; pointer-events: all; }
.url-historico-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 90%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  overflow: hidden;
}
.url-historico-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.url-historico-title { font-size: 14px; font-weight: 700; color: var(--papaya-whip); }
.url-historico-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.15s;
}
.url-historico-close:hover { color: var(--text); }
.url-historico-body { overflow-y: auto; padding: 16px; flex: 1; }
.url-hist-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.url-hist-date  { font-size: 11px; color: var(--muted); margin-bottom: 4px; font-family: 'Orbitron', monospace; }
.url-hist-label { font-size: 13px; font-weight: 600; color: var(--papaya-whip); margin-bottom: 6px; }
.url-hist-preview {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
  border-left: 2px solid var(--highlight);
  border-radius: 0 4px 4px 0;
  padding: 8px 10px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 120px;
  overflow-y: auto;
  margin-top: 6px;
}

/* ─── Utilitários de layout ──────────────────────────────────────────────────── */
.header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Linha de adição de URL */
.url-add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.url-input-main  { flex: 2; min-width: 180px; }
.url-input-label { flex: 1; min-width: 130px; }

/* ════════════════════════════════════════════════════════════════════════════
   RESPONSIVIDADE — Tablet  ≤ 900px
   ════════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  #sidebar { width: 210px; }
  #main-content { padding: 20px 18px; }
}

/* ════════════════════════════════════════════════════════════════════════════
   RESPONSIVIDADE — Mobile  ≤ 768px
   ════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Topbar ──────────────────────────────────────────────────────────── */
  #topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    padding: 0 16px;
    background: rgba(5, 12, 24, 0.98);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 400;
  }

  #btn-menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 6px;
    background: none;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
  }
  #btn-menu span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.25s;
  }

  /* Botão "Menu principal" no topo da sidebar mobile */
  .sidebar-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 10px 16px;
    margin: 12px 12px 4px;
    border-radius: 8px;
    background: rgba(0,200,255,0.12);
    border: 1px solid rgba(0,200,255,0.3);
    transition: background 0.2s, border-color 0.2s;
  }
  .sidebar-menu-btn:active { background: rgba(0,200,255,0.22); }

  .topbar-brand {
    font-size: 15px;
    font-weight: 800;
    color: var(--papaya-whip);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    flex: 1;
  }

  #topbar-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: rgba(160,200,240,0.7);
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    border: 1px solid rgba(0,200,255,0.18);
    border-radius: 7px;
    transition: all 0.2s;
    white-space: nowrap;
  }
  #topbar-back-btn:hover,
  #topbar-back-btn:active {
    color: var(--neon, #00c8ff);
    border-color: var(--neon, #00c8ff);
  }

  /* ── Sidebar — drawer lateral ────────────────────────────────────────── */
  #screen-app.active { display: block; height: 100vh; overflow: hidden; }

  #sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: 270px;
    z-index: 500;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 32px rgba(0, 0, 0, 0.6);
  }
  #sidebar.open { transform: translateX(0); }

  /* Linha luminosa — esconde no mobile quando fechado */
  #sidebar::after { display: none; }

  /* Overlay escurecido */
  #sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 499;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s;
  }
  #sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
  }

  /* ── Main content ────────────────────────────────────────────────────── */
  #main-content {
    padding: 72px 14px 28px;
    height: 100vh;
    overflow-y: auto;
    width: 100%;
  }

  /* ── Auth ────────────────────────────────────────────────────────────── */
  #screen-auth { padding: 16px; }
  .auth-wrapper { gap: 20px; }
  .auth-brand h1 { font-size: 20px; }
  .auth-logo svg { width: 40px; height: 40px; }
  .auth-form { padding: 18px 16px; gap: 14px; }
  .field-row { flex-direction: column; }

  /* ── View header ─────────────────────────────────────────────────────── */
  .view-header {
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
  }
  .view-header h2 { font-size: 18px; width: 100%; }
  .header-actions { width: 100%; }

  /* ── Stats ───────────────────────────────────────────────────────────── */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-value { font-size: 22px; }
  .stat-card  { padding: 14px 16px; }

  /* ── Cards de alerta ─────────────────────────────────────────────────── */
  .alert-card { padding: 12px 14px; }
  .alert-card-header { flex-wrap: wrap; gap: 8px; }
  .alert-card-footer { flex-direction: column; align-items: flex-start; gap: 8px; }
  .alert-card-actions { flex-wrap: wrap; }

  /* ── Tabela de jornais — scroll horizontal ───────────────────────────── */
  #jornais-tabela-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .jornais-table { min-width: 580px; }

  /* ── Config ──────────────────────────────────────────────────────────── */
  .config-grid { grid-template-columns: 1fr; }
  .config-card-wide { grid-column: auto; }
  .config-card { padding: 16px 14px; }
  .config-sections { max-width: 100%; }

  /* ── URLs view ───────────────────────────────────────────────────────── */
  .url-add-row { flex-direction: column; }
  .url-input-main, .url-input-label { flex: none; width: 100%; min-width: 0; }
  .url-add-row .btn { width: 100%; justify-content: center; }
  .url-card-url { max-width: 100%; }

  /* ── Alerta visual popup — sobe da base ──────────────────────────────── */
  .visual-alert {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 70vh;
    border-radius: 16px 16px 0 0;
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  @keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  /* ── Search bar ──────────────────────────────────────────────────────── */
  .search-bar-wrapper { max-width: 100%; }

  /* ── Estados grid ────────────────────────────────────────────────────── */
  .estados-grid { grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 6px; }
  .estado-item  { padding: 10px 6px; }

  /* ── Paginação ───────────────────────────────────────────────────────── */
  .paginacao { flex-wrap: wrap; }

  /* ── Toast não transborda ────────────────────────────────────────────── */
  .app-toast { white-space: normal; text-align: center; max-width: 90vw; }

  /* ── Modal de confirmação ────────────────────────────────────────────── */
  .app-confirm-box { padding: 24px 18px; }
  .app-confirm-btns { flex-wrap: wrap; justify-content: center; }

  /* ── Filtros de alertas ──────────────────────────────────────────────── */
  .alerta-filtros { gap: 6px; }
  .alerta-filtro-btn { font-size: 11px; padding: 4px 10px; }
}

/* ════════════════════════════════════════════════════════════════════════════
   Celular pequeno  ≤ 420px
   ════════════════════════════════════════════════════════════════════════ */
@media (max-width: 420px) {
  #main-content { padding: 68px 10px 24px; }
  .stats-grid   { grid-template-columns: 1fr 1fr; }
  .stat-value   { font-size: 20px; }
  .stat-card    { padding: 12px 12px; }
  #sidebar      { width: 100%; }
  .view-header h2 { font-size: 16px; }
  .auth-form    { padding: 14px 12px; }
}

/* ════════════════════════════════════════════════════════════════════════════
   Desktop ≥ 769px — topbar e overlay ficam escondidos
   ════════════════════════════════════════════════════════════════════════ */
@media (min-width: 769px) {
  #topbar          { display: none; }
  #sidebar-overlay { display: none !important; }
  #screen-app.active { display: flex; }
}
