/* Studio interface. Brand: Bahrain Websites navy, cream and teal. Logical properties throughout so the
   whole interface mirrors for Arabic. Section 1 (tokens and shared components) is the base every editor
   module uses; later sections style the shell. Panels live in panels.css. */

/* ---------- 1. Tokens ---------- */
:root {
  --ui-navy: #0C2340;
  --ui-navy-2: #16304F;
  --ui-cream: #F1EEE6;
  --ui-bg: #EDE9DF;          /* canvas behind the preview */
  --ui-panel: #FBFAF6;       /* side panel */
  --ui-card: #FFFFFF;
  --ui-ink: #0C2340;
  --ui-ink2: #4A5B71;        /* 6.6:1 on --ui-panel, 5.9:1 on --ui-cream */
  --ui-ink3: #5A6879;        /* hints: 5.5:1 on --ui-panel, 4.9:1 on --ui-cream, 4.7:1 on --ui-bg (tested) */
  --ui-line: rgba(12, 35, 64, .14);
  --ui-line-2: rgba(12, 35, 64, .24);
  --ui-ac: #1FB5AD;          /* teal, used as a fill with navy text */
  --ui-ac-strong: #0F6E69;   /* teal for text and focus rings: 5.8:1 on --ui-panel, 5.2:1 on --ui-cream, 5.0:1 on --ui-bg (tested) */
  --ui-ac-soft: rgba(31, 181, 173, .14);
  --ui-gold: #FFC46B;
  --ui-danger: #B3261E;
  --ui-ok: #1E7A4F;
  --ui-font: 'Google Sans', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* F12: one readable Arabic sans for every control, label, input and hint; the Kufi is kept for the
     big brand moments only (the start headline and dialog titles). */
  --ui-font-ar: 'IBM Plex Sans Arabic', 'Google Sans', system-ui, sans-serif;
  --ui-display-ar: 'Reem Kufi', 'IBM Plex Sans Arabic', 'Google Sans', system-ui, sans-serif;
  --ui-r-sm: 10px;
  --ui-r: 14px;
  --ui-r-lg: 22px;
  --ui-shadow: 0 1px 2px rgba(12, 35, 64, .06), 0 8px 24px -12px rgba(12, 35, 64, .22);
  --ui-shadow-lg: 0 2px 6px rgba(12, 35, 64, .08), 0 28px 60px -24px rgba(12, 35, 64, .45);
  --ui-ease: cubic-bezier(.22, .9, .24, 1);
  --ui-panel-w: 392px;
  --ui-top-h: 60px;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--ui-bg);
  color: var(--ui-ink);
  font-family: var(--ui-font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html[lang="ar"] body { font-family: var(--ui-font-ar); }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
.ico { flex: none; }
a { color: var(--ui-ac-strong); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--ui-ac-strong); outline-offset: 2px; }
.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; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- 3. Buttons and chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--ui-line-2); background: var(--ui-card); color: var(--ui-ink);
  font-weight: 500; font-size: 14.5px; white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background-color .18s var(--ui-ease), border-color .18s var(--ui-ease), transform .18s var(--ui-ease), box-shadow .18s var(--ui-ease);
}
.btn:hover { border-color: var(--ui-navy); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--ui-navy); border-color: var(--ui-navy); color: var(--ui-cream); }
.btn-primary:hover { background: var(--ui-navy-2); }
.btn-accent { background: var(--ui-ac); border-color: var(--ui-ac); color: var(--ui-navy); font-weight: 600; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 4px 14px -6px rgba(31, 181, 173, .7); }
.btn-accent:hover { background: #3CC8C0; border-color: #3CC8C0; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(12, 35, 64, .06); border-color: transparent; }
.btn-icon { width: 40px; padding: 0; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13.5px; }
.btn-sm.btn-icon { width: 32px; }
.btn-lg { min-height: 52px; padding: 0 24px; font-size: 16px; }
.btn-danger { color: var(--ui-danger); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--ui-line-2); background: var(--ui-card);
  font-size: 14px; cursor: pointer; transition: background-color .18s, border-color .18s;
}
.chip:hover { border-color: var(--ui-navy); }
.chip[aria-pressed="true"] { background: var(--ui-navy); border-color: var(--ui-navy); color: var(--ui-cream); }

/* ---------- 4. Form fields ---------- */
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld-l { font-size: 13px; font-weight: 600; color: var(--ui-ink); }
.fld-h { font-size: 12.5px; color: var(--ui-ink3); }
.fld-err .fld-h { color: var(--ui-danger); }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: var(--ui-r-sm);
  border: 1px solid var(--ui-line-2); background: var(--ui-card); color: var(--ui-ink);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { resize: vertical; min-height: 88px; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ui-ac-strong); box-shadow: 0 0 0 3px rgba(18, 124, 119, .2); }
.fld-err .input, .fld-err .textarea { border-color: var(--ui-danger); }
.input[dir="rtl"], .textarea[dir="rtl"] { font-family: var(--ui-font-ar); }

/* ---------- 5. Segmented control ---------- */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(12, 35, 64, .07); }
.seg-b {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent;
  font-size: 13.5px; font-weight: 500; color: var(--ui-ink2); cursor: pointer; transition: background-color .18s, color .18s, box-shadow .18s;
}
.seg-b:hover { color: var(--ui-ink); }
.seg-b[aria-checked="true"] { background: var(--ui-card); color: var(--ui-ink); font-weight: 600; box-shadow: inset 0 0 0 1.5px var(--ui-navy), 0 1px 3px rgba(12, 35, 64, .16); }
.seg-sm .seg-b { min-height: 28px; padding: 0 10px; font-size: 12.5px; }

/* ---------- 6. Modal ---------- */
.m-root {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px;
  background: rgba(8, 22, 41, .48); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  animation: m-fade .18s var(--ui-ease);
}
.m-root.m-out { opacity: 0; transition: opacity .16s; }
.m-panel {
  width: min(520px, 100%); max-height: min(88vh, 900px); display: flex; flex-direction: column;
  background: var(--ui-panel); border-radius: var(--ui-r-lg); box-shadow: var(--ui-shadow-lg);
  animation: m-rise .24s var(--ui-ease); outline: none;
}
.m-wide { width: min(980px, 100%); }
.m-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 18px 8px 24px; }
.m-title { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.m-body { padding: 8px 24px 20px; overflow: auto; }
.m-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 14px 24px 20px; border-top: 1px solid var(--ui-line); }
@keyframes m-fade { from { opacity: 0; } }
@keyframes m-rise { from { opacity: 0; transform: translateY(12px) scale(.985); } }
@media (max-width: 640px) {
  .m-root { place-items: end stretch; padding: 0; }
  .m-panel { width: 100%; max-height: 92vh; border-radius: var(--ui-r-lg) var(--ui-r-lg) 0 0; }
}

/* ---------- 7. Toasts ---------- */
/* The stack spans the screen inside the safe area and centres each toast, so a long message gets a real
   width and wraps into a few lines, not a narrow column. 8.13 keeps it clear of the tab bar, the chat
   field and the look picker. */
.toasts {
  position: fixed; z-index: 1100; inset-inline: 0; inset-block-end: calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding-left: max(4vw, env(safe-area-inset-left)); padding-right: max(4vw, env(safe-area-inset-right));
  pointer-events: none;
}
/* At most about 34rem. The radius is half a one-line toast's height (a line plus the padding), so one
   line is still a pill and a wrapped message is a rounded box, not a blob. */
