/* ================================================
   13AI — Premium AI-Powered Unlock Platform
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  /* ── Brand Colors ── */
  --primary: #6C5CE7;
  --primary-dark: #5A4BD1;
  --primary-light: #EDE9FF;
  --primary-glow: rgba(108, 92, 231, 0.25);
  --accent: #00D2FF;
  --accent-dark: #00B4D8;
  --accent-glow: rgba(0, 210, 255, 0.2);

  /* ── Semantic ── */
  --success: #00E676;
  --success-bg: rgba(0, 230, 118, 0.1);
  --danger: #FF5252;
  --danger-bg: rgba(255, 82, 82, 0.08);
  --warning: #FFB300;
  --warning-bg: rgba(255, 179, 0, 0.1);
  --info: #448AFF;

  /* ── Surfaces ── */
  --bg: #0D0F14;
  --bg-secondary: #141721;
  --bg-card: #1A1D28;
  --bg-card-hover: #1F2233;
  --bg-elevated: #22263A;
  --bg-input: #141721;

  /* ── Text ── */
  --text: #F0F0F5;
  --text-secondary: #8B8FA3;
  --text-muted: #5C6078;

  /* ── Borders ── */
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --border-active: rgba(108, 92, 231, 0.4);

  /* ── Shadows ── */
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(108, 92, 231, 0.15);

  /* ── Layout ── */
  --radius-xl: 24px;
  --radius-lg: 20px;
  --radius: 16px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --radius-pill: 28px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;

  /* ── Typography ── */
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', Consolas, monospace;

  /* ── Primary opacity variants ── */
  --primary-3: rgba(108, 92, 231, 0.03);
  --primary-6: rgba(108, 92, 231, 0.06);
  --primary-8: rgba(108, 92, 231, 0.08);
  --primary-10: rgba(108, 92, 231, 0.1);
  --primary-30: rgba(108, 92, 231, 0.3);
  --primary-90: rgba(108, 92, 231, 0.9);

  /* ── Chat ── */
  --chat-bot-bg: #1A1D28;
  --chat-user-bg: linear-gradient(135deg, #6C5CE7, #a855f7);
  --chat-user-text: #FFFFFF;

  /* ── Navbar ── */
  --navbar-height: 64px;
  --navbar-height-mobile: 56px;

  /* ── Glow gradients ── */
  --gradient-primary: linear-gradient(135deg, #6C5CE7 0%, #a855f7 50%, #00D2FF 100%);
  --gradient-accent: linear-gradient(135deg, #00D2FF 0%, #6C5CE7 100%);
  --gradient-surface: linear-gradient(135deg, var(--primary-6), rgba(0, 210, 255, 0.03));
}

/* ── Reset ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  height: -webkit-fill-available;
  height: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Lock viewport when chat is visible so chat-container scrolls, not the page */
body.chat-active {
  height: var(--app-height, 100dvh);
  max-height: var(--app-height, 100dvh);
  overflow: hidden;
  overscroll-behavior: none;
}

/* Lock viewport when mobile menu is open */
body.menu-open {
  overflow: hidden;
  overscroll-behavior: none;
}

/* ── Animated Background ── */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, var(--primary-8) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(0, 210, 255, 0.06) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  flex: 1;
}

body.chat-active #app {
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* ================================================
   NAVBAR
   ================================================ */
.navbar {
  background: rgba(13, 15, 20, 0.85);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  padding-left: calc(24px + env(safe-area-inset-left, 0px));
  padding-right: calc(24px + env(safe-area-inset-right, 0px));
  height: var(--navbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.3px;
  cursor: default;
  user-select: none;
  flex-shrink: 0;
}

.nav-logo {
  min-width: 38px;
  height: 38px;
  padding: 0 6px;
  background: var(--gradient-primary);
  border-radius: 10px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  color: #fff;
  box-shadow: 0 2px 12px var(--primary-glow);
  position: relative;
  overflow: hidden;
  line-height: 38px;
}

.logo-13 {
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: -0.5px;
}

.logo-ai {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.9;
}

.nav-logo::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 40%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 60%
  );
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%) rotate(45deg); }
  100% { transform: translateX(100%) rotate(45deg); }
}

.nav-title {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Hamburger Toggle (hidden on desktop) ── */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  margin: -10px;
  z-index: 102;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease;
}

.nav-toggle:hover {
  background: var(--primary-8);
}

.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform-origin: center;
}

/* ── Hamburger → X animation ── */
.nav-toggle.active .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.active .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Overlay (mobile only) ── */
.nav-overlay {
  display: none;
}

/* ── Nav Links (desktop) ── */
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  text-decoration: none;
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.2s ease, background 0.2s ease;
  white-space: nowrap;
  position: relative;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

.nav-link:hover {
  color: var(--text);
  background: var(--primary-8);
}

.nav-link.active {
  color: var(--primary);
  background: var(--primary-10);
  font-weight: 600;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

.nav-link.nav-logout {
  color: var(--danger);
  cursor: pointer;
}

.nav-link.nav-logout:hover {
  background: var(--danger-bg);
}

/* ── Tablet breakpoint (≤ 768px): show hamburger, slide-out menu ── */
@media (max-width: 768px) {
  .navbar {
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
  }

  .nav-brand {
    position: relative;
    z-index: 103;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100dvh;
    height: 100vh;
    background: rgba(13, 15, 20, 0.97);
    backdrop-filter: blur(24px) saturate(1.8);
    -webkit-backdrop-filter: blur(24px) saturate(1.8);
    border-left: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: calc(var(--navbar-height) + 16px) 16px 24px;
    z-index: 101;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .nav-links.open {
    transform: translateX(0);
  }

  .nav-link {
    padding: 14px 16px;
    font-size: 0.95rem;
    min-height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
  }

  .nav-link.active::after {
    bottom: auto;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    border-radius: 0 3px 3px 0;
  }

  .nav-link.nav-logout {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding-top: 16px;
  }

  /* ── Overlay ── */
  .nav-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    z-index: 100;
    pointer-events: none;
    transition: background 0.3s ease;
  }

  .nav-overlay.active {
    background: rgba(0, 0, 0, 0.5);
    pointer-events: auto;
  }
}

/* ================================================
   AUTH MODAL
   ================================================ */
.auth-modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 24px 16px;
}

