/* ====================================================================
   SCREEN 50 MESSAGES — the customer's page, the desktop layer (slice
   M50a, 2026-10-10). pharmacy/messages.html only, linked after
   desktop/shared.css. The thread module's own pieces (the bubbles, the
   composer, the "more" button, the Report and photo dialogs) are
   css/pharmacy/50-messages.css's; this file lays the page out.
   Sheet: docs/design/pharmacy/screens/50/FACTS.md, "50-d"; contract C4.
   Every rule inside a min-width query; the phone is untouched.

   Tiers:
     >=901   the 480 column unwinds (.vm-dt-shell); the customer's glass
             header (Orders lit, no Basket) over the band; the band in
             the customer's light (.vm-dt-band--customer): the glass exit
             naming where she came from (the reference) | the counter's
             name at 34 over the case line | the urgent `tel:` as a glass
             pill at the band's right. Under it the thread card at the
             column's width, FIXED to the window (556 at 800 tall: the
             window less 244), its messages scrolling inside on #fbfcfd,
             bubbles to 520, the composer at its foot.
     901-1119 (no frame drawn; the director's ruling): the band and the
             card at the full column width, the case card under the card.
     >=1120  main 764 | the case card in the 340 column (gap 48).

   Sections:
     1. The band
     2. The body and the thread card
     3. The case card
     4. States (loading, signed out, a failed open)
     5. The columns from 1120
     6. Hover
   ==================================================================== */


/* ====================================================================
   1. THE BAND (50-d): the glass header (65 with its hairline) sits over
   its top, so the content starts 16 under it.
   ==================================================================== */
