/* ==============================================================================
   VARIÁVEIS GLOBAIS (DESIGN SYSTEM)
   ============================================================================== */
:root {
  --bg-dark: #121212;
  --bg-card: #1e1e1e;
  --bg-input: #2c2c2c;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --blue: #3878e1;
  --blue-hover: #2b62c0;
  --red: #ef5350;
  --red-hover: #d32f2f;
  --green: #66bb6a;
  --orange: #ffa726;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* ==============================================================================
   SCROLLBAR CUSTOMIZADA
   ============================================================================== */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
::-webkit-scrollbar-track {
  background: #1e1e1e;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb {
  background-color: #333;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--blue);
}
* {
  scrollbar-width: thin;
  scrollbar-color: #333 #1e1e1e;
}

/* ==============================================================================
   RESET & BASE
   ============================================================================== */
* {
  box-sizing: border-box;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
*:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  margin: 0;
  padding: 30px;
}

/* Correção do scroll (travar fundo) */
body.no-scroll {
  overflow: hidden;
}

.desktop-actions {
  display: none !important; /* Esconde botões do cabeçalho globalmente pois agora usamos a Sidebar */
}

/* ==============================================================================
   TIPOGRAFIA
   ============================================================================== */
h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
}
h1 {
  font-size: 1.8rem;
  color: var(--text-primary);
  text-transform: capitalize;
}
h2 {
  font-size: 1rem;
  color: var(--text-primary);
}

/* ==============================================================================
   MOBILE SIDEBAR E FAB COMPONENT
   ============================================================================== */
.fab-menu {
  display: flex;
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  border: none;
  box-shadow: 0 10px 25px rgba(56, 120, 225, 0.4);
  cursor: pointer;
  z-index: 900;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  align-items: center;
  justify-content: center;
}
.fab-menu:hover {
  transform: scale(1.08);
  background: var(--blue-hover);
}
.fab-menu:active {
  transform: scale(0.95);
}
.fab-menu .material-icons {
  font-size: 28px;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease-in-out;
}
.sidebar-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-mobile {
  position: fixed;
  top: 0;
  right: -320px;
  width: 280px;
  max-width: 85vw;
  height: 100vh;
  background: rgba(30, 30, 30, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  z-index: 999;
  transition: right 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
  padding: 25px 20px;
  overflow-y: auto;
}
.sidebar-mobile.open {
  right: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.sidebar-header h2 {
  font-size: 1.2rem;
  margin: 0;
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: 0.5px;
}
.btn-close-sidebar {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-close-sidebar:hover {
  background: rgba(239, 83, 80, 0.15);
  color: var(--red);
  border-color: rgba(239, 83, 80, 0.3);
  transform: rotate(90deg);
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-family: inherit;
  width: 100%;
  text-align: left;
}
.sidebar-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateX(4px);
}
.sidebar-btn .material-icons {
  font-size: 20px;
  color: var(--text-secondary);
}
.sidebar-btn-users .material-icons {
  opacity: 0.9;
}

.sidebar-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 10px 0;
}

.btn-danger-sidebar {
  color: var(--red);
}
.btn-danger-sidebar:hover {
  background: rgba(239, 83, 80, 0.08);
  border-color: rgba(239, 83, 80, 0.2);
}
.btn-danger-sidebar .material-icons {
  color: var(--red);
}

/* ==============================================================================
   VISIBILIDADE RESPONSIVA
   ============================================================================== */
@media (min-width: 769px) {
  .hide-on-desktop {
    display: none !important;
  }
}
@media (max-width: 768px) {
  .hide-on-mobile {
    display: none !important;
  }
}

/* ==============================================================================
   HEADER
   ============================================================================== */
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.header-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.nav-links {
  display: flex;
  gap: 15px;
  font-size: 0.9rem;
}
.nav-btn {
  text-decoration: none;
  color: var(--text-secondary);
  transition: all 0.2s;
  font-weight: 500;
  cursor: pointer;
}
.nav-btn:hover {
  color: var(--blue);
  transform: translateX(2px);
}
.nav-btn.active {
  color: var(--text-primary);
  font-weight: bold;
  cursor: default;
}

.header-actions {
  display: flex;
  gap: 12px;
}
.btn-secondary,
.btn-danger-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-secondary:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}
.btn-danger-outline:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(239, 83, 80, 0.1);
}

