/* ==============================
   VARIABLES GLOBALES
============================== */
:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #f59e0b;

  --bg: #f8fafc;
  --card-bg: #ffffff;

  --text: #1e293b;
  --text-muted: #64748b;

  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* ==============================
   RESET BÁSICO
============================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ==============================
   TOPBAR
============================== */
.topbar {
  background: var(--card-bg);
  padding: 20px;
  box-shadow: var(--shadow);

  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;

  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-section {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.label-with-icon {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-muted);
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--primary);
}

.topbar-title h1 {
  font-size: 24px;
  font-weight: 700;
}

.month-label {
  background: var(--primary);
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
}

/* ==============================
   INPUTS & SELECTS
============================== */
input,
select {
  padding: 10px 14px;
  border-radius: 8px;
  border: 2px solid var(--border);
  font-size: 14px;
  transition: all 0.25s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ==============================
   BOTONES
============================== */
button {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;

  font-weight: 600;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  gap: 8px;

  transition: all 0.25s ease;
}

button:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

button.success {
  background: var(--success);
}

button.success:hover {
  background: #15803d;
}

button.danger {
  background: var(--danger);
}

button.danger:hover {
  background: #b91c1c;
}

button.warning {
  background: var(--warning);
}

button.warning:hover {
  background: #d97706;
}

/* ==============================
   CONTENEDOR
============================== */
.container {
  max-width: 1400px;
  margin: 30px auto;
  padding: 0 20px;
}

/* ==============================
   CARDS
============================== */
.card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 25px;
  box-shadow: var(--shadow);
  margin-bottom: 25px;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;

  margin-bottom: 20px;
  padding-bottom: 15px;

  border-bottom: 2px solid var(--border);
}

.card-header h2 {
  font-size: 20px;
  color: var(--text);
}

.card-header i {
  font-size: 24px;
  color: var(--primary);
}

/* ==============================
   STATS
============================== */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.stat-box {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  padding: 20px;
  border-radius: 10px;
  color: #fff;

  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-box.success {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

.stat-box.danger {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 14px;
  opacity: 0.9;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
}

.stat-icon {
  font-size: 48px;
  opacity: 0.3;
}

/* ==============================
   FORMULARIOS
============================== */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 15px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ==============================
   TABLAS
============================== */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

thead {
  background: var(--bg);
}

th {
  padding: 12px;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}

td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

tbody tr:hover {
  background: var(--bg);
}

/* ==============================
   PROGRESO
============================== */
.progress-container {
  margin: 20px 0;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text-muted);
}

.progress-bar {
  width: 100%;
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--success), var(--primary));
  transition: width 0.5s ease;

  display: flex;
  align-items: center;
  justify-content: flex-end;

  padding-right: 10px;
  color: #fff;
  font-weight: 600;
  font-size: 12px;
}

/* ==============================
   NOTIFICACIONES
============================== */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;

  padding: 15px 20px;
  border-radius: 8px;

  color: #fff;
  font-weight: 600;

  z-index: 1000;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
}

.notification.success {
  background: var(--success);
}

.notification.error {
  background: var(--danger);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ==============================
   BACKUP
============================== */
.backup-info {
  background: #f0f9ff;
  border: 2px solid #0ea5e9;
  border-radius: 8px;
  padding: 15px;

  margin-top: 15px;

  display: flex;
  align-items: center;
  gap: 12px;
}

.backup-info i {
  font-size: 24px;
  color: #0ea5e9;
}

.backup-info-text {
  flex: 1;
}

.backup-info-text strong {
  display: block;
  margin-bottom: 5px;
}

/* ==============================
   RESPONSIVE
============================== */
@media (max-width: 768px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .stat-value {
    font-size: 24px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .card-header {
    flex-wrap: wrap;
  }
}
.days-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr); /* 7 columnas */
  gap: 10px;
  margin-bottom: 15px;
}

.day {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px;
  text-align: center;
  font-size: 13px;
}

.day label {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
  color: #374151;
}

.day input {
  width: 100%;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  text-align: center;
}
#expensesChart {
  width: 100%;
  height: 300px;
}
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  align-items: center;
}

.summary-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
}

.summary-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.summary-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.summary-name {
  font-weight: 600;
  color: #1f2937;
}

.summary-right {
  text-align: right;
  font-size: 14px;
}

.summary-right strong {
  display: block;
}

@media (max-width: 768px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }
}
.income-ok {
  background: #e6f9ee;
  border-left: 4px solid #22c55e;
  transition: background 0.3s ease;
}
.day-cell.filled {
  background-color: #e6f9ee;
  border-color: #22c55e;
}
.notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #22c55e;
  color: white;
  padding: 12px 24px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  font-weight: bold;
  display: none;
  z-index: 9999;
  transition: opacity 0.4s ease;
}
.notification.show {
  display: block;
  opacity: 1;
}
.notification.hide {
  opacity: 0;
  transition: opacity 0.4s ease;
}
.warning-row { background-color: #fcd34d33; } /* naranja claro */
.danger-row { background-color: #f8717133; }   /* rojo claro */
tr input[type="checkbox"] { margin-right: 5px; }
