@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital@1&display=swap');

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f4f6fb;
  color: #222;
}

/* ── Topbar ── */
.topbar {
  background: #0b3f7d;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
  height: 56px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}

.brand-logo {
  height: 38px;
  width: auto;
}

.brand-slogan {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 0.95rem;
  color: rgba(255,255,255,0.9);
  letter-spacing: 0.5px;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-links a {
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.topbar-end {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Avatar */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5bcfa5, #2e7d32);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.avatar-lg {
  width: 44px;
  height: 44px;
  font-size: 1rem;
}

/* User pill (desktop) */
.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.15s;
}

.user-pill:hover {
  background: rgba(255,255,255,0.1);
}

.user-name {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
}

/* User dropdown */
.user-dropdown {
  display: none;
  position: fixed;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  min-width: 180px;
  padding: 6px;
  z-index: 60;
}

.user-dropdown.open {
  display: block;
}

.user-dropdown a {
  display: block;
  padding: 10px 14px;
  color: #333;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.9rem;
}

.user-dropdown a:hover {
  background: #f0f4fb;
}

.user-dropdown hr {
  border: none;
  border-top: 1px solid #e7ecf4;
  margin: 4px 8px;
}

.text-danger {
  color: #c62828 !important;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile overlay & drawer */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 70;
}

.mobile-overlay.open {
  display: block;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  right: -280px;
  width: 280px;
  height: 100%;
  background: #fff;
  z-index: 80;
  transition: right 0.25s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.mobile-drawer.open {
  right: 0;
}

.drawer-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  background: #0b3f7d;
  color: #fff;
}

.drawer-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.drawer-email {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.7);
  margin-top: 2px;
}

.mobile-drawer > a {
  display: block;
  padding: 14px 20px;
  color: #333;
  text-decoration: none;
  font-size: 0.95rem;
  border-bottom: 1px solid #f0f2f5;
}

.mobile-drawer > a:hover,
.mobile-drawer > a.active {
  background: #f0f4fb;
  color: #0b3f7d;
}

.mobile-drawer > hr {
  border: none;
  border-top: 1px solid #e7ecf4;
  margin: 0;
}

.container {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px;
}

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

.card, .panel {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,.06);
  padding: 20px;
}

.card h2, .panel h2 {
  margin-top: 0;
}

.card p {
  font-size: 2rem;
  margin: 16px 0 0;
}

.card.card-total {
  border-left: 5px solid #0b3f7d;
}

.card.card-quitado {
  border-left: 5px solid #2e7d32;
  background: linear-gradient(135deg, #f1f8f1, #fff);
}

.card.card-quitado p {
  color: #2e7d32;
}

.card.card-aberto {
  border-left: 5px solid #c62828;
  background: linear-gradient(135deg, #fef1f1, #fff);
}

.card.card-aberto p {
  color: #c62828;
}

.vencimentos-lista {
  list-style: none;
  padding: 0;
  margin: 0;
}

.vencimentos-lista li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #e7ecf4;
}

.vencimentos-lista li:last-child {
  border-bottom: none;
}

.venc-conta {
  font-weight: 600;
}

.venc-data {
  color: #555;
  font-size: 0.9rem;
}

.venc-valor {
  font-weight: 600;
  color: #0b3f7d;
}

.venc-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.venc-badge.vencido {
  background: #ffebee;
  color: #c62828;
}

.venc-badge.hoje {
  background: #fff3e0;
  color: #e65100;
}

.venc-badge.proximo {
  background: #e8f5e9;
  color: #2e7d32;
}

.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}

.chart-container {
  position: relative;
  height: 280px;
}

@media (max-width: 768px) {
  .chart-row {
    grid-template-columns: 1fr;
  }
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.inline-fields, .field-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

label {
  display: flex;
  flex-direction: column;
  font-size: 0.95rem;
}

input, select, button, textarea {
  font: inherit;
}

input, select, textarea {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid #ccd1dc;
  border-radius: 8px;
  min-width: 220px;
}

button {
  border: none;
  background: #0b3f7d;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  cursor: pointer;
}

button.secondary {
  background: #6f7f94;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: #f0f4fb;
}

th, td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid #e7ecf4;
}

tr:hover {
  background: #f8f9fc;
}

.helper {
  color: #3a3a3a;
  margin: 10px 0 0;
}

