/* ========================================
   Min Leiebil 2.0 — Design Prototype
   ======================================== */

:root {
  --bg: #F4F4F6;
  --card-bg: #FFFFFF;
  --card-radius: 16px;
  --card-border: 1px solid rgba(0, 0, 0, 0.06);
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  --max-width: 540px;
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --accent: #0061F0;
  --tab-inactive: #8E8E93;
}

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

/* ----------------------------------------------------------------------
   PDS-fallback: gir PDS web-komponenter sensible display-typer FØR
   bundlen har lastet. Uten dette rendres alle custom elements som
   `display: inline`, så heading + text renner sammen på én linje.
   ---------------------------------------------------------------------- */
p-heading,
p-text,
p-divider,
p-spinner,
p-tabs,
p-tabs-bar,
p-accordion,
p-inline-notification,
p-banner,
p-toast {
  display: block;
}

p-heading:empty,
p-text:empty {
  /* hindrer at tomme heading-elementer kollapser */
  min-height: 1em;
}

p-text,
p-heading {
  /* baseline-tekst i tilfelle bundlen er treg */
  font-family: 'Porsche Next', 'Arial Narrow', Arial, sans-serif;
  color: #1a1a1a;
}

p-heading {
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
}

p-heading[size="xx-large"] { font-size: 32px; }
p-heading[size="x-large"]  { font-size: 24px; }
p-heading[size="large"]    { font-size: 20px; }
p-heading[size="medium"]   { font-size: 17px; }

