/* The shell of the one chat (round 3, P0: docs/CHAT_ROUND3_SPEC.md 5.1, 5.2 and section 3).
   The frame's sizes and the six kinds' base look; each part's own look is in its own sheet,
   loaded after this one. No new colour and no new font: the Simple layout's tokens. */

/* the header's bell and menu (5.1): 44 by 44 each */
#desk h3 .desk-hbell, #desk h3 .desk-ctx { flex: none; width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0;
  display: inline-grid; place-items: center; border-radius: 50%; position: relative; }
#desk h3 .desk-hbell svg, #desk h3 .desk-ctx svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
#desk h3 .desk-ctx svg circle { fill: currentColor; stroke: none; }
#desk h3 .desk-hcount { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  font: 600 12px/18px var(--font); background: var(--primary, #3167ed); color: #fff; font-variant-numeric: tabular-nums; }

/* the board (5.1): hidden when empty; it scrolls sideways only */
.desk-board { flex: none; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; }
.desk-board[hidden], .desk-board:empty { display: none; }

/* the context row (5.5, 5.6): 36 px when it shows something, else nothing */
.desk-context { display: flex; align-items: center; gap: 8px; min-width: 0; }
.desk-context:not(:has(> :not([hidden]))) { display: none; }
.desk-context .desk-pin { flex: 1 1 auto; min-width: 0; margin: 0 0 8px; min-height: 36px; }
.desk-workpill[hidden] { display: none; }
.desk-offline { margin: 0 0 8px; min-height: 32px; display: flex; align-items: center; padding: 0 12px; border-radius: var(--r-xs, 10px);
  font-size: 13px; color: var(--warn, #d9822b); background: color-mix(in srgb, var(--warn, #d9822b) 12%, transparent); }
.desk-offline[hidden] { display: none; }

/* the box (5.4): 16 px, a line height of 1.45, five lines at most */
#desk .desk-box textarea { font-size: 16px; line-height: 1.45; max-height: 136px; }
/* a placeholder is one line, cut with an ellipsis, never a second line half seen under the first
   (review of P0: "Reply about The Gate at Night" at 320) */
#desk .desk-box textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.desk-right { flex: none; display: flex; align-items: flex-end; gap: 6px; }
#desk .desk-box .desk-quick, #desk .desk-box .desk-mic { flex: none; width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0;
  display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
#desk .desk-box .desk-quick svg, #desk .desk-box .desk-mic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
#desk .desk-box .desk-quick[hidden], #desk .desk-box .desk-mic[hidden] { display: none; }
#desk .desk-box .desk-send, #desk .desk-box .desk-clip-btn { min-width: 44px; min-height: 44px; height: 44px; }
#desk .desk-box .desk-send { width: auto; min-width: 44px; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Z10 (5.4): the words have at least 180 px at 320 and 250 px at 390 beside the + and a plain
   44 px Send (a 3 px inner edge and 5 px between, where 4 and 6 left 178 and 248) */
#desk .desk-box { padding: 3px; gap: 5px; }

/* the six kinds (5.2) */
#deskItems > li.k-his { justify-content: flex-end; }
/* the li is his bubble already (heritage.css .desk-item.mine: his colour, the padding, at most 80%);
   the inner .desk-bubble is markup only, never a second bubble inside the first (review of P0:
   a bubble at 80% of a bubble broke "question" inside the word at 390) */
#deskItems > li.k-his .desk-bubble { max-width: none; margin: 0; padding: 0; border-radius: 0; background: none; min-width: 0; overflow-wrap: break-word; }
#deskItems > li.k-his .desk-bubble .desk-text { font-size: 16px; line-height: 1.45; margin: 0; }
/* Z7 (5.2): his time inside his bubble's foot, on the right, small and muted; this outranks
   heritage.css's `.desk-item.mine .desk-who { display: none }` (heritage.css is not edited) */
#deskItems > li.k-his .desk-who.desk-time { display: flex; justify-content: flex-end; gap: 6px; margin: 4px 0 0; text-align: right;
  font-size: 12px; line-height: 1.3; font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, .78); }