@media (min-width: 901px) {
    .vm-ms-top {
        position: static;
        display: flex;
        align-items: center;
        gap: 20px;
        padding: 81px max(24px, calc((100% - 1152px) / 2)) 22px;
        color: #fff;
    }
    .vm-ms-head {
        flex: 1;
        min-width: 0;
        flex-direction: row;
        align-items: center;
        gap: 20px;
        padding: 0;
        background: none;
        border: 0;
    }
    .vm-ms-back.vm-back {
        flex-shrink: 0;
        align-self: center;
        min-height: 44px;
        margin: 0;
        padding: 0 16px 0 12px;
        gap: 8px;
        border-radius: 13px;
        background: rgba(255, 255, 255, .12);
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
        color: #fff;
        font-size: 13.5px;
        font-weight: 700;
    }
    .vm-ms-back.vm-back i { font-size: 14px; }
    .vm-ms-back.vm-back:focus-visible { outline-color: #fff; }
    .vm-ms-id { flex: 1; min-width: 0; }
    .vm-ms-title {
        font-size: 34px;
        letter-spacing: -1px;
        line-height: 1.1;
        color: #fff;
        text-wrap: balance;
    }
    .vm-ms-line {
        margin-top: 6px;
        font-size: 15px;
        color: #e2e8f0;
    }
    .vm-ms-line .vm-ms-sep { color: rgba(255, 255, 255, .4); }
    .vm-ms-urgent {
        flex-shrink: 0;
        gap: 10px;
        min-height: 44px;
        padding: 0 18px 0 14px;
        border: 0;
        border-radius: 999px;
        background: rgba(255, 255, 255, .12);
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
        color: #e2e8f0;
        font-size: 14px;
    }
    .vm-ms-urgent i { font-size: 12px; color: #8ff08b; }
    .vm-ms-urgent strong { color: #fff; }
    .vm-ms-urgent .vm-ms-urgentsep { color: rgba(255, 255, 255, .4); }
    .vm-ms-urgent:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
}


/* ====================================================================
   2. THE BODY AND THE THREAD CARD
   ==================================================================== */
@media (min-width: 901px) {
    .vm-ms-body {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        row-gap: 24px;
        align-items: start;
        width: 100%;
        max-width: 1200px;
        margin: 0 auto;
        padding: 24px 24px 48px;
        box-sizing: border-box;
    }
    .vm-ms-main { min-width: 0; }
    .vm-ms-thread {
        height: max(420px, calc(100vh - 244px));
        background: #fff;
        border-radius: 18px;
        box-shadow: 0 1px 2px rgba(16, 24, 40, .03), 0 10px 28px rgba(16, 24, 40, .07);
        overflow: hidden;
    }
    .vm-ms-thread > .vm-th { height: 100%; }
    .vm-ms-thread .vm-th-scroll {
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 24px 24px 20px;
        background: #fbfcfd;
    }
    /* The messages sit at the card's foot while they are few (the frame's
       flex-end), and scroll from the top once they are many. */
    .vm-ms-thread .vm-th-list {
        margin-top: auto;
        gap: 16px;
    }
    .vm-ms-thread .vm-th-msg { max-width: 520px; }
    .vm-ms-thread .vm-th--page .vm-th-foot { position: static; }
    .vm-ms-thread .vm-th-form { padding: 14px 20px 16px; }
    .vm-ms-thread .vm-th-thanks { margin: 14px 20px 0; }
    .vm-ms-thread .vm-th-closed { padding: 16px 20px 20px; }
}


/* ====================================================================
   3. THE CASE CARD (50-d): what the thread is about, in the code's
   words; "Open the order" (or the visit) at its foot.
   ==================================================================== */
@media (min-width: 901px) {
    .vm-ms-case {
        display: block;
        min-width: 0;
        background: #fff;
        border-radius: 18px;
        box-shadow: 0 1px 2px rgba(16, 24, 40, .03), 0 10px 28px rgba(16, 24, 40, .07);
        overflow: hidden;
    }
    .vm-ms-case[hidden] { display: none; }
    .vm-ms-case-in {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 18px 20px;
    }
    .vm-ms-case-k {
        display: flex;
        align-items: center;
        gap: 8px;
        margin: 0;
        font-size: 12px;
        font-weight: 700;
        color: #0f6d5c;
        font-variant-numeric: tabular-nums;
    }
    .vm-ms-case-k i { font-size: 12px; }
    .vm-ms-case-t {
        margin: 6px 0 0;
        font-family: 'Space Grotesk', sans-serif;
        font-size: 20px;
        font-weight: 700;
        letter-spacing: -.4px;
        line-height: 1.2;
        color: #0f172a;
        font-variant-numeric: tabular-nums;
    }
    .vm-ms-case-lines {
        margin: 0;
        padding: 0;
        list-style: none;
        border: 1px solid #f0f2f4;
        border-radius: 12px;
        overflow: hidden;
    }
    .vm-ms-case-line {
        display: flex;
        align-items: center;
        gap: 10px;
        min-height: 44px;
        padding: 10px 14px;
        box-sizing: border-box;
        font-size: 13.5px;
    }
    .vm-ms-case-line + .vm-ms-case-line { border-top: 1px solid #f0f2f4; }
    .vm-ms-case-name { flex: 1; min-width: 0; font-weight: 600; color: #0f172a; overflow-wrap: anywhere; }
    .vm-ms-case-qty { flex-shrink: 0; color: #64748b; font-variant-numeric: tabular-nums; }
    .vm-ms-case-pay {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 12px;
        margin: 0;
        font-size: 13.5px;
        color: #475569;
    }
    .vm-ms-case-fig {
        font-family: 'Space Grotesk', sans-serif;
        font-size: 18px;
        font-weight: 700;
        color: #0f172a;
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
    }
    .vm-ms-case-go {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 9px;
        height: 52px;
        border-top: 1px solid #f0f2f4;
        color: #0f6d5c;
        font-size: 14.5px;
        font-weight: 700;
        text-decoration: none;
    }
    .vm-ms-case-go i { font-size: 12px; }
    .vm-ms-case-go:focus-visible { outline: 2px solid #0f6d5c; outline-offset: -2px; }
}


/* ====================================================================
   4. STATES: loading, signed out, a failed open
   ==================================================================== */
@media (min-width: 901px) {
    .vm-ms-loading { padding: 8px 0; }
    .vm-ms-card {
        margin: 0;
        max-width: 764px;
        box-sizing: border-box;
    }
}


/* ====================================================================
   5. THE COLUMNS FROM 1120: main 764 | the 340 case card, gap 48.
   ==================================================================== */
@media (min-width: 1120px) {
    .vm-ms-body {
        grid-template-columns: minmax(0, 1fr) 340px;
        column-gap: 48px;
    }
    .vm-ms-body > .vm-ms-main { grid-column: 1; grid-row: 1; }
    .vm-ms-body > .vm-ms-case { grid-column: 2; grid-row: 1; }
}


/* ====================================================================
   6. HOVER (a pointer that can hover)
   ==================================================================== */
@media (min-width: 901px) {
    @media (hover: hover) {
        .vm-ms-back.vm-back:hover { background: rgba(255, 255, 255, .18); color: #fff; }
        .vm-ms-urgent:hover { background: rgba(255, 255, 255, .18); color: #e2e8f0; }
        .vm-ms-case-go:hover { background: #f4fbf9; color: #0f6d5c; }
    }
}