p-text                       { font-size: 16px; line-height: 1.45; }
p-text[size="small"]         { font-size: 14px; }
p-text[size="x-small"]      { font-size: 12px; }
p-text[size="xx-small"]     { font-size: 11px; }
p-text[weight="semi-bold"]  { font-weight: 600; }
p-text[color="contrast-medium"], p-heading[color="contrast-medium"] { color: rgba(0,0,0,0.6); }
p-text[color="contrast-low"],    p-heading[color="contrast-low"]    { color: rgba(0,0,0,0.4); }
p-text[color="notification-success"] { color: #2BA055; }
p-text[color="notification-warning"] { color: #FFB400; }
p-text[color="notification-error"]   { color: #DC3232; }

p-icon, p-tag, p-button, p-button-pure, p-link, p-link-pure {
  display: inline-block;
}

/* ----- p-button fallback (vises FØR PDS loader) ----- */
p-button:not(:defined) {
  cursor: pointer;
  padding: 14px 24px;
  border-radius: 4px;
  background: #1a1a1a;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  font-family: 'Porsche Next', 'Arial Narrow', Arial, sans-serif;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}
p-button[variant="secondary"]:not(:defined) {
  background: transparent;
  color: #1a1a1a;
  border: 1px solid #1a1a1a;
}
p-button[compact="true"]:not(:defined) {
  padding: 8px 14px;
  font-size: 14px;
}

/* ----- p-link / p-link-pure fallback ----- */
p-link:not(:defined) {
  cursor: pointer;
  padding: 14px 24px;
  border-radius: 4px;
  background: #1a1a1a;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  font-family: 'Porsche Next', 'Arial Narrow', Arial, sans-serif;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}
p-link:not(:defined) a {
  color: inherit;
  text-decoration: none;
}
p-link-pure:not(:defined) {
  cursor: pointer;
  color: #1a1a1a;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}
p-link-pure:not(:defined) a {
  color: inherit;
  text-decoration: none;
}

/* ----- p-tag fallback ----- */
p-tag:not(:defined) {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(0,0,0,0.08);
  color: #1a1a1a;
}
p-tag[color="notification-warning-soft"]:not(:defined) { background: #FFF3CD; color: #8B6914; }
p-tag[color="notification-success-soft"]:not(:defined) { background: #D4EDDA; color: #155724; }
p-tag[color="notification-error-soft"]:not(:defined)   { background: #F8D7DA; color: #721C24; }

/* ----- p-icon fallback: en lite "•" plassholder så vi ser at noe er der ----- */
p-icon:not(:defined) {
  width: 20px;
  height: 20px;
  display: inline-block;
  vertical-align: middle;
  background-color: currentColor;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}
p-icon[size="x-small"]:not(:defined) { width: 12px; height: 12px; }
p-icon[size="small"]:not(:defined)   { width: 16px; height: 16px; }
p-icon[size="medium"]:not(:defined)  { width: 24px; height: 24px; }
p-icon[size="large"]:not(:defined)   { width: 36px; height: 36px; }

/* Pre-load icons via CDN URLs (manifest fra PDS v3.33.0) */
p-icon[name="car"]:not(:defined)              { -webkit-mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/car.35229c9.svg'); mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/car.35229c9.svg'); }
p-icon[name="user"]:not(:defined)             { -webkit-mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/user.c18dabe.svg'); mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/user.c18dabe.svg'); }
p-icon[name="phone"]:not(:defined)            { -webkit-mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/phone.f4f774b.svg'); mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/phone.f4f774b.svg'); }
p-icon[name="email"]:not(:defined)            { -webkit-mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/email.f2530de.svg'); mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/email.f2530de.svg'); }
p-icon[name="arrow-left"]:not(:defined)       { -webkit-mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/arrow-left.e03c25b.svg'); mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/arrow-left.e03c25b.svg'); }
p-icon[name="arrow-right"]:not(:defined)      { -webkit-mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/arrow-right.872716b.svg'); mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/arrow-right.872716b.svg'); }
p-icon[name="arrow-head-right"]:not(:defined) { -webkit-mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/arrow-head-right.304b330.svg'); mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/arrow-head-right.304b330.svg'); }
p-icon[name="arrow-down"]:not(:defined)       { -webkit-mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/arrow-down.49c6983.svg'); mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/arrow-down.49c6983.svg'); }
p-icon[name="success"]:not(:defined)          { -webkit-mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/success.b16d4c1.svg'); mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/success.b16d4c1.svg'); }
p-icon[name="warning"]:not(:defined)          { -webkit-mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/warning.59927e6.svg'); mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/warning.59927e6.svg'); }
p-icon[name="information"]:not(:defined)      { -webkit-mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/information.da41162.svg'); mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/information.da41162.svg'); }
p-icon[name="logout"]:not(:defined)           { -webkit-mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/logout.7ec7451.svg'); mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/logout.7ec7451.svg'); }
p-icon[name="edit"]:not(:defined)             { -webkit-mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/edit.330f321.svg'); mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/edit.330f321.svg'); }
p-icon[name="configurate"]:not(:defined)      { -webkit-mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/configurate.5311c8d.svg'); mask-image: url('https://cdn.ui.porsche.com/porsche-design-system/icons/configurate.5311c8d.svg'); }

/* Icon with color from p-icon[color="..."] */
p-icon[color="notification-success"]:not(:defined) { color: #2BA055; }
p-icon[color="notification-warning"]:not(:defined) { color: #FFB400; }
p-icon[color="notification-error"]:not(:defined)   { color: #DC3232; }
p-icon[color="contrast-medium"]:not(:defined)      { color: rgba(0,0,0,0.6); }
p-icon[color="contrast-low"]:not(:defined)         { color: rgba(0,0,0,0.4); }

/* Når PDS faktisk loader, fjern alle våre fallbacks */
p-icon:defined, p-button:defined, p-button-pure:defined,
p-link:defined, p-link-pure:defined, p-tag:defined {
  background: revert;
  padding: revert;
  border-radius: revert;
  -webkit-mask-image: none;
  mask-image: none;
}


/* Prevent iOS Safari auto-zoom on input focus */
input, select, textarea {
  font-size: 16px;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none; /* Prevent Safari back-swipe */
  -webkit-overflow-scrolling: touch;
}

#app {
  position: relative;
  min-height: 100vh;
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ---- App Loader ---- */
#app-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}

/* ---- Pages ---- */
.page {
  display: none;
  min-height: 100vh;
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); /* Space for solid tab bar */
}

@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-entering {
  animation: pageFadeIn 0.2s ease both;
}

.page-content {
  padding: var(--spacing-md);
  padding-top: var(--spacing-lg);
}

/* ---- Glassmorph tab bar — floating på bunnen (matcher msa-app navbar-glass) ---- */
.floating-tab-bar {
  position: fixed;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 420px;
  background: rgba(247, 247, 247, 0.7);
  -webkit-backdrop-filter: blur(15px) saturate(180%);
  backdrop-filter: blur(15px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 24px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
  padding: 6px 4px;
  display: flex;
  z-index: 200;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.floating-tab-bar.hidden {
  transform: translateX(-50%) translateY(calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
}

.floating-tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  flex: 1;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  min-height: 48px;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  transition: opacity 0.15s ease;
}

.floating-tab-item:active {
  opacity: 0.5;
}

.floating-tab-item .tab-icon {
  color: var(--tab-inactive);
  transition: color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

/* Inline-SVG-fallback for ikoner som ikke finnes i PDS v3 (clock, question). */
.floating-tab-item .tab-svg {
  width: 22px;
  height: 22px;
  display: block;
}

.floating-tab-item .tab-label {
  color: var(--tab-inactive);
  transition: color 0.15s ease;
  font-family: 'Porsche Next', 'Arial Narrow', Arial, sans-serif;
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

/* Aktiv-state: sort tekst/ikon (matcher msa-app sin svart/hvitt/grå-palett —
   bevisst ikke --accent (#0061F0) for å unngå Stripe-blå inntrykk). */
.floating-tab-item.active .tab-icon {
  color: #131313;
}

.floating-tab-item.active .tab-label {
  color: #131313;
  font-weight: 600;
}

/* ---- Cards ---- */
.card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--spacing-md);
  margin-bottom: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:active {
  transform: scale(0.985);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

/* Desktop hover lift — only for clickable cards */
@media (hover: hover) {
  .card-clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  }
  .card-clickable:active {
    transform: scale(0.985);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }
}

.hero-card {
  padding: 20px;
  background: linear-gradient(135deg, #f0f7ff 0%, #ffffff 60%);
}

.hero-completed {
  background: linear-gradient(135deg, #f8f9fb 0%, #ffffff 100%);
}

.hero-unsigned {
  background: linear-gradient(135deg, #fffbf0 0%, #ffffff 100%);
}

.compact-card {
  padding: 14px var(--spacing-md);
}

.card-warning {
  background: linear-gradient(135deg, #FFF8E8 0%, #FFFFFF 60%);
  border: 1px solid rgba(255, 155, 0, 0.15);
}

/* Completed cards show chevron */
.card-chevron {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: rgba(0, 0, 0, 0.25);
}

/* Pulse animation for sign button */
@keyframes subtlePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 155, 0, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(255, 155, 0, 0); }
}

.sign-button-wrap p-button {
  animation: subtlePulse 2s ease-in-out infinite;
  border-radius: 8px;
}

/* Non-clickable cards */
.receipt-buttons {
  cursor: default;
}

/* ---- Layout helpers ---- */
.card-row-between {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.section-label {
  margin-bottom: 8px;
  padding: 0 4px;
}

.back-row {
  margin-bottom: var(--spacing-md);
  animation: slideInFromLeft 250ms ease-out both;
}

/* Native primær-knapp (link/button) — fungerer uten PDS */
.btn-primary,
.btn-primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
  padding: 14px 24px;
  background: #1a1a1a;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s ease, transform .1s ease;
  -webkit-appearance: none;
  appearance: none;
}
.btn-primary:hover,
.btn-primary-link:hover { background: #2d2d2d; }
.btn-primary:active,
.btn-primary-link:active { transform: scale(0.98); }
.btn-primary:disabled {
  background: rgba(0, 0, 0, 0.2);
  cursor: not-allowed;
  transform: none;
}
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
  padding: 14px 24px;
  background: #fff;
  color: #1a1a1a;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border: 1.5px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s ease, border-color .15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.btn-secondary:hover {
  background: #FAFBFF;
  border-color: rgba(0, 97, 240, 0.4);
}

/* PDS display-only komponenter med interaktivt shadow-DOM kan kapre
   klikk fra parent <a>/<button>. p-icon og p-spinner har vist seg
   problematiske; p-text/heading/tag tester bra med text-selection
   og lar vi være. Hvis nye bugs dukker opp, utvid listen presist. */
p-icon, p-spinner { pointer-events: none; }

/* Sekundær-link (lys bakgrunn) */
.btn-secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
  padding: 14px 24px;
  background: #fff;
  color: #1a1a1a;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border: 1.5px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}
.btn-secondary-link:hover {
  background: #FAFBFF;
  border-color: rgba(0, 97, 240, 0.4);
}

/* "Pure"-link med ikon (kompakt, til "Se alle", "Logg ut", "Send på nytt" etc.) */
.link-pure {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  color: #1a1a1a;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: 6px;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}
.link-pure:hover { background: rgba(0, 0, 0, 0.04); }
.link-pure__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 14px;
  line-height: 1;
}
.link-pure--inline {
  padding: 4px 0;
  min-height: 0;
}

/* Native tilbake-lenke som ikke krever PDS (fungerer alltid) */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 4px;
  color: #131313;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  min-height: 44px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-family: inherit;
}
.back-link:hover { background: rgba(0, 0, 0, 0.04); }
.back-link__icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ---- Status summary line ---- */
.status-summary-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

/* ---- Speedometer / KM indicator ---- */
.km-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(0, 97, 240, 0.06);
  border-radius: 10px;
}

/* ---- Section count badge ---- */
.section-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 9999px;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.5);
  margin-left: 6px;
}

/* ---- Compact completed card on oversikt ---- */
.completed-compact {
  padding: 12px var(--spacing-md);
}

/* ---- See all button wrapper ---- */
.see-all-wrap {
  text-align: center;
  margin-top: 4px;
  margin-bottom: 8px;
}

/* ---- Progress bar ---- */
.progress-section {
  margin-top: 20px;
}

.progress-bar-track {
  height: 6px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.6s ease;
}

.progress-label {
  margin-top: 4px;
  text-align: center;
}

/* ---- Detail rows ---- */
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  gap: 12px;
}

.detail-row:last-child {
  border-bottom: none;
}

/* ---- Toll rows ---- */
.toll-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.toll-row:last-of-type {
  border-bottom: none;
}

/* ---- Payment card visual ---- */
.payment-card-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.payment-card-visual {
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 100%);
  border-radius: 12px;
  padding: 16px;
  color: #fff;
  position: relative;
  margin-bottom: 12px;
}

.payment-card-visual .card-brand {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  opacity: 0.8;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.payment-card-visual .card-number {
  font-size: 16px;
  letter-spacing: 2px;
  font-family: monospace;
  margin-bottom: 12px;
}

.payment-card-visual .card-expiry {
  font-size: 12px;
  opacity: 0.6;
}

/* ---- Avatar ---- */
.avatar-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0061F0 0%, #0047b3 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  box-shadow: 0 4px 16px rgba(0, 97, 240, 0.25);
}

.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 28px;
}

/* ---- Lagrede Stripe-kort i profil ---- */
.saved-card-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: #fff;
}
.saved-card-row__brand {
  flex-shrink: 0;
  width: 44px;
  height: 30px;
  border-radius: 6px;
  background: linear-gradient(135deg, #0061F0 0%, #0047b3 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
}
.saved-card-row__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.saved-card-row__title {
  font-size: 14px;
  font-weight: 600;
  color: #131313;
}
.saved-card-row__meta {
  font-size: 12px;
  color: #6E7682;
}
.saved-card-row.is-default {
  border-color: rgba(0, 97, 240, 0.35);
  background: linear-gradient(135deg, rgba(0, 97, 240, 0.04) 0%, #fff 60%);
}
.saved-card-row__tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  background: rgba(0, 97, 240, 0.12);
  color: #0047b3;
  vertical-align: middle;
}
.saved-card-row__actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.saved-card-row__default,
.saved-card-row__delete {
  min-height: 36px;
  padding: 6px 10px;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  white-space: nowrap;
}
.saved-card-row__default { color: #0061F0; }
.saved-card-row__default:hover { background: rgba(0, 97, 240, 0.06); }
.saved-card-row__delete { color: #DC3232; }
.saved-card-row__delete:hover { background: rgba(220, 50, 50, 0.06); }
.saved-card-row__default:disabled,
.saved-card-row__delete:disabled { opacity: 0.5; cursor: not-allowed; }
.saved-card-row.is-expired {
  opacity: 0.7;
  background: #FAFAFA;
}
.saved-card-row.is-expired .saved-card-row__brand {
  background: linear-gradient(135deg, #C0C0C0 0%, #909090 100%);
}
.saved-card-row__tag--expired {
  background: rgba(220, 50, 50, 0.12);
  color: #B11F1F;
}

/* ---- Skeleton placeholders for kort-lasting ---- */
.saved-card-row--skeleton {
  pointer-events: none;
}
.saved-card-row--skeleton .saved-card-row__brand {
  background: transparent;
}
.skeleton-shimmer {
  position: relative;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 6px;
}
.skeleton-shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.55) 50%,
    transparent 100%
  );
  transform: translateX(-100%);
  animation: skeleton-sweep 1.4s ease-in-out infinite;
}
.skeleton-line {
  height: 12px;
  margin: 0;
}
.skeleton-line--title { width: 60%; height: 13px; margin-bottom: 6px; }
.skeleton-line--meta  { width: 40%; height: 11px; }
@keyframes skeleton-sweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%);  }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton-shimmer::after { animation: none; }
}