.toast {
  display: flex; align-items: center; gap: 10px; max-width: min(100%, 34rem); padding: 11px 18px; border-radius: 22px; border-radius: calc(.5lh + 11px);
  background: var(--ui-navy); color: var(--ui-cream); font-size: 14px; line-height: 1.45; box-shadow: var(--ui-shadow-lg);
  animation: m-rise .22s var(--ui-ease); pointer-events: auto;
}
html[lang="ar"] .toast { font-size: 15px; line-height: 1.6; }
.toast > span { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
/* A wrapped message keeps its icon on the first line. */
.toast:not(:has(button)) > .ico { align-self: flex-start; margin-block-start: 1px; margin-block-start: calc((1lh - 18px) / 2); }
/* With an action, the message wraps and the button keeps its size at the end, near the edge; the
   corners follow the button's (8.12 does the same for its 44px size). */
.toast:has(button) { padding-block: 7px; padding-inline-end: 7px; border-radius: 22px; }
.toast > span > :is(.toast-undo, .pn-toast) { display: flex; }
.toast > span > :is(.toast-undo, .pn-toast) > span { flex: 1 1 auto; min-width: 0; }
.toast button { flex: none; white-space: nowrap; }
.toast-ok .ico { color: var(--ui-ac); }
.toast-warn .ico, .toast-err .ico { color: var(--ui-gold); }
.toast-out { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }

/* ---------- 8. Shell (the editor layout, start screen, chat, share and send) ---------- */
/* Owned by the shell module; extend below. */

/* 8.1 Shared shell bits */
.bw-mark { position: relative; flex: none; width: 18px; height: 25px; border-radius: 9px 9px 2px 2px; background: var(--ui-ac); box-shadow: inset 0 0 0 2px var(--ui-navy); }
.bw-mark::after { content: ''; position: absolute; inset-inline: 4.5px; bottom: 2px; height: 10px; border-radius: 4.5px 4.5px 0 0; background: var(--ui-navy); }
.chip-sm { min-height: 30px; padding: 0 12px; font-size: 13px; }
.spin { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: ui-spin .8s linear infinite; }
@keyframes ui-spin { to { transform: rotate(360deg); } }
.sk { border-radius: 10px; background: linear-gradient(90deg, rgba(12, 35, 64, .06) 25%, rgba(12, 35, 64, .11) 37%, rgba(12, 35, 64, .06) 63%); background-size: 400% 100%; animation: ui-sk 1.4s ease infinite; }
@keyframes ui-sk { from { background-position: 100% 50%; } to { background-position: 0 50%; } }
@keyframes ui-in { from { opacity: 0; transform: translateY(6px); } }
.toast-undo { display: inline-flex; align-items: center; gap: 12px; }
.toast-act { min-height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: rgba(241, 238, 230, .16); color: var(--ui-cream); font-weight: 600; font-size: 13.5px; cursor: pointer; }
.toast-act:hover { background: rgba(241, 238, 230, .26); }
.toast-act[disabled] { opacity: .5; cursor: default; }

/* Arabic reading text uses the same face as the controls (F12): one Arabic family per form. */
html[lang="ar"] :is(.st-sub, .st-sec-sub, .st-deck-cap, .st-foot, .msg-body, .chat-welcome, .sh-lead, .snd-lead, .snd-done p, .looks-s, .looks-note, .pv-empty-card p, .sh-notes, .snd-sum-body, .look-mood, .chat-mode, .fld-h, .snd-fine, .snd-free, .imp-lead, .imp-safe, .stf p, .blog-time, .pv-build-t, .lm-note) { font-family: var(--ui-font-ar); }
/* The Kufi only where the type is big enough to carry it. */
html[lang="ar"] :is(.st-h1, .m-title) { font-family: var(--ui-display-ar); }
html[lang="ar"] .st-sub { font-size: clamp(19px, 1.7vw, 22px); line-height: 1.5; }
html[lang="ar"] :is(.msg-body, .chat-welcome, .sh-lead, .snd-lead, .snd-done p, .st-sec-sub, .st-foot, .imp-lead) { font-size: 17.5px; line-height: 1.5; }
html[lang="ar"] :is(.looks-s, .looks-note, .sh-notes, .snd-sum-body, .look-mood, .st-deck-cap, .chat-mode, .pv-empty-card p, .fld-h, .snd-fine, .snd-free, .imp-safe, .blog-time, .lm-note) { font-size: 15.5px; line-height: 1.45; }
/* An empty Arabic chat box reads right to left, placeholder included (chat.js sets dir while empty). */
.chat-in::placeholder { text-align: start; }

/* 8.2 Thumbnails: a scaled, still render. The frame is positioned and scaled from the physical top-left
   on purpose: this is geometry, not reading direction. */
.thumb { position: relative; width: 100%; overflow: hidden; overflow: clip; direction: ltr; background: #F6F4EE; }
.thumb-if { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; pointer-events: none; background: transparent; opacity: 0; transition: opacity .2s ease; }
.thumb-on .thumb-if { opacity: 1; }
/* The stand-in drawn in the look's own colours until the page paints (and if it never does). */
.thumb-ph { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 7%; padding: 4% 6%; }
.thumb-ph-nav { flex: none; height: 3%; width: 100%; border-radius: 4px; opacity: .12; }
.thumb-ph-body { flex: 1; display: grid; grid-template-columns: 1.1fr 1fr; gap: 6%; align-items: center; min-height: 0; }
.thumb-ph-copy { display: flex; flex-direction: column; gap: 9%; min-width: 0; }
.thumb-ph-aa { font: 600 clamp(14px, 3.4vw, 46px)/1 Georgia, 'Times New Roman', serif; letter-spacing: -.02em; }
.thumb-ph-l { height: 7px; border-radius: 4px; opacity: .16; }
.thumb-ph-s { width: 62%; }
.thumb-ph-btn { width: 38%; height: 12px; border-radius: 999px; }
.thumb-ph-img { align-self: stretch; margin-block: 4%; border-radius: 10px; }
.thumb-on .thumb-ph { transition: opacity .2s; opacity: 0; }

/* 8.3 Start screen */
.st { min-height: 100vh; min-height: 100dvh; background: var(--ui-cream); background-image: radial-gradient(1200px 520px at 85% -10%, rgba(31, 181, 173, .13), transparent 60%), radial-gradient(900px 500px at -10% 10%, rgba(255, 196, 107, .12), transparent 60%); }
.st-top { display: flex; align-items: center; gap: 10px; max-width: 1240px; margin: 0 auto; padding: 16px 24px; }
.st-brand { display: flex; align-items: center; gap: 10px; min-height: 44px; padding-inline: 8px 12px; border-radius: 999px; color: var(--ui-ink); text-decoration: none; font-weight: 600; font-size: 17px; letter-spacing: -.01em; transition: background-color .2s; }
.st-brand:hover { background: rgba(12, 35, 64, .06); }
.st-badge { padding: 3px 10px; border-radius: 999px; background: var(--ui-navy); color: var(--ui-cream); font-size: 12.5px; font-weight: 600; letter-spacing: .02em; }
.st-top-sp { flex: 1; }
.st-lang { min-width: 64px; font-size: 15px; }
.st-main { max-width: 1240px; margin: 0 auto; padding: 0 24px 56px; }
.st-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 450px); gap: clamp(40px, 5vw, 72px); align-items: center; padding: clamp(20px, 5vh, 64px) 0 clamp(40px, 7vh, 80px); }
.st-copy { min-width: 0; }
.st-kicker { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 22px; padding: 6px 14px 6px 12px; border-radius: 999px; border: 1px solid var(--ui-line); background: rgba(255, 255, 255, .66); color: var(--ui-ac-strong); font-size: 13.5px; font-weight: 600; }
.st-h1 { margin: 0; font-size: clamp(42px, 4.9vw, 72px); font-weight: 500; line-height: 1.02; letter-spacing: -.035em; color: var(--ui-navy); text-wrap: balance; }
.st-h1 span { color: var(--ui-ac-strong); }
html[lang="ar"] .st-h1 { font-weight: 600; letter-spacing: 0; line-height: 1.22; }
.st-sub { max-width: 33em; margin: 22px 0 28px; font-size: clamp(16.5px, 1.45vw, 19px); line-height: 1.55; color: var(--ui-ink2); }
.st-box { position: relative; border: 1px solid var(--ui-line); border-radius: 24px; background: var(--ui-card); box-shadow: 0 1px 2px rgba(12, 35, 64, .05), 0 26px 60px -30px rgba(12, 35, 64, .38); transition: border-color .2s, box-shadow .2s; }
.st-box:focus-within { border-color: rgba(18, 124, 119, .55); box-shadow: 0 0 0 4px rgba(31, 181, 173, .16), 0 26px 60px -30px rgba(12, 35, 64, .42); }
.st-field { position: relative; }
.st-in { display: block; width: 100%; min-height: 116px; max-height: 40vh; padding: 22px 24px 10px; border: 0; background: transparent; resize: none; font-size: 19px; line-height: 1.5; color: var(--ui-ink); outline: none; }
.st-ph { position: absolute; inset: 22px 24px auto; font-size: 19px; line-height: 1.5; color: var(--ui-ink3); pointer-events: none; opacity: 0; transition: opacity .3s var(--ui-ease); }
.st-ph.on { opacity: 1; }
.st-ph[hidden] { display: none; }
.st-vibes { display: flex; align-items: center; gap: 6px; padding: 4px 20px 14px; overflow-x: auto; scrollbar-width: none; }
.st-vibes::-webkit-scrollbar { display: none; }
.st-vibes .chip { flex: none; }
.st-vibes-l { flex: none; margin-inline-end: 4px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ui-ink3); }
html[lang="ar"] .st-vibes-l { letter-spacing: 0; font-size: 13px; }
.st-bar { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-top: 1px solid var(--ui-line); }
.st-bar-sp { flex: 1; }
.st-go { padding-inline: 24px 20px; }
.st-err { margin: 10px 6px 0; font-size: 14px; color: var(--ui-danger); }
.st-err:empty { display: none; }
.st-shake { animation: st-shake .38s var(--ui-ease); }
@keyframes st-shake { 20% { transform: translateX(-6px); } 45% { transform: translateX(5px); } 70% { transform: translateX(-3px); } }
.st-examples { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; }
.st-examples-l { margin-inline-end: 2px; font-size: 13px; font-weight: 600; color: var(--ui-ink3); }
.st-examples .chip { background: rgba(255, 255, 255, .6); }