/* ==============================================================================
   CARDS DO DASHBOARD
   ============================================================================== */
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}
.card {
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: transform 0.2s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.card:hover {
  transform: translateY(-3px);
  background: #252525;
}
.card:active {
  transform: scale(0.98);
}
.card h3 {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.card .valor {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0;
  margin-top: 8px;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.text-right {
  text-align: right;
  white-space: nowrap;
}

/* Privacidade (blur forte) */
html.hide-rendas-mode #valorRendas {
  filter: blur(15px);
  opacity: 0.5;
  user-select: none;
  cursor: default;
}

/* Privacidade Global acionada pelo atalho Ctrl+Alt+P */
html.hide-global-mode .dashboard-cards .card .valor {
  filter: blur(15px);
  opacity: 0.5;
  user-select: none;
  cursor: default;
}

.card-icon-eye {
  position: absolute;
  top: 15px;
  right: 15px;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  transition: color 0.2s;
  z-index: 10;
}
.card-icon-eye:hover {
  color: var(--text-primary);
}

/* Cores utilitárias */
.azul {
  color: var(--blue);
}
.vermelho {
  color: var(--red);
}
.verde {
  color: var(--green);
}
.laranja {
  color: var(--orange);
}

/* ==============================================================================
   GRID PRINCIPAL
   ============================================================================== */
.action-area {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
}
.btn-primary {
  background-color: var(--blue);
  color: white;
  border: none;
  padding: 12px 35px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(56, 120, 225, 0.4);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.btn-primary:hover {
  background-color: var(--blue-hover);
  transform: scale(1.05);
}

.main-grid {
  display: grid;
  grid-template-columns: 480px 1fr 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 400px;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.total-panel {
  font-size: 1rem;
  font-weight: bold;
  color: var(--text-secondary);
  white-space: nowrap;
}
.total-panel.vermelho {
  color: var(--red);
}
.total-panel.azul {
  color: var(--blue);
}

/* ==============================================================================
   GRID DE TERCEIROS
   ============================================================================== */
.terceiros-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  width: 100%;
}
@media (max-width: 1600px) {
  .terceiros-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 1200px) {
  .terceiros-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 768px) {
  .terceiros-grid {
    grid-template-columns: 1fr;
  }
}

.header-total-mes {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: normal;
}
.header-total-mes span {
  color: var(--red);
  font-weight: bold;
}

/* ==============================================================================
   TEXTAREA (ANOTAÇÕES)
   ============================================================================== */
.anotacoes-wrapper {
  position: relative;
  height: 100%;
}
textarea {
  width: 100%;
  height: 100%;
  min-height: 350px;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid transparent;
  padding: 16px;
  border-radius: 12px;
  resize: none;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  transition: border 0.3s ease;
}
textarea:focus {
  background: #333;
  border-color: var(--blue);
}
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}
.checklist-item input[type='checkbox'] {
  margin-top: 4px;
  accent-color: var(--blue);
  cursor: pointer;
}

/* ==============================================================================
   TABELAS
   ============================================================================== */
.list-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
}
.list-table tr {
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.2s;
}
.list-table tr:hover {
  background: rgba(255, 255, 255, 0.05);
}
.list-table tr.selected-row {
  background: rgba(56, 120, 225, 0.2) !important;
}
.list-table tr.linha-paga {
  opacity: 0.45;
  background-color: rgba(0, 0, 0, 0.2) !important;
  transition: all 0.3s ease;
}
.list-table td {
  padding: 10px 12px;
  font-size: 0.9rem;
  vertical-align: middle;
}
.list-table td:first-child {
  border-radius: 8px 0 0 8px;
}
.list-table td:last-child {
  border-radius: 0 8px 8px 0;
  padding-right: 5px;
}

.drag-container td:nth-child(3) {
  width: 100%;
}
.list-table tr:not(.draggable-row) td:nth-child(2) {
  white-space: nowrap;
}
.text-right {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
input[type='checkbox'] {
  accent-color: var(--blue);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.actions {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
  padding-left: 15px;
  align-items: center;
}
.actions span {
  font-size: 16px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.2s;
}
.actions span:hover {
  color: var(--text-primary);
}

/* ==============================================================================
   COMPARATIVO FATURA APP
   ============================================================================== */
.app-compare-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  margin-bottom: 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.app-compare-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.app-compare-input {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--blue);
  font-weight: bold;
  font-size: 1rem;
  padding: 5px 10px;
  width: 140px;
  text-align: right;
  transition: all 0.2s;
  font-family: inherit;
}
.app-compare-input:focus {
  border-color: var(--blue);
  background: #252525;
  outline: none;
}

/* ==============================================================================
   SCROLL ESTRUTURAL
   ============================================================================== */
.scroll-wrapper {
  max-height: 520px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 5px;
  margin-top: 10px;
}

/* ==============================================================================
   MODAIS
   ============================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  visibility: hidden;
  opacity: 0;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}
.modal-overlay.active {
  visibility: visible;
  opacity: 1;
}
.modal-overlay.confirm-overlay {
  z-index: 1100;
}
.modal-box {
  background: var(--bg-card);
  width: 100%;
  max-width: 800px;
  padding: 30px;
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  transform: translateY(20px) scale(0.95);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}
.modal-box.modal-lg {
  max-width: 1200px;
  width: 95%;
  height: 90vh;
}
.modal-box .scroll-wrapper {
  max-height: none !important;
  flex-grow: 1;
  height: 100%;
  margin-bottom: 10px;
}
.modal-overlay.active .modal-box {
  transform: translateY(0) scale(1);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 15px;
  flex-shrink: 0;
  width: 100%;
}
.modal-title-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-right: 20px;
}
.modal-scroll {
  overflow-y: auto;
  flex-grow: 1;
  padding-right: 5px;
  margin-bottom: 10px;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 5px;
}
.modal-close:hover {
  color: var(--red);
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}
.modal-grid.single-col {
  grid-template-columns: 1fr;
  max-width: 400px;
  margin: 0 auto;
}
.hide-on-edit {
  display: block;
}
.modal-grid.single-col .hide-on-edit {
  display: none;
}
.form-group {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.form-group label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
}
.form-input,
.form-select {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid transparent;
  padding: 12px;
  border-radius: 8px;
  font-size: 1rem;
  width: 100%;
}
.form-input:focus,
.form-select:focus {
  border-color: var(--blue);
  background: #333;
}
.form-btn {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  margin-top: 10px;
}

.list-header {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 10px;
  text-transform: uppercase;
}
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.list-item:last-child {
  border-bottom: none;
}
.list-item .desc {
  font-weight: 500;
}
.list-item .val {
  font-weight: bold;
  font-size: 1.1rem;
}

.confirm-actions {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
  margin-top: 20px;
}
.btn-cancel {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
}
.btn-cancel:hover {
  color: var(--text-primary);
  border-color: var(--text-primary);
}
.btn-delete {
  background: var(--red);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
}
.btn-delete:hover {
  background: var(--red-hover);
}

/* ==============================================================================
   DRAG & DROP
   ============================================================================== */
.draggable-row {
  cursor: move;
}
.draggable-row.dragging {
  opacity: 0.5;
  background: #333;
}
.drag-handle {
  cursor: grab;
  color: var(--text-secondary);
}
.drag-handle:active {
  cursor: grabbing;
  color: var(--text-primary);
}
.draggable-card {
  cursor: grab;
  transition:
    transform 0.2s,
    opacity 0.2s;
}
.draggable-card:active {
  cursor: grabbing;
}
.draggable-card.dragging {
  opacity: 0.4;
  border: 2px dashed var(--blue);
  transform: scale(0.98);
}

/* ==============================================================================
   PRINT (IMPRESSÃO A4)
   ============================================================================== */
#printable-area {
  display: none;
}
@media print {
  body > *:not(#printable-area) {
    display: none !important;
  }
  body {
    background-color: white !important;
    color: black !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  #printable-area {
    display: block !important;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: white;
    padding: 20px;
  }
  .print-header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #000;
    padding-bottom: 10px;
  }
  .print-header h1 {
    color: #000 !important;
    font-size: 24px;
    margin: 0;
  }
  .print-header p {
    color: #666;
    margin: 5px 0 0 0;
  }
  .print-section {
    margin-bottom: 30px;
    page-break-inside: avoid;
  }
  .print-section h2 {
    color: #000 !important;
    font-size: 18px;
    border-bottom: 1px solid #ccc;
    padding-bottom: 5px;
    margin-bottom: 10px;
    text-transform: uppercase;
  }
  .print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
  }
  .print-table th {
    text-align: left;
    border-bottom: 1px solid #000;
    padding: 5px;
    font-weight: bold;
  }
  .print-table td {
    padding: 5px;
    border-bottom: 1px solid #eee;
  }
  .print-table tr.pago {
    color: #666;
    font-style: italic;
  }
  .print-total {
    text-align: right;
    font-weight: bold;
    font-size: 14px;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid #000;
  }
}

