/* Global theme - Enhanced modern palette */
:root {
  --bg: #0a0e1a;
  --bg-gradient: radial-gradient(1400px 900px at 15% -10%, #0f172a 0%, var(--bg) 45%),
                 radial-gradient(1200px 800px at 85% 120%, #1e1b4b 0%, transparent 40%),
                 linear-gradient(180deg, #020617 0%, var(--bg) 100%);
  --panel: linear-gradient(145deg, rgba(30, 41, 59, 0.4) 0%, rgba(15, 23, 42, 0.6) 100%);
  --panel-solid: #1e293b;
  --panel-2: #0f1629;
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --muted: #94a3b8;
  --muted-light: #64748b;
  --primary: #6366f1;
  --primary-light: #8b5cf6;
  --primary-dark: #4f46e5;
  --primary-600: #4f46e5;
  --accent: #06b6d4;
  --accent-light: #22d3ee;
  --accent-pink: #ec4899;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --border: rgba(148, 163, 184, 0.1);
  --border-light: rgba(148, 163, 184, 0.2);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.4);
  --glow: 0 0 20px rgba(99, 102, 241, 0.3);
  --glass: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Noto Sans, Ubuntu, Cantarell, Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg-gradient);
  color: var(--text);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 96px 16px 120px;
}
/* Ensure content doesn't slide under the topbar */
.has-topbar .container { padding-top: calc(80px + var(--topbar-extra, 0px)); }

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 16px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

h1 { 
  font-size: clamp(24px, 4vw, 36px); 
  font-weight: 800;
  color: var(--text);
}
h2 { 
  font-size: clamp(18px, 3vw, 24px); 
  color: var(--text-secondary); 
  font-weight: 700; 
  margin-top: 32px; 
}
h3 { 
  font-size: clamp(16px, 2.5vw, 20px); 
  color: var(--text-secondary);
  font-weight: 600;
}

.muted { color: var(--muted); }
.text-gradient {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Utility */
.hidden { display: none !important; }

/* Cards - Enhanced with glassmorphism */
.card {
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-border), transparent);
  opacity: 0.6;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-light);
}

.card + .card { margin-top: 20px; }

/* Buttons - Enhanced modern design */
.button, .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  box-shadow: var(--shadow), 0 0 0 1px rgba(99, 102, 241, 0.2);
  position: relative;
  overflow: hidden;
}

.button::before, .btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.button:hover::before, .btn:hover::before {
  left: 100%;
}

.button.small { 
  padding: 10px 16px; 
  font-size: 14px; 
  border-radius: 10px; 
}
.actions .button.small { min-height: 40px; }

.button:hover, .btn:hover { 
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-lg), var(--glow);
}
.button:active, .btn:active { 
  transform: translateY(0) scale(1);
  transition: all 0.1s;
}

.button.secondary {
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
}

.button.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-light);
}

.button.accent { 
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%); 
  color: #0a0e1a; 
  box-shadow: var(--shadow), 0 0 20px rgba(6, 182, 212, 0.4);
}

.button.accent:hover {
  box-shadow: var(--shadow-lg), 0 0 30px rgba(6, 182, 212, 0.6);
}

.button.full { width: 100%; justify-content: center; }

/* Inputs - Enhanced modern design */
input[type="text"], input[type="email"], input[type="password"], textarea, select, input[type="file"] {
  width: 100%;
  padding: 14px 16px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  outline: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 15px;
}

input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1), var(--shadow-sm);
  background: rgba(255, 255, 255, 0.08);
}

input[type="text"]::placeholder, input[type="email"]::placeholder, input[type="password"]::placeholder, textarea::placeholder { 
  color: var(--muted); 
  transition: color 0.3s ease;
}

input[type="text"]:focus::placeholder, input[type="email"]:focus::placeholder, input[type="password"]:focus::placeholder, textarea:focus::placeholder {
  color: var(--muted-light);
}

/* Readonly inputs (used when email is confirmed) */
input[readonly] {
  opacity: 0.9;
}

