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

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  /* Extend background behind status bar / Dynamic Island */
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--surface2);
}
.header h1 {
  font-size: 18px;
  font-weight: 700;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}
.badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-pending { background: var(--warning); color: #000; }
.badge-admin { background: var(--primary); color: #fff; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  color: #fff;
}
.btn-primary { background: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--surface2);
  color: var(--text);
}
.btn-outline:hover { background: var(--surface); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-google {
  background: #fff;
  color: #333;
  font-size: 15px;
}
.btn-google:hover { background: #f0f0f0; }

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.card-date {
  font-size: 16px;
  font-weight: 700;
}
.status {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.status-queued { background: var(--primary); color: #fff; }
.status-notified { background: var(--success); color: #000; }
.status-completed { background: var(--surface2); color: var(--text-muted); }
.status-cancelled { background: var(--surface2); color: var(--text-muted); }
.status-expired { background: var(--warning); color: #000; }
.status-requeuing { background: var(--warning); color: #000; }

.card-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.hold-timer {
  font-size: 13px;
  color: var(--success);
  font-weight: 600;
  margin-top: 4px;
}

/* Calendar */
.calendar {
  margin-bottom: 16px;
}
.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}
.cal-dow {
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px;
  font-weight: 600;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s;
}
.cal-day.empty { cursor: default; }
.cal-day.available { background: #166534; color: #fff; }
.cal-day.sold-out { background: #991b1b; color: #fff; opacity: 0.6; cursor: not-allowed; }
.cal-day.no-reservation { background: var(--surface2); color: var(--text-muted); cursor: not-allowed; }
.cal-day.past { opacity: 0.3; cursor: not-allowed; }
.cal-day.today { border-color: var(--primary); font-weight: 700; }
.cal-day.selected { border-color: var(--warning); background: #78350f; }

/* Sections */
.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  margin-top: 24px;
}
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 16px;
  font-size: 14px;
}

/* Login */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70dvh;
  text-align: center;
  gap: 24px;
}
.login-container h1 { font-size: 24px; }
.login-container p { color: var(--text-muted); }

/* Install prompt */
.install-banner {
  background: #78350f;
  border: 2px solid var(--warning);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  animation: pulse-border 2s ease-in-out infinite;
}
.install-banner strong { color: var(--warning); font-size: 15px; }
@keyframes pulse-border {
  0%, 100% { border-color: var(--warning); }
  50% { border-color: #fbbf24; }
}

/* Nav tabs */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}
.tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  border: none;
  color: var(--text-muted);
  transition: all 0.15s;
}
.tab.active {
  background: var(--primary);
  color: #fff;
}

/* Admin table */
.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.user-info { display: flex; flex-direction: column; gap: 2px; }
.user-name { font-weight: 600; font-size: 14px; }
.user-email { font-size: 12px; color: var(--text-muted); }

/* Toggle */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--surface2);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
  border: none;
}
.toggle.on { background: var(--success); }
.toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
.toggle.on::after { transform: translateX(20px); }

/* Notification prompt */
.notif-prompt {
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

/* Loading */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--surface2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70dvh;
}
