/* Noura: the in-app companion, in Osimah Digital's design language.
 *
 * Noura is an Osimah product, so the page takes Osimah's system (the
 * Osimah-website repo, DESIGN.md): one brand hue from the logo ring, teal for
 * structure and cyan for whatever the person is touching, paper grounds in
 * light mode and Osimah's near-black in dark mode, a six-step radius ladder,
 * three durations and one hover colour. docs/HANDOFF.md § "Design" lists the
 * rules and where each one came from. Use a token; a new value needs a reason
 * written there first. */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  /* Grounds. Paper in light mode: Osimah's pale wash outside the shell, the
     design file's #F6F6F6 under the page, white for surfaces. */
  --bg: #eef0f1;
  --paper: #f6f6f6;
  --surface: #fff;
  --tile: #eef0f1;
  --stage: #10161c;            /* behind Noura's video, in both themes */

  /* Ink. Every text colour here clears 4.5:1 on --paper and --surface. */
  --ink: #071a1c;
  --ink-2: #616a6b;            /* paragraphs under a heading (5.1:1 on paper) */
  --muted: #616a6b;            /* labels and metadata */

  /* Lines. --field-line draws the edge of anything a person types into or
     switches, so it owes 3:1 to its ground (WCAG 1.4.11); --line is decoration. */
  --line: #e2e5e7;
  --line-soft: #eef0f1;
  --field-line: #7c8790;

  /* The ring's two ends. Teal is structure and resting marks; cyan answers the
     person. On paper both take the darker step of their own hue that clears
     4.5:1, as Osimah's paper sections do. */
  --teal-text: #0f766e;
  --teal-wash: #e7f4f2;
  --teal-line: rgb(15 118 110 / .25);
  --accent-text: #0e7a90;
  --accent-wash: #eaf9fd;
  --accent-line: rgb(14 122 144 / .28);
  --hover-line: rgb(22 184 200 / .55);
  --hover-ink: #0a5260;

  /* The one filled action: Osimah's lead button on paper, #073B45, stepping to
     #0A5260 under the pointer. */
  --action: #073b45;
  --action-ink: #fff;
  --action-hover: #0a5260;

  /* Live: the mic while it listens and a switch that is on. */
  --live: #0e7a90;
  --live-ink: #fff;

  --danger: #b42318;
  --danger-wash: #fef3f2;
  --danger-line: #fecdca;
  --neutral-wash: #eef0f1;
  --toggle-off: #7c8790;
  /* A control floating over the page (the phone dock): Osimah's navy panel on dark. */
  --float: #fff;
  --float-line: #e2e5e7;

  /* Focus follows its ground (it owes 3:1 to it): Osimah's dark teal on
     paper, the cyan on anything dark. */
  --focus: #0d4452;
  --focus-on-dark: #29c6e8;

  --glass: rgb(255 255 255 / .9);
  --overlay: rgb(5 7 10 / .45);
  /* Shadows only under what floats (dialog, sheet, toast) and under a card
     being touched: long, soft and nearly black, pooling beneath. */
  --shadow-float: 0 24px 48px -24px rgb(5 7 10 / .35), 0 4px 12px -6px rgb(5 7 10 / .12);
  --shadow-sheet: 0 -18px 50px -20px rgb(5 7 10 / .35);
  --shadow-hover: 0 18px 40px -26px rgb(5 7 10 / .4);

  --osimah-logo: url("../img/osimah-on-light.webp");

  /* Type: IBM Plex Sans Arabic for everything read, Noto Kufi Arabic for the
     display heads (Osimah's Arabic pair), Inter for Latin runs. */
  --font-ar: 'IBM Plex Sans Arabic', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Noto Kufi Arabic', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-latin: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Osimah's ladders: 4px spacing, six radii, three durations, two curves. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --r-xs: 2px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;
  --dur-1: 120ms;
  --dur-2: 170ms;
  --dur-3: 240ms;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-soft: cubic-bezier(.4, 0, .2, 1);
}

/* Dark: Osimah's own canvas. Written twice, once for the device setting and
   once for the in-app choice, and kept identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #05070a;
    --paper: #0b0f14;
    --surface: #10161c;
    --tile: #141d2c;
    --ink: #eef1ee;
    --ink-2: #b7c0c6;
    --muted: #7c8790;
    --line: #1b232b;
    --line-soft: #161d24;
    --field-line: #5f6c78;
    --teal-text: #2fe0cf;
    --teal-wash: rgb(47 224 207 / .08);
    --teal-line: rgb(47 224 207 / .2);
    --accent-text: #29c6e8;
    --accent-wash: rgb(41 198 232 / .1);
    --accent-line: rgb(41 198 232 / .2);
    --hover-line: rgb(22 184 200 / .38);
    --hover-ink: #7be4f0;
    --action: #eef1ee;
    --action-ink: #05070a;
    --action-hover: #16b8c8;
    --live: #29c6e8;
    --live-ink: #05070a;
    --danger: #f97066;
    --danger-wash: rgb(240 68 56 / .12);
    --danger-line: rgb(249 112 102 / .35);
    --neutral-wash: #1b232b;
    --toggle-off: #5f6c78;
    --float: #141d2c;
    --float-line: #2a3540;
    --focus: #29c6e8;
    --glass: rgb(11 15 20 / .82);
    --overlay: rgb(0 0 0 / .6);
    --shadow-float: 0 18px 40px -22px rgb(0 0 0 / .85);
    --shadow-sheet: 0 -18px 50px -20px rgb(0 0 0 / .85);
    --shadow-hover: 0 30px 60px -30px rgb(0 0 0 / .9);
    --osimah-logo: url("../img/osimah-on-dark.webp");
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #05070a;
  --paper: #0b0f14;
  --surface: #10161c;
  --tile: #141d2c;
  --ink: #eef1ee;
  --ink-2: #b7c0c6;
  --muted: #7c8790;
  --line: #1b232b;
  --line-soft: #161d24;
  --field-line: #5f6c78;
  --teal-text: #2fe0cf;
  --teal-wash: rgb(47 224 207 / .08);
  --teal-line: rgb(47 224 207 / .2);
  --accent-text: #29c6e8;
  --accent-wash: rgb(41 198 232 / .1);
  --accent-line: rgb(41 198 232 / .2);
  --hover-line: rgb(22 184 200 / .38);
  --hover-ink: #7be4f0;
  --action: #eef1ee;
  --action-ink: #05070a;
  --action-hover: #16b8c8;
  --live: #29c6e8;
  --live-ink: #05070a;
  --danger: #f97066;
  --danger-wash: rgb(240 68 56 / .12);
  --danger-line: rgb(249 112 102 / .35);
  --neutral-wash: #1b232b;
  --toggle-off: #5f6c78;
  --float: #141d2c;
  --float-line: #2a3540;
  --focus: #29c6e8;
  --glass: rgb(11 15 20 / .82);
  --overlay: rgb(0 0 0 / .6);
  --shadow-float: 0 18px 40px -22px rgb(0 0 0 / .85);
  --shadow-sheet: 0 -18px 50px -20px rgb(0 0 0 / .85);
  --shadow-hover: 0 30px 60px -30px rgb(0 0 0 / .9);
  --osimah-logo: url("../img/osimah-on-dark.webp");
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* Sizes are in rem so the page follows the reader's own text size. Arabic sets
   one step looser than Latin, and never takes letter-spacing: it breaks the joins. */
