/* D521, the hard review of 12 November 2026: the chat area's fixes, loaded after heritage.css and simple.css. */

/* 1: the Simple layout's light theme is one palette: the page, the header, the rail and the tab bar take its tokens, never the Heritage parchment */
html[data-layout="simple"][data-theme], html[data-layout="simple"][data-theme] body { background: var(--bg); }
html[data-layout="simple"][data-theme="light"] header.top { background: color-mix(in srgb, var(--bg) 92%, transparent); }
html[data-layout="simple"][data-theme="light"] nav.rail { background: var(--bg-2); }
@media (max-width: 899px) {
  html[data-layout="simple"][data-theme="light"] nav.tabs { background: color-mix(in srgb, var(--bg-2) 97%, transparent); box-shadow: 0 -2px 10px rgba(0, 0, 0, .05); }
  html[data-layout="simple"][data-theme="dark"] nav.tabs, html[data-layout="simple"]:not([data-theme="light"]) nav.tabs { background: color-mix(in srgb, var(--bg-2) 96%, transparent); }
}

/* 38: hairlines that are seen in the dark */
html[data-layout="simple"]:not([data-theme="light"]) { --line: rgba(255, 255, 255, .11); }

/* 6, 7: the film's name in the header is the page's main noun, and a film with no poster shows its initial */
.filmpick b { color: var(--ink); }
.filmpick .fp-ph.init { display: grid; place-items: center; font: 700 14px/1 var(--font); color: var(--muted); background: color-mix(in srgb, var(--primary, var(--accent)) 12%, var(--panel-2)); }

/* 24: the header shares the content's left edge on a desk; the view's name stays for a screen reader only */
@media (min-width: 900px) {
  html[data-layout="simple"] header.top { padding-left: max(32px, calc((100% - 1120px) / 2)); padding-right: max(32px, calc((100% - 1120px) / 2)); }
  html[data-layout="simple"] header.top h1#viewName { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }
  html[data-layout="simple"] .sx-chathome { max-width: 860px; margin: 0; }
}