.actions {
  margin-top: 16px;
  display: flex;
  gap: 12px;
}

.badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e8f5e9;
  color: #256029;
  font-weight: 600;
}

.alert {
  border-left: 4px solid #f1c40f;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: #fff8e5;
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 100;
  justify-content: center;
  align-items: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  padding: 32px;
  width: 100%;
  max-width: 460px;
}

.modal h2 {
  margin-top: 0;
  color: #0b3f7d;
}

.modal .field {
  margin-bottom: 16px;
}

.modal .field label {
  font-weight: 600;
  margin-bottom: 4px;
}

.modal .field input,
.modal .field select {
  width: 100%;
  box-sizing: border-box;
}

.modal .actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.status-aberto {
  color: #c62828;
  font-weight: 600;
}

.status-quitado {
  color: #2e7d32;
  font-weight: 600;
}

td .valor-input {
  min-width: 100px;
  width: 110px;
  padding: 6px 8px;
  text-align: right;
}

td button {
  padding: 6px 12px;
  font-size: 0.85rem;
  margin-right: 4px;
}

td button.quitar {
  background: #2e7d32;
}

td button.editar-valor {
  background: #f57c00;
}

td button.reabrir {
  background: #0b3f7d;
}

td button.excluir {
  background: #c62828;
}

/* Item cards (mobile responsive) */
.cards-mobile {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.item-card {
  background: #fff;
  border: 1px solid #e7ecf4;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.item-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.item-card-title {
  font-weight: 600;
  font-size: 1rem;
  color: #0b3f7d;
}

.item-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.item-card-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}

.item-card-label {
  color: #888;
}

.item-card-valor {
  font-weight: 600;
  color: #0b3f7d;
}

.item-card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.item-card-actions button {
  padding: 8px 14px;
  font-size: 0.85rem;
}

.item-card-actions button.quitar {
  background: #2e7d32;
}

.item-card-actions button.editar-valor {
  background: #f57c00;
}

.item-card-actions button.reabrir {
  background: #0b3f7d;
}

.item-card-actions button.editar {
  background: #0b3f7d;
}

.item-card-actions button.status {
  background: #6f7f94;
}

.item-card-actions button.excluir {
  background: #c62828;
}

/* Hero logo (dashboard / login) */
.hero-logo-section {
  text-align: center;
  margin-bottom: 24px;
}

.hero-logo {
  height: 240px;
  width: auto;
  max-width: 100%;
}

@media (max-width: 768px) {
  .hero-logo {
    height: 80px;
  }
  .brand-slogan {
    display: none;
  }
  .table-desktop {
    display: none;
  }
  .cards-mobile {
    display: flex;
  }
  .nav-links,
  .user-pill {
    display: none;
  }
  .hamburger {
    display: flex;
  }
  .panel-header, .inline-fields, .field-row {
    flex-direction: column;
    align-items: stretch;
  }
  .modal {
    margin: 16px;
  }
}

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.toggle .slider {
  position: absolute;
  inset: 0;
  background: #ccd1dc;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle .slider::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle input:checked + .slider {
  background: #2e7d32;
}

.toggle input:checked + .slider::before {
  transform: translateX(20px);
}

.toggle-blue input:checked + .slider {
  background: #0b3f7d;
}

/* Dropzone (file upload) */
.dropzone {
  border: 2px dashed #ccd1dc;
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-top: 8px;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: #0b3f7d;
  background: #f0f4fb;
}

.dropzone-icon {
  margin-bottom: 8px;
}

.dropzone-text {
  margin: 0;
  font-size: 0.95rem;
  color: #555;
}

.dropzone-link {
  color: #0b3f7d;
  font-weight: 600;
  text-decoration: underline;
}

.dropzone-hint {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: #999;
}

.dropzone.has-file {
  border-style: solid;
  border-color: #2e7d32;
  background: #f1f8f1;
}

.dropzone.has-file .dropzone-icon,
.dropzone.has-file .dropzone-text,
.dropzone.has-file .dropzone-hint {
  display: none;
}

.dropzone-file {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.dropzone-filename {
  font-weight: 600;
  color: #2e7d32;
  font-size: 0.95rem;
  word-break: break-all;
}

.dropzone-remove {
  background: #c62828;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 24px;
}

/* Spinner (loading) */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

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