/* ==========================================================================
   CarConnect Design System & UI Stylesheet
   Mobile-First, Ultra-Responsive, Modern, Calm & Trustworthy
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Color Palette */
  --slate-950: #020617;
  --slate-900: #0f172a;
  --slate-850: #131d33;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;

  /* Accent Colors */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;

  --accent-cyan: #06b6d4;
  --accent-sky: #38bdf8;
  
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-50: #ecfdf5;
  
  --amber-500: #f59e0b;
  --amber-50: #fffbeb;
  
  --rose-500: #f43f5e;
  --rose-50: #fff1f2;

  /* Typography */
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Elevation */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--slate-50);
  color: var(--slate-800);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* iOS input auto-zoom prevention */
input, select, textarea, button {
  font-family: inherit;
  font-size: 16px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--slate-900);
  font-weight: 700;
  line-height: 1.25;
}

a {
  color: var(--primary-600);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-700);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ==========================================================================
   Layout Containers
   ========================================================================== */

.app-container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 16px;
  width: 100%;
}

@media (min-width: 768px) {
  .app-container {
    padding: 0 24px;
  }
}

/* ==========================================================================
   Navbar & Mobile Navigation
   ========================================================================== */

.navbar {
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 10px 0;
}

.navbar .nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 16px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.nav-brand .brand-badge {
  background: linear-gradient(135deg, var(--accent-sky), var(--primary-600));
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: white;
}

.nav-links-desktop {
  display: none;
  align-items: center;
  gap: 16px;
  list-style: none;
}

@media (min-width: 768px) {
  .nav-links-desktop {
    display: flex;
  }
}

.nav-links-desktop a {
  color: var(--slate-300);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-links-desktop a:hover,
.nav-links-desktop a.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-badge-count {
  background: var(--rose-500);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

/* Mobile Top Right Actions */
.nav-mobile-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (min-width: 768px) {
  .nav-mobile-right {
    display: none;
  }
}

/* Mobile Bottom Navigation Bar for Logged-in Owners */
.mobile-bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
  z-index: 99;
  justify-content: space-around;
  align-items: center;
}

@media (min-width: 768px) {
  .mobile-bottom-nav {
    display: none;
  }
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--slate-400);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 8px;
  position: relative;
  min-width: 60px;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.mobile-nav-item .nav-icon {
  font-size: 1.35rem;
  margin-bottom: 2px;
}

.mobile-nav-item.active {
  color: var(--accent-sky);
}

.mobile-nav-item .mobile-badge {
  position: absolute;
  top: 2px;
  right: 12px;
  background: var(--rose-500);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: var(--radius-full);
}

/* Body extra padding when bottom nav is present */
body.has-bottom-nav {
  padding-bottom: 74px;
}

/* Flash Messages */
.flash-container {
  max-width: 1160px;
  margin: 12px auto 0;
  padding: 0 16px;
  width: 100%;
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  animation: slideIn 0.25s ease;
}

.alert-success { background-color: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background-color: #fff1f2; color: #9f1239; border: 1px solid #fecdd3; }
.alert-warning { background-color: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background-color: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

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

/* ==========================================================================
   Buttons & UI Elements (Touch Friendly >= 44px)
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  min-height: 44px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  color: #ffffff !important;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
}

.btn-secondary {
  background: var(--slate-100);
  color: var(--slate-700) !important;
  border: 1px solid var(--slate-200);
}

.btn-secondary:hover {
  background: var(--slate-200);
  color: var(--slate-900) !important;
}

.btn-dark {
  background: var(--slate-900);
  color: #ffffff !important;
  border: 1px solid var(--slate-700);
}

.btn-dark:hover {
  background: var(--slate-800);
}

.btn-success {
  background: linear-gradient(135deg, var(--emerald-600), #047857);
  color: #ffffff !important;
}

.btn-outline-danger {
  background: transparent;
  color: var(--rose-500) !important;
  border: 1px solid var(--rose-500);
}

.btn-outline-danger:hover {
  background: var(--rose-500);
  color: #ffffff !important;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 1.02rem;
  min-height: 50px;
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: 6px 12px;
  min-height: 36px;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.btn-full-mobile {
  width: 100%;
}
@media (min-width: 640px) {
  .btn-full-mobile {
    width: auto;
  }
}

/* ==========================================================================
   Cards & Panels
   ========================================================================== */

.card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--slate-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 12px 18px;
  background: var(--slate-50);
  border-top: 1px solid var(--slate-100);
}

/* ==========================================================================
   Hero Section (Mobile Optimized)
   ========================================================================== */

.hero-section {
  background: radial-gradient(circle at top center, #1e293b 0%, #0f172a 70%, #020617 100%);
  color: #ffffff;
  padding: 44px 0 54px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

@media (min-width: 768px) {
  .hero-section {
    padding: 70px 0 80px;
  }
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--accent-sky);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 18px;
}

.hero-title {
  font-size: clamp(1.85rem, 6vw, 3.1rem);
  font-weight: 800;
  color: #ffffff;
  max-width: 840px;
  margin: 0 auto 16px;
  letter-spacing: -0.6px;
  line-height: 1.2;
}

.hero-title span {
  background: linear-gradient(135deg, var(--accent-sky) 0%, #60a5fa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: clamp(0.95rem, 3.5vw, 1.15rem);
  color: var(--slate-300);
  max-width: 640px;
  margin: 0 auto 28px;
  line-height: 1.55;
  padding: 0 8px;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 420px;
  margin: 0 auto 36px;
}

@media (min-width: 640px) {
  .hero-actions {
    flex-direction: row;
    justify-content: center;
    max-width: none;
  }
}

.hero-trust-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--slate-400);
  flex-wrap: wrap;
  padding: 0 12px;
}

.hero-trust-badges span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Feature & Step Grids */
.features-section {
  padding: 44px 0;
}

@media (min-width: 768px) {
  .features-section {
    padding: 70px 0;
  }
}

.section-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 36px;
}

.section-tag {
  color: var(--primary-600);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
  display: block;
}

.section-title {
  font-size: clamp(1.5rem, 5vw, 2.1rem);
  margin-bottom: 10px;
}

.feature-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

@media (min-width: 640px) {
  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }
}

