:root {
  /* Color Palette */
  --primary-rgb: 99, 102, 241; /* Indigo */
  --primary: rgb(var(--primary-rgb));
  --primary-hover: #4f46e5;
  
  --success-rgb: 16, 185, 129; /* WhatsApp Green */
  --success: rgb(var(--success-rgb));
  
  --danger-rgb: 239, 68, 68; /* Crimson */
  --danger: rgb(var(--danger-rgb));
  
  --warning-rgb: 245, 158, 11; /* Amber */
  --warning: rgb(var(--warning-rgb));
  
  --neutral-100: #f5f5f5;
  --neutral-200: #e5e5e5;
  --neutral-300: #d4d4d4;
  --neutral-400: #a3a3a3;
  --neutral-500: #737373;
  --neutral-800: #262626;
  --neutral-900: #171717;
  --neutral-950: #050505;
  
  /* Glassmorphism Variables */
  --glass-bg: rgba(10, 10, 10, 0.75);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-glow: rgba(255, 255, 255, 0.02);
  
  /* Fonts */
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --font-title: 'Outfit', sans-serif;
  
  /* Shadows */
  --shadow-sm: 0 2px 8px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 12px 24px -4px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.5);
  
  /* Transitions */
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--neutral-950);
  color: var(--neutral-100);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 0;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
}

/* Background Glowing Accents */
.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  z-index: 0;
  opacity: 0.45;
  pointer-events: none;
}

.bg-glow-1 {
  width: 45vw;
  height: 45vw;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.15) 0%, rgba(0,0,0,0) 70%);
  top: -10%;
  left: -10%;
  animation: float-slow 18s ease-in-out infinite alternate;
}

.bg-glow-2 {
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.02) 0%, rgba(0,0,0,0) 70%);
  bottom: -15%;
  right: -10%;
  animation: float-slow 22s ease-in-out infinite alternate-reverse;
}

@keyframes float-slow {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(5%, 8%) scale(1.1); }
  100% { transform: translate(-3%, -5%) scale(0.9); }
}

/* App Container */
.app-container {
  width: 100%;
  max-width: 480px;
  padding: 20px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px;
}

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

.brand-icon {
  width: 28px;
  height: 28px;
  color: var(--success);
  filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.4));
}

.brand-title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--neutral-100) 40%, var(--neutral-300) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Icon Buttons */
.icon-button {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--neutral-300);
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--neutral-100);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.icon-button svg {
  width: 20px;
  height: 20px;
  transition: transform 0.5s ease;
}

.icon-button:hover svg {
  transform: rotate(45deg);
}

/* Glassmorphism utility */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 24px;
}

/* Main Card */
.main-card {
  width: 100%;
  box-shadow: var(--shadow-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  overflow: hidden;
}

.main-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0) 100%);
}

/* Status Bar */
.card-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 16px;
}

.instance-info-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 12px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--neutral-300);
}

.badge-icon {
  width: 14px;
  height: 14px;
}

/* Status Badges */
.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: var(--transition-smooth);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
}

/* Checking Status */
.state-checking {
  background: rgba(148, 163, 184, 0.12);
  color: var(--neutral-400);
  border: 1px solid rgba(148, 163, 184, 0.2);
}
.state-checking .pulse-dot {
  background-color: var(--neutral-400);
  animation: pulse 1.5s infinite;
}

/* Connected (open) Status */
.state-connected {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.08);
}
.state-connected .pulse-dot {
  background-color: var(--success);
  animation: pulse-glow-success 1.8s infinite;
}

/* Disconnected (close) Status */
.state-disconnected {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.state-disconnected .pulse-dot {
  background-color: var(--danger);
}

/* Connecting Status */
.state-connecting {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}
.state-connecting .pulse-dot {
  background-color: var(--warning);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.5; }
}

@keyframes pulse-glow-success {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Content Views Management */
.card-content {
  position: relative;
  min-height: 320px;
  display: flex;
  flex-direction: column;
}

.view {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  animation: fade-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.view.active {
  display: flex;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Typography Inside Card */
.view-title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.5rem;
  margin-top: 12px;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.view-subtitle {
  font-size: 0.9rem;
  color: var(--neutral-400);
  margin-bottom: 24px;
  max-width: 320px;
}

/* Loader Styles */
.spinner-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 180px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3.5px solid rgba(255, 255, 255, 0.05);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-message {
  font-size: 0.95rem;
  color: var(--neutral-400);
  animation: pulse 1.5s infinite;
}

/* Connected View UI details */
.connected-animation {
  position: relative;
  width: 110px;
  height: 110px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
}

.glow-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.2) 0%, rgba(16, 185, 129, 0) 70%);
  animation: scale-pulsate 2.5s ease-in-out infinite;
}

