:root {
  --ds-space-1: 0.25rem;
  --ds-space-2: 0.5rem;
  --ds-space-3: 0.75rem;
  --ds-space-4: 1rem;
  --ds-space-5: 1.25rem;
  --ds-radius-md: 10px;
  --ds-radius-lg: 14px;
  --ds-font-title: "Quicksand", "Nunito", system-ui, sans-serif;
}

.ds-stack {
  display: grid;
  gap: var(--ds-space-3);
}





.ds-title {
  font-family: var(--ds-font-title);
  letter-spacing: 0.01em;
}

.ds-subtle {
  color: var(--muted);
  font-size: var(--text-sm);
}

@media (max-width: 768px) {
  
}
/* ==========================================================================
   C.O.G.N.I.T. Design System - Mobile-First Responsive
   ========================================================================== */

/* --------------------------------------------------------------------------
   Design Tokens - CSS Variables
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* Colors */
  --bg: #f0f2f5;
  --panel: #ffffff;
  --panel-bg: #ffffff;
  --text: #1c1e21;
  --muted: #65676b;
  --primary: #1877f2;
  --secondary: #e7f3ff;
  --accent: #d2e2ff;
  --accent-bg: rgba(24, 119, 242, 0.08);
  --warning: #e67e22;
  --success: #27ae60;
  --error: #e74c3c;
  --border: #ccd0d5;
  --border-light: #e4e6eb;

  /* Shadows - Unified elevation system */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-primary: 0 2px 8px rgba(24, 119, 242, 0.25);

  /* Legacy shadow for compatibility */
  --shadow: var(--shadow-lg);

  /* Spacing - 8px grid system */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Border Radius - Unified scale */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: "Quicksand", "Nunito", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, monospace;

  /* Font Sizes - Mobile optimized */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 0.9375rem;
  --text-lg: 1.0625rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.75rem;

  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Line Heights */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 1.75;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  /* Layout */
  --container-max: 960px;
  --header-height: auto;

  /* Gradients */
  --gradient: linear-gradient(135deg, #f0f2f5 0%, #e7f3ff 100%);
  --gradient-soft: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);

  --soft-panel: rgba(255, 255, 255, 0.75);

  /* Focus Ring */
  --focus-ring: 0 0 0 3px rgba(24, 119, 242, 0.3);
  --focus-ring-offset: 2px;

  /* Mobile-specific vars */
  --mobile-padding: 16px;
  --mobile-touch-target: 48px;
}

/* Dark mode */
body.dark {
  color-scheme: dark;
  --bg: #18191a;
  --panel: #242526;
  --panel-bg: #242526;
  --text: #e4e6eb;
  --muted: #b0b3b8;
  --primary: #1877f2;
  --secondary: #3a5795;
  --accent: #2d4778;
  --accent-bg: rgba(45, 71, 120, 0.4);
  --warning: #f39c12;
  --success: #2ecc71;
  --error: #ff8fa3;
  --border: #3a3b3c;
  --border-light: #4e4f50;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-primary: 0 2px 8px rgba(24, 119, 242, 0.3);

  --gradient: linear-gradient(135deg, #18191a 0%, #242526 100%);
  --soft-panel: rgba(36, 37, 38, 0.8);

  --focus-ring: 0 0 0 3px rgba(24, 119, 242, 0.4);
}

/* --------------------------------------------------------------------------
   Base Styles
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--panel);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  min-height: 100vh;
  transition: background var(--transition-slow), color var(--transition-slow);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition:
    background-color var(--transition-slow),
    color var(--transition-slow);
}

/* Smooth theme switching across primary surfaces and controls */


@media (prefers-reduced-motion: reduce) {
  
}

@media (min-width: 768px) {
  body {
    background: var(--gradient);
  }
}

/* --------------------------------------------------------------------------
   Mobile-First Layout - App Container
   -------------------------------------------------------------------------- */
.app {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  gap: 0;
}

@media (min-width: 768px) {
  .app {
    max-width: var(--container-max);
    padding: var(--space-3);
    gap: var(--space-3);
  }
}

@media (min-width: 1024px) {
  .app {
    padding: var(--space-3) var(--space-4) var(--space-2);
  }
}

/* --------------------------------------------------------------------------
   Mobile-First Header
   -------------------------------------------------------------------------- */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  background: var(--panel);
  padding: var(--space-3) var(--mobile-padding);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}

@media (min-width: 768px) {
  .header {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    position: relative;
    top: auto;
  }
}

@media (max-width: 420px) {
  .header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
}

.header .subtitle {
  display: block;
}

.header-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.header-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.header-status-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--text-xs);
  color: var(--muted);
  line-height: 1.2;
  min-width: 0;
}

.header-status-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.header-status-line:first-child {
  color: var(--text);
  font-weight: var(--font-semibold);
}

.header-status-line:last-child {
  font-size: 11px;
}

@media (min-width: 768px) {
  .header-actions {
    gap: var(--space-3);
  }
}

@media (max-width: 640px) {
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .header-status-line {
    max-width: 160px;
  }

  /* Keep the Online/Offline badge but hide the verbose status text on mobile. */
  .header-status-text {
    display: none;
  }
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 0;
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-weight: var(--font-bold);
  color: var(--primary);
  font-size: 1.25rem;
  line-height: var(--leading-tight);
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary) 60%, #667eea 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 480px) {
  .brand h1 {
    font-size: 1.5rem;
  }
}

@media (min-width: 768px) {
  .brand h1 {
    font-size: clamp(1.375rem, 4vw, 1.75rem);
  }
}

.brand .subtitle {
  margin: 0;
  color: var(--muted);
  font-weight: var(--font-medium);
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  opacity: 0.9;
  transition: opacity var(--transition-base);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

@media (min-width: 768px) {
  .brand .subtitle {
    font-size: var(--text-sm);
  }
}

.brand:hover .subtitle {
  opacity: 1;
}

/* Status Dot / Badge - Mobile optimized */
.status-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: var(--font-semibold);
  line-height: 1;
  min-height: 28px;
}

@media (min-width: 480px) {
  .status-dot {
    font-size: var(--text-xs);
    padding: var(--space-2) var(--space-4);
  }
}

.status-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

@media (min-width: 480px) {
  .status-dot::before {
    width: 8px;
    height: 8px;
  }
}

.status-dot.online {
  background: var(--accent);
  color: #1c1e21;
}

.status-dot.online::before {
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(39, 174, 96, 0.3);
}

.status-dot.offline {
  background: rgba(231, 76, 60, 0.15);
  color: var(--error);
}

.status-dot.offline::before {
  background: var(--error);
  box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.3);
}

body.dark .status-dot.online {
  background: var(--accent);
  color: #e4e6eb;
}

body.dark .status-dot.offline {
  background: rgba(231, 76, 60, 0.2);
  color: #ff8fa3;
}

/* --------------------------------------------------------------------------
   Mobile-First Panel / Card - NO BOX ON MOBILE
   -------------------------------------------------------------------------- */
