* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  min-height: 100vh;
  color: #fff;
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: #fff;
}

.subtitle {
  color: #8892b0;
  font-size: 1.1rem;
}

/* Navigation */
.nav {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

.nav a {
  color: #8892b0;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.nav a:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.nav a.active {
  background: rgba(78, 205, 196, 0.2);
  color: #4ecdc4;
}

.nav .btn-add {
  margin-left: auto;
}

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.card-label {
  font-size: 0.9rem;
  color: #8892b0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.card-value {
  font-size: 2rem;
  font-weight: 700;
}

.card-count, .card-status {
  font-size: 0.85rem;
  color: #8892b0;
}

.card.credito {
  border-left: 4px solid #00d26a;
}

.card.credito .card-value {
  color: #00d26a;
}

.card.debito {
  border-left: 4px solid #ff6b6b;
}

.card.debito .card-value {
  color: #ff6b6b;
}

.card.saldo {
  border-left: 4px solid #4ecdc4;
}

.card.saldo .card-value {
  color: #4ecdc4;
}

.card.saldo.negativo .card-value {
  color: #ff6b6b;
}

.card.saldo.positivo .card-value {
  color: #00d26a;
}

/* Toolbar - 3 filtros alinhados */
.toolbar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.toolbar select {
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: #fff !important;
  font-size: 0.9rem;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.7rem top 50%;
  background-size: 1rem auto;
  padding-right: 2.5rem;
}

.toolbar select option {
  background: #16213e;
  color: #fff;
}

.toolbar select:focus {
  outline: none;
  border-color: #4ecdc4;
}

.btn-add {
  background: linear-gradient(135deg, #00d26a 0%, #00b359 100%);
  color: #fff !important;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-add:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 210, 106, 0.3);
}

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

/* Table */
.table-container {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

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

th, td {
  padding: 1rem;
  text-align: left;
  color: #fff;
}

th {
  background: rgba(0, 0, 0, 0.3);
  font-weight: 600;
  color: #8892b0;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 1px;
}

tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.2s;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

tbody tr:last-child {
  border-bottom: none;
}

td {
  font-size: 0.95rem;
  color: #e6e6e6;
}

td.loading {
  text-align: center;
  padding: 3rem;
  color: #8892b0;
}

.tipo-credito {
  color: #00d26a;
  font-weight: 600;
}

.tipo-debito {
  color: #ff6b6b;
  font-weight: 600;
}

.valor-credito {
  color: #00d26a;
  font-weight: 600;
}

.valor-debito {
  color: #ff6b6b;
  font-weight: 600;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform 0.3s;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
  font-size: 1.3rem;
  color: #fff;
}

.modal-close {
  background: none;
  border: none;
  color: #8892b0;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

#form-lancamento {
  padding: 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #8892b0;
  font-size: 0.9rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: #fff !important;
  font-size: 1rem;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.form-group input[type="date"] {
  color-scheme: dark;
}

.form-group select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.7rem top 50%;
  background-size: 1rem auto;
  padding-right: 2.5rem;
}

.form-group select option {
  background: #16213e;
  color: #fff;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #4ecdc4;
}

.form-group input::placeholder {
  color: #5a6380;
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.btn-delete {
  background: linear-gradient(135deg, #ff4757 0%, #c0392b 100%);
  color: #fff !important;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-right: auto;
}

.btn-delete:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255, 71, 87, 0.3);
}

.btn-cancel {
  background: rgba(255, 255, 255, 0.1);
  color: #8892b0 !important;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cancel:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff !important;
}

.btn-submit {
  background: linear-gradient(135deg, #00d26a 0%, #00b359 100%);
  color: #fff !important;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 210, 106, 0.3);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Footer */
footer {
  margin-top: 2rem;
  text-align: center;
  color: #8892b0;
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  header {
    margin-bottom: 1rem;
  }

  header h1 {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.9rem;
  }

  .nav {
    flex-wrap: wrap;
  }

  .nav .btn-add {
    margin-left: 0;
    width: 100%;
    order: 3;
  }

  /* Painel compacto no mobile */
  .cards {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
  }

  .card {
    flex: 1;
    border-radius: 0;
    border: none;
    border-left: none;
    padding: 0.75rem 0.5rem;
    text-align: center;
    background: transparent;
  }

  .card:not(:last-child) {
    border-right: 1px solid rgba(255, 255, 255, 0.1);
  }

  .card.credito,
  .card.debito,
  .card.saldo {
    border-left: none;
  }

  .card-label {
    font-size: 0.65rem;
    letter-spacing: 0.5px;
  }

  .card-value {
    font-size: 1rem;
    font-weight: 600;
  }

  .card-count, .card-status {
    font-size: 0.7rem;
  }

  .toolbar {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
  }

  .toolbar select {
    padding: 0.5rem 0.5rem;
    font-size: 0.8rem;
  }

  th, td {
    padding: 0.75rem 0.5rem;
    font-size: 0.85rem;
  }

  .table-container {
    overflow-x: auto;
  }

  table {
    min-width: 600px;
  }

  .modal {
    width: 95%;
    margin: 1rem;
  }

  .form-actions {
    flex-direction: column;
  }

  .btn-cancel, .btn-submit {
    width: 100%;
  }
}

/* Ocultar coluna tipo */
.hidden {
  display: none !important;
}

/* Linha clicável */
.row-clickable {
  cursor: pointer !important;
}

.row-clickable:hover {
  background: rgba(255, 255, 255, 0.1) !important;
}