body { margin: 0; background: var(--bg); color: var(--ink); font: .875rem/1.6 var(--font-ar); letter-spacing: 0; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; }
svg { display: block; }
button, input { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: not-allowed; }
:is(.round, .send, .chip, .ctl):disabled, input:disabled { opacity: .5; }
button svg { width: 21px; height: 21px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }
/* Order numbers and other Latin runs inside Arabic text: isolated so they keep
   their own order, in Inter, with figures that line up. */
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; font-family: var(--font-latin); font-variant-numeric: tabular-nums; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; inset-inline-start: var(--space-3); top: -60px; z-index: 100; background: var(--action); color: var(--action-ink); padding: 10px var(--space-4); border-radius: var(--r-pill); text-decoration: none; font-weight: 600; }
.skip-link:focus { top: var(--space-3); }

/* ---------- Layout ---------- */
.shell { max-width: 1450px; margin: auto; display: grid; grid-template-columns: 230px minmax(350px, 1fr) 365px; min-height: 100dvh; }

.sidebar { padding: 40px 28px var(--space-6); background: var(--surface); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; gap: var(--space-7); position: sticky; top: 0; height: 100dvh; }
/* The wordmark is her name, set like the display heads (Noto Kufi Arabic 500, no
   letter-spacing), with a teal full stop like the page heads; the voice-arc mark takes
   the page's action colour. */
.brand { font-family: var(--font-display); font-size: 1.625rem; font-weight: 500; line-height: 1.2; display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--ink); }
.brand-dot { color: var(--teal-text); }
.mark { width: 30px; height: 30px; flex-shrink: 0; color: var(--action); --mark-ink: var(--action-ink); }
.brand--compact { display: none; font-size: 1.375rem; }
.nav-label { padding: 0 var(--space-3) var(--space-3); }
.nav { display: grid; gap: var(--space-1); }
.nav a { position: relative; display: flex; gap: var(--space-3); align-items: center; min-height: 44px; padding: 10px var(--space-3); border-radius: var(--r-md); color: var(--muted); text-decoration: none; transition: color var(--dur-1) var(--ease-soft), background var(--dur-1) var(--ease-soft); }
.nav a:hover { color: var(--ink); background: var(--line-soft); }
/* The current page reads by a bar and weight as well as colour, so it holds in
   greyscale and on a washed-out projector. */
.nav a.active { color: var(--accent-text); background: var(--accent-wash); font-weight: 700; }
.nav a.active::before { content: ''; position: absolute; inset-inline-start: 0; inset-block: 10px; width: 3px; border-radius: var(--r-xs); background: currentColor; }
.nav svg { width: 19px; height: 19px; }
.side-note { margin-top: auto; border-top: 1px solid var(--line); padding-top: var(--space-5); }
.side-note .text-btn { padding-inline-start: 0; margin-top: var(--space-2); }

/* "A product by Osimah": the lockup as Osimah draws it, its wordmark inked for
   the ground under it (assets/img/osimah-on-*.webp). */
.made-by { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--line); text-decoration: none; color: var(--muted); font-size: .75rem; }
.osimah-logo { display: block; width: 116px; aspect-ratio: 320 / 86; background: var(--osimah-logo) no-repeat center / contain; }
.made-by:hover { color: var(--ink); }
.made-by--compact { display: none; }

.main { background: var(--paper); padding: 36px 36px 112px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: 40px; min-height: 36px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.crumbs { font-size: .75rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs[hidden] { display: none; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }
.crumbs .sep { opacity: .5; }
.talk-btn { display: none; }

/* ---------- Typography helpers ---------- */
.small { font-size: .75rem; color: var(--muted); line-height: 1.7; }
.eyebrow { font-size: .75rem; font-weight: 600; line-height: 1.5; color: var(--teal-text); }
.nav-label { color: var(--muted); }
.demo-label { display: inline-block; background: var(--teal-wash); color: var(--teal-text); border: 1px solid var(--teal-line); font-size: .75rem; line-height: 1.4; padding: 3px 10px; border-radius: var(--r-pill); font-weight: 600; margin-bottom: var(--space-3); }
/* The display head: Noto Kufi Arabic at 500, as Osimah sets its Arabic heads,
   on a looser line for the marks above and below. */
.welcome { font-family: var(--font-display); font-weight: 500; font-size: 2.125rem; line-height: 1.45; margin: var(--space-2) 0; }
.sub { color: var(--ink-2); line-height: 1.7; }
.footnote { margin-top: var(--space-4); }

/* ---------- Buttons ---------- */
/* Every control is a pill. None lifts or grows: the fill steps, the edge
   lights, and a press gives a little. */
.text-btn { position: relative; color: var(--accent-text); font-size: .75rem; font-weight: 600; padding: 6px; text-decoration: none; display: inline-block; border-radius: var(--r-sm); }
.text-btn:hover { color: var(--hover-ink); text-decoration: underline; text-underline-offset: 3px; }
.primary, .secondary, .danger { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 44px; padding: 10px 20px; border-radius: var(--r-pill); font-weight: 600; font-size: .8125rem; transition: background var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out); }
.primary { background: var(--action); color: var(--action-ink); }
.primary:not(:disabled):hover { background: var(--action-hover); }
.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--field-line); }
.secondary:not(:disabled):hover { border-color: var(--hover-line); background: var(--accent-wash); color: var(--hover-ink); }
/* A destructive action is a danger line, not a fill: the safe choice beside it
   is the one that stands out. */