@media (min-width: 1024px) {
  .feature-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.feature-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  border: 1px solid var(--slate-200);
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--primary-50);
  color: var(--primary-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 16px;
}

.steps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .steps-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .steps-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.step-card {
  background: #ffffff;
  padding: 22px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
}

.step-number {
  width: 32px;
  height: 32px;
  background: var(--slate-900);
  color: var(--accent-sky);
  font-weight: 800;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  font-size: 0.9rem;
}

/* ==========================================================================
   Dashboard Responsive Grid & Cards
   ========================================================================== */

.dashboard-header {
  margin: 20px 0 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (min-width: 640px) {
  .dashboard-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

@media (min-width: 480px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stat-card {
  background: #ffffff;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-val {
  font-size: 1.6rem;
  font-weight: 800;
  font-family: var(--font-heading);
  line-height: 1;
  color: var(--slate-900);
}

.stat-label {
  font-size: 0.78rem;
  color: var(--slate-500);
  font-weight: 500;
  margin-top: 2px;
}

/* Responsive Two-Column Layout for Dashboard */
.dashboard-content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 900px) {
  .dashboard-content-grid {
    grid-template-columns: 1.25fr 0.75fr;
  }
}

/* Responsive Two-Column Layout for QR View */
.qr-view-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 840px) {
  .qr-view-grid {
    grid-template-columns: 1.15fr 0.85fr;
  }
}

/* Garage Vehicle Grid */
.vehicle-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: 28px;
}

