:root {
  --pm-blue: #0d6efd;
  --pm-red: #dc3545;
  --pm-dark: #212529;
  --pm-yellow: #ffc107;
}

/* Global layout safety for mobile */
*, *::before, *::after { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
img { max-width: 100%; height: auto; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background-color: #f8f9fa;
  line-height: 1.6;
}

.text-gradient {
  background: linear-gradient(to right, var(--pm-blue), #20c997);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Subtítulo do cabeçalho */
.app-subtitle {
  font-size: 0.95rem;
  color: #6c757d;
  letter-spacing: 0.3px;
  line-height: 1.2;
  margin-top: 2px;
}

.img-topo {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--pm-blue);
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.card {
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  border: none;
  margin-bottom: 1.5rem;
}

.card-header {
  font-weight: 600;
  font-size: 1.1rem;
  border-radius: 10px 10px 0 0 !important;
  padding: 1rem 1.25rem;
}

.btn-primary {
  background-color: var(--pm-blue);
  border: none;
  font-weight: 500;
  letter-spacing: 0.5px;
  padding: 0.5rem 1rem;
}

.btn-primary:hover {
  background-color: #0b5ed7;
}

.form-check-input {
  width: 1.2em;
  height: 1.2em;
  margin-top: 0.1em;
  border: 2px solid var(--pm-blue);
  cursor: pointer;
}

.form-check-input:checked {
  background-color: var(--pm-blue);
  border-color: var(--pm-blue);
}

.form-check-label {
  margin-left: 0.5em;
  font-weight: 500;
  cursor: pointer;
}

#pensao-container {
  background-color: #f8f9fa;
  padding: 1rem;
  border-radius: 8px;
  margin-top: 0.5rem;
  border: 1px solid #dee2e6;
  transition: all 0.3s ease;
}

#resultado-container {
  animation: fadeIn 0.3s ease-in;
  background-color: white !important;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.list-group-item {
  transition: all 0.3s ease;
  border-radius: 8px !important;
  margin-bottom: 0.5rem;
  padding: 1rem;
  border: 1px solid rgba(0,0,0,0.1);
  position: relative;
}

.list-group-item:hover {
  transform: translateX(3px);
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

.badge {
  font-weight: 500;
  padding: 0.5em 0.75em;
  margin-right: 0.5em;
}

@media print {
  body * {
    visibility: hidden;
  }
  #resultado-container, #resultado-container *,
  #historico-lista, #historico-lista * {
    visibility: visible;
  }
  #resultado-container {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
  }
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table th, .table td {
  padding: 0.75rem;
  border: 1px solid #dee2e6;
}

.table th {
  background-color: #f1f5f9;
  font-weight: 600;
}

.alert-info {
  background-color: #e7f5ff;
  border-color: #d0ebff;
}

#total-acumulado {
  border-radius: 8px;
  font-weight: 600;
  text-align: right;
  margin-top: 1rem;
  padding: 0.75rem 1.25rem;
}

#total-perdido-pensao {
  border-radius: 8px;
  font-weight: 600;
  text-align: right;
  padding: 0.75rem 1.25rem;
}

@media (max-width: 768px) {
  .card-body {
    padding: 1rem;
  }
  
  .table {
    font-size: 0.9rem;
  }
  
  .img-topo {
    width: 80px;
    height: 80px;
  }
  
  .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
  }
}

/* Pequenas otimizações para telas muito pequenas */
@media (max-width: 576px) {
  /* Cabeçalho: permitir quebra e compactar ações */
  .header-bar { row-gap: .5rem; }
  .header-actions .btn .btn-text { display: none; }
  .header-actions .btn { padding: 0.375rem 0.5rem; }

  /* Rodapé: botões largura total para melhor toque */
  .footer-btn { width: 100%; }

  /* Totais centralizados para leitura agradável */
  #total-acumulado,
  #total-perdido-pensao { text-align: center; }

  /* Evita auto-zoom em iOS quando focar inputs */
  input, select, textarea { font-size: 16px; }
}

/* Novas classes para conflitos */
.conflict-warning {
  background-color: #fff8f8;
  border-left: 4px solid #dc3545;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border-radius: 4px;
}

.conflict-item {
  padding: 0.5rem;
  margin-bottom: 0.25rem;
  background-color: #fef2f2;
  border-radius: 4px;
  font-size: 0.9rem;
}