.danger { background: var(--surface); color: var(--danger); border: 1px solid var(--danger); }
.danger:not(:disabled):hover { background: var(--danger-wash); }
:is(.primary, .secondary, .danger, .chip, .send, .round, .talk-btn, .start-btn, .end-btn, .stage-stop, .back, .hero button):not(:disabled):active, .ctl:not(:disabled):active .ctl-icon { scale: .97; }
/* A disabled action goes grey, and its words stay legible: they say why. */
:is(.primary, .secondary, .danger):disabled { background: var(--neutral-wash); color: var(--muted); border-color: var(--line); }
.back { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill); display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 14px; font-size: .75rem; margin-bottom: var(--space-4); text-decoration: none; transition: border-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out); }
.back:hover { border-color: var(--hover-line); color: var(--hover-ink); }

/* ---------- Home ---------- */
/* The one dark band on the page, in both themes: Osimah frames its paper with
   dark bands, and this is where the page introduces Noura. */
.hero { --focus: var(--focus-on-dark); border-radius: var(--r-lg); background: linear-gradient(160deg, #000434, #05070a 70%); color: #eef1ee; border: 1px solid #1b232b; margin: var(--space-6) 0; padding: 28px; position: relative; overflow: hidden; min-height: 184px; }
.hero .eyebrow { color: #2fe0cf; }
.hero h2 { font-family: var(--font-display); font-weight: 500; font-size: 1.4375rem; max-width: 280px; line-height: 1.5; margin: var(--space-2) 0; }
.hero p { max-width: 250px; font-size: .8125rem; line-height: 1.7; color: #b7c0c6; }
.hero button { display: inline-flex; align-items: center; min-height: 44px; background: #eef1ee; color: #05070a; border-radius: var(--r-pill); padding: 10px 20px; margin-top: var(--space-4); font-size: .8125rem; font-weight: 600; transition: background var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out); }
.hero button:hover { background: #16b8c8; box-shadow: 0 14px 34px -14px rgb(22 184 200 / .32); }
.hero-art { position: absolute; inset-inline-end: 28px; top: 36px; width: 95px; height: 110px; transform: rotate(10deg); }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: var(--space-5) 0 var(--space-4); }
.section-head h2 { font-size: 1.0625rem; font-weight: 600; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
.quick { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); padding: 18px var(--space-3); text-align: start; display: grid; gap: var(--space-3); font-size: .8125rem; font-weight: 600; text-decoration: none; transition: border-color var(--dur-3) var(--ease-soft), box-shadow var(--dur-3) var(--ease-soft); }
/* A card under the pointer: its edge lights and light pools beneath it. */
.quick:hover, .order-card:hover { border-color: var(--hover-line); box-shadow: var(--shadow-hover); }
.quick svg { width: 20px; height: 20px; color: var(--accent-text); }

/* ---------- Orders ---------- */
.order-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px; margin: var(--space-3) 0; text-decoration: none; color: inherit; transition: border-color var(--dur-3) var(--ease-soft), box-shadow var(--dur-3) var(--ease-soft); }
.order-top { display: flex; gap: var(--space-3); align-items: center; }
.order-top > div:not(.product) { flex: 1; min-width: 0; }
.product { width: 58px; height: 64px; border-radius: var(--r-sm); background: var(--tile); display: grid; place-items: center; flex-shrink: 0; }
.product svg { width: 44px; height: 49px; }
.product--large { width: 80px; height: 86px; }
.order-card h3 { font-size: .9375rem; font-weight: 600; margin-bottom: var(--space-1); }
.chevron { font-size: 1.1875rem; color: var(--muted); transition: transform var(--dur-2) var(--ease-out); }
/* Arrows travel along the reading direction. */
.order-card:hover .chevron { transform: translateX(-3px); color: var(--hover-ink); }
.order-bottom { border-top: 1px solid var(--line-soft); padding-top: 14px; margin-top: var(--space-4); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
/* Status: a wash, an edge one step up and words in the darkest step. */
.pill { font-size: .75rem; line-height: 1.4; font-weight: 600; border-radius: var(--r-pill); padding: 2px 10px; display: inline-block; border: 1px solid; }
.pill--processing { background: var(--accent-wash); color: var(--accent-text); border-color: var(--accent-line); }
.pill--delivered { background: var(--teal-wash); color: var(--teal-text); border-color: var(--teal-line); }
.pill--cancelled { background: var(--neutral-wash); color: var(--muted); border-color: var(--line); }
.search { width: 100%; min-height: 48px; background: var(--surface); border: 1px solid var(--field-line); border-radius: var(--r-sm); padding: 11px var(--space-4); margin: var(--space-5) 0 6px; font-size: 1rem; transition: border-color var(--dur-1) var(--ease-soft); }
.search::placeholder { color: var(--muted); }
.search:hover { border-color: var(--hover-line); }
.empty { padding: 40px var(--space-4); margin: var(--space-3) 0; text-align: center; color: var(--muted); font-size: .8125rem; border: 1px dashed var(--field-line); border-radius: var(--r-md); }

.detail-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--space-5); margin-top: 18px; scroll-margin: 90px 0 40px; }
.detail-box h3 { font-size: .9375rem; font-weight: 600; margin-bottom: 14px; }
.detail-box .order-top h3 { margin-bottom: 6px; }
.line { display: flex; justify-content: space-between; font-size: .8125rem; margin: 14px 0; gap: 14px; }
.line > span { color: var(--muted); }
.line strong { text-align: end; font-weight: 600; }
.detail-box .text-btn { padding-inline-start: 0; margin-top: var(--space-2); }
.detail-box .small + :is(.secondary, .primary, .danger) { margin-top: var(--space-4); }

/* Teal draws the delivery steps already made; the step in progress takes the cyan. */
.timeline { margin: 20px 0; padding: 0; list-style: none; }
.step { border-inline-start: 2px solid var(--line); padding-block: 0 22px; padding-inline: 20px 0; position: relative; font-size: .8125rem; }
.step::before { content: ''; position: absolute; inset-inline-start: -5px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--toggle-off); }
.step.done { border-inline-start-color: var(--teal-text); }
.step.done::before { background: var(--teal-text); }
.step.current::before { background: var(--accent-text); box-shadow: 0 0 0 4px var(--accent-wash); }
.step:last-child { padding-bottom: 0; border-inline-start-color: transparent; }
.step strong { font-weight: 600; }
.step p { font-size: .75rem; color: var(--muted); margin-top: var(--space-1); }

/* Guide mode: Noura points at the control; the person presses it. */
.focus-ring { outline: 2px solid var(--accent-text); outline-offset: 5px; animation: pulse-ring 1.2s var(--ease-soft) 3; }
@keyframes pulse-ring { 50% { outline-offset: 9px; outline-color: color-mix(in srgb, var(--accent-text) 40%, transparent); } }

/* ---------- Settings & help ---------- */
.setting { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); border-bottom: 1px solid var(--line); padding: 18px 0; font-size: .8125rem; }
.setting strong { font-weight: 600; }
.setting:last-child { border-bottom: 0; padding-bottom: 0; }
.setting:first-of-type { padding-top: 0; }
.setting .small { margin-top: 2px; }
.toggle { position: relative; width: 44px; height: 26px; border-radius: var(--r-pill); background: var(--toggle-off); padding: 3px; display: flex; flex-shrink: 0; transition: background var(--dur-2) var(--ease-out); }
.toggle[aria-checked="true"] { background: var(--live); justify-content: flex-end; }
.toggle::after { content: ''; width: 20px; height: 20px; border-radius: 50%; background: #fff; }
.toggle[aria-checked="true"]::after { background: var(--live-ink); }
/* A choice made is filled in the action colour. */
.segmented { display: inline-flex; background: var(--paper); border: 1px solid var(--field-line); border-radius: var(--r-pill); padding: 3px; gap: 2px; flex-shrink: 0; }
.segmented button { min-height: 32px; padding: 4px 14px; border-radius: var(--r-pill); font-size: .75rem; color: var(--muted); transition: background var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out); }
.segmented button:hover { color: var(--ink); }
.segmented button[aria-checked="true"] { background: var(--action); color: var(--action-ink); font-weight: 600; }
.help-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); margin: var(--space-3) 0; padding: 18px; font-size: .8125rem; line-height: 1.7; }
.help-card strong { display: block; margin-bottom: var(--space-1); font-weight: 600; }
.help-card p { font-size: .8125rem; color: var(--ink-2); }
.help-card em { font-style: normal; font-weight: 600; color: var(--ink); }
.try-list { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
kbd { font: 600 .75rem/1 var(--font-latin); background: var(--paper); border: 1px solid var(--field-line); border-bottom-width: 2px; border-radius: var(--r-sm); padding: 2px 6px; }

/* ---------- Assistant panel ---------- */
.assistant { background: var(--surface); border-inline-start: 1px solid var(--line); padding: 28px var(--space-5) 20px; display: flex; flex-direction: column; height: 100dvh; position: sticky; top: 0; min-width: 0; }
.assistant-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: var(--space-4); }
.assistant-id { min-width: 0; }
.assistant-head h2 { font-family: var(--font-display); font-size: 1.125rem; font-weight: 500; line-height: 1.4; }
/* Where the person is: the page she is following with them. */
.context { font-size: .75rem; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.context svg { width: 14px; height: 14px; flex-shrink: 0; }
.context strong { color: var(--ink); font-weight: 600; }

.avatar-stage { --focus: var(--focus-on-dark); height: clamp(190px, 32vh, 300px); min-height: 150px; flex-shrink: 1; border-radius: var(--r-lg); background: var(--stage); position: relative; overflow: hidden; }
.avatar-stage img { width: 100%; height: 100%; object-fit: cover; object-position: center 35%; }
/* Persistent media layers: idle, silent live motion, then the recorded reply. */
.avatar-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; }
.avatar-stage :is(.talking, .clip) { opacity: 0; transition: opacity var(--dur-1) var(--ease-soft); }
.avatar-stage.is-talking:not(.is-clip) .talking { opacity: 1; }
.avatar-stage.is-clip .clip { opacity: 1; }
.avatar-stage.has-video img { visibility: hidden; }
/* Her state, on her face where the audience looks: one glass badge, empty at rest.
   «تسمعك» is the live colour; «تتكلم» carries the moving bars; «صوتها مطفّي» stays
   until her voice is back on, so a silent Noura is never a mystery. */