.cards-loading__label {
  text-align: center;
  margin-top: 8px;
  opacity: 0.85;
}

/* ---- Fade-in når kort lastet ferdig ---- */
.cards-fade-in {
  animation: cards-fade-in 220ms ease-out both;
}
@keyframes cards-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0);   }
}
@media (prefers-reduced-motion: reduce) {
  .cards-fade-in { animation: none; }
}

/* Step 2 saved-card-pick — utløpt = grå + ikke-klikkbar */
.saved-card-pick.is-expired {
  opacity: 0.55;
  cursor: not-allowed;
  background: #FAFAFA;
}
.saved-card-pick.is-expired:hover {
  border-color: rgba(0, 0, 0, 0.08);
  background: #FAFAFA;
}
.saved-card-pick.is-expired .saved-card-pick__brand {
  background: linear-gradient(135deg, #C0C0C0 0%, #909090 100%);
}
.saved-card-pick__tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  background: rgba(220, 50, 50, 0.12);
  color: #B11F1F;
  vertical-align: middle;
}

/* ---- Velg lagret kort i signing step 2 ---- */
.saved-card-pick {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 8px;
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  text-align: left;
  transition: border-color .15s ease, background .15s ease;
}
.saved-card-pick:hover {
  border-color: rgba(0, 97, 240, 0.4);
  background: #FAFBFF;
}
.saved-card-pick.is-selected {
  border-color: #0061F0;
  background: linear-gradient(135deg, rgba(0, 97, 240, 0.04) 0%, #fff 60%);
}
.saved-card-pick__brand {
  flex-shrink: 0;
  width: 44px;
  height: 30px;
  border-radius: 6px;
  background: linear-gradient(135deg, #6E7682 0%, #4A525C 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.saved-card-pick.is-selected .saved-card-pick__brand {
  background: linear-gradient(135deg, #0061F0 0%, #0047b3 100%);
}
.saved-card-pick__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.saved-card-pick__title {
  font-size: 14px;
  font-weight: 600;
  color: #131313;
}
.saved-card-pick__meta {
  font-size: 12px;
  color: #6E7682;
}
.saved-card-pick__check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 0, 0, 0.18);
  background: #fff;
  position: relative;
}
.saved-card-pick.is-selected .saved-card-pick__check {
  border-color: #0061F0;
  background: #0061F0;
}
.saved-card-pick.is-selected .saved-card-pick__check::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 3px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ---- Karusell-piler: 44px touch-target ---- */
.dmg-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  border-radius: 8px;
  transition: background .15s ease;
}
.dmg-nav-btn:hover { background: rgba(0, 0, 0, 0.04); }
.dmg-nav-btn:active { background: rgba(0, 0, 0, 0.08); }