/* Área de ações nos itens do histórico */
.list-group-item .btn-group {
  display: inline-flex;
  gap: 6px;
}

.btn-remover-item,
.btn-editar-item {
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
}

/* Valor original com pensão */
.valor-original {
  font-size: 0.85rem;
  color: #6c757d;
  text-decoration: line-through;
  margin-right: 5px;
}

/* Valor líquido */
.valor-liquido {
  font-weight: bold;
  color: #198754;
}

/* Estilo para anotações */
#resumo-anotacoes {
  background-color: #f9fafb;
  border-left: 3px solid var(--pm-blue);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  font-style: italic;
}

.list-group-item .mt-1.text-muted {
  background-color: #f9fafb;
  border-left: 3px solid #e2e6ea;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-style: italic;
}

/* Modal de conflito */
/* SweetAlert2 custom theme */
.swal2-popup { border-radius: 14px; }
.swal2-title { color: var(--pm-blue); font-weight: 600; }
.swal2-confirm { background-color: var(--pm-blue) !important; border-color: var(--pm-blue) !important; color: #fff !important; }
.swal2-cancel { background-color: #6c757d !important; border-color: #6c757d !important; color: #fff !important; }
.swal2-styled:focus { box-shadow: 0 0 0 0.25rem rgba(13,110,253,.25) !important; }

/* FullCalendar responsiveness and event text control */
#historico-calendario { width: 100%; }
#historico-calendario .fc { font-size: 0.9rem; }
#historico-calendario .fc-toolbar { flex-wrap: wrap; gap: 8px; }
#historico-calendario .fc-toolbar-title { font-size: 1rem; }

/* Avoid text overflow on events */
#historico-calendario .fc-daygrid-event .fc-event-title { 
  white-space: nowrap; 
  overflow: hidden; 
  text-overflow: ellipsis; 
}
#historico-calendario .fc-timegrid-event .fc-event-main { 
  white-space: nowrap; 
  overflow: hidden; 
  text-overflow: ellipsis; 
}

/* Remove painting: show plain text for events */
#historico-calendario .fc-event, 
#historico-calendario .fc-daygrid-event, 
#historico-calendario .fc-timegrid-event { 
  background-color: transparent !important; 
  border-color: transparent !important; 
  color: #212529 !important; 
}

/* Chip de evento dentro da célula do dia */
#historico-calendario .ve-event-chip {
  display: block;
  width: 100%;
  padding: 2px 6px;
  border: 1px solid transparent; /* texto sem borda por padrão */
  border-radius: 6px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.85rem;
}

/* Borda no quadrado do dia quando houver evento */
#historico-calendario .fc-daygrid-day.ve-day-has-event-today {
  box-shadow: inset 0 0 0 2px #0d6efd;
  border-radius: 8px;
}
#historico-calendario .fc-daygrid-day.ve-day-has-event-future {
  box-shadow: inset 0 0 0 2px #dc3545;
  border-radius: 8px;
}

@media (max-width: 576px) {
  #historico-calendario .fc-toolbar { flex-direction: column; align-items: flex-start; }
  #historico-calendario .fc-toolbar-title { margin-top: 4px; }
}

/* Highlight for current day (Today) */
#historico-calendario .fc-day-today { 
  background-color: rgba(13, 110, 253, 0.10) !important; 
  outline: 2px solid #0d6efd; 
  outline-offset: -2px; 
}
.modal-conflict {
  display: none;
  position: fixed;
  z-index: 1050;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.4);
}

.modal-conflict-content {
  background-color: #fefefe;
  margin: 10% auto;
  padding: 20px;
  border: 1px solid #888;
  width: 80%;
  max-width: 500px;
  border-radius: 8px;
  animation: fadeIn 0.3s;
}