.panel {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: var(--space-3) var(--mobile-padding);
  box-shadow: none;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
  margin-bottom: 0;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.route-transition {
  width: 100%;
  animation: route-fade-slide var(--transition-slow) ease both;
}

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

@media (min-width: 768px) {
  .panel {
    background: var(--panel);
    border-radius: var(--radius-xl);
    padding: var(--space-5) var(--space-6);
    margin-bottom: var(--space-3);
    max-width: var(--container-max);
  }
}

@media (min-width: 1024px) {
  .panel {
    padding: var(--space-6) var(--space-8);
  }
}

.status-panel {
  text-align: center;
  justify-content: center;
  min-height: 50vh;
}

.status-panel .status-message {
  color: var(--muted);
  margin: var(--space-4) 0;
}

.status-message.error {
  color: var(--error);
}

.status-panel .spinner {
  margin: var(--space-6) auto 0;
}

.panel-state {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: center;
  text-align: center;
}

.panel-state h1,
.panel-state h2,
.panel-state h3,
.panel-state p {
  margin: 0;
}

.panel-state-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-bold);
  background: color-mix(in srgb, var(--muted) 10%, var(--panel) 90%);
  border: 1px solid var(--border-light);
  color: var(--muted);
}

.panel-state-warning .panel-state-icon {
  background: color-mix(in srgb, var(--warning) 14%, var(--panel) 86%);
  border-color: color-mix(in srgb, var(--warning) 35%, var(--border-light) 65%);
  color: var(--warning);
}

.panel-state-info .panel-state-icon {
  background: color-mix(in srgb, var(--primary) 10%, var(--panel) 90%);
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border-light) 70%);
  color: var(--primary);
}

.panel-state-success .panel-state-icon {
  background: color-mix(in srgb, var(--success) 12%, var(--panel) 88%);
  border-color: color-mix(in srgb, var(--success) 35%, var(--border-light) 65%);
  color: var(--success);
}

.panel-state-error .panel-state-icon {
  background: color-mix(in srgb, var(--error) 12%, var(--panel) 88%);
  border-color: color-mix(in srgb, var(--error) 35%, var(--border-light) 65%);
  color: var(--error);
}





























.panel-state-actions .primary,
.panel-state-actions .ghost {
  width: auto;
}

.finish-panel .page-actions.inline-actions {
  justify-content: center;
}

.finish-panel .page-actions .primary:hover:not(:disabled) {
  background: var(--primary);
  box-shadow: var(--shadow-sm);
  filter: none;
}





@keyframes skeleton-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.skeleton-page {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  background: linear-gradient(145deg, var(--panel) 0%, color-mix(in srgb, var(--panel) 86%, var(--primary) 14%) 100%);
  width: 100%;
  min-height: 100%;
  height: 100%;
  padding: var(--space-5);
  display: flex;
  align-items: center;
}

.skeleton-page-frame {
  width: 100%;
  min-height: clamp(420px, 62vh, 700px);
  height: clamp(420px, 62vh, 700px);
  display: flex;
  align-items: stretch;
}

.skeleton-page.compact {
  min-height: 100%;
  height: 100%;
}

.skeleton-shell {
  position: relative;
  z-index: 2;
  display: grid;
  gap: var(--space-4);
  width: 100%;
}

.skeleton-hero {
  display: grid;
  gap: var(--space-2);
}

.skeleton-kicker {
  width: 96px;
  height: 10px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--primary) 30%, var(--border-light) 70%);
}

.skeleton-title {
  width: min(72%, 420px);
  height: 22px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--primary) 18%, var(--border-light) 82%);
}

.skeleton-subtitle {
  width: min(58%, 320px);
  height: 14px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--primary) 10%, var(--border-light) 90%);
}

.skeleton-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.skeleton-block {
  height: clamp(74px, 14vh, 120px);
  border-radius: var(--radius-lg);
  background: linear-gradient(165deg, color-mix(in srgb, var(--primary) 14%, var(--border-light) 86%), color-mix(in srgb, var(--accent) 35%, var(--panel) 65%));
}

.skeleton-footer {
  display: flex;
  gap: var(--space-3);
}

.skeleton-button {
  width: 180px;
  max-width: 46%;
  height: 40px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--primary) 30%, var(--border-light) 70%);
}

.skeleton-button.ghost {
  background: color-mix(in srgb, var(--muted) 22%, var(--border-light) 78%);
}

.skeleton-caption {
  margin: 0;
  color: var(--text);
  font-weight: var(--font-semibold);
  text-align: center;
  width: 100%;
}

.skeleton-caption.muted {
  color: var(--muted);
  font-weight: var(--font-medium);
}

.skeleton-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(8px);
  opacity: 0.42;
  z-index: 1;
  animation: skeleton-float 7s ease-in-out infinite;
}

.skeleton-orb.orb-a {
  width: 140px;
  height: 140px;
  top: -42px;
  right: -24px;
  background: color-mix(in srgb, var(--primary) 45%, transparent);
}

.skeleton-orb.orb-b {
  width: 92px;
  height: 92px;
  bottom: 12%;
  left: -16px;
  animation-delay: 0.8s;
  background: color-mix(in srgb, var(--accent) 45%, transparent);
}

.skeleton-orb.orb-c {
  width: 74px;
  height: 74px;
  top: 38%;
  right: 18%;
  animation-delay: 1.4s;
  background: color-mix(in srgb, var(--primary-light) 55%, transparent);
}

.shimmer {
  background-size: 240% 100%;
  animation: skeleton-shimmer 1.5s ease infinite;
}

.section-skeleton {
  margin-top: var(--space-3);
}





.section-skeleton-head {
  width: 38%;
  height: 14px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--primary) 22%, var(--border-light) 78%);
}

.section-skeleton-sub {
  width: 62%;
  height: 10px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--primary) 12%, var(--border-light) 88%);
}

.section-skeleton-grid {
  display: grid;
  gap: var(--space-2);
}

.section-skeleton-line {
  width: 100%;
  height: 10px;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--border-light), var(--accent), var(--border-light));
}

.section-skeleton-caption {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
}



.location-permission-btn {
  margin-top: var(--space-2);
}

body.dark .section-skeleton {
  background: var(--accent-bg);
  border-color: var(--border);
}

@keyframes skeleton-float {
  0%, 100% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(-8px) translateX(6px); }
}

@media (max-width: 768px) {
  .skeleton-page-frame {
    min-height: calc(100dvh - 16px);
    height: calc(100dvh - 16px);
  }

  .skeleton-grid {
    grid-template-columns: 1fr;
  }
  .skeleton-button {
    width: 100%;
    max-width: 100%;
  }
}

@supports not (height: 100dvh) {
  @media (max-width: 768px) {
    .skeleton-page-frame {
      min-height: calc(100vh - 16px);
      height: calc(100vh - 16px);
    }
  }
}

.panel h2 {
  margin: 0 0 var(--space-3);
  color: var(--primary);
  font-weight: var(--font-bold);
  font-size: var(--text-xl);
  line-height: var(--leading-tight);
  letter-spacing: 0.01em;
}

@media (min-width: 768px) {
  .panel h2 {
    font-size: var(--text-2xl);
    margin: 0 0 var(--space-4);
  }
}

/* --------------------------------------------------------------------------
   Mobile-First Banner
   -------------------------------------------------------------------------- */
.banner {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  margin: var(--space-3) var(--mobile-padding);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  border: 1px solid transparent;
  line-height: var(--leading-relaxed);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  max-width: 100%;
}

.banner.compact {
  width: fit-content;
}

@media (min-width: 768px) {
  .banner {
    margin: var(--space-2) 0;
  }
}

@media (max-width: 768px) {
  
}

.banner.warning {
  background: #fff7ed;
  color: #9a3412;
  border-color: #fed7aa;
}

body.dark .banner.warning {
  background: rgba(230, 126, 34, 0.2);
  color: #fbbf24;
  border-color: rgba(230, 126, 34, 0.4);
}