/* ==============================================================================
   RESPONSIVO (MOBILE)
   ============================================================================== */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
  .header-left {
    width: 100%;
  }
  .header-actions {
    width: 100%;
    display: none; /* Esconde no mobile em favor do sidebar */
  }
  .dashboard-cards {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .card {
    padding: 15px;
  }
  .card h3 {
    font-size: 0.7rem;
  }
  .card .valor {
    font-size: 1.4rem;
  }
  .main-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .terceiros-grid {
    grid-template-columns: 1fr;
  }
  .modal-box {
    width: 98%;
    max-height: 98vh;
    padding: 15px;
  }
  .modal-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  input[type='checkbox'] {
    width: 22px;
    height: 22px;
  }
  .list-table td {
    font-size: 0.75rem;
    padding: 12px 3px;
  }
  .actions {
    gap: 6px;
  }
  .actions span {
    font-size: 18px;
    padding: 4px;
  }
  .drag-container td:nth-child(3) {
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.2;
  }
  .panel .btn-secondary {
    width: auto !important;
    flex-shrink: 0;
    padding: 6px 12px;
    font-size: 0.75rem;
  }
  .panel > div[style*='background'] {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
  }
  .panel > div[style*='background'] div[style*='font-size: 1.4rem'] {
    font-size: 1.1rem !important;
  }

  /* ==============================================================================
     CORREÇÃO MOBILE: SCROLL EM IFRAMES DENTRO DE MODAIS (APENAS MOBILE)
     ============================================================================== */
  .modal-scroll {
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
  }

  /* Iframe dentro de modal - permitir scroll apenas no mobile */
  .modal-scroll iframe {
    width: 100%;
    height: 100%;
    min-height: 100%;
    border: none;
    display: block;
    touch-action: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Modal de iframe específico - APENAS MOBILE */
  .modal-box.iframe-modal {
    padding: 0;
    overflow: hidden;
  }

  .modal-box.iframe-modal .modal-header {
    padding: 15px 20px;
    margin-bottom: 0;
    background: var(--bg-card);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .modal-box.iframe-modal .modal-scroll {
    height: calc(90vh - 60px);
    max-height: none;
    padding: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal-box.iframe-modal .modal-scroll iframe {
    height: 100%;
    min-height: 100%;
  }
}

/* ==============================================================================
   MODAL CALCULAR LUZ (IFRAME) - CORREÇÃO PC
   ============================================================================== */

/* Container do iframe dentro do modal */
#modalCalcularLuz .modal-scroll {
  height: calc(90vh - 80px); /* Altura do modal menos header */
  max-height: none;
  padding: 0;
  overflow: hidden; /* Remove scroll do container */
  display: flex;
  flex-direction: column;
}

/* Container direto do iframe */
#modalCalcularLuz .modal-scroll > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

/* Iframe em si */
#modalCalcularLuz .modal-scroll iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 100%;
  border: none;
  border-radius: 0 0 16px 16px;
  display: block;
}

/* Header do modal */
#modalCalcularLuz .modal-header {
  flex-shrink: 0; /* Não encolhe */
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 15px 20px;
}