/* Showcase deck: the front card cycles to the back. */
.st-show { min-width: 0; }
.st-deck { position: relative; padding-top: 44px; }
.st-deck::after { content: ''; display: block; aspect-ratio: 1280 / 800; margin-bottom: 58px; }
.st-card { position: absolute; inset-inline: 0; top: 44px; display: flex; flex-direction: column; padding: 0; border: 1px solid var(--ui-line); border-radius: 18px; overflow: hidden; background: var(--ui-card); box-shadow: 0 30px 70px -36px rgba(12, 35, 64, .55), 0 2px 6px rgba(12, 35, 64, .06); cursor: pointer; text-align: start; color: var(--ui-ink); transform-origin: 50% 0; transition: transform .75s var(--ui-ease), opacity .75s var(--ui-ease), box-shadow .25s; }
.st-card[data-pos="0"] { z-index: 3; }
.st-card[data-pos="1"] { z-index: 2; transform: translateY(-22px) scale(.94); opacity: .92; pointer-events: none; }
.st-card[data-pos="2"] { z-index: 1; transform: translateY(-42px) scale(.88); opacity: .7; pointer-events: none; }
.st-card[data-pos="3"] { z-index: 0; transform: translateY(-58px) scale(.82); opacity: 0; pointer-events: none; }
.st-card[data-pos="out"] { z-index: 4; transform: translateY(26px) scale(1.02); opacity: 0; pointer-events: none; }
.st-card[data-pos="0"]:hover { box-shadow: 0 36px 80px -36px rgba(12, 35, 64, .6), 0 2px 6px rgba(12, 35, 64, .08); }
.st-card-thumb { display: block; }
.st-card-cap { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 10px 16px; border-top: 1px solid var(--ui-line); }
.st-card-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-card-meta { font-size: 13px; color: var(--ui-ink3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-card-go { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: auto; flex: none; padding: 6px 12px; border-radius: 999px; background: var(--ui-navy); color: var(--ui-cream); font-size: 13px; font-weight: 600; opacity: 0; transform: translateX(-4px); transition: opacity .2s, transform .2s; }
.st-card:hover .st-card-go, .st-card:focus-visible .st-card-go { opacity: 1; transform: none; }
html[dir="rtl"] .st-card-go { transform: translateX(4px); }
html[dir="rtl"] .st-card:hover .st-card-go, html[dir="rtl"] .st-card:focus-visible .st-card-go { transform: none; }
.st-deck-cap { margin: 0; text-align: center; font-size: 13.5px; color: var(--ui-ink3); }

.st-sec { padding: 32px 0; border-top: 1px solid var(--ui-line); }
.st-sec[hidden] { display: none; }
.st-h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.st-sec-sub { margin: 6px 0 0; color: var(--ui-ink2); font-size: 15px; }
.st-recent-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; margin: 18px 0 0; padding: 0; }
.st-rc { position: relative; }
.st-rc-open { display: flex; flex-direction: column; width: 100%; padding: 0; border: 1px solid var(--ui-line); border-radius: 16px; overflow: hidden; background: var(--ui-card); color: var(--ui-ink); text-align: start; cursor: pointer; transition: transform .2s var(--ui-ease), box-shadow .2s; }
.st-rc-open:hover { transform: translateY(-2px); box-shadow: var(--ui-shadow); }
.st-rc-thumb { display: block; border-bottom: 1px solid var(--ui-line); }
.st-rc-meta { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px 12px; }
.st-rc-name { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-rc-time { font-size: 12.5px; color: var(--ui-ink3); }
.st-rc-x { position: absolute; top: 8px; inset-inline-end: 8px; border-color: transparent; background: rgba(255, 255, 255, .94); box-shadow: var(--ui-shadow); opacity: 0; transition: opacity .2s; }
.st-rc:hover .st-rc-x, .st-rc-x:focus-visible { opacity: 1; }
@media (hover: none) { .st-rc-x { opacity: 1; } }
.st-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.st-pill { background: rgba(255, 255, 255, .66); }
.st-foot { padding: 28px 0 0; border-top: 1px solid var(--ui-line); text-align: center; color: var(--ui-ink2); font-size: 15px; }
.st-foot p { margin: 0; }

@media (max-width: 1099px) {
  .st-hero { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .st-copy { max-width: 720px; }
  .st-show { width: 100%; max-width: 520px; margin-inline: auto; }
}
@media (max-width: 640px) {
  .st-top { padding: 10px 12px; }
  .st-top-link { display: none; }
  .st-main { padding: 0 16px 40px; }
  .st-hero { padding: 8px 0 32px; }
  .st-kicker { margin-bottom: 16px; font-size: 12.5px; }
  .st-h1 { font-size: clamp(36px, 10.5vw, 46px); }
  .st-sub { margin: 16px 0 22px; }
  .st-box { border-radius: 20px; }
  .st-in { min-height: 104px; padding: 16px 16px 8px; font-size: 17px; }
  .st-ph { inset: 16px 16px auto; font-size: 17px; }
  .st-vibes { padding: 2px 14px 12px; }
  .st-bar { flex-wrap: wrap; padding: 10px; }
  .st-bar-sp { display: none; }
  .st-langseg { flex: 1; display: flex; justify-content: center; }
  .st-go { flex: 1 1 100%; }
  .st-examples { flex-wrap: nowrap; overflow-x: auto; margin-inline: -16px; padding: 2px 16px; scrollbar-width: none; }
  .st-examples::-webkit-scrollbar { display: none; }
  .st-examples .chip, .st-examples-l { flex: none; }
  .st-recent-list { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 62%; overflow-x: auto; margin-inline: -16px; padding: 0 16px 6px; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .st-rc { scroll-snap-align: start; }
}

/* 8.4 Workspace layout */
/* overflow: clip (not hidden) on the frame's ancestors: they must not be scroll containers, or a
   scrollIntoView inside the sandboxed page would scroll the editor itself. */
.ws { position: relative; display: grid; grid-template-columns: var(--ui-panel-w) minmax(0, 1fr); grid-template-rows: var(--ui-top-h) minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; overflow: clip; background: var(--ui-bg); }
.tb { grid-column: 1 / -1; position: relative; z-index: 20; display: flex; align-items: center; gap: 12px; padding-inline: 12px; background: var(--ui-panel); border-bottom: 1px solid var(--ui-line); }
.tb-l { display: flex; align-items: center; gap: 6px; width: calc(var(--ui-panel-w) - 24px); min-width: 0; flex: none; }
.tb-c { flex: 1; display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 0; }
.tb-r { display: flex; align-items: center; gap: 8px; flex: none; }
.tb-home { display: flex; align-items: center; gap: 9px; flex: none; min-height: 40px; padding-inline: 10px 12px; border: 0; border-radius: 999px; background: transparent; color: var(--ui-ink); font-size: 15.5px; font-weight: 600; cursor: pointer; transition: background-color .2s; }
.tb-home:hover { background: rgba(12, 35, 64, .06); }
.tb-div { flex: none; width: 1px; height: 22px; margin-inline: 4px; background: var(--ui-line); }
.tb-name { flex: 0 1 auto; min-width: 72px; max-width: 210px; field-sizing: content; padding: 6px 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ui-ink); font-size: 15px; font-weight: 600; text-overflow: ellipsis; transition: border-color .15s, background-color .15s; }
.tb-name::placeholder { color: var(--ui-ink3); font-weight: 500; }
.tb-name:hover { border-color: var(--ui-line); }
.tb-name:focus { outline: none; border-color: var(--ui-ac-strong); background: var(--ui-card); box-shadow: 0 0 0 3px rgba(18, 124, 119, .18); }
.tb-status { display: inline-flex; align-items: center; gap: 5px; flex: none; font-size: 12.5px; color: var(--ui-ink3); white-space: nowrap; }
.tb-status .ico { color: var(--ui-ok); }
.tb-status.is-warn, .tb-status.is-warn .ico { color: var(--ui-danger); }
.tb-status.is-busy { color: var(--ui-ink2); }
.tb-ib { width: 36px; min-height: 36px; }
.tb-plang:not([hidden]) { display: flex; align-items: center; gap: 6px; margin-inline-start: 8px; }
.tb-plang-l { font-size: 12.5px; font-weight: 600; color: var(--ui-ink2); }
.tb-plang .seg-b span:lang(ar) { font-family: var(--ui-font-ar); }
.tb .seg { flex-wrap: nowrap; }
/* "Try it as a visitor" sits on the canvas by the page it changes. */
.pv-try { position: absolute; z-index: 6; top: 8px; right: 28px; gap: 6px; min-height: 34px; background: rgba(255, 255, 255, .92); box-shadow: var(--ui-shadow); }
.pv-try[hidden] { display: none; }
.pv-try .ico { color: var(--ui-ac-strong); }
/* Room for it above the device frame (physical right: the frame's browser bar is left-to-right). */
.pv:not([data-device="bare"]) .pv-vp { top: 34px; }
.pv[data-device="bare"] .pv-try { display: none; }
.tb-looks .ico { color: var(--ui-ac-strong); }
.tb-status-b { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border: 0; border-radius: 8px; background: rgba(179, 38, 30, .08); color: var(--ui-danger); font-size: 12.5px; font-weight: 600; cursor: pointer; }
/* The interface language: a globe and a language name, opening a small menu in the workspace. */
.ui-lang { gap: 6px; font-size: 14px; }
.ui-lang .ico { color: var(--ui-ink2); }
.ui-lang span:lang(ar) { font-family: var(--ui-font-ar); }
.lm-menu { position: fixed; z-index: 950; min-width: 220px; padding: 6px; border: 1px solid var(--ui-line); border-radius: 16px; background: var(--ui-card); box-shadow: var(--ui-shadow-lg); animation: ui-in .18s var(--ui-ease); }
.lm-h { margin: 6px 10px 4px; font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--ui-ink2); }
.lm-i { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ui-ink); font-size: 15px; text-align: start; cursor: pointer; }
.lm-i:lang(ar) { font-family: var(--ui-font-ar); }
.lm-i:hover, .lm-i:focus-visible { background: rgba(12, 35, 64, .06); }
.lm-i:focus-visible { outline-offset: -2px; }
.lm-i[aria-checked="true"] { font-weight: 600; }
.lm-i .ico { color: var(--ui-ac-strong); }
.lm-note { margin: 4px 10px 6px; padding-top: 8px; border-top: 1px solid var(--ui-line); font-size: 12.5px; color: var(--ui-ink3); }
.tb-send .lbl-short { display: none; }
.tb-more { display: none; }
.tb-menu { position: fixed; z-index: 900; top: calc(var(--ui-top-h) - 4px); inset-inline-end: 8px; min-width: 232px; padding: 6px; border: 1px solid var(--ui-line); border-radius: 16px; background: var(--ui-card); box-shadow: var(--ui-shadow-lg); animation: ui-in .18s var(--ui-ease); }
.tb-mi { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ui-ink); font-size: 15px; text-align: start; cursor: pointer; }
.tb-mi:hover, .tb-mi:focus-visible { background: rgba(12, 35, 64, .06); }
.tb-mi[aria-disabled="true"] { color: var(--ui-ink3); cursor: default; }
.tb-mi[aria-disabled="true"] .ico { color: var(--ui-ink3); opacity: .6; }
.tb-mi:focus-visible { outline-offset: -2px; }
.tb-mi .ico { color: var(--ui-ink2); }
@media (max-width: 1360px) {
  .tb-looks .lbl, .tb-share .lbl { display: none; }
  .tb-looks, .tb-share { width: 40px; padding: 0; }
}
@media (max-width: 1240px) {
  .tb-send .lbl-long { display: none; }
  .tb-send .lbl-short { display: inline; }
  .tb-plang-l { display: none; }
}
@media (max-width: 1100px) and (min-width: 900px) {
  .tb-l { width: auto; flex: 0 1 auto; }
  .tb-status { display: none; }
  .ui-lang > span[lang] { display: none; }
}