.banner.info {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

body.dark .banner.info {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.45);
}

.banner.success {
  background: #ecfdf3;
  color: #166534;
  border-color: #bbf7d0;
}

body.dark .banner.success {
  background: rgba(22, 101, 52, 0.2);
  color: #86efac;
  border-color: rgba(22, 101, 52, 0.4);
}

.banner.error {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

body.dark .banner.error {
  background: rgba(185, 28, 28, 0.2);
  color: #fca5a5;
  border-color: rgba(185, 28, 28, 0.4);
}

.banner.spaced {
  margin-top: var(--space-3);
}

.helper-text {
  margin-top: var(--space-2);
  color: var(--muted);
  font-size: var(--text-sm);
}
.helper-text.ok {
  color: var(--success);
}
.helper-text.warning {
  color: var(--warning);
}
.button-badge {
  margin-left: var(--space-2);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--text);
}








.consent-content {
  position: relative;
}
.consent-body {
  position: relative;
}
.consent-body.collapsed {
  max-height: 420px;
  overflow: hidden;
}
.consent-fade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 120px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), transparent);
}
body.dark .consent-fade {
  background: linear-gradient(180deg, rgba(36, 37, 38, 0), transparent);
}
.consent-toggle {
  display: flex;
  justify-content: center;
  margin-top: var(--space-2);
  padding-top: var(--space-2);
}

.consent-toggle-text {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  font: inherit;
  font-weight: var(--font-semibold);
  cursor: pointer;
}

.consent-toggle-text:hover {
  text-decoration: none;
}

.flow-stepper-wrap {
  position: relative;
  width: 100%;
  align-self: stretch;
  margin: 0 auto;
  padding: 0 var(--space-3);
}
.flow-stepper-hint {
  display: none;
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: var(--space-2);
  text-align: right;
}

.flow-stepper {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(var(--flow-step-count, 4), minmax(0, 1fr));
  gap: 0.5rem;
  align-items: stretch;
  padding: 0.35rem;
  border-radius: 1.4rem;
  background: color-mix(in srgb, var(--secondary) 55%, white 45%);
}
.flow-step {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 1rem;
  min-height: 0;
  padding: 0.7rem 0.8rem;
  text-align: center;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    border-color var(--transition-base),
    box-shadow var(--transition-base),
    background-color var(--transition-base),
    transform var(--transition-base);
}
.flow-step.done {
  border-color: color-mix(in srgb, var(--success) 22%, transparent 78%);
  background: color-mix(in srgb, var(--success) 10%, white 90%);
  color: color-mix(in srgb, var(--success) 80%, var(--text) 20%);
}
.flow-step.active {
  border-color: color-mix(in srgb, var(--primary) 72%, white 28%);
  background: var(--panel);
  box-shadow: 0 4px 12px rgba(24, 119, 242, 0.12);
}

.flow-step.active .flow-step-index {
  color: var(--primary);
}
.flow-step-label {
  font-size: clamp(0.82rem, 1vw, 0.95rem);
  font-weight: var(--font-semibold);
  letter-spacing: 0;
  line-height: 1.2;
}
@media (min-width: 768px) {
  .flow-stepper-wrap {
    max-width: 560px;
    padding: 0;
  }

  .flow-step {
    padding: 0.65rem 0.55rem;
  }
}
@media (max-width: 640px) {
  .flow-stepper-wrap {
    margin-top: var(--space-2);
    padding-left: var(--mobile-padding);
    padding-right: var(--mobile-padding);
  }

  .flow-stepper {
    display: grid;
    grid-template-columns: repeat(var(--flow-step-count, 4), minmax(0, 1fr));
    gap: 6px;
    overflow-x: visible;
    padding: 0.3rem;
    scroll-snap-type: none;
  }
  .flow-step {
    min-width: 0;
    min-height: auto;
    padding: 0.6rem 0.35rem;
    border-radius: var(--radius-full);
    box-shadow: none;
    transform: none;
  }
  .flow-step-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
  }
  .flow-stepper-hint {
    display: none;
  }
}

@media (max-width: 360px) {
  .flow-step {
    padding: 7px 5px;
  }
  .flow-step-label {
    font-size: 11px;
  }
}

/* --------------------------------------------------------------------------
   Mobile-First Form Grid
   -------------------------------------------------------------------------- */
.form-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
  margin: var(--space-4) 0;
}

@media (min-width: 768px) {
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4) var(--space-6);
  }

  /* When OTP is shown under Email, pull left-column fields up to avoid dead space under Username. */
  .form-grid.has-otp {
    align-items: start;
  }

  .form-grid.has-otp .username-field { grid-column: 1; grid-row: 1; }
  .form-grid.has-otp .email-field { grid-column: 2; grid-row: 1; }
  .form-grid.has-otp .otp-field { grid-column: 2; grid-row: 2; }

  .form-grid.has-otp .gender-field { grid-column: 1; grid-row: 2; }
  .form-grid.has-otp .location-field { grid-column: 1; grid-row: 3; }
  .form-grid.has-otp .prior-experience-field { grid-column: 1; grid-row: 4; }

  .form-grid.has-otp .age-field { grid-column: 2; grid-row: 3; }
  .form-grid.has-otp .language-field { grid-column: 2; grid-row: 4; }
}

@media (min-width: 1024px) {
  .form-grid {
    gap: var(--space-5) var(--space-8);
  }
}

/* --------------------------------------------------------------------------
   Mobile-First Form Field
   -------------------------------------------------------------------------- */
.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}
@media (max-width: 640px) {
  .form-field {
    gap: var(--space-3);
  }
}

.survey-page-panel .field {
  background: var(--panel);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.form-field label {
  font-weight: var(--font-semibold);
  color: var(--text);
  font-size: var(--text-sm);
  line-height: var(--leading-tight);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.form-field label .required {
  color: var(--error);
  font-weight: var(--font-bold);
  font-size: 1.1em;
  margin-left: 2px;
}

.field label .required {
  color: var(--error);
  font-weight: var(--font-bold);
  font-size: 1.1em;
  margin-left: 2px;
}

.form-field.error label {
  color: var(--error);
}

.form-field input,
.form-field select {
  width: 100%;
  min-height: var(--mobile-touch-target);
  font-size: 16px;
}

.otp-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.otp-row .otp-inputs {
  flex: 1;
}

.otp-resend-btn.ghost {
  min-width: var(--mobile-touch-target);
  min-height: var(--mobile-touch-target);
  width: var(--mobile-touch-target);
  flex: 0 0 var(--mobile-touch-target);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.otp-field {
  grid-column: auto;
}

@media (min-width: 768px) {
  .otp-field {
    grid-column: 2;
  }
}

.loading-spinner {
  color: var(--primary);
  animation: spin 0.9s linear infinite;
}

.otp-resend-btn[aria-disabled="true"] {
  cursor: not-allowed;
  pointer-events: none;
}

.otp-inputs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-2);
  max-width: 360px;
  width: 100%;
}

.otp-input {
  width: 100%;
  min-height: var(--mobile-touch-target);
  text-align: center;
  font-size: 18px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--panel);
}

@media (max-width: 420px) {
  .otp-inputs {
    gap: var(--space-1);
    max-width: 100%;
  }

  .otp-input {
    font-size: 16px;
  }
}

.otp-input:focus {
  outline: 2px solid color-mix(in srgb, var(--primary) 60%, transparent 40%);
  outline-offset: 2px;
}