@keyframes scale-pulsate {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.success-icon-wrapper {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.1);
  border: 2px solid rgba(16, 185, 129, 0.3);
  color: var(--success);
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.2);
}

.success-icon {
  width: 36px;
  height: 36px;
  animation: stroke-draw 0.6s cubic-bezier(0.16, 1, 0.3, 1) both 0.2s;
}

@keyframes stroke-draw {
  from { stroke-dashoffset: 50; }
  to { stroke-dashoffset: 0; }
}

.details-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  width: 100%;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.detail-label {
  color: var(--neutral-400);
}

.detail-value {
  font-weight: 600;
  color: var(--neutral-200);
}

.text-success {
  color: var(--success) !important;
}

/* QR Code Container */
.qr-container-wrapper {
  position: relative;
  margin-bottom: 24px;
}

.qr-box {
  width: 220px;
  height: 220px;
  background: white;
  border-radius: 20px;
  padding: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  box-shadow: var(--shadow-md), 0 0 30px rgba(99, 102, 241, 0.1);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.qr-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.3s ease;
  image-rendering: pixelated;
}

.qr-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.92);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  color: var(--neutral-200);
  font-size: 0.85rem;
  font-weight: 500;
}

.qr-overlay .spinner {
  width: 32px;
  height: 32px;
}

.qr-box.loading .qr-overlay {
  display: flex;
}

/* Expiry Countdown Indicator */
.countdown-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 14px 6px 10px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--neutral-300);
}

.countdown-ring {
  transform: rotate(-90deg);
}

.countdown-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 2.5;
}

.countdown-ring-progress {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 100.53; /* 2 * PI * r (2 * 3.14159 * 16) */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke var(--transition-smooth);
}

.countdown-text {
  font-weight: 700;
  font-family: var(--font-title);
  color: var(--neutral-100);
  min-width: 14px;
}

.countdown-label {
  color: var(--neutral-400);
}

/* Instructions */
.instructions {
  width: 100%;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  padding: 16px 20px;
  text-align: left;
  margin-bottom: 12px;
}

.instructions ol {
  padding-left: 16px;
  color: var(--neutral-300);
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.instructions li::marker {
  color: var(--primary);
  font-weight: 700;
}

.action-footer {
  width: 100%;
  display: flex;
  justify-content: center;
}

/* Button Classes */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 12px 24px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: var(--transition-bounce);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.25);
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--neutral-200);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transform: translateY(-1px);
}

.btn-danger {
  background: rgba(var(--danger-rgb), 0.15);
  border: 1px solid rgba(var(--danger-rgb), 0.3);
  color: #fca5a5;
  box-shadow: 0 4px 12px rgba(var(--danger-rgb), 0.1);
}
.btn-danger:hover {
  background: rgba(var(--danger-rgb), 0.25);
  border-color: rgba(var(--danger-rgb), 0.5);
  color: white;
  box-shadow: 0 6px 16px rgba(var(--danger-rgb), 0.2);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.8rem;
  border-radius: 10px;
}

/* Error view layout */
.error-icon-wrapper {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(var(--danger-rgb), 0.1);
  border: 1px solid rgba(var(--danger-rgb), 0.25);
  color: var(--danger);
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 15px;
  margin-bottom: 5px;
}

.error-icon {
  width: 28px;
  height: 28px;
}

.error-actions {
  width: 100%;
  margin-bottom: 12px;
}

/* Modal Dialog */
.settings-modal {
  margin: auto;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 24px;
  color: var(--neutral-100);
  max-width: 420px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow-lg), 0 0 60px rgba(0,0,0,0.6);
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.settings-modal[open] {
  opacity: 1;
  transform: scale(1);
}

.settings-modal::backdrop {
  background: rgba(2, 6, 23, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: backdrop-fade 0.3s ease forwards;
}

@keyframes backdrop-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 12px;
}

.modal-header h3 {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 600;
}