/* Modal box */
#modalCalcularLuz .modal-box {
  padding: 0; /* Remove padding padrão */
  display: flex;
  flex-direction: column;
  height: 90vh;
  max-height: 90vh;
  overflow: hidden;
}

/* Mobile - mantém comportamento atual */
@media (max-width: 768px) {
  #modalCalcularLuz .modal-box {
    height: 95vh;
    max-height: 95vh;
  }

  #modalCalcularLuz .modal-scroll {
    height: calc(95vh - 70px);
  }
}

/* ==============================================================================
   LOGIN PAGE STYLES (NOVO DESIGN ELEGANTE)
   ============================================================================== */
.login-body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  padding: 20px;
  background-color: var(--bg-dark);
  background: radial-gradient(circle at center, #1e1e1e 0%, #121212 100%);
}

.login-container {
  width: 100%;
  max-width: 380px;
  perspective: 1000px;
}

.login-card {
  background: var(--bg-card);
  padding: 50px 40px;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
  animation: fadeInLogin 0.8s ease-out forwards;
  opacity: 0;
  transform: translateY(20px);
}

@keyframes fadeInLogin {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-icon {
  font-size: 40px;
  color: var(--blue);
  margin-bottom: 20px;
  background: rgba(56, 120, 225, 0.1);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
  box-shadow: 0 0 20px rgba(56, 120, 225, 0.1);
}

.login-card h2 {
  color: var(--text-primary);
  margin-bottom: 5px;
  font-size: 1.5rem;
  font-weight: 700;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 35px;
  display: block;
}

.login-form .form-group {
  margin-bottom: 20px;
  text-align: left;
}

.login-form label {
  font-size: 0.85rem;
  margin-bottom: 8px;
  display: block;
  color: var(--text-secondary);
  font-weight: 500;
}

.login-input {
  width: 100%;
  padding: 14px 16px;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s ease;
  outline: none;
}

.login-input:focus {
  border-color: var(--blue);
  background-color: rgba(56, 120, 225, 0.05);
  box-shadow: 0 0 0 4px rgba(56, 120, 225, 0.1);
}

.login-btn {
  width: 100%;
  padding: 14px;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 10px;
}

.login-btn:hover {
  background: var(--blue-hover);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(56, 120, 225, 0.3);
}

.login-footer {
  margin-top: 30px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.3);
}