.auth-modal-backdrop {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.auth-modal-content {
  position: relative;
  z-index: 201;
  margin: auto;
  animation: modalSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-close-btn {
  position: absolute;
  top: 16px; right: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 1.3rem;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
  z-index: 10;
}

.auth-close-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text);
  transform: scale(1.08);
}

.auth-container {
  max-width: 440px;
  margin: 0 auto;
  padding: 0 16px;
}

.auth-form {
  background: var(--bg-card);
  padding: 40px 36px 32px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.auth-form::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-primary);
}

.auth-form-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-form-header .auth-logo {
  width: 56px; height: 56px;
  background: var(--gradient-primary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 1.5rem;
  box-shadow: 0 4px 20px var(--primary-glow);
}

.auth-form-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.auth-form-header p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.auth-form h2 {
  margin-bottom: 24px;
  font-size: 1.4rem;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-switch {
  text-align: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.auth-switch a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition-fast);
}

.auth-switch a:hover {
  text-decoration: underline;
  filter: brightness(1.2);
}

.auth-features {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 20px;
  padding-top: 16px;
}

.auth-feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.auth-feature-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: var(--transition);
}

.auth-feature:hover .auth-feature-icon {
  border-color: var(--primary);
  background: var(--primary-8);
  transform: translateY(-2px);
}

/* ================================================
   FORMS
   ================================================ */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group .input-wrapper {
  position: relative;
}

.form-group .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem;
  color: var(--text-muted);
  pointer-events: none;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  transition: var(--transition);
  background: var(--bg-input);
  color: var(--text);
  font-family: inherit;
}

.form-group .has-icon input {
  padding-left: 42px;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  transition: var(--transition-fast);
}

.toggle-password:hover {
  color: var(--primary);
}

.form-hint {
  display: block;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-auth {
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  background: var(--gradient-primary);
  color: white;
  letter-spacing: 0.2px;
  box-shadow: 0 4px 20px var(--primary-glow);
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.btn-auth::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s ease;
}

.btn-auth:not(:disabled):hover::before {
  left: 100%;
}

.btn-auth:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px var(--primary-glow);
}

.btn-auth:not(:disabled):active {
  transform: translateY(0);
  box-shadow: 0 2px 12px var(--primary-glow);
}

.btn-auth:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ================================================
   BUTTONS
   ================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 2px 12px var(--primary-glow);
}

.btn-primary:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:not(:disabled):hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--border-active);
  padding: 8px 16px;
}

.btn-outline:not(:disabled):hover {
  background: var(--primary-8);
  border-color: var(--primary);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-full {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-lg);
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info { background: rgba(68, 138, 255, 0.1); color: var(--info); }

/* ================================================
   CHAT UI
   ================================================ */
.chat-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
  overflow: hidden;
}

.chat-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 16px 16px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  min-height: 0;
  /* Allow touch scrolling only within chat */
  touch-action: pan-y;
}

.chat-container::-webkit-scrollbar {
  width: 6px;
}

.chat-container::-webkit-scrollbar-track {
  background: transparent;
}

.chat-container::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 100%;
  padding-bottom: 8px;
}

.chat-messages::before {
  content: '';
  margin-top: auto;
}

/* ── Message Rows (ChatGPT-style) ── */
.chat-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 4px;
  animation: rowIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-row.user {
  justify-content: flex-end;
}

@keyframes rowIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Avatar ── */
.chat-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.6rem;
  font-weight: 800;
  margin-top: 2px;
}

.bot-avatar {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.bot-avatar span {
  line-height: 1;
}

/* ── Message Content ── */
.chat-content {
  max-width: 85%;
  min-width: 0;
}

.chat-row.user .chat-content {
  max-width: 75%;
}

/* ── Chat Bubbles ── */
.chat-bubble {
  font-size: 0.92rem;
  line-height: 1.7;
  word-break: break-word;
}

.chat-bubble.bot {
  background: transparent;
  color: var(--text);
  padding: 0;
  border: none;
  box-shadow: none;
}

.chat-bubble.user {
  background: var(--bg-elevated);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 20px;
  border-bottom-right-radius: 6px;
  border: 1px solid var(--border);
}

/* ── Device Card in Chat ── */
.chat-device-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 18px;
  margin: 12px 0;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.chat-device-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gradient-primary);
}

.chat-device-card .device-name {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text);
  letter-spacing: -0.3px;
}

.chat-device-card .device-detail {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 4px 0;
  line-height: 1.5;
}

.chat-device-card .device-detail strong {
  color: var(--text);
}

.chat-device-card .device-detail code {
  background: var(--bg-elevated);
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  word-break: break-all;
  color: var(--accent);
  border: 1px solid var(--border);
}

/* ── Unlock Gauge in Chat ── */
.chat-unlock-gauge {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin: 12px 0;
  border: 1px solid var(--border);
}

