html {
  font-size: 13.5px;
}

:root {
  --primary: #0f3d59;
  --primary-dark: #092537;
  --primary-light: #185a80;
  --secondary: #17a2b8;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --sidebar-bg: #0b2538;
  --sidebar-hover: #133954;
  --sidebar-active: #1d4e73;
  --light-bg: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--light-bg);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
}

/* TELA DE LOGIN INSTITUCIONAL E AUDITORIA (MROSC) */
.login-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow-y: auto;
  background: 
    radial-gradient(circle at 15% 25%, rgba(2, 132, 199, 0.22) 0%, transparent 45%),
    radial-gradient(circle at 85% 75%, rgba(16, 185, 129, 0.18) 0%, transparent 45%),
    linear-gradient(135deg, #041421 0%, #072338 35%, #0f3d59 75%, #164e72 100%);
  background-attachment: fixed;
  padding: 2.5rem 1.5rem 7.5rem 1.5rem;
  box-sizing: border-box;
  position: relative;
}

.login-wrapper::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}

.login-portal-container {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 2rem;
  width: 100%;
  max-width: 1160px;
  margin: auto;
  z-index: 2;
  position: relative;
}

/* COLUNA ESQUERDA: HERO INSTITUCIONAL & COMPROVAÇÃO DO SISTEMA */
.login-hero-showcase {
  flex: 1.25;
  background: rgba(15, 61, 89, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 16px;
  padding: 2.25rem 2.5rem;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 20px 35px -10px rgba(0,0,0,0.45);
}

.login-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(2, 132, 199, 0.25);
  border: 1px solid rgba(56, 189, 248, 0.45);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #38bdf8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
}

.login-hero-title {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 0.65rem;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.login-hero-desc {
  font-size: 0.88rem;
  color: #cbd5e1;
  line-height: 1.55;
  margin-bottom: 1.25rem;
}

.login-hero-img-box {
  background: rgba(4, 20, 33, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 1.25rem;
  text-align: center;
}

.login-hero-img {
  width: 100%;
  max-height: 190px;
  object-fit: contain;
  filter: drop-shadow(0 10px 15px rgba(0,0,0,0.35));
}

.login-proof-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.login-proof-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 12px;
  transition: transform 0.2s, background 0.2s;
}

.login-proof-card:hover {
  background: rgba(255, 255, 255, 0.09);
  transform: translateY(-2px);
}

.login-proof-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.82rem;
  margin-bottom: 3px;
}

.login-proof-text {
  font-size: 0.72rem;
  color: #cbd5e1;
  line-height: 1.4;
}

.login-hero-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.72rem;
  color: #94a3b8;
}

/* COLUNA DIREITA: CARD DO FORMULÁRIO DE LOGIN */
.login-card {
  flex: 0.95;
  max-width: 460px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4), 0 10px 20px -5px rgba(0, 0, 0, 0.2);
  padding: 2.25rem 2.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-header {
  text-align: center;
  margin-bottom: 1.35rem;
}

.login-logos-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 0.75rem;
}

.login-logo-img {
  height: 48px;
  max-width: 100px;
  object-fit: contain;
}

.login-header h2 {
  color: var(--primary);
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 2px;
}

.login-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.login-input-group {
  position: relative;
}

.login-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  color: #64748b;
  pointer-events: none;
}

.login-input-group .form-control {
  padding-left: 38px;
}

.login-password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: #64748b;
  padding: 4px;
}

.login-help {
  margin-top: 1.25rem;
  padding: 0.75rem 0.85rem;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.login-help code {
  background: #e2e8f0;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
  color: var(--primary);
}

/* RESPONSIVIDADE PARA TELAS MENORES */
@media (max-width: 960px) {
  .login-portal-container {
    flex-direction: column;
    max-width: 520px;
    gap: 1.5rem;
  }
  .login-hero-showcase {
    padding: 1.5rem;
  }
  .login-hero-title {
    font-size: 1.45rem;
  }
  .login-card {
    max-width: 100%;
    padding: 1.75rem 1.5rem;
  }
}

/* LAYOUT PRINCIPAL: SIDEBAR + MAIN WRAPPER */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* SIDEBAR ESQUERDA - SEM BARRA DE ROLAGEM VISÍVEL E COMPACTA */
.sidebar {
  width: 220px;
  min-width: 220px;
  background-color: var(--sidebar-bg);
  color: #f1f5f9;
  display: flex;
  flex-direction: column;
  height: 100vh;
  border-right: 1px solid rgba(255,255,255,0.08);
  z-index: 10;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.sidebar::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.sidebar-header {
  padding: 0.85rem 1rem 0.65rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header .logo-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-header .logo-icon {
  font-size: 1.8rem;
}

.sidebar-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ffffff;
}

.sidebar-header .subtitle {
  font-size: 0.72rem;
  color: #94a3b8;
}

/* CAIXA DE INSTITUIÇÃO NA SIDEBAR */
.sidebar-institution-box {
  display: none !important;
}

.sidebar-institution-box label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 0.35rem;
}

.sidebar-select {
  background: #ffffff;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
}

.sidebar-contract-info {
  margin-top: 0.6rem;
  background: rgba(255,255,255,0.08);
  border-left: 3px solid var(--accent);
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
}

.sidebar-contract-info .s-contract {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #ffffff;
}

.sidebar-contract-info .s-val {
  display: block;
  font-size: 0.7rem;
  color: #cbd5e1;
}

/* NAVEGAÇÃO LATERAL - TOTALMENTE SEM ROLAGEM VISÍVEL */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.35rem 0.45rem;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.sidebar-nav::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.nav-section-title {
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #64748b;
  padding: 0.45rem 0.6rem 0.2rem 0.6rem;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.42rem 0.65rem;
  background: none;
  border: none;
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 5px;
  cursor: pointer;
  text-align: left;
  transition: all 0.12s ease-in-out;
  margin-bottom: 1px;
}

.nav-item .nav-icon {
  font-size: 1.05rem;
}

.nav-item:hover {
  background-color: var(--sidebar-hover);
  color: #ffffff;
}

.nav-item.active {
  background-color: var(--sidebar-active);
  color: #ffffff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}

/* FOOTER DA SIDEBAR */
.sidebar-footer {
  padding: 1rem 1.25rem;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid rgba(255,255,255,0.08);
}

.user-info-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #ffffff;
}

.user-role {
  font-size: 0.7rem;
  color: #94a3b8;
}

/* MAIN WRAPPER (DIREITA) */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background-color: var(--light-bg);
}