.error-msg {
  background: rgba(239, 83, 80, 0.1);
  color: var(--red);
  padding: 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 20px;
  border: 1px solid rgba(239, 83, 80, 0.2);
}

/* ==============================================================================
   LOGIN: CHECKBOX LEMBRAR DE MIM
   ============================================================================== */
.remember-group {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin: 10px 0 25px 0;
}

/* Aumentando a especificidade para sobrescrever o .login-form label (que aplicava block) */
.login-form label.custom-checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  margin-bottom: 0;
}

.hidden-checkbox {
  display: none;
}

.custom-checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  background-color: rgba(255, 255, 255, 0.02);
}

.custom-checkbox-wrapper:hover .custom-checkbox {
  border-color: rgba(56, 120, 225, 0.5);
}

.hidden-checkbox:checked + .custom-checkbox {
  background-color: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 0 12px rgba(56, 120, 225, 0.4);
}

.hidden-checkbox:checked + .custom-checkbox::after {
  content: '';
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.remember-text {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.3s ease;
}

.hidden-checkbox:checked ~ .remember-text {
  color: var(--text-primary);
}

/* ==============================================================================
   BOTÕES TOGGLE — Sim/Não para Lançamento em Massa
   ============================================================================== */
.bulk-toggle-btn {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: var(--text-secondary);
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
}
.bulk-toggle-btn:hover {
  border-color: rgba(56, 120, 225, 0.5);
  color: var(--text-primary);
  background: rgba(56, 120, 225, 0.05);
}
.bulk-toggle-btn.active {
  border-color: var(--blue);
  color: var(--text-primary);
  background: rgba(56, 120, 225, 0.1);
  box-shadow: 0 0 0 3px rgba(56, 120, 225, 0.15);
}
.bulk-toggle-btn.active:hover {
  border-color: var(--blue);
  background: rgba(56, 120, 225, 0.1);
}