.inline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.form-field.loading input,
.form-field.loading select,
.form-field.loading textarea {
  background: linear-gradient(90deg, var(--border-light), color-mix(in srgb, var(--border-light) 60%, var(--panel) 40%), var(--border-light));
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}
.form-field textarea {
  min-height: 140px;
}

.input-with-ghost {
  position: relative;
}

.input-with-ghost input {
  position: relative;
  z-index: 1;
  background: transparent;
}

.ghost-placeholder {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: var(--text-sm);
  pointer-events: none;
  z-index: 0;
  opacity: 0.9;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.ghost-prefix {
  opacity: 0.7;
}

.ghost-domain {
  display: inline-block;
  min-width: 7ch;
}

.ghost-placeholder.simple .ghost-domain {
  color: var(--primary);
  font-weight: var(--font-semibold);
  letter-spacing: 0.2px;
  will-change: transform, opacity;
}

.simple-animate {
  animation: simpleSlideFade 0.55s ease;
}

@keyframes simpleSlideFade {
  0% { transform: translateY(6px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@media (max-width: 768px) {
  .form-field {
    margin-bottom: var(--space-2);
  }

  .form-field label {
    font-size: var(--text-base);
  }

  .error-text {
    font-size: var(--text-sm);
  }

  input,
  select,
  textarea {
    padding: var(--space-4);
  }
}



.icon-badge {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--primary) 12%, var(--panel) 88%);
  color: var(--primary);
  font-weight: var(--font-bold);
  font-size: var(--text-sm);
}

.icon-badge.dark {
  background: color-mix(in srgb, var(--primary) 18%, var(--panel) 82%);
}

.card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.card-header {
  padding: var(--space-3) var(--space-4) var(--space-2);
  border-bottom: 1px solid var(--border-light);
}
.card-body {
  padding: 0 var(--space-4) var(--space-3);
}

@media (max-width: 540px) {
  .card-header,
  .card-body,
  .card-footer {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }
}

/* --------------------------------------------------------------------------
   Mobile-First Welcome Info / Consent Content
   -------------------------------------------------------------------------- */
.welcome-info {
  margin: var(--space-4) 0;
  padding: var(--space-4);
  background: var(--accent-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

@media (min-width: 768px) {
  .welcome-info {
    margin: var(--space-5) 0;
    padding: var(--space-5);
  }
}

.welcome-info h3 {
  color: var(--primary);
  margin: var(--space-4) 0 var(--space-2);
  font-size: var(--text-base);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
}

.welcome-info h3:first-child {
  margin-top: 0;
}

.welcome-info ul {
  margin: var(--space-2) 0;
  padding-left: 1.25em;
}

.welcome-info li {
  margin: var(--space-2) 0;
  color: var(--text);
  line-height: var(--leading-relaxed);
}

@media (max-width: 540px) {
  .welcome-info {
    padding: var(--space-3);
  }
  .welcome-info h3 {
    margin-top: var(--space-3);
    font-size: var(--text-base);
  }
  .welcome-info p,
  .welcome-info li {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
  }
  .welcome-info ul {
    padding-left: 1rem;
  }
}

.welcome-info p {
  margin: var(--space-2) 0;
  line-height: var(--leading-relaxed);
  color: var(--text);
}

.welcome-info a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.welcome-info a:hover {
  text-decoration: none;
}

.welcome-info p + p {
  margin-top: var(--space-3);
}

/* --------------------------------------------------------------------------
   Mobile-First Input Styles
   -------------------------------------------------------------------------- */
input,
select,
textarea {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: var(--space-3) var(--space-4);
  background: var(--panel);
  color: inherit;
  font-size: 16px;
  font-family: inherit;
  line-height: var(--leading-normal);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  min-height: var(--mobile-touch-target);
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}

@media (min-width: 768px) {
  input,
  select,
  textarea {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-base);
    min-height: 40px;
  }
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--muted);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

input[type="number"].number-left {
  text-align: left;
  padding-right: var(--space-4);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2365676b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  padding-right: 44px;
  cursor: pointer;
}

select:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%231877f2' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

body.dark select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23b0b3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

textarea {
  min-height: 120px;
  resize: vertical;
  line-height: var(--leading-relaxed);
}

@media (min-width: 768px) {
  textarea {
    min-height: 120px;
  }
}

/* --------------------------------------------------------------------------
   Mobile-First Error Styles
   -------------------------------------------------------------------------- */


.error-input:focus {
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2) !important;
}

.error-text {
  color: var(--error);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  min-height: 18px;
  display: block;
  margin-top: var(--space-1);
}

.checking-text {
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  min-height: 18px;
  display: block;
  margin-top: var(--space-1);
  font-style: italic;
}

/* --------------------------------------------------------------------------
   Mobile-First Consent Checkbox
   -------------------------------------------------------------------------- */
.consent-checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin: var(--space-4) 0 0;
  padding: var(--space-3);
  background: var(--accent-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  transition: border-color var(--transition-fast);
}

@media (min-width: 768px) {
  .consent-checkbox {
    padding: var(--space-2) var(--space-3);
    gap: var(--space-2);
  }
}

.consent-checkbox:hover {
  border-color: var(--primary);
}

.consent-checkbox.error {
  border-color: var(--error);
  background: rgba(231, 76, 60, 0.05);
}

.consent-checkbox input[type="checkbox"] {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  accent-color: var(--primary);
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-appearance: checkbox;
  appearance: checkbox;
  min-height: 24px;
}

@media (min-width: 768px) {
  .consent-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    margin-top: 2px;
  }
}

.consent-checkbox label {
  flex: 1;
  font-weight: var(--font-medium);
  color: var(--text);
  cursor: pointer;
  line-height: var(--leading-normal);
  font-size: var(--text-sm);
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.consent-note {
  margin: var(--space-1) 0 0;
  font-size: var(--text-xs);
  color: var(--muted);
  font-weight: var(--font-normal);
  text-align: left;
  padding: 0;
  background: transparent;
  border-radius: 0;
  border: none;
  line-height: var(--leading-normal);
}

/* --------------------------------------------------------------------------
   Mobile-First Buttons
   -------------------------------------------------------------------------- */
.primary {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  font-weight: var(--font-semibold);
  font-size: var(--text-base);
  font-family: inherit;
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--mobile-touch-target);
  min-width: 0;
  line-height: 1;
  width: 100%;
  touch-action: manipulation;
}

@media (min-width: 480px) {
  .primary {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    min-height: 40px;
    min-width: 0;
  }
}

.primary:hover:not(:disabled) {
  box-shadow: var(--shadow-md);
  filter: brightness(1.1);
}

.primary:active:not(:disabled) {
  box-shadow: var(--shadow-sm);
  filter: brightness(0.95);
}

.primary:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring), var(--shadow-sm);
}

.primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--muted);
}

.primary.small {
  padding: var(--space-2) var(--space-3);
  min-width: 0;
  width: auto;
}

.primary.large {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-lg);
  min-height: 56px;
}

@media (min-width: 768px) {
  .primary.large {
    padding: var(--space-4) var(--space-8);
  }
}

.button-top {
  margin-top: var(--space-3);
}

.ghost {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  cursor: pointer;
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  font-family: inherit;
  background: transparent;
  color: var(--text);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--mobile-touch-target);
  min-width: 0;
  width: 100%;
  touch-action: manipulation;
}

@media (min-width: 480px) {
  .ghost {
    padding: var(--space-2);
    min-height: 36px;
  }
}

.ghost:hover:not(:disabled) {
  background: var(--bg);
  border-color: var(--primary);
  color: var(--primary);
}

