/* v8 Messages: the inbox, a conversation, a notice, Write to us (17 October 2026).
   Views: ../../prototype/app/v8-messages.js. Foundations: base.css (tokens, hero, cards, rows, forms).
   Every in-app rule starts #v8 #app (2 ids); !important only on font-size and font-weight, and where an older class is restyled
   (the phone dock). No font-size inside a media query. */

/* ---------- Shared ---------- */
#v8 #app .v8-msg-ck { display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: var(--v8-r-tag); background: var(--v8-green); color: var(--v8-white); }
#v8 #app .v8-msg-ck svg.i { width: 16px; height: 16px; }
#v8 #app .v8-msg-err[hidden] { display: none; }
#v8 #app .v8-msg-err { margin-top: var(--v8-2); }
#v8 #app .v8-msg-reply [aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--v8-red); }

/* Main 8 + aside 4 on the white page (a conversation, Write to us); one column below 1280 */
#v8 #app .v8-msg-cols { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--v8-gutter); row-gap: var(--v8-sec); align-items: start; }
#v8 #app .v8-msg-main { grid-column: 1 / span 8; min-width: 0; }
#v8 #app .v8-msg-aside { grid-column: 9 / span 4; display: grid; gap: var(--v8-cards); min-width: 0; position: sticky; top: var(--v8-5); }
@media (max-width: 1279px) {
  #v8 #app .v8-msg-cols { grid-template-columns: minmax(0, 1fr); }
  #v8 #app .v8-msg-main, #v8 #app .v8-msg-aside { grid-column: 1; }
  #v8 #app .v8-msg-aside { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
}
/* push: also answers to the page area's width (branch ai-drawer README, the push layout) */
@container app (max-width: 1279px) {
  #v8 #app .v8-msg-cols { grid-template-columns: minmax(0, 1fr); }
  #v8 #app .v8-msg-main, #v8 #app .v8-msg-aside { grid-column: 1; }
  #v8 #app .v8-msg-aside { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }}
@media (max-width: 767px) { #v8 #app .v8-msg-aside { grid-template-columns: minmax(0, 1fr); } }
#v8 #app .v8-msg-one { display: grid; }
#v8 #app .v8-msg-one > li { display: grid; }
#v8 #app .v8-msg-aside .v8-claim, #v8 #app .v8-msg-aside .v8-pc { min-height: 248px; }

/* ---------- The inbox ---------- */
#v8 #app .v8-msg-list { margin-top: var(--v8-8) !important; }
/* The toolbar is the shared list toolbar (base.css 32, 20 October 2026); the groups start 24 under it */
#v8 #app .v8-msg-lt > .v8-lt-res { margin-top: var(--v8-5); }
#v8 #app .v8-msg-grp + .v8-msg-grp { margin-top: var(--v8-7); }
#v8 #app .v8-msg-grp > .v8-h3 { margin-bottom: var(--v8-3); }
/* The list keeps its rows inside one reading span, so the date stays beside the subject and the preview inside the measure */
#v8 #app .v8-msg-list > :is(.v8-msg-lt, .v8-msg-grp, .v8-msg-inbox, .v8-msg-none, .v8-msg-note) { max-width: 880px; }
/* README 117: the rows sit in the boxed list (.v8-boxlist) as link rows (.v8-boxlink, base.css): 16 inside, the wash edge to edge */
#v8 #app .v8-msg-inbox > li { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: var(--v8-4); padding: var(--v8-4); }
#v8 #app .v8-msg-inbox .v8-in-tx { gap: 4px; }
/* Row: the subject (16, the link) and the date on one line; under it "Sender: preview", one line cut with an ellipsis */
#v8 #app .v8-msg-inbox .v8-in-top { align-items: flex-start; }
#v8 #app .v8-msg-sl { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
#v8 #app .v8-msg-inbox .v8-in-subj { font-size: var(--v8-fs-16) !important; line-height: var(--v8-lh-16) !important; min-width: 0; }
#v8 #app .v8-msg-inbox .v8-in-dot { flex: none; width: 8px; height: 8px; margin-top: 8px; }
#v8 #app .v8-msg-inbox .v8-in-pre { color: var(--v8-ink-2); }
/* The preview shows two lines before it is cut, enough to decide whether to open it (base.css cuts .v8-in-pre to one) */
@media (min-width: 640px) {
  #v8 #app .v8-msg-inbox .v8-in-pre { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; white-space: normal; text-overflow: clip; }
}
#v8 #app .v8-msg-from { color: var(--v8-ink); }
/* Unread: the green dot, the subject, the sender and the date in Bold; read rows stay Regular */
#v8 #app .v8-msg-inbox .v8-unread :is(.v8-in-subj, .v8-msg-from) { font-weight: 700 !important; }
#v8 #app .v8-msg-inbox .v8-unread .v8-in-date { color: var(--v8-ink); font-weight: 700 !important; }
/* On a phone: the subject across the whole width, then the sender with the date at its right, then the preview on its own line */
@media (max-width: 639px) {
  #v8 #app .v8-msg-inbox .v8-in-tx { grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--v8-3); }
  #v8 #app .v8-msg-inbox :is(.v8-in-top, .v8-in-pre) { display: contents; }
  #v8 #app .v8-msg-inbox .v8-msg-sl { grid-column: 1 / -1; grid-row: 1; }
  /* The sender wraps in its own column: .v8-in-pre's nowrap (inherited through display: contents) ran it under the date */
  #v8 #app .v8-msg-inbox .v8-msg-from { grid-column: 1; grid-row: 2; min-width: 0; white-space: normal; overflow-wrap: break-word; }
  #v8 #app .v8-msg-inbox .v8-msg-colon { display: none; }
  #v8 #app .v8-msg-inbox .v8-in-date { grid-column: 2; grid-row: 2; }
  #v8 #app .v8-msg-inbox .v8-msg-pv { grid-column: 1 / -1; grid-row: 3; min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; color: var(--v8-ink-2); white-space: normal; }
  #v8 #app .v8-msg-inbox .v8-unread .v8-msg-pv { color: var(--v8-ink-2); }
}
#v8 #app .v8-msg-inbox .v8-av-me { background: var(--v8-gray); }
/* Fennia's avatar: the f of the logo, in the logo's green, on the mint disc */
#v8 #app .v8-msg-fav svg { display: block; width: 12px; height: 24px; fill: var(--v8-green); }
/* No match: said in the filters' words with the one way back, as Claims' past claims say it (no box) */
#v8 #app .v8-msg-none { display: grid; justify-items: start; gap: var(--v8-5); }
#v8 #app .v8-msg-none p { margin: 0; }
#v8 #app .v8-msg-none .v8-cl { margin-top: var(--v8-2); }
/* The email notice in Fennia's blue info box (V8.info, note 6, 18 October 2026), the list's width, 40 under the list */
#v8 #app .v8-msg-note { margin-top: var(--v8-7); }
#v8 #app .v8-msg-note > .v8-info { max-width: none; }
#v8 #app :is(.v8-msg-note, .v8-msg-tip) .v8-link { display: inline; }

/* ---------- A conversation: the bubbles ---------- */
#v8 #app .v8-thread { display: grid; gap: var(--v8-5); }
#v8 #app .v8-msg { display: grid; grid-template-columns: 40px minmax(0, min(560px, calc(85% - 52px))); gap: var(--v8-3); align-items: start; }
#v8 #app .v8-msg-you { grid-template-columns: minmax(0, min(560px, 85%)); justify-content: end; }
/* On a small phone Fennia's bubble drops the avatar (the line under it names the sender) and takes the same 85 % */
@media (max-width: 479px) {
  #v8 #app .v8-msg-them { grid-template-columns: minmax(0, 85%); }
  #v8 #app .v8-msg-them > .v8-av { display: none; }
}
#v8 #app .v8-msg-c { min-width: 0; }
#v8 #app .v8-bub { padding: var(--v8-4) var(--v8-5); border-radius: 4px var(--v8-r) var(--v8-r) var(--v8-r); background: var(--v8-white); box-shadow: inset 0 0 0 1px var(--v8-line); color: var(--v8-ink); }
#v8 #app .v8-msg-you .v8-bub { border-radius: var(--v8-r) 4px var(--v8-r) var(--v8-r); background: var(--v8-mint); box-shadow: none; }
#v8 #app .v8-bub > p + p { margin-top: var(--v8-3); }
#v8 #app .v8-bub > p { max-width: none; }
#v8 #app .v8-msg-meta { margin-top: var(--v8-2); color: var(--v8-ink-2); }
#v8 #app .v8-msg-you .v8-msg-meta { text-align: right; }
#v8 #app .v8-msg-fail { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 8px; color: var(--v8-red); }
#v8 #app .v8-msg-fail svg.i { width: 20px; height: 20px; color: var(--v8-red); }
#v8 #app .v8-msg-failed .v8-bub { box-shadow: inset 0 0 0 1px var(--v8-red); }
/* The New line: where the unread part begins */
#v8 #app .v8-msg-new { display: flex; align-items: center; gap: var(--v8-4); color: var(--v8-ink); }
#v8 #app .v8-msg-new > span { font-weight: 700 !important; }
#v8 #app .v8-msg-new::before, #v8 #app .v8-msg-new::after { content: ""; flex: 1; height: 1px; background: var(--v8-green); }
/* A system line (the claim was paid, she added a file) */
#v8 #app .v8-msg-sys { display: flex; align-items: flex-start; justify-content: center; gap: var(--v8-3); padding: 0 var(--v8-5); color: var(--v8-ink-2); text-align: left; }
#v8 #app .v8-msg-sys > span:last-child { max-width: 52ch; padding-top: 0; }
/* Files inside a bubble (README 117): the boxed documents list (V8.docCards, .v8-docs-box, base.css), 12 under the words */
#v8 #app .v8-bub > .v8-msg-fdocs { margin-top: var(--v8-3); }
#v8 #app .v8-bub > .v8-msg-fdocs:first-child { margin-top: 0; }
/* Files added to a message before it is sent: the boxed list's look (one white box, hairlines), the remove button at the right */
#v8 #app .v8-msg-added > li { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: var(--v8-3); min-height: 56px; padding: var(--v8-2) var(--v8-4); background: var(--v8-white); }
#v8 #app .v8-msg-added > li + li { border-top: 1px solid var(--v8-line); }
#v8 #app .v8-msg-fi svg.i { display: block; width: 24px; height: 24px; color: var(--v8-green); }
#v8 #app .v8-msg-ft { display: grid; min-width: 0; }
#v8 #app .v8-msg-ft > span { color: var(--v8-ink-2); }
#v8 #app .v8-msg-ft > b { font-weight: 400 !important; color: var(--v8-ink); overflow-wrap: anywhere; }
#v8 #app .v8-msg-added { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; border: 1px solid var(--v8-line); border-radius: var(--v8-r-sm); background: var(--v8-white); overflow: hidden; }
#v8 #app .v8-msg-added .v8-ib { margin: -6px -10px -6px 0; }

/* The reply box: one white frame, the field and its bar inside it */
#v8 #app .v8-msg-reply { margin-top: var(--v8-7); }
#v8 #app .v8-msg-reply > .v8-label { margin-bottom: var(--v8-2); }
/* README 117: the field's 8 corners (--v8-r-sm), as every field; it was the cards' 16 */
#v8 #app .v8-msg-box { border-radius: var(--v8-r-sm); background: var(--v8-white); box-shadow: inset 0 0 0 1px var(--v8-field); transition: box-shadow .16s ease-out; }
#v8 #app .v8-msg-box:focus-within { box-shadow: inset 0 0 0 2px var(--v8-deep); }
#v8 #app .v8-msg-reply:has([aria-invalid="true"]) .v8-msg-box { box-shadow: inset 0 0 0 2px var(--v8-red); }
#v8 #app .v8-msg-ta { display: block; width: 100%; min-height: 96px; padding: var(--v8-4) var(--v8-5) var(--v8-2) !important; border: 0 !important; border-radius: var(--v8-r-sm) var(--v8-r-sm) 0 0 !important; background: transparent !important; box-shadow: none !important; color: var(--v8-ink); font: inherit; font-size: var(--v8-fs-16) !important; line-height: var(--v8-lh-16) !important; resize: none; field-sizing: content; max-height: 320px; }
#v8 #app .v8-msg-ta:focus { outline: none !important; }
#v8 #app .v8-msg-box > .v8-msg-added { margin: 0 var(--v8-4) var(--v8-2); }
#v8 #app .v8-msg-bar { display: flex; align-items: center; gap: var(--v8-3); padding: var(--v8-2) var(--v8-2) var(--v8-2) var(--v8-2); }
#v8 #app .v8-msg-promise { flex: 1; min-width: 0; color: var(--v8-ink-2); }
#v8 #app .v8-msg-bar .v8-btn-1 { flex: none; }
@media (max-width: 479px) { #v8 #app .v8-msg-promise { display: none; } #v8 #app .v8-msg-bar { justify-content: space-between; } }

/* A closed conversation: what replaces the reply box */
/* README 117: the help box's surface (README 110): white, the 1 px line, 8 corners, 24 inside; it was a gray card */
#v8 #app .v8-msg-closed { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: var(--v8-5); margin-top: var(--v8-7); padding: var(--v8-5); border: 1px solid var(--v8-line); border-radius: var(--v8-r-sm); background: var(--v8-white); }
@media (forced-colors: active) { #v8 #app .v8-msg-closed { border-color: CanvasText; } }
#v8 #app .v8-msg-closed .v8-ic48 { border-radius: var(--v8-r-sm); background: var(--v8-mint); }   /* the mark on a mint square, as the hero's tile */
#v8 #app .v8-msg-closed .v8-cl { margin-top: var(--v8-2); }
#v8 #app .v8-msg-closed .v8-acts { margin-top: var(--v8-5); }
@media (max-width: 479px) { #v8 #app .v8-msg-closed { grid-template-columns: minmax(0, 1fr); padding: var(--v8-5); } }

/* The aside's cards */
#v8 #app .v8-msg-aside .v8-help .v8-dl { margin-top: var(--v8-5); padding: 0; background: transparent; }
#v8 #app .v8-msg-aside .v8-help .v8-dl > div { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: var(--v8-3) 0 0; border-top: 1px solid var(--v8-line); }
/* One padding for the aside's cards: the help card takes the claim card's 24, so their titles and text start on one line */
#v8 #app .v8-msg-aside .v8-help { padding: var(--v8-5); }
/* The claim number in "Rather talk?": the figure first, "Claim number" under it, Copy beside them */
#v8 #app .v8-msg-aside .v8c-num { display: flex; align-items: center; justify-content: space-between; gap: var(--v8-3); margin-top: var(--v8-5); padding-top: var(--v8-4); border-top: 1px solid var(--v8-line); }
#v8 #app .v8c-num > p { display: grid; min-width: 0; }
#v8 #app .v8c-num b { font-weight: 700 !important; font-variant-numeric: tabular-nums; }
#v8 #app .v8c-num span { color: var(--v8-ink-2); }
#v8 #app .v8c-num .v8-ib { flex: none; }
#v8 #app .v8-msg-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
#v8 #app .v8-msg-book .v8-ct { padding-top: var(--v8-6); }
#v8 #app .v8-msg-book .v8-acts { margin-top: var(--v8-5); }

/* The phone's dock (under 640): white, a hairline above, the field 44 high, Send green once there is something to send.
   README 117: the field and Send take the system's 8 corners (no circles, README 70); they were a 22 pill and a disc.
   It restyles the older .dock, so the values carry !important where the older rules do */
@media (max-width: 639px) { #v8 #app .shell.has-dock .v8-msg-reply { display: none; } }
#v8 #app .v8-msg-dock { gap: var(--v8-2); padding: var(--v8-2) var(--v8-4) calc(var(--v8-2) + env(safe-area-inset-bottom)); background: var(--v8-white); border-top: 1px solid var(--v8-line); }
#v8 #app .v8-msg-dock .dock-row { align-items: flex-end; gap: var(--v8-2); }
#v8 #app .v8-msg-dock .dock-field { min-height: 44px !important; padding: 10px 16px !important; border-radius: var(--v8-r-sm) !important; background: var(--v8-white) !important; box-shadow: inset 0 0 0 1px var(--v8-field) !important; color: var(--v8-ink); }
#v8 #app .v8-msg-dock .dock-field::placeholder { color: var(--v8-ink-2); }
#v8 #app .v8-msg-dock .dock-field:focus { outline: none !important; box-shadow: inset 0 0 0 2px var(--v8-deep) !important; }
#v8 #app .v8-msg-dock .dock-field[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--v8-red) !important; }
#v8 #app .v8-msg-dock .send { width: 44px !important; height: 44px !important; border: 0; border-radius: var(--v8-r-sm) !important; background: var(--v8-white) !important; box-shadow: inset 0 0 0 1px var(--v8-green) !important; color: var(--v8-green) !important; cursor: pointer; }
#v8 #app .v8-msg-dock .send.ready { background: var(--v8-green) !important; box-shadow: none !important; color: var(--v8-white) !important; }
#v8 #app .v8-msg-dock .send svg.i { width: 20px; height: 20px; }
#v8 #app .v8-msg-dock .v8-msg-added { max-height: 136px; overflow: auto; }

/* ---------- A notice ---------- */
#v8 #app .v8-msg-text { display: grid; gap: var(--v8-4); max-width: var(--v8-measure); }
#v8 #app .v8-msg-done { display: flex; align-items: flex-start; gap: var(--v8-3); color: var(--v8-ink); }
#v8 #app .v8-msg-on { display: inline-flex; align-items: center; gap: var(--v8-2); min-height: 44px; color: var(--v8-ink); }
/* ---------- Write to us ---------- */
#v8 #app .v8-msg-form { max-width: 640px; }
#v8 #app .v8-msg-form .v8-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* The topic rows: Fennia's option rows (base.css 22 draws every state: rest, hover, focus, selected light green, error) */
#v8 #app .v8-msg-form .v8-opt { grid-template-columns: 24px minmax(0, 1fr); align-items: center; gap: var(--v8-3); min-height: 64px; padding: var(--v8-4) var(--v8-5); }
#v8 #app .v8-msg-form .v8-opt > .v8-opt-r { display: none; }
#v8 #app .v8-msg-form .v8-opt-tx b { font-size: var(--v8-fs-16) !important; line-height: var(--v8-lh-16) !important; font-weight: 400 !important; }
@media (max-width: 479px) { #v8 #app .v8-msg-form .v8-opts { grid-template-columns: minmax(0, 1fr); } }
#v8 #app .v8-msg-tip { max-width: var(--v8-measure); color: var(--v8-ink-2); }
/* The fields: the section 15 field. The older '#app input, textarea, select' rule carries !important (a warm gray 1 px border,
   radius 4, 52 tall, no shadow), so these do too */
#v8 #app .v8-msg-form .v8-ta { height: auto !important; min-height: 144px !important; padding: 12px 16px !important; }
#v8 #app .v8-msg-up { margin-top: var(--v8-1); }
#v8 #app .v8-msg-up + .v8-msg-added { margin-top: var(--v8-2); }
#v8 #app .v8-msg-foot { margin-top: var(--v8-4); }
@media (max-width: 479px) { #v8 #app .v8-msg-foot { flex-direction: column-reverse; align-items: stretch; } }

/* ---------- The hero's lead: the text and the disc start at the top in base.css (harmonised 18 October 2026) ---------- */
#v8 #app .v8-msg-hero .v8-lead { text-wrap: balance; }
#v8 #app .v8-msg-dt { display: inline-block; font-weight: inherit !important; }   /* the figure's 700 (the older #app * weight rule set it to 400) */
#v8 #app .v8-msg-hero .v8-meta > span:not(.sr, .v8-badge) { display: inline-block; }
/* A notice's figures are the lean hero's strip since 18 October 2026, night (README 35): 28, one row at every width, so the stacking
   below 1280 that the 40 dates needed went */


/* A conversation is its history alone (18 October 2026, Janne: "just show the messaging history"): no aside, so the thread and the
   reply take one reading column, 8 of the 12 columns from 1024 (about 680 at 1440), on the page's left edge like every page */
#v8 #app .v8-msg-only .v8-msg-main { grid-column: 1 / span 8; }
@media (max-width: 1023px) { #v8 #app .v8-msg-only .v8-msg-main { grid-column: 1; } }
/* "Write to us" lines up with the inbox (Janne, 22 October 2026: "Write to us is not aligned with the messages, so it should move to
   the left"): the inbox's head takes the list's 880 width, so the button's right edge meets the list's right edge (README 123) */
#v8 #app .v8-hero.v8-hero-inbox .v8-hero-g { max-width: 880px; }