.conflict-option {
  margin: 10px 0;
  padding: 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.conflict-option:hover {
  background-color: #f1f1f1;
}

.conflict-option-danger {
  background-color: #f8d7da;
  color: #721c24;
}

.conflict-option-warning {
  background-color: #fff3cd;
  color: #856404;
}

.conflict-option-primary {
  background-color: #d1ecf1;
  color: #0c5460;
}
.btn {
  border-radius: 6px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.btn-outline-danger {
  border-color: var(--pm-red);
  color: var(--pm-red);
}
.btn-outline-danger:hover {
  background-color: var(--pm-red);
  color: #fff;
}

.btn-outline-secondary {
  border-color: #6c757d;
  color: #6c757d;
}
.btn-outline-secondary:hover {
  background-color: #6c757d;
  color: #fff;
}

.btn-outline-success {
  border-color: #198754;
  color: #198754;
}
.btn-outline-success:hover {
  background-color: #198754;
  color: #fff;
}
/* Exibir eventos específicos por visualização */
#historico-calendario .fc-daygrid .ve-week-only { display: none !important; }
#historico-calendario .fc-timegrid .ve-month-only { display: none !important; }

/* Tooltip custom (Bootstrap) para calendário do Histórico */
.tooltip.ve-tooltip-bs .tooltip-inner {
  background: #111827; /* slate-900 */
  color: #f8fafc; /* near-white */
  border-radius: 10px;
  padding: 10px 12px;
  max-width: 280px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
  text-align: left;
}
.tooltip.ve-tooltip-bs .tooltip-arrow::before {
  border-top-color: #111827 !important;
}
.ve-tip-wrapper { display: grid; gap: 8px; }
.ve-tip-item { border-bottom: 1px dashed rgba(255,255,255,0.15); padding-bottom: 6px; }
.ve-tip-item:last-child { border-bottom: none; padding-bottom: 0; }
.ve-tip-periodo { font-weight: 600; }
.ve-tip-meta { font-size: 0.9em; opacity: 0.9; }
.ve-tip-notas { font-size: 0.9em; margin-top: 2px; }

/* Legenda de uso (desktop vs mobile) */
.hist-legend-hover, .hist-legend-tap { display: none; }
@media (hover: hover) { .hist-legend-hover { display: inline; } }
@media (hover: none) { .hist-legend-tap { display: inline; } }

/* Espaçamento da legenda no bloco Calendário */
.hist-legend-bar { gap: 8px; }
.hist-legend { margin-left: 6px; }
@media (max-width: 576px) {
  .hist-legend-bar { flex-wrap: wrap; }
  .hist-legend { margin-left: 0; margin-top: 6px; width: 100%; }
} 
 / *   M o d a l   P I X   C a f e   * /  
 # p i x C a f e M o d a l   . m o d a l - c o n t e n t   {   b o r d e r - r a d i u s :   1 5 p x ;   o v e r f l o w :   h i d d e n ;   }  
 # p i x C a f e M o d a l   . m o d a l - h e a d e r   {   b o r d e r - b o t t o m :   n o n e ;   p a d d i n g :   1 . 5 r e m ;   }  
 # p i x C a f e M o d a l   . m o d a l - b o d y   {   p a d d i n g :   1 . 5 r e m ;   }  
 # p i x - c o d e   {   b a c k g r o u n d - c o l o r :   # f 8 f 9 f a ;   b o r d e r :   2 p x   d a s h e d   # f f c 1 0 7 ;   b o r d e r - r a d i u s :   8 p x ;   f o n t - s i z e :   0 . 7 5 r e m ;   l i n e - h e i g h t :   1 . 4 ;   p a d d i n g :   0 . 7 5 r e m ;   t r a n s i t i o n :   a l l   0 . 3 s   e a s e ;   }  
 # p i x - c o d e : h o v e r   {   b a c k g r o u n d - c o l o r :   # f f f ;   b o r d e r - c o l o r :   # f f 9 8 0 0 ;   b o x - s h a d o w :   0   2 p x   8 p x   r g b a ( 2 5 5 ,   1 5 2 ,   0 ,   0 . 2 ) ;   }  
 # b t n - c o p y - p i x   {   t r a n s i t i o n :   a l l   0 . 3 s   e a s e ;   }  
 # b t n - c o p y - p i x : h o v e r   {   t r a n s f o r m :   t r a n s l a t e Y ( - 2 p x ) ;   b o x - s h a d o w :   0   4 p x   1 2 p x   r g b a ( 2 5 5 ,   1 9 3 ,   7 ,   0 . 4 ) ;   }  
 . f o o t e r - b t n   {   t r a n s i t i o n :   a l l   0 . 3 s   e a s e ;   }  
 . f o o t e r - b t n : h o v e r   {   t r a n s f o r m :   t r a n s l a t e Y ( - 2 p x ) ;   b o x - s h a d o w :   0   4 p x   1 2 p x   r g b a ( 0 ,   0 ,   0 ,   0 . 1 5 ) ;   }  
 