/* Leonardo Library -- The Thinker shelf (Story 2445). Phone-first, mirrors the
   Poems / Books / Quotes "qm-" design so the Library reads as one system.
   A thought carries more metadata than a poem does -- the Type of Thought, the
   model, the session, the grade -- so the card leads with a chip row and keeps
   the prose underneath it. */

:root {
    --qm-ink:    #1d2330;
    --qm-muted:  #6b7280;
    --qm-line:   #e6e8ef;
    --qm-bg:     #f4f5f9;
    --qm-card:   #ffffff;
    --qm-accent: #3f6f8b;
    --qm-essay:  #7a4bb0;
    --qm-gold:   #f0a500;
    --qm-danger: #c2384a;
}

* { box-sizing: border-box; }

body {
    background: var(--qm-bg);
    color: var(--qm-ink);
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Fixed-viewport shell: pins the Leonardo menu band and the filters; only
   .qm-body scrolls, so the chrome never scrolls off. 100dvh, not 100vh. */
.qm-shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }

/* ---- top ---------------------------------------------------------------- */
.qm-top { background: #24384a; color: #fff; flex: 0 0 auto; }
.lw-nav { min-height: 6px; }

.tk-header { display: flex; align-items: center; gap: 10px; padding: 6px 12px 2px; }
.tk-header h1 { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: .2px; }
.tk-header button { font: inherit; font-size: 12px; margin-left: auto; background: transparent; border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 999px; padding: 4px 12px; cursor: pointer; }

.qm-stats { display: flex; gap: 0; padding: 6px 8px; }
.qm-stat {
    flex: 1 1 0; min-width: 56px; text-align: center;
    padding: 3px 2px; border-right: 1px solid rgba(255,255,255,.16);
}
.qm-stat:last-child { border-right: none; }
.qm-stat .n { font-size: 16px; font-weight: 700; display: block; line-height: 1.1; }
.qm-stat .l { font-size: 9px; text-transform: uppercase; letter-spacing: .5px; color: #bcd4e2; }

/* ---- action buttons ----------------------------------------------------- */
.qm-actions {
    display: flex; gap: 7px; padding: 9px 10px; flex-wrap: wrap;
    background: #fff; border-bottom: 1px solid var(--qm-line);
}
.qm-btn {
    font: inherit; font-size: 13px; font-weight: 600;
    border: 1px solid var(--qm-line); border-radius: 999px;
    background: #fff; color: var(--qm-ink);
    padding: 8px 13px; cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px;
    transition: background .12s, border-color .12s, transform .05s;
    text-decoration: none;
}
.qm-btn:hover { background: #eef4f8; border-color: #cfe0ea; }
.qm-btn:active { transform: scale(.97); }
.qm-btn.primary { background: var(--qm-accent); border-color: var(--qm-accent); color: #fff; }
.qm-btn.primary:hover { background: #355d76; }
.qm-btn .ic { font-size: 15px; line-height: 1; }
.qm-btn.on { background: #e4eef4; border-color: #cfe0ea; color: var(--qm-accent); }

/* ---- always-on search row (Story 2446) ---------------------------------- */
/* Search is the one control that never folds away: a shelf you cannot search is
   a shelf you cannot use once it passes a hundred thoughts. */
.tk-searchrow {
    display: flex; align-items: center; gap: 8px; flex: 0 0 auto;
    padding: 8px 10px; background: #fff; border-bottom: 1px solid var(--qm-line);
}
.tk-searchrow .ic { font-size: 15px; color: var(--qm-muted); flex: 0 0 auto; }
.tk-searchrow input {
    flex: 1 1 auto; min-width: 0; width: 100%; box-sizing: border-box;
    padding: 10px 12px; font: inherit; font-size: 15px;
    border: 1px solid var(--qm-line); border-radius: 10px; background: #fff; outline: none;
    -webkit-appearance: none; appearance: none;
}
.tk-searchrow input::-webkit-search-cancel-button { display: none; }
.tk-searchrow input:focus { border-color: var(--qm-accent); box-shadow: 0 0 0 3px rgba(63,111,139,.18); }
.tk-searchrow .voice-mic-wrap { display: block; flex: 1 1 auto; min-width: 0; }
.tk-searchclear {
    display: none; flex: 0 0 auto; border: none; background: transparent; cursor: pointer;
    color: var(--qm-muted); font-size: 15px; line-height: 1;
    min-width: 40px; min-height: 40px; border-radius: 8px;
}
.tk-searchclear.show { display: inline-flex; align-items: center; justify-content: center; }
.tk-searchclear:hover { background: #eef4f8; }

/* ---- search + filter ---------------------------------------------------- */
.qm-searchbar {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 10px; background: #fff; border-bottom: 1px solid var(--qm-line);
    cursor: pointer; font-size: 13px; font-weight: 600; color: var(--qm-ink);
}
.qm-searchbar .chev { margin-left: auto; transition: transform .15s; color: var(--qm-muted); }
.qm-searchbar.open .chev { transform: rotate(180deg); }
.qm-searchbar .activedot { display: none; width: 8px; height: 8px; border-radius: 50%; background: var(--qm-accent); }
.qm-searchbar.filtered .activedot { display: inline-block; }

.qm-filters {
    display: none; flex-direction: column; gap: 10px;
    padding: 12px 10px; background: #fff; border-bottom: 1px solid var(--qm-line);
}
.qm-filters.open { display: flex; }
.qm-filters label { font-size: 11px; font-weight: 600; color: var(--qm-muted); margin-bottom: -4px; }
.qm-filters input, .qm-filters select {
    width: 100%; box-sizing: border-box;
    padding: 11px 12px; font: inherit; font-size: 15px;
    border: 1px solid var(--qm-line); border-radius: 10px; background: #fff; outline: none;
}
.qm-filters input:focus, .qm-filters select:focus { border-color: var(--qm-accent); box-shadow: 0 0 0 3px rgba(63,111,139,.18); }
.qm-filters .favrow { display: flex; align-items: center; gap: 8px; }
.qm-filters .favrow input { width: 20px; height: 20px; }
.qm-filters .favrow label { margin: 0; font-size: 14px; color: var(--qm-ink); }
.qm-filters .clearrow { display: flex; justify-content: flex-end; gap: 8px; }
.qm-filters .ps-select {
    width: 100%; box-sizing: border-box; padding: 11px 12px; font: inherit; font-size: 15px;
    border: 1px solid var(--qm-line); border-radius: 10px; background: #fff;
}

/* ---- group-by bar ------------------------------------------------------- */
.qm-groupbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; flex-wrap: wrap; }
.qm-groupbar .lbl { font-size: 12px; color: var(--qm-muted); }
.qm-seg { display: inline-flex; border: 1px solid var(--qm-line); border-radius: 999px; overflow: hidden; background: #fff; }
.qm-seg button { font: inherit; font-size: 12px; font-weight: 600; border: none; background: transparent; color: var(--qm-muted); padding: 6px 11px; cursor: pointer; }
.qm-seg button.on { background: var(--qm-accent); color: #fff; }

/* ---- body / groups / cards ---------------------------------------------- */
.qm-body { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 10px 90px; }

.qm-group { border: 1px solid var(--qm-line); border-radius: 12px; background: #fff; margin-bottom: 10px; overflow: hidden; }
.qm-group-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; cursor: pointer; user-select: none; background: #f4f8fa; }
.qm-group-h .chev { transition: transform .15s; color: var(--qm-accent); font-size: 12px; }
.qm-group.open .qm-group-h .chev { transform: rotate(90deg); }
.qm-group-h .t { font-size: 14px; font-weight: 800; color: var(--qm-accent); }
.qm-group-h .c { margin-left: auto; font-size: 11px; color: var(--qm-muted); background: #e4eef4; padding: 1px 9px; border-radius: 999px; }
.qm-group-body { display: none; padding: 8px 10px 10px; }
.qm-group.open .qm-group-body { display: block; }

.qm-card {
    background: var(--qm-card);
    border: 1px solid var(--qm-line);
    border-left: 4px solid var(--qm-accent);
    border-radius: 10px;
    padding: 12px 14px 8px;
    margin: 0 0 9px;
    box-shadow: 0 1px 2px rgba(20,20,50,.04);
}
.qm-card.essay { border-left-color: var(--qm-essay); }
.qm-card:last-child { margin-bottom: 0; }

.tk-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; }
.tk-chip { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: 2px 8px; border-radius: 999px; background: #e4eef4; color: var(--qm-accent); }
.tk-chip.essay { background: #efe4fa; color: var(--qm-essay); }
.tk-chip.grade { background: #fff2d6; color: #8a5b00; }
.tk-chip.model { background: #eceff4; color: #4b5563; text-transform: none; letter-spacing: 0; font-weight: 600; }

.qm-card .tk-title { font-size: 17px; font-weight: 700; color: var(--qm-accent); margin-bottom: 2px; word-break: break-word; }
.qm-card.essay .tk-title { color: var(--qm-essay); }
.qm-card .tk-when { font-size: 12px; color: var(--qm-muted); margin-bottom: 8px; }

.qm-card .tk-summary {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 15px; line-height: 1.55; color: #20242e;
    white-space: pre-wrap; word-break: break-word;
    max-height: 8.5em; overflow: hidden; position: relative;
    transition: max-height .2s ease;
}
.qm-card .tk-summary.expanded { max-height: 4000px; }
.qm-card .tk-summary.clipped::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2.4em;
    background: linear-gradient(rgba(255,255,255,0), #fff);
}
.qm-card .tk-more {
    display: none; margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--qm-accent);
    background: none; border: none; cursor: pointer; padding: 4px 0;
}
.qm-card .tk-more.show { display: inline-block; }

.qm-card .tk-learned { font-size: 12px; color: var(--qm-muted); font-style: italic; margin-top: 8px; }

.qm-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.qm-meta .src { font-size: 11px; color: var(--qm-muted); font-style: italic; }
.qm-meta-right { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.qm-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; background: #e4eef4; color: var(--qm-accent); padding: 2px 8px; border-radius: 999px; }

.qm-cardactions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-top: 6px; padding-top: 6px; border-top: 1px dashed #eef0f6; }
.qm-icobtn {
    border: none; background: transparent; cursor: pointer;
    font-size: 19px; line-height: 1; padding: 8px 11px; border-radius: 8px; color: var(--qm-muted);
    min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center;
}
.qm-icobtn:hover { background: #eef4f8; }
/* Story 5577: eight 40px buttons are wider than a card on a 390px phone. With
   flex-end and no wrap the overflow spilled out the LEFT side, taking the star
   off the screen. Narrow screens get slimmer buttons so the row fits; anything
   narrower still wraps instead of overflowing. */
@media (max-width: 480px) {
    .qm-cardactions { gap: 2px; }
    .qm-cardactions .qm-icobtn { min-width: 34px; padding: 8px 5px; }
}
.qm-icobtn.star.on { color: var(--qm-gold); }
.qm-icobtn.readmark.on { color: var(--qm-accent); }
.qm-icobtn.del:hover { background: #fdecef; color: var(--qm-danger); }

/* ---- read / unread (Story 2455) -----------------------------------------
   The shelf writes faster than it is read, so the card has to say at a glance
   whether Tony has been through it. Deliberately quiet: an unread thought gets
   one small dot beside its title and nothing else. A read thought gets no mark
   at all -- the absence IS the signal, and it costs the card no space. */
.tk-unreaddot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--qm-accent); vertical-align: middle;
    margin-right: 7px; flex: 0 0 auto;
}
.qm-card.essay .tk-unreaddot { background: var(--qm-essay); }
/* A read thought steps back a shade so the unread ones lead the eye. */
.qm-card.tk-read .tk-title { color: #6f7b88; }
.qm-card.essay.tk-read .tk-title { color: #8a7ba0; }

/* ---- collapsed to titles (Story 2446) ----------------------------------- */
/* Collapse all folds the bands away; with no bands to fold (Group by = None)
   it folds the cards themselves down to a title and a date, so a long shelf
   still becomes a list you can run your eye down. Tapping one opens it. */
.qm-body.tk-compact .qm-card { padding: 8px 12px 8px; }
.qm-body.tk-compact .qm-card:not(.tk-open) .tk-chips,
.qm-body.tk-compact .qm-card:not(.tk-open) .tk-summary,
.qm-body.tk-compact .qm-card:not(.tk-open) .tk-more,
.qm-body.tk-compact .qm-card:not(.tk-open) .tk-learned,
.qm-body.tk-compact .qm-card:not(.tk-open) .qm-meta,
.qm-body.tk-compact .qm-card:not(.tk-open) .qm-cardactions { display: none; }
.qm-body.tk-compact .qm-card:not(.tk-open) .tk-title { font-size: 15px; margin-bottom: 0; }
.qm-body.tk-compact .qm-card:not(.tk-open) .tk-when { font-size: 11px; margin-bottom: 0; }
.qm-body.tk-compact .tk-title { cursor: pointer; }

.qm-empty { text-align: center; color: var(--qm-muted); padding: 50px 20px; font-size: 14px; }
.qm-empty .big { font-size: 40px; display: block; margin-bottom: 8px; opacity: .5; }

.tk-morerow { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 6px 0 14px; }
.tk-moreleft { font-size: 12px; color: var(--qm-muted); }

/* ---- floating add ------------------------------------------------------- */
.qm-fab {
    position: fixed; right: 18px; bottom: 22px; z-index: 60;
    width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
    background: var(--qm-accent); color: #fff; font-size: 28px; line-height: 1;
    box-shadow: 0 6px 18px rgba(63,111,139,.45);
}
.qm-fab:active { transform: scale(.94); }

/* ---- modal -------------------------------------------------------------- */
.qm-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(20,18,40,.55); display: none; align-items: flex-end; justify-content: center; }
.qm-overlay.show { display: flex; }
.qm-modal { background: #fff; width: 100%; max-width: 660px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 16px 16px 22px; box-shadow: 0 -8px 30px rgba(0,0,0,.25); }
@media (min-width: 640px) { .qm-overlay { align-items: center; } .qm-modal { border-radius: 16px; } }
.qm-modal h2 { margin: 2px 0 12px; font-size: 17px; display: flex; align-items: center; gap: 8px; }

.qm-field { margin-top: 12px; }
.qm-field:first-of-type { margin-top: 4px; }
.qm-field label { display: block; font-size: 12px; font-weight: 600; color: var(--qm-muted); margin-bottom: 5px; }
.qm-field input[type=text], .qm-field input[type=date], .qm-field input[type=number], .qm-field select, .qm-field textarea {
    width: 100%; box-sizing: border-box;
    padding: 11px 12px; font: inherit; font-size: 15px;
    border: 1px solid var(--qm-line); border-radius: 10px; outline: none; background: #fff;
}
.qm-field textarea { resize: vertical; min-height: 120px; line-height: 1.5; font-family: Georgia, serif; }
.qm-field .ps-select {
    width: 100%; box-sizing: border-box; padding: 11px 12px; font: inherit; font-size: 15px;
    border: 1px solid var(--qm-line); border-radius: 10px; background: #fff;
}
.qm-field .ps-select:focus, .qm-field .ps-select.is-open { border-color: var(--qm-accent); box-shadow: 0 0 0 3px rgba(63,111,139,.18); }
.qm-field input:focus, .qm-field select:focus, .qm-field textarea:focus { border-color: var(--qm-accent); box-shadow: 0 0 0 3px rgba(63,111,139,.18); }
.qm-field .hint { font-size: 11px; color: var(--qm-muted); margin-top: 4px; }
.qm-checkline { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--qm-ink); }
.qm-checkline input { width: 20px; height: 20px; }

/* PicassoVoice wraps text inputs in an inline-block span, which collapses
   width:100% to the intrinsic content width. Force it to block everywhere a
   field must span the row. */
.qm-field .voice-mic-wrap,
.qm-filters .voice-mic-wrap { display: block; width: 100%; }

.qm-dupwarn { display: none; margin-top: 10px; padding: 10px 12px; background: #fff5e0; border: 1px solid #f0d28a; border-radius: 10px; font-size: 13px; color: #8a5b00; }
.qm-dupwarn.show { display: block; }

.qm-modal-btns { display: flex; gap: 8px; margin-top: 16px; }
.qm-modal-btns .qm-btn { flex: 1; justify-content: center; padding: 11px; }

/* ---- read-only thought view --------------------------------------------- */
.tv-scroll { padding: 4px 2px 2px; }
.tv-head { border-bottom: 1px solid var(--qm-line); padding-bottom: 14px; margin-bottom: 16px; }
.tv-title { font-size: 22px; font-weight: 800; color: var(--qm-accent); line-height: 1.25; word-break: break-word; }
/* Favorite is a real pill button in its own row under the tags (Story 3560),
   never a bare glyph in front of the title. */
.tv-headbtns { display: flex; gap: 8px; margin-top: 12px; }
.tv-fav { -webkit-appearance: none; appearance: none; }
.tv-fav .ic { font-size: 17px; color: var(--qm-muted); }
.tv-fav.on { background: #fff7e0; border-color: #f0d28a; color: #8a5b00; }
.tv-fav.on .ic { color: var(--qm-gold); }
.tv-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin-top: 10px; font-size: 13px; }
.tv-facts dt { color: var(--qm-muted); font-weight: 600; }
.tv-facts dd { margin: 0; color: #20242e; word-break: break-word; }
.tv-section { margin-top: 16px; }
.tv-section h3 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--qm-muted); }
.tv-text { font-family: Georgia, "Times New Roman", serif; font-size: 16px; line-height: 1.6; color: #20242e; white-space: pre-wrap; word-break: break-word; }
.tv-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 10px; }

/* Permanent copies in Leonardo Files (Story 2458). One link per document, the
   file's size beside it so a tool and its write-up are told apart at a glance. */
.tv-files { list-style: none; margin: 0; padding: 0; }
.tv-files li { padding: 4px 0; word-break: break-word; }
.tv-files a { color: var(--qm-accent, #2b6cb0); text-decoration: none; font-weight: 600; }
.tv-files a:hover { text-decoration: underline; }
.tv-filesize { color: var(--qm-muted); font-size: 12px; }

/* Markdown, rendered (Story 2446). The Thinker writes markdown, so View shows
   it as a page -- headings, lists, quotes, rules -- not as raw asterisks. The
   pre-wrap of .tv-text is dropped here because the parser owns the whitespace. */
.tv-md { font-family: Georgia, "Times New Roman", serif; font-size: 16px; line-height: 1.6; color: #20242e; word-break: break-word; white-space: normal; }
.tv-md > :first-child { margin-top: 0; }
.tv-md > :last-child { margin-bottom: 0; }
.tv-md h1, .tv-md h2, .tv-md h3, .tv-md h4 {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--qm-accent); line-height: 1.25; margin: 18px 0 8px;
}
.tv-md h1 { font-size: 21px; } .tv-md h2 { font-size: 18px; } .tv-md h3 { font-size: 16px; } .tv-md h4 { font-size: 15px; }
.tv-md p { margin: 0 0 12px; }
.tv-md ul, .tv-md ol { margin: 0 0 12px; padding-left: 22px; }
.tv-md li { margin-bottom: 5px; }
.tv-md blockquote { margin: 0 0 12px; padding: 4px 0 4px 14px; border-left: 3px solid var(--qm-line); color: #444b59; font-style: italic; }
.tv-md hr { border: none; border-top: 1px solid var(--qm-line); margin: 18px 0; }
.tv-md a { color: var(--qm-accent); }
.tv-md code { font-family: Consolas, "Courier New", monospace; font-size: 13px; background: #f2f4f8; padding: 1px 5px; border-radius: 5px; }
.tv-md pre { background: #f2f4f8; padding: 10px 12px; border-radius: 10px; overflow-x: auto; }
.tv-md pre code { background: none; padding: 0; }
.tv-md table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 0 0 12px; }
.tv-md th, .tv-md td { border: 1px solid var(--qm-line); padding: 6px 9px; text-align: left; }
.tv-md th { background: #f4f8fa; }
.tv-md img { max-width: 100%; height: auto; }

/* ---- start a session panel ---------------------------------------------- */
.tk-startnote { margin: 0 0 4px; font-size: 13px; line-height: 1.5; color: var(--qm-muted); }

/* ---- sessions panel ----------------------------------------------------- */
.tk-sessions { display: flex; flex-direction: column; gap: 8px; }
.tk-session { border: 1px solid var(--qm-line); border-radius: 10px; padding: 10px 12px; }
.tk-session .n { font-weight: 800; color: var(--qm-accent); }
.tk-session .d { font-size: 12px; color: var(--qm-muted); }
.tk-session .p { font-size: 12px; color: #20242e; margin-top: 4px; }

.qm-statusbar { background: #232733; color: #aeb4c2; padding: 5px 12px; font-size: 11px; }

/* ---- comments (Story 2453) ----------------------------------------------
   Deliberately quiet. Comments cost the shelf nothing until they are asked
   for: a count on the Comments button when something is unanswered, and a
   panel that lists every comment collapsed to its title, newest first. */
.tk-badge {
    display: none; min-width: 18px; height: 18px; line-height: 18px;
    padding: 0 5px; border-radius: 999px;
    background: var(--qm-danger); color: #fff;
    font-size: 11px; font-weight: 700; text-align: center;
}
.tk-badge.show { display: inline-block; }

.tc-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.tc-count { font-size: 12px; color: var(--qm-muted); margin-left: auto; }

.tc-item { border: 1px solid var(--qm-line); border-radius: 10px; padding: 9px 11px; background: #fff; }
.tc-item.unanswered { border-left: 3px solid var(--qm-gold); }
.tc-head { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.tc-head .chev { color: var(--qm-muted); font-size: 12px; transition: transform .12s; }
.tc-item.open .tc-head .chev { transform: rotate(90deg); }
.tc-t { font-weight: 700; color: var(--qm-accent); word-break: break-word; }
.tc-flag {
    margin-left: auto; font-size: 10px; text-transform: uppercase; letter-spacing: .4px;
    color: #8a5b00; background: #fff5e0; border: 1px solid #f0d28a;
    border-radius: 999px; padding: 1px 7px; white-space: nowrap;
}
.tc-meta { font-size: 11px; color: var(--qm-muted); margin-top: 3px; }
.tc-body { display: none; margin-top: 8px; }
.tc-item.open .tc-body { display: block; }
.tc-text { font-size: 14px; line-height: 1.55; color: #20242e; white-space: pre-wrap; word-break: break-word; }
.tc-clip {
    display: block; margin-top: 8px; padding: 8px 12px; min-height: 40px;
    background: #f2f4f8; border: 1px solid var(--qm-line); border-radius: 10px;
    color: var(--qm-ink, #20242e); font: inherit; font-size: 13px; font-weight: 600;
    cursor: pointer;
}
.tc-on { font-size: 12px; color: var(--qm-muted); margin-top: 7px; }
.tc-link {
    font: inherit; font-size: 12px; font-weight: 600;
    background: none; border: none; padding: 0; cursor: pointer;
    color: var(--qm-accent); text-decoration: underline;
}
.tc-reply {
    margin-top: 9px; padding: 8px 10px;
    border-left: 3px solid var(--qm-accent); background: #f6f9fb; border-radius: 0 8px 8px 0;
}
.tc-rtitle {
    font-weight: 700; font-size: 13px; color: #20242e; margin: 2px 0 3px;
    display: flex; align-items: center; gap: 8px;
}

/* ---- unread answers (Story 3479) ----------------------------------------
   "Unanswered" already says nobody has replied, and it is drawn in gold. This
   says the opposite thing -- someone DID reply and Tony has not read it -- so it
   is drawn in the accent instead, because the two are different jobs and must
   never read as one mark. An unread answer sits on a tinted panel and carries
   the same read checkbox the essays carry; ticking it leaves plain history. */
.tc-reply.tc-unread { background: #eef5f9; border-left-width: 5px; }
/* Opening a thread marks its answers read, but the tint stays for that viewing
   so the answer that was new is still easy to find while reading it. */
.tc-reply.tc-justread { background: #eef5f9; border-left-width: 5px; }
.tc-rtitle .readmark { margin-left: auto; flex: 0 0 auto; }
.tc-newflag {
    font-size: 10px; text-transform: uppercase; letter-spacing: .4px;
    color: #fff; background: var(--qm-accent); border: 1px solid var(--qm-accent);
    border-radius: 999px; padding: 1px 7px; white-space: nowrap;
}
.tc-item.tc-hasnew { border-left: 3px solid var(--qm-accent); }
/* The second badge on the Comments button: unread answers, not unanswered
   comments. Different colour so the two counts are never read as one. */
.tk-badge-new { background: var(--qm-accent); color: #fff; }
.tc-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.tc-acts .qm-btn { font-size: 12px; padding: 5px 11px; }
.tc-acts .qm-btn.danger { color: var(--qm-danger); border-color: #f0c6cd; }

/* The section inside one thought: a heading, the way to add the first one,
   and then the comments already there. */
.tv-comments { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.tc-secthead { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--qm-line); padding-top: 14px; }
.tc-secthead h3 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--qm-muted); }
.tc-secthead .qm-btn { margin-left: auto; font-size: 12px; padding: 6px 12px; }