.gauge-ring {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.gauge-ring svg { width: 64px; height: 64px; }

.gauge-ring .gauge-score {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  line-height: 1;
  text-align: center;
  width: max-content;
}

.gauge-info { flex: 1; }

.gauge-info .gauge-label {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: var(--text);
}

.gauge-info .gauge-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ── Quick Reply Buttons ── */
.chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chat-quick-btn {
  padding: 8px 18px;
  border: 1px solid var(--border-active);
  border-radius: 24px;
  background: var(--bg-secondary);
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.chat-quick-btn:not(:disabled):hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--primary-glow);
}

.chat-quick-btn.success {
  border-color: rgba(0, 230, 118, 0.3);
  color: var(--success);
}

.chat-quick-btn.success:not(:disabled):hover {
  background: var(--success);
  color: #000;
  border-color: var(--success);
  box-shadow: 0 4px 16px rgba(0, 230, 118, 0.2);
}

.chat-quick-btn.danger {
  border-color: rgba(255, 82, 82, 0.3);
  color: var(--danger);
}

.chat-quick-btn.danger:not(:disabled):hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
  box-shadow: 0 4px 16px rgba(255, 82, 82, 0.2);
}

.chat-quick-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Typing Indicator ── */
.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 10px 16px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  align-self: flex-start;
  width: fit-content;
}

.typing-indicator span {
  width: 8px; height: 8px;
  background: var(--primary);
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-8px); opacity: 1; }
}

/* ── Chat Input Bar (flex child at bottom of chat-wrapper) ── */
.chat-input-bar {
  flex-shrink: 0;
  z-index: 90;
  padding: 12px 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(13, 15, 20, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
}

.chat-input-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 820px;
  margin: 0 auto;
  overflow: hidden;
  width: 100%;
}

.chat-input {
  flex: 1;
  min-width: 0;
  padding: 14px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  background: var(--bg-input);
  color: var(--text);
  transition: var(--transition);
  outline: none;
  font-family: inherit;
}

.chat-input:focus {
  border-color: var(--primary);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.chat-send-btn {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border: none;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
  box-shadow: 0 2px 12px var(--primary-glow);
  /* Prevent send button from stealing focus / dismissing mobile keyboard */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.chat-send-btn:not(:disabled):hover {
  transform: scale(1.08);
  box-shadow: 0 4px 20px var(--primary-glow);
}

.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.chat-hint {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 8px;
  padding: 0 8px;
}

.chat-hint a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.chat-hint a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ================================================
   LEGAL MODALS (Privacy & Terms)
   ================================================ */
.legal-modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 24px 16px;
}

.legal-modal-backdrop {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.legal-modal-content {
  position: relative;
  z-index: 301;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 36px 32px;
  max-width: 640px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  animation: modalSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.legal-modal-content::-webkit-scrollbar {
  width: 6px;
}

.legal-modal-content::-webkit-scrollbar-track {
  background: transparent;
}

.legal-modal-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.legal-modal-content h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 20px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.legal-body h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin: 20px 0 8px;
}

.legal-body h3:first-of-type {
  margin-top: 12px;
}

.legal-body p {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

@media (max-width: 640px) {
  .legal-modal {
    padding: 12px 8px;
  }
  .legal-modal-content {
    padding: 28px 20px 24px;
    max-height: 85vh;
    border-radius: var(--radius-lg);
  }
  .legal-modal-content h2 {
    font-size: 1.2rem;
  }
  .legal-body h3 {
    font-size: 0.9rem;
  }
  .legal-body p {
    font-size: 0.84rem;
  }
}

/* ================================================
   ORDERS PAGE
   ================================================ */
.orders-container {
  max-width: 820px;
  margin: 32px auto;
  padding: 0 20px;
}

.orders-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.orders-header h2 {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.orders-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.order-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.order-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--gradient-surface);
  opacity: 0;
  transition: var(--transition);
}

.order-card:hover::before {
  opacity: 1;
}

.order-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg);
}

.order-card.status-pending_payment { border-left-color: var(--warning); }
.order-card.status-pending { border-left-color: var(--warning); }
.order-card.status-processing { border-left-color: var(--primary); }
.order-card.status-in_progress { border-left-color: var(--accent); }
.order-card.status-unlocked { border-left-color: var(--success); }
.order-card.status-failed { border-left-color: var(--danger); }

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
  position: relative;
}

.order-card-id {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.order-status {
  padding: 4px 14px;
  border-radius: var(--radius-lg);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.order-status.pending_payment { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(255, 179, 0, 0.2); }
.order-status.pending { background: var(--warning-bg); color: var(--warning); }
.order-status.processing { background: var(--primary-10); color: var(--primary); }
.order-status.in_progress { background: var(--accent-glow); color: var(--accent); }
.order-status.unlocked { background: var(--success-bg); color: var(--success); }
.order-status.failed { background: var(--danger-bg); color: var(--danger); }
.order-status.cancelled { background: rgba(92, 96, 120, 0.1); color: var(--text-muted); }

.order-card-device {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
  position: relative;
}

.order-card-details {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  font-size: 0.85rem;
  position: relative;
}

.order-card-details .detail-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.order-card-details .detail-value {
  font-weight: 600;
  color: var(--text);
}

/* ── Animated Order Stepper ── */
.order-stepper {
  display: flex;
  align-items: center;
  margin-top: 18px;
  padding: 12px 4px;
}

.stepper-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
}

.stepper-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  transition: all 0.4s ease;
  position: relative;
}

.stepper-dot.completed {
  background: var(--success);
  color: #000;
  font-size: 0.9rem;
  box-shadow: 0 2px 12px rgba(0, 230, 118, 0.3);
}