.side { grid-row: 2; display: flex; flex-direction: column; min-height: 0; background: var(--ui-panel); border-inline-end: 1px solid var(--ui-line); }
.tabs { display: flex; gap: 2px; padding: 8px 12px 0; border-bottom: 1px solid var(--ui-line); }
.tab { position: relative; flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 0 6px; border: 0; border-radius: 10px 10px 0 0; background: none; color: var(--ui-ink2); font-size: 14px; font-weight: 500; cursor: pointer; transition: color .15s, background-color .15s; }
.tab:hover { color: var(--ui-ink); background: rgba(12, 35, 64, .04); }
.tab[aria-selected="true"] { color: var(--ui-ink); }
.tab[aria-selected="true"]::after { content: ''; position: absolute; inset-inline: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--ui-navy); }
.tab:focus-visible { outline-offset: -3px; }
.tab-dot { display: none; position: absolute; top: 9px; inset-inline-end: 14%; width: 7px; height: 7px; border-radius: 50%; background: var(--ui-ac); box-shadow: 0 0 0 2px var(--ui-panel); }
.chat-unread .tab-dot { display: block; }
.sheet { flex: 1; display: flex; flex-direction: column; min-height: 0; }
/* The sheet's title bar is for phones; on computers each panel names itself with an h2 for screen
   readers (panels.js .pn-h2, chat.js .chat-h2), so the panels' h3s sit under an h2 either way. */
.sheet-head { display: none; }
.side-body { position: relative; flex: 1; min-height: 0; }
.panel { position: absolute; inset: 0; overflow: auto; overscroll-behavior: contain; }
.panel[hidden] { display: none; }
.panel:focus { outline: none; }
#tp-chat { overflow: hidden; }
.ws[data-busy] .panel:not(#tp-chat) { opacity: .5; transition: opacity .2s; }
.panel-sk { display: grid; gap: 14px; padding: 22px 20px; }
.panel-sk .sk-line { height: 12px; }
.panel-sk .w40 { width: 40%; } .panel-sk .w55 { width: 55%; } .panel-sk .w70 { width: 70%; }
.panel-sk .sk-block { height: 92px; border-radius: 14px; }
.panel-sk .sk-block.short { height: 58px; }
.panel-err { display: grid; justify-items: center; gap: 10px; margin: 40px 20px; padding: 24px 20px; border: 1px dashed var(--ui-line-2); border-radius: 16px; text-align: center; color: var(--ui-ink2); }
.panel-err p { margin: 0; }
.panel-err .ico { color: #B26A00; }
.stage { grid-row: 2; position: relative; min-width: 0; min-height: 0; overflow: hidden; overflow: clip; background: var(--ui-bg); }
.ws-pill { position: fixed; z-index: 40; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); translate: -50% 0; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px); padding-block: 6px; padding-inline: 16px 6px; border-radius: 999px; background: var(--ui-navy); color: var(--ui-cream); font-size: 14px; box-shadow: var(--ui-shadow-lg); animation: ui-in .25s var(--ui-ease); }
.ws-pill[hidden] { display: none; }
.ws-pill-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-pill-stop { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: rgba(241, 238, 230, .16); color: var(--ui-cream); font-weight: 600; font-size: 13.5px; cursor: pointer; }