.ghost:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dark-mode-toggle {
  padding: var(--space-2) !important;
  font-size: 20px;
  min-width: var(--mobile-touch-target);
  min-height: var(--mobile-touch-target);
  width: auto;
}

.dark-mode-toggle svg {
  width: 20px;
  height: 20px;
  display: block;
}

.dark-mode-toggle .dark-mode-emoji {
  display: block;
  font-size: 20px;
  line-height: 1;
}

@media (min-width: 480px) {
  .dark-mode-toggle {
    font-size: 18px;
    min-width: 44px;
    min-height: 44px;
    padding: var(--space-2) var(--space-3) !important;
  }

  .dark-mode-toggle svg {
    width: 18px;
    height: 18px;
  }

  .dark-mode-toggle .dark-mode-emoji {
    font-size: 18px;
  }
}

.image-container {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  justify-content: center;
  align-items: center;
  max-height: min(300px, 50vh);
  min-height: 200px;
  transition: all var(--transition-base);
}

@media (min-width: 768px) {
  .image-container {
    max-height: min(400px, 55vh);
    min-height: clamp(200px, 40vh, 300px);
  }
}

.image-container img {
  max-width: 100%;
  max-height: min(300px, 50vh);
  transition: transform var(--transition-base);
  cursor: zoom-in;
  object-fit: contain;
}

@media (min-width: 768px) {
  .image-container img {
    max-height: min(400px, 55vh);
  }
}

.image-container.zoomed img {
  transform: scale(1.5);
  cursor: zoom-out;
}

.image-loading,
.image-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-weight: var(--font-semibold);
  padding: var(--space-4);
  text-align: center;
}

.image-loading {
  background: var(--accent-bg);
  color: var(--primary);
}

.image-loading .spinner {
  margin: var(--space-4) auto;
}

.image-error {
  background: rgba(231, 76, 60, 0.05);
  color: var(--error);
}

.zoom-toggle {
  position: absolute;
  bottom: var(--space-2);
  right: var(--space-2);
  width: auto;
  max-width: fit-content;
  background: var(--panel);
  color: var(--primary);
  border: 1px solid var(--border);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  transition: all var(--transition-fast);
  min-height: 32px;
}

@media (min-width: 768px) {
  .zoom-toggle {
    bottom: var(--space-3);
    right: var(--space-3);
  }
}

.zoom-toggle:hover {
  background: var(--primary);
  color: white;
}

.meta {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  color: var(--muted);
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
  flex-wrap: wrap;
  margin-top: var(--space-2);
}

.meta-step-top {
  margin-top: 0;
  margin-bottom: var(--space-2);
}

.survey-page-panel .meta-timer-row {
  margin-bottom: var(--space-3);
}

.timer {
  font-weight: var(--font-semibold);
  color: var(--primary);
  margin-top: var(--space-2);
}

.step-chip {
  display: inline-flex;
  align-items: center;
  background: var(--accent-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-1);
}

.survey-badges {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin: var(--space-2) 0 var(--space-3);
}

.status-badge {
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
}

.status-badge.met {
  border-color: rgba(39, 174, 96, 0.35);
  background: rgba(39, 174, 96, 0.12);
  color: var(--success);
}

.status-badge.pending {
  border-color: rgba(230, 126, 34, 0.35);
  background: rgba(230, 126, 34, 0.12);
  color: var(--warning);
}

/* --------------------------------------------------------------------------
   Priority Notes (Per Field)
   -------------------------------------------------------------------------- */
.priority-field-note {
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: rgba(24, 119, 242, 0.06);
}

.priority-field-note.ready {
  border-color: rgba(39, 174, 96, 0.45);
  background: rgba(39, 174, 96, 0.1);
}

.priority-field-head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
}

.priority-inline-bar {
  width: 100%;
  height: 8px;
  margin-top: var(--space-2);
  border-radius: var(--radius-full);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.12);
}

.priority-inline-bar > span {
  display: block;
  height: 100%;
  background: var(--primary);
  transition: width var(--transition-base);
}

.priority-field-note.ready .priority-inline-bar > span {
  background: var(--success);
}

.priority-field-note p {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
  color: var(--muted);
}

.priority-field-note .priority-micro-note {
  margin-top: var(--space-1);
  color: var(--primary);
  font-weight: var(--font-medium);
}

.priority-field-note.ready .priority-micro-note {
  color: var(--success);
}

body.dark .priority-inline-bar {
  background: rgba(255, 255, 255, 0.2);
}

body.dark .priority-field-note {
  background: var(--accent-bg);
  border-color: var(--border);
}

body.dark .priority-field-note.ready {
  background: var(--accent-bg);
  border-color: var(--border);
}

.textarea-wrap {
  position: relative;
}

.textarea-counter {
  position: absolute;
  right: 10px;
  bottom: 8px;
  font-size: var(--text-xs);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  pointer-events: none;
}

body.dark .textarea-counter {
  background: rgba(36, 37, 38, 0.92);
  border-color: var(--border);
}

/* --------------------------------------------------------------------------
   Mobile-First Field
   -------------------------------------------------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

@media (min-width: 768px) {
  .field {
    margin-bottom: var(--space-5);
  }
}

.feedback-field {
  margin-bottom: var(--space-2);
}

@media (min-width: 768px) {
  .feedback-field {
    margin-bottom: var(--space-3);
  }
}

.field label {
  font-weight: var(--font-semibold);
  color: var(--primary);
  font-size: var(--text-sm);
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Mobile-First Counts
   -------------------------------------------------------------------------- */
.counts {
  display: flex;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--muted);
  font-weight: var(--font-medium);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
  padding: var(--space-2) var(--space-3);
  background: var(--accent);
  border-radius: var(--radius-md);
}

@media (min-width: 480px) {
  .counts {
    gap: var(--space-4);
    font-size: var(--text-sm);
  }
}

body.dark .counts {
  background: var(--accent-bg);
  border: 1px solid var(--border);
}

.counts .ok {
  color: var(--success);
  font-weight: var(--font-semibold);
}

.counts .warning {
  color: var(--warning);
  font-weight: var(--font-semibold);
}

/* --------------------------------------------------------------------------
   Mobile-First Rating Scale
   -------------------------------------------------------------------------- */
.rating-scale {
  display: flex;
  gap: var(--space-1);
  justify-content: center;
  flex-wrap: wrap;
}

.rating-scale-disabled {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(0.15);
}

@media (min-width: 480px) {
  .rating-scale {
    gap: var(--space-2);
  }
}

@media (min-width: 768px) {
  .rating-scale {
    gap: var(--space-3);
  }
}

.rating-option {
  cursor: pointer;
}

.rating-scale-disabled .rating-option {
  cursor: not-allowed;
}

.rating-option input {
  display: none;
}

.rating-label {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--border);
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  color: var(--text);
  transition: all var(--transition-fast);
  touch-action: manipulation;
  overflow: visible;
}

.rating-label::after {
  content: "✨";
  position: absolute;
  top: -8px;
  right: -6px;
  font-size: 12px;
  opacity: 0;
  transform: scale(0.4) rotate(-15deg);
  pointer-events: none;
}

@media (min-width: 400px) {
  .rating-label {
    width: 40px;
    height: 40px;
  }
}

@media (min-width: 768px) {
  .rating-label {
    width: clamp(40px, 9vw, 48px);
    height: clamp(40px, 9vw, 48px);
  }
}

.rating-option:hover .rating-label {
  border-color: var(--primary);
  transform: scale(1.05);
}

.rating-scale-disabled .rating-option:hover .rating-label {
  border-color: var(--border);
  transform: none;
}

.rating-option input:checked + .rating-label {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  transform: scale(1.05);
  box-shadow: var(--shadow-sm);
  animation: rating-pop 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.rating-option input:checked + .rating-label::after {
  animation: rating-sparkle 480ms ease-out;
}

.rating-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: var(--space-2);
  padding: 0 var(--space-1);
}

@media (min-width: 480px) {
  .rating-labels {
    font-size: var(--text-xs);
    padding: 0 var(--space-2);
  }
}

.effort-rating {
  margin-bottom: var(--space-3);
}

@keyframes rating-pop {
  0% {
    transform: scale(0.88);
  }
  45% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1.05);
  }
}

@keyframes rating-sparkle {
  0% {
    opacity: 0;
    transform: scale(0.4) rotate(-20deg) translateY(4px);
  }
  35% {
    opacity: 1;
    transform: scale(1.1) rotate(0deg) translateY(0);
  }
  100% {
    opacity: 0;
    transform: scale(0.8) rotate(12deg) translateY(-6px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .rating-option input:checked + .rating-label,
  .rating-option input:checked + .rating-label::after {
    animation: none;
  }

  .button-spinner {
    animation: none;
  }
}

@media (min-width: 768px) {
  .effort-rating {
    margin-bottom: var(--space-4);
  }
}

/* --------------------------------------------------------------------------
   Mobile-First Actions
   -------------------------------------------------------------------------- */
.actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  padding-top: var(--space-4);
}

@media (min-width: 768px) {
  .actions {
    gap: var(--space-4);
  }
}



/* --------------------------------------------------------------------------
   Mobile-First Guidance
   -------------------------------------------------------------------------- */
.guidance {
  text-align: center;
  padding: var(--space-4) 0;
}

.survey-feed-panel {
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 768px) {
  .guidance {
    padding: var(--space-4);
  }
}

.guidance h2 {
  color: var(--primary);
}

.debrief {
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  margin: var(--space-3) 0;
}

/* --------------------------------------------------------------------------
   Mobile-First Toasts
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  top: var(--space-2);
  left: var(--space-2);
  right: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: 1000;
}

@media (min-width: 640px) {
  .toast-container {
    top: var(--space-4);
    right: var(--space-4);
    left: auto;
    max-width: 400px;
  }
}

.toast {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  display: flex;
  gap: var(--space-3);
  align-items: center;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  font-size: var(--text-sm);
}

.toast > span {
  flex: 1;
}

.toast-actions {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .toast {
    min-width: 280px;
    font-size: var(--text-base);
  }
}

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

@media (min-width: 640px) {
  @keyframes slideIn {
    from {
      transform: translateX(100%);
      opacity: 0;
    }
    to {
      transform: translateX(0);
      opacity: 1;
    }
  }
}

.toast.success {
  border-color: var(--success);
  background: #f0fdf4;
}

body.dark .toast.success {
  background: rgba(39, 174, 96, 0.15);
}

.toast.error {
  border-color: var(--error);
  background: #fef2f2;
}

body.dark .toast.error {
  background: rgba(231, 76, 60, 0.15);
}

.toast.warning {
  border-color: var(--warning);
  background: #fffbeb;
}

body.dark .toast.warning {
  background: rgba(230, 126, 34, 0.15);
}

.toast-action {
  background: var(--primary);
  border: none;
  color: white;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  cursor: pointer;
  font-weight: var(--font-semibold);
  min-height: 32px;
  flex-shrink: 0;
}

.toast button[aria-label="Dismiss"] {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .toast {
    padding: var(--space-2) var(--space-3);
    gap: var(--space-2);
    font-size: var(--text-xs);
  }

  .toast-actions {
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-1);
  }

  .toast-action {
    padding: 2px var(--space-2);
    min-height: 24px;
  }

  .toast button[aria-label="Dismiss"] {
    width: 24px;
    height: 24px;
    font-size: 18px;
  }
}

.toast button[aria-label="Dismiss"]:hover {
  background: var(--bg);
  color: var(--text);
}

/* --------------------------------------------------------------------------
   Confetti
   -------------------------------------------------------------------------- */
.confetti {
  pointer-events: none;
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 10;
}

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 14px;
  top: -10px;
  animation: fall 1.6s linear infinite;
}

@media (min-width: 768px) {
  .confetti-piece {
    width: 10px;
    height: 18px;
  }
}

@keyframes fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* --------------------------------------------------------------------------
   Mobile-First Spinner
   -------------------------------------------------------------------------- */


