/* ==========================================================================
   ZapTech WiFi-Pix — Dashboard Master Stylesheet (Desktop + Mobile/Tablet)
   ========================================================================== */

:root {
  --bg: #0b1329;
  --sidebar: #131c36;
  --card: #152042;
  --card-subtle: #1a2850;
  --border: #2c3e6b;
  --border-light: rgba(255, 255, 255, 0.08);
  --text: #f8fafc;
  --text-strong: #ffffff;
  --muted: #94a9c9;
  --muted-light: #b4c6e4;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --radius: 12px;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --input-bg: #0c152e;
}

/* ── Tema Claro (Light Mode) — Padrão SaaS de Alto Padrão (Linear / Stripe / Tailwind) ── */
body.theme-light, html.theme-light {
  --bg: #f8fafc;
  --sidebar: #ffffff;
  --card: #ffffff;
  --card-subtle: #f1f5f9;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #0f172a;
  --text-strong: #020617;
  --muted: #64748b;
  --muted-light: #475569;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --green: #10b981;
  --red: #ef4444;
  --amber: #f59e0b;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.1), 0 4px 8px -2px rgba(15, 23, 42, 0.05);
  --input-bg: #ffffff;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  font-family: inherit;
}

input, select, textarea {
  font-family: inherit;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 13px;
  width: 100%;
  font-size: .88rem;
  outline: none;
  transition: all .15s ease-in-out;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted-light);
  display: block;
  margin-bottom: 5px;
  letter-spacing: -0.01em;
}

/* ── Layout Principal (Desktop por padrão) ───────────────────────────────── */
#app {
  display: flex;
  flex-direction: row;
  width: 100%;
  min-height: 100vh;
  min-width: 0;
  background: var(--bg);
}

#sidebar {
  width: 248px;
  min-width: 248px;
  max-width: 248px;
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 50;
  overflow-y: auto;
}

#sidebar .logo {
  padding: 18px 20px;
  font-size: 1.05rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.02em;
}

#sidebar nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

#sidebar nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  font-size: .88rem;
  font-weight: 500;
  color: var(--muted);
  border-radius: 8px;
  transition: all .15s ease;
}

#sidebar nav a:hover {
  background: var(--card-subtle);
  color: var(--text);
}

#sidebar nav a.active {
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent);
  font-weight: 600;
}

body.theme-light #sidebar nav a.active {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
}

#sidebar .sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

#sidebar .sidebar-footer button {
  width: 100%;
  background: var(--card-subtle);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: .84rem;
  font-weight: 500;
  transition: all .15s ease;
}

#sidebar .sidebar-footer button:hover {
  background: rgba(239, 68, 68, .08);
  color: var(--red);
  border-color: rgba(239, 68, 68, .3);
}

#main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  overflow-x: hidden;
}

#topbar {
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--sidebar);
  min-height: 62px;
  flex-shrink: 0;
}

#topbar h2 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

#topbar .user-info {
  font-size: .84rem;
  color: var(--muted);
}

#content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  min-width: 0;
}

/* ── Cards & Grids Principais ────────────────────────────────────────────── */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 0;
  box-shadow: var(--shadow);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.card .c-label {
  font-size: .74rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
}

.card .c-val {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-strong);
}

.card .c-val.green { color: var(--green); }
.card .c-val.blue  { color: var(--accent); }
.card .c-val.amber { color: var(--amber); }

/* ── Grids do Dashboard (Desktop) ────────────────────────────────────────── */
.dash-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.dash-chart-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 1100px) {
  .dash-chart-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

.dash-metric-card {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.dash-metric-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  border-color: var(--accent) !important;
}
body.theme-light .dash-metric-card:hover {
  box-shadow: 0 10px 20px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -2px rgba(15, 23, 42, 0.04);
  border-color: #cbd5e1 !important;
}

.dash-tables-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

/* ── POPs & Hotspots List (Desktop) ──────────────────────────────────────── */
.hspot-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  width: 100%;
}

.hspot-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
  position: relative;
  min-width: 0;
}

.hspot-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}

.hspot-card[draggable="true"] { cursor: grab; }
.hspot-card[draggable="true"]:active { cursor: grabbing; }

.hspot-card.dragging {
  opacity: 0.35;
  transform: scale(0.97);
  border: 2px dashed var(--accent) !important;
  box-shadow: 0 0 16px rgba(59, 130, 246, .3);
}

.hspot-card.drag-over {
  border-color: var(--accent) !important;
  background: rgba(59, 130, 246, .08);
  box-shadow: 0 0 20px rgba(59, 130, 246, .35);
  transform: translateY(-3px) scale(1.02);
}

.drag-handle {
  cursor: grab;
  padding: 2px 6px;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  border-radius: 4px;
  transition: color .2s, background .2s;
  user-select: none;
}

.drag-handle:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, .08);
}

.drag-handle:active { cursor: grabbing; }

.hspot-card .hname {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 4px;
}