/* Skadefigur — bilde med klikkbare markører i naturlig aspect-ratio. */
.damage-img-wrap {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #f5f5f5;
}
.damage-img {
  display: block;
  width: 100%;
  height: auto;
}
.damage-markers {
  position: absolute;
  inset: 0;
  pointer-events: none; /* layer er gjennomsiktig — bare individuelle knapper får events */
}
.damage-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #DC3232;
  cursor: pointer;
  pointer-events: auto;
  padding: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(220, 50, 50, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.damage-marker:hover {
  transform: translate(-50%, -50%) scale(1.18);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35), 0 0 0 6px rgba(220, 50, 50, 0.18);
}
.damage-marker:focus-visible {
  outline: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35), 0 0 0 4px rgba(0, 97, 240, 0.4);
}

/* Skadefoto-popover som vises på markør-klikk. */
.damage-photo-popover {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.damage-photo-popover.is-open {
  display: flex;
}
.damage-photo-popover img {
  max-width: min(560px, 100%);
  max-height: 70vh;
  width: auto;
  height: auto;
  display: block;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}
.damage-photo-popover__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.95);
  cursor: pointer;
  font-size: 18px;
  font-weight: 600;
  color: #131313;
  display: flex;
  align-items: center;
  justify-content: center;
}
.damage-photo-popover__close:hover { background: #fff; }
.damage-photo-popover__desc {
  position: absolute;
  bottom: 24px;
  left: 24px;
  right: 24px;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 13px;
  border-radius: 8px;
  text-align: center;
}

/* ---- Nøkkelboks-kode-card (vises på kontrakt.php for aktive kontrakter
   når cars.keybox_url er en kode, ikke en URL). Lenker går fortsatt
   gjennom "Åpne nøkkelboks"-knappen. */
.keybox-code-card {
  text-align: center;
  background: linear-gradient(135deg, #FFFBEB 0%, #FFF5D6 100%);
  border: 1px solid #FBBF24;
  border-radius: 14px;
  padding: 20px 24px;
}
.keybox-code-card__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #92400E;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.keybox-code-card__code {
  font-family: 'SF Mono', ui-monospace, Menlo, Monaco, 'Courier New', monospace;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #131313;
  word-break: break-all;
  line-height: 1.2;
  user-select: all;
}
.keybox-code-card__spot {
  margin-top: 10px;
  font-size: 12px;
  color: #92400E;
}

/* ---- Kontrakt-modal (signing step 3 "Se leiekontrakt") ----
   Selvstendig modal-struktur som IKKE arver .profile-sheet — vi
   trenger garantert scroll i body uten å konkurrere med .profile-sheet
   sin overflow-y:auto + sticky header. Display:grid med 1fr-rad +
   min-height:0 er den eneste kombinasjonen som scroller pålitelig
   på tvers av iOS Safari, Firefox og Chrome. */
.k-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.k-modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.k-modal {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.18);
  height: 92vh;
  max-height: 92vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  transform: translateY(100%);
  transition: transform 0.26s cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: none;
}
.k-modal.is-open {
  transform: translateY(0);
  pointer-events: auto;
}