/* TOPBAR REFINADO E MULTI-DISPOSITIVO */
.topbar {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 0.45rem 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  position: relative;
  z-index: 850;
  box-sizing: border-box;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 0 0 auto;
}

.topbar-logos-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar-logo-img {
  height: 34px;
  max-width: 130px;
  object-fit: contain;
}

.topbar-center {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
}

.topbar-center-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 520px;
  cursor: pointer;
}

.topbar-select-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 20px;
  padding: 0.35rem 0.95rem;
  transition: all var(--transition-speed);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.topbar-select-pill:hover {
  background: #f1f5f9;
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(15, 61, 89, 0.1);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 0 0 auto;
  justify-content: flex-end;
}

.topbar-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 0.28rem 0.75rem;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.topbar-user-badge:hover {
  background: #e2e8f0;
  border-color: var(--primary);
}

.topbar-user-name {
  font-weight: 700;
  color: #0f3d59;
  font-size: 0.82rem;
}

.topbar-role-badge {
  background: #0284c7;
  color: #ffffff;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar-action-btn {
  white-space: nowrap !important;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.28rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
}

.sidebar-action-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.65rem 1rem;
  color: var(--sidebar-text);
  background: transparent;
  border: none;
  border-radius: var(--border-radius);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-speed);
  text-align: left;
  margin-bottom: 0.25rem;
  text-decoration: none;
}

.sidebar-action-btn:hover {
  background-color: var(--sidebar-hover);
  color: #ffffff;
}

.sidebar-action-btn .nav-icon {
  margin-right: 0.75rem;
  font-size: 1.1rem;
}

.sidebar.collapsed .sidebar-action-btn {
  justify-content: center;
  padding: 0.65rem;
}

.sidebar.collapsed .sidebar-action-btn .nav-text,
.sidebar.collapsed .sidebar-action-btn span[id*="Badge"] {
  display: none;
}

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 1.15rem 6rem 1.15rem;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* CARDS DE MÉTRICAS */
.metrics-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.metric-card {
  background: #ffffff;
  padding: 1.25rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  border-left: 5px solid var(--primary);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.metric-card.warning { border-left-color: var(--warning); }
.metric-card.danger { border-left-color: var(--danger); }
.metric-card.success { border-left-color: var(--success); }
.metric-card.info { border-left-color: var(--info); }

.metric-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.metric-info {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.metric-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0.15rem 0;
}

.metric-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* GRIDS DO DASHBOARD */
.dashboard-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
  gap: 1.5rem;
}

/* CARDS GERAIS */
.card {
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.25rem;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h3 {
  font-size: 1rem;
  color: var(--primary);
  font-weight: 700;
}

.card-badge {
  background: #e0f2fe;
  color: #0284c7;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
}

.card-body {
  padding: 1.25rem;
}

/* METER / BARRA DE CONSUMO */
.meter-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.progress-bar-bg {
  width: 100%;
  height: 16px;
  background-color: #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #f59e0b);
  transition: width 0.4s ease;
}

.meter-foot-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.dash-accounts-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dash-acc-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.8rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.82rem;
}

.dash-task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.dash-task-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0.75rem;
  background: #f8fafc;
  border-left: 3px solid var(--primary);
  border-radius: 4px;
  font-size: 0.82rem;
}

/* SEÇÃO HEADER & FILTROS */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-header h2 {
  font-size: 1.2rem;
  color: var(--primary);
  font-weight: 700;
}

.section-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.filter-item label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* TABELAS */
.table-container {
  background: #ffffff;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  border: 1px solid var(--border-color);
  max-width: 100%;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}