.btn-close-icon {
  background: transparent;
  border: none;
  color: var(--neutral-400);
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 6px;
  transition: var(--transition-smooth);
}

.btn-close-icon:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--neutral-200);
}

.btn-close-icon svg {
  width: 18px;
  height: 18px;
}

/* Forms */
#settings-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--neutral-300);
}

.form-group input {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px;
  font-size: 0.88rem;
  font-family: var(--font-body);
  color: white;
  width: 100%;
  outline: none;
  transition: var(--transition-smooth);
}

.form-group input:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.form-tip {
  font-size: 0.72rem;
  color: var(--neutral-500);
  margin-top: 2px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 16px;
  margin-top: 6px;
}

/* Footer layout */
.app-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--neutral-500);
  margin-top: 5px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  width: calc(100% - 32px);
  max-width: 360px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  color: var(--neutral-200);
  font-size: 0.82rem;
  font-weight: 500;
  animation: toast-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast.removing {
  opacity: 0;
  transform: translateY(10px) scale(0.9);
}

.toast-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-success .toast-icon { color: var(--success); }

.toast-error { border-left: 3px solid var(--danger); }
.toast-error .toast-icon { color: var(--danger); }

.toast-info { border-left: 3px solid var(--primary); }
.toast-info .toast-icon { color: var(--primary); }

/* PIN Locked Access Screen Styles */
.lock-icon-wrapper {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.08);
  border: 2.5px solid rgba(99, 102, 241, 0.2);
  color: var(--primary);
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 15px;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15);
  animation: pulse-glow-primary 2.5s ease-in-out infinite;
}

@keyframes pulse-glow-primary {
  0% { transform: scale(0.96); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
  70% { transform: scale(1.04); box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
  100% { transform: scale(0.96); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.lock-icon {
  width: 32px;
  height: 32px;
}

.font-sm {
  font-size: 0.85rem !important;
  max-width: 290px;
}

.pin-display {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin: 16px 0 28px 0;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background-color: transparent;
  transition: var(--transition-smooth);
}

.pin-dot.filled {
  background-color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 12px rgba(var(--primary-rgb), 0.6);
  transform: scale(1.15);
}

.pin-dot.error {
  background-color: var(--danger);
  border-color: var(--danger);
  box-shadow: 0 0 12px rgba(var(--danger-rgb), 0.6);
}

.pin-dot.success {
  background-color: var(--success);
  border-color: var(--success);
  box-shadow: 0 0 12px rgba(var(--success-rgb), 0.6);
}

/* Keypad Grid Layout */
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 240px;
  width: 100%;
  margin-bottom: 12px;
}

.key-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--neutral-200);
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 600;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  margin: 0 auto;
  transition: var(--transition-bounce);
  user-select: none;
}

.key-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: white;
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.key-btn:active {
  transform: scale(0.9) translateY(0);
  background: rgba(var(--primary-rgb), 0.2);
  border-color: rgba(var(--primary-rgb), 0.4);
}

.btn-clear {
  color: var(--neutral-400);
}
.btn-clear:hover {
  color: var(--neutral-100);
}

.btn-backspace {
  color: var(--neutral-400);
}
.btn-backspace:hover {
  color: var(--neutral-100);
}

.btn-backspace svg {
  width: 20px;
  height: 20px;
}

/* Shake Animation for incorrect PIN entry */
.shake-card {
  animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Instances List Mode Styles */
.search-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-bottom: 16px;
}

.filter-group {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 3px;
  gap: 2px;
  width: 100%;
}

.filter-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--neutral-400);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 8px 6px;
  border-radius: 9px;
  cursor: pointer;
  transition: var(--transition-smooth);
  text-align: center;
  white-space: nowrap;
}

.filter-btn:hover {
  color: var(--neutral-200);
}

.filter-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.25);
}

#search-instances {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-family: var(--font-body);
  color: white;
  outline: none;
  transition: var(--transition-smooth);
}

#search-instances:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.1);
}

.instances-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}

.instances-list::-webkit-scrollbar {
  width: 5px;
}
.instances-list::-webkit-scrollbar-track {
  background: transparent;
}
.instances-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
.instances-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.instance-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  padding: 10px 14px;
  transition: var(--transition-smooth);
}

.instance-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.09);
  transform: translateY(-1px);
}