@media (min-width: 768px) {
  
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes shimmer {
  0% { background-position: 0% 0%; }
  100% { background-position: -200% 0%; }
}

@keyframes wiggle {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}



/* --------------------------------------------------------------------------
   Mobile-First Footer
   -------------------------------------------------------------------------- */
.branding-footer {
  text-align: center;
  color: var(--muted);
  font-size: var(--text-xs);
  padding: var(--space-3) var(--mobile-padding);
  margin-top: auto;
  flex-shrink: 0;
  border-top: 1px solid var(--border-light);
  background: var(--panel);
  width: 100%;
}

.back-to-top {
  position: fixed;
  right: calc(var(--mobile-padding) + env(safe-area-inset-right, 0px));
  bottom: calc(var(--mobile-padding) + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  width: 50px;
  height: 50px;
  padding: 0;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  font-size: 20px;
  line-height: 1;
}

@media (min-width: 768px) {
  .back-to-top {
    display: none;
  }
}

@media (min-width: 768px) {
  .branding-footer {
    font-size: var(--text-sm);
    padding: var(--space-2) 0;
    margin-top: var(--space-3);
    background: transparent;
    border-top: none;
  }
}

/* --------------------------------------------------------------------------
   Mobile-First Page Components
   -------------------------------------------------------------------------- */
.page-hero {
  text-align: center;
  padding: var(--space-4) 0;
}

@media (min-width: 768px) {
  .page-hero {
    padding: var(--space-4) var(--space-3);
  }
}

.page-subtitle {
  color: var(--muted);
  font-size: var(--text-base);
  margin: var(--space-1) 0 var(--space-3);
  text-align: center;
  line-height: var(--leading-relaxed);
}

@media (min-width: 768px) {
  .page-subtitle {
    font-size: var(--text-base);
  }
}

.page-subtitle.left {
  text-align: left;
}

.page-subtitle.no-bottom-margin {
  margin-bottom: 0;
  padding-bottom: 0;
}

.panel:has(> h2 + .page-subtitle.left.no-bottom-margin) h2 {
  margin-bottom: var(--space-2);
}

.panel:has(> h2 + .page-subtitle.left.no-bottom-margin) .page-subtitle.left.no-bottom-margin {
  margin-top: 0;
  margin-bottom: var(--space-1);
  line-height: var(--leading-normal);
}

.panel:has(> h2 + .page-subtitle.left.no-bottom-margin) .welcome-info {
  margin-top: var(--space-2);
}

.panel:has(> h2 + .page-subtitle.left.no-bottom-margin) .consent-checkbox {
  margin-top: var(--space-2);
}

@media (min-width: 768px) {
  
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}



@media (min-width: 768px) {
  
}











@media (max-width: 767px) {
  
}

@media (min-width: 768px) {
  

  
}

@media (min-width: 768px) {
  
}



@media (min-width: 768px) {
  
}





























.guidance-list {
  margin: 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.guidance-list li {
  line-height: var(--leading-normal);
}











@media (min-width: 480px) {
  
}













@media (max-width: 540px) {
  .guidance-list {
    padding-left: 1rem;
    gap: var(--space-2);
  }
  
  
  
  
  
}



.sticky-mobile-actions {
  width: 100%;
}

.page-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-4);
  width: 100%;
}

.page-top-actions {
  margin-bottom: var(--space-3);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  position: relative;
}

.page-top-actions.column {
  flex-direction: column;
  align-items: flex-start;
}

.page-top-actions.inline {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
}

.page-top-actions.inline .banner {
  margin: 0;
  min-height: 36px;
  padding: var(--space-2) var(--space-3);
  line-height: 1.2;
}

.page-top-banners {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-end;
  align-items: flex-start;
  flex: 1;
}

.page-top-banners .banner {
  margin: 0;
}



.panel-with-corner-status {
  position: relative;
}



@media (max-width: 640px) {
  .page-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .page-actions .primary,
  .page-actions .ghost {
    width: 100%;
  }

  

  .panel-state-actions .primary,
  .panel-state-actions .ghost {
    width: 100%;
  }

  

  .page-subtitle {
    font-size: var(--text-sm);
  }
}

.page-actions.inline-actions {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.page-actions.inline-actions .primary,
.page-actions.inline-actions .ghost {
  width: auto;
  min-width: fit-content;
}

@media (max-width: 480px) {
  .page-actions.inline-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .page-actions.inline-actions .primary,
  .page-actions.inline-actions .ghost {
    width: 100%;
  }
}

.error-details {
  margin-bottom: var(--space-5);
  text-align: left;
}

.error-details-summary {
  cursor: pointer;
  margin-bottom: var(--space-3);
}

.error-details-pre {
  background: var(--bg);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  overflow: auto;
  font-size: 12px;
  max-height: min(300px, 40vh);
}

.service-unavailable-card {
  background: var(--accent-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-top: var(--space-3);
  margin-bottom: var(--space-6);
  text-align: left;
}

.service-unavailable-card-title {
  font-weight: var(--font-semibold);
  margin: 0 0 var(--space-2);
  color: var(--text);
}

.service-unavailable-list {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--muted);
  line-height: var(--leading-relaxed);
}

.survey-feedback-tip {
  background-color: var(--accent-bg);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  margin: var(--space-3) 0 var(--space-5);
  border-left: 4px solid var(--primary);
  width: 100%;
  max-width: none;
}

.survey-feedback-tip p {
  margin: 0;
  color: var(--muted);
  line-height: var(--leading-relaxed);
}

.survey-feedback-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  flex-wrap: wrap;
  margin-top: var(--space-3);
}

/* Survey feedback uses `inline-actions` for button sizing, but should stay centered. */
.page-actions.survey-feedback-actions.inline-actions {
  justify-content: center;
}

.survey-feedback-finish {
  border: 2px solid var(--error);
  color: var(--error);
}

@media (max-width: 479px) {
  .survey-feedback-actions {
    gap: var(--space-2);
  }

  .survey-feedback-actions .primary,
  .survey-feedback-actions .ghost {
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   Mobile-First Finish Page
   -------------------------------------------------------------------------- */
.finish-wrapper {
  text-align: center;
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.finish-panel {
  display: flex;
  align-items: center;
  justify-content: center;
}

.finish-wrapper > * {
  width: 100%;
}

.survey-submit-actions {
  padding-top: 0;
}

.submit-trust-note,
.submit-shortcut-hint {
  width: 100%;
  margin: 0;
  font-size: var(--text-xs);
  color: var(--muted);
  text-align: left;
}

.submit-info-box {
  width: 100%;
  display: grid;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--accent-bg);
}

.button-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  animation: button-spin 0.7s linear infinite;
}
.button-spinner.small {
  width: 10px;
  height: 10px;
  border-width: 2px;
  margin-right: var(--space-1);
}

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



@media (min-width: 640px) {
  
}







.not-found-dog {
  width: 140px;
  margin: 0 auto var(--space-4);
}

@media (min-width: 768px) {
  .not-found-dog {
    width: 180px;
    margin: 0 auto var(--space-6);
  }
}

.not-found-dog svg {
  width: 100%;
  height: auto;
  display: block;
}

.error-page-centered {
  justify-content: center;
  align-items: center;
}

.error-page-centered .panel {
  width: 100%;
}

.error-page-centered .panel {
  padding: var(--space-4);
}

.error-page-centered .page-hero {
  padding: var(--space-2) 0;
}

.error-page-centered .panel-state {
  gap: var(--space-2);
}

.error-page-centered .error-details {
  margin-bottom: var(--space-3);
}

.error-page-centered .error-details-summary {
  margin-bottom: var(--space-2);
}

.service-unavailable-card {
  margin-top: var(--space-2);
  margin-bottom: var(--space-4);
}

@media (min-width: 768px) {
  
}











@media (min-width: 768px) {
  
}











@media (max-width: 640px) {
  
}





@media (max-width: 479px) {
  

  
}















































@media (max-width: 768px) {
  

  

  

  

  
}

/* --------------------------------------------------------------------------
   Responsive Compatibility Pass (All Frontend Pages)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .route-transition {
    width: 100%;
    max-width: 100%;
  }

  

  

  

  .page-top-actions {
    width: 100%;
  }

}

@media (max-width: 420px) {
  

  

  

  

  

  

  

  
}

@media (max-width: 479px) {
  

}

@media (max-width: 360px) {
  

  
}



































/* --------------------------------------------------------------------------
   Accessibility
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

/* --------------------------------------------------------------------------
   Mobile-First Scrollbar
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

@media (min-width: 768px) {
  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Number input - fix spinner overlap */
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
  text-align: center;
  padding-right: var(--space-8);
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: inner-spin-button !important;
  width: 20px;
  height: 100%;
  cursor: pointer;
}

/* Ensure proper input sizing for short content */
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="tel"] {
  min-width: 0;
}

/* Footer link styling */
.branding-footer a {
  color: inherit;
  text-decoration: none;
}

@media (min-width: 768px) {
  
}

/* Ensure mobile-friendly touch targets on all interactive elements */
button,
input,
select,
textarea,
.rating-option .rating-label {
  touch-action: manipulation;
}

/* Focus visible improvements for accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Ensure images don't overflow containers */
img {
  max-width: 100%;
  height: auto;
}

/* Panel minimum height */
.panel {
  min-height: 0;
}

/* Text truncation and line breaks */




/* Improve placeholder contrast */
input::placeholder,
textarea::placeholder,
select:invalid {
  opacity: 0.9;
}

/* Disabled visual feedback */
button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--bg);
}

/* Ensure dropdown options display properly */
select option {
  white-space: normal;
  overflow-wrap: break-word;
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
  input,
  select,
  textarea {
    font-size: 16px;
  }
}

/* Safe area insets for notched devices */
@supports (padding: max(0px)) {
  .app {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }

  .header {
    padding-left: max(var(--mobile-padding), env(safe-area-inset-left));
    padding-right: max(var(--mobile-padding), env(safe-area-inset-right));
  }

  .panel {
    padding-left: max(var(--mobile-padding), env(safe-area-inset-left));
    padding-right: max(var(--mobile-padding), env(safe-area-inset-right));
  }

  .branding-footer {
    padding-left: max(var(--mobile-padding), env(safe-area-inset-left));
    padding-right: max(var(--mobile-padding), env(safe-area-inset-right));
    padding-bottom: max(var(--space-3), env(safe-area-inset-bottom));
  }
}

