/* Comments on an issue (assets/js/comments.js). One thread, drawn the same
   way in a worksheet card, the issue drawer and the dashboard. */

.cmt {
    font-size: var(--fs-sm);
}

.cmt-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 14px;
}

.cmt-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.cmt-av {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 50%;
    color: #fff;
    font-size: var(--fs-2xs);
    font-weight: 700;
}

.cmt-av--sm {
    width: 24px;
    height: 24px;
    font-size: var(--fs-2xs);
}

.cmt-main {
    flex: 1;
    min-width: 0;
}

.cmt-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

/* The comment a notification pointed at: an amber wash with a left bar that
   eases away after a few seconds, so the eye lands on it without it staying
   marked. Only the message itself — not the replies nested beneath it. */
.cmt-msg {
    border-radius: var(--r-sm);
}

.cmt-flash > .cmt-main > .cmt-msg {
    margin: -6px -8px;
    padding: 6px 8px;
    animation: cmt-flash 4.5s ease-out forwards;
}

@keyframes cmt-flash {
    0%, 55% {
        background: var(--warning-soft);
        box-shadow: inset 3px 0 0 var(--amber), 0 0 0 1px var(--warning-line);
    }
    100% {
        background: transparent;
        box-shadow: inset 3px 0 0 transparent, 0 0 0 1px transparent;
    }
}

.cmt-who {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--ink);
}

.cmt-you {
    padding: 1px 6px;
    border-radius: var(--r-pill);
    background: var(--primary-soft-2);
    color: var(--primary);
    font-size: var(--fs-2xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.cmt-when {
    font-size: var(--fs-2xs);
    color: var(--muted-ink);
}

/* A quiet marker once a comment has been changed since it was first posted
   — the reader is trusting words that were not what was originally typed. */
.cmt-edited {
    font-size: var(--fs-2xs);
    color: var(--faint-ink);
    font-style: italic;
}

.cmt-body {
    margin: 3px 0 0;
    line-height: 1.55;
    color: var(--ink-3);
    overflow-wrap: anywhere;
}

.cmt-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 5px;
}

.cmt-link {
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    font-size: var(--fs-2xs);
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
}

.cmt-link:hover {
    text-decoration: underline;
}

/* Delete reads as a plain action alongside Reply and Edit rather than a
   corner ×, but it should still not look interchangeable with them. */
.cmt-link--danger {
    color: var(--muted-ink);
}

.cmt-link--danger:hover {
    color: var(--danger);
}

.cmt-count {
    font-size: var(--fs-2xs);
    color: var(--muted-ink);
}

/* Replies sit under their comment, on a rule that makes the thread read as
   one conversation rather than a flat list. */
.cmt-replies {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 10px 0 0;
    padding-inline-start: 12px;
    border-inline-start: 2px solid var(--line);
}

.cmt-none {
    margin: 0 0 14px;
    padding: 14px;
    border-radius: var(--r-sm);
    background: var(--surface-2);
    font-size: var(--fs-xs);
    color: var(--muted-ink);
    line-height: 1.5;
}

.cmt-note {
    margin: 0;
    font-size: var(--fs-xs);
    color: var(--muted-ink);
}

.cmt-note--bad {
    color: var(--danger-ink);
}

/* ── the write box ─────────────────────────────────────────────
   Carries your own avatar and starts at one line, growing with what is
   typed (patCmtAutoGrow in comments.js) — a chat composer, not a bare
   textarea dropped under the thread. */
.cmt-box {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.cmt-box--reply {
    margin-top: 10px;
}

/* Replacing the body text in place, not appended under it. */
.cmt-box--edit {
    margin-top: 4px;
}

.cmt-edit-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cmt-box__field {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    padding: 8px 10px;
    transition: border-color .15s, box-shadow .15s;
}

.cmt-box__field:focus-within {
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

/* The field owns the focus ring now, so the textarea itself stays bare —
   otherwise a click near the edge shows two competing outlines. */
.cmt-input {
    width: 100%;
    max-height: 220px;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-size: var(--fs-sm);
    line-height: 1.5;
    color: var(--ink);
    resize: none;
    outline: none;
    overflow-y: auto;
}

.cmt-input::placeholder {
    color: var(--faint-ink);
}

.cmt-box__foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* Only worth saying once there is something to post; an empty box does not
   need to be told how to be submitted. */
.cmt-input:placeholder-shown ~ .cmt-box__foot .cmt-hint {
    display: none;
}

.cmt-hint {
    font-size: var(--fs-2xs);
    color: var(--muted-ink);
}

.cmt-send {
    padding: 6px 14px;
    border: 1px solid var(--primary);
    border-radius: var(--r-pill);
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-size: var(--fs-xs);
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s, opacity .15s;
}

.cmt-send:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.cmt-send:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Present but quiet until there is something to send — the pill only
   asserts itself once it does something. */
.cmt-input:placeholder-shown ~ .cmt-box__foot .cmt-send {
    opacity: .45;
}

/* ── the count chip on an issue row ─────────────────────────── */
.cmt-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 7px;
    border: none;
    border-radius: var(--r-pill);
    background: var(--surface-3);
    color: var(--ink-3);
    font: inherit;
    font-size: var(--fs-2xs);
    font-weight: 600;
    cursor: pointer;
    transition: background-color .12s, color .12s;
}

.cmt-chip:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

/* An issue with nothing said about it shows no chip at all. The `hidden`
   attribute alone cannot do that here: the UA rule it relies on is
   `display: none`, which the `display: inline-flex` above outranks. */
.cmt-chip[hidden],
[data-cmt-count][hidden] {
    display: none;
}

/* View-only access (or a goal handed away): the thread is read, never written to (comments.js). */
.cmt-note--ro {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 10px;
    padding: 8px 12px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-md);
    background: var(--surface-2);
}
