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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #f3f4f6, #e0f2fe);
  color: #111827;
  min-height: 100vh;
}

.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: #1d4ed8;
  color: #fff;
  padding: 1rem 1.5rem;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
}

header h1 {
  font-size: 1.4rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-logo {
  height: 40px;
}

main {
  flex: 1;
  padding: 1.5rem;
  max-width: 960px;
  margin: 0 auto;
}

.footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.8rem;
  color: #6b7280;
}

.card {
  background: #ffffff;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
  margin-bottom: 1.5rem;
}

.card h2 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.5rem;
}

@media (max-width: 640px) {
  main {
    padding: 1rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

input[type='text'],
input[type='email'],
input[type='password'],
input[type='number'],
input[type='date'],
select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 0.5rem;
  border: 1px solid #d1d5db;
  font-size: 0.95rem;
}

input:focus,
select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #2563eb33;
}

button {
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.4rem;
  background: #2563eb;
  color: #fff;
  font-weight: 500;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.1s ease;
}

button:hover {
  background: #1d4ed8;
  box-shadow: 0 8px 15px rgba(37, 99, 235, 0.25);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
  box-shadow: none;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

th,
td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.9rem;
}

th {
  text-align: left;
  background: #eff6ff;
  position: sticky;
  top: 0;
}

tr:nth-child(even) td {
  background: #f9fafb;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-pending {
  background: #fef3c7;
  color: #92400e;
}

.badge-paid {
  background: #dcfce7;
  color: #166534;
}

.badge-other {
  background: #e5e7eb;
  color: #374151;
}

.page-actions {
  margin-top: 1rem;
}

.page-actions a {
  margin-right: 0.75rem;
  font-size: 0.9rem;
}

/* Botões principais da home (Sou paciente / Sou administrador) */
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.6rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-primary {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
  background: #6b7280;
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(55, 65, 81, 0.25);
}

.btn-secondary:hover {
  background: #4b5563;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(55, 65, 81, 0.35);
}

.btn-secondary {
  background: #6b7280;
}

.btn-secondary:hover {
  background: #4b5563;
}

.btn-danger {
  background: #dc2626;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-small {
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
}

.btn-link {
  background: transparent;
  color: #2563eb;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}

.btn-link:hover {
  background: transparent;
  text-decoration: underline;
  transform: none;
  box-shadow: none;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.info-text {
  font-size: 0.9rem;
  color: #4b5563;
  margin-top: 0.75rem;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.loading-box {
  background: #ffffff;
  padding: 1.25rem 1.75rem;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 3px solid #e5e7eb;
  border-top-color: #2563eb;
  animation: spin 0.8s linear infinite;
}

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

.text-success {
    color: #166534;
    font-weight: bold;
}

.text-danger {
    color: #dc2626;
    font-weight: bold;    
}

.text-info {
    color: #2563eb;
    font-weight: bold;
}