/* 8.5 Preview: device frames scaled to fit. Scaling geometry uses physical top-left on purpose. */
.pv-vp { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.pv-frame { position: relative; display: flex; flex-direction: column; direction: ltr; flex: none; transition: padding .45s var(--ui-ease), border-radius .45s var(--ui-ease), background-color .45s; }
.pv-chrome { display: none; align-items: center; gap: 12px; height: 38px; padding: 0 14px; border-radius: 12px 12px 0 0; background: #FFFFFF; border-bottom: 1px solid var(--ui-line); }
.pv-dots { display: flex; gap: 6px; flex: none; }
.pv-dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(12, 35, 64, .13); }
.pv-url { flex: 0 1 380px; margin-inline: auto; padding: 4px 12px; border-radius: 8px; background: rgba(12, 35, 64, .05); color: var(--ui-ink3); font-size: 12px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transform: translateX(-28px); }
.pv-screen { position: relative; overflow: hidden; overflow: clip; background: #FFFFFF; transition: width .45s var(--ui-ease), height .45s var(--ui-ease), border-radius .45s var(--ui-ease); }
.pv-scaler { position: absolute; top: 0; left: 0; transform-origin: 0 0; transition: transform .45s var(--ui-ease); }
.pv-if { display: block; width: 100%; height: 100%; border: 0; background: #FFFFFF; }
.pv[data-device="desktop"] .pv-frame { border-radius: 12px; box-shadow: var(--ui-shadow-lg); }
.pv[data-device="desktop"] .pv-chrome { display: flex; }
.pv[data-device="desktop"] .pv-screen { border-radius: 0 0 12px 12px; }
.pv[data-device="phone"] .pv-frame { padding: 10px; border-radius: 54px; background: var(--ui-navy); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .1), var(--ui-shadow-lg); }
.pv[data-device="phone"] .pv-screen { border-radius: 44px; }
.pv[data-device="tablet"] .pv-frame { padding: 12px; border-radius: 34px; background: var(--ui-navy); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .1), var(--ui-shadow-lg); }
.pv[data-device="tablet"] .pv-screen { border-radius: 22px; }
.pv[data-device="bare"] .pv-screen, .pv[data-device="bare"] .pv-scaler { transition: none; }
.pv-busy .pv-if { pointer-events: none; }
/* Building state while a new site streams in: a calm sketch of a hero in the new site's own colours
   (once its look has arrived) with the build log's current line. Never an empty page shell. */
.pv-building { --pvb-bg: #FFFFFF; --pvb-ink: #0C2340; --pvb-ac: #1FB5AD; --pvb-img: rgba(12, 35, 64, .07);
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; padding: 0 0 6%; background: var(--pvb-bg); color: var(--pvb-ink);
  transition: background-color .6s var(--ui-ease); }
/* Opaque from the first frame (the empty page shell never shows); only the sketch itself fades in. */
.pv-building > * { animation: ui-fade .35s .15s both; }
.pv-building[hidden] { display: none; }
.pv-building i { display: block; }
.pvb-nav { display: flex; align-items: center; gap: 3%; height: 9%; min-height: 34px; padding: 0 6%; }
.pvb-sp { flex: 1; }
.pvb-k { --o: .1; border-radius: 6px; background: var(--pvb-ink); opacity: var(--o); }
.pvb-a { --o: .85; border-radius: 999px; background: var(--pvb-ac); opacity: var(--o); }
.pvb-brand { width: 16%; height: 22%; }
.pvb-link { width: 7%; height: 14%; }
.pvb-cta { width: 11%; height: 36%; }
.pvb-hero { flex: 1; display: grid; grid-template-columns: 1.15fr 1fr; gap: 6%; align-items: center; padding: 3% 6% 0; min-height: 0; }
.pvb-copy { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pvb-kick { width: 26%; height: 10px; }
.pvb-h1 { --o: .16; width: 92%; height: clamp(20px, 5.5vh, 46px); }
.pvb-short { width: 64%; }
.pvb-p { width: 84%; height: 11px; margin-top: 6px; }
.pvb-row { display: flex; gap: 4%; margin-top: 10px; }
.pvb-btn { width: 32%; height: 40px; }
.pvb-ghost { --o: .07; }
.pvb-img { align-self: stretch; margin-block: 4% 2%; border-radius: 18px; background: var(--pvb-img); }
.pvb-k, .pvb-a, .pvb-img { animation: pvb-breathe 2.4s ease-in-out infinite; }
.pvb-copy > :nth-child(2), .pvb-img { animation-delay: .3s; }
.pvb-copy > :nth-child(3) { animation-delay: .5s; }
.pvb-copy > :nth-child(4), .pvb-copy > :nth-child(5) { animation-delay: .7s; }
/* A slow breath, each block around its own strength, so the sketch feels alive without flashing. */
@keyframes pvb-breathe { 50% { opacity: calc(var(--o, 1) * .55); } }
.pv-build-t { margin: 0; padding: 0 6%; font-size: clamp(13px, 1.6vw, 16px); font-weight: 500; text-align: center; opacity: .72; }
.pv[data-device="bare"] .pvb-hero, .pv[data-device="phone"] .pvb-hero { grid-template-columns: 1fr; align-content: start; gap: 22px; padding-top: 10%; }
.pv[data-device="bare"] .pvb-img, .pv[data-device="phone"] .pvb-img { min-height: 160px; }
.pv[data-device="bare"] .pvb-link, .pv[data-device="phone"] .pvb-link { display: none; }
.pv[data-device="bare"] .pvb-brand, .pv[data-device="phone"] .pvb-brand { width: 36%; }
.pv[data-device="bare"] .pvb-cta, .pv[data-device="phone"] .pvb-cta { width: 24%; }
@keyframes ui-fade { from { opacity: 0; } }
/* Reveal: a veil covers the screen until the finished page is in place, then sweeps down once. */
.pv-curtain { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0; background: var(--ui-cream); border-top: 3px solid transparent; }
.pv-veiled .pv-curtain { opacity: 1; }
.pv-reveal .pv-curtain { opacity: 1; animation: pv-sweep .9s cubic-bezier(.65, 0, .35, 1) both; }
@keyframes pv-sweep { from { transform: translateY(0); border-top-color: var(--ui-ac); } to { transform: translateY(101%); border-top-color: var(--ui-ac); } }
.pv-layer { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.pv-layer > * { pointer-events: auto; }
.pv-hint { position: absolute; z-index: 9; left: 50%; bottom: 22px; max-width: calc(100% - 32px); padding: 8px 16px; border-radius: 999px; background: var(--ui-navy); color: var(--ui-cream); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; opacity: 0; transform: translate(-50%, 8px); transition: opacity .2s, transform .2s var(--ui-ease); }
.pv-hint.on { opacity: 1; transform: translate(-50%, 0); }
.pv-looks .pv-hint { bottom: auto; top: 18px; }
/* The look picker docks under the page: the frame shrinks to fit above it, so nothing on the page
   (a focused button included) is hidden behind it. */
.pv-looks .pv-vp { bottom: calc(var(--looks-h, 0px) + 18px); transition: bottom .35s var(--ui-ease); }
.pv-vp { transition: bottom .25s var(--ui-ease); }
/* Visitor preview: a slim bar over the page says so, with the way back. */
.pv-visit { position: absolute; z-index: 7; top: 4px; left: 50%; translate: -50% 0; display: flex; align-items: center; gap: 10px; max-width: calc(100% - 24px); padding-block: 5px; padding-inline: 14px 5px; border-radius: 999px; background: var(--ui-navy); color: var(--ui-cream); font-size: 13.5px; box-shadow: var(--ui-shadow-lg); animation: ui-in .25s var(--ui-ease); }
.pv-visit > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-visit .ico { flex: none; color: var(--ui-ac); }
.pv-visit-x { flex: none; border-color: rgba(241, 238, 230, .3); background: var(--ui-cream); color: var(--ui-navy); }
.pv-visit-x:hover { background: #FFFFFF; }
.pv-visit-x .ico { color: var(--ui-navy); }
.pv-visitor .pv-frame { box-shadow: 0 0 0 3px var(--ui-ac), var(--ui-shadow-lg); }
.pv-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; }
.pv-empty-card { max-width: 380px; padding: 28px; border: 1px solid var(--ui-line); border-radius: 22px; background: var(--ui-panel); box-shadow: var(--ui-shadow-lg); text-align: center; animation: ui-in .3s var(--ui-ease); }
.pv-empty-ico { display: inline-grid; place-items: center; width: 48px; height: 48px; margin-bottom: 12px; border-radius: 14px; background: var(--ui-ac-soft); color: var(--ui-ac-strong); }
.pv-empty-card h2 { margin: 0 0 6px; font-size: 19px; }
.pv-empty-card p { margin: 0 0 18px; color: var(--ui-ink2); }
.pv-empty-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.pv-fail { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px); padding: 8px 8px 8px 14px; border-radius: 999px; background: var(--ui-card); box-shadow: var(--ui-shadow-lg); font-size: 14px; }
.pv-fail .ico { color: #B26A00; }

/* 8.6 Look picker */
.looks { position: absolute; z-index: 8; bottom: 18px; inset-inline: 0; width: min(880px, calc(100% - 40px)); margin-inline: auto; padding: 16px 18px 14px; border: 1px solid var(--ui-line); border-radius: 22px; background: rgba(251, 250, 246, .95); -webkit-backdrop-filter: blur(16px) saturate(1.3); backdrop-filter: blur(16px) saturate(1.3); box-shadow: var(--ui-shadow-lg); animation: looks-in .45s var(--ui-ease) both; }
.looks-out { animation: looks-out .2s ease both; }
@keyframes looks-in { from { opacity: 0; transform: translateY(24px); } }
@keyframes looks-out { to { opacity: 0; transform: translateY(16px); } }
.looks-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; padding-inline-start: 4px; }
.looks-t { margin: 0; font-size: 16.5px; font-weight: 600; letter-spacing: -.01em; }
.looks-s { margin: 2px 0 0; font-size: 13.5px; color: var(--ui-ink2); }
.looks-x { margin-block-start: -4px; margin-inline-end: -4px; }
.looks-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.look { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 6px; border: 1.5px solid transparent; border-radius: 16px; background: transparent; color: var(--ui-ink); text-align: start; cursor: pointer; transition: border-color .2s, background-color .2s, transform .2s var(--ui-ease); }
.look:hover { background: rgba(12, 35, 64, .04); }
.look[aria-pressed="true"] { border-color: var(--ui-navy); background: var(--ui-card); }
.look-thumb { position: relative; display: block; border-radius: 11px; overflow: hidden; box-shadow: 0 0 0 1px var(--ui-line); }
.look-badge { position: absolute; top: 8px; inset-inline-start: 8px; display: inline-flex; align-items: center; gap: 4px; padding-block: 3px; padding-inline: 6px 9px; border-radius: 999px; background: var(--ui-navy); color: var(--ui-cream); font-size: 11.5px; font-weight: 600; opacity: 0; transform: scale(.85); transition: opacity .2s, transform .25s var(--ui-ease); }
.look[aria-pressed="true"] .look-badge { opacity: 1; transform: none; }
.look-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 0 4px 2px; }
.look-name { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 600; }
.look-mood { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; line-height: 1.35; color: var(--ui-ink2); }
.look-sw { display: inline-flex; flex: none; padding-inline-start: 4px; }
.look-sw i { width: 13px; height: 13px; margin-inline-start: -4px; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--ui-card), inset 0 0 0 1px rgba(12, 35, 64, .12); }
.looks-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.looks-note { flex: 1; margin: 0; font-size: 13px; line-height: 1.4; color: var(--ui-ink2); }
.looks-note[hidden] { display: none; }