.data-table th {
  background-color: #f8fafc;
  color: var(--primary);
  font-weight: 700;
  padding: 0.75rem 0.8rem;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.data-table tr:hover {
  background-color: #f8fafc;
}

/* BADGES & STATUS */
.status-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-pendente {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
}

.status-classificado {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.badge-debito {
  color: var(--danger);
  font-weight: 600;
}

.badge-credito {
  color: var(--success);
  font-weight: 600;
}

/* INTERATIVE DRILLDOWN TABLE */
.clickable-row {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.clickable-row:hover {
  background-color: #e2f0fb !important;
}

.instructions-banner {
  background-color: #e8f4fd;
  border-left: 4px solid var(--secondary);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.82rem;
  color: #0c5460;
}

/* FORMULÁRIOS & BOTÕES */
.form-group {
  margin-bottom: 0.9rem;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.84rem;
  outline: none;
  transition: border 0.15s;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(15, 61, 89, 0.15);
}

.form-control-sm {
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.col-4 { flex: 1; }
.col-6 { flex: 1; }

.btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: none;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }

.btn-secondary { background: #64748b; color: #fff; }
.btn-secondary:hover { background: #475569; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-outline-light {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: #f1f5f9;
}
.btn-outline-light:hover {
  background: rgba(255,255,255,0.1);
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
}

.btn-xs {
  padding: 0.25rem 0.5rem;
  font-size: 0.72rem;
}

.btn-block { width: 100%; }

/* RAMIFICAÇÃO HIERARCHY CARDS */
.hierarchy-cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.h-card {
  background: #f8fafc;
  padding: 1rem;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.h-badge {
  display: inline-block;
  font-size: 0.68rem;
  background: var(--primary);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.h-card h4 {
  font-size: 0.9rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}

.h-card p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ÍCONE DE AJUDA ? */
.help-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  background: #3b82f6;
  color: #fff;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  margin-left: 4px;
  vertical-align: middle;
  transition: transform 0.15s, background-color 0.15s;
}

.help-circle:hover {
  background: #1d4ed8;
  transform: scale(1.15);
}

.help-modal-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 1.25rem;
  border-radius: 6px;
  color: #166534;
  font-size: 0.88rem;
  line-height: 1.6;
}

/* MODALS E POP-UPS (COMPATIBILIDADE .modal E .modal-overlay) */
.modal, .modal-overlay {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.modal.active, .modal-overlay.active {
  display: flex !important;
}

.modal-content, .modal-card {
  background: #ffffff;
  border-radius: 10px;
  width: 100%;
  max-width: 600px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 20px 35px -5px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  position: relative;
  margin: auto;
}

@media (max-width: 600px) {
  .modal, .modal-overlay {
    padding: 0.5rem;
    align-items: flex-end;
  }
  .modal-content, .modal-card {
    max-width: 100% !important;
    max-height: 95vh !important;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
}

.modal-content.modal-lg {
  max-width: 900px;
}

.modal-header {
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.05rem;
  color: var(--primary);
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 1.25rem;
}

.modal-footer {
  padding: 0.75rem 1.25rem;
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.modal-tabs-header {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 1rem;
}

.modal-tab-btn {
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
}

.modal-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.5rem;
  padding: 0.75rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  max-height: 140px;
  overflow-y: auto;
}

.form-card-inline {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  padding: 1rem;
  border-radius: 6px;
}

.form-card-inline h4 {
  font-size: 0.92rem;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

/* DROPZONE */
.drop-zone {
  border: 2px dashed #b0c4de;
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  background-color: #fafbfc;
  cursor: pointer;
  margin-bottom: 1rem;
}

.drop-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.25rem;
}

.drop-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

/* ALERTS */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.82rem;
  margin-bottom: 1rem;
}
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* FOOTER */
.app-footer {
  text-align: center;
  padding: 0.75rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.week-box {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

/* METAS & GALERIA DE EVIDÊNCIAS */
.goal-card {
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: transform 0.15s, box-shadow 0.15s;
}

.goal-card:hover {
  box-shadow: var(--shadow-md);
}

.goal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.goal-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.goal-number-badge {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
}

.goal-title {
  font-size: 1.1rem;
  color: var(--primary);
  font-weight: 700;
}

.goal-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
  background: #f8fafc;
  padding: 1.25rem;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.goal-column h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.goal-column p {
  font-size: 0.82rem;
  color: var(--text-main);
  line-height: 1.6;
}

/* GALERIA DE MÍDIAS NA META */
.goal-gallery-section {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
}

.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.gallery-header h4 {
  font-size: 0.92rem;
  color: var(--primary);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.media-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
}

.media-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.media-thumb-box {
  width: 100%;
  height: 120px;
  background-color: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}

.media-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}

.media-thumb-img:hover {
  transform: scale(1.05);
}

.media-icon-doc {
  font-size: 3rem;
  color: #3b82f6;
}

.media-icon-video {
  font-size: 3rem;
  color: #ef4444;
}

.media-info {
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.media-title {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.media-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 0.4rem;
  border-top: 1px solid #f1f5f9;
}

.media-type-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-foto { background: #e0f2fe; color: #0369a1; }
.badge-doc { background: #fef3c7; color: #92400e; }
.badge-video { background: #fee2e2; color: #991b1b; }

/* MINI FOTOS NO DASHBOARD */
.dash-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.65rem;
}

.dash-photo-item {
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  height: 90px;
  cursor: pointer;
  position: relative;
}

.dash-photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}

.dash-photo-item img:hover {
  transform: scale(1.08);
}

.dash-photo-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 0.68rem;
  padding: 2px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* LOGOS NO TOPBAR */
.topbar-logos-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.topbar-logo-img {
  height: 38px;
  max-width: 120px;
  object-fit: contain;
}

.topbar-title-block {
  display: flex;
  flex-direction: column;
}

/* BOOK OFICIAL DE PRESTAÇÃO DE CONTAS */
.official-book-paper {
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  padding: 2.5rem 3rem;
  max-width: 1100px;
  margin: 0 auto 3rem auto;
}

.book-header-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
}

.book-logo-side {
  height: 60px;
  max-width: 160px;
  object-fit: contain;
}

.book-center-title {
  text-align: center;
  flex: 1;
  padding: 0 1rem;
}

.book-center-title h2 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.book-center-title p {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 0.2rem;
}

.book-quadro {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.book-quadro-title {
  background: #f1f5f9;
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid #cbd5e1;
}

.book-quadro-body {
  padding: 1rem;
  font-size: 0.82rem;
}

.signatures-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 2rem;
  margin-top: 3.5rem;
  padding-top: 1rem;
}

.signature-box {
  text-align: center;
}

.signature-line {
  border-top: 1px solid #000;
  margin-bottom: 0.4rem;
  width: 85%;
  margin-left: auto;
  margin-right: auto;
}

.signature-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
}

.signature-role {
  font-size: 0.72rem;
  color: #64748b;
}

/* REGRAS AVANÇADAS DE IMPRESSÃO MULTI-MODO (TELA INDIVIDUAL, DOSSIÊ COMPLETO E BOOK) */



/* SELETOR CENTRAL NO TOPBAR (unificado em base e media queries) */

.topbar-select-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.topbar-select {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  border-radius: 4px;
}

/* BOTÃO MOBILE HAMBURGER */
.mobile-menu-btn {
  display: none;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 1.25rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  margin-right: 0.5rem;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
}

.sidebar-backdrop.active {
  display: block;
}

/* MATRIZ DE PERMISSÕES POR TELA */
.permissions-matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.6rem;
  max-height: 250px;
  overflow-y: auto;
  padding: 0.5rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.perm-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid #f1f5f9;
}

.perm-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
}

.perm-select {
  width: auto;
  min-width: 140px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

/* REGRAS RESPONSIVAS PARA TABLETS E CELULARES */
@media (max-width: 1100px) {
  /* Em telas médias/pequenas, oculta o chip pois o select de município já exibe o termo */
  .topbar-chip {
    display: none !important;
  }
}

@media (max-width: 900px) {
  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -285px;
    bottom: 0;
    width: 280px;
    z-index: 1000;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 5px 0 25px rgba(0,0,0,0.4);
  }

  .sidebar.open {
    left: 0;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    padding: 0.45rem 0.75rem;
    gap: 0.45rem;
    height: auto;
    min-height: auto;
  }

  .topbar-row-header {
    width: 100%;
    justify-content: space-between;
  }

  .topbar-user-area {
    margin-left: auto;
  }

  .topbar-row-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
  }

  .topbar-row-actions .topbar-action-btn {
    width: 100%;
    justify-content: center;
    padding: 0.38rem 0.5rem;
    font-size: 0.78rem;
  }

  .topbar-center-selector {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    flex: 0 0 auto !important;
    margin: 0.2rem 0 0 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
  }

  .topbar-select-pill {
    padding: 0.45rem 0.85rem;
    background: #ffffff;
  }

  .sub-topbar-banner {
    padding: 0.4rem 0.75rem;
  }

  .sub-banner-desc {
    display: none;
  }

  .sub-banner-right {
    display: none;
  }

  .content-area {
    padding: 0.75rem 0.75rem 6.5rem 0.75rem;
  }

  .dashboard-grid-2 {
    grid-template-columns: 1fr;
  }

  .metrics-cards {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
  }

  .metric-card {
    padding: 0.9rem;
  }

  .metric-value {
    font-size: 1.15rem;
  }

  .form-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .modal-content.modal-lg {
    max-width: 95vw;
  }
}

@media (max-width: 640px) {
  .btn-hide-mobile {
    display: none !important;
  }

  .topbar-logo-img {
    height: 26px;
    max-width: 75px;
  }

  .topbar-user-badge {
    padding: 0.2rem 0.45rem;
  }

  .topbar-user-badge .topbar-user-name {
    max-width: 65px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-user-badge .topbar-role-badge {
    display: none !important;
  }

  .topbar-right button.btn-outline-danger {
    padding: 0.25rem 0.45rem !important;
  }
.section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-bar {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .filter-item {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-item .form-control {
    width: 100%;
  }

  .metrics-cards {
    grid-template-columns: 1fr;
  }
}

/* MODO SOMENTE LEITURA (READONLY) */
.readonly-view .btn-action-edit,
.readonly-view button[onclick*="openEdit"],
.readonly-view button[onclick*="openNew"],
.readonly-view button[onclick*="submit"],
.readonly-view button[onclick*="delete"],
.readonly-view button[onclick*="quickSave"],
.readonly-view .drop-zone,
.readonly-view .paste-zone {
  display: none !important;
}


/* ESTILOS DA GRADE DE DESTINAÇÃO OFX */
.ofx-select-rubrica {
  width: 100%;
  font-size: 0.8rem;
  padding: 0.3rem 0.45rem;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background-color: #f8fafc;
  color: #1e293b;
  font-weight: 500;
}
.ofx-select-rubrica:focus {
  border-color: var(--primary);
  background-color: #ffffff;
  outline: none;
}
.ofx-input-cell {
  width: 100%;
  font-size: 0.8rem;
  padding: 0.3rem 0.45rem;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
}
.ofx-row-exists {
  opacity: 0.55;
  background-color: #f1f5f9;
}
.ofx-badge-duplicate {
  font-size: 0.68rem;
  background: #cbd5e1;
  color: #475569;
  padding: 2px 5px;
  border-radius: 3px;
  display: inline-block;
  margin-top: 2px;
}




/* MODO RECOLHIDO (COLLAPSED SIDEBAR) */
.sidebar-header {
  padding: 0.85rem 0.95rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: 54px;
  display: flex;
  align-items: center;
}

.sidebar-header-expanded {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.sidebar-header-collapsed {
  display: none;
  width: 100%;
  justify-content: center;
  align-items: center;
}

.sidebar-collapse-btn {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 6px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.sidebar-collapse-btn:hover {
  background: var(--accent);
  color: #ffffff;
}

.sidebar-expand-btn {
  background: rgba(245, 158, 11, 0.25);
  border: 1.5px solid var(--accent);
  color: var(--accent);
  border-radius: 6px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  transition: all 0.2s ease;
}
.sidebar-expand-btn:hover {
  background: var(--accent);
  color: #ffffff;
}

/* QUANDO RECOLHIDO (COLLAPSED): O ÍCONE DA INSTITUIÇÃO SOME COMPLETAMENTE, FICA SÓ O BOTÃO DE IR/VOLTAR */
.sidebar.collapsed {
  width: 58px !important;
  min-width: 58px !important;
}

.sidebar.collapsed .sidebar-header {
  padding: 0.6rem 0;
  justify-content: center;
}

.sidebar.collapsed .sidebar-header-expanded {
  display: none !important;
}

.sidebar.collapsed .sidebar-header-collapsed {
  display: flex !important;
}

.sidebar.collapsed .logo-box,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .user-details,
.sidebar.collapsed .sidebar-actions {
  display: none !important;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 0.6rem 0;
}

.sidebar.collapsed .nav-icon {
  font-size: 1.25rem;
  margin: 0;
}

.sidebar.collapsed .user-info-row {
  justify-content: center;
  margin-bottom: 0;
}


/* SUB-TOPBAR BANNER (BLOCO MENOR UNIFICADO ABAIXO DA TOPBAR) */
.sub-topbar-banner {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 0.55rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
  min-height: 46px;
}

.sub-banner-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.sub-banner-icon {
  font-size: 1.35rem;
}

.sub-banner-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
  line-height: 1.2;
}

.sub-banner-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: block;
}

.sub-banner-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* GRÁFICOS VISUAIS DO DASHBOARD */
.charts-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

@media (max-width: 1024px) {
  .charts-dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
}

.chart-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 0.5rem;
}

.chart-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.chart-canvas-box {
  width: 100%;
  height: 220px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.period-toggle-group {
  display: flex;
  gap: 2px;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.period-toggle-btn {
  border: none;
  background: transparent;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  cursor: pointer;
  color: #64748b;
  transition: all 0.15s ease;
}

.period-toggle-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* POP-UP / MODAL DE DETALHES DE LANÇAMENTO */
.trans-detail-hero {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.trans-detail-val {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
}

.trans-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1.25rem;
  font-size: 0.85rem;
}

.trans-detail-item {
  display: flex;
  flex-direction: column;
}

.trans-detail-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 2px;
}

.trans-detail-value {
  color: #1e293b;
  font-weight: 600;
  word-break: break-word;
}

/* ESTILOS DA GRADE DE DESTINAÇÃO OFX */
.ofx-select-rubrica {
  width: 100%;
  font-size: 0.8rem;
  padding: 0.3rem 0.45rem;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background-color: #f8fafc;
  color: #1e293b;
  font-weight: 500;
}
.ofx-select-rubrica:focus {
  border-color: var(--primary);
  background-color: #ffffff;
  outline: none;
}
.ofx-input-cell {
  width: 100%;
  font-size: 0.8rem;
  padding: 0.3rem 0.45rem;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
}
.ofx-row-exists {
  opacity: 0.55;
  background-color: #f1f5f9;
}
.ofx-badge-duplicate {
  font-size: 0.68rem;
  background: #cbd5e1;
  color: #475569;
  padding: 2px 5px;
  border-radius: 3px;
  display: inline-block;
  margin-top: 2px;
}


/* ESTILOS DE INTERATIVIDADE, ASSINATURA DIGITAL E SEPARADORES SEMÂNTICOS */
.clickable-row {
  cursor: pointer !important;
  transition: background-color 0.15s ease-in-out !important;
}
.clickable-row:hover {
  background-color: #f1f5f9 !important;
}

/* CARIMBOS DE ASSINATURA DIGITAL */
.gov-signature-seal {
  border: 2px solid #059669;
  border-radius: 8px;
  background: #f0fdf4;
  padding: 0.85rem;
  font-size: 0.78rem;
  color: #1e293b;
  margin-bottom: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.icp-signature-seal {
  border: 2px solid #2563eb;
  border-radius: 8px;
  background: #eff6ff;
  padding: 0.85rem;
  font-size: 0.78rem;
  color: #1e293b;
  margin-bottom: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.open-signature-box {
  border: 2px dashed #94a3b8;
  border-radius: 8px;
  background: #f8fafc;
  padding: 1.25rem 0.85rem;
  text-align: center;
  font-size: 0.78rem;
  color: #475569;
  margin-bottom: 0.5rem;
}

/* SEPARADORES SEMÂNTICOS E CARDS */
.section-semantic-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0 0.85rem 0;
  padding: 0.6rem 0.85rem;
  background: #f8fafc;
  border-left: 4px solid var(--primary);
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
}
.ramificacao-group-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.ramificacao-group-header {
  background: #f1f5f9;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
}
.ramificacao-subgroup-box {
  padding: 0.75rem 1rem;
  border-bottom: 1px dashed #e2e8f0;
}
.ramificacao-subgroup-box:last-child {
  border-bottom: none;
}

/* TOOLTIP INTERATIVO FLUTUANTE DOS GRÁFICOS BI */
.chart-interactive-tooltip {
  position: fixed;
  z-index: 99999;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.94);
  color: #ffffff;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.78rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  max-width: 290px;
  line-height: 1.4;
  transition: opacity 0.12s ease-out, transform 0.12s ease-out;
}
.chart-interactive-tooltip .tt-title {
  font-weight: 700;
  font-size: 0.82rem;
  color: #38bdf8;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 4px;
  margin-bottom: 6px;
}
.chart-interactive-tooltip .tt-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 2px;
}
.chart-interactive-tooltip .tt-val {
  font-weight: 700;
  color: #f8fafc;
}
.chart-interactive-tooltip .tt-highlight {
  color: #4ade80;
  font-weight: 800;
}

/* TOPBAR: IDENTIFICAÇÃO DO USUÁRIO NO CANTO SUPERIOR DIREITO */
.topbar-user-badge {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.8rem;
  color: #1e293b;
}

.topbar-user-name {
  font-weight: 700;
  color: var(--primary);
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-role-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  background: #dbeafe;
  color: #1e40af;
  text-transform: uppercase;
}

/* GRÁFICOS SVG VETORIAIS NÍTIDOS (SEM IMAGENS EMBAÇADAS) */
.crisp-svg {
  shape-rendering: geometricPrecision;
  text-rendering: geometricPrecision;
}
.svg-interactive-elem {
  cursor: pointer;
  transition: opacity 0.15s ease-out, filter 0.15s ease-out, transform 0.15s ease-out;
}
.svg-interactive-elem:hover {
  filter: brightness(1.15) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3)) !important;
}
.svg-donut-slice:hover {
  transform: scale(1.04);
}


/* BOTÃO DE RECOLHER / ABRIR MENU NO RODAPÉ DA SIDEBAR */
.sidebar-footer {
  padding: 0.65rem 0.85rem;
  background: rgba(0, 0, 0, 0.18);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.sidebar-version-box {
  width: auto;
  max-width: 90%;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  font-size: 0.70rem;
  font-weight: 600;
  color: #cbd5e1;
  text-align: center;
  margin-bottom: 0.2rem;
  white-space: nowrap;
}

.sidebar.collapsed .sidebar-version-box {
  display: none !important;
}

.sidebar-toggle-btn-unified {
  width: 100%;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar-toggle-btn-unified:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* QUANDO RECOLHIDO (COLLAPSED): LARGURA 64px, SEM OVERFLOW DE TEXTO */
.sidebar.collapsed {
  width: 64px !important;
  min-width: 64px !important;
}

.sidebar.collapsed .sidebar-header {
  padding: 0.75rem 0 !important;
  justify-content: center !important;
  display: flex !important;
}

.sidebar.collapsed .sidebar-header-expanded {
  display: none !important;
}

.sidebar.collapsed .sidebar-header-collapsed {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
}

.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-section-title {
  display: none !important;
}

.sidebar.collapsed .nav-item {
  justify-content: center !important;
  padding: 0.65rem 0 !important;
}

.sidebar.collapsed .nav-icon {
  font-size: 1.35rem !important;
  margin: 0 !important;
}

.sidebar.collapsed .sidebar-footer {
  padding: 0.5rem 0.2rem !important;
  text-align: center !important;
}

.sidebar.collapsed .sidebar-toggle-btn-unified {
  padding: 0.4rem 0.15rem !important;
  font-size: 0.65rem !important;
  flex-direction: column !important;
  gap: 2px !important;
  white-space: normal !important;
  line-height: 1.1 !important;
  word-break: break-word !important;
}
/* ESTILOS ESPECÍFICOS PARA CONTROLES DO BOOK E MODAIS ANINHADOS */
#entityFormModal, #userFormModal, #instFormModal, #userProfileModal {
  z-index: 25000 !important;
}

.btn-book-period {
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  border: none;
  background: none;
  color: #64748b;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.btn-book-period:hover {
  color: var(--primary);
}

.btn-book-period.active {
  background: #ffffff !important;
  color: #0f3d59 !important;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}


/* ============================================================ */
/* BOOK DE PRESTAÇÃO DE CONTAS - FOLHAS A4 (RETRATO E PAISAGEM) */
/* ============================================================ */

#instFormModal, #entityFormModal {
  z-index: 25000 !important;
}

.book-preview-container {
  background: #f1f5f9;
  border-radius: 8px;
  padding: 2rem 1rem;
  margin-top: 1rem;
}

.book-page {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  max-width: 900px;
  min-height: 1150px;
  margin: 0 auto 3rem auto;
  padding: 2.2rem 2.8rem;
  box-sizing: border-box;
  position: relative;
  page-break-after: always;
  break-after: page;
}

/* Folhas em Orientação Paisagem (Landscape / Horizontal) */
.book-page.book-page-landscape,
.book-page.book-landscape-page,
.book-landscape-page {
  max-width: 1460px;
  width: 98%;
  min-height: 820px;
  padding: 1.4rem 2rem;
  page: page-landscape;
}

.book-page-badge {
  position: absolute;
  top: -13px;
  right: 25px;
  background: #0f3d59;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 10;
}

.book-page-badge.landscape {
  background: #0284c7;
}

.book-page-footer {
  border-top: 1px solid #e2e8f0;
  padding-top: 0.5rem;
  margin-top: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: #64748b;
}

/* Upload de Imagem e Emblemas */
.image-uploader-card {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 0.75rem;
  text-align: center;
  background: #f8fafc;
  transition: all 0.2s ease;
}

.image-uploader-card:hover {
  border-color: #0284c7;
  background: #f0f9ff;
}

.image-uploader-preview {
  height: 65px;
  max-width: 140px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  padding: 4px;
  margin-bottom: 0.4rem;
  display: inline-block;
}

/* Diretivas de Impressão A4 Retrato e Paisagem Mista */


/* RODAPÉ OFICIAL FIXO NA PARTE INFERIOR DA TELA (ALINHAMENTO CENTRALIZADO) */
.app-main-footer {
  flex-shrink: 0;
  background: #ffffff;
  border-top: 1px solid #cbd5e1;
  padding: 0.65rem 1.25rem;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  text-align: center;
  font-size: 0.76rem;
  color: #64748b;
  z-index: 100;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.03);
}

.app-main-footer .footer-center-content {
  text-align: center;
  margin: 0 auto;
  max-width: 820px;
}

.app-main-footer p {
  margin: 0;
  line-height: 1.35;
  text-align: center;
}

.app-main-footer .footer-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: #0f3d59;
  letter-spacing: 0.2px;
  text-align: center;
}

.app-main-footer .footer-sub {
  font-size: 0.75rem;
  color: #334155;
  margin-top: 2px;
  text-align: center;
}

.app-main-footer .footer-legal {
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 2px;
  text-align: center;
}

.app-main-footer .footer-right-action {
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
}

@media (max-width: 950px) {
  .app-main-footer {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
  }
  .app-main-footer .footer-right-action {
    position: static;
    transform: none;
  }
}

/* RODAPÉ FIXO NA PARTE DE BAIXO DA TELA DE LOGIN (ESTÁVEL E SEM MUDAR DE POSIÇÃO) */
.login-fixed-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: rgba(7, 30, 44, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.65rem 1.25rem;
  text-align: center;
  z-index: 9999;
  box-sizing: border-box;
}

.login-fixed-footer p {
  margin: 0;
  line-height: 1.4;
}

.login-fixed-footer .footer-title {
  color: #ffffff;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.2px;
}

.login-fixed-footer .footer-sub {
  color: #cbd5e1;
  font-size: 0.75rem;
  margin-top: 2px;
}

.login-fixed-footer .footer-legal {
  color: #94a3b8;
  font-size: 0.7rem;
  margin-top: 2px;
}

/* RODAPÉ OFICIAL FIXO NA PARTE INFERIOR DO SISTEMA (ESTÁVEL E SEM MUDAR DE POSIÇÃO) */
.app-main-footer {
  position: static;
  margin-top: 2rem;
  width: 100%;
  background: #ffffff;
  border-top: 1px solid #cbd5e1;
  padding: 0.6rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: #64748b;
  z-index: 900;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
  transition: left 0.25s ease;
}

.sidebar.collapsed ~ .main-wrapper .app-main-footer {
  left: 64px;
}

@media (max-width: 900px) {
  .app-main-footer {
    left: 0 !important;
  }
}

.sidebar.collapsed .sidebar-version-badge {
  display: none !important;
}



/* ==============================================================================
   ESTILOS OFICIAIS DE IMPRESSÃO - FORMATO TRIBUNAL DE CONTAS / MROSC
   Suporte perfeito para A4 Retrato e A4 Paisagem (100% de preenchimento de folha)
   ============================================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 8mm 8mm 8mm 8mm;
  }
  @page page-landscape {
    size: A4 landscape;
    margin: 6mm 8mm 6mm 8mm;
  }
  @page page-portrait {
    size: A4 portrait;
    margin: 8mm 8mm 8mm 8mm;
  }

  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 8pt !important;
    height: auto !important;
    width: 100% !important;
    max-width: none !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Oculta menus, barras de navegação, modais e botões de interface */
  .sidebar, .topbar, .sub-topbar-banner, .app-main-footer, .no-print, .btn, .nav-tabs, 
  .modal-overlay, #toastContainer, .sidebar-backdrop, .sidebar-footer, header, nav, 
  .alert-info, .section-header, .filters-bar, .filter-bar, .period-toggle-group, .book-page-badge,
  .mobile-only-book-view, #bookHistorySection, .mobile-view-card, .desktop-only-book-view > .no-print {
    display: none !important;
  }

  /* Remove restrições e permite 100% da largura do papel */
  .app-layout, .main-wrapper, .content-area, .book-preview-container, .official-book-paper {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    position: static !important;
  }

  /* Exibe a aba do Book Oficial no padrão de impressão */
  body:not(.print-mode-single):not(.print-mode-dossie) .tab-pane {
    display: none !important;
  }
  body:not(.print-mode-single):not(.print-mode-dossie) #tab-book {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  body:not(.print-mode-single):not(.print-mode-dossie) #tab-book > *:not(#officialBookContainer) {
    display: none !important;
  }
  #officialBookContainer {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
  }

  /* Impressão de dossiê consolidado ou tela individual */
  body.print-mode-dossie .tab-pane { display: none !important; }
  body.print-mode-dossie #dossieImpressaoCompleto { display: block !important; width: 100% !important; }
  body.print-mode-single .tab-pane { display: none !important; }
  body.print-mode-single .tab-pane.active { 
    display: block !important; 
    width: 100% !important; 
    max-width: none !important;
  }

  /* MODO PAISAGEM FORÇADO PARA TELAS LARGAS (Diário, Orçamento, Demonstrativo, etc.) */
  body.print-orientation-landscape,
  body.print-orientation-landscape .tab-pane.active {
    page: page-landscape !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 100% !important;
  }

  body.print-orientation-portrait,
  body.print-orientation-portrait .tab-pane.active {
    page: page-portrait !important;
    width: 100% !important;
    max-width: none !important;
  }

  /* Estrutura das Páginas / Folhas */
  .book-page {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: auto !important;
    height: auto !important;
    padding: 0 0 0.8rem 0 !important;
    margin: 0 !important;
    page-break-before: always !important;
    break-before: page !important;
    page-break-after: auto !important;
    break-after: auto !important;
    box-sizing: border-box !important;
  }

  .book-preview-container > .book-page:first-child,
  .book-page:first-of-type {
    page-break-before: auto !important;
    break-before: auto !important;
  }

  /* Folhas Retrato */
  .book-page:not(.book-page-landscape) {
    page: page-portrait !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Folhas Paisagem - PREENCHIMENTO COMPLETO DE 100% DA FOLHA HORIZONTAL */
  .book-page.book-page-landscape,
  .book-page.book-landscape-page,
  .book-landscape-page {
    page: page-landscape !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  /* Cabeçalho Oficial */
  .book-header-box {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
    margin-bottom: 0.4rem !important;
    padding-bottom: 0.3rem !important;
    border-bottom: 1.5px solid #0f3d59 !important;
    width: 100% !important;
  }

  /* Barra de Autenticidade do Extrato OFX e Book */
  .book-extrato-auth-bar, .dossie-auth-banner {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
    margin-bottom: 0.4rem !important;
    border: 1px solid #86efac !important;
    width: 100% !important;
  }

  /* Quadros e Conteúdos */
  .book-quadro, .dossie-module-box {
    page-break-inside: auto !important;
    break-inside: auto !important;
    margin-bottom: 0.5rem !important;
    border: 1px solid #94a3b8 !important;
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
  }

  .book-quadro-title {
    page-break-after: avoid !important;
    break-after: avoid !important;
    padding: 3px 6px !important;
    font-size: 7.8pt !important;
  }

  .book-quadro-body {
    padding: 4px 6px !important;
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
  }

  /* Gráficos e Cartões */
  .chart-card {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Tabelas Analíticas - PREENCHIMENTO TOTAL DE 100% NA PAISAGEM */
  .table-container {
    max-height: none !important;
    overflow: visible !important;
    border: none !important;
    width: 100% !important;
    max-width: none !important;
  }

  table, .data-table {
    page-break-inside: auto !important;
    break-inside: auto !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 100% !important;
    border-collapse: collapse !important;
    table-layout: auto !important;
  }

  .book-page-landscape table,
  .book-page-landscape .data-table,
  body.print-orientation-landscape table,
  body.print-orientation-landscape .data-table {
    width: 100% !important;
    max-width: none !important;
    min-width: 100% !important;
    table-layout: auto !important;
  }

  table thead, .data-table thead {
    display: table-header-group !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
  }

  table tr, .data-table tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  table th, .data-table th {
    background-color: #f1f5f9 !important;
    color: #0f3d59 !important;
    border: 1px solid #cbd5e1 !important;
    font-size: 7.2pt !important;
    padding: 4px 5px !important;
  }

  table td, .data-table td {
    border: 1px solid #cbd5e1 !important;
    font-size: 7pt !important;
    padding: 3px 5px !important;
  }

  /* SVGs e Gráficos de Paisagem ocupando 100% do espaço */
  .book-page-landscape svg,
  body.print-orientation-landscape svg {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }

  .book-page-landscape div[style*="grid-template-columns"],
  body.print-orientation-landscape div[style*="grid-template-columns"] {
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
  }
}

/* ==============================================================================
   REGRAS EXCLUSIVAS DE TELA (NÃO AFETAM IMPRESSÃO)
   ============================================================================== */
@media screen {
/* ==============================================================================
   TRAVA ABSOLUTA DE ROLAGEM HORIZONTAL E RESPONSIVIDADE MOBILE V2.5
   ============================================================================== */
html, body {
  width: 100% !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
  position: relative !important;
  -webkit-text-size-adjust: 100%;
}

.app-layout {
  width: 100% !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
  position: relative !important;
}

.main-wrapper {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  position: relative !important;
}

.content-area {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
  padding: 0.85rem 1rem 1.5rem 1rem !important;
}

/* RODAPÉ DO SISTEMA NO FLUXO NORMAL (NÃO-FIXADO) */
.app-main-footer {
  position: static !important;
  width: 100% !important;
  box-sizing: border-box !important;
  margin-top: 2rem !important;
  padding: 1.15rem 1rem !important;
  background: #ffffff !important;
  border-top: 1px solid #cbd5e1 !important;
  text-align: center !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  box-shadow: none !important;
}

.sidebar.collapsed ~ .main-wrapper .app-main-footer {
  left: auto !important;
}

@media (max-width: 900px) {
  .app-main-footer {
    padding: 0.85rem 0.6rem !important;
    margin-top: 1.25rem !important;
    left: auto !important;
  }
  .app-main-footer .footer-legal {
    display: none !important;
  }
  .app-main-footer .footer-title {
    font-size: 0.80rem !important;
  }
  .app-main-footer .footer-sub {
    font-size: 0.72rem !important;
    margin-top: 2px !important;
  }

  /* Exibição condicional de telas operadas no computador */
  .mobile-only-import-notice {
    display: block !important;
  }
  .desktop-only-import-content {
    display: none !important;
  }

  .mobile-only-book-view {
    display: block !important;
  }
  .desktop-only-book-view {
    display: none !important;
  }

  .mobile-only-cronograma {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.65rem !important;
  }
  .desktop-only-cronograma {
    display: none !important;
  }

  .mobile-only-provisoes {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.65rem !important;
  }
  .desktop-only-provisoes {
    display: none !important;
  }

  .card, .table-container, .filters-bar, .metric-card, .chart-card {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

@media (min-width: 901px) {
  .mobile-only-import-notice,
  .mobile-only-book-view,
  .mobile-only-cronograma,
  .mobile-only-provisoes {
    display: none !important;
  }
  .desktop-only-import-content,
  .desktop-only-book-view,
  .desktop-only-cronograma,
  .desktop-only-provisoes {
    display: block !important;
  }
}

/* STICKY FOOTER REAL E CONTROLE DE ALTURA DE CONTEÚDO */
.content-area {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  padding: 0.85rem 1rem 0 1rem !important;
}

.tab-pane.active {
  display: block !important;
  flex: 1 0 auto !important;
}

.app-main-footer {
  margin-top: auto !important;
  flex-shrink: 0 !important;
  position: static !important;
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 1.15rem 1rem !important;
  background: #ffffff !important;
  border-top: 1px solid #cbd5e1 !important;
  text-align: center !important;
  box-shadow: none !important;
}

/* MODAL DE CENTRALIZAÇÃO AMPLO */
#adminModal .modal-card {
  max-width: 1150px !important;
  width: 95vw !important;
}

.sidebar.collapsed .sidebar-security-badge {
  display: none !important;
}

@media (max-width: 900px) {
  #adminModal .modal-card {
    max-width: 100vw !important;
    width: 100% !important;
    margin: 0 !important;
    border-radius: 8px !important;
  }

  .desktop-only-admin-insts, .desktop-only-admin-users {
    display: none !important;
  }
  .mobile-only-admin-insts, .mobile-only-admin-users {
    display: block !important;
  }

  .app-main-footer {
    padding: 0.85rem 0.5rem !important;
    margin-top: auto !important;
  }
}

@media (min-width: 901px) {
  .desktop-only-admin-insts, .desktop-only-admin-users {
    display: block !important;
  }
  .mobile-only-admin-insts, .mobile-only-admin-users {
    display: none !important;
  }
}

.footer-security-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 0.35rem;
  font-size: 0.74rem;
  color: #64748b;
  flex-wrap: wrap;
}

}


/* ==============================================================================
   ESTILOS VISUAIS: CENTRAL DE AJUDA & MANUAL DO USUÁRIO
   ============================================================================== */
.btn-manual-chapter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-manual-chapter:hover {
  background: #e2e8f0;
  color: #0f3d59;
}
.btn-manual-chapter.active {
  background: #e0f2fe;
  color: #0284c7;
  font-weight: 800;
  border-color: #bae6fd;
}
.manual-section {
  margin-bottom: 2rem;
  scroll-margin-top: 1rem;
}
.manual-header-badge {
  display: inline-block;
  background: #0284c7;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.manual-section-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f3d59;
}
.manual-lead {
  font-size: 0.88rem;
  color: #475569;
  line-height: 1.5;
  margin-bottom: 1rem;
}
.manual-card-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  font-size: 0.84rem;
  color: #334155;
  line-height: 1.6;
}
.manual-card-box h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
  color: #0f3d59;
}
.manual-alert-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 0.85rem 1.15rem;
  margin-bottom: 1rem;
  font-size: 0.84rem;
  color: #1e40af;
  line-height: 1.5;
}
.manual-alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 0.85rem 1.15rem;
  margin-bottom: 1rem;
  font-size: 0.84rem;
  color: #166534;
  line-height: 1.5;
}
.manual-divider {
  border: 0;
  border-top: 1.5px dashed #cbd5e1;
  margin: 2rem 0;
}
.manual-step-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.manual-step-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.84rem;
  color: #334155;
  line-height: 1.5;
}
.step-num {
  background: #0284c7;
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  flex-shrink: 0;
}
.critical-faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.critical-faq-item {
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}
.faq-question {
  background: #f8fafc;
  padding: 0.75rem 1rem;
  font-size: 0.86rem;
  font-weight: 700;
  color: #0f3d59;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s ease;
}
.faq-question:hover {
  background: #f1f5f9;
}
.faq-arrow {
  color: #64748b;
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}
.critical-faq-item.open .faq-arrow {
  transform: rotate(180deg);
}
.faq-answer {
  display: none;
  padding: 0.9rem 1.15rem;
  font-size: 0.84rem;
  color: #334155;
  line-height: 1.6;
  border-top: 1px solid #e2e8f0;
  background: #ffffff;
}
.critical-faq-item.open .faq-answer {
  display: block;
}

/* ==============================================================================
   ESTILOS DEDICADOS E RESPONSIVIDADE: CENTRAL DE AJUDA & MANUAL OPERACIONAL
   ============================================================================== */
#systemManualModal {
  z-index: 33000 !important;
}

#systemManualModal.active {
  display: flex !important;
}

#systemManualModal .modal-card {
  width: 95vw !important;
  max-width: 1240px !important;
  height: 88vh !important;
  max-height: 88vh !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 0 !important;
  border-radius: 12px !important;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.45) !important;
  overflow: hidden !important;
  border: 1px solid #cbd5e1 !important;
}

#manualContentPane {
  flex: 1 !important;
  overflow-y: auto !important;
  padding: 1.5rem 2rem !important;
  background: #ffffff !important;
  scroll-behavior: smooth !important;
}

.manual-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff !important;
  font-weight: 700;
  font-size: 0.76rem;
  padding: 4px 10px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.manual-action-btn:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}

@media (max-width: 900px) {
  #systemManualModal .modal-card {
    width: 98vw !important;
    height: 94vh !important;
    max-height: 94vh !important;
  }
}