.stage-state { position: absolute; z-index: 2; bottom: var(--space-3); inset-inline-start: var(--space-3); display: flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px var(--space-3); border-radius: var(--r-pill); background: var(--glass); color: var(--ink); font-size: .875rem; font-weight: 700; line-height: 1.4; transition: opacity var(--dur-2) var(--ease-soft); }
.stage-state[data-state="idle"] { opacity: 0; }
.stage-state .state-icon { width: 18px; height: 18px; flex-shrink: 0; }
.stage-state:not([data-state="listening"], [data-state="connecting"], [data-state="muted"], [data-state="ended"]) .state-icon { display: none; }
.stage-state[data-state="listening"] { background: var(--live); color: var(--live-ink); }
.stage-state[data-state="muted"] .state-icon { color: var(--danger); }
.bars { display: none; align-items: center; gap: 3px; height: 16px; }
.bars i { width: 3px; height: 8px; border-radius: var(--r-xs); background: var(--accent-text); }
.bars i:nth-child(2) { height: 14px; animation-delay: .2s; }
.bars i:nth-child(3) { height: 10px; animation-delay: .4s; }
.bars i:nth-child(4) { height: 16px; animation-delay: .1s; }
.stage-state:is([data-state="speaking"], [data-state="thinking"]) .bars { display: flex; }
.stage-state[data-state="speaking"] .bars i { animation: wave .6s infinite alternate; }
.stage-state[data-state="thinking"] .bars i { animation: wave 1.1s ease-in-out infinite alternate; opacity: .55; }
@keyframes wave { to { height: 4px; } }
/* Stop this reply without muting her: there only while she speaks. */
.stage-stop { position: absolute; z-index: 2; bottom: var(--space-3); inset-inline-end: var(--space-3); display: none; align-items: center; gap: 6px; min-height: 32px; padding: 4px var(--space-3); border-radius: var(--r-pill); background: var(--glass); color: var(--ink); font-size: .8125rem; font-weight: 600; transition: background var(--dur-2) var(--ease-out); }
.stage-stop svg { width: 14px; height: 14px; }
.stage-stop:hover { background: var(--surface); }
/* The video behind it is not reliably dark, so the ring brings its own glass ground. */
.stage-stop:focus-visible { outline-color: var(--ink); outline-offset: 2px; box-shadow: 0 0 0 6px var(--glass); }
.avatar-stage.is-speaking .stage-stop { display: flex; }