.stepper-dot.active {
  background: var(--primary);
  color: #fff;
  font-size: 0.85rem;
  box-shadow: 0 0 0 4px var(--primary-glow);
  animation: stepperPulse 2s ease-in-out infinite;
}

.stepper-dot.upcoming {
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 2px solid var(--border);
  font-size: 0.75rem;
}

.stepper-dot.inactive {
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 2px solid var(--border);
  font-size: 0.75rem;
  opacity: 0.4;
}

.stepper-label {
  margin-top: 6px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.stepper-label.completed { color: var(--success); }
.stepper-label.active { color: var(--primary); font-weight: 800; }
.stepper-label.upcoming { color: var(--text-muted); }
.stepper-label.inactive { color: var(--text-muted); opacity: 0.4; }

.stepper-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 4px;
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  align-self: flex-start;
  margin-top: 17px;
  min-width: 24px;
}

.stepper-connector.filled {
  background: var(--success);
}

.stepper-connector-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--success), var(--primary));
  border-radius: 2px;
}

.stepper-connector.filled .stepper-connector-fill {
  width: 100%;
  animation: connectorFill 1s ease forwards;
}

/* ── Live Progress for Active Orders ── */
.order-live-progress {
  margin-top: 16px;
  padding: 16px 18px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.order-live-progress::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gradient-primary);
}

.order-progress-bar-animated {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
}

.order-progress-fill-animated {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  border-radius: 2px;
  animation: shimmerBar 2s ease-in-out infinite;
}

.order-live-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.order-elapsed {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.order-remaining {
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 600;
}

.order-activity-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  min-height: 22px;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: activityBlink 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

.activity-text {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ── Order active card glow ── */
.order-card.order-active {
  border-left-width: 4px;
  animation: cardGlow 3s ease-in-out infinite;
}

/* ── Success/Failed Banners ── */
.order-success-banner {
  margin-top: 14px;
  padding: 16px 18px;
  background: rgba(0, 230, 118, 0.06);
  border-radius: 12px;
  border: 1px solid rgba(0, 230, 118, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: successSlideIn 0.5s ease;
}

.success-checkmark {
  font-size: 1.8rem;
  animation: successBounce 0.6s ease;
}

.success-text strong {
  color: var(--success);
  display: block;
  margin-bottom: 2px;
}

.success-text p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0;
}

.order-failed-banner {
  margin-top: 14px;
  padding: 16px 18px;
  background: var(--danger-bg);
  border-radius: 12px;
  border: 1px solid rgba(255, 82, 82, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
}

.failed-icon { font-size: 1.5rem; }

.failed-text strong {
  color: var(--danger);
  display: block;
  margin-bottom: 2px;
}

.failed-text p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0;
}

/* ── Keyframe Animations ── */
@keyframes stepperPulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--primary-glow); transform: scale(1); }
  50% { box-shadow: 0 0 0 8px var(--primary-10); transform: scale(1.08); }
}

@keyframes connectorFill {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes shimmerBar {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes activityBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.7); }
}

@keyframes cardGlow {
  0%, 100% { box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
  50% { box-shadow: 0 4px 24px var(--primary-glow), var(--shadow); }
}

@keyframes successSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes successBounce {
  0% { transform: scale(0); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ── Order card actions (Pay Now) ── */
.order-card-actions {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  position: relative;
}

.btn-pay-now {
  flex: 1;
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--success), #00C853);
  color: #000;
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  font-family: inherit;
}

.btn-pay-now:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 230, 118, 0.3);
}

.btn-pay-now:active {
  transform: translateY(0);
}

.orders-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.orders-empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* ================================================
   ACCOUNT PAGE
   ================================================ */
.account-container {
  max-width: 600px;
  margin: 32px auto;
  padding: 0 20px;
}

.account-container h2 {
  margin-bottom: 24px;
  font-size: 1.3rem;
  font-weight: 800;
}

.account-info {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border);
  margin-bottom: 32px;
}

.account-field {
  display: flex;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.account-field:last-child { border-bottom: none; }

.account-field-label {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
}

.account-field-value {
  font-weight: 600;
  color: var(--text);
}

.account-password {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border);
}

.account-password h3 {
  margin-bottom: 20px;
  font-size: 1.1rem;
  font-weight: 700;
}

/* ── Pages ── */
.page { display: none; }
.page.active { display: block; }

/* Chat page needs flex to fill available height */
#pageChat.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* Hide footer when chat is active (input bar IS the bottom) */
body:has(#pageChat.active) .footer {
  display: none;
}

/* ================================================
   TOAST
   ================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  color: white;
  font-weight: 500;
  font-size: 0.92rem;
  box-shadow: var(--shadow-lg);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
  max-width: 400px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-family: inherit;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success { background: rgba(0, 230, 118, 0.9); color: #000; }
.toast.error { background: rgba(255, 82, 82, 0.9); }
.toast.info { background: var(--primary-90); }

/* ================================================
   FOOTER
   ================================================ */
.footer {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
  background: rgba(13, 15, 20, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.footer-note {
  margin-top: 6px;
  font-size: 0.72rem;
  opacity: 0.6;
}

/* ── Utilities ── */
.loading {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}

.section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ================================================
   PRICING CARD
   ================================================ */
.chat-pricing-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin: 12px 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.chat-pricing-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gradient-primary);
}

.pricing-type {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.pricing-amount {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--success), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
  line-height: 1.2;
}

.pricing-time {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.pricing-includes {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  padding: 4px 0;
}

.pricing-guarantee {
  font-size: 0.78rem;
  color: var(--warning);
  font-weight: 600;
}

/* ================================================
   CRYPTO PAYMENT CARD
   ================================================ */
.crypto-payment-card {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 179, 0, 0.2);
  border-radius: 16px;
  padding: 22px;
  margin: 14px 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.crypto-payment-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--warning), var(--accent));
}