/* --------------------------------------------------------------------------
   Mobile Compatibility Hardening (All Pages)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  html,
  body,
  #root {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app {
    min-height: 100dvh;
  }

  .survey-sticky-footer {
    position: sticky;
    bottom: 0;
    z-index: 20;
    background: var(--panel);
    border-top: 1px solid var(--border-light);
    margin-top: var(--space-2);
    padding: var(--space-2) 0 calc(var(--space-2) + env(safe-area-inset-bottom, 0px));
  }

  .sticky-mobile-actions {
    position: sticky;
    bottom: 0;
    z-index: 19;
    background: var(--panel);
    border-top: 1px solid var(--border-light);
    padding: var(--space-2) 0 calc(var(--space-2) + env(safe-area-inset-bottom, 0px));
    margin-top: var(--space-2);
  }

  .header {
    gap: var(--space-2);
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
  }

  .brand {
    max-width: 100%;
    flex: 1 1 auto;
  }

  .brand h1 {
    font-size: 1.1rem;
    line-height: 1.2;
  }

  .header-actions {
    margin-left: auto;
    flex-shrink: 0;
  }

  .panel {
    width: 100%;
    max-width: 100%;
    padding-top: var(--space-3);
    padding-bottom: var(--space-4);
  }

  .panel h2 {
    font-size: 1.2rem;
    line-height: 1.3;
  }

  .welcome-info {
    padding: var(--space-3);
  }

  .welcome-info h3 {
    font-size: var(--text-sm);
  }

  .page-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .page-actions .primary,
  .page-actions .ghost {
    width: 100%;
  }

  .page-top-actions {
    display: flex;
    justify-content: flex-start;
    margin-bottom: var(--space-2);
  }

  .image-container {
    min-height: 180px;
    max-height: 42vh;
  }

  .image-container img {
    max-height: 42vh;
  }

  .zoom-toggle {
    font-size: var(--text-xs);
    min-height: 36px;
    padding: var(--space-1) var(--space-2);
  }

  .meta {
    justify-content: space-between;
    gap: var(--space-2);
  }

  .counts {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-1);
    padding: var(--space-2);
  }

  .rating-scale {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--space-2);
    justify-items: center;
  }

  .rating-label {
    width: 100%;
    max-width: 42px;
    aspect-ratio: 1 / 1;
    height: auto;
  }

  .rating-labels {
    font-size: 10px;
  }

  .survey-submit-actions .primary {
    margin-top: 0;
  }

  .survey-feedback-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .survey-feedback-actions .primary,
  .survey-feedback-actions .ghost {
    width: 100%;
  }

  

  

  

  

  

  

  

  

  

  

  .finish-panel {
    align-items: flex-start;
    justify-content: flex-start;
  }

  .finish-wrapper {
    max-width: 100%;
  }

  .debrief {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
  }

  .toast-container {
    left: var(--space-2);
    right: var(--space-2);
    width: auto;
    max-width: none;
  }

  .toast {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 359px) {
  :root {
    --mobile-padding: 12px;
  }

  .panel {
    padding-top: var(--space-2);
    padding-bottom: var(--space-3);
  }

  .header {
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
  }

  .page-actions {
    gap: var(--space-1);
    margin-top: var(--space-3);
  }

  .primary,
  .ghost {
    min-height: 40px;
    font-size: var(--text-sm);
  }

  .field,
  .form-field {
    gap: var(--space-1);
  }
}

@media (max-width: 420px) {
  .panel {
    padding-left: 12px;
    padding-right: 12px;
  }

  .header {
    padding-left: 12px;
    padding-right: 12px;
  }

  .brand h1 {
    font-size: 1rem;
  }

  .primary,
  .ghost {
    font-size: var(--text-sm);
  }

  .field label {
    font-size: var(--text-xs);
  }

  

  

  .service-unavailable-card,
  .welcome-info {
    padding: var(--space-3);
  }
}

/* --------------------------------------------------------------------------
   Ultra Mobile Compatibility (All Pages + Components)
   -------------------------------------------------------------------------- */






/* --------------------------------------------------------------------------
   Global Mobile Guardrails
   -------------------------------------------------------------------------- */
html,
body,
#root {
  max-width: 100%;
  overflow-x: hidden;
}

img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
}

@media (max-width: 767px) {
  input,
  select,
  textarea,
  button {
    font-size: 16px;
  }

  button {
    min-height: var(--mobile-touch-target);
    padding: 0.65rem 1rem;
  }

  

  
}

@media (max-width: 767px) {
  .header {
    align-items: center;
  }

  .header-actions {
    gap: var(--space-2);
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .header .brand {
    max-width: 100%;
  }

  .header .brand h1,
  .header .brand h1 {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  

  .panel-state-actions .primary,
  .panel-state-actions .ghost {
    width: 100%;
  }

  .status-dot {
    max-width: 110px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  

  

  .error-details-pre {
    font-size: 11px;
    line-height: 1.35;
    max-height: min(240px, 36vh);
  }

  .toast {
    align-items: flex-start;
    gap: var(--space-2);
  }

  .toast-action {
    margin-left: 0;
  }
}





@media (max-width: 540px) {
  .header {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: var(--space-2);
  }

  .header-actions {
    width: auto;
    justify-content: flex-end;
    gap: var(--space-2);
    flex-wrap: wrap;
  }

  .dark-mode-toggle {
    min-width: var(--mobile-touch-target);
  }

  .brand {
    flex: 1 1 auto;
  }

  .brand h1 {
    width: 100%;
    white-space: nowrap;
  }

  .brand .subtitle {
    display: block;
  }

  .status-dot {
    max-width: none;
  }
}

@media (max-width: 360px) {
  .header-actions .status-dot {
    display: inline-flex;
    max-width: 86px;
    min-height: 24px;
    padding: 2px 8px;
    font-size: 10px;
    line-height: 1;
  }

  .header-actions {
    gap: var(--space-1);
  }

  

  

  .rating-scale {
    gap: var(--space-1);
  }

  .rating-label {
    max-width: 36px;
  }
}

/* --------------------------------------------------------------------------
   Survey Page Typography + Controls
   -------------------------------------------------------------------------- */
.survey-page-panel {
  font-size: 1.05rem;
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
}

@media (min-width: 768px) {
  .survey-page-panel {
    padding-top: var(--space-4);
    padding-bottom: var(--space-4);
  }
}

.survey-page-panel h2 {
  font-size: 1.45rem;
}

.survey-page-panel .field label {
  font-size: 1rem;
}

.survey-page-panel textarea,
.survey-page-panel .counts,
.survey-page-panel .meta,
.survey-page-panel .rating-label {
  font-size: 1rem;
}

.survey-page-panel .rating-labels {
  font-size: 0.85rem;
}

.survey-page-panel .counts {
  margin-bottom: var(--space-2);
}

.survey-page-panel .priority-field-note {
  margin-bottom: 0;
}



/* --------------------------------------------------------------------------
   Mobile Hardening
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  input,
  select,
  textarea {
    font-size: 16px;
    min-height: var(--mobile-touch-target);
  }

  button,
  .primary,
  .ghost {
    min-height: var(--mobile-touch-target);
  }

  .page-actions {
    padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom));
  }

  .panel code,
  .panel pre {
    white-space: pre-wrap;
    word-break: break-word;
  }
}

img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
}