/* The call bar. Before the first tap it holds one door, «كلّم نورة», which carries the
   ring as its edge: the logo's two stops, mint to cyan along the reading direction (one
   of three places the gradient appears, with the logo and the favicon). In a session it
   holds the two channels, each named under its circle, then End after a divider. */
.call-controls { display: flex; justify-content: center; align-items: flex-start; gap: var(--space-4); margin: var(--space-4) 0 var(--space-3); }
.start-btn { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 48px; background: var(--action); color: var(--action-ink); border-radius: var(--r-pill); padding: 10px 20px; font-weight: 600; font-size: .9375rem; white-space: nowrap; transition: background var(--dur-2) var(--ease-out); }
.start-btn::before { content: ''; position: absolute; inset: -2px; padding: 2px; border-radius: inherit; background: linear-gradient(to left, #6ad8c0, #16a3ca); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); pointer-events: none; }
.start-btn:hover { background: var(--action-hover); }
.start-btn svg { width: 20px; height: 20px; }
[data-session="on"] .start-btn, .assistant:not([data-session="on"]) :is(.ctl, .ctl-divider, .end-btn) { display: none; }
.ctl { display: grid; justify-items: center; gap: 6px; min-width: 64px; border-radius: var(--r-md); color: var(--ink); }
.ctl:focus-visible { outline-offset: 2px; }
.ctl-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); border: 1px solid var(--field-line); transition: background var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out); }
.ctl-icon svg { width: 22px; height: 22px; }
.ctl-label { display: flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 600; line-height: 1.3; color: var(--ink-2); white-space: nowrap; }
.ctl-label kbd { display: none; font-size: .625rem; padding: 1px 4px; color: var(--muted); }
@media (hover: hover) and (pointer: fine) { :root:not([data-shortcuts="off"]) .ctl-label kbd { display: inline-block; } }
/* One grammar for both channels: the plain icon is on, the slashed one is off. Only
   "she is hearing you" is filled, in the live colour, with your voice level as its ring;
   her voice switched off takes the danger wash so it is never missed. Hover only lights
   the edge, so a state never changes under the pointer. */
.ctl[aria-checked="true"] .ico-off, .ctl[aria-checked="false"] .ico-on { display: none; }
.ctl:not(:disabled):hover .ctl-icon { border-color: var(--hover-line); }
#mic[aria-checked="true"] .ctl-icon { background: var(--live); color: var(--live-ink); border-color: var(--live); box-shadow: 0 0 0 calc(3px + var(--level, 0) * 10px) var(--accent-wash); transition: box-shadow .08s linear; }
#mic[aria-checked="true"] .ctl-label { color: var(--accent-text); }
#mic.is-pulse .ctl-icon { animation: listening 1.4s ease-out infinite; }
#mic[aria-busy="true"] .ctl-icon { border-color: var(--live); color: var(--accent-text); border-style: dashed; }
@keyframes listening { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 45%, transparent); } to { box-shadow: 0 0 0 10px color-mix(in srgb, var(--live) 0%, transparent); } }
#speaker[aria-checked="false"] .ctl-icon { background: var(--danger-wash); color: var(--danger); border-color: var(--danger-line); }
#speaker[aria-checked="false"] .ctl-label { color: var(--danger); }
.ctl-divider { align-self: center; width: 1px; height: 32px; background: var(--line); margin-top: -18px; }
/* Ending is destructive, so it is a danger line with its own word, away from the two
   switches, and only there while a session runs. */
.end-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-top: 2px; padding: 8px var(--space-4); border-radius: var(--r-pill); border: 1px solid var(--danger-line); color: var(--danger); background: var(--surface); font-size: .8125rem; font-weight: 600; transition: background var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out); }
.end-btn svg { width: 18px; height: 18px; }
.end-btn:hover { background: var(--danger-wash); border-color: var(--danger); }

.round { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--paper); border: 1px solid var(--line); transition: background var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out); }
.round:not(:disabled):hover { border-color: var(--hover-line); color: var(--hover-ink); }

.chat { overflow-y: auto; flex: 1; min-height: 95px; padding: var(--space-3) 2px 10px; overscroll-behavior: contain; display: flex; flex-direction: column; }
.chat > :first-child { margin-top: auto; }
.msg { margin-bottom: 14px; font-size: .8125rem; line-height: 1.75; overflow-wrap: anywhere; }
.msg .who { font-size: .75rem; font-weight: 600; color: var(--teal-text); margin-bottom: 2px; }
.msg--user { margin-inline-start: 28px; background: var(--accent-wash); border: 1px solid var(--accent-line); border-radius: var(--r-md); border-end-end-radius: var(--r-xs); padding: 10px var(--space-3); }
.msg--user .who { color: var(--accent-text); }
.msg--system { text-align: center; font-size: .75rem; color: var(--muted); }
.action-note { font-size: .75rem; color: var(--teal-text); margin-top: 6px; border-inline-start: 2px solid currentColor; padding-inline-start: var(--space-2); }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: typing 1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

