:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --border: #e5e7eb;
  --uyu: #2563eb;
  --usd: #16a34a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 72px;
}

a { color: var(--primary); text-decoration: none; }

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar h1 {
  font-size: 1.05rem;
  margin: 0;
  font-weight: 700;
}

.topbar .logout {
  font-size: 0.85rem;
  color: var(--muted);
}

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

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

.stat-card .label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-card .value {
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 4px;
}

.stat-card .value.uyu { color: var(--uyu); }
.stat-card .value.usd { color: var(--usd); }

.chart-wrap {
  position: relative;
  height: 260px;
  margin-top: 8px;
}

h2.section-title {
  font-size: 0.95rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0 0 10px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 10px 6px;
  border-bottom: 1px solid var(--border);
}

th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge.pagado { background: #dcfce7; color: #166534; }
.badge.pendiente { background: #fef3c7; color: #92400e; }
.badge.uyu { background: #dbeafe; color: #1e40af; }
.badge.usd { background: #dcfce7; color: #166534; }

.row-actions { white-space: nowrap; }
.row-actions a, .row-actions button {
  font-size: 0.8rem;
  margin-right: 8px;
}

form.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

form.filters select {
  flex: 1;
  min-width: 100px;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
  margin-top: 12px;
}

input, select, textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
  color: var(--text);
}

button, .btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

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

.btn.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

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

.btn-block { width: 100%; margin-top: 16px; }

.flash {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.flash.error { background: #fee2e2; color: #991b1b; }
.flash.success { background: #dcfce7; color: #166534; }
.flash.info { background: #dbeafe; color: #1e40af; }

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  z-index: 10;
}

.bottom-nav a {
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.bottom-nav a.active { color: var(--primary); font-weight: 700; }
.bottom-nav .icon { font-size: 1.2rem; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 24px;
  width: 100%;
  max-width: 360px;
}

.login-card h1 {
  font-size: 1.2rem;
  margin: 0 0 4px 0;
}

.login-card p.sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 20px 0;
}

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

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