/* Categories textarea sizing */
#categoriesInput {
  font-size: clamp(15px, 1.2vw, 18px);
  line-height: 1.5;
  min-height: 52px;
  max-height: 60vh;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Alerts */
.alert { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: rgba(245, 158, 11, 0.08); color: #fbbf24; }
.alert.alert-success { background: rgba(34, 197, 94, 0.08); color: #86efac; }
.alert.alert-danger { background: rgba(239, 68, 68, 0.08); color: #fca5a5; }

/* Progress */
.progress { width: 100%; height: 8px; border-radius: 999px; background: #0c1322; border: 1px solid var(--border); overflow: hidden; }
.progress .progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.3s ease; }

/* List */
ul.clean { list-style: none; padding-left: 0; margin: 8px 0 0; }
ul.clean li { padding: 6px 10px; border: 1px solid var(--border); border-radius: 10px; background: #0c1322; margin-bottom: 6px; color: var(--muted); }

/* Chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--border); background: #0c1322; color: var(--muted); cursor: pointer; transition: background .2s ease, color .2s ease, border-color .2s ease; }
.chip .icon { font-size: 16px; line-height: 0; }
.chip:hover { border-color: rgba(59,130,246,0.5); }
.chip.selected { background: rgba(59,130,246,0.15); color: #dbeafe; border-color: rgba(59,130,246,0.65); }

/* Toasts */
.toast-container { position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 1002; }
.toast { padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: #0c1322; color: var(--text); box-shadow: var(--shadow); transition: opacity .25s ease, transform .25s ease; }
.toast.success { border-color: rgba(34,197,94,0.5); background: rgba(34,197,94,0.12); color: #a7f3d0; }
.toast.error { border-color: rgba(239,68,68,0.5); background: rgba(239,68,68,0.12); color: #fecaca; }
.toast.info { border-color: rgba(59,130,246,0.5); background: rgba(59,130,246,0.12); color: #bfdbfe; }

/* Spinner */
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.35); border-top-color: white; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Chat launcher */
#openChatBtn.chat-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-600) 100%);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.45);
  z-index: 1003;
}

/* Chat modal/panel */
#chatModal.chat-modal {
  position: fixed;
  right: 20px;
  bottom: calc(108px + env(safe-area-inset-bottom));
  width: 380px;
  height: auto;
  max-height: min(520px, calc(100dvh - 140px));
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: none;
  overflow: hidden;
  z-index: 1002;
}

#chatModal.chat-modal.open {
  display: grid;
  grid-template-rows: 48px 1fr auto;
}

/* Duplicate modal reuse chat-modal styles but centered */
#duplicateModal.chat-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 520px;
  max-width: calc(100% - 24px);
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 1002;
  display: flex;
  flex-direction: column;
}

/* Local picker modal - centered, like duplicate modal */
#localPickerModal.chat-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 520px;
  max-width: calc(100% - 24px);
  max-height: calc(100dvh - 24px);
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 1002;
  display: flex;
  flex-direction: column;
}

#duplicateModal .chat-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

#localPickerModal .chat-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

#dupMessage {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#duplicateModal .actions { flex-wrap: wrap; }

@media (max-width: 520px) {
  #duplicateModal .actions .btn { flex: 1 1 100%; justify-content: center; }
}

.chat-backdrop { position: fixed; inset: 0; background: rgba(2,6,23,0.55); backdrop-filter: blur(4px); display: none; z-index: 1001; }

/* Backdrop for hamburger menu dropdown */
#menuBackdrop { position: fixed; inset: 0; background: rgba(2,6,23,0.55); backdrop-filter: blur(4px); display: none; z-index: 1000; }

.chat-header {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}

#chatWindow {
  min-height: 0;
  height: auto;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#chatWindow .chat-tip {
  align-self: center;
  font-size: 13px;
  color: var(--muted);
  background: rgba(148, 163, 184, 0.08);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  max-width: 90%;
  text-align: center;
}

.chat-input {
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: end;
}

#chatInput {
  resize: none;
  min-height: 38px;
  max-height: 120px;
}

#sendChatBtn, #voiceChatBtn, #closeChatBtn {
  height: 38px;
}
#voiceChatBtn.listening {
  background: var(--danger);
  color: #fff;
}

/* Message bubbles */
.message { display: flex; align-items: flex-start; gap: 8px; }
.message .avatar {
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%;
  background: #0b1220; border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px;
}
.message .bubble {
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border);
  background: #0c1322; color: var(--text); max-width: 78%; position: relative;
}
.message.user { flex-direction: row-reverse; }
.message.user .bubble { background: rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.35); }
.message.user .avatar { background: rgba(59,130,246,0.15); border-color: rgba(59,130,246,0.35); color: #93c5fd; }

/* Typing dots */
.typing { display: inline-flex; gap: 2px; align-items: center; }
.typing .dot { width: 6px; height: 6px; background: var(--muted); border-radius: 50%; opacity: 0.4; animation: blink 1.4s infinite; }
.typing .dot:nth-child(2) { animation-delay: 0.2s; }
.typing .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }

/* Camera page */
.camera-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.video-frame, .image-frame { border: 1px solid var(--border); background: #0c1322; border-radius: 14px; padding: 10px; }
#video, #capturedImage { width: 100%; height: 420px; object-fit: cover; border-radius: 10px; display: block; will-change: transform; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

/* Advanced camera overlays */
.video-frame { position: relative; overflow: hidden; }
.camera-overlay { position: absolute; inset: 10px; border-radius: 10px; overflow: hidden; pointer-events: none; }
.camera-overlay .grid { position: absolute; inset: 0; background:
  linear-gradient(to right, rgba(255,255,255,0.08) 1px, transparent 1px) 0 0 / calc(100%/3) 100%,
  linear-gradient(to bottom, rgba(255,255,255,0.08) 1px, transparent 1px) 0 0 / 100% calc(100%/3);
  opacity: 0.5; }
.focus-ring { position: absolute; width: 72px; height: 72px; border-radius: 999px; border: 2px solid #22d3ee; box-shadow: 0 0 0 2px rgba(34,211,238,0.25); transform: translate(-50%, -50%); transition: opacity .25s ease, transform .12s ease; }
.zoom-ui { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); padding: 6px 10px; background: rgba(0,0,0,0.35); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid var(--glass-border); border-radius: 999px; display: flex; align-items: center; gap: 10px; pointer-events: auto; }
.zoom-ui input[type="range"] { appearance: none; width: 200px; height: 4px; border-radius: 999px; background: rgba(255,255,255,0.2); outline: none; }
.zoom-ui input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-light)); box-shadow: 0 2px 6px rgba(0,0,0,0.35); cursor: pointer; }
.zoom-ui input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-light)); border: 0; box-shadow: 0 2px 6px rgba(0,0,0,0.35); cursor: pointer; }

/* Dropzone */
.dropzone { margin-top: 8px; border: 1px dashed rgba(148,163,184,0.35); background: #0b1220; color: #94a3b8; padding: 18px; border-radius: 12px; text-align: center; cursor: pointer; }
.dropzone.dragover { border-color: #60a5fa; background: rgba(59,130,246,0.08); color: #cfe1ff; }
.preview-image { max-width: 220px; border-radius: 10px; border: 1px solid var(--border); display: block; }

/* Add landing/sign-in hero styles */
.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: center;
  justify-items: center;
  text-align: center;
  margin-top: 40px;
  min-height: calc(100vh - 200px);
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: 50%;
  width: 800px;
  height: 800px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
  filter: blur(40px);
  z-index: -1;
}
.hero .brand { display: none; }
.hero .brand-logo { width: 42px; height: 42px; border-radius: 10px; box-shadow: 0 8px 18px rgba(37,99,235,.35); }
.hero h1.title {
  font-size: clamp(28px, 5.5vw, 48px);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  text-wrap: balance;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  color: var(--text);
  position: relative;
  z-index: 1;
}
@media (min-width: 1100px) {
  /* Allow wrapping even on large screens to avoid overflow in edge cases */
  .hero h1.title { white-space: normal; }
}
.hero p.tagline {
  font-size: clamp(15px, 2.5vw, 18px);
  color: #cbd5e1;
  font-weight: 400;
  text-align: center;
  max-width: 60ch;
  margin: 0 auto 8px;
}

/* Hide hero illustration on sign-in as requested */
.hero-illustration { display: none; }

/* Steps grid for logged-in flow */
.steps-grid { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: stretch; justify-content: center; }
.logged-in .steps-grid { min-height: auto; align-content: start; }
@media (min-width: 980px) {
  .steps-grid { grid-template-columns: repeat(2, minmax(360px, 1fr)); align-items: start; justify-content: center; }
  /* Keep all step cards visually aligned at the top on desktop */
  .steps-grid > .card { height: 300px; min-height: 300px; align-items: center; justify-content: center; }
  /* Let Step 3 card auto-grow to fit textarea content */
  #step3Card { height: auto; min-height: 300px; }
}
@media (min-width: 1400px) {
  .steps-grid { grid-template-columns: repeat(2, minmax(460px, 1fr)); gap: 24px; justify-content: center; align-items: stretch; }
}

/* Ensure step cards have equal height and consistent spacing */
.steps-grid > .card { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; margin: 0; padding: 22px 24px; border: 1px solid rgba(148,163,184,0.08); transition: border-color .2s ease, box-shadow .2s ease, transform .06s ease; min-height: 240px; }
.steps-grid > .card:hover { border-color: rgba(59,130,246,0.35); box-shadow: 0 10px 26px rgba(37,99,235,0.25); transform: translateY(-1px); }
.steps-grid > .card h2 { margin: 0 0 8px; font-size: 22px; }
.steps-grid > .card p { margin: 4px 0; }
.steps-grid > .card .actions { margin-top: 6px; justify-content: center; }
/* Center chips in step cards */
.steps-grid .chip-row { justify-content: center; }
/* Ensure consistent spacing after grid before next section */
.steps-grid + .card { margin-top: 16px; }

/* Larger type scale on very large screens */
@media (min-width: 1400px) {
  body { font-size: 18px; }
  h1 { font-size: 32px; }
  h2 { font-size: 24px; }
  .logged-in .card h2 { font-size: 22px; }
}

@media (min-width: 1800px) {
  body { font-size: 19px; }
}

/* Benefits under title */
.benefits { list-style: none; padding: 0; margin: 16px 0 20px; display: grid; gap: 10px; justify-content: center; }
.benefits li { display: flex; align-items: center; gap: 10px; color: #cbd5e1; justify-content: center; }
.benefits li .check { width: 10px; height: 10px; border-radius: 50%; background: linear-gradient(180deg, var(--primary), var(--accent)); box-shadow: 0 0 0 4px rgba(59,130,246,0.15); }
.benefits li .icon { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }

.signin-panel { background: linear-gradient(180deg, rgba(18,24,38,0.85) 0%, rgba(14,21,35,0.85) 100%); backdrop-filter: blur(8px); border: 1px solid var(--border); border-radius: 18px; padding: 22px; box-shadow: var(--shadow); }
.signin-panel h3 { margin: 0 0 12px; color: #dbeafe; font-size: 20px; }

/* AI Assistant panel */
.ai-panel { padding: 24px; }
.ai-header { display: grid; justify-items: center; gap: 8px; margin-bottom: 16px; text-align: center; }
.ai-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #bbf7d0; background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.35); border-radius: 999px; }
.ai-title { margin: 0; color: #ffffff; font-size: clamp(22px, 4vw, 34px); font-weight: 800; letter-spacing: -0.02em; }
.ai-sub { margin: 0; font-size: 16px; color: var(--text-secondary); line-height: 1.6; }

.ai-features { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 12px 0 10px; }
@media (min-width: 640px) { .ai-features { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .ai-features { grid-template-columns: repeat(3, 1fr); } }
.ai-feature { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 16px; border: 1px solid var(--glass-border); border-radius: 16px; background: rgba(148,163,184,0.06); box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease; }
.ai-feature:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-light); }
.ai-icon { width: 48px; height: 48px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; background: rgba(59,130,246,0.15); box-shadow: inset 0 0 0 1px rgba(59,130,246,0.35); font-size: 24px; }
.ai-text { display: grid; gap: 4px; }
.ai-feature-title { color: var(--text); font-weight: 800; font-size: 16px; letter-spacing: -0.01em; }
.ai-feature-sub { color: #9aa4b2; font-size: 14px; }

.ai-examples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 6px; }
.ai-example { background: rgba(99,102,241,0.10); border-color: rgba(99,102,241,0.35); color: #dbeafe; }
.ai-example:hover { background: rgba(99,102,241,0.16); border-color: rgba(99,102,241,0.55); }

@media (max-width: 768px) {
  .ai-examples { justify-content: flex-start; }
}

/* Demo GIF block */
.demo-panel { padding: 20px; }
.demo-header { display: grid; justify-items: center; gap: 6px; margin-bottom: 12px; }
.demo-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #dbeafe; background: rgba(59,130,246,0.12); border: 1px solid rgba(59,130,246,0.35); border-radius: 999px; }
.demo-title { margin: 0; color: #e5e7eb; font-size: 18px; font-weight: 800; }
.demo-media { position: relative; aspect-ratio: 16 / 9; width: 100%; max-width: 720px; margin: 0 auto; border-radius: 16px; background: #0b1220; border: 1px solid var(--glass-border); box-shadow: var(--shadow); overflow: hidden; }
.demo-media img, .demo-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #0b1220; }

/* Prevent horizontal overflow on mobile caused by wide media or hero backdrop */
@media (max-width: 768px) {
  html, body { overflow-x: hidden; }
  .hero { overflow: hidden; }
  .demo-panel { max-width: 92%; }
  .demo-media { max-width: 92vw; }
}

@media (max-width: 768px) {
  .demo-panel { padding: 16px; }
  .demo-title { font-size: 16px; }
}

/* Pricing grid */
.pricing { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: stretch; }
@media (min-width: 980px) { .pricing { grid-template-columns: repeat(3, 1fr); } }
/* Ensure plan cards align consistently */
.pricing > .card { margin: 0; }
.plan { display: flex; flex-direction: column; align-items: stretch; height: 100%; }
.plan .button { margin-top: auto; }

.oauth-btn { display: inline-flex; align-items: center; gap: 10px; padding: 14px 18px; border-radius: 999px; background: white; color: #111827; font-weight: 600; border: none; cursor: pointer; width: 100%; justify-content: center; box-shadow: 0 8px 18px rgba(0,0,0,0.25); text-decoration: none; }
.oauth-btn img, .oauth-btn svg { width: 20px; height: 20px; }
.oauth-btn.google { background: white; color: #111827; }
.oauth-btn.apple { background: #000; color: #fff; }
.oauth-btn.apple img { filter: invert(1); }
.oauth-btn.email { background: transparent; color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.oauth-btn:hover { transform: translateY(-1px); }
.oauth-btn:active { transform: translateY(0); }

.auth-divider { display: flex; align-items: center; gap: 10px; color: #94a3b8; font-size: 13px; margin: 8px 0; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; flex: 1; background: var(--border); }

/* Remove trust badges */
.trust-badges, .badge { display: none !important; }

/* Corner logo badge -> top-left with label */
.corner-logo { 
  position: sticky; 
  left: 16px; 
  top: 16px; 
  z-index: 1000; 
  opacity: 0.98; 
  display: inline-flex; 
  align-items: center; 
  gap: 12px; 
  text-decoration: none; 
  transition: all 0.3s ease;
}
.corner-logo:hover {
  transform: translateY(-1px);
}
.corner-logo img { 
  width: 40px; 
  height: 40px; 
  border-radius: 10px; 
  box-shadow: var(--glow), var(--shadow);
  transition: all 0.3s ease;
}
.corner-logo:hover img {
  box-shadow: var(--glow), var(--shadow-lg);
}
.corner-logo .brand-text { 
  color: var(--text); 
  font-weight: 800; 
  font-size: 18px;
  letter-spacing: -0.02em; 
  background: linear-gradient(135deg, var(--text) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Sticky topbar with logo and actions - Enhanced glassmorphism */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: calc(12px + env(safe-area-inset-top)) 20px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(10, 14, 26, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  z-index: 1100;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.topbar .corner-logo { position: static; top: auto; left: auto; opacity: 1; }
.topbar .signout-top { margin-left: 8px; }
/* Equal spacing between all navbar buttons on wide screens */
.topbar .topbar-actions { margin-left: 0; margin-right: 0; display: flex; gap: 12px; align-items: center; }
/* Push the first element after the logo to the right (Back or actions), stabilizing layout */
.topbar .corner-logo + * { margin-left: 0; }
/* Keep hamburger pinned right on small screens */
.topbar .menu-toggle { margin-left: auto; }
/* Hamburger menu toggle and dropdown */
.menu-toggle { display: none; align-items: center; justify-content: center; background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; line-height: 1; font-size: 18px; min-width: 44px; min-height: 44px; }
.menu-dropdown { display: none; position: absolute; top: 56px; right: 16px; background: #0c1322; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); min-width: 180px; overflow: hidden; z-index: 1200; }
.menu-dropdown a { display: block; padding: 10px 12px; color: var(--text); text-decoration: none; border-bottom: 1px solid rgba(255,255,255,0.04); }
.menu-dropdown a:last-child { border-bottom: none; }

/* When menu is open on small screens, keep dropdown overlayed (no layout shift) */
.topbar.menu-open { flex-wrap: nowrap; }
.topbar.menu-open .menu-dropdown { display: block; position: absolute; right: 16px; top: 56px; width: auto; margin-top: 0; border-radius: 12px; }

/* Benefit icon grid */
.benefit-icons { 
  display: grid; 
  grid-template-columns: 1fr; 
  gap: 24px; 
  align-items: start; 
  margin-top: 32px; 
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}
@media (min-width: 768px) { 
  .benefit-icons { 
    grid-template-columns: repeat(2, 1fr); 
  } 
}
@media (min-width: 1400px) { 
  .benefit-icons { 
    grid-template-columns: repeat(4, 1fr); 
  } 
}
@media (max-width: 768px) { 
  .benefit-icons { 
    grid-template-columns: 1fr; 
    gap: 20px;
  } 
}
.benefit { 
  display: grid; 
  justify-items: center; 
  text-align: center; 
  gap: 16px; 
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.benefit .circle { 
  width: 120px; 
  height: 120px; 
  border-radius: 30px; 
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border); 
  display: inline-flex; 
  align-items: center; 
  justify-content: center; 
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.benefit .circle::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(6, 182, 212, 0.1) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.benefit:hover .circle::before {
  opacity: 1;
}

.benefit .circle .icon { 
  width: 48px; 
  height: 48px; 
  color: var(--primary-light); 
  filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.3));
  z-index: 1;
  transition: all 0.3s ease;
}

.benefit:hover .circle .icon {
  transform: scale(1.1);
  color: var(--accent-light);
}

.benefit .label { 
  color: var(--text-secondary); 
  font-size: 16px; 
  font-weight: 500;
}

/* Ensure benefit icons look consistent */
.benefit .stroke-2 { stroke: #cbd5e1; stroke-width: 2; fill: none; }
.benefit .fill { fill: #cbd5e1; }

/* Benefit titles and subtext */
.benefits-heading {
  margin: 32px 0 8px;
  font-size: 18px;
  color: #dbeafe;
  font-weight: 800;
  letter-spacing: 0.15px;
}
.benefits-heading::before {
  content: "";
  display: block;
  width: 42px;
  height: 3px;
  margin: 0 auto 8px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
}
.benefit .label .title { color: #e5e7eb; font-weight: 800; font-size: 16px; }
.benefit .label .sub { color: #94a3b8; font-size: 14px; margin-top: 2px; }
/* Increase description font for Why You'll Love SnapDoc */
.benefit .label .benefit-desc { font-size: 15px; }

/* Subtle fade-in */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px);} to { opacity: 1; transform: translateY(0);} }
.fade-in { animation: fadeUp .5s ease both; }
.fade-in.delay-1 { animation-delay: .06s; }
.fade-in.delay-2 { animation-delay: .12s; }
.fade-in.delay-3 { animation-delay: .18s; }

/* Step divider between sign-in blocks */
.step-divider { color: #9aa4b2; opacity: .75; font-weight: 700; letter-spacing: .08em; font-size: 12px; text-transform: uppercase; margin: 8px auto 0; width: max-content; position: relative; padding: 4px 10px; }
.step-divider::before, .step-divider::after { content: ""; position: absolute; top: 50%; transform: translateY(-50%); height: 1px; width: 120px; background: var(--border); }
.step-divider::before { left: -130px; }
.step-divider::after { right: -130px; }

/* Responsive */
@media (max-width: 900px) {
  .camera-wrap { grid-template-columns: 1fr; }
  #chatModal.chat-modal { width: calc(100% - 24px); height: auto; max-height: 70dvh; right: 12px; bottom: calc(108px + env(safe-area-inset-bottom)); }
  #openChatBtn.chat-launcher { bottom: calc(108px + env(safe-area-inset-bottom)); }
}

/* Responsive full-width buttons on small screens */
@media (max-width: 768px) {
  .actions .button:not(.small) { flex: 1 1 100%; justify-content: center; }
  .benefit-icons { grid-template-columns: 1fr; gap: 18px; }
  .benefit .circle { width: 140px; height: 140px; }
  .corner-logo { top: calc(8px + env(safe-area-inset-top)); }
  .container { padding-left: 12px; padding-right: 12px; }
  .container, .card, .signin-panel { overflow-wrap: anywhere; }
  /* Show hamburger on small screens */
  .menu-toggle { display: inline-flex; margin-left: auto; font-size: 22px; padding: 10px 12px; min-width: 48px; min-height: 48px; }
}

/* Compact spacing for logged-in workflow with safe distance from topbar */
.has-topbar.logged-in .container { padding: 96px 16px 64px; }
@media (max-width: 768px) { .has-topbar.logged-in .container { padding: 80px 12px 56px; } }
.logged-in .steps-grid { gap: 16px; }
.logged-in .card { padding: 14px; margin-bottom: 16px; border-radius: 14px; }
.logged-in .card h2 { margin: 0 0 2px; font-size: 20px; }
/* Slightly larger base text inside step cards when logged in */
.logged-in .steps-grid > .card { font-size: 17px; }
.logged-in .card p { margin: 2px 0; }
.logged-in .steps-grid > .card { padding: 16px 18px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; min-height: 240px; }
/* Uniform 16px spacing between all logged-in step cards */
.logged-in .card + .card { margin-top: 16px; }
.logged-in .steps-grid + .card { margin-top: 16px; }

/* Ensure step cards in the grid are aligned at the same top position */
.logged-in .steps-grid > .card { margin-top: 0; }

/* Micro benefits under title */
@media (max-width: 600px) {
  .benefits.micro { grid-template-columns: 1fr 1fr; }
}

/* CTA prominence */
.oauth-btn.google.primary {
  padding: 16px 20px;
  font-size: 16px;
  box-shadow: 0 14px 32px rgba(37,99,235,0.45), inset 0 0 0 1px rgba(0,0,0,0.04);
  border: 2px solid #e5e7eb;
}

/* Signup hint beneath CTAs */
.signup-hint { margin: 8px 0 0; text-align: center; color: #9ca3af; font-size: 13px; }
.signup-hint a { color: #93c5fd; text-decoration: underline; }

/* Benefit hover micro-interaction */
.benefit .circle { transition: transform .15s ease; }
.benefit:hover .circle { transform: translateY(-2px) scale(1.02); }

/* Focus visibility - Enhanced for accessibility */
.button:focus-visible, .btn:focus-visible, .oauth-btn:focus-visible, .chip:focus-visible, a:focus-visible, .menu-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.5), var(--shadow);
}

.button.secondary:focus-visible {
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.3), var(--shadow);
}

/* Larger touch target for buttons */
.button, .btn { min-height: 44px; }

/* Disabled OAuth appearance */
.oauth-btn[aria-disabled="true"] { opacity: .6; filter: grayscale(0.2); }

/* Responsive tweaks for micro benefits */
.benefits.micro { display: grid; grid-template-columns: auto auto auto; gap: 8px 16px; margin: 10px 0 2px; justify-content: center; }
.benefits.micro li { color: #d1d5db; font-size: 14px; }
.benefits.micro .icon { width: 18px; height: 18px; font-size: 16px; }

/* Table styles for profile processed files */
.table { width: 100%; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #0c1322; }
.table-row { display: grid; grid-template-columns: 180px 1fr; border-bottom: 1px solid var(--border); padding: 10px 12px; }
.table-row:last-child { border-bottom: none; }
.table-header { background: rgba(148,163,184,0.08); font-weight: 700; color: #cbd5e1; }
@media (max-width: 520px) { .table-row { grid-template-columns: 1fr; } }

/* Skeleton loading */
.skeleton-text { height: 14px; border-radius: 8px; background: rgba(148,163,184,0.18); }
.skeleton-rect { background: rgba(148,163,184,0.14); }
.shimmer { position: relative; overflow: hidden; }
.shimmer::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* Hide actions on small screens; show hamburger at top-right */
@media (max-width: 768px) {
  .topbar .auth-actions,
  .topbar .topbar-actions { display: none !important; }
  .menu-toggle { display: inline-flex !important; margin-left: auto; }
}

/* Always show actions and hide burger on desktop */
@media (min-width: 769px) {
  .auth-actions { display: flex; }
  .menu-toggle { display: none !important; }
}

/* Profile/header responsive actions */
.topbar .auth-actions { margin-left: 0; margin-right: 0; }
.menu-dropdown { display: none; position: absolute; right: 16px; top: 56px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 8px; z-index: 1200; }
.menu-dropdown a { display: block; padding: 8px 12px; text-decoration: none; color: var(--text); border-radius: 8px; }
.menu-dropdown a:hover { background: #0c1322; }
@media (max-width: 520px) {
  .menu-toggle { display: inline-flex; margin-left: auto; }
}

/* Hide auth actions (profile/pricing/sign out) on small phone screens only */
@media (max-width: 520px) { .auth-actions { display: none; } }



/* Step cards: reduce internal empty space on small screens */
@media (max-width: 768px) {
  .steps-grid { gap: 16px; }
  .steps-grid > .card { padding: 16px 16px; height: auto; min-height: 240px; }
  .steps-grid > .card .actions { margin-top: 8px; }
  .steps-grid > .card h2 { margin-top: 0; font-size: 20px; }
  .steps-grid > .card p { font-size: 16px; }
}

/* Scroll reveal animations for mobile content */
@media (max-width: 768px) {
  .sr {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.45s ease-out, transform 0.45s ease-out;
  }
  
  .sr.is-visible {
    opacity: 1;
    transform: translateY(0);
  }
  
  .sr-delay-1 { 
    transition-delay: 0.1s; 
  }
  
  .sr-delay-2 { 
    transition-delay: 0.2s; 
  }
  
  .sr-delay-3 { 
    transition-delay: 0.3s; 
  }
}

/* Smooth scrolling for better mobile experience */
html {
  scroll-behavior: smooth;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Remove the tagline next to the brand on all pages */
.brand-tagline { display: none !important; }

/* Small-screen scroll reveal for sign-in/landing */
@media (max-width: 768px) {
  /* Avoid double animations on mobile */
  .fade-in { animation: none !important; }

  .sr {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
    transition: opacity .45s ease, transform .45s ease;
    will-change: opacity, transform;
  }
  .sr-left { transform: translateX(-10px) scale(0.98); }
  .sr-right { transform: translateX(10px) scale(0.98); }
  .sr.is-visible {
    opacity: 1;
    transform: none;
  }
  .sr-delay-1 { transition-delay: .08s; }
  .sr-delay-2 { transition-delay: .16s; }
  .sr-delay-3 { transition-delay: .24s; }
}

@media (prefers-reduced-motion: reduce) {
  .sr, .sr.is-visible {
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}