.k-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: #fff;
}
.k-modal__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #131313;
}
.k-modal__close {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #6E7682;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
}
.k-modal__close:hover { background: rgba(0, 0, 0, 0.04); }

.k-modal__body {
  /* min-height:0 er kritisk — uten den vokser grid-radens implicit
     min-height til content-størrelsen, og overflow-y:auto engasjerer aldri. */
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 16px 20px calc(28px + env(safe-area-inset-bottom));
}

@media (min-width: 768px) {
  .k-modal {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    transform: translate(-50%, calc(-50% + 16px));
    opacity: 0;
    width: calc(100% - 32px);
    max-width: 560px;
    border-radius: 16px;
    height: 88vh;
    max-height: 88vh;
  }
  .k-modal.is-open {
    transform: translate(-50%, -50%);
    opacity: 1;
  }
}

/* ---- Kontrakt-detaljer i signing-accordion (key/value-rader) ---- */
.contract-details {
  padding: 8px 0;
}
.contract-section {
  padding: 12px 0 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.contract-section:last-of-type {
  border-bottom: 0;
}
.contract-section__title {
  display: block;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.contract-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 6px 0;
  font-size: 13px;
  line-height: 1.5;
}
.contract-row__label {
  color: #6E7682;
  flex-shrink: 0;
  font-weight: 500;
}
.contract-row__value {
  color: #131313;
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}
.contract-info-block {
  padding: 12px 0;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.contract-info-block:first-of-type {
  margin-top: 8px;
}

/* ---- Spesifikasjon av beløp som reserveres (step 2) ---- */
.invoice-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 14px;
}
.invoice-row:last-child { border-bottom: 0; }
.invoice-row__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.invoice-row__name {
  color: #131313;
  font-weight: 500;
}
.invoice-row__qty {
  font-size: 12px;
  color: #6E7682;
}
.invoice-row__sum {
  flex-shrink: 0;
  color: #131313;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.invoice-row--total {
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1.5px solid rgba(0, 0, 0, 0.12);
  font-size: 15px;
}
.invoice-row--total .invoice-row__name,
.invoice-row--total .invoice-row__sum { font-weight: 700; }

/* ---- "Jobber"-modal: låser skjermen under betaling ---- */
.payment-busy {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.payment-busy.is-open {
  opacity: 1;
  pointer-events: auto;
}
.payment-busy__card {
  background: #fff;
  border-radius: 16px;
  padding: 32px 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
  transform: scale(0.95);
  transition: transform .2s ease;
}
.payment-busy.is-open .payment-busy__card {
  transform: scale(1);
}
.payment-busy__title {
  margin: 18px 0 8px;
  font-size: 16px;
  font-weight: 700;
  color: #131313;
}
.payment-busy__sub {
  margin: 0;
  font-size: 13px;
  color: #6E7682;
  line-height: 1.5;
}
.payment-busy__icon {
  display: flex;
  justify-content: center;
  margin-bottom: 6px;
}
.payment-busy__spinner {
  display: flex;
  justify-content: center;
}
.payment-busy__actions {
  margin-top: 20px;
}

/* ---- Signing-progresjon (minbil-stil) ---- */
.signing-progress {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 3px;
  overflow: hidden;
}
.signing-progress__bar {
  height: 100%;
  background: #0061F0;
  border-radius: 3px;
  transition: width .3s ease;
}

/* ---- Profilvelger: kompakt trigger + bottom-sheet ---- */
.profile-switcher-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color .15s ease, background .15s ease;
}
.profile-switcher-trigger:hover {
  border-color: rgba(0, 97, 240, 0.4);
  background: #FAFBFF;
}
.profile-switcher-trigger__avatar {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0061F0 0%, #0047b3 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.profile-switcher-trigger__avatar--firma { border-radius: 7px; }
.profile-switcher-trigger__label {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: #131313;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-switcher-trigger__hint {
  font-size: 11px;
  font-weight: 500;
  color: #0061F0;
  flex-shrink: 0;
}

/* ---- Profilvelger: bottom-sheet på mobil, sentrert modal på desktop ---- */
.profile-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.profile-sheet-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}
.profile-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 12px 16px 24px;
  z-index: 999;
  max-height: 80vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  transform: translateY(100%);
  transition: transform .26s cubic-bezier(0.32, 0.72, 0, 1);
  /* Hindre at sheet'en kapret klikk når den var lukket men fortsatt
     i DOM-en med position:fixed. Bug: klikk på "Trenger du hjelp?"
     traff nederste profilvelger-tile i den skjulte sheet'en. */
  pointer-events: none;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}
.profile-sheet.is-open {
  transform: translateY(0);
  pointer-events: auto;
  /* Box-shadow kun når åpen — ellers bløder den -12px-offsetede
     skyggen oppover inn i viewporten fra translateY(100%)-posisjonen
     og syns som en skygge over tab-baren på mobil. */
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.18);
}
.profile-sheet__handle {
  display: block;
  width: 36px;
  height: 4px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 2px;
  margin: 0 auto 16px;
}
.profile-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  background: #fff;
  padding-top: 4px;
  padding-bottom: 8px;
  z-index: 1;
}
.profile-sheet__title {
  font-size: 16px;
  font-weight: 700;
  color: #131313;
  margin: 0;
}
.profile-sheet__close {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #6E7682;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 6px;
}
.profile-sheet__close:hover { background: rgba(0, 0, 0, 0.04); }