.hspot-card .haddr {
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.hspot-card .hstats {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
  font-size: .82rem;
  flex-wrap: wrap;
}

.hspot-card .hstats span { color: var(--muted); }
.hspot-card .hactions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Tabelas & Seções ────────────────────────────────────────────────────── */
.section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}

.section-head {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.section-head h3 {
  font-size: .9rem;
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
}

th {
  text-align: left;
  padding: 12px 16px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.08);
}

body.theme-light th {
  background: #f8fafc;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
  font-size: .85rem;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(59, 130, 246, .05); }

body.theme-light tr:hover td { background: #f8fafc; }

.empty {
  text-align: center;
  padding: 36px 20px;
  color: var(--muted);
  font-size: .9rem;
}

/* ── Badges & Pills de Alto Padrão ────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: .73rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  letter-spacing: -0.01em;
  border: 1px solid transparent;
}

.pill-green { background: #064e3b; color: #34d399; border-color: rgba(52, 211, 153, 0.2); }
.pill-red   { background: #450a0a; color: #f87171; border-color: rgba(248, 113, 113, 0.2); }
.pill-blue  { background: #1e3a5f; color: #60a5fa; border-color: rgba(96, 165, 250, 0.2); }
.pill-gray  { background: #1e293b; color: #94a3b8; border-color: var(--border); }
.pill-amber { background: #451a03; color: #fbbf24; border-color: rgba(251, 191, 36, 0.2); }

/* ── Botões Profissionais ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: .84rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: all .15s ease-in-out;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary { 
  background: var(--accent); 
  color: #fff; 
  border: 1px solid transparent;
}
.btn-primary:hover { 
  background: var(--accent-hover); 
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.btn-ghost { 
  background: var(--card-subtle); 
  color: var(--text); 
  border: 1px solid var(--border); 
}
.btn-ghost:hover { 
  background: var(--border); 
  color: var(--text-strong); 
}

body.theme-light .btn-ghost {
  background: #ffffff;
  color: #334155;
  border-color: #cbd5e1;
}
body.theme-light .btn-ghost:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

.btn-danger { 
  background: rgba(239, 68, 68, 0.1); 
  color: var(--red); 
  border: 1px solid rgba(239, 68, 68, 0.3); 
}
.btn-danger:hover { 
  background: var(--red); 
  color: #fff; 
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.25);
}

.btn-success { 
  background: var(--green); 
  color: #fff; 
  border: 1px solid transparent;
}
.btn-success:hover { 
  background: #059669; 
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25);
}

.btn-sm { 
  padding: 4px 10px; 
  font-size: .76rem; 
  border-radius: 6px;
}

/* ── Formulários & Abas ──────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group { margin-bottom: 16px; }
.form-group.full { grid-column: 1 / -1; }

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 12px 16px;
  font-size: .85rem;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  transition: .15s;
}

.tab.active {
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.tab-content { display: none; padding: 18px; }
.tab-content.active { display: block; }

/* ── Gráficos & Utilidades ───────────────────────────────────────────────── */
.chart-wrap { padding: 18px; }
.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.bar {
  flex: 1;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  min-width: 4px;
  transition: .3s;
  position: relative;
}

.bar:hover::after {
  content: attr(data-val);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .72rem;
  white-space: nowrap;
  color: var(--text);
}

#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--green);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  display: none;
  z-index: 9999;
  font-size: .9rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
}

#toast.err { background: var(--red); }

#login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  background: var(--bg);
}

.login-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, .4);
}

.login-box h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; text-align: center; }
.login-box p  { color: var(--muted); font-size: .85rem; text-align: center; margin-bottom: 28px; }

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Modais (Desktop) ────────────────────────────────────────────────────── */
.modal-overlay, #modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-box, .modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .4);
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Menu Mobile Toggle & Overlay ────────────────────────────────────────── */
#menu-toggle {
  display: none;
  background: #1e293b;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  font-size: 1.3rem;
  line-height: 1;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 7px;
  left: 8px;
  z-index: 1001;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
  transition: background .15s ease;
}

#menu-toggle:active { background: var(--accent); }

#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(2px);
  z-index: 999;
}

/* ==========================================================================
   Responsividade: Tablets (769px até 1024px)
   ========================================================================== */