.crypto-payment-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--text);
  margin-bottom: 12px;
  font-weight: 600;
}

.crypto-icon { font-size: 1.4em; }

.crypto-amount {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--warning);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  word-break: break-all;
}

.crypto-rate {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.crypto-address-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
}

.crypto-address {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 12px;
  word-break: break-all;
}

.crypto-address code {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--accent);
  flex: 1;
  text-align: left;
  user-select: all;
}

.crypto-copy-btn {
  background: none;
  border: none;
  font-size: 1.1em;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.crypto-copy-btn:hover {
  background: var(--bg-card-hover);
}

.crypto-copy-btn.copy-success,
.crypto-copy-amount-btn.copy-success {
  color: var(--success) !important;
  border-color: var(--success) !important;
}

.crypto-copy-amount-row {
  margin-bottom: 12px;
}

.crypto-copy-amount-btn {
  background: var(--primary-10);
  border: 1px solid var(--border-active);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.crypto-copy-amount-btn:hover {
  background: var(--primary);
  color: #fff;
}

.crypto-network-badge {
  display: inline-block;
  background: var(--warning-bg);
  border: 1px solid rgba(255, 179, 0, 0.2);
  border-radius: var(--radius-lg);
  padding: 5px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--warning);
  margin: 0 4px 12px 4px;
}

.crypto-warning {
  font-size: 0.75rem;
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid rgba(255, 82, 82, 0.15);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  line-height: 1.5;
}

.crypto-expiry {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.crypto-timer {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary);
  padding: 6px 0;
  font-family: var(--font-mono);
}

.crypto-timer.warning { color: var(--warning); }
.crypto-timer.expired { color: var(--danger); }

/* Timer progress bar */
.crypto-timer-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.crypto-timer-bar .timer-bar-fill {
  height: 100%;
  width: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 1s linear;
}

.crypto-timer-bar .timer-bar-fill.warning {
  background: var(--warning);
}

/* QR code section */
.crypto-qr-section {
  display: flex;
  justify-content: center;
  margin: 14px 0;
}

.crypto-qr-code {
  border-radius: 12px;
  border: 3px solid var(--border);
  background: #fff;
  padding: 6px;
}

/* Contract details (collapsible) */
.crypto-contract-details {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-align: left;
}

.crypto-contract-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 4px 0;
  user-select: none;
}

.crypto-contract-details code {
  display: block;
  margin-top: 6px;
  font-size: 0.72rem;
  word-break: break-all;
  background: var(--bg-elevated);
  padding: 8px 10px;
  border-radius: 6px;
  font-family: var(--font-mono);
  color: var(--accent);
}

/* Price breakdown */
.crypto-price-breakdown {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding: 6px 12px;
  background: var(--bg-elevated);
  border-radius: 6px;
}

/* Payment progress steps */
.payment-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 8px;
  padding: 10px 0;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 60px;
}

.progress-step .step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.progress-step.active .step-num {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 3px var(--primary-10);
}

.progress-step.completed .step-num {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.progress-step .step-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
}

.progress-step.active .step-label {
  color: var(--primary);
}

.progress-step.completed .step-label {
  color: var(--success);
}

.progress-connector {
  width: 32px;
  height: 2px;
  background: var(--border);
  margin: 0 4px;
  margin-bottom: 18px;
}

.progress-step.completed + .progress-connector,
.progress-connector:has(+ .progress-step.active) {
  background: var(--primary);
}

/* Payment summary bar (replaces repeated device cards) */
.payment-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin: 8px 0;
  font-size: 0.82rem;
}

.payment-summary-bar .summary-price {
  font-weight: 700;
  color: var(--success);
}

/* Recommended network badge */
.network-select-btn.recommended {
  border-color: var(--primary);
  background: var(--primary-6);
}

.network-select-btn .rec-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-10);
  padding: 1px 8px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ================================================
   TOKEN / NETWORK SELECTORS
   ================================================ */
.token-selector,
.network-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.network-select-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  font-family: inherit;
}

.network-select-btn:hover {
  border-color: var(--primary);
  background: var(--primary-6);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.network-select-btn:active {
  transform: translateY(0);
}

.network-select-btn .network-icon {
  font-size: 1.8em;
  width: 40px;
  text-align: center;
  flex-shrink: 0;
}

.network-select-btn .network-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.network-select-btn .network-info strong {
  font-size: 1rem;
  color: var(--text);
}

.network-select-btn .network-info small {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.token-select-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  font-family: inherit;
}

.token-select-btn:hover {
  border-color: var(--primary);
  background: var(--primary-6);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.token-select-btn:active {
  transform: translateY(0);
}

.token-select-btn .token-icon {
  font-size: 1.6em;
  width: 36px;
  text-align: center;
  flex-shrink: 0;
}

.token-select-btn .token-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.token-select-btn .token-info strong {
  font-size: 0.95rem;
  color: var(--text);
}

.token-select-btn .token-info small {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.token-select-btn .token-price {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ================================================
   ADMIN PANEL
   ================================================ */
.admin-container {
  max-width: 1100px;
  margin: 28px auto;
  padding: 0 20px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.admin-header h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
}

.admin-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 3px;
  border: 1px solid var(--border);
}

.admin-tab {
  padding: 8px 18px;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition);
  font-family: inherit;
}

.admin-tab:hover {
  color: var(--text);
  background: var(--primary-6);
}

.admin-tab.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; }

/* Stats Grid */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.admin-stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 22px;
  border: 1px solid var(--border);
  text-align: center;
  transition: var(--transition);
}