#deskItems > li.k-his .desk-who.desk-time:not(:has(time)) { display: none; }
#deskItems > li.k-his .desk-who.desk-time time, #deskItems > li.k-his .desk-who.desk-time .desk-via { color: inherit; }
#deskItems > li.k-words .desk-text, #deskItems > li .desk-body > .desk-text { font-size: 16px; line-height: 1.45; }
.desk-morebtn { min-height: 44px; padding: 0 14px; margin-top: 4px; background: transparent; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 14px; }
#deskItems > li.k-thing .desk-pic, #deskItems > li.k-thing .desk-asset { max-width: 300px; }
#deskItems > li.k-thing .desk-pic img { max-height: 300px; object-fit: contain; }
#deskItems > li.k-news > .desk-news > summary { min-height: 48px; display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  font-size: 15px; padding: 0 4px; }
#deskItems > li.k-news > .desk-news > summary::-webkit-details-marker { display: none; }
#deskItems > li.k-news > .desk-news > summary::after { content: ''; flex: none; width: 8px; height: 8px; margin-left: auto; border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor; transform: rotate(45deg); opacity: .6; }
#deskItems > li.k-news > .desk-news[open] > summary::after { transform: rotate(-135deg); }
.desk-newsline { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desk-newsdot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--primary, #3167ed); }
.desk-newsdot[hidden] { display: none; }
.desk-newsitems { display: flex; gap: 10px; overflow-x: auto; padding: 8px 0; }
.desk-newsitem { flex: none; width: 120px; min-width: 0; }
.desk-newsitem .desk-body { min-width: 0; }
@media (min-width: 900px) { .desk-newsitems { flex-wrap: wrap; overflow-x: visible; } .desk-newsitem { width: 160px; } }

/* the Reading row, the slow row, Cancel's words (5.12) */
.desk-slow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.desk-slow[hidden] { display: none; }
.desk-slow > span { flex: 1 1 100%; }
.desk-slow button { min-height: 44px; padding: 0 16px; white-space: nowrap; }
.desk-stopnote { margin: 6px 0 0; font-size: 13px; color: var(--muted); }

/* the first open of a chat (5.12): three large starts, the full column on a phone, three across on a desk */
.desk-first p { font-size: 16px; line-height: 1.45; }
.desk-starts.desk-starts3 { grid-template-columns: 1fr; }
.desk-starts.desk-starts3 .desk-start { min-height: 64px; justify-content: center; }
@media (min-width: 900px) { .desk-starts.desk-starts3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* the chat's menu (5.1): one sheet, one 48 px row each, the danger rows apart and last */
.desk-menu { display: flex; flex-direction: column; gap: 4px; }
/* a block, not the app's centred inline-flex button: every row reads from the left, one line,
   cut with an ellipsis (review of P0: a short row sat centred under a long one) */
.desk-menurow { display: block; width: 100%; line-height: 24px;
  min-height: 48px; padding: 12px 14px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: transparent; border: 0; border-radius: 12px; font-size: 16px; }
.desk-menurow.danger { margin-top: 10px; color: var(--bad, #d64545); border: 1px solid var(--bad, #d64545); background: transparent; }

/* the desk (5.1): one centred column of at most 720 px */
@media (min-width: 900px) {
  #desk.desk-inline .desk-board, #desk.desk-inline .desk-log > *, #desk.desk-inline .desk-foot > * { max-width: 720px; margin-inline: auto; }
}

/* section 3, the keyboard rule: the board, the status line and the chips step aside */
#desk.desk-inline.kbd { min-height: 0; }
#desk.kbd .desk-board { display: none; }
#desk.kbd .desk-status { display: none; }
#desk.kbd .desk-chips { display: none; }
#desk.kbd .desk-box textarea { max-height: 94px; }
#desk.kbd.kbd-short .desk-context { display: none; }
#desk.kbd .desk-foot { padding-bottom: 0; }

/* toasts on a phone sit at the top while the inline chat is on screen */
@media (max-width: 899px) {
  html.ch-in-chat .itt-toasts, body:has(#desk.desk-inline) .itt-toasts { top: calc(12px + env(safe-area-inset-top)); bottom: auto; }
}

/* motion with a job: a new message rises 8 px over 160 ms */
@keyframes desk-rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
#deskItems > li.desk-item { animation: desk-rise 160ms ease-out; }
@media (prefers-reduced-motion: reduce) {
  #deskItems > li.desk-item, #desk * { animation: none !important; transition: none !important; }
}
/* W6 (round 4, R97): how an answer a lesson rewrote was read, one small muted line under it */
#deskItems .desk-readas { margin: 4px 0 0; font-size: 13px; line-height: 1.4; color: var(--muted, #8a8f98); }

/* the walk (WK): his words are white on his colour, and need 4.5:1 at 16 px; the Simple layout's
   accent gives 3.8:1, so his bubble takes it darkened (the same hue), his time is near white, and
   a bubble still being sent keeps its contrast (the Reading row under it says it is on its way) */
#desk .desk-item.mine { background: color-mix(in srgb, var(--accent, #3167ed) 78%, #000); }
#desk .desk-pending.mine { opacity: 1; }
#deskItems > li.k-his .desk-who.desk-time { color: rgba(255, 255, 255, .9); }

/* the walk (WK): a news row's line is its verdict ("..., 2 need you"), so it wraps rather than
   lose its end on a phone; and it has one disclosure mark (its own, on the right), never a
   second from heritage.css's details > summary::before */
#deskItems > li.k-news > .desk-news > summary::before { display: none; content: none; }
#deskItems > li.k-news .desk-newsline { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: break-word; line-height: 1.35; }
/* the walk (WK): a bubble that was not sent keeps its words readable and its red edge inside the
   column (an outline set out from the bubble ran past the screen's right edge at 390) */
#desk .desk-item.desk-failed { opacity: 1; outline-offset: -2px; }
#deskStrip .desk-scope[hidden] { display: none; }

/* a verdict badge's words read 4.5:1 on their own tint in both themes (axe on the walk: the light
   theme's green on a 10% green tint read 4.4:1); mixed toward the ink, so dark lightens, light darkens */
#desk .desk-asset .desk-badge.ok { color: color-mix(in srgb, var(--ok) 78%, var(--ink)); }
#desk .desk-asset .desk-badge.warn { color: color-mix(in srgb, var(--warn) 78%, var(--ink)); }

/* the verifier (WK): every primary button a reply draws in the thread ("Describe block 2", a
   reply's first action) is white words at 14 px on the primary and needs 4.5:1; the Simple
   layout's primary gives 3.83:1 (axe on the walk's sheets at 390 dark), so it takes the primary
   darkened, as the card's main button and the send do */
#deskItems button.primary:not(.dc-danger):not(.danger) { background: color-mix(in srgb, var(--primary) 85%, #000); }

/* L7: long words fold. A value of more than a few lines (a block's words, a description) shows
   two lines and "Show all"; the tap opens it in place. On a desk a row reads label beside value */
#deskItems .desk-rows .row > .desk-fold { display: flex; flex-direction: column; align-items: flex-start; gap: 0; min-width: 0; text-align: left; }
#deskItems .desk-fold .desk-foldt { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
#deskItems .desk-fold.open .desk-foldt { display: block; -webkit-line-clamp: unset; line-clamp: none; overflow: visible; }
#deskItems .desk-foldbtn { min-height: 44px; min-width: 44px; margin: 0; padding: 0 2px; border: 0; border-radius: 8px; background: none; box-shadow: none;
  color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
@media (min-width: 900px) {
  #deskItems .desk-rows .row, #deskItems .desk-body .desk-rows .row { display: grid; grid-template-columns: minmax(160px, 32%) minmax(0, 1fr); gap: 16px; align-items: baseline; }
  #deskItems .desk-rows .row:has(.k:empty) { grid-template-columns: minmax(0, 1fr); }
  #deskItems .desk-foldbtn { min-height: 32px; }
}

/* L11: an asset with no picture has no hole: it is its line (number, name, verdict) with its menu
   at the right of that line, never an empty picture area with the menu floating in it */
#deskItems > li.k-thing .desk-asset:not(:has(figure, .desk-views, .desk-sound)) { max-width: none; }
#deskItems .desk-asset:not(:has(figure, .desk-views, .desk-sound)) > .desk-acap { flex-wrap: nowrap; align-items: center; }
#deskItems .desk-asset:not(:has(figure, .desk-views, .desk-sound)) > .desk-acap > .desk-alabel { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
#deskItems .desk-asset:not(:has(figure, .desk-views, .desk-sound)) > .desk-acap > .assetno,
#deskItems .desk-asset:not(:has(figure, .desk-views, .desk-sound)) > .desk-acap > .desk-badge { flex: none; }
#deskItems .desk-asset:not(:has(figure, .desk-views, .desk-sound)) > .desk-acap > .tc-dots { margin-left: auto; }

/* L12: on a desk the reel's strip spans the conversation's column, its frames from the left and
   + Block at its right end; a frame under the pointer or the focus keeps the band's dark behind
   its words, so the selected empty tile's label reads in both themes */
#deskBoard.desk-board-reel { width: 100%; box-sizing: border-box; align-self: stretch; }
#deskBoard.desk-board-reel > #chReel { justify-content: flex-start; }
#deskBoard .ch-frame[data-n], #deskBoard .ch-frame[data-n]:is(:hover, :focus, :focus-visible, :active) { background: transparent; }
#deskBoard .ch-frame[data-n] .ch-cap { color: #d9d3c9; }