@media (min-width: 768px) {
  .profile-sheet {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    transform: translate(-50%, calc(-50% + 16px));
    opacity: 0;
    border-radius: 16px;
    max-width: 480px;
    width: calc(100% - 32px);
    padding: 20px 20px 24px;
  }
  .profile-sheet.is-open {
    transform: translate(-50%, -50%);
    opacity: 1;
  }
  .profile-sheet__handle { display: none; }
}

/* ---- Profilvelger (firma / privat) ---- */
.profile-switcher {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}
.profile-switcher__item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  width: 100%;
  transition: border-color .15s ease, background .15s ease, transform .1s ease;
}
.profile-switcher__item:hover {
  border-color: rgba(0, 97, 240, 0.4);
  background: #FAFBFF;
}
.profile-switcher__item:active {
  transform: scale(0.995);
}
.profile-switcher__item.is-active {
  border-color: #0061F0;
  background: linear-gradient(135deg, rgba(0, 97, 240, 0.04) 0%, #fff 60%);
  cursor: default;
}
.profile-switcher__item.is-active:hover {
  background: linear-gradient(135deg, rgba(0, 97, 240, 0.04) 0%, #fff 60%);
}
.profile-switcher__avatar {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6E7682 0%, #4A525C 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.profile-switcher__item.is-active .profile-switcher__avatar {
  background: linear-gradient(135deg, #0061F0 0%, #0047b3 100%);
  box-shadow: 0 4px 12px rgba(0, 97, 240, 0.3);
}
.profile-switcher__avatar--firma {
  border-radius: 10px;
}
.profile-switcher__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.profile-switcher__name {
  font-size: 15px;
  font-weight: 600;
  color: #131313;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 8px;
}
.profile-switcher__tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  background: #F0F1F4;
  color: #6E7682;
}
.profile-switcher__tag--firma {
  background: rgba(0, 97, 240, 0.12);
  color: #0047b3;
}
.profile-switcher__meta {
  font-size: 12px;
  color: #6E7682;
}
.profile-switcher__indicator {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6E7682;
  font-size: 16px;
}
.profile-switcher__item.is-active .profile-switcher__indicator {
  color: #0061F0;
}

/* ---- Signature preview ---- */
.signature-preview {
  background: #FAFAFA;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  padding: 12px;
  margin: 8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.signature-block {
  margin-bottom: 16px;
}

.signature-block:last-child {
  margin-bottom: 0;
}

/* ---- 360° Car Spin Viewer ---- */
.spin-viewer {
  border-radius: 12px;
  overflow: hidden;
  background: #FAFAFA;
}

.spin-canvas {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  cursor: grab;
  overflow: hidden;
  background: #F8F8FA;
}

.spin-canvas:active {
  cursor: grabbing;
}

/* Spin frames (image + overlay) */
.spin-frame {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.spin-frame.active {
  opacity: 1;
  pointer-events: auto;
}

.spin-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.spin-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
}

/* Zone markers */
.zone-marker {
  position: absolute;
  width: 28px;
  height: 28px;
  margin-left: -14px;
  margin-top: -14px;
  border-radius: 50%;
  border: 2px solid rgba(0, 100, 200, 0.3);
  background: rgba(0, 100, 200, 0.08);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.zone-marker:hover {
  transform: scale(1.3);
  border-color: rgba(0, 100, 200, 0.6);
  background: rgba(0, 100, 200, 0.15);
}

.zone-marker.highlighted {
  transform: scale(1.4);
  border-color: rgba(0, 100, 200, 0.8);
  background: rgba(0, 100, 200, 0.2);
  box-shadow: 0 0 12px rgba(0, 100, 200, 0.3);
}

/* Damage markers */
.zone-marker.has-damage {
  border-color: rgba(220, 50, 50, 0.5);
  background: rgba(220, 50, 50, 0.1);
}

.zone-marker.has-damage:hover,
.zone-marker.has-damage.highlighted {
  border-color: rgba(220, 50, 50, 0.8);
  background: rgba(220, 50, 50, 0.2);
  box-shadow: 0 0 12px rgba(220, 50, 50, 0.3);
}

.zone-marker.has-damage.major {
  border-color: rgba(220, 50, 50, 0.7);
  background: rgba(220, 50, 50, 0.15);
}

.zone-damage-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #DC3232;
  animation: damagePulse 2s ease infinite;
}

@keyframes damagePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
}

/* Damage info panel */
.spin-damage-info {
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  background: #fff;
}

.damage-info-content {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.damage-info-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.damage-info-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.damage-info-dot.minor { background: #F59E0B; }
.damage-info-dot.major { background: #DC3232; }

/* ---- Damage list (below viewer) ---- */
.damage-list {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: #fff;
}

.damage-list-header {
  padding: 12px 16px 8px;
}

.damage-list-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 16px;
}

.damage-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  min-height: 48px;
}

.damage-list-row:hover {
  background: rgba(0, 0, 0, 0.02);
}

.damage-list-row:active,
.damage-list-row.active {
  background: rgba(0, 100, 200, 0.04);
}

.damage-list-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.damage-list-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.damage-list-dot.minor { background: #F59E0B; }
.damage-list-dot.major { background: #DC3232; }

.spin-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-family: 'Porsche Next', 'Arial Narrow', Arial, sans-serif;
  pointer-events: none;
  animation: hintPulse 2s ease infinite;
}

@keyframes hintPulse {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 0.5; }
}

.spin-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 16px;
  background: #fff;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.spin-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  color: #1a1a1a;
  -webkit-tap-highlight-color: transparent;
}

.spin-btn:active {
  background: #F0F0F2;
}

.spin-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.spin-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.15);
  transition: background 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

.spin-dot.active {
  background: rgba(0, 0, 0, 0.7);
  transform: scale(1.2);
}

.spin-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px;
  background: #FAFAFA;
  border-radius: 12px;
}