.admin-stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.admin-stat-card .stat-icon { font-size: 1.8rem; margin-bottom: 8px; }
.admin-stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}
.admin-stat-card .stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Controls Row */
.admin-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.admin-search {
  flex: 1;
  min-width: 200px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  background: var(--bg-input);
  color: var(--text);
  font-family: inherit;
}

.admin-search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.admin-filter {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  background: var(--bg-input);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

/* Table */
.admin-table-wrap { overflow-x: auto; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.admin-table th {
  text-align: left;
  padding: 12px 14px;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-secondary);
}

.admin-table tr:hover {
  background: var(--primary-3);
}

.admin-table .mono {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
}

.admin-table .btn-action {
  padding: 6px 14px;
  border: 1px solid var(--border-active);
  background: transparent;
  color: var(--primary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  transition: var(--transition);
  font-family: inherit;
}

.admin-table .btn-action:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Pagination */
.admin-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
}

.admin-pagination button {
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-secondary);
  transition: var(--transition);
  font-family: inherit;
}

.admin-pagination button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.admin-pagination button.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.admin-pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.admin-section { margin-top: 12px; }

.admin-section h3 {
  margin-bottom: 12px;
  font-size: 1.05rem;
  font-weight: 700;
}

.admin-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

/* ================================================
   WALLET PAGE
   ================================================ */
.wallet-container {
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 16px;
}

.wallet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.wallet-header h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
}

.wallet-balance-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.wallet-balance-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 22px;
  text-align: center;
  border: 1px solid var(--border);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.wallet-balance-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  opacity: 0.5;
}

.wallet-balance-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.wallet-balance-card.on-hold {
  border-left: 3px solid var(--warning);
}
.wallet-balance-card.on-hold::before { background: var(--warning); }

.wallet-balance-card.available {
  border-left: 3px solid var(--success);
}
.wallet-balance-card.available::before { background: var(--success); }

.wallet-balance-card.withdrawn {
  border-left: 3px solid var(--primary);
}
.wallet-balance-card.withdrawn::before { background: var(--primary); }

.wallet-balance-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.wallet-balance-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 600;
}

.wallet-balance-amount {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.wallet-balance-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.wallet-info-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--primary-6);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 24px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.wallet-info-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* Withdraw Section */
.wallet-withdraw-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.wallet-withdraw-section h3 {
  margin: 0 0 16px 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.wallet-withdraw-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.wallet-withdraw-form .form-group {
  margin: 0;
}

.wallet-withdraw-form .form-group:first-child {
  grid-column: 1;
}

.wallet-withdraw-form .form-group:nth-child(2) {
  grid-column: 1 / -1;
}

.wallet-withdraw-form input,
.wallet-withdraw-form select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.92rem;
  font-family: inherit;
  background: var(--bg-input);
  color: var(--text);
}

.wallet-withdraw-form input:focus,
.wallet-withdraw-form select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn-withdraw {
  grid-column: 1 / -1;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  background: var(--gradient-primary);
  color: white;
  transition: var(--transition);
  font-family: inherit;
  box-shadow: 0 2px 12px var(--primary-glow);
}

.btn-withdraw:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-withdraw:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Withdraw notice */
.wallet-withdraw-notice {
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.88rem;
  line-height: 1.5;
  margin-bottom: 16px;
}

.wallet-withdraw-notice.notice-info {
  background: var(--primary-6);
  border: 1px solid var(--border-active);
  color: var(--text-secondary);
}

.wallet-withdraw-notice.notice-pending {
  background: var(--warning-bg);
  border: 1px solid rgba(255, 179, 0, 0.2);
  color: var(--warning);
}

.wallet-withdraw-form input:disabled,
.wallet-withdraw-form select:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--bg);
}

/* Pending Withdrawal Notice */
.wallet-pending-withdrawal {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--warning-bg);
  border: 1px solid rgba(255, 179, 0, 0.2);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 24px;
}

.wallet-pending-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.wallet-pending-text strong {
  display: block;
  margin-bottom: 4px;
  color: var(--warning);
}

.wallet-pending-text p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* Transaction History */
.wallet-history {
  margin-top: 4px;
}

.wallet-history h3 {
  margin-bottom: 16px;
  font-size: 1.1rem;
  font-weight: 700;
}

.wallet-tx-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wallet-tx-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  transition: var(--transition);
}

.wallet-tx-item:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
}

.wallet-tx-item.tx-credit { border-left: 3px solid var(--primary); }
.wallet-tx-item.tx-release { border-left: 3px solid var(--success); }
.wallet-tx-item.tx-refund { border-left: 3px solid var(--warning); }
.wallet-tx-item.tx-withdrawal { border-left: 3px solid var(--accent); }

.wallet-tx-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.wallet-tx-type {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
}

.wallet-tx-amount {
  font-weight: 700;
  font-size: 1.02rem;
}

.wallet-tx-amount.positive { color: var(--success); }
.wallet-tx-amount.negative { color: var(--danger); }

.wallet-tx-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.wallet-tx-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 6px;
}

.wallet-tx-detail a {
  text-decoration: none;
  color: var(--primary);
}

.wallet-tx-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}

.wallet-tx-status.status-pending {
  background: var(--warning-bg);
  color: var(--warning);
}

.wallet-tx-status.status-rejected {
  background: var(--danger-bg);
  color: var(--danger);
}

.wallet-tx-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.wallet-tx-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-tx-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ================================================
   RESPONSIVE — MOBILE-FIRST OPTIMIZATION
   ================================================ */
