/**
 * OTTO · slice 3 phone (dark thread) · shared by home, /forhandlere/brugtvogn/, /vaerksted/.
 * Markup: src/lib/slots3.mjs ({{s3phone:<page>}}), copy: src/copy/slice3.json, motion: /assets/phone3.js.
 * External review P1–P4, P6 (chips: model + service/time only), P7; P5 (light thread) declined → dark thread in the bezel.
 * Tokens (Kreativ, CoS OK): thread #0b141a · card #202c33 + 3px edge #e39a78 · inset #111b21 / #e9edef · Send #00a884 / #0b141a ·
 * Ret ghost #e9edef · changed words rgba(227,154,120,.12) + 1px underline #e39a78 · stamp/«Alt er klaret» #00a884 · receipts #8696a0.
 * Colour = state only (no per-agent colours); status is always also in text. Nothing below 10.5px; times tabular-nums.
 * Only transform/opacity animate (visibility flips with them). Fixed phone size; state swaps share one grid cell → no CLS.
 * Server HTML = END frame (no JS / reduced motion). .p3-armed = JS took over (start frame + play).
 */
.p3 {
  --p3-bg: #0b141a;
  --p3-panel: #1f2c34;
  --p3-card: #202c33;
  --p3-inset: #111b21;
  --p3-text: #e9edef;
  --p3-meta: #8696a0;
  --p3-green: #00a884;
  --p3-ask: #e39a78;
  --p3-chg: rgba(227, 154, 120, 0.12);
  --p3-line: #2a3942;
  --p3-dig: #1d3a33;
  color: var(--p3-text);
  font-family: var(--font-phone, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
  -webkit-font-smoothing: antialiased;
}
.p3 p, .p3 ul { margin: 0; padding: 0; }
.p3 ul { list-style: none; }
.p3 button { font: inherit; margin: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.p3 .p3-time, .p3 .p3-clock, .p3 .p3-stamp, .p3 .p3-pin-text { font-variant-numeric: tabular-nums; }

/* ---------- Fixed device size (brugtvogn + vaerksted; home keeps living-phone-chrome --screen-h) ---------- */
.phone-hero .phone-stage .phone.p3 { transform: none; transition: none; }
.phone-hero .phone-stage .phone.p3:hover { transform: none; }
.phone-hero .phone-stage .p3 .phone-screen { height: 680px; min-height: 0; max-height: none; }
@media (max-width: 899px) { .phone-hero .phone-stage .p3 .phone-screen { height: 640px; min-height: 0; max-height: none; } }
@media (max-width: 420px) { .phone-hero .phone-stage .p3 .phone-screen { height: 600px; min-height: 0; max-height: none; } }
.p3 .phone-screen { background: var(--p3-bg); display: flex; flex-direction: column; overflow: hidden; contain: layout paint; }
.p3 .phone-status { flex-shrink: 0; }
.p3 .p3-clock { display: inline-block; min-width: 3.2em; }

/* ---------- Header (P3): stacked initials + «Jeres hold» + «N AI-assistenter · human placeholder» ---------- */
.p3 .p3-head {
  flex-shrink: 0; display: flex; align-items: center; gap: 8px;
  background: var(--p3-panel); padding: 6px 12px 9px 8px; position: relative; z-index: 3;
}
.p3 .p3-back { color: var(--p3-meta); font-size: 22px; line-height: 1; padding: 0 2px 2px 4px; font-weight: 300; }
.p3 .p3-stack { display: flex; flex-shrink: 0; padding-left: 6px; }
.p3 .p3-stack span {
  width: 24px; height: 24px; margin-left: -6px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--p3-line); color: var(--p3-text); border: 2px solid var(--p3-panel);
  font-size: 10.5px; font-weight: 700; line-height: 1;
}
.p3 .p3-stack .p3-human { margin-left: -2px; } /* the human (jeres marketing): person icon #e9edef on the same chip as the agents; never terracotta */
.p3 .p3-stack .p3-human svg { display: block; }
.p3 .p3-team { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.p3 .p3-team strong { font-size: 14px; font-weight: 600; color: var(--p3-text); }
.p3 .p3-team span { font-size: 11px; color: var(--p3-meta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p3 .p3-team .p3-teamline { white-space: normal; overflow: visible; text-overflow: clip; } /* never cut «jeres marketing» */
.p3 .p3-team .sep-i { white-space: nowrap; overflow: visible; font-size: inherit; } /* team line parts (sep-row, identity.mjs): wrap between parts, «·» never at a line edge */

/* ---------- Pinned bar: «N venter på dig» → «Alt er klaret» ---------- */
.p3 .p3-pin {
  flex-shrink: 0; height: 30px; box-sizing: border-box; display: flex; align-items: center; gap: 7px;
  padding: 0 12px; background: var(--p3-inset); border-top: 1px solid var(--p3-line); border-bottom: 1px solid var(--p3-line);
  font-size: 12px; font-weight: 600; color: var(--p3-ask); position: relative; z-index: 3;
}
.p3 .p3-pin-dot { width: 12px; height: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; line-height: 1; }
.p3 .p3-pin-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.p3 .p3-pin-text { flex: 1; min-width: 0; white-space: nowrap; }
.p3 .p3-pin-link {
  background: none; border: 0; padding: 4px 0 4px 8px; color: var(--p3-text); font-size: 12px; font-weight: 500;
}
.p3 .p3-pin-link::after { content: " ›"; }
.p3 .p3-pin.is-done { color: var(--p3-green); }
.p3 .p3-pin.is-done .p3-pin-dot::before { content: "✓"; width: auto; height: auto; border-radius: 0; background: none; }
.p3 .p3-pin.is-done .p3-pin-link { visibility: hidden; }

/* ---------- Thread ---------- */
/* END frame (no JS, reduced motion): the thread opens at scrollTop 0. .p3-now is exactly one thread-height tall (100cqh) and
   bottom-aligned, so its last item, the one waiting card, sits fully in view; older items overflow upwards (clipped),
   later items (.p3-later) are one scroll down. No reordering, no JS, nothing moves after paint.
   Animated mode (JS, motion OK): the two wrappers are display:contents and the inner list moves by transform. */
.p3 .p3-thread {
  flex: 1; min-height: 0; position: relative; background: var(--p3-bg); container-type: size;
  display: block; overflow-y: auto; overscroll-behavior: auto; /* scroll chains to the page over the phone (Otto delta D5) */ scrollbar-width: none;
}
.p3 .p3-thread::-webkit-scrollbar { display: none; }
.p3 .p3-thread:focus-visible { outline: 2px solid var(--p3-green); outline-offset: -2px; }
.p3 .p3-inner { display: flex; flex-direction: column; }
.p3 .p3-now, .p3 .p3-later { display: flex; flex-direction: column; gap: 8px; padding: 0 8px 12px; box-sizing: border-box; }
.p3 .p3-now { flex: none; height: 100cqh; justify-content: flex-end; padding-top: 10px; }
.p3 .p3-later:empty { display: none; }
/* html.js is set inline in <head> before first paint, so this layout never switches after render (no CLS). */
@media (prefers-reduced-motion: no-preference) {
  .js .p3 .p3-thread { overflow: hidden; }
  .js .p3 .p3-inner {
    position: absolute; left: 0; right: 0; bottom: 0; gap: 8px; padding: 10px 8px 12px;
    will-change: transform; transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
  }
  .js .p3 .p3-now, .js .p3 .p3-later { display: contents; }
}

.p3 .p3-day { text-align: center; margin: 2px 0; }
.p3 .p3-day span {
  display: inline-block; background: #1a2830; color: var(--p3-meta);
  font-size: 10.5px; font-weight: 500; padding: 4px 10px; border-radius: 7px;
}
.p3 .p3-msg { position: relative; max-width: 92%; align-self: flex-start; }
.p3 .p3-ini {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--p3-line); color: var(--p3-text); font-size: 10.5px; font-weight: 700; line-height: 1;
}
.p3 .p3-role { color: var(--p3-meta); font-weight: 400; }
.p3 .p3-time { font-size: 10.5px; color: var(--p3-meta); white-space: nowrap; }
.p3 .p3-lane {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; color: var(--p3-meta);
}
.p3 .p3-tick { color: var(--p3-green); font-weight: 700; }

/* Receipt: one quiet line, tick, internal work only */
.p3 .p3-rcpt {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr); column-gap: 6px; row-gap: 1px; align-items: start;
  padding: 2px 4px; color: var(--p3-meta); font-size: 12px; line-height: 1.4; max-width: 100%;
}
.p3 .p3-rcpt .p3-tick { font-size: 12px; line-height: 20px; }
.p3 .p3-rcpt .p3-rtext { padding-top: 1px; }
.p3 .p3-rcpt .p3-rtext b { color: var(--p3-text); font-weight: 600; }
.p3 .p3-rcpt .p3-rwho { display: flex; gap: 8px; justify-content: space-between; align-items: baseline; }
.p3 .p3-rcpt .p3-rmeta { white-space: nowrap; }

/* Card + digest shell */
.p3 .p3-card, .p3 .p3-digest {
  background: var(--p3-card); border-radius: 10px; padding: 9px 10px 10px 12px; width: 92%; max-width: none; box-sizing: border-box;
  font-size: 13.5px; line-height: 1.4;
}
.p3 .p3-mhead { display: flex; align-items: center; gap: 7px; font-size: 12px; line-height: 1.3; }
.p3 .p3-who { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p3 .p3-who b { font-weight: 600; color: var(--p3-text); }
.p3 .p3-tags { display: flex; gap: 8px; align-items: center; margin: 3px 0 5px 27px; min-height: 15px; }
.p3 .p3-ctx { color: var(--p3-text); }
.p3 .p3-ctx strong { font-weight: 600; }

/* Approval card («Venter på dig» edge; edge goes after Send) */
.p3 .p3-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 10px 0 0 10px;
  background: var(--p3-ask); transition: opacity 0.3s ease;
}
.p3 .p3-card.is-sent::before { opacity: 0; }
.p3 .p3-wait { font-size: 10.5px; font-weight: 700; color: var(--p3-ask); transition: opacity 0.3s ease, visibility 0s; }
.p3 .p3-card.is-sent .p3-wait { opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0s linear 0.3s; }

.p3 .p3-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 7px 0 0; }
.p3 .p3-chips li {
  font-size: 11px; line-height: 1.3; padding: 3px 8px; border-radius: 999px;
  background: rgba(233, 237, 239, 0.07); color: var(--p3-text);
}
.p3 .p3-chips b { font-weight: 600; }

.p3 .p3-inset { margin-top: 8px; background: var(--p3-inset); border-radius: 8px; padding: 7px 9px 8px; }
.p3 .p3-ilabel { display: block; font-size: 11px; font-weight: 600; color: var(--p3-meta); margin-bottom: 2px; }
.p3 .p3-draft { font-size: 13px; line-height: 1.42; color: var(--p3-text); }
.p3 .p3-chg {
  background: var(--p3-chg); color: var(--p3-text);
  text-decoration: underline 1px var(--p3-ask); text-underline-offset: 2px; border-radius: 2px; padding: 0 1px;
}

/* Ret/Send swaps: both versions share one grid cell (height = the taller one) → state change never moves layout */
.p3 .p3-swap { display: inline-grid; vertical-align: top; }
.p3 .p3-draft > .p3-swap { display: grid; }
.p3 .p3-swap > * { grid-area: 1 / 1; transition: opacity 0.3s ease, visibility 0s; }
.p3 .p3-swap > .p3-b,
.p3 .p3-card.is-fixed .p3-swap > .p3-a { opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0s linear 0.3s; }
.p3 .p3-card.is-fixed .p3-swap > .p3-b { opacity: 1; visibility: visible; transition: opacity 0.3s ease 0.05s, visibility 0s; }
/* Tap-only Rets (RET-SUPPLEMENT): not reserved in the layout, so the END frame keeps its exact size; shown on the visitor's tap */
.p3 .p3-swap-tap > .p3-b, .p3 .p3-card.is-fixed .p3-swap-tap > .p3-a { display: none; }
.p3 .p3-card.is-fixed .p3-swap-tap > .p3-b { display: inline; }
.p3 .p3-tapdig:not(.is-shown) { display: none; }

.p3 .p3-act { display: grid; margin-top: 9px; min-height: 30px; }
.p3 .p3-btns, .p3 .p3-stamp { grid-area: 1 / 1; align-self: center; }
.p3 .p3-btns { display: flex; gap: 8px; transition: opacity 0.25s ease, visibility 0s; }
.p3 .p3-send, .p3 .p3-ret {
  height: 30px; padding: 0 18px; border-radius: 999px; font-size: 12.5px; font-weight: 600; line-height: 1;
  transition: transform 0.12s ease;
}
.p3 .p3-send { background: var(--p3-green); color: var(--p3-bg); border: 1px solid var(--p3-green); }
.p3 .p3-ret { background: transparent; color: var(--p3-text); border: 1px solid var(--p3-text); }
.p3 .p3-send:focus-visible, .p3 .p3-ret:focus-visible, .p3 .p3-all:focus-visible, .p3 .p3-pin-link:focus-visible {
  outline: 2px solid var(--p3-text); outline-offset: 2px;
}
.p3 .is-press { transform: scale(0.97); }
.p3 .p3-ret.is-used { opacity: 0.45; }
.p3 .p3-stamp {
  font-size: 12px; font-weight: 600; color: var(--p3-green);
  opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}
.p3 .p3-card.is-sent .p3-btns { opacity: 0; visibility: hidden; transition: opacity 0.2s ease, visibility 0s linear 0.2s; }
.p3 .p3-card.is-sent .p3-stamp { opacity: 1; visibility: visible; transition: opacity 0.3s ease 0.1s, visibility 0s; }

/* Digest: Nils's ticked list; waiting items last, in the «venter» colour */
.p3 .p3-list { margin-top: 4px; display: grid; gap: 2px; font-size: 13px; }
.p3 .p3-list li { display: grid; grid-template-columns: 16px 1fr; }
.p3 .p3-list li.is-wait { color: var(--p3-ask); }
.p3 .p3-mark { font-size: 11px; line-height: 18px; }

/* Dig: only a real typed Ret correction */
.p3 .p3-dig {
  align-self: flex-end; max-width: 80%; background: var(--p3-dig); border-radius: 10px; padding: 6px 10px 5px;
  font-size: 13.5px; line-height: 1.4;
}
.p3 .p3-dig-who { display: block; font-size: 11px; font-weight: 600; color: var(--p3-meta); }
.p3 .p3-dig .p3-time { display: block; text-align: right; margin-top: 1px; }
/* Dig meta on #1d3a33: #a3b0b8 = 5.55:1 (AA; #8696a0 was 4.04:1, Otto delta D3) */
.p3 .p3-dig-who, .p3 .p3-dig .p3-time { color: #a3b0b8; }

/* ---------- Notification banner (approval cards only) ---------- */
.p3 .p3-notif {
  position: absolute; z-index: 9; left: 8px; right: 8px; top: 46px;
  display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 18px;
  background: #f6f3ee; color: #1a1612; box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.5);
  transform: translateY(-160%); opacity: 0; pointer-events: none;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease;
}
.p3 .p3-notif.on { transform: translateY(0); opacity: 1; }
.p3 .p3-app {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0; background: var(--p3-green); color: var(--p3-bg);
  font-weight: 800; font-size: 11px; display: flex; align-items: center; justify-content: center;
}
.p3 .p3-ntxt { min-width: 0; flex: 1; line-height: 1.25; }
.p3 .p3-nrow { display: flex; justify-content: space-between; font-size: 10.5px; color: #6b6560; }
.p3 .p3-ntext { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Composer (P7): quick replies + «Skriv, hvis du vil…» ---------- */
.p3 .p3-comp { flex-shrink: 0; background: var(--p3-panel); border-top: 1px solid var(--p3-line); padding: 7px 10px 0; position: relative; z-index: 3; }
.p3 .p3-qr { display: flex; gap: 6px; flex-wrap: nowrap; overflow: hidden; }
.p3 .p3-qr > * {
  flex-shrink: 0; height: 26px; padding: 0 10px; border-radius: 999px; box-sizing: border-box;
  display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 500; line-height: 1;
  border: 1px solid #3b4a54; color: var(--p3-text); background: transparent;
}
/* N2 (Otto): «Ring mig op» / «Hvad venter?» are visual only → plain labels (no button look, no pointer, no hover). «Send alle» stays a button. */
.p3 .p3-qr > span { border-color: transparent; background: none; padding: 0 4px; color: var(--p3-meta); cursor: default; }
.p3 .p3-qr > .p3-all { cursor: pointer; }
.p3 .p3-field { display: flex; gap: 8px; align-items: center; margin-top: 7px; }
.p3 .p3-field > span:first-child {
  flex: 1; background: var(--p3-line); border-radius: 20px; padding: 8px 14px; color: #a3b0b8; /* placeholder only: AA on #2a3942 (SEO Lighthouse 2026-10-09) */ font-size: 13px; line-height: 1.2;
}
.p3 .p3-mic {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; background: var(--p3-green); color: var(--p3-bg);
  display: flex; align-items: center; justify-content: center; font-weight: 800;
}
.p3 .p3-homeind { width: 120px; height: 4px; background: rgba(255, 255, 255, 0.28); border-radius: 3px; margin: 7px auto 6px; }

/* ---------- Armed play: pending messages fade up 8px (opacity/transform; visibility keeps them out of tab order) ---------- */
.p3.p3-armed .p3-msg, .p3.p3-armed .p3-day { transition: opacity 0.32s ease, transform 0.32s ease, visibility 0s; }
.p3.p3-armed .is-pending { opacity: 0; transform: translateY(8px); visibility: hidden; transition: none; }
/* Desktop tap mode (same query as phone3.js): a Dig correction only exists once Ret is tapped, so the layout change happens
   on the visitor's own input. Set from first paint (html.js), never by a late class → no CLS. No JS / reduced motion: shown. */
@media (min-width: 900px) and (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .js .p3 .p3-dig:not(.is-shown) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .p3 *, .p3 *::before, .p3 *::after { transition: none !important; animation: none !important; }
}

/* ---------- Home only (scroll-story .stage) ---------- */
/* living-phone.css sets .phone-hero .stage{pointer-events:none} below 900px so the transparent top band doesn't eat the hero chips.
   The phone itself must stay tappable (Send / Ret / Vis / «Send alle»). Otto delta D1. */
.phone-hero .stage .p3 { pointer-events: auto; }
/* ≤380px: the home phone (sticky or static) gets a little more thread: before this, 360×780 sticky gave a 234px thread.
   Clock + icons move up beside the island (as on a real phone) and the card/header spacing tightens a little, so the whole
   waiting card fits under the pin. Static media query → nothing changes after paint (no CLS). Otto delta D2. */
@media (max-width: 380px) {
  .phone-hero .stage .p3 .phone-status { padding: 16px 14px 8px 22px; }
  .phone-hero .stage .p3 .p3-head { padding-top: 4px; padding-bottom: 6px; }
  .phone-hero .stage .p3 .p3-card { padding-top: 7px; padding-bottom: 8px; }
  .phone-hero .stage .p3 .p3-tags { margin-top: 2px; margin-bottom: 3px; }
  .phone-hero .stage .p3 .p3-chips { margin-top: 5px; }
  .phone-hero .stage .p3 .p3-inset { margin-top: 6px; }
  .phone-hero .stage .p3 .p3-act { margin-top: 7px; }
}
/* Short mobile viewports (home): the sticky story phone takes its height from 100svh, so below these heights its thread would
   be shorter than the waiting card. There the phone is static like on brugtvogn / værksted (screen 600px → 360px thread;
   640px from 421px), the stage no longer spans the story panels and the invisible panels drop out. Thresholds = the heights
   where the sticky thread (100svh − nav − dock − caption − phone chrome) still fits the tallest card in its corrected state
   (H4: 286px ≤380px wide, 299px above) + 22px padding.
   phone3.js uses the same query (SHORT) to drive the steps from the thread's position, like the other two pages.
   Static media query → decided before first paint, nothing switches after load (no CLS). Otto delta D6. */
@media (max-width: 380px) and (max-height: 819px), (min-width: 381px) and (max-width: 479px) and (max-height: 869px), (min-width: 480px) and (max-width: 899px) and (max-height: 839px) {
  .phone-hero .stage { grid-row: 2; margin-top: 0; }
  .phone-hero .stage-sticky { position: relative; top: auto; height: auto; justify-content: flex-start; padding: 4px 0 28px; }
  .phone-hero .panel { display: none; }
  .phone-hero .lp-phone-scope { --screen-h: 640px; }
}
@media (max-width: 380px) and (max-height: 819px), (min-width: 381px) and (max-width: 420px) and (max-height: 869px) {
  .phone-hero .lp-phone-scope { --screen-h: 600px; }
}