.instance-details {
  display: flex;
  flex-direction: column;
  text-align: left;
  gap: 2px;
}

.instance-item-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--neutral-100);
}

.instance-item-phone {
  font-size: 0.72rem;
  color: var(--neutral-400);
}

.instance-status-col {
  display: flex;
  align-items: center;
  gap: 12px;
}

.instance-list-badge {
  font-size: 0.7rem;
  padding: 4px 10px;
  font-weight: 600;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.instance-list-badge.status-open {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.instance-list-badge.status-connecting {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.15);
}

.instance-list-badge.status-close {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.15);
}

.btn-manage {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--neutral-200);
  cursor: pointer;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition-smooth);
}

.btn-manage:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  transform: scale(1.03);
}

.no-instances {
  padding: 30px;
  color: var(--neutral-500);
  font-size: 0.85rem;
}

/* Universal Mobile Responsiveness Fixes */
html, body {
  overflow-x: hidden;
  width: 100%;
}

@media (max-width: 440px) {
  body {
    padding: 20px 0 !important;
  }
  .app-container {
    padding: 12px;
    gap: 15px;
  }
  
  .main-card {
    padding: 18px;
    border-radius: 20px;
    gap: 16px;
  }
  
  .view-title {
    font-size: 1.3rem;
  }
  
  .view-subtitle {
    font-size: 0.82rem;
    margin-bottom: 16px;
  }
  
  .brand-title {
    font-size: 1rem !important;
  }
  
  .brand-icon {
    width: 22px;
    height: 22px;
  }
  
  #btn-back-to-list {
    width: 32px !important;
    height: 32px !important;
    margin-right: 6px !important;
  }

  .qr-box {
    width: 180px;
    height: 180px;
    border-radius: 16px;
    padding: 10px;
  }
  
  .keypad {
    gap: 10px;
    max-width: 200px;
  }
  
  .key-btn {
    width: 50px;
    height: 50px;
    font-size: 1.15rem;
  }
  
  .pin-display {
    gap: 14px;
    margin: 12px 0 20px 0;
  }
  
  .pin-dot {
    width: 14px;
    height: 14px;
  }
  
  .details-box {
    padding: 12px 14px;
    margin-bottom: 18px;
    gap: 10px;
  }
  
  .detail-item {
    font-size: 0.8rem;
  }
  
  .btn {
    padding: 10px 18px;
    font-size: 0.85rem;
    border-radius: 12px;
  }
  
  .instances-list {
    max-height: 420px;
  }
  
  .instance-item {
    padding: 8px 12px;
    border-radius: 12px;
  }
  
  .instance-item-name {
    font-size: 0.85rem;
  }
  
  .instance-item-phone {
    font-size: 0.68rem;
  }
  
  .instance-list-badge {
    font-size: 0.65rem;
    padding: 3px 8px;
  }
  
  .btn-manage {
    padding: 5px 8px;
    font-size: 0.7rem;
  }
  
  .toast-container {
    width: calc(100% - 24px);
    bottom: 16px;
  }
  
  .toast {
    padding: 10px 14px;
    font-size: 0.78rem;
  }
}

@media (max-width: 390px) {
  .instance-item {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 12px !important;
  }
  .instance-details {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 6px;
  }
  .instance-status-col {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
  }
  .filter-btn {
    font-size: 0.72rem !important;
    padding: 8px 4px !important;
  }
}

/* Custom Confirmation Dialog */
.confirm-dialog {
  margin: auto;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 24px;
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  color: var(--neutral-100);
  max-width: 360px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
}

.confirm-dialog[open] {
  opacity: 1;
  transform: scale(1);
}

.confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: backdrop-fade 0.3s ease forwards;
}

.confirm-modal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
}

.confirm-icon-wrapper {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.15);
  border: 1.5px solid rgba(239, 68, 68, 0.25);
  color: var(--danger);
  display: flex;
  justify-content: center;
  align-items: center;
}

.confirm-icon-wrapper svg {
  width: 26px;
  height: 26px;
}

.confirm-title {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  color: var(--neutral-100);
}

.confirm-message {
  font-size: 0.88rem;
  color: var(--neutral-400);
  margin: 0;
  line-height: 1.45;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  width: 100%;
  margin-top: 8px;
}

.confirm-actions .btn {
  flex: 1;
}
