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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
  color: #fff;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.container {
  width: 100%;
  max-width: 480px;
  padding: 24px;
}

/* -- PIN Screen -- */
#pin-screen {
  text-align: center;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  border-radius: 18px;
  margin-bottom: 16px;
}

.app-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.app-subtitle {
  font-size: 16px;
  color: #64748b;
  margin-bottom: 36px;
}

.pin-dots {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 36px;
}

.pin-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #334155;
  transition: all 0.15s;
}

.pin-dot.filled {
  background: #3b82f6;
  border-color: #3b82f6;
}

.pin-dot.error {
  background: #ef4444;
  border-color: #ef4444;
}

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 300px;
  margin: 0 auto;
}

.numpad-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 20px;
  font-size: 28px;
  font-weight: 500;
  color: #fff;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.numpad-btn:active {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(0.95);
}

.numpad-btn.empty {
  background: transparent;
  border: none;
  cursor: default;
}

.numpad-btn.delete {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin-error {
  color: #ef4444;
  font-size: 16px;
  margin-top: 20px;
  min-height: 24px;
}

/* -- Dashboard -- */
#dashboard {
  display: none;
}

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 36px;
}

.dash-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dash-brand .logo-badge {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  margin-bottom: 0;
}

.dash-brand span {
  font-size: 20px;
  font-weight: 700;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
}

.logout-btn:active {
  background: rgba(255, 255, 255, 0.1);
}

/* Status card */
.status-card {
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 28px;
  text-align: center;
}

.status-card.connected {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.status-card.disconnected {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.status-card.loading {
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  margin-bottom: 16px;
}

.connected .status-icon {
  background: rgba(34, 197, 94, 0.15);
}

.disconnected .status-icon {
  background: rgba(239, 68, 68, 0.15);
}

.loading .status-icon {
  background: rgba(148, 163, 184, 0.15);
}

.status-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.connected .status-title {
  color: #22c55e;
}

.disconnected .status-title {
  color: #ef4444;
}

.loading .status-title {
  color: #94a3b8;
}

.status-location {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #94a3b8;
  font-size: 16px;
}

.status-message {
  font-size: 16px;
  margin-top: 14px;
}

.connected .status-message {
  color: #22c55e;
}

.disconnected .status-message {
  color: #fbbf24;
  font-weight: 500;
}

/* Reset button */
.reset-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border: none;
  border-radius: 14px;
  padding: 26px;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.reset-btn:active {
  transform: scale(0.98);
}

.reset-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.reset-hint {
  font-size: 14px;
  color: #64748b;
  text-align: center;
  margin-top: 12px;
}

/* Toast */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  padding: 16px 24px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  opacity: 0;
  transition: all 0.3s;
  z-index: 100;
  max-width: 90%;
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success {
  background: rgba(34, 197, 94, 0.9);
  color: #fff;
}

.toast.error {
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
}

/* Spinner */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