@media (max-width: 768px) {
  .section {
    padding-top: var(--navbar-height);
  }

  .wallet-balance-grid {
    grid-template-columns: 1fr;
  }
  .wallet-withdraw-form {
    grid-template-columns: 1fr;
  }
  .wallet-withdraw-form .form-group:first-child {
    grid-column: 1;
  }
  .wallet-withdraw-form .form-group:nth-child(2) {
    grid-column: 1;
  }
  .wallet-tx-details {
    flex-direction: column;
    gap: 4px;
  }
  .admin-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .admin-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .admin-controls {
    flex-direction: column;
  }
  .admin-search {
    min-width: 100%;
  }

  /* Payment responsive */
  .crypto-payment-card {
    padding: 16px;
    margin: 10px 0;
  }

  .crypto-amount {
    font-size: 1.2rem;
  }

  .crypto-address code {
    font-size: 0.68rem;
  }

  .payment-progress {
    gap: 0;
  }

  .progress-step {
    min-width: 50px;
  }

  .progress-connector {
    width: 20px;
  }

  .network-select-btn {
    padding: 10px 14px;
    gap: 10px;
  }

  .network-select-btn .network-icon {
    font-size: 1.4em;
    width: 32px;
  }

  .token-select-btn {
    padding: 10px 12px;
    gap: 8px;
  }

  .crypto-qr-code {
    width: 130px;
    height: 130px;
  }

  .payment-summary-bar {
    font-size: 0.78rem;
    padding: 8px 12px;
  }
}

