/* L&P Care SCS — Design System 2026 */

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #232736;
  --border: #2e3347;
  --accent: #4f8ef7;
  --accent-dim: rgba(79,142,247,0.15);
  --success: #22c55e;
  --success-dim: rgba(34,197,94,0.15);
  --danger: #ef4444;
  --danger-dim: rgba(239,68,68,0.15);
  --warning: #f59e0b;
  --text: #e8eaf0;
  --text-muted: #6b7280;
  --text-dim: #9ca3af;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  font-size: 15px;
}

/* ── Layout ──────────────────────────────── */
.container { max-width: 680px; margin: 0 auto; padding: 1rem; }
.container-wide { max-width: 1100px; margin: 0 auto; padding: 1rem; }

/* ── Header ──────────────────────────────── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-brand {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.header-brand span { color: var(--accent); }
.header-user {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.header-user a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

/* ── Nav ─────────────────────────────────── */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
}
.nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Cards ───────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.card-title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* ── Stats ───────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  text-align: center;
}
.stat-value { font-size: 2rem; font-weight: 700; color: var(--accent); line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.5rem; }

/* ── Buttons ─────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
  letter-spacing: 0.01em;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: 0.9; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.8rem; }
.btn-lg { padding: 1rem 2rem; font-size: 1rem; }
.btn-block { width: 100%; }

/* ── Forms ───────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-input-pin {
  font-size: 2.5rem;
  text-align: center;
  letter-spacing: 0.5rem;
  font-weight: 700;
  background: var(--surface2);
}
.form-textarea { min-height: 80px; resize: vertical; }

/* ── PIN Keypad ──────────────────────────── */
.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 1rem;
}
.pin-key {
  aspect-ratio: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pin-key:hover { background: var(--border); }
.pin-key:active { transform: scale(0.95); background: var(--accent-dim); }
.pin-key-del { font-size: 1.2rem; color: var(--text-muted); }
.pin-key-ok { background: var(--accent); color: #fff; border-color: var(--accent); }
.pin-key-ok:hover { opacity: 0.9; }
.pin-dots {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 0;
}
.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.15s;
}
.pin-dot.filled { background: var(--accent); }

/* ── Client Grid ─────────────────────────── */
.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.client-btn {
  padding: 1rem 1.25rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  color: var(--text);
}
.client-btn:hover { border-color: var(--accent); background: var(--accent-dim); }
.client-btn.selected { border-color: var(--accent); background: var(--accent-dim); }
.client-btn .name { font-weight: 600; font-size: 0.95rem; }
.client-btn .address { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ── Active Intervention ─────────────────── */
.intervention-active {
  background: var(--success-dim);
  border-color: var(--success) !important;
}
.intervention-active .client-name { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.intervention-active .client-address { color: var(--text-muted); margin-top: 0.25rem; }
.intervention-active .checkin-time {
  font-size: 2rem;
  font-weight: 700;
  color: var(--success);
  margin: 0.75rem 0 1.25rem;
  font-variant-numeric: tabular-nums;
}
.elapsed-label { font-size: 0.8rem; color: var(--text-muted); }

/* ── Tables ──────────────────────────────── */
.table-wrapper { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface2); }

/* ── Badges ──────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
}
.badge-success { background: var(--success-dim); color: var(--success); }
.badge-danger { background: var(--danger-dim); color: var(--danger); }
.badge-info { background: var(--accent-dim); color: var(--accent); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }

/* ── Alerts ──────────────────────────────── */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  border-left: 3px solid;
}
.alert-error { background: var(--danger-dim); color: #fca5a5; border-color: var(--danger); }
.alert-success { background: var(--success-dim); color: #86efac; border-color: var(--success); }
.alert-info { background: var(--accent-dim); color: #93c5fd; border-color: var(--accent); }

/* ── Login ───────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--bg);
}
.login-box {
  width: 100%;
  max-width: 380px;
}
.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo .brand {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}
.login-logo .brand span { color: var(--accent); }
.login-logo .subtitle { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ── Filters ─────────────────────────────── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1.5rem;
}
.filters .form-group { margin-bottom: 0; flex: 1; min-width: 140px; }

/* ── Empty State ─────────────────────────── */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: 0.75rem; opacity: 0.5; }
.empty-state p { font-size: 0.9rem; }

/* ── Divider ─────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ── Utilities ───────────────────────────── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-accent { color: var(--accent); }
.fw-700 { font-weight: 700; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none !important; }
.flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

/* ── Mobile ──────────────────────────────── */
@media (max-width: 640px) {
  .hide-mobile { display: none; }
  .table th:nth-child(n+4), .table td:nth-child(n+4) { display: none; }
}

/* ── btn-secondary alias ─────────────────── */
.btn-secondary {
  background: var(--surface2);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--text-muted); color: var(--text); }

/* ── Modal overlay ───────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow);
}
.modal-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text);
}

/* ── Select dark ─────────────────────────── */
.form-select option { background: var(--surface2); color: var(--text); }

/* ── Print ───────────────────────────────── */
@media print {
  .header, .nav, .btn, .filters { display: none !important; }
  body { background: white; color: black; }
  .card { background: white; border: 1px solid #ddd; box-shadow: none; }
}