/* Suggestions are outlined; the one that answers Noura's question is filled. */
.suggestions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--space-3); }
.suggestions:empty { display: none; }
.chip { min-height: 36px; background: var(--surface); color: var(--ink); border: 1px solid var(--field-line); border-radius: var(--r-pill); padding: 6px 14px; font-size: .75rem; font-weight: 500; transition: background var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out); }
.chip:hover { background: var(--accent-wash); border-color: var(--hover-line); color: var(--hover-ink); }
.chip--strong { background: var(--action); border-color: var(--action); color: var(--action-ink); font-weight: 600; }
.chip--strong:hover { background: var(--action-hover); border-color: var(--action-hover); color: var(--action-ink); }
.input-row { display: flex; align-items: center; gap: var(--space-1); background: var(--paper); border: 1px solid var(--field-line); border-radius: var(--r-pill); padding: 5px; padding-inline-start: var(--space-3); transition: border-color var(--dur-1) var(--ease-soft); }
.input-row:hover { border-color: var(--hover-line); }
.input-row:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
/* 16px, or iOS zooms the page when the field takes focus. */
.input-row input { min-width: 0; width: 100%; border: 0; background: transparent; padding: 6px 0; font-size: 1rem; }
.input-row input:focus-visible { outline: none; }
.input-row input::placeholder { color: var(--muted); }
.send { background: var(--action); color: var(--action-ink); border-radius: 50%; min-width: 36px; height: 36px; display: grid; place-items: center; transition: background var(--dur-2) var(--ease-out); }
.send:hover { background: var(--action-hover); }
.send svg { width: 17px; height: 17px; }
.fine { font-size: .6875rem; color: var(--muted); text-align: center; line-height: 1.6; margin-top: 10px; }
.mobile-close, .mobile-nav { display: none; }

