/* Quickreach homepage: a live chat surface. The engine (sc/scrollcraft.css)
   pins the stage; everything below is this page's own markup. */

:root {
  /* engine roles, mapped to the shared brand tokens (tokens.css) */
  --sc-canvas:     var(--midnight-deep);
  --sc-surface:    var(--midnight);
  --sc-ink:        var(--ivory);
  --sc-ink-soft:   var(--mist);
  --sc-accent:     var(--brass);
  --sc-accent-ink: var(--midnight);
  --sc-font-display: var(--font-display);
  --sc-font-text: var(--font-text);

  /* chat surface */
  --c-ground:   #ECE6DA;
  --c-in:       #FFFFFF;
  --c-out:      #F4E8C8;
  --c-ink:      var(--midnight);
  --c-soft:     #5A6871;
  --c-meta:     #5C6971;
  --c-line:     color-mix(in oklab, var(--midnight) 12%, transparent);
  --c-chip:     #FBF3DA;
  --c-chip-ink: #574719;
  --c-read:     #276EA8;
  --c-link:     #7A5A16;
  --c-head:     var(--paper);
  --c-shadow:   0 1px 0.5px rgba(16, 34, 46, 0.13);
  --c-row-h:    76px;
  --c-radius:   var(--radius-sm);
  --c-typing:   #2F8F4E;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
}
:root[data-theme="dark"] {
  --c-ground:   #0D1A22;
  --c-in:       #182A35;
  --c-out:      #3A3324;
  --c-ink:      var(--ivory);
  --c-soft:     var(--mist);
  --c-meta:     #93A0A6;
  --c-line:     color-mix(in oklab, var(--ivory) 12%, transparent);
  --c-chip:     #2A2718;
  --c-chip-ink: #E6D7A6;
  --c-read:     #6CB6F0;
  --c-link:     #DDBF7C;
  --c-head:     #132631;
  --c-typing:   #7FD196;
  --c-shadow:   0 1px 0.5px rgba(0, 0, 0, 0.35);
}

html { background: var(--sc-canvas); scroll-behavior: auto; }
body.qr { background: var(--sc-canvas); color: var(--sc-ink); font-family: var(--sc-font-text); margin: 0; }
html[lang="ar"] { --sc-font-display: var(--font-ar); --sc-font-text: var(--font-ar); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; inset-inline-start: 12px; top: -60px; z-index: 50; background: var(--sc-accent); color: var(--sc-accent-ink); padding: 10px 14px; border-radius: 8px; font-weight: 600; text-decoration: none; transition: top 160ms var(--ease); }
.skip:focus-visible { top: 12px; }
:focus-visible { outline: 2px solid var(--sc-accent); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------------------------------------ the app frame */
.app {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  width: 100%;
  max-width: 1500px;
  margin-inline: auto;
}
@media (min-width: 1540px) {
  .app { height: calc(100svh - 40px); top: 20px; border-radius: 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35); }
}

