 :root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --primary: #0f4c81;
  --primary-dark: #0b365b;
  --secondary: #1f7a8c;
  --success: #1b8f5a;
  --danger: #c0392b;
  --warning: #d68910;
  --text: #1e293b;
  --muted: #64748b;
  --border: #dbe3ee;
  --shadow: 0 10px 30px rgba(15, 76, 129, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
}

body {
  background: linear-gradient(135deg, #eef4fb 0%, #f8fbff 100%);
  color: var(--text);
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 32px;
  border: 1px solid var(--border);
}

.auth-card h1 {
  color: var(--primary);
  font-size: 28px;
  margin-bottom: 8px;
}

.auth-card p {
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}

.tab-btn {
  border: none;
  padding: 12px 16px;
  border-radius: 12px;
  background: #eaf1f8;
  color: var(--primary-dark);
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s ease;
}

.tab-btn.active {
  background: var(--primary);
  color: white;
}

.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 6px;
  color: var(--primary-dark);
}

input,
select,
button,
textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 4px rgba(31, 122, 140, 0.12);
}

.btn {
  border: none;
  background: var(--primary);
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s ease;
}

.btn:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--secondary);
}

.btn-success {
  background: var(--success);
}

.auth-switch {
  text-align: center;
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
}

.auth-switch a {
  color: var(--primary);
  text-decoration: none;
  font-weight: bold;
  cursor: pointer;
}

.message {
  margin-top: 12px;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  display: none;
}

.message.success {
  display: block;
  background: #eaf8f0;
  color: var(--success);
}

.message.error {
  display: block;
  background: #fdecea;
  color: var(--danger);
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  padding: 24px;
}

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

.title-wrap h1 {
  font-size: 30px;
  color: var(--primary);
  margin-bottom: 6px;
}

.title-wrap p {
  color: var(--muted);
}

.logout-btn {
  width: auto;
  padding: 12px 20px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 0.8fr;
  gap: 20px;
  align-items: start;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 22px;
}

.card h2 {
  font-size: 22px;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

.card .subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 18px;
  line-height: 1.5;
}

.summary-card {
  position: sticky;
  top: 24px;
}

.summary-item {
  background: #f8fbff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
}

.summary-label {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 6px;
}

.summary-value {
  font-size: 28px;
  font-weight: bold;
  color: var(--primary);
}

.summary-total {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.detail-section {
  margin-top: 22px;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: white;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

thead {
  background: #edf4fb;
}

th,
td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: top;
}

th {
  color: var(--primary-dark);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  color: #334155;
}

.badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
  color: white;
}

.badge.boleta {
  background: var(--primary);
}

.badge.recibo {
  background: var(--warning);
}

.footer-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

.download-btn {
  max-width: 280px;
  padding: 14px 18px;
  font-size: 15px;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 22px;
}

@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .summary-card {
    position: static;
  }
}

@media (max-width: 700px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .app-shell {
    padding: 16px;
  }

  .card {
    padding: 18px;
  }

  .title-wrap h1 {
    font-size: 24px;
  }
}

@media print {
  body {
    background: white;
  }

  .topbar,
  .dashboard-grid,
  .footer-actions,
  .detail-section h2 + p {
    display: none !important;
  }

  .detail-section {
    margin-top: 0;
  }

  .card,
  .table-wrap {
    box-shadow: none;
    border: none;
  }

  table {
    min-width: 100%;
  }
}

.action-cell {
  white-space: nowrap;
}

.btn-delete {
  width: auto;
  min-width: 88px;
  padding: 8px 12px;
  border-radius: 10px;
  border: none;
  background: var(--danger);
  color: white;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
}

.btn-delete:hover {
  filter: brightness(0.95);
}

.btn-delete:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
