:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --primary: #3b82f6;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--danger); font-size: 0.85rem; }

.screen { min-height: 100dvh; }

/* Login */
.login-card {
  max-width: 380px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: center;
  min-height: 100dvh;
}
.login-card h1 { margin: 0; font-size: 1.8rem; }
.user-list { display: flex; flex-direction: column; gap: 0.75rem; }
.user-btn {
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  text-align: left;
}
.user-btn:hover { background: var(--surface-2); }

.pin-pad { display: flex; flex-direction: column; gap: 0.75rem; }
.pin-pad input {
  padding: 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--surface-2);
  background: var(--surface);
  color: var(--text);
  font-size: 1.2rem;
  text-align: center;
  letter-spacing: 0.5rem;
}
.pin-buttons { display: flex; gap: 0.5rem; }
.pin-buttons button { flex: 1; }

/* Topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--surface-2);
  position: sticky;
  top: 0;
  z-index: 10;
}
.badge {
  margin-left: 0.5rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--primary);
  font-size: 0.75rem;
  text-transform: uppercase;
}

/* Alert banner */
.alert-banner {
  background: var(--warn);
  color: #1f2937;
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--surface-2);
  overflow-x: auto;
}
.tab {
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.tab.active { background: var(--primary); color: white; }

/* Main */
main { padding: 1rem; max-width: 900px; margin: 0 auto; }

.filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
@media (min-width: 640px) {
  .filters { grid-template-columns: 2fr 1fr 1fr 1fr 1fr; }
}
.filters input, .filters select {
  padding: 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--surface-2);
  background: var(--surface);
  color: var(--text);
}

/* List */
.list { display: flex; flex-direction: column; gap: 0.75rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.card.bajo { border-left: 4px solid var(--warn); }
.card.cero { border-left: 4px solid var(--danger); }
.card.ok { border-left: 4px solid var(--ok); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.5rem;
}
.card-title { font-weight: 600; }
.card-sub { color: var(--muted); font-size: 0.85rem; }
.card-variantes { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.variante {
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.8rem;
}
.variante.bajo { background: var(--warn); color: #1f2937; }
.variante.cero { background: var(--danger); color: white; }

.card-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }

/* Buttons */
button {
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  border: none;
  background: var(--primary);
  color: white;
  cursor: pointer;
  font-size: 0.9rem;
}
button.ghost { background: transparent; border: 1px solid var(--surface-2); color: var(--text); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}
.modal-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.modal-card label { font-size: 0.85rem; color: var(--muted); }
.modal-card input, .modal-card select {
  padding: 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--surface-2);
  background: var(--surface-2);
  color: var(--text);
}
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 0.5rem; }