/* ------------------------------------------------------------ inbox (nav) */
.inbox {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--sc-surface);
  border-inline-end: 1px solid color-mix(in oklab, var(--sc-ink) 10%, transparent);
}
.inbox__head { display: flex; align-items: center; gap: 12px; padding: 14px 16px 10px; }
.inbox__logo { width: 40px; height: 40px; border-radius: 50%; }
.inbox__brand { min-width: 0; font-family: var(--sc-font-display); font-weight: 600; font-size: 1.02rem; letter-spacing: -0.01em; color: var(--sc-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox__note { margin: 0 16px 10px; font-size: 0.8rem; color: var(--sc-ink-soft); }

.lang {
  margin-inline-start: auto; appearance: none; cursor: pointer;
  font: inherit; font-size: 0.85rem; font-weight: 600;
  color: var(--sc-ink); background: transparent;
  border: 1px solid color-mix(in oklab, var(--sc-ink) 28%, transparent);
  border-radius: var(--radius-pill); padding: 6px 14px; min-height: var(--tap);
  transition: background-color 150ms var(--ease), transform 120ms var(--ease);
}
.lang:hover { background: color-mix(in oklab, var(--sc-ink) 10%, transparent); }
.lang:active { transform: scale(0.97); }
.lang--pane { display: none; }

.chats { position: relative; list-style: none; margin: 0; padding: 0; height: calc(var(--c-row-h) * 5); flex: none; }
.chat {
  position: absolute; inset-inline: 0; top: 0; height: var(--c-row-h);
  transform: translateY(calc(var(--i, 0) * var(--c-row-h)));
  transition: transform 520ms var(--ease);
}
.chat__btn {
  all: unset; box-sizing: border-box; cursor: pointer;
  display: flex; align-items: center; gap: 12px; width: 100%; height: 100%;
  padding: 0 16px; color: var(--sc-ink);
  transition: background-color 150ms var(--ease);
}
.chat__btn:hover { background: color-mix(in oklab, var(--sc-ink) 6%, transparent); }
.chat__btn:focus-visible { outline: 2px solid var(--sc-accent); outline-offset: -2px; border-radius: 0; }
.chat.is-active .chat__btn { background: color-mix(in oklab, var(--sc-ink) 11%, transparent); }
.chat__main { flex: 1; min-width: 0; display: grid; gap: 3px; padding-block: 12px; border-bottom: 1px solid color-mix(in oklab, var(--sc-ink) 8%, transparent); }
.chat__row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chat__name { flex: 1; min-width: 0; font-size: 0.98rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat__time { font-size: 0.75rem; color: var(--sc-ink-soft); font-variant-numeric: tabular-nums; }
.chat__prev { flex: 1; min-width: 0; font-size: 0.86rem; color: var(--sc-ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat__short { display: none; }
.chat__pin { width: 15px; height: 15px; color: var(--sc-ink-soft); flex: none; }

.tag { flex: none; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.02em; padding: 2px 7px; border-radius: 999px; }
.tag--cold   { color: #B9C6CC; background: color-mix(in oklab, #B9C6CC 16%, transparent); }
.tag--follow { color: #E6CD8E; background: color-mix(in oklab, #E6CD8E 15%, transparent); }
.tag--active { color: var(--midnight); background: #9FD8A7; }

.when-warm { display: none; }
.is-warm .when-warm { display: inline; }
.is-warm .when-cold { display: none; }
.chat.is-warm .chat__prev { color: var(--sc-ink); font-weight: 600; }
.chat.just-warm .chat__btn { animation: rowflash 1400ms var(--ease); }
@keyframes rowflash { 0% { background: color-mix(in oklab, var(--sc-accent) 34%, transparent); } 100% { background: color-mix(in oklab, var(--sc-ink) 11%, transparent); } }

.inbox__foot { margin-top: auto; padding: 14px 16px 16px; border-top: 1px solid color-mix(in oklab, var(--sc-ink) 8%, transparent); }
.inbox__links { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.inbox__links a { color: var(--sc-ink); font-size: 0.84rem; text-underline-offset: 3px; text-decoration-thickness: 1px; text-decoration-color: color-mix(in oklab, var(--sc-ink) 40%, transparent); }
.inbox__links a:hover { text-decoration-color: var(--sc-accent); }
.inbox__legal { display: flex; gap: 8px; margin: 0; font-size: 0.72rem; line-height: 1.5; color: var(--sc-ink-soft); }
.lock svg { width: 13px; height: 13px; margin-top: 2px; }

/* avatars */
.ava {
  flex: none; display: grid; place-items: center;
  width: 48px; height: 48px; border-radius: 50%;
  font-weight: 700; font-size: 1.05rem;
  color: #fff; background: hsl(var(--h, 200) 32% 42%);
}
.ava--logo { background: var(--sc-surface); object-fit: cover; }
.ava--sm { width: 40px; height: 40px; font-size: 0.95rem; }
.ava--xs { width: 30px; height: 30px; font-size: 0.8rem; }

/* ------------------------------------------------------------ pane */
.pane { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--c-ground); color: var(--c-ink); }
.pane::before { /* faint paper grain so the flat ground doesn't band */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.pane__head {
  position: relative; z-index: 3;
  display: flex; align-items: center; gap: 12px;
  min-height: 62px; padding: 10px 18px;
  background: var(--c-head); border-bottom: 1px solid var(--c-line);
}
.head { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.head[hidden] { display: none; }
.head__text { min-width: 0; }
.head__name { margin: 0; font-weight: 600; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head__status { margin: 1px 0 0; font-size: 0.8rem; color: var(--c-soft); min-height: 1.2em; }
.head__status.is-typing { color: var(--c-typing); font-weight: 600; }

.thread-lang {
  margin-inline-start: auto; flex: none; appearance: none; cursor: pointer;
  font: inherit; font-size: 0.8rem; color: var(--c-ink);
  background: transparent; border: 1px solid var(--c-line); border-radius: 999px;
  padding: 6px 12px; min-height: 34px;
  transition: background-color 150ms var(--ease), transform 120ms var(--ease);
}
.thread-lang:hover { background: color-mix(in oklab, var(--c-ink) 7%, transparent); }
.thread-lang:active { transform: scale(0.97); }
.thread-lang__to { font-weight: 700; }

.pane__body { position: relative; flex: 1; min-height: 0; overflow: clip; }

.thread {
  position: absolute; inset-inline: 0; top: 0;
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 6px; padding: 18px clamp(16px, 6%, 64px) 26px;
  will-change: transform;
}
.js .thread:not(.is-active) { visibility: hidden; opacity: 0; }
.js .thread { transition: opacity 240ms var(--ease), visibility 0s linear 240ms; }
.js .thread.is-active { transition: opacity 240ms var(--ease), visibility 0s; }

/* messages */
.msg, .chip, .date { flex: none; }
.js [data-at] { opacity: var(--a, 1); translate: 0 calc((1 - var(--a, 1)) * 14px); }
/* pending messages stay hidden, except ones holding a link or button: those stay
   in the Tab order (transparent, below the pane) and home.js brings the story to
   them on focus, so the keyboard can reach every control */
.js [data-at].is-pending:not(:has(a[href], button, summary)) { visibility: hidden; }

.msg {
  position: relative; max-width: min(560px, 78%);
  padding: 7px 10px 8px; border-radius: var(--c-radius);
  background: var(--c-in); box-shadow: var(--c-shadow);
  font-size: 0.95rem; line-height: 1.45;
}
.msg + .msg--in, .chip + .msg, .date + .msg, .msg--out + .msg--in, .msg--in + .msg--out { margin-top: 6px; }
.msg p { margin: 0; }
.msg p + p { margin-top: 6px; }
.msg--in { border-start-start-radius: 2px; }
.msg--out { align-self: flex-end; background: var(--c-out); border-start-end-radius: 2px; }
.meta {
  float: inline-end; display: inline-flex; align-items: center; gap: 4px;
  margin: 6px 0 -3px 12px; font-size: 0.7rem; line-height: 1; color: var(--c-meta);
  font-variant-numeric: tabular-nums;
}
html[dir="rtl"] .meta { margin: 6px 12px -3px 0; }
.ticks { width: 16px; height: 11px; color: var(--c-meta); }
.ticks.is-read { color: var(--c-read); }

.msg--hero { max-width: min(640px, 92%); padding: 16px 18px 12px; }
.msg--hero h1 {
  margin: 0 0 10px; font-family: var(--sc-font-display); font-weight: 600;
  font-size: clamp(1.7rem, 1.1rem + 1.9vw, 2.6rem); line-height: 1.08; letter-spacing: -0.02em;
  text-wrap: balance;
}
html[lang="ar"] .msg--hero h1 { letter-spacing: 0; line-height: 1.3; }
.msg--hero p { font-size: 1.05rem; color: var(--c-soft); text-wrap: pretty; max-width: 52ch; }

.msg--list { padding: 10px 12px 9px; }
.list__title { font-weight: 600; }
.quiet { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; }
.quiet li { display: flex; gap: 10px; align-items: flex-start; }
.quiet li > span:last-child { display: grid; gap: 1px; }
.quiet b { font-weight: 600; font-size: 0.92rem; }
.quiet small { font-size: 0.78rem; color: var(--c-meta); }
.quiet em { font-style: normal; font-size: 0.85rem; color: var(--c-soft); }

.msg--step { padding: 10px 12px 0; overflow: hidden; min-width: min(320px, 100%); }
.step__n { font-size: 0.75rem; font-weight: 700; color: var(--c-link); letter-spacing: 0.02em; }
.msg h2 { margin: 2px 0 4px; font-family: var(--sc-font-display); font-weight: 600; font-size: 1.12rem; line-height: 1.25; letter-spacing: -0.01em; }
html[lang="ar"] .msg h2 { letter-spacing: 0; }
.action {
  display: flex; justify-content: center; align-items: center; clear: both;
  margin: 10px -12px 0; padding: 11px 12px; min-height: 44px;
  border-top: 1px solid var(--c-line);
  color: var(--c-read); font-weight: 600; font-size: 0.92rem;
  transition: background-color 180ms var(--ease);
}
.action.is-pressed { background: color-mix(in oklab, var(--c-read) 14%, transparent); }
.action--live { all: unset; box-sizing: border-box; display: flex; justify-content: center; align-items: center; clear: both; width: calc(100% + 24px); margin: 10px -12px 0; padding: 11px 12px; min-height: 44px; border-top: 1px solid var(--c-line); color: var(--c-read); font-weight: 600; font-size: 0.92rem; cursor: pointer; transition: background-color 150ms var(--ease); }
.action--live:hover { background: color-mix(in oklab, var(--c-read) 10%, transparent); }
.action--live:active { background: color-mix(in oklab, var(--c-read) 18%, transparent); }
.action--live:focus-visible { outline: 2px solid var(--sc-accent); outline-offset: -2px; border-radius: 0 0 var(--c-radius) var(--c-radius); }

.template { margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: color-mix(in oklab, var(--c-ink) 5%, transparent); border-inline-start: 1px solid var(--c-line); }
.template p { font-size: 0.9rem; }
.template p[lang="ar"] { font-family: "IBM Plex Sans Arabic", "Segoe UI", system-ui, sans-serif; }

.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.85rem; color: var(--c-soft); }
.doc { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.doc svg { width: 30px; height: 30px; color: var(--c-link); flex: none; }
.doc span { display: grid; }
.doc small { font-size: 0.75rem; color: var(--c-meta); }

.auto { display: flex; align-items: center; gap: 5px; font-size: 0.72rem; font-weight: 600; color: var(--c-link); }
.auto svg { width: 12px; height: 12px; flex: none; }
.quick { display: flex; clear: both; margin: 10px -10px -8px; border-top: 1px solid var(--c-line); }
.qbtn { flex: 1; text-align: center; padding: 10px 8px; color: var(--c-read); font-weight: 600; font-size: 0.88rem; transition: background-color 180ms var(--ease); }
.qbtn + .qbtn { border-inline-start: 1px solid var(--c-line); }
.qbtn.is-pressed { background: color-mix(in oklab, var(--c-read) 14%, transparent); }

.msg--peak p { font-size: 1.02rem; }

.msg--lead { padding: 10px 12px 0; min-width: min(330px, 100%); }
.lead__title { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--c-link); }
.lead__title svg { width: 16px; height: 16px; }
.lead__who { font-weight: 600; font-size: 1.02rem; }
.lead__facts { display: grid; gap: 6px; margin: 8px 0 0; }
.lead__facts div { display: grid; grid-template-columns: 7.5rem 1fr; gap: 10px; }
.lead__facts dt { font-size: 0.8rem; color: var(--c-meta); }
.lead__facts dd { margin: 0; font-size: 0.92rem; font-weight: 600; }

.msg--wide { max-width: min(600px, 88%); padding: 12px 14px 9px; }
.soft { color: var(--c-soft); }
.rules { list-style: none; margin: 10px 0 8px; padding: 0; display: grid; gap: 10px; }
.rules li { display: grid; gap: 1px; padding-inline-start: 22px; position: relative; }
.rules li::before { content: ""; position: absolute; inset-inline-start: 2px; top: 7px; width: 10px; height: 6px; border-inline-start: 2px solid var(--c-read); border-bottom: 2px solid var(--c-read); transform: rotate(-45deg); }
html[dir="rtl"] .rules li::before { transform: rotate(45deg); }
.rules b { font-weight: 600; font-size: 0.93rem; }
.rules span { font-size: 0.88rem; color: var(--c-soft); }
.link, .msg a, .chip a { color: var(--c-link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.link { font-weight: 600; font-size: 0.9rem; }
/* inline links: vertical padding on an inline box grows the tap area to 44px
   without changing line height, so the text around them doesn't move */
.link, .msg a, .chip a, .inbox__links a { padding-block: calc((var(--tap) - 1.2em) / 2); padding-inline: 2px; }

.faq { margin-top: 6px; }
.faq details { border-top: 1px solid var(--c-line); }
.faq summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; min-height: 44px; font-weight: 600; font-size: 0.92rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-weight: 400; font-size: 1.2rem; color: var(--c-meta); transition: transform 160ms var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq summary:focus-visible { outline-offset: 0; }
.faq details p { padding: 0 0 12px; font-size: 0.9rem; color: var(--c-soft); max-width: 62ch; }

.crm { font-size: 1.05rem; }
.crm strong { font-weight: 700; }

.date, .chip {
  align-self: center; margin: 10px 0 4px;
  padding: 5px 12px; border-radius: var(--radius-sm);
  font-size: 0.78rem; text-align: center; box-shadow: var(--c-shadow);
}
.date { background: var(--c-head); color: var(--c-soft); font-weight: 600; }
.chip { display: flex; gap: 6px; align-items: flex-start; max-width: min(520px, 92%); background: var(--c-chip); color: var(--c-chip-ink); line-height: 1.45; }
.chip svg { width: 13px; height: 13px; flex: none; margin-top: 2px; }
.chip--gap { background: transparent; box-shadow: none; color: var(--c-meta); font-style: italic; }
.chip--done { background: color-mix(in oklab, #9FD8A7 40%, var(--c-head)); color: #1F4A2A; font-weight: 600; }
:root[data-theme="dark"] .chip--done { background: #1E3A28; color: #BFE8C6; }
.chip--legal { background: transparent; box-shadow: none; color: var(--c-meta); font-size: 0.8rem; line-height: 2; }

/* first-screen hint: names the demo and invites the scroll */
.scroll-hint {
  position: absolute; z-index: 5; inset-inline: 0; bottom: 18px; margin: 0 auto; width: max-content; max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: var(--radius-pill);
  border: 1px solid color-mix(in oklab, var(--sc-accent) 45%, transparent);
  background: var(--sc-surface); color: var(--sc-ink);
  font-size: 0.82rem; font-weight: 600; line-height: 1.3; text-align: center;
  box-shadow: 0 6px 20px rgba(11, 24, 33, 0.28);
  pointer-events: none;
}
.scroll-hint svg { width: 16px; height: 16px; flex: none; color: var(--sc-accent); animation: hint-bob 1.6s var(--ease) infinite; }
@keyframes hint-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 3px; } }
@media (prefers-reduced-motion: reduce) { .scroll-hint svg { animation: none; } }
html:not(.js) .scroll-hint { display: none; }

/* the notification that drops in at the end of the peak */
.banner {
  position: absolute; z-index: 4; top: 12px; inset-inline: 0; margin-inline: auto;
  width: min(420px, calc(100% - 32px));
  display: flex; gap: 10px; align-items: center;
  padding: 10px 14px; border-radius: 14px;
  background: var(--sc-surface); color: var(--sc-ink);
  box-shadow: 0 10px 28px rgba(11, 24, 33, 0.28), inset 0 1px 0 rgba(237, 230, 211, 0.08);
  font-size: 0.85rem; line-height: 1.35;
  opacity: 0; visibility: hidden; pointer-events: none;
}
.banner > span { display: grid; }
.banner b { font-weight: 700; }

/* composer: the always-present call to action */
.composer {
  position: relative; z-index: 3;
  display: flex; align-items: flex-end; gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--c-head); border-top: 1px solid var(--c-line);
}
.composer textarea {
  flex: 1; min-width: 0; resize: none; overflow: hidden;
  font: inherit; font-size: 0.95rem; line-height: 1.4; color: var(--c-ink);
  background: var(--c-in); border: 1px solid var(--c-line); border-radius: 22px;
  padding: 11px 16px; min-height: var(--tap); max-height: 120px;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.composer textarea::placeholder { color: var(--c-meta); }
.composer textarea:focus-visible { outline: none; border-color: var(--sc-accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--sc-accent) 35%, transparent); }
.send {
  flex: none; display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  min-height: var(--tap); padding: 0 18px; border: 0; border-radius: var(--radius-pill);
  font: inherit; font-weight: 700; font-size: 0.95rem; white-space: nowrap;
  color: var(--sc-accent-ink); background: var(--sc-accent);
  box-shadow: 0 2px 6px rgba(16, 34, 46, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 120ms var(--ease), background-color 150ms var(--ease);
}
.send svg { width: 18px; height: 18px; }
html[dir="rtl"] .send svg { transform: scaleX(-1); }
.send:hover { background: var(--brass-hover); }
.send:active { transform: scale(0.97); }
.composer.is-ready .send { animation: nudge 700ms var(--ease) 1; }
@keyframes nudge { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }

/* ------------------------------------------------------------ phone */
@media (max-width: 859px) {
  :root { --c-col-w: 74px; }
  /* Follow the visible screen height, so the composer stays on the bottom edge
     when the phone's address bar slides away (svh left a gap under it). */
  .app[data-sc-stage] { height: 100svh; height: 100dvh; }
  .app {
    grid-template-columns: 100%;
    grid-template-rows: auto auto 1fr auto;
    grid-template-areas: "head" "chats" "body" "composer";
  }
  .inbox, .pane { display: contents; }
  .inbox__head, .inbox__note, .inbox__foot { display: none; }
  .pane__head { grid-area: head; padding: 8px 12px; min-height: 58px; }
  .lang--pane { display: inline-block; margin-inline-start: auto; flex: none; color: var(--c-ink); border-color: var(--c-line); }
  .lang--pane:hover { background: color-mix(in oklab, var(--c-ink) 7%, transparent); }
  .head { flex: 1 1 auto; }
  .thread-lang { padding: 5px 10px; font-size: 0.75rem; }
  .thread-lang [data-i18n="chat.langLabel"] { display: none; }

  .chats {
    grid-area: chats; height: 96px; overflow: hidden;
    background: var(--sc-surface);
  }
  .chat { inset-inline: auto; inset-inline-start: 0; width: var(--c-col-w); height: 96px; transform: translateX(calc(var(--i, 0) * var(--c-col-w))); }
  html[dir="rtl"] .chat { transform: translateX(calc(var(--i, 0) * var(--c-col-w) * -1)); }
  .chat__btn { flex-direction: column; justify-content: center; gap: 5px; padding: 6px 4px 4px; }
  .chat__main { padding: 0; border: 0; display: block; text-align: center; width: 100%; }
  .chat__main .chat__row:first-child { justify-content: center; }
  .chat__main .chat__row:last-child, .chat__time { display: none; }
  .chat__name { font-size: 0.72rem; font-weight: 600; flex: none; max-width: 100%; }
  .chat__name[data-i18n] { display: none; }
  .chat__short { display: block; font-size: 0.72rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pane__body { background: var(--c-ground); }
  .thread-lang { display: none; }
  .composer textarea { font-size: 0.9rem; padding-inline: 14px; max-height: 92px; overflow-y: auto; }
  .ava { width: 44px; height: 44px; }
  .chat.is-active .ava { box-shadow: 0 0 0 2px var(--sc-surface), 0 0 0 4px var(--sc-accent); }
  .chat.is-active .chat__btn { background: transparent; }
  .chat.is-warm .ava::after { content: ""; }

  .pane__body { grid-area: body; }
  .composer { grid-area: composer; padding-inline: 10px; gap: 8px; }
  .send { padding: 0 14px; font-size: 0.88rem; }
  .thread { padding-inline: 12px; }
  .msg { max-width: 86%; }
  .msg--hero, .msg--wide { max-width: 96%; }
  .msg--hero h1 { font-size: 1.62rem; }
  .msg--hero p { font-size: 0.98rem; }
}
@media (max-width: 380px) {
  .send span { font-size: 0.82rem; }
  .send { padding: 0 12px; }
}

/* ------------------------------------------------------------ no JS: a plain readable page */
html:not(.js) .sc-stage, html:not(.js) .app { position: static; height: auto; }
html:not(.js) .app-act { height: auto !important; }
html:not(.js) .pane__body { overflow: visible; }
html:not(.js) .thread { position: static; }
html:not(.js) .banner, html:not(.js) .head[data-head="ahmed"] { display: none; }
html:not(.js) .composer { position: sticky; bottom: 0; }

@media (prefers-reduced-motion: reduce) {
  .chat, .js .thread, .banner, .composer.is-ready .send, .chat.just-warm .chat__btn { transition: none !important; animation: none !important; }
  .js [data-at] { translate: none; }
}

.msg--out .qbtn { color: color-mix(in oklab, var(--c-read) 88%, #000); }
:root[data-theme="dark"] .msg--out .qbtn { color: var(--c-read); }

/* ------------------------------------------------------------ chapter cards */
.chapters { position: absolute; inset: 0; z-index: 20; pointer-events: none; border-radius: inherit; overflow: hidden; }
.card {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 clamp(24px, 9vw, 160px);
  /* a soft veil over the chat, not a cut to black: the chat stays visible behind */
  background: color-mix(in oklab, var(--sc-canvas) 78%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: var(--sc-ink);
  opacity: 0; visibility: hidden;
}
.card > * { position: relative; max-width: 22ch; margin: 0; opacity: var(--o, 1); translate: 0 calc((1 - var(--o, 1)) * 8px); }
.card__n {
  font-family: var(--sc-font-display); font-weight: 600; line-height: 1;
  font-size: 0.85rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sc-accent);
  font-variant-numeric: tabular-nums;
}
.card__t {
  margin-top: 10px;
  font-family: var(--sc-font-display); font-weight: 600;
  font-size: clamp(1.6rem, 1.1rem + 1.8vw, 2.6rem); line-height: 1.15; letter-spacing: -0.02em;
  text-wrap: balance;
}
.card__s {
  margin-top: 10px; max-width: 38ch !important;
  font-size: clamp(0.98rem, 0.92rem + 0.3vw, 1.1rem); line-height: 1.55; color: var(--sc-ink-soft);
  text-wrap: pretty;
}
html[lang="ar"] .card__t, html[lang="ar"] .card__n { letter-spacing: 0; line-height: 1.25; }
html:not(.js) .chapters { display: none; }
@media (prefers-reduced-motion: reduce) { .card > * { translate: none; } }