/* 25: Ask is a conversation, so its icon is a speech bubble, and it is a full tap target on a phone */
html[data-layout="simple"] header.top .askbtn > svg { display: none; }
html[data-layout="simple"] header.top .askbtn::before { content: ""; flex: none; width: 20px; height: 20px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M4 5h16v11H9l-5 4z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M4 5h16v11H9l-5 4z'/%3E%3C/svg%3E") center / contain no-repeat; }
@media (max-width: 899px) {
  html[data-layout="simple"] header.top .askbtn { min-width: 44px; min-height: 44px; justify-content: center; padding: 0; }
}

/* 26: no machine words or key hints in the Simple rail; they live in Help */
html[data-layout="simple"] nav.rail .foot { display: none; }

/* 8, 35: the status is said once on the Film page (its hero), and elsewhere it reads as words, not a toggle */
html[data-layout="simple"] body[data-view="film"] header.top #livePill { display: none; }
html[data-layout="simple"] header.top #livePill { background: transparent; border: 0; padding-left: 0; flex: none; }
html[data-layout="simple"] #liveWords::first-letter { text-transform: uppercase; }

/* 34: the phone's tab bar: readable labels, the current place shown by colour and a small pill behind its icon, the badge on the icon's corner */
@media (max-width: 899px) and (min-width: 360px) {
  html[data-layout="simple"] nav.tabs .navbtn { font-size: 11px; font-weight: 600; }
}
@media (max-width: 899px) {
  html[data-layout="simple"] nav.tabs .navbtn[aria-current="page"] { background: none; color: var(--primary); }
  html[data-layout="simple"] nav.tabs .navbtn[aria-current="page"] svg { box-sizing: border-box; width: 52px; height: 30px; padding: 3px 14px; border-radius: 999px; background: color-mix(in srgb, var(--primary) 14%, transparent); stroke: var(--primary); }
  html[data-layout="simple"] nav.tabs .navbtn .badge.sxbadge { top: 2px; right: auto; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; line-height: 18px; }
}

/* 12, 36: an action is a rounded rectangle 44 px tall, never a pill; chips, the scope and the need pills share 36 px */
.desk-acts button { border-radius: 12px; min-height: 44px; }
.desk-scope, .desk-need, .desk-chips .chipbtn { min-height: 36px; }
.desk-at, .desk-scopemenu { border-radius: 12px; }

/* 17: a chip that fills the box looks like its siblings; its "..." says it waits for words */
.desk-chips .fillchip { border-style: solid; }

/* 16: the conversation fades under the foot, and the chips fade at their scrolling end */
.desk-log { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 20px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 20px), transparent); padding-bottom: 20px; }
.desk-chips { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
html[data-theme="light"] .desk.desk-inline .desk-foot { border-top: 1px solid var(--line); }

/* 39: a short thread sits near the composer, as a conversation does */
.desk-log { display: flex; flex-direction: column; }
.desk-log > * { flex: none; }
.desk-items { margin-top: auto; }

/* 13, 14, 15: the scope and the need share one row that scrolls sideways, at one height and one weight */
.desk-strip > .desk-sline { display: flex; flex: 0 0 100%; flex-wrap: nowrap; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 4px 0; }
.desk-strip > .desk-sline::-webkit-scrollbar { display: none; }
.desk-scope, .desk-need { position: relative; flex: none; padding: 0 14px; font-size: 13.5px; border-radius: 999px; }
.desk-scope::after, .desk-need::after { content: ""; position: absolute; inset: -4px 0; }
.desk-scope .desk-chev { width: 12px; height: 12px; flex: none; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
html[data-theme="light"] .desk-need { background: color-mix(in srgb, var(--warn, #a65b00) 22%, var(--panel)); }
.desk-shead small { color: var(--muted); }
.desk-wt { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
/* 37: a play badge large enough to read and hit */
.desk-wplay { width: 28px; height: 28px; }
.desk-wplay::after { left: 11px; top: 8px; border-left-width: 9px; border-top-width: 6px; border-bottom-width: 6px; }
@media (max-width: 599px) {
  .desk-shead small { display: none; }
  .desk-w, .desk-f { flex-basis: 104px; width: 104px; max-width: 104px; }
  .desk-wpic { width: 104px; }
}

/* 5: the "Talking about" menu is a popover under what opened it, never the @ names list in the foot */
.desk-scopemenu { position: absolute; z-index: 6; min-width: 280px; max-width: calc(100% - 8px); max-height: min(360px, 60vh); overflow-y: auto;
  padding: 4px; border: 1px solid var(--line-strong); background: var(--panel); box-shadow: var(--shadow-2); }
.desk-scopemenu[hidden] { display: none; }
.desk-scopemenu button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; min-height: 48px; padding: 8px 12px; border: 0; border-radius: 9px;
  background: transparent; color: var(--ink); text-align: left; white-space: normal; height: auto; }
.desk-scopemenu button b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.desk-scopemenu button small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.desk-scopemenu button[aria-selected="true"], .desk-scopemenu button:hover, .desk-scopemenu button:focus-visible { background: color-mix(in srgb, var(--primary, var(--accent)) 14%, transparent); }
.desk-at li b { flex: none; white-space: nowrap; }
.desk-at li small { flex: 1 1 auto; min-width: 0; }

/* 19: the words lead; the time sits under them */
.desk-item:not(.mine) .desk-body { display: flex; flex-direction: column; }
.desk-item:not(.mine) .desk-who { order: 99; margin: 6px 0 0; color: var(--faint); }
.desk-item:not(.mine) .desk-body > .desk-who + * { margin-top: 0; }

/* 20, 21: figures read label above value at every width inside the chat, and words after them are set apart */
.desk-rows .row, .desk-body .desk-rows .row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
.desk-rows + .desk-text { border-top: 1px solid var(--line); padding-top: 8px; }

/* 18: on a phone the studio's lamp leaves its column and sits beside the time, so the words get the width */
@media (max-width: 599px) {
  .desk-item:not(.mine) { grid-template-columns: minmax(0, 1fr); }
  .desk-item:not(.mine)::before { display: none; }
  .desk-item:not(.mine) .desk-body { grid-column: 1; }
  .desk-item:not(.mine) .desk-who::before { content: ""; flex: none; width: 14px; height: 14px; align-self: center;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23d4a24c' d='M12 3c2.6 3 3.6 5.3 3.6 7.2A3.6 3.6 0 0 1 12 13.8a3.6 3.6 0 0 1-3.6-3.6C8.4 8.3 9.4 6 12 3z'/%3E%3Cpath fill='%23d4a24c' d='M5 17h14l-1.6 3H6.6z'/%3E%3C/svg%3E") center / contain no-repeat; }
}

/* 22, 23: the sheet's header clears the notch, and its controls are one height with one treatment; the lamp matches the thread's */
@media (max-width: 899px) {
  .desk.on .desk-card { padding-top: env(safe-area-inset-top); }
  .desk.on .desk-card > .sh-head { padding-top: 8px; }
}
.desk-ctx { min-height: 36px; }
.desk-card .sh-x { position: relative; width: 36px; height: 36px; min-height: 36px; background: transparent; border-color: var(--line); box-shadow: none; }
.desk-card .sh-x::after { content: ""; position: absolute; inset: -4px; }
.desk-ava { width: 30px; height: 30px; background: var(--panel-2); border: 1px solid var(--line); color: #d4a24c; box-shadow: none; }
.desk-ava svg { width: 16px; height: 16px; }

/* 33: the composer: a send button that waits for words, a soft shadow in light, 44 px controls */
.desk-box { padding: 4px; }
.desk-box .desk-clip-btn, .desk-box .desk-send { width: 44px; height: 44px; min-height: 44px; }
.desk-box.empty .desk-send { background: var(--raised); color: var(--muted); box-shadow: none; }
html[data-theme="light"] .desk-box { box-shadow: 0 2px 10px rgba(0, 0, 0, .06); }

/* ---------------------------------------------------------------- P7, the chat's screen faults (15/11/2026) */

/* row 6: every button, chip and icon button in the chat is at least 44 x 44 */
.desk-chips .chipbtn, .desk-scope, .desk-need, .desk-ctx, .desk-unpin, .desk-acts button, .desk-acts .btn, .desk-link, .desk-retry { min-height: 44px; }
.desk-unpin, .desk-card .sh-x { width: 44px; height: 44px; min-height: 44px; }
.desk-chips .chipbtn { min-width: 44px; }

/* row 7: the chips that are there are shown whole; they step aside while he types */
.desk-chips[hidden] { display: none !important; }
.desk-chips .chipbtn { max-width: none; white-space: nowrap; }

/* row 5: a button never wraps; past 28 characters it is cut at a word and the whole label is its title */
.desk-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.desk-acts button, .desk-acts .btn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; flex: 0 1 auto; min-width: 0; }

/* row 4: a send that failed keeps his bubble, marked Not sent, with Retry */
.desk-item.desk-failed { opacity: .82; outline: 2px solid var(--bad, #e5484d); outline-offset: 2px; }
.desk-notsent { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 10px; margin: 8px 0 4px auto; max-width: min(560px, 100%); font-size: 13.5px; line-height: 1.4; }
.desk-notsent b { font-weight: 700; color: var(--bad, #e5484d); }
.desk-notsent span { color: var(--ink); flex: 1 1 200px; text-align: right; }
.desk-retry { height: 44px; padding: 0 16px; border-radius: 12px; font-weight: 650; border: 1px solid var(--line-strong); background: var(--raised); color: var(--ink); }

/* row 9: on a desk the inline thread and its composer sit in one centred column of at most 760 px */
@media (min-width: 900px) {
  .desk.desk-inline .desk-card { max-width: 760px; margin: 0 auto; }
  .desk.desk-inline .desk-log, .desk.desk-inline .desk-foot { padding-left: 16px; padding-right: 16px; box-sizing: border-box; }
}