/* ---------- Dialog & toast ---------- */
.modal { border: 1px solid var(--line); padding: 0; border-radius: var(--r-lg); max-width: 400px; width: calc(100% - 40px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-float); }
.modal form { padding: 28px; }
.modal::backdrop { background: var(--overlay); }
.modal h2 { font-family: var(--font-display); font-weight: 500; font-size: 1.375rem; line-height: 1.5; margin: var(--space-1) 0 var(--space-2); }
.modal p { font-size: .875rem; line-height: 1.7; color: var(--ink-2); }
.modal .demo-label { margin-bottom: var(--space-2); }
.modal .summary { padding: var(--space-1) 14px; margin-top: var(--space-4); background: var(--paper); }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: var(--space-5); justify-content: flex-end; }
.modal[open] { animation: rise var(--dur-3) var(--ease-out); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.toast { position: fixed; bottom: var(--space-5); left: 50%; transform: translate(-50%, 12px); background: var(--ink); color: var(--surface); border-radius: var(--r-md); padding: var(--space-3) 20px; font-size: .8125rem; z-index: 50; box-shadow: var(--shadow-float); max-width: min(90vw, 420px); opacity: 0; pointer-events: none; transition: opacity var(--dur-3) var(--ease-soft), transform var(--dur-3) var(--ease-out); }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Touch targets ---------- */
/* On a touch screen every target is 44px, even where the drawing is smaller:
   controls grow, and text links carry an unseen pad that never covers a neighbour. */
@media (pointer: coarse) {
  .chip, .back, .segmented button { min-height: 44px; }
  .send { min-width: 44px; height: 44px; }
  .text-btn::after, .toggle::before { content: ''; position: absolute; inset: -10px -6px; }
  /* 32px drawn, 44px to the finger: the stage's bottom inset leaves room. The landscape
     strip clips the pad; there the mic, which also stops her, is the larger target. */
  .stage-stop::after { content: ''; position: absolute; inset: -6px -4px; }
}

/* ---------- Responsive ---------- */
@media (min-width: 1451px) and (max-width: 1599px) {
  .shell { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

@media (max-width: 1100px) {
  .shell { grid-template-columns: 190px minmax(320px, 1fr) 330px; }
  .sidebar { padding: var(--space-6) 18px; }
  .main { padding: var(--space-6) var(--space-5) 100px; }
  .assistant { padding: var(--space-5) 18px; }
  .hero-art { inset-inline-end: 14px; width: 75px; }
  .hero p { max-width: 200px; }
  .welcome { font-size: 1.875rem; }
}

@media (max-width: 850px) {
  /* Fixed sizes, not measured ones (HANDOFF § 5b): the tab bar; Noura's face in the
     dock; the dock itself (the taller of the face and two lines of her reply, two
     ladder steps of padding, 1px edges); the offer chip that floats above it; and
     how far the dock reaches up from the bottom edge. */
  :root {
    --tabbar-h: 64px;
    --dock-tile: 64px;
    --dock-h: calc(max(var(--dock-tile), 2.6rem) + 2 * var(--space-2) + 2px);
    --dock-chip: calc(44px + var(--space-2));
    --dock-reserve: calc(var(--tabbar-h) + var(--space-2) + var(--dock-h) + env(safe-area-inset-bottom));
  }
  html { scroll-padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  body { background: var(--paper); }
  .shell { display: block; min-height: 0; }
  .sidebar { display: none; }
  .main { max-width: 600px; margin: auto; padding: 18px 20px calc(96px + env(safe-area-inset-bottom)); }
  .topbar { margin-bottom: var(--space-5); }
  .crumbs { display: none; }
  .brand--compact { display: flex; }
  .talk-btn { display: flex; align-items: center; gap: var(--space-2); min-height: 44px; background: var(--action); color: var(--action-ink); border-radius: var(--r-pill); padding-block: 6px; padding-inline: 10px 16px; font-size: .8125rem; font-weight: 600; }
  .talk-btn svg { width: 20px; height: 20px; }
  .talk-btn[aria-expanded="true"] { visibility: hidden; }
  .hero { margin-top: var(--space-5); min-height: 196px; padding: var(--space-5); }
  .hero-art { opacity: .9; width: 80px; inset-inline-end: 14px; }
  .hero p { max-width: 200px; }
  .hero h2 { max-width: 220px; }
  .made-by--compact { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 10px; margin-top: var(--space-6); }
  .made-by--compact .osimah-logo { width: 96px; }

  /* The current tab: an inset bar at its top, weight and colour. */
  .mobile-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: color-mix(in srgb, var(--surface) 93%, transparent); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10; justify-content: space-around; }
  .mobile-nav a { position: relative; height: var(--tabbar-h); font-size: .6875rem; color: var(--muted); display: grid; justify-items: center; align-content: center; gap: var(--space-1); min-width: 66px; text-decoration: none; }
  .mobile-nav a.active { color: var(--accent-text); font-weight: 600; }
  .mobile-nav a.active::before { content: ''; position: absolute; top: 0; inset-inline: 18px; height: 3px; border-radius: 0 0 var(--r-xs) var(--r-xs); background: currentColor; }
  .mobile-nav svg { width: 21px; height: 21px; }

  /* The companion becomes a bottom sheet that leaves the page visible above it. */
  .assistant { display: none; position: fixed; z-index: 20; inset: auto auto 0 0; width: 420px; max-width: 100%; height: min(680px, 80svh); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--shadow-sheet); padding: 14px var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom)); }
  .assistant.is-open { display: flex; animation: sheet-in var(--dur-3) var(--ease-out); }
  /* A safety net for large text: the full view scrolls before the field leaves the screen. */
  .assistant.is-open:not(.is-docked) { overflow-y: auto; overscroll-behavior: contain; }
  /* Let the page scroll clear of the full view so highlighted controls can be reached;
     the tab bar under it is out of reach, so it leaves the tab order too. */
  [data-companion="expanded"] { scroll-padding-bottom: calc(min(680px, 80svh) + var(--space-4)); }
  [data-companion="expanded"] .main { padding-bottom: calc(min(680px, 80svh) + 24px); }
  [data-companion="expanded"] .mobile-nav { visibility: hidden; }
  /* Wide enough for the four tabs beside the 420px sheet: they move clear of it and stay usable. */
  @media (min-width: 700px) { [data-companion="expanded"] .mobile-nav { visibility: visible; padding-left: calc(420px + var(--space-2) + env(safe-area-inset-left)); } }
  /* Her face never fades: the panel only rises into place. */
  @keyframes sheet-in { from { transform: translateY(24px); } }
  .assistant-head { margin-bottom: 10px; }
  .mobile-close { display: grid; }
  /* The portrait gives way first, so the field stays on screen on short phones. */
  .avatar-stage { height: 30svh; min-height: 120px; max-height: 260px; flex-shrink: 1; isolation: isolate; }
  :is(.assistant-head, .call-controls, .context, .suggestions, .input-row) { flex-shrink: 0; }
  .call-controls { margin: 10px 0; }
  .chat { min-height: 60px; padding-top: var(--space-3); }
  .fine { display: none; }

  /* Docked: Noura steps aside. The same panel becomes a floating bar above the tab bar:
     her face (the same persistent <video>s), her newest line, the toggle back
     to the full view, and the mic. Visual order, right to left: face, line, toggle,
     mic, which is also the tab order. */
  .assistant.is-docked { top: auto; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--space-2)); left: max(var(--space-2), env(safe-area-inset-left)); width: min(424px, calc(100% - max(var(--space-2), env(safe-area-inset-left)) - max(var(--space-2), env(safe-area-inset-right)))); height: var(--dock-h); flex-direction: row; align-items: center; gap: var(--space-2); padding: var(--space-2); background: var(--float); border: 1px solid var(--float-line); border-radius: var(--r-lg); box-shadow: var(--shadow-sheet); cursor: pointer; animation: dock-in var(--dur-2) var(--ease-out); }
  @keyframes dock-in { from { transform: translateY(var(--space-3)); } }
  .is-docked .avatar-stage { order: -2; flex: none; width: var(--dock-tile); height: var(--dock-tile); min-height: 0; max-height: none; border-radius: var(--r-sm); }
  /* Her face fills the tile, cropped like a contact photo; the portrait takes the same crop. */
  .is-docked .avatar-stage :is(img, video) { scale: 1.5; transform-origin: 50% 32%; }
  /* Her state stays on the tile as its icon alone (the word is in the full view):
     the live mic, the moving bars, or the slashed speaker while she is muted. */
  .is-docked .stage-state { inset-inline-start: auto; inset-inline-end: 3px; bottom: 3px; min-height: 0; padding: 2px 5px; gap: 0; }
  .is-docked .stage-state .state-icon { width: 14px; height: 14px; }
  .is-docked .bars { height: 12px; gap: 2px; }
  .is-docked .bars i { width: 2px; }
  .is-docked #statusText { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .is-docked .chat { order: -1; flex: 1; min-width: 0; min-height: 0; position: relative; padding: 0 var(--space-1); overflow: hidden; }
  .is-docked :is(.assistant-head, .call-controls) { flex: none; margin: 0; }
  .is-docked .assistant-head { gap: 0; }
  .is-docked :is(#speaker, #end, .ctl-divider, .context, .input-row, .start-btn, .stage-stop) { display: none; }
  /* In the dock the mic is the one way to talk: filled in the action colour so it never
     reads as the outlined toggle beside it, the live colour while she hears you. Its
     name stays for screen readers; the word under it goes. */
  .is-docked .ctl { min-width: 0; gap: 0; }
  .is-docked .ctl-icon { width: 44px; height: 44px; }
  .is-docked #mic[aria-checked="false"] .ctl-icon { background: var(--action); color: var(--action-ink); border-color: var(--action); }
  .is-docked #mic .ico-on { display: block; }
  .is-docked #mic .ico-off { display: none; }
  .is-docked .ctl-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .is-docked #minimize svg { rotate: 180deg; }
  /* Clipped, never display:none: the log stays whole for screen readers, so the
     full view coming back announces nothing again. */
  .is-docked :is(.assistant-head h2, .chat > :not(:last-child), .msg--assistant > .who, .action-note) { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
  .is-docked .msg { margin: 0; font-size: .8125rem; line-height: 1.6; }
  .is-docked .msg-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; min-width: 0; }
  /* The person's own words, labelled: «أنت» and the line stay two blocks, so a screen reader keeps them apart. */
  .is-docked .msg--user { display: flex; align-items: baseline; gap: var(--space-1); padding: 0; border: 0; background: none; color: var(--accent-text); }
  .is-docked .msg--user > .who { flex: none; margin: 0; }
  .is-docked .msg--system { text-align: start; }
  .is-docked .typing { padding: 0; }
  /* Her question answered in one tap: only the filled chip, floating over the mic end. */
  .is-docked .suggestions { position: absolute; inset-inline-end: 0; bottom: calc(100% + var(--space-2)); margin: 0; }
  .is-docked .suggestions .chip:not(.chip--strong), :root:not([data-offer]) .is-docked .suggestions { display: none; }
  .is-docked .chip--strong { box-shadow: var(--shadow-float); }
  @media (hover: hover) { .assistant.is-docked:hover { border-color: var(--hover-line); } }
  /* The page keeps everything, and keyboard focus, clear of the dock and its chip. */
  [data-companion="docked"] { scroll-padding-bottom: calc(var(--dock-reserve) + var(--space-4)); }
  [data-companion="docked"] .main { padding-bottom: calc(var(--dock-reserve) + var(--space-5)); }
  [data-companion="docked"][data-offer] { scroll-padding-bottom: calc(var(--dock-reserve) + var(--dock-chip) + var(--space-4)); }
  [data-companion="docked"][data-offer] .main { padding-bottom: calc(var(--dock-reserve) + var(--dock-chip) + var(--space-5)); }
  /* Below the top bar, so it never covers «كلّم نورة» when it points at it. */
  .toast { top: calc(70px + env(safe-area-inset-top)); bottom: auto; transform: translate(-50%, -12px); }
  .toast.is-visible { transform: translate(-50%, 0); }
}