/* ---- Receipt buttons ---- */
.receipt-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---- Car profile card on kontrakt ---- */
.car-profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0;
}

.car-profile-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f0fe 100%);
  flex-shrink: 0;
}

.car-profile-details {
  flex: 1;
}

/* ---- Accordion heading icon helper ---- */
.accordion-icon-heading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ---- Footer text ---- */
.profil-footer {
  text-align: center;
  margin-top: 32px;
  padding-bottom: 8px;
}

/* ---- Links ---- */
a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ---- Accordion tweaks ---- */
p-accordion {
  --p-accordion-border-color: rgba(0, 0, 0, 0.06);
}

/* ---- Accordion Cards (custom, not PDS p-accordion) ---- */
.acc-card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  margin-bottom: 10px;
  overflow: hidden;
}

.acc-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  min-height: 48px;
}

.acc-card-header:active {
  background: rgba(0, 0, 0, 0.02);
}

.acc-card-title {
  font-family: 'Porsche Next', 'Arial Narrow', Arial, sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
}

.acc-card-chevron {
  transition: transform 0.2s ease;
  color: #8e8e93;
  flex-shrink: 0;
}

.acc-card.open .acc-card-chevron {
  transform: rotate(180deg);
}

.acc-card-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.acc-card.open .acc-card-body {
  max-height: 2000px;
}

.acc-card-content {
  padding: 0 16px 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.accordion-card .detail-row {
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.accordion-card .detail-row:last-child {
  border-bottom: none;
}

.accordion-card .toll-row {
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.accordion-card .toll-row:last-of-type {
  border-bottom: none;
}

/* Tighten dividers inside accordion cards */
.accordion-card p-divider {
  margin: 8px 0;
}

/* Payment card info inside accordion */
.accordion-card .payment-card-info {
  margin-bottom: 0;
}

/* ---- Help section heading ---- */
.help-heading {
  text-align: center;
  margin-bottom: 16px;
}

/* ---- Historikk summary line ---- */
.historikk-summary {
  margin-top: 4px;
}

.historikk-count {
  margin-bottom: 20px;
}

/* ---- Spacing utility classes ---- */
.mt-xs { margin-top: var(--spacing-xs); }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

.mb-xs { margin-bottom: var(--spacing-xs); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

.text-right { text-align: right; }

/* ---- Login page ---- */
.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: var(--spacing-md);
  padding-top: 60px;
}

.login-brand {
  text-align: center;
  margin-bottom: 48px;
}

.login-content {
  width: 100%;
  max-width: 400px;
}

.login-phone-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 0 12px;
  height: 48px;
  background: #fff;
}

.login-prefix {
  flex-shrink: 0;
  padding-right: 8px;
  border-right: 1px solid rgba(0, 0, 0, 0.1);
}

.login-phone-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  font-family: 'Porsche Next', 'Arial Narrow', Arial, sans-serif;
  background: transparent;
  height: 100%;
}

.login-phone-input::placeholder {
  color: rgba(0, 0, 0, 0.3);
}

/* ---- OTP digit boxes ---- */
.digit-input-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.digit-box {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  font-family: 'Porsche Next', 'Arial Narrow', Arial, sans-serif;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  outline: none;
  background: #fff;
  transition: border-color 0.15s ease;
}

.digit-box:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 97, 240, 0.15);
}

/* ---- Stepper section ---- */
.stepper-section {
  margin: var(--spacing-md) 0;
}

/* ---- Signature Pad ---- */
.sig-pad {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.sig-pad-canvas-wrap {
  position: relative;
  width: 100%;
  height: 160px;
  cursor: crosshair;
  touch-action: none;
}

.sig-pad-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.sig-pad-placeholder {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.sig-pad-actions {
  display: flex;
  justify-content: flex-end;
  padding: 6px 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  background: #FAFAFA;
}

.sig-pad-clear {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: 'Porsche Next', 'Arial Narrow', Arial, sans-serif;
  font-size: 13px;
  color: #626669;
  border-radius: 6px;
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.sig-pad-clear:active {
  background: rgba(0, 0, 0, 0.04);
}

/* Legacy mock area (keep for compatibility) */
.mock-signature-area {
  border: 2px dashed rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FAFAFA;
}

/* ---- Mock card form ---- */
.mock-card-form {
  display: flex;
  flex-direction: column;
}

.mock-card-form-row {
  display: flex;
  gap: 12px;
  margin-top: var(--spacing-md);
}

.mock-card-form-half {
  flex: 1;
}

.mock-card-input {
  width: 100%;
  height: 44px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 16px; /* Must be 16px+ to prevent iOS Safari zoom */
  font-family: 'Porsche Next', 'Arial Narrow', Arial, sans-serif;
  outline: none;
  background: #fff;
  margin-top: 4px;
  transition: border-color 0.15s ease;
}

.mock-card-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 97, 240, 0.15);
}

.mock-card-input::placeholder {
  color: rgba(0, 0, 0, 0.3);
}

/* ---- Module form (signing flow) ---- */
.module-form {
  display: flex;
  flex-direction: column;
}

/* ---- Summary check row (signing confirm) ---- */
.summary-check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.summary-check-row:last-child {
  border-bottom: none;
}

/* ---- Success view ---- */
.success-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 60px;
}

.success-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(1, 129, 1, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- FAQ section ---- */
.faq-section {
  margin-top: var(--spacing-lg);
}

/* ---- Contact card row ---- */
.contact-card-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.contact-card-link {
  text-decoration: none;
}

.contact-card-link:hover {
  text-decoration: none;
}

/* ---- Checkbox row ---- */
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.checkbox-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--accent);
}

/* ---- Track indicators (oversikt cards) ---- */
.track-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
}

.track-fast {
  background: rgba(1, 129, 1, 0.06);
  border: 1px solid rgba(1, 129, 1, 0.12);
}

.track-medium {
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.15);
}

.track-slow {
  background: rgba(220, 50, 50, 0.05);
  border: 1px solid rgba(220, 50, 50, 0.12);
}

/* Card with incomplete profile */
.card-incomplete {
  border-color: rgba(220, 50, 50, 0.15);
  background: linear-gradient(135deg, #FFF5F5 0%, #FFFFFF 60%);
}

.missing-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-left: 24px;
}

/* ---- Fast-track status rows ---- */
.fast-track-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fast-track-row p-text {
  flex: 1;
}

/* ---- Profile completion bar ---- */
.profile-completion {
  text-align: left;
}

.completion-bar-track {
  height: 6px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 3px;
  overflow: hidden;
}

.completion-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* ---- Profile editable rows ---- */
.profil-row {
  position: relative;
}

.profil-row-value {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profil-edit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  padding: 0;
}

.profil-edit-btn:active {
  background: rgba(0, 0, 0, 0.08);
}

.profil-edit-form {
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}

.profil-edit-form .profil-edit-input {
  margin-top: 0;
  height: 40px;
}

.profil-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.profil-save-btn,
.profil-cancel-btn {
  padding: 6px 16px;
  border-radius: 6px;
  border: none;
  font-family: 'Porsche Next', 'Arial Narrow', Arial, sans-serif;
  font-size: 13px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.profil-save-btn {
  background: var(--accent);
  color: #fff;
}

.profil-save-btn:active {
  opacity: 0.85;
}

.profil-cancel-btn {
  background: rgba(0, 0, 0, 0.06);
  color: #626669;
}

.profil-cancel-btn:active {
  background: rgba(0, 0, 0, 0.1);
}

/* ---- Consent toggles ---- */
.consent-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.consent-row:last-child {
  border-bottom: none;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 26px;
  transition: background 0.2s ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 2px;
  bottom: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* ---- Vilkaar page ---- */
.vilkaar-page {
  position: relative;
}

.vilkaar-content {
  margin-bottom: var(--spacing-lg);
}

.vilkaar-section {
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.vilkaar-section:last-child {
  border-bottom: none;
}

.vilkaar-scroll-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 10px;
  text-align: center;
  transition: opacity 0.3s ease;
}

/* ---- Vilkaar read badge ---- */
.vilkaar-read-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

/* ===================================
   Live Chat Component
   =================================== */

.chat-bubble {
  position: fixed;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  right: 16px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #0061F0;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 97, 240, 0.35);
  z-index: 300;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.chat-bubble:active {
  transform: scale(0.9);
}

.chat-bubble.open {
  transform: scale(0);
  pointer-events: none;
}

.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #DC3232;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  font-family: 'Porsche Next', Arial, sans-serif;
  animation: badgePop 0.3s ease;
}

@keyframes badgePop {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Chat panel — fullscreen on mobile, floating on desktop */
.chat-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  top: 0;
  background: #F4F4F6;
  z-index: 400;
  display: flex;
  flex-direction: column;
  animation: chatSlideUp 0.3s ease;
  /* Handle iOS keyboard — use visual viewport */
  height: 100dvh;
}

@media (min-width: 500px) {
  .chat-panel {
    top: auto;
    left: auto;
    right: 16px;
    bottom: 16px;
    width: 380px;
    height: 580px;
    max-height: calc(100dvh - 32px);
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
  }
}

@keyframes chatSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
}

@media (min-width: 500px) {
  .chat-header {
    padding-top: 16px;
  }
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #0061F0;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Porsche Next', Arial, sans-serif;
}

.chat-status {
  color: #059669;
}

.chat-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.04);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.chat-close:active {
  background: rgba(0, 0, 0, 0.08);
}

/* Messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-welcome {
  text-align: center;
  padding: 24px 16px;
  opacity: 0.7;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  animation: msgFadeIn 0.2s ease;
}

@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg-user {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-msg-agent {
  align-self: flex-start;
  align-items: flex-start;
}

.chat-msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-family: 'Porsche Next', 'Arial Narrow', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.chat-msg-user .chat-msg-bubble {
  background: #0061F0;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg-agent .chat-msg-bubble {
  background: #fff;
  color: #1a1a1a;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-bottom-left-radius: 4px;
}

.chat-msg-time {
  font-size: 10px;
  color: rgba(0, 0, 0, 0.35);
  margin-top: 4px;
  padding: 0 4px;
  font-family: 'Porsche Next', Arial, sans-serif;
}

/* Typing indicator */
.typing-dots {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3);
  animation: typingBounce 1.2s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

/* Input area */
.chat-input-area {
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.chat-quick-actions {
  display: flex;
  gap: 6px;
  padding: 10px 16px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.chat-quick-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #fff;
  font-family: 'Porsche Next', Arial, sans-serif;
  font-size: 13px;
  color: #0061F0;
  cursor: pointer;
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.chat-quick-btn:active {
  background: rgba(0, 97, 240, 0.06);
}

.chat-compose {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 12px;
}

.chat-text-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #F4F4F6;
  font-family: 'Porsche Next', 'Arial Narrow', Arial, sans-serif;
  font-size: 16px; /* 16px+ prevents iOS Safari zoom */
  outline: none;
  transition: border-color 0.15s ease;
}

.chat-text-input:focus {
  border-color: #0061F0;
  background: #fff;
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #0061F0;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.chat-send-btn:active {
  transform: scale(0.9);
}
