.comment-item {
    border-top: 1px solid var(--color-border);
    padding: 0.5em 1.8em 1.5em 0.5em;
    position: relative;
}

.comment-item.selected-for-move {
    background-color: var(--color-section-bg);
    border-color: var(--color-border);
    -webkit-user-select: none;
    user-select: none;
}

.comment-user-menu {
    vertical-align: middle;
}

.comment-user-menu-trigger {
    display: inline-flex;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    vertical-align: middle;
}

.comment-user-menu-trigger:focus-visible {
    outline: 2px solid var(--color-active);
    outline-offset: 2px;
}

.comment-user-popup {
    width: 240px;
    min-width: 240px;
    overscroll-behavior: contain;
    padding: var(--space-2);
}

.comment-user-popup .popup-menu-item {
    box-sizing: border-box;
    white-space: normal;
    overflow-wrap: anywhere;
}

.comment-user-popup-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-2) var(--space-2);
}

.comment-user-popup-identity {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.comment-user-popup-email {
    overflow: hidden;
    color: var(--text-muted);
    font-size: var(--text-0);
    text-overflow: ellipsis;
}

.comment-user-popup-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--text-muted);
    font-size: var(--text-0);
}

.comment-user-popup-status.is-offline [data-comment-user-menu-target="statusLabel"] {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.comment-user-popup-status-dot {
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
}

.comment-user-popup-status.is-online .comment-user-popup-status-dot {
    background: var(--color-success);
}

.comment-user-popup-status.is-check_error .comment-user-popup-status-dot {
    background: var(--color-danger);
}

.comment-user-popup-status.is-unknown .comment-user-popup-status-dot {
    background: var(--color-warning);
}

.comment-user-popup-guide {
    margin: var(--space-2) var(--space-2) var(--space-1);
    padding-top: var(--space-2);
    border-top: 1px solid var(--color-border);
    color: var(--text-muted);
    font-size: var(--text-0);
    line-height: 1.4;
}

.comment-select {
    position: absolute;
    top: 0.4em;
    right: 0.2em;
}

.comment-select-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.comment-content {
    margin-top: 0.2em;
}

.comment-content img,
.comment-content video {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-2);
}

.comment-content img[src]:not([src=""]) {
    cursor: zoom-in;
}

.comment-content pre {
    white-space: pre-wrap;
    word-break: break-word;
}

.comment-content pre code {
    white-space: pre-wrap;
    word-break: break-word;
}

.comment-quoted-block {
    margin-top: 0.3em;
    margin-bottom: 0.2em;
}

.comment-quoted-text,
.comment-content blockquote {
    border-left: 3px solid var(--color-border);
    padding: 0.2em 0.6em;
    margin: 0 0 0.3em 0;
    color: var(--color-muted);
    font-size: 0.9em;
    background: color-mix(in srgb, var(--color-section-bg) 50%, transparent);
    border-radius: 0 4px 4px 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.comment-content blockquote p {
    margin: 0;
}

/* Table + download-toolbar styling moved to collavre/tables.css (shared with
   creative description tables). Load 'collavre/tables' alongside this file. */

/* Quote indicator in form */
.comment-quote-indicator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3em 0.6em;
    margin-bottom: 0.3em;
    background: color-mix(in srgb, var(--color-section-bg) 50%, transparent);
    border-left: 3px solid var(--color-active);
    border-radius: 0 4px 4px 0;
    font-size: 0.85em;
    color: var(--color-muted);
}

.comment-quote-indicator-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.comment-quote-cancel {
    border: none;
    background: none;
    cursor: pointer;
    color: var(--color-muted);
    font-size: 1.1em;
    padding: 0 0.2em;
    line-height: 1;
    flex-shrink: 0;
}

.comment-quote-cancel:hover {
    color: var(--color-text);
}

/* Review quote chips */
.review-quotes-container {
    display: flex;
    flex-direction: column;
    gap: 0.25em;
    padding: 0.4em 0.5em;
    max-height: 8em;
    overflow-y: auto;
}

.review-quote-chip {
    display: flex;
    align-items: center;
    gap: 0.3em;
    padding: 0.25em 0.5em;
    background: color-mix(in srgb, var(--color-section-bg) 50%, transparent);
    border-left: 3px solid var(--color-muted);
    border-radius: 0 var(--radius-2) var(--radius-2) 0;
    font-size: var(--text-0);
    color: var(--color-muted);
    line-height: 1.3;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.review-quote-chip--active {
    border-left-color: var(--color-active);
    background: color-mix(in srgb, var(--color-active) 8%, transparent);
}

.review-quote-type-toggle {
    border: none;
    background: none;
    cursor: pointer;
    padding: 0 0.1em;
    font-size: 0.85em;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0.8;
    transition: opacity 0.15s ease;
}

.review-quote-type-toggle:hover {
    opacity: 1;
}

.review-quote-chip-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.review-quote-chip-text:hover {
    color: var(--color-text);
}

.review-quote-chip-feedback {
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85em;
    color: var(--color-text);
    opacity: 0.7;
}

.review-quote-chip-remove {
    border: none;
    background: none;
    cursor: pointer;
    color: var(--color-muted);
    font-size: 1em;
    padding: 0 0.15em;
    line-height: 1;
    flex-shrink: 0;
}

.review-quote-chip-remove:hover {
    color: var(--color-danger);
}

.review-submit-btn {
    font-size: var(--text-0) !important;
    white-space: nowrap;
}

.inbox-reply-btn {
    font-size: var(--text-0) !important;
    white-space: nowrap;
}

.comment-highlight {
    background: color-mix(in srgb, var(--color-active) 15%, transparent) !important;
    transition: background 0.3s ease;
}

/* Review popup (uses common-popup) */
.comment-review-popup {
    min-width: auto;
}

.comment-review-popup .common-popup-item {
    padding: 0.3em 0.8em;
    font-size: 0.85em;
    cursor: pointer;
    border-radius: var(--radius-2);
    white-space: nowrap;
}

/* Review / Ask side by side, in chat and in document mode */
.quote-selection-popup ul {
    display: flex;
    gap: 0.2em;
}

/* Document-mode quotes */
.review-quote-chip-source {
    margin-right: 0.4em;
    color: var(--color-muted);
    font-size: 0.9em;
}

.comment-creative-quote-source {
    display: inline-block;
    margin-top: 0.3em;
    font-size: 0.8em;
    color: var(--color-muted);
    text-decoration: none;
}

.comment-creative-quote-source:hover {
    color: var(--color-text);
    text-decoration: underline;
}

.creative-quote-review {
    margin-top: 0.5em;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2);
    padding: 0.4em 0.6em;
}

.creative-quote-review > details > summary {
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
}

.creative-quote-review .creative-history-state {
    margin-left: 0.4em;
    font-weight: normal;
    color: var(--color-muted);
}

.creative-quote-review-warning {
    margin: 0.4em 0;
    font-size: 0.8em;
}

.creative-quote-highlight {
    background: color-mix(in srgb, var(--color-active) 15%, transparent);
    transition: background 0.3s ease;
}