@media (max-width: 420px) {
  .main { padding-left: var(--space-4); padding-right: var(--space-4); }
  .welcome { font-size: 1.75rem; }
  .quick-grid { gap: var(--space-2); }
  .quick { padding: 14px 10px; font-size: .75rem; }
  .setting--wide { flex-wrap: wrap; }
  .assistant { border-inline: 0; }
}

@media (max-height: 640px) and (max-width: 850px) {
  .avatar-stage { height: 130px; min-height: 96px; }
  .context { display: none; }
  /* One row of suggestions, scrolled sideways, with room for their focus ring. */
  .assistant:not(.is-docked) .suggestions { flex-wrap: nowrap; overflow-x: auto; padding: 5px; margin: 0 -5px 7px; }
  .assistant:not(.is-docked) .chip { flex: none; }
}

/* Phones on their side: the full view takes the whole height (and scrolls before the
   field leaves the screen); the dock joins the tab bar's row. */
@media (max-height: 500px) and (max-width: 850px) and (orientation: landscape) {
  :root { --dock-tile: 48px; }
  .assistant.is-open:not(.is-docked) { top: max(var(--space-2), env(safe-area-inset-top)); height: auto; padding-top: 10px; padding-left: max(var(--space-4), env(safe-area-inset-left)); }
  [data-companion="expanded"] { scroll-padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .assistant-head { margin-bottom: 6px; }
  /* With Safari's bars showing the full view can be 300px tall: her face keeps a floor
     (the panel scrolls instead). */
  .avatar-stage { height: 96px; min-height: var(--dock-tile); }
  /* Her face is a strip here: the badge and the stop button shrink so they don't cover it. */
  :is(.stage-state, .stage-stop) { bottom: 6px; min-height: 24px; padding: 1px 10px; font-size: .75rem; }
  [data-companion="expanded"] .toast { left: calc(420px + (100% - 420px) / 2); max-width: calc(100% - 420px - 32px); }
  .stage-state { inset-inline-start: 6px; }
  .stage-stop { inset-inline-end: 6px; }
  .call-controls { margin: 6px 0; }
}
/* Wide enough for the dock and all four tabs side by side: the dock joins the tab bar's row,
   as wide as the tabs leave room for. Narrower landscape keeps the portrait dock above the bar. */
@media (max-height: 500px) and (min-width: 600px) and (max-width: 850px) and (orientation: landscape) {
  :root {
    --dock-w: min(360px, calc(100vw - 4 * 66px - 3 * var(--space-2) - env(safe-area-inset-left) - env(safe-area-inset-right)));
    --dock-reserve: calc(var(--space-1) + var(--dock-h) + env(safe-area-inset-bottom));
  }
  .assistant.is-docked { bottom: calc(env(safe-area-inset-bottom) + var(--space-1)); width: var(--dock-w); }
  [data-companion="docked"] .mobile-nav { padding-left: calc(var(--dock-w) + 2 * var(--space-2) + env(safe-area-inset-left)); padding-right: env(safe-area-inset-right); }
}

/* Short laptop screens: tighter rhythm, and her face gives way before the field. */
@media (max-height: 800px) and (min-width: 851px) {
  .avatar-stage { height: clamp(170px, 30vh, 230px); }
  .assistant { padding-top: 20px; padding-bottom: var(--space-4); }
  .assistant-head { margin-bottom: var(--space-3); }
  .call-controls { margin: var(--space-3) 0 var(--space-2); }
  .fine { margin-top: var(--space-2); }
}

/* Big screens, often shared to a call and seen at half size: the extra width goes to
   her (a larger face, a wider column, larger lines), not to empty margins. */
@media (min-width: 1600px) {
  .shell { max-width: 1720px; grid-template-columns: 260px minmax(350px, 1fr) clamp(365px, 26vw, 460px); }
  .avatar-stage { height: clamp(240px, 36vh, 400px); }
  .msg { font-size: .9375rem; }
  .stage-state { font-size: 1rem; }
}
@media (min-width: 1721px) {
  .shell { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

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

/* Under a contrast theme the backgrounds go, so states drawn with a fill are
   redrawn in the system's own colours. */
@media (forced-colors: active) {
  .toggle { border: 1px solid CanvasText; }
  .toggle::after { background: CanvasText; }
  .toggle[aria-checked="true"] { background: Highlight; }
  .toggle[aria-checked="true"]::after { background: HighlightText; }
  .segmented button[aria-checked="true"] { background: Highlight; color: HighlightText; }
  .nav a.active, .mobile-nav a.active { color: Highlight; }
  .pill { border-color: CanvasText; }
  .osimah-logo { forced-color-adjust: none; }
  .assistant.is-docked { border: 1px solid CanvasText; }
  .ctl-icon, .end-btn, .stage-state, .stage-stop { border: 1px solid CanvasText; }
  :is(#mic, #speaker)[aria-checked="true"] .ctl-icon { background: Highlight; color: HighlightText; box-shadow: none; }
  .stage-state[data-state="listening"] { forced-color-adjust: none; background: Highlight; color: HighlightText; }
  #speaker[aria-checked="false"] .ctl-icon { border-style: dashed; }
}