@media (max-width: 640px) {
  :root {
    --navbar-height: var(--navbar-height-mobile);
  }

  .navbar {
    padding: 0 12px;
    padding-left: calc(12px + env(safe-area-inset-left, 0px));
    padding-right: calc(12px + env(safe-area-inset-right, 0px));
  }

  .nav-brand {
    gap: 8px;
    font-size: 1rem;
  }

  .nav-logo {
    min-width: 34px;
    height: 34px;
    padding: 0 5px;
    border-radius: 8px;
  }

  .nav-logo::after {
    animation: none;
  }

  .logo-13 {
    font-size: 1rem;
  }

  .logo-ai {
    font-size: 0.55rem;
  }

  .auth-container {
    margin: 0 auto;
    padding: 0 8px;
    max-width: 100%;
  }

  .auth-form {
    padding: 28px 20px 24px;
    border-radius: var(--radius-lg);
  }

  .auth-form-header .auth-logo {
    width: 48px;
    height: 48px;
    font-size: 1.3rem;
    border-radius: var(--radius-md);
  }

  .auth-form-header h2 {
    font-size: 1.25rem;
  }

  .auth-features {
    gap: 16px;
  }

  .auth-feature {
    font-size: 0.68rem;
  }

  .auth-feature-icon {
    width: 30px;
    height: 30px;
    font-size: 0.9rem;
  }

  /* Chat — Mobile optimized */
  .chat-row {
    gap: 8px;
    padding: 10px 2px;
  }

  .chat-avatar {
    width: 26px;
    height: 26px;
    font-size: 0.55rem;
  }

  .chat-content {
    max-width: 88%;
  }

  .chat-row.user .chat-content {
    max-width: 80%;
  }

  .chat-bubble {
    font-size: 0.88rem;
  }

  .chat-bubble.user {
    padding: 10px 14px;
  }

  .chat-input {
    padding: 12px 16px;
    font-size: 16px; /* Prevents iOS zoom on focus */
    border-radius: var(--radius-xl);
  }

  .chat-send-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
  }

  .chat-send-btn svg {
    width: 18px;
    height: 18px;
  }

  .chat-device-card {
    padding: 14px;
  }

  .chat-input-bar {
    padding: 10px 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .chat-input-wrapper {
    gap: 8px;
  }

  .chat-hint {
    font-size: 0.68rem;
    margin-top: 6px;
  }

  .chat-container {
    padding: 16px 12px 12px;
  }

  .chat-unlock-gauge {
    padding: 12px 14px;
    gap: 10px;
  }

  .gauge-ring {
    width: 52px;
    height: 52px;
  }

  .gauge-ring svg {
    width: 52px;
    height: 52px;
  }

  .gauge-ring .gauge-score {
    font-size: 0.7rem;
  }

  .chat-quick-replies {
    gap: 6px;
  }

  .chat-quick-btn {
    padding: 7px 14px;
    font-size: 0.82rem;
  }

  /* Payment — Small screens */
  .crypto-payment-card {
    padding: 14px;
    border-radius: 12px;
  }

  .crypto-amount {
    font-size: 1.1rem;
  }

  .crypto-address {
    padding: 8px 10px;
  }

  .crypto-address code {
    font-size: 0.65rem;
  }

  .crypto-qr-code {
    width: 120px;
    height: 120px;
  }

  .payment-progress {
    padding: 6px 0;
  }

  .progress-step {
    min-width: 44px;
  }

  .progress-step .step-num {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
  }

  .progress-step .step-label {
    font-size: 0.6rem;
  }

  .progress-connector {
    width: 16px;
    margin-bottom: 14px;
  }

  .network-select-btn {
    padding: 10px 12px;
    gap: 8px;
  }

  .network-select-btn .network-icon {
    font-size: 1.3em;
    width: 28px;
  }

  .token-select-btn {
    padding: 10px 10px;
    gap: 6px;
  }

  .payment-summary-bar {
    font-size: 0.75rem;
    padding: 8px 10px;
  }

  /* Orders — Mobile */
  .order-card {
    padding: 18px;
  }

  .order-card-details {
    grid-template-columns: 1fr;
  }

  .stepper-dot {
    width: 28px;
    height: 28px;
    font-size: 0.65rem;
  }

  .stepper-label {
    font-size: 0.55rem;
  }

  .stepper-connector {
    min-width: 14px;
    margin-top: 13px;
  }

  .order-live-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .order-activity-msg {
    font-size: 0.72rem;
  }

  .account-container {
    margin: 20px auto;
    padding: 0 12px;
  }

  .orders-container {
    margin: 20px auto;
    padding: 0 12px;
  }

  .orders-header h2,
  .account-container h2 {
    font-size: 1.1rem;
  }

  .wallet-container {
    padding: 16px 12px;
  }

  .wallet-header h2 {
    font-size: 1.1rem;
  }

  .admin-container {
    margin: 16px auto;
    padding: 0 12px;
  }

  .admin-header h2 {
    font-size: 1.1rem;
  }

  .admin-tabs {
    flex-wrap: wrap;
    gap: 4px;
  }

  .admin-tab {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  /* Crypto — Mobile */
  .crypto-payment-card { padding: 16px; }
  .crypto-amount { font-size: 1.3rem; }
  .crypto-address code { font-size: 0.68rem; }

  /* Token/Network selectors — Mobile */
  .token-select-btn { padding: 10px 12px; gap: 10px; }
  .token-select-btn .token-icon { font-size: 1.3em; width: 28px; }
  .token-select-btn .token-price { font-size: 0.78em; }
  .network-select-btn { padding: 11px 14px; gap: 10px; }
  .network-select-btn .network-icon { font-size: 1.4em; width: 32px; }

  /* Pricing — Mobile */
  .chat-pricing-card { padding: 16px; }
  .pricing-amount { font-size: 1.8rem; }

  /* Toast — Mobile */
  .toast {
    left: 12px;
    right: 12px;
    bottom: 16px;
    max-width: none;
    text-align: center;
    font-size: 0.85rem;
    padding: 12px 16px;
  }

  /* Auth modal — Mobile full-screen */
  .auth-modal {
    padding: 16px 12px;
    align-items: flex-start;
    padding-top: 48px;
  }

  .auth-modal-content {
    width: 100%;
    max-width: 100%;
  }
}

/* ── Extra-small screens (< 380px) ── */
@media (max-width: 380px) {
  .navbar {
    padding: 0 8px;
    padding-left: calc(8px + env(safe-area-inset-left, 0px));
    padding-right: calc(8px + env(safe-area-inset-right, 0px));
  }

  .chat-row {
    gap: 6px;
    padding: 8px 2px;
  }

  .chat-avatar {
    width: 24px;
    height: 24px;
    font-size: 0.5rem;
  }

  .chat-content {
    max-width: 92%;
  }

  .chat-row.user .chat-content {
    max-width: 85%;
  }

  .chat-bubble {
    font-size: 0.85rem;
  }

  .chat-bubble.user {
    padding: 10px 12px;
  }

  .chat-quick-btn {
    padding: 7px 14px;
    font-size: 0.78rem;
  }

  .chat-input {
    padding: 10px 14px;
    font-size: 16px;
  }

  .chat-send-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  .chat-send-btn svg {
    width: 16px;
    height: 16px;
  }

  .chat-input-bar {
    padding: 8px 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .chat-input-wrapper {
    gap: 6px;
  }

  .chat-device-card {
    padding: 12px;
  }

  .chat-device-card .device-name {
    font-size: 1rem;
  }

  .chat-device-card .device-detail {
    font-size: 0.8rem;
  }

  .chat-device-card .device-detail code {
    font-size: 0.75rem;
    padding: 1px 6px;
  }

  .auth-form {
    padding: 24px 16px 20px;
  }

  .auth-modal-content {
    margin: 16px 8px;
  }

  .wallet-balance-card {
    padding: 14px;
  }

  .pricing-amount {
    font-size: 1.5rem;
  }
}

/* ── Safe area insets for modern mobile devices ── */
@supports (padding: env(safe-area-inset-bottom)) {
  .footer {
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
}

/* ── Focus styles for keyboard navigation ── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── Selection style ── */
::selection {
  background: var(--primary-30);
  color: var(--text);
}

/* ── Cleaner mobile taps ── */
a, button, [role="button"], [role="menuitem"], input, select, textarea {
  -webkit-tap-highlight-color: transparent;
}

/* ── Utility classes for JS-generated markup ── */
.crypto-contract-code { font-size: 0.78em; }
.tx-link { color: var(--primary); text-decoration: none; font-size: 0.82em; }
.tx-link:hover { text-decoration: underline; }
.error-text { color: var(--danger); }

/* ── Reduce motion for accessibility ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ================================================
   PRINT STYLESHEET
   ================================================ */
@media print {
  body {
    background: #fff;
    color: #000;
  }

  body::before,
  .navbar,
  .footer,
  .chat-input-bar,
  .chat-send-btn,
  .btn-auth,
  .btn-pay-now,
  .btn-withdraw,
  .btn,
  .auth-modal,
  .toast {
    display: none !important;
  }

  .order-card,
  .wallet-tx-item,
  .admin-stat-card,
  .chat-device-card,
  .crypto-payment-card {
    break-inside: avoid;
    border: 1px solid #ccc;
    box-shadow: none;
    background: #fff;
    color: #000;
  }

  .order-card-device,
  .order-card-id,
  .wallet-tx-type,
  .wallet-tx-amount,
  .admin-stat-card .stat-value {
    color: #000;
  }

  a {
    text-decoration: underline;
    color: #000;
  }

  .page {
    display: block !important;
  }
}