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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
}

.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%);
  z-index: 2000;
}

.login-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  width: 100%;
  max-width: 360px;
  padding: 32px;
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: #dbeafe;
  color: #2563eb;
  border-radius: 16px;
  margin-bottom: 16px;
}

.login-header h1 {
  font-size: 1.4rem;
  color: #1f2937;
  margin: 0;
}

.login-header p {
  color: #9ca3af;
  font-size: 0.85rem;
  margin-top: 4px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-form input {
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-form input:focus {
  border-color: transparent;
  box-shadow: 0 0 0 2px #60a5fa;
}

.login-error {
  font-size: 0.85rem;
  color: #ef4444;
  text-align: center;
  min-height: 0;
}

.login-error.success {
  color: #16a34a;
}

.login-form button,
#login-submit {
  padding: 12px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s;
}

.login-form button:hover:not(:disabled) {
  background: #1d4ed8;
}

.login-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 8px;
}

.topbar h1 {
  text-align: left;
  margin-bottom: 0;
}

.topbar-actions {
  display: flex;
  gap: 6px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #16213e;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-icon:hover {
  background: #16213e;
  color: #fff;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1500;
  padding: 16px;
}

.modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 360px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}

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

.modal form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal input {
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-size: 0.95rem;
  outline: none;
}

.modal input:focus {
  border-color: transparent;
  box-shadow: 0 0 0 2px #60a5fa;
}

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

.modal-actions button[type="submit"] {
  background: #2563eb;
  color: #fff;
}

.modal-actions button[type="submit"]:hover {
  background: #1d4ed8;
}

.badge-origem {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #27ae60;
  background: #ecfdf5;
  border-radius: 6px;
}

.filtros-preset {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.btn-preset {
  padding: 8px 14px;
  background: #16213e;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-preset:hover {
  background: #0f3460;
}

.btn-preset[data-preset="tudo"] {
  background: #27ae60;
}

.btn-preset[data-preset="tudo"]:hover {
  background: #1f8a4c;
}

.filtros-intervalo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}

.filtros-intervalo label {
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.filtros-intervalo input[type="date"] {
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
}

#btn-intervalo {
  background: #2563eb;
  color: #fff;
  border: none;
}

#btn-intervalo:hover {
  background: #1d4ed8;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px;
}

h1 {
  text-align: center;
  margin-bottom: 20px;
  font-size: 1.6rem;
  color: #16213e;
}

.badge {
  font-size: 0.7rem;
  background: #0f3460;
  color: #fff;
  padding: 3px 8px;
  border-radius: 12px;
  vertical-align: middle;
}

h2 {
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: #16213e;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.date-picker {
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.moeda-toggle {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #ddd;
  flex-shrink: 0;
}

.btn-moeda {
  padding: 8px 14px;
  border: none;
  border-radius: 0;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  background: #f0f2f5;
  color: #666;
  transition: background 0.2s, color 0.2s;
}

.btn-moeda.active {
  background: #0f3460;
  color: #fff;
}

.btn-moeda:hover:not(.active) {
  background: #e2e8f0;
  color: #333;
}

.date-picker label {
  font-weight: 600;
  font-size: 0.95rem;
}

.date-picker input[type="date"] {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  flex: 1;
}

.form-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.form-row input {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
}

.form-row input[type="text"] {
  flex: 2;
  min-width: 120px;
}

.form-row input[type="number"] {
  flex: 1;
  min-width: 100px;
}

button {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

#btn-submit {
  background: #0f3460;
  color: #fff;
}

#btn-submit:hover {
  background: #16213e;
}

.btn-cancel {
  background: #e2e8f0;
  color: #333;
}

.btn-cancel:hover {
  background: #cbd5e1;
}

.despesa-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

.despesa-item:last-child {
  border-bottom: none;
}

.despesa-info {
  flex: 1;
}

.despesa-nome {
  font-weight: 600;
  font-size: 0.95rem;
}

.despesa-valor {
  font-size: 0.85rem;
  color: #555;
  margin-top: 2px;
}

.despesa-actions {
  display: flex;
  gap: 6px;
}

.btn-edit, .btn-delete {
  padding: 6px 10px;
  font-size: 0.8rem;
  border-radius: 6px;
}