/* 8.7 Chat */
.chat { display: flex; flex-direction: column; height: 100%; }
.chat-log { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; padding: 20px 18px 10px; overflow-y: auto; overscroll-behavior: contain; }
.chat-log:focus { outline: none; }
.msg { animation: ui-in .28s var(--ui-ease) both; }
.msg p { margin: 0; }
.msg p + p { margin-top: 8px; }
.msg-user { align-self: flex-end; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; max-width: 86%; }
.msg-bubble { padding: 10px 14px; border-radius: 18px; border-end-end-radius: 6px; background: var(--ui-navy); color: var(--ui-cream); font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }
.msg-focus { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ui-ink3); }
.msg-bot { display: flex; align-items: flex-start; gap: 10px; font-size: 14.5px; line-height: 1.55; }
.msg-av { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ui-ac-soft); color: var(--ui-ac-strong); }
.msg-body { min-width: 0; padding-top: 3px; overflow-wrap: anywhere; }
.msg .msg-note { display: flex; align-items: flex-start; gap: 6px; margin-top: 8px; font-size: 12.5px; line-height: 1.45; color: var(--ui-ink3); }
.msg-note .ico { margin-top: 1px; }
.msg-log { margin-inline-start: 38px; padding: 12px 14px; border: 1px solid var(--ui-line); border-radius: 14px; background: var(--ui-card); font-size: 13.5px; }
details.msg-log { padding: 8px 12px; background: transparent; }
details.msg-log summary { display: flex; align-items: center; gap: 8px; color: var(--ui-ink2); font-size: 13px; cursor: pointer; list-style: none; border-radius: 6px; }
details.msg-log summary::-webkit-details-marker { display: none; }
details.msg-log summary .ico { color: var(--ui-ac-strong); }
details.msg-log[open] summary { margin-bottom: 10px; }
.blog { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.blog-step { display: flex; align-items: center; gap: 10px; color: var(--ui-ink2); animation: ui-in .3s var(--ui-ease) both; }
.blog-step.no-anim { animation: none; }
.blog-step.is-active { color: var(--ui-ink); font-weight: 500; }
.blog-dot { flex: none; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; }
.is-done .blog-dot { background: var(--ui-ac-soft); color: var(--ui-ac-strong); }
.is-active .blog-dot { border: 2px solid var(--ui-ac); border-top-color: transparent; animation: ui-spin .8s linear infinite; }
.is-stopped .blog-dot { background: rgba(12, 35, 64, .08); color: var(--ui-ink3); }
/* What we read from the description: true from the first second, shown as quiet facts. */
.blog-step.is-fact { color: var(--ui-ink); }
.is-fact .blog-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ui-ac-strong); }
.blog-time { margin: 10px 0 0; padding-inline-start: 28px; font-size: 12.5px; color: var(--ui-ink3); font-variant-numeric: tabular-nums; }
.blog-time:empty { display: none; }
.msg-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.msg-act { color: var(--ui-ac-strong); border-color: rgba(15, 110, 105, .35); font-weight: 500; }
html[dir="rtl"] .msg-act .ico { transform: scaleX(-1); }
.chat-welcome { display: flex; gap: 10px; padding: 14px; border: 1px solid var(--ui-line); border-radius: 16px; background: var(--ui-card); color: var(--ui-ink2); font-size: 14px; line-height: 1.5; }
.chat-welcome p { margin: 0; }
.chat-welcome-t { margin-bottom: 4px !important; color: var(--ui-ink); font-weight: 600; }
.chat-foot { display: flex; flex-direction: column; gap: 10px; padding: 6px 14px 14px; }
.chat-sugg { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-sugg[hidden] { display: none; }
.chat-sugg .chip { min-height: 32px; max-width: 100%; padding: 4px 12px; font-size: 13px; line-height: 1.3; text-align: start; }
.chat-sugg .chip-look { border-color: rgba(18, 124, 119, .4); color: var(--ui-ac-strong); font-weight: 500; }
.chat-box { padding: 6px; border: 1px solid var(--ui-line-2); border-radius: 18px; background: var(--ui-card); box-shadow: var(--ui-shadow); transition: border-color .15s, box-shadow .15s; }
.chat-box:focus-within { border-color: var(--ui-ac-strong); box-shadow: 0 0 0 3px rgba(18, 124, 119, .16); }
.chat-focus { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 2px 6px 6px; font-size: 12.5px; color: var(--ui-ink3); }
.chat-focus[hidden] { display: none; }
.chat-focus-chip { display: inline-flex; align-items: center; gap: 5px; padding-block: 2px; padding-inline: 10px 3px; border-radius: 999px; background: var(--ui-ac-soft); color: var(--ui-ac-strong); font-weight: 600; }
.chat-focus-x { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.chat-focus-x:hover { background: rgba(18, 124, 119, .16); }
.chat-field { display: flex; align-items: flex-end; gap: 6px; }
.chat-in { flex: 1; min-width: 0; min-height: 40px; max-height: 168px; padding: 9px 10px; border: 0; background: transparent; resize: none; font-size: 15px; line-height: 1.45; outline: none; }
.chat-in::placeholder { color: var(--ui-ink3); }
.chat-send { flex: none; width: 40px; padding: 0; border-color: var(--ui-navy); background: var(--ui-navy); color: var(--ui-cream); }
.chat-send:hover { background: var(--ui-navy-2); }
.chat-send[disabled] { border-color: transparent; background: rgba(12, 35, 64, .1); color: var(--ui-ink3); opacity: 1; }
.chat-send.is-stop { width: auto; gap: 6px; padding: 0 14px 0 12px; border-color: var(--ui-line-2); background: var(--ui-card); color: var(--ui-ink); font-size: 14px; font-weight: 600; }
.chat-send.is-stop:hover { border-color: var(--ui-navy); }
html[dir="rtl"] .chat-send:not(.is-stop) .ico { transform: scaleX(-1); }
.chat-mode { display: flex; align-items: flex-start; gap: 6px; margin: 0; padding-inline: 4px; font-size: 12px; line-height: 1.45; color: var(--ui-ink3); }
.chat-mode[hidden] { display: none; }
.chat-mode .ico { margin-top: 1px; }

/* 8.8 Share and send dialogs */
.sh-lead, .snd-lead { margin: 0 0 16px; color: var(--ui-ink2); }
.sh-row { display: flex; gap: 8px; }
.sh-link { flex: 1; min-width: 0; font-size: 13.5px; color: var(--ui-ink2); }
.sh-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.sh-acts .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.sh-status { min-height: 20px; margin: 10px 0 0; font-size: 13.5px; color: var(--ui-ok); }
.sh-status.is-err { color: var(--ui-danger); }
.sh-notes { display: grid; gap: 10px; margin: 12px 0 0; padding: 14px 0 0; border-top: 1px solid var(--ui-line); list-style: none; font-size: 13.5px; line-height: 1.45; color: var(--ui-ink2); }
.sh-notes li { display: flex; align-items: flex-start; gap: 10px; }
.sh-notes .ico { margin-top: 1px; color: var(--ui-ink3); }
.sh-notes .sh-warn .ico { color: #B26A00; }
.snd-lead { max-width: 62ch; }
.snd-grid { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 28px; align-items: start; }
.snd-sum { position: sticky; top: 0; overflow: hidden; border: 1px solid var(--ui-line); border-radius: 16px; background: var(--ui-card); }
.snd-thumb { border-bottom: 1px solid var(--ui-line); }
.snd-sum-body { display: grid; gap: 6px; padding: 14px 16px 16px; font-size: 13.5px; line-height: 1.45; color: var(--ui-ink2); }
.snd-sum-body p { margin: 0; }
.snd-sum-name { color: var(--ui-ink); font-size: 16px; font-weight: 600; }
.snd-sum-look { display: flex; align-items: center; gap: 8px; }
.snd-form { display: grid; gap: 18px; }
.snd-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.snd-fields .fld:nth-child(n+3) { grid-column: 1 / -1; }
.snd-fields .fld-h[hidden] { display: none; }
.snd-hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; opacity: 0; }
.snd-pkg-wrap { display: grid; gap: 8px; }
.snd-pkg-wrap .fld-l { margin: 0; }
.snd-pkgs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.snd-pkg { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; padding: 12px 14px; border: 1.5px solid var(--ui-line-2); border-radius: 14px; background: var(--ui-card); color: var(--ui-ink); text-align: start; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.snd-pkg:hover { border-color: rgba(12, 35, 64, .5); }
.snd-pkg[aria-checked="true"] { border-color: var(--ui-navy); background: #F2FAF9; box-shadow: inset 0 0 0 1px var(--ui-navy); }
.snd-pkg-dot { flex: none; position: relative; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--ui-ink2); }
.snd-pkg[aria-checked="true"] .snd-pkg-dot { border-color: var(--ui-navy); }
.snd-pkg[aria-checked="true"] .snd-pkg-dot::after { content: ''; position: absolute; inset: 2.5px; border-radius: 50%; background: var(--ui-navy); }
.snd-pkg-top { display: flex; align-items: center; gap: 8px; width: 100%; }
.snd-pkg-name { font-weight: 600; }
.snd-pkg-tag { margin-inline-start: auto; padding: 2px 8px; border-radius: 999px; background: var(--ui-ac-soft); color: var(--ui-ac-strong); font-size: 11.5px; font-weight: 600; }
.snd-pkg-price { font-size: 13.5px; }
.snd-pkg-d { font-size: 12.5px; line-height: 1.35; color: var(--ui-ink2); }
.snd-fine { margin: 2px 0 0; font-size: 12.5px; color: var(--ui-ink3); }
.snd-status:empty { display: none; }
.snd-status.is-err { padding: 10px 14px; border-radius: 12px; background: rgba(179, 38, 30, .08); color: var(--ui-danger); font-size: 14px; }
.snd-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.snd-go.is-sending { opacity: .85; cursor: progress; }
.snd-free { margin: 0; font-size: 13px; color: var(--ui-ink3); }
.snd-done { padding: 28px 8px 12px; text-align: center; outline: none; animation: ui-in .3s var(--ui-ease); }
.snd-done-ico { display: grid; place-items: center; width: 60px; height: 60px; margin: 0 auto 16px; border-radius: 50%; background: var(--ui-ac); color: var(--ui-navy); }
.snd-done h3 { margin: 0 0 8px; font-size: 22px; letter-spacing: -.01em; }
.snd-done p { max-width: 46ch; margin: 0 auto 22px; color: var(--ui-ink2); }
.snd-done-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
@media (max-width: 760px) {
  .snd-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .snd-sum { position: static; display: grid; grid-template-columns: 112px minmax(0, 1fr); }
  .snd-thumb { border-bottom: 0; border-inline-end: 1px solid var(--ui-line); }
  .snd-sum-body { padding: 10px 12px; gap: 3px; font-size: 12.5px; }
  .snd-sum-name { font-size: 15px; }
  .snd-fields { grid-template-columns: minmax(0, 1fr); }
  .snd-go { flex: 1 1 100%; }
}

/* 8.9 Phones and small tablets: the preview fills the screen, panels become a bottom sheet. */
@media (max-width: 899px) {
  .ws { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
  .tb { gap: 4px; min-height: 56px; padding: env(safe-area-inset-top) 8px 0; }
  .tb-l { flex: 1; width: auto; gap: 2px; }
  .tb-home { padding-inline: 8px; }
  .tb-home-w, .tb-status, .tb-l .tb-div, .tb-c .tb-div, .tb-dev, .tb-plang, .tb-plang:not([hidden]), .tb-uilang, .tb-looks { display: none; }
  /* F13: undo and redo move into the ⋯ menu, so the site's name keeps its room. */
  .tb-c { display: none; }
  .tb-r { gap: 4px; }
  /* Share keeps its own button on phones (an icon); the rest lives behind ⋯. */
  .tb-share { width: 40px; padding: 0; border-color: transparent; background: transparent; }
  .tb-share .lbl { display: none; }
  .tb-name { flex: 1; max-width: none; min-width: 0; font-size: 15px; }
  .tb-send { min-height: 36px; padding: 0 12px; font-size: 13.5px; }
  .tb-send .ico { display: none; }
  .tb-more { display: inline-flex; }
  .side { grid-row: 3; position: relative; z-index: 30; border-inline-end: 0; border-top: 1px solid var(--ui-line); }
  .tabs { padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); border-bottom: 0; background: var(--ui-panel); }
  .tab { flex-direction: column; gap: 2px; min-height: 54px; border-radius: 12px; font-size: 11.5px; }
  .tab[aria-selected="true"]::after { display: none; }
  .ws[data-sheet="open"] .tab[aria-selected="true"] { background: var(--ui-ac-soft); }
  .tab-dot { top: 7px; inset-inline-end: 30%; }
  /* The sheet snaps to peek, half or full height, and the page stays in view above it. */
  .sheet { position: absolute; inset-inline: 0; bottom: 100%; height: 52dvh; border-radius: 22px 22px 0 0; background: var(--ui-panel); box-shadow: 0 -18px 50px -20px rgba(12, 35, 64, .45); transform: translateY(calc(100% + 90px)); visibility: hidden; transition: transform .38s var(--ui-ease), height .32s var(--ui-ease), visibility 0s .38s; }
  .ws[data-snap="peek"] .sheet { height: 34dvh; }
  .ws[data-snap="full"] .sheet { height: calc(100dvh - 124px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .ws[data-sheet="open"] .sheet { transform: none; visibility: visible; transition: transform .38s var(--ui-ease), height .32s var(--ui-ease); }
  .sheet.dragging { transition: none; }
  .sheet-head { position: relative; display: flex; align-items: center; gap: 4px; padding-block: 14px 4px; padding-inline: 20px 8px; touch-action: none; cursor: grab; }
  .sheet-grab { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); }
  .chat-h2 { display: none; }
  .sheet-grab span { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--ui-line-2); }
  .sheet-t { flex: 1; margin: 0; font-size: 17px; font-weight: 600; }
  .looks { position: fixed; z-index: 35; bottom: calc(70px + env(safe-area-inset-bottom)); inset-inline: 8px; width: auto; padding: 14px 12px 12px; border-radius: 20px; }
  .looks-s { display: none; }
  .looks-row { gap: 6px; }
  .look { padding: 4px; gap: 6px; }
  .look-mood { display: none; }
  .look-name { font-size: 13px; }
  .look-sw { display: none; }
  .looks-foot { margin-top: 10px; }
  .looks-foot .btn { flex: 1; }
  .pv-hint { bottom: 16px; }
}

/* 8.10 Start screen additions: continue card, labelled site language, showcase pause */
.st-cont { margin: 0 0 22px; }
.st-cont-b { display: flex; align-items: center; gap: 14px; width: 100%; max-width: 520px; padding: 8px; padding-inline-end: 18px; border: 1px solid var(--ui-line); border-radius: 18px; background: var(--ui-card); color: var(--ui-ink); text-align: start; cursor: pointer; box-shadow: var(--ui-shadow); transition: border-color .2s, transform .2s var(--ui-ease); }
.st-cont-b:hover { border-color: var(--ui-navy); transform: translateY(-1px); }
.st-cont-thumb { flex: none; width: 112px; border-radius: 11px; overflow: hidden; box-shadow: 0 0 0 1px var(--ui-line); }
.st-cont-t { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.st-cont-k { font-size: 12.5px; font-weight: 600; color: var(--ui-ac-strong); }
.st-cont-n { font-size: 16.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-cont-b > .ico { flex: none; color: var(--ui-ink2); }
.st-langseg { display: flex; align-items: center; gap: 10px; }
.st-langseg-l { font-size: 12.5px; font-weight: 600; color: var(--ui-ink2); white-space: nowrap; }
.st-langseg .seg-b span:lang(ar) { font-family: var(--ui-font-ar); }
.st-deck-foot { display: flex; align-items: center; justify-content: center; gap: 4px 12px; flex-wrap: wrap; margin-top: 12px; }
.st-pause { gap: 6px; color: var(--ui-ink2); font-size: 13px; }
.st-pause[hidden] { display: none; }
.st-more { margin-top: 16px; }
@media (max-width: 640px) {
  .st-cont-thumb { width: 88px; }
  .st-langseg { flex-direction: column; gap: 6px; }
}

/* 8.11 Dialogs: open a shared copy, device out of room */
.imp { display: grid; gap: 14px; }
.imp-thumb { overflow: hidden; border-radius: 14px; box-shadow: 0 0 0 1px var(--ui-line); }
.imp-lead { margin: 0; color: var(--ui-ink2); }
.imp-safe { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--ui-ac-soft); color: var(--ui-ink); font-size: 14px; }
.imp-safe .ico { flex: none; margin-top: 2px; color: var(--ui-ac-strong); }
.stf p { margin: 0 0 14px; color: var(--ui-ink2); }
.stf-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.stf-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 14px; border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-card); }
.stf-name { display: flex; flex-direction: column; min-width: 0; font-weight: 600; }
.stf-tag { font-size: 12.5px; font-weight: 400; color: var(--ui-ink3); }

/* 8.12 Touch screens: every control is at least 44 px to a finger. */
@media (pointer: coarse) {
  .btn, .btn-sm, .btn-lg { min-height: 44px; }
  .btn-icon, .btn-sm.btn-icon { width: 44px; }
  .tb-ib { width: 44px; min-height: 44px; }
  .tb-home { min-height: 44px; min-width: 44px; justify-content: center; }
  .tb-name { min-height: 44px; }
  .tb-share, .chat-send { width: 44px; }
  .chat-send.is-stop { width: auto; }
  .chip, .chip-sm, .chat-sugg .chip { min-height: 44px; }
  .seg-b, .seg-sm .seg-b { min-height: 44px; }
  .toast-act { min-height: 44px; padding: 0 16px; }
  .toast:has(button) { border-radius: 29px; }
  .chat-focus-x { width: 44px; height: 44px; margin-block: -10px; margin-inline-end: -8px; }
  .tab { min-height: 48px; }
  .ws-pill-stop { min-height: 44px; }
  .st-brand { min-height: 44px; }
  .tb-status-b { min-height: 44px; }
}
/* A reply in Arabic in the English interface (or the reverse) is set in that language's reading face. */
html:not([lang="ar"]) .msg-body [lang="ar"] { font-family: var(--ui-font-ar); font-size: 15px; line-height: 1.6; }
html[lang="ar"] .msg-body [lang="en"] { font-family: var(--ui-font); font-size: 14.5px; }

/* F13: on the narrowest phones the bar tightens its spacing so about 12 characters of the name show. */
@media (max-width: 380px) {
  .tb { gap: 2px; padding-inline: 6px; }
  .tb-r { gap: 2px; }
  .tb-send { padding: 0 10px; }
  .tb-home { padding-inline: 6px; }
}

/* F12: Arabic small text never drops below 13px (Arabic letters need the room Latin caps don't). */
html[lang="ar"] :is(.fld-h, .seg-sm .seg-b, .st-badge, .st-vibes-l, .st-rc-time, .st-kicker, .tb-status, .tb-plang-l, .tb-status-b, .lm-h, .lm-note, .pv-url,
  .look-badge, .look-mood, .msg-focus, .msg .msg-note, .blog-time, .chat-focus, .chat-mode, .snd-pkg-tag, .snd-pkg-d, .snd-fine, .snd-sum-body, .tab,
  .st-cont-k, .st-langseg-l, .stf-tag) { font-size: 13px; }

/* 8.13 Toasts stay clear of what the owner is using (section 7). */
/* Wide screens: over the preview, beside the panel, so the chat field is never covered. Over a dialog
   they centre on the screen again. */
@media (min-width: 900px) {
  body:has(.ws):not(:has(.m-root)) .toasts { inset-inline-start: var(--ui-panel-w); padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
  /* The look picker fills the bottom of the preview: toasts drop from under the bar, as its hint does. */
  body:has(.pv-looks):not(:has(.m-root)) .toasts { inset-block: calc(var(--ui-top-h) + 16px) auto; }
}
/* Phones: above the tab bar (57 to 63px tall) so its tabs stay tappable, and above the build pill. */
@media (max-width: 899px) {
  body:has(.ws) .toasts { inset-block-end: calc(72px + env(safe-area-inset-bottom)); }
  body:has(.ws-pill:not([hidden])) .toasts { inset-block-end: calc(148px + env(safe-area-inset-bottom)); }
  /* While the chat is open in the sheet (its field sits on the tab bar) or the look picker is up, the
     bottom is in use: toasts drop from under the top bar, over the page above the sheet. */
  body:has(.ws[data-sheet="open"] #tp-chat:not([hidden]), .pv-looks):not(:has(.m-root)) .toasts { inset-block: calc(66px + env(safe-area-inset-top)) auto; }
  /* A full-height sheet starts under the bar: below its head, over the older messages. */
  body:has(.ws[data-sheet="open"][data-snap="full"] #tp-chat:not([hidden])):not(:has(.m-root)) .toasts { inset-block-start: calc(136px + env(safe-area-inset-top)); }
}
