/* Comments (app/comments/web): the thread a screen puts in a slot, the
 * @ autocomplete and the plan grid's badge. The card is the series panel's
 * own (.spc); the rest sits on the theme tokens so dark mode follows. */

.cmt { --cmt-at: #2F6BFF; }
:root[data-theme="dark"] .cmt { --cmt-at: #8AB4FF; }
.cmt .spc-title span { text-transform: none; }

.cmt-list, .cmt-replies { list-style: none; margin: 0; padding: 0; }
.cmt-item + .cmt-item { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.cmt-replies { margin: 8px 0 0 34px; display: grid; gap: 8px; }

.cmt-c { display: flex; gap: 10px; align-items: flex-start; }
.cmt-av { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--hover); color: var(--text-2); font-size: 10px; font-weight: 700; letter-spacing: .3px; }
.cmt-c.is-reply .cmt-av { width: 20px; height: 20px; font-size: 9px; }
.cmt-main { flex: 1; min-width: 0; }
.cmt-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: 12px; }
.cmt-who { font-weight: 600; color: var(--text); }
.cmt-who.muted, .cmt-c.is-deleted .cmt-who { font-weight: 400; font-style: italic; color: var(--muted); }
.cmt-when, .cmt-edited { color: var(--muted); font-size: 11px; }
.cmt-body { margin: 3px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
/* A verdict's entry: what was done, the number in bold, the motivo pill. */
.cmt-ev { color: var(--text-2); }
.cmt-ev b { color: var(--text); font-weight: 700; }
.cmt-ev-d.pos { color: var(--success); font-weight: 600; }
.cmt-ev-d.neg { color: var(--error); font-weight: 600; }
.cmt-ev-flagged { color: var(--warning); }
.cmt-pill { display: inline-flex; align-items: center; height: 18px; padding: 0 8px; border-radius: 999px; font-size: 10.5px; font-weight: 600; color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); }
.cmt-at { color: var(--cmt-at); font-weight: 600; background: color-mix(in srgb, var(--cmt-at) 12%, transparent); border-radius: 4px; padding: 0 2px; }

.cmt-acts { display: flex; gap: 12px; margin-top: 4px; }
.cmt-link { font-size: 11.5px; color: var(--text-2); padding: 0; background: none; border: 0; cursor: pointer; }
.cmt-link:hover { color: var(--text); text-decoration: underline; }
.cmt-del:hover { color: var(--error); }

.cmt-form { margin-top: 8px; }
.cmt-new { margin-top: 12px; }
.cmt-field { position: relative; }
.cmt-field textarea { width: 100%; box-sizing: border-box; min-height: 52px; resize: vertical; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: 12.5px; line-height: 1.4; }
.cmt-field textarea:focus { outline: none; border-color: var(--primary); }
.cmt-row { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 6px; }
.cmt-hint { margin-right: auto; font-size: 10.5px; color: var(--muted); }
.cmt-send { height: 28px; padding: 0 12px; border-radius: 6px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 500; border: 0; cursor: pointer; }
.cmt-send:hover { filter: brightness(.95); }
.cmt.htmx-request .cmt-send, .cmt-form.htmx-request .cmt-send { opacity: .6; pointer-events: none; }

.cmt-empty, .cmt-ro { margin: 0; font-size: 12px; color: var(--muted); }
.cmt-ro { margin-top: 10px; }
.cmt-error { margin: 10px 0 0; font-size: 12px; color: var(--error); }
.cmt-sk { display: block; height: 12px; margin: 4px 0; }
.cmt-sk.short { width: 60%; }

/* The @ autocomplete. It hangs from <body>, fixed, placed by comments.js
 * (place): under the box, or over it in the series panel and wherever
 * there is no room below, so no scrolling panel or footer clips it; past
 * its max height it scrolls on its own. Over the side panel (z 81) and the
 * plan's menus (95). */
.cmt-ac { position: fixed; z-index: 130; box-sizing: border-box; max-height: 220px; overflow-y: auto; overscroll-behavior: contain; background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, .14); padding: 4px; }
.cmt-ac.is-up { box-shadow: 0 -6px 18px rgba(0, 0, 0, .14); }
.cmt-ac-opt { display: flex; align-items: baseline; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 12.5px; }
.cmt-ac-opt b { font-weight: 600; color: var(--text); }
.cmt-ac-opt span { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmt-ac-opt.is-on, .cmt-ac-opt:hover { background: var(--hover); }
.cmt-ac-none { padding: 6px 8px; font-size: 12px; color: var(--muted); }

/* A step of Ciclo S&OP: the thread folds under its row. */
.sop-cthread { padding: 0 18px 12px 46px; }
.sop-cthread + .sop-crow { border-top: 1px solid var(--border); }
.cmt-fold > summary { cursor: pointer; font-size: 11.5px; color: var(--text-2); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.cmt-fold > summary::-webkit-details-marker { display: none; }
.cmt-fold > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 120ms linear; }
.cmt-fold[open] > summary::before { transform: rotate(45deg); }
.cmt-fold-body { margin-top: 8px; max-width: 640px; }
.cmt-fold-body .cmt { margin-bottom: 0; }

/* The plan grid: comments on a series row. */
.cmt-badge { display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; padding: 0 6px; height: 16px; border-radius: 8px; background: var(--hover); color: var(--text-2); font-size: 10px; font-weight: 600; line-height: 16px; font-variant-numeric: tabular-nums; flex: none; }
.cmt-badge::before { content: ""; width: 9px; height: 8px; border: 1.4px solid currentColor; border-radius: 2px 2px 2px 0; box-sizing: border-box; }