@media (min-width: 640px) {
  .vehicle-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

.vehicle-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.vehicle-banner {
  height: 130px;
  background: linear-gradient(135deg, var(--slate-900), var(--slate-800));
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.vehicle-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vehicle-plate-pill {
  background: #0f172a;
  color: #ffffff;
  font-family: monospace;
  font-weight: 700;
  letter-spacing: 0.8px;
  font-size: 0.88rem;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-active { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-inactive { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }
.badge-resolved { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-urgent { background: #fff1f2; color: #9f1239; border: 1px solid #fecdd3; }

/* Dashboard Single Vehicle Card Row */
.dash-vehicle-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

@media (min-width: 480px) {
  .dash-vehicle-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* ==========================================================================
   Scanner Mobile Interface (Outdoor & One-Handed Optimized)
   ========================================================================== */

.scanner-container {
  max-width: 500px;
  margin: 12px auto 30px;
  padding: 0 12px;
  width: 100%;
}

.scanner-header-card {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: white;
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  text-align: center;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.scanner-vehicle-plate {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-family: monospace;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  display: inline-block;
  letter-spacing: 0.8px;
  margin: 8px 0 4px;
}

.scanner-privacy-callout {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
}

/* Preset Chips */
.presets-container {
  margin-bottom: 16px;
}

.preset-chip-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}

@media (min-width: 380px) {
  .preset-chip-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.preset-chip {
  background: #ffffff;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  min-height: 48px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--slate-800);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  transition: all var(--transition-fast);
  user-select: none;
}

.preset-chip:active {
  transform: scale(0.98);
}

.preset-chip:hover {
  background: var(--slate-50);
  border-color: var(--primary-500);
}

.preset-chip.selected {
  background: var(--primary-50);
  border-color: var(--primary-600);
  color: var(--primary-700);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.preset-chip .preset-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* Photo Attach Preview Box */
.photo-attach-box {
  background: var(--slate-50);
  border: 2px dashed var(--slate-300);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 14px;
  transition: border-color var(--transition-fast);
}

.photo-attach-box:hover {
  border-color: var(--primary-500);
}

.photo-preview-wrapper {
  position: relative;
  display: inline-block;
  margin-top: 8px;
}

.photo-preview-img {
  max-height: 140px;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
}

.photo-remove-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--rose-500);
  color: white;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* ==========================================================================
   Chat Room (Mobile-App-Like Fullscreen Feel)
   ========================================================================== */

.chat-container {
  max-width: 800px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 0;
  border: none;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 54px);
  height: calc(100dvh - 54px);
  overflow: hidden;
}

@media (min-width: 768px) {
  .chat-container {
    margin: 16px auto 30px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--slate-200);
    box-shadow: var(--shadow-lg);
    height: calc(100vh - 110px);
    height: calc(100dvh - 110px);
    min-height: 520px;
  }
}

.chat-header {
  padding: 12px 16px;
  background: #0f172a;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-header .vehicle-badge {
  color: var(--accent-sky);
  font-weight: 700;
  font-size: 0.95rem;
}

.chat-messages-scroll {
  flex: 1;
  padding: 14px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
  .chat-messages-scroll {
    padding: 20px;
    gap: 14px;
  }
}

/* Chat Bubbles */
.chat-bubble-wrapper {
  display: flex;
  flex-direction: column;
  max-width: 88%;
}

@media (min-width: 640px) {
  .chat-bubble-wrapper {
    max-width: 75%;
  }
}

.chat-bubble-wrapper.incoming {
  align-self: flex-start;
}

.chat-bubble-wrapper.outgoing {
  align-self: flex-end;
}

.bubble-sender {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--slate-500);
  margin-bottom: 2px;
  padding: 0 4px;
}

.chat-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 0.92rem;
  line-height: 1.45;
  word-break: break-word;
  position: relative;
}

.incoming .chat-bubble {
  background: #ffffff;
  color: var(--slate-800);
  border: 1px solid var(--slate-200);
  border-bottom-left-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.outgoing .chat-bubble {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  color: #ffffff;
  border-bottom-right-radius: var(--radius-sm);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.2);
}

.bubble-time {
  font-size: 0.68rem;
  opacity: 0.75;
  margin-top: 3px;
  text-align: right;
}

.chat-bubble-img {
  max-width: 200px;
  border-radius: var(--radius-md);
  margin-top: 6px;
  cursor: pointer;
}

/* Phone Cards in Chat */
.phone-request-card {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 12px;
  margin: 6px 0;
  text-align: center;
  align-self: center;
  max-width: 95%;
  width: 100%;
}

.phone-reveal-card {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-md);
  padding: 12px;
  margin: 6px 0;
  text-align: center;
  align-self: center;
  max-width: 95%;
  width: 100%;
}

.phone-call-btn {
  background: var(--emerald-600);
  color: white !important;
  font-size: 1rem;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
  min-height: 44px;
  width: 100%;
  max-width: 280px;
}

/* Chat Input Bar */
.chat-input-bar {
  padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  background: #ffffff;
  border-top: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.chat-input-bar input[type="text"] {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--slate-300);
  outline: none;
  font-size: 16px; /* Prevents mobile Safari zoom */
}

.chat-input-bar input[type="text"]:focus {
  border-color: var(--primary-600);
}

/* ==========================================================================
   Modals (Mobile Responsive with Safe Max-Height)
   ========================================================================== */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-xl);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-xl);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px 20px;
  animation: slideIn 0.2s ease;
}

@media (min-width: 640px) {
  .modal-card {
    padding: 28px;
  }
}

/* ==========================================================================
   Form Styles
   ========================================================================== */

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--slate-700);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  min-height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-300);
  background: #ffffff;
  font-size: 16px; /* Prevents auto zoom */
  color: var(--slate-900);
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-control:focus {
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Horizontal Scrollable Tabs on Mobile (e.g. Inbox status filter) */
.scroll-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.scroll-tabs::-webkit-scrollbar {
  display: none;
}

/* ==========================================================================
   Printable Sticker Styles (@media print)
   ========================================================================== */

@media print {
  body * {
    visibility: hidden;
  }
  .printable-sticker-area, .printable-sticker-area * {
    visibility: visible;
  }
  .printable-sticker-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
  }
  .no-print {
    display: none !important;
  }
}

/* Footer */
.app-footer {
  margin-top: auto;
  background: #0f172a;
  color: var(--slate-400);
  padding: 24px 0 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
}

.app-footer .footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 16px;
  gap: 8px;
}

@media (min-width: 640px) {
  .app-footer .footer-inner {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}
