/*
 * static/css/admin-inbox.css — the /opensesame dashboard's inboxes and readers (plan R-120, lane dash-inbox; spec
 * docs/plan/specs/dashboard-2.md §3.6, §3.7): the one triage inbox of Arjav Pro requests and Feedback (views/inbox.js:
 * the list beside the opened item at 900 px and wider, the item a page of its own below), and the one transcript
 * reader of the Arjav Pro transcripts and the deleted accounts' chats (views/reader.js: a column of about 880 px, day
 * and reply dividers, tool bodies verbatim in a bounded box of their own). Same rules as admin.css: `.adm-` selectors
 * only, tokens only, each selector defined once.
 */

/* ============================================================
   INBOX: the page, the list, the opened item
   ============================================================ */
.adm-inbox-page { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.adm-inbox-filters { min-width: 0; }
.adm-inbox-filters:empty { display: none; }
.adm-inbox { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 16px; align-items: start; }
.adm-inbox-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.adm-inbox-list { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.adm-inbox-empty { padding: 28px 16px; border-radius: var(--radius-md); box-shadow: inset 0 0 0 1px var(--c-outline-variant); }
.adm-inbox-foot:empty { display: none; }
.adm-inbox-foot > .adm-loadmore { border-top: 0; padding: 4px 4px 0; }
.adm-inbox-items { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.adm-inbox-row {
    position: relative; display: flex; flex-direction: column; min-width: 0;
    background: var(--c-surface); border-radius: var(--radius-md); box-shadow: inset 0 0 0 1px var(--c-outline-variant);
    transition: background-color var(--dur-1) var(--ease-standard);
}
.adm-inbox-row:hover { background: var(--c-surface-high); }
.adm-inbox-item {
    display: flex; flex-direction: column; gap: 6px; width: 100%; min-height: 44px; padding: 12px 14px; text-align: left;
    cursor: pointer; background: transparent; border: 0; border-radius: inherit; color: inherit; font: inherit;
}
.adm-inbox-item:focus-visible { outline-offset: -2px; }
.adm-inbox-row:has(> .adm-inbox-item[aria-current="true"]) { background: var(--c-accent-container); box-shadow: inset 3px 0 0 var(--c-accent), inset 0 0 0 1px var(--c-outline-variant); }
/* answered items read quieter through their name and text, never by fading the whole row (on-3 keeps AA: fix ux-14) */
.adm-inbox-item[data-status="archived"] .adm-inbox-name, .adm-inbox-item[data-status="resolved"] .adm-inbox-name,
.adm-inbox-item[data-status="archived"] .adm-inbox-text, .adm-inbox-item[data-status="resolved"] .adm-inbox-text { color: var(--c-on-3); }
.adm-inbox-top { display: flex; align-items: center; gap: 8px; min-width: 0; font: var(--t-body-s); }
.adm-inbox-top > time { flex: none; color: var(--c-on-3); white-space: nowrap; }
/* The sender's name is a plain block, so a long one-word username breaks inside the row on a phone (min-width 0 +
   break-word) while a short one never wraps early; the spacer only takes the room left over. */
.adm-inbox-name { display: block; flex: 0 1 auto; min-width: 0; overflow-wrap: break-word; color: var(--c-on-2); font: var(--t-label-l); }
.adm-inbox-item[data-unread="true"] .adm-inbox-name { color: var(--c-on); font-weight: 650; }
.adm-inbox-top > .adm-grow { flex-basis: 0; }
/* two lines of the message (the whole text is one click away) */
.adm-inbox-text {
    color: var(--c-on-2); font: var(--t-body-m); overflow: hidden; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.adm-inbox-item[aria-current="true"] .adm-inbox-text { color: var(--c-on-accent-container); }
.adm-inbox-sub { color: var(--c-on-3); font: var(--t-body-s); overflow-wrap: anywhere; }
.adm-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c-accent); }
.adm-inbox-detail {
    position: sticky; top: calc(var(--adm-bar-h) + 16px); min-width: 0;
    max-height: calc(100vh - var(--adm-bar-h) - 32px); max-height: calc(100dvh - var(--adm-bar-h) - 32px); overflow-y: auto;
    border-radius: var(--radius-lg);
}
.adm-inbox-detail:empty { display: none; }
.adm-inbox-back { display: none; }
.adm-inbox-article { min-width: 0; }
.adm-detail-head { display: flex; align-items: flex-start; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 14px; }
.adm-detail-main { flex: 1 1 260px; min-width: 0; }
.adm-detail-titlerow { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; min-width: 0; }
.adm-detail-title { min-width: 0; color: var(--c-on); font: var(--t-title-l); overflow-wrap: anywhere; }
.adm-detail-title:focus { outline: none; }
.adm-detail-name { color: var(--c-on); text-decoration: none; }
.adm-detail-name:hover { color: var(--c-accent-text); text-decoration: underline; text-underline-offset: 3px; }
.adm-detail-meta { margin-top: 4px; color: var(--c-on-3); font: var(--t-body-s); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.adm-detail-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.adm-detail-hint { flex: 1 1 100%; color: var(--c-on-2); font: var(--t-body-s); text-align: right; }
/* what the person wrote: once, as plain text (no box inside the card) */
.adm-detail-text, .adm-feedback-text { margin: 0 0 14px; color: var(--c-on); font: var(--t-body-l); white-space: pre-wrap; overflow-wrap: anywhere; }
.adm-inbox-lines { display: grid; justify-items: end; row-gap: 2px; }
.adm-excerpt { margin: 0 0 14px; }
.adm-excerpt blockquote { margin: 6px 0 0; padding-left: 14px; border-left: 3px solid var(--c-outline-variant); color: var(--c-on-2); }
.adm-note { margin-top: 16px; }
.adm-note .adm-textarea { width: 100%; }

/* a person's Arjav Pro history (this inbox's Earlier, the person page's section) */
.adm-quote { margin: 0; color: var(--c-on); font: var(--t-body-m); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.adm-history { list-style: none; display: flex; flex-direction: column; }
.adm-history-item { display: grid; gap: 6px; padding: 8px 0; border-top: 1px solid var(--c-outline-variant); }
.adm-history-item:first-child { border-top: 0; }
.adm-history-head { display: flex; align-items: center; gap: 10px; color: var(--c-on-3); font: var(--t-body-s); }

/* ============================================================
   LISTS OF TRANSCRIPTS: Arjav Pro transcripts, deleted accounts' chats
   ============================================================ */
.adm-tx-snippet { overflow-wrap: anywhere; }
/* a title with a search hit under it: two lines need room above and below */
.adm-table--transcripts .adm-c--title { padding-top: 10px; padding-bottom: 10px; }
.adm-table .adm-kept-group th {
    height: auto; padding: 16px 20px 8px; background: var(--c-surface-low); color: var(--c-on-3); font: var(--t-body-s);
    letter-spacing: normal; text-transform: none;
}
/* one line of words that wraps between its parts (inline, so the spaces around each " · " stay) */
.adm-kept-line { display: block; min-width: 0; line-height: 1.6; }
.adm-kept-line > span { white-space: nowrap; }
.adm-kept-line > .adm-kept-name { color: var(--c-on); font: var(--t-label-l); white-space: normal; overflow-wrap: anywhere; }

/* ============================================================
   THE READER
   ============================================================ */
.adm-reader { display: flex; flex-direction: column; gap: 10px; max-width: 880px; min-width: 0; }
.adm-tx-day {
    display: flex; align-items: center; gap: 12px; margin: 10px 0 0; color: var(--c-on-3); font: var(--t-label-s);
    letter-spacing: 0.08em; text-transform: uppercase;
}
.adm-tx-day::after { content: ''; flex: 1 1 auto; height: 1px; background: var(--c-outline-variant); }
.adm-tx-day:first-child { margin-top: 0; }
/* a reply: a divider over the entries it holds, not a card */
.adm-tx-turn { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--c-primary-edge); }
.adm-tx-turn-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; color: var(--c-accent-text); font: var(--t-label-l); font-weight: 600; }
.adm-tx-turn-text { min-width: 0; overflow-wrap: anywhere; }
.adm-tx-turn-note { margin-top: 4px; color: var(--c-on-3); font: var(--t-body-s); white-space: pre-wrap; overflow-wrap: anywhere; }
.adm-tx-entry { min-width: 0; padding: 12px 16px; border-radius: var(--radius-md); border: 1px solid var(--c-outline-variant); background: var(--c-surface); }
.adm-tx-entry--user { background: var(--c-surface-high); }
.adm-tx-entry--meta, .adm-tx-entry--tool, .adm-tx-entry--result { background: var(--c-surface-low); }
.adm-tx-entry--event { padding: 2px 16px; border: 0; background: none; }
.adm-tx-entry--event .adm-tx-title { color: var(--c-on-2); font: var(--t-body-s); }
.adm-tx-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.adm-tx-kind { color: var(--c-on-3); font: var(--t-label-s); letter-spacing: 0.08em; text-transform: uppercase; }
.adm-tx-title { min-width: 0; color: var(--c-on); font: var(--t-label-l); font-weight: 600; overflow-wrap: anywhere; }
.adm-tx-time { margin-left: auto; color: var(--c-on-3); font: var(--t-body-s); font-variant-numeric: tabular-nums; white-space: nowrap; }
.adm-tx-body { margin-top: 8px; color: var(--c-on); font: var(--t-body-m); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.adm-tx-entry--text .adm-tx-body { margin-top: 0; }
/* a tool call or result: what the model saw, verbatim, about 12 lines tall at most with a scroll of its own */
.adm-tx-code {
    max-height: calc(12 * 1.5em + 20px); overflow-y: auto; padding: 10px 12px; border-radius: var(--radius-sm);
    background: var(--c-surface); box-shadow: inset 0 0 0 1px var(--c-outline-variant); font: var(--t-mono); font-size: 0.8125rem; line-height: 1.5;
}

/* ============================================================
   NARROW SCREENS: an opened item is a page of its own
   ============================================================ */
@media (max-width: 899px) {
    .adm-inbox { grid-template-columns: minmax(0, 1fr); }
    .adm-inbox-page[data-detail="true"] .adm-inbox-col,
    .adm-inbox-page[data-detail="true"] > .adm-head,
    .adm-inbox-page[data-detail="true"] > .adm-inbox-filters { display: none; }
    .adm-inbox-page[data-detail="false"] .adm-inbox-detail { display: none; }
    .adm-inbox-detail { position: static; max-height: none; overflow: visible; }
    .adm-inbox-back { display: inline-flex; }
    .adm-detail-actions { flex: 1 1 100%; }
    .adm-detail-actions > .adm-btn { flex: 1 1 0; min-height: 44px; }
    .adm-detail-hint { text-align: left; }
}
@media (max-width: 640px) {
    .adm-inbox-lines { justify-items: start; }
    .adm-tx-entry { padding: 10px 12px; }
}
@media (forced-colors: active) {
    .adm-tx-entry, .adm-tx-code { border: 1px solid CanvasText; }
    .adm-inbox-item[aria-current="true"] { outline: 2px solid Highlight; outline-offset: -2px; }
    .adm-dot { forced-color-adjust: none; background: CanvasText; }
    .adm-detail-title:focus-visible { outline: 2px solid Highlight; outline-offset: 4px; }
}