@media (max-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
  .dash-chart-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .dash-tables-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* ==========================================================================
   Responsividade: Mobile (< 768px)
   ========================================================================== */
@media (max-width: 768px) {
  body {
    flex-direction: column;
    overflow-x: hidden;
  }

  #menu-toggle {
    display: flex;
  }

  #sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    width: 260px;
    max-width: 80vw;
    z-index: 1000;
    transition: left .25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 6px 0 24px rgba(0, 0, 0, .6);
  }

  #sidebar.open {
    left: 0;
  }

  #sidebar-overlay.open {
    display: block;
  }

  #app {
    flex-direction: column;
    width: 100%;
    min-width: 0;
    max-width: 100vw;
  }

  #main {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  #topbar {
    padding: 10px 12px 10px 56px;
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
  }

  #topbar h2 {
    font-size: .95rem;
    white-space: nowrap;
  }

  #topbar .user-info {
    display: none !important;
  }

  #tenant-badge-container {
    margin-left: 0 !important;
    margin-right: 0 !important;
    display: inline-flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: .75rem !important;
    max-width: 100%;
  }

  #tenant-badge-container .pill {
    padding: 2px 6px;
    font-size: .68rem;
  }

  #tenant-badge-container button {
    padding: 2px 6px !important;
    font-size: .72rem !important;
  }

  #content {
    padding: 14px 10px;
    min-width: 0;
    max-width: 100%;
  }

  .cards, .grid-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }

  .card {
    padding: 14px 12px;
  }

  .card .c-label {
    font-size: .65rem;
    margin-bottom: 4px;
  }

  .card .c-val {
    font-size: 1.25rem;
  }

  /* Grids responsivas no celular */
  .dash-grid-2,
  .dash-chart-grid,
  .dash-tables-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
    margin-bottom: 14px;
  }

  /* Converte grids de 2 colunas inline para 1 coluna no celular */
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns:1fr 1fr"],
  div[style*="grid-template-columns: 2fr 1fr"],
  div[style*="grid-template-columns:2fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Permite que selects e buscas ocupem 100% no mobile */
  div[style*="min-width: 220px"],
  div[style*="min-width:220px"],
  div[style*="min-width: 180px"],
  div[style*="min-width:180px"],
  div[style*="min-width: 160px"],
  div[style*="min-width:160px"],
  div[style*="min-width: 140px"],
  div[style*="min-width:140px"] {
    min-width: 100% !important;
  }

  .hspot-list {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  /* Scroll horizontal suave para tabelas sem esmagar colunas */
  .card, .section {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    display: table !important;
    width: 100% !important;
    min-width: 580px !important;
    border-collapse: collapse;
  }

  th, td {
    padding: 9px 12px !important;
    font-size: .78rem !important;
    white-space: nowrap !important;
  }

  .section-head {
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .section-head h3 {
    font-size: .85rem;
  }

  .btn {
    padding: 6px 12px;
    font-size: .8rem;
  }

  .login-box {
    margin: 14px;
    padding: 24px 16px;
  }

  #toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    text-align: center;
    font-size: .82rem;
  }

  .hspot-card .hactions {
    flex-direction: column;
  }

  .hspot-card .hactions .btn {
    width: 100%;
    justify-content: center;
  }

  .tabs {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    padding: 0 8px;
  }

  .tab {
    padding: 10px 12px;
    font-size: .8rem;
  }

  /* Modais no Mobile */
  .modal-overlay, #modal-overlay {
    padding: 8px;
  }

  .modal-box, .modal {
    max-width: 95vw !important;
    padding: 16px !important;
    max-height: 88vh !important;
    border-radius: 12px;
  }
}

/* ==========================================================================
   Responsividade: Telas Pequenas (< 480px)
   ========================================================================== */
@media (max-width: 480px) {
  .cards, .grid-4 {
    grid-template-columns: 1fr;
  }
  #topbar {
    padding-left: 52px;
  }
}

/* ── Botão Alternar Tema (Claro / Escuro) — Pill Executivo ── */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  background: var(--card-subtle);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9999px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.theme-toggle-btn:hover {
  background: var(--border);
  color: var(--accent);
  transform: translateY(-1px);
}

.theme-toggle-btn:active {
  transform: translateY(0);
}

body.theme-light .theme-toggle-btn {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

body.theme-light .theme-toggle-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #2563eb;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* ── Badges no Tema Claro (Tons Suaves e Texto Contratado) ── */
body.theme-light .pill-gray {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

body.theme-light .pill-blue {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

body.theme-light .pill-green {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

body.theme-light .pill-red {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

body.theme-light .pill-amber {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

/* ── Elementos do Tema Claro ── */
body.theme-light .card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
}

body.theme-light .card:hover {
  border-color: #cbd5e1;
}

body.theme-light #sidebar {
  background: #ffffff;
  border-right-color: #e2e8f0;
  box-shadow: 1px 0 3px 0 rgba(0, 0, 0, 0.03);
}

body.theme-light #topbar {
  background: #ffffff;
  border-bottom-color: #e2e8f0;
}

body.theme-light .section {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}

body.theme-light .section-head {
  border-bottom-color: #e2e8f0;
  background: #f8fafc;
}

body.theme-light input, 
body.theme-light select, 
body.theme-light textarea {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

body.theme-light input:focus, 
body.theme-light select:focus, 
body.theme-light textarea:focus {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

body.theme-light .modal-box,
body.theme-light .modal {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  color: #0f172a;
}

body.theme-light .tabs {
  border-bottom-color: #e2e8f0;
}

body.theme-light .tab:hover {
  color: #0f172a;
}

body.theme-light .login-box {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