.btn-edit {
  background: #e8f4fd;
  color: #0f3460;
}

.btn-edit:hover {
  background: #d0e8f7;
}

.btn-delete {
  background: #fde8e8;
  color: #c0392b;
}

.btn-delete:hover {
  background: #f5c6c6;
}

.total-dia {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px solid #f0f2f5;
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.total-dia .clp {
  color: #0f3460;
}

.total-dia .brl {
  color: #27ae60;
}

.empty-msg {
  text-align: center;
  color: #999;
  padding: 20px 0;
  font-size: 0.9rem;
}

#resumo-geral {
  background: #f8f9fb;
  padding: 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-weight: 700;
  font-size: 1.05rem;
}

#resumo-geral .clp {
  color: #0f3460;
}

#resumo-geral .brl {
  color: #27ae60;
}

.resumo-dia-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  margin: 0;
  border: none;
  border-bottom: 1px solid #f0f0f0;
  border-radius: 6px;
  background: transparent;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 400;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.resumo-dia-item:hover {
  background: #f1f5f9;
}

.resumo-dia-item:last-child {
  border-bottom: none;
}

.resumo-dia-data {
  font-weight: 600;
}

.resumo-dia-valores {
  text-align: right;
  color: #555;
}

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

.card-header h2 {
  margin-bottom: 0;
}

.btn-group-relatorio {
  display: flex;
  gap: 0;
}

.btn-group-relatorio .btn-relatorio {
  background: #27ae60;
  color: #fff;
  padding: 6px 12px;
  font-size: 0.75rem;
  border-radius: 0;
  border-right: 1px solid rgba(255,255,255,0.3);
}

.btn-group-relatorio .btn-relatorio:first-child {
  border-radius: 8px 0 0 8px;
}

.btn-group-relatorio .btn-relatorio:last-child {
  border-radius: 0 8px 8px 0;
  border-right: none;
}

.btn-group-relatorio .btn-relatorio:hover {
  background: #219a52;
}

.relatorio-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #fff;
  z-index: 1000;
  overflow-y: auto;
}

.relatorio-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 30px 20px;
}

.relatorio-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}

.relatorio-header {
  text-align: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #16213e;
}

.relatorio-header h2 {
  font-size: 1.4rem;
  color: #16213e;
  margin-bottom: 4px;
}

.relatorio-header p {
  color: #555;
  font-size: 0.9rem;
}

.relatorio-tabela {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.relatorio-tabela th {
  background: #16213e;
  color: #fff;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
}

.relatorio-tabela th:last-child,
.relatorio-tabela td:last-child {
  text-align: right;
}

.relatorio-tabela th:nth-child(2),
.relatorio-tabela td:nth-child(2) {
  text-align: right;
}

.relatorio-tabela td {
  padding: 8px 12px;
  border-bottom: 1px solid #e0e0e0;
}

.relatorio-tabela tr:nth-child(even) td {
  background: #f8f9fb;
}

.relatorio-totais {
  background: #f8f9fb;
  padding: 16px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 1.1rem;
  border: 2px solid #16213e;
}

.relatorio-totais .clp {
  color: #0f3460;
}

.relatorio-totais .brl {
  color: #27ae60;
}

.relatorio-dia-header td {
  background: #e8edf3 !important;
  font-weight: 700;
  color: #16213e;
  font-size: 0.9rem;
  padding: 8px 12px;
  border-bottom: 1px solid #ccd5e0;
}

.relatorio-dia-subtotal td {
  font-weight: 600;
  color: #0f3460;
  border-bottom: 2px solid #16213e;
  font-size: 0.9rem;
}

.relatorio-rodape {
  margin-top: 20px;
  text-align: center;
  color: #999;
  font-size: 0.8rem;
}

@media print {
  .no-print {
    display: none !important;
  }

  .relatorio-overlay {
    position: static;
  }

  body > .container {
    display: none;
  }
}

@media (max-width: 480px) {
  .form-row {
    flex-direction: column;
  }

  .form-row input, button {
    width: 100%;
  }

  .total-dia, #resumo-geral {
    flex-direction: column;
    text-align: center;
  }
}
