/* PCV Filament Messenger. Plain CSS, so the host's Tailwind build needs no
   configuration. Colors come from --pcvm-* (set from the config), falling
   back to the panel's own palette. */

.pcvm {
    --pcvm-accent: var(--pcvm-primary, var(--primary-600, #4f46e5));
    --pcvm-accent-text: var(--pcvm-primary-text, #fff);
    --pcvm-surface: #fff;
    --pcvm-surface-alt: var(--gray-50, #f9fafb);
    --pcvm-border: var(--gray-200, #e5e7eb);
    --pcvm-text: var(--gray-950, #030712);
    --pcvm-muted: var(--gray-500, #6b7280);
    --pcvm-in-bg: var(--pcvm-incoming, var(--gray-100, #f3f4f6));
    --pcvm-in-text: var(--pcvm-incoming-text, var(--gray-950, #030712));
    --pcvm-check-color: var(--pcvm-check, #9ca3af);
    --pcvm-check-read-color: var(--pcvm-check-read, #3b82f6);
    --pcvm-online-color: var(--pcvm-online, #22c55e);
    --pcvm-offline-color: var(--pcvm-offline, #ef4444);
    --pcvm-badge-color: var(--pcvm-badge, #ef4444);
    --pcvm-radius: 1rem;

    font-size: 0.875rem;
    line-height: 1.35;
    color: var(--pcvm-text);
}

.dark .pcvm {
    --pcvm-surface: var(--gray-900, #111827);
    --pcvm-surface-alt: var(--gray-950, #030712);
    --pcvm-border: rgb(255 255 255 / 0.1);
    --pcvm-text: #fff;
    --pcvm-muted: var(--gray-400, #9ca3af);
    --pcvm-in-bg: var(--pcvm-incoming, var(--gray-800, #1f2937));
    --pcvm-in-text: var(--pcvm-incoming-text, #fff);
}

.pcvm [x-cloak] {
    display: none !important;
}

.pcvm button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
}

.pcvm svg {
    flex-shrink: 0;
}

/* Bubble -------------------------------------------------------------- */

.pcvm-bubble {
    position: fixed;
    bottom: var(--pcvm-y, 1.5rem);
    z-index: var(--pcvm-z, 40);
    display: grid;
    place-items: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 9999px;
    background: var(--pcvm-accent) !important;
    color: var(--pcvm-accent-text) !important;
    box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.25), 0 4px 10px -6px rgb(0 0 0 / 0.2);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pcvm--right .pcvm-bubble { right: var(--pcvm-x, 1.5rem); }
.pcvm--left .pcvm-bubble { left: var(--pcvm-x, 1.5rem); }

.pcvm-bubble:hover { transform: scale(1.06); }
.pcvm-bubble.is-disabled { background: var(--pcvm-muted) !important; opacity: 0.75; }
.pcvm-bubble:focus-visible { outline: 3px solid color-mix(in srgb, var(--pcvm-accent) 40%, transparent); outline-offset: 3px; }
.pcvm-bubble svg { width: 1.6rem; height: 1.6rem; }

.pcvm-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1rem;
    height: 1rem;
    padding: 0 0.25rem;
    border-radius: 9999px;
    background: var(--pcvm-badge-color);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1;
}

/* Counters pinned to the top-right corner of what they count. */
.pcvm-bubble-badge,
.pcvm-avatar-badge {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    z-index: 1;
    box-shadow: 0 0 0 2px var(--pcvm-surface);
}

.pcvm-avatar-badge {
    top: -0.3rem;
    right: -0.35rem;
    min-width: 0.95rem;
    height: 0.95rem;
    font-size: 0.5625rem;
    box-shadow: 0 0 0 2px var(--pcvm-surface-alt);
}

/* Window -------------------------------------------------------------- */

.pcvm-window {
    position: fixed;
    bottom: calc(var(--pcvm-y, 1.5rem) + 4.25rem);
    z-index: var(--pcvm-z, 40);
    display: flex;
    flex-direction: column;
    width: min(46rem, calc(100vw - 2 * var(--pcvm-x, 1.5rem)));
    height: min(36rem, calc(100vh - var(--pcvm-y, 1.5rem) - 6rem));
    overflow: hidden;
    border: 1px solid var(--pcvm-border);
    border-radius: var(--pcvm-radius);
    background: var(--pcvm-surface);
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.3);
}

.pcvm--right .pcvm-window { right: var(--pcvm-x, 1.5rem); transform-origin: bottom right; }
.pcvm--left .pcvm-window { left: var(--pcvm-x, 1.5rem); transform-origin: bottom left; }

.pcvm-enter { transition: opacity 0.15s ease, transform 0.15s ease; }
.pcvm-leave { transition: opacity 0.1s ease, transform 0.1s ease; }
.pcvm-enter-start { opacity: 0; transform: scale(0.96) translateY(0.5rem); }

.pcvm-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--pcvm-border);
}

.pcvm-title {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.pcvm-icon-button {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    color: var(--pcvm-muted) !important;
    cursor: pointer;
}

.pcvm-icon-button:hover { background: var(--pcvm-surface-alt) !important; color: var(--pcvm-text) !important; }
.pcvm-icon-button svg { width: 1.25rem; height: 1.25rem; }

.pcvm-list-toggle { display: none !important; }
.pcvm-icon-button--danger:hover { background: color-mix(in srgb, var(--pcvm-badge-color) 12%, transparent) !important; color: var(--pcvm-badge-color) !important; }
.pcvm-icon-button.is-active { background: color-mix(in srgb, var(--pcvm-accent) 14%, transparent) !important; color: var(--pcvm-accent) !important; }

.pcvm-loading {
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--pcvm-border);
    border-top-color: var(--pcvm-accent);
    border-radius: 9999px;
    animation: pcvm-spin 0.7s linear infinite;
}

@keyframes pcvm-spin { to { transform: rotate(360deg); } }

.pcvm-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* People -------------------------------------------------------------- */

.pcvm-people {
    display: flex;
    flex-direction: column;
    width: 15rem;
    flex-shrink: 0;
    border-right: 1px solid var(--pcvm-border);
    background: var(--pcvm-surface-alt);
}

.pcvm-search {
    position: relative;
    padding: 0.625rem;
}

.pcvm-search svg {
    position: absolute;
    top: 50%;
    left: 1.25rem;
    width: 1rem;
    height: 1rem;
    color: var(--pcvm-muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.pcvm-search input {
    width: 100%;
    padding: 0.45rem 0.625rem 0.45rem 2rem;
    border: 1px solid var(--pcvm-border);
    border-radius: 0.5rem;
    background: var(--pcvm-surface);
    color: var(--pcvm-text);
    font-size: 0.8125rem;
    outline: none;
}

.pcvm-search input:focus { border-color: var(--pcvm-accent); box-shadow: 0 0 0 1px var(--pcvm-accent); }

.pcvm-people-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 0.375rem;
}

.pcvm-section {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin: 0.5rem 0 0.25rem;
    padding: 0 0.875rem;
    color: var(--pcvm-muted);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.pcvm-section span {
    padding: 0 0.375rem;
    border-radius: 9999px;
    background: color-mix(in srgb, var(--pcvm-text) 8%, transparent);
    font-size: 0.625rem;
    letter-spacing: 0;
}

.pcvm-people-list {
    margin: 0;
    padding: 0 0.375rem;
    list-style: none;
}

.pcvm-person {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.5rem;
    border-radius: 0.625rem;
    text-align: start;
}

.pcvm-person:hover { background: color-mix(in srgb, var(--pcvm-text) 5%, transparent) !important; }
.pcvm-person.is-active { background: color-mix(in srgb, var(--pcvm-accent) 12%, transparent) !important; }
.pcvm-person.is-static { cursor: default; }
.pcvm-person.is-static:hover { background: none !important; }
.pcvm-person.is-disabled .pcvm-person-text { opacity: 0.55; }
label.pcvm-person { cursor: pointer; }

.pcvm-person-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.pcvm-person-name,
.pcvm-person-preview,
.pcvm-file-name {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.pcvm-person-name { font-weight: 500; }
.pcvm-person.has-unread .pcvm-person-name { font-weight: 700; }
.pcvm-person-preview { color: var(--pcvm-muted); font-size: 0.75rem; }
.pcvm-person.has-unread .pcvm-person-preview { color: var(--pcvm-text); }

.pcvm-person-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    color: var(--pcvm-muted);
    font-size: 0.6875rem;
}

/* Avatars & presence -------------------------------------------------- */

.pcvm-avatar {
    position: relative;
    display: inline-grid;
    flex-shrink: 0;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9999px;
    background: color-mix(in srgb, var(--pcvm-accent) 18%, var(--pcvm-surface));
    color: var(--pcvm-accent);
    font-size: 0.75rem;
    font-weight: 600;
}

.dark .pcvm-avatar {
    background: color-mix(in srgb, var(--pcvm-accent) 45%, var(--pcvm-surface));
    color: #fff;
}

.pcvm-avatar--sm { width: 1.5rem; height: 1.5rem; font-size: 0.625rem; }

.pcvm-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 9999px;
    object-fit: cover;
}

.pcvm-presence {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 0.7rem;
    height: 0.7rem;
    border: 2px solid var(--pcvm-surface-alt);
    border-radius: 9999px;
    background: var(--pcvm-offline-color);
    transition: background-color 0.2s ease;
}

.pcvm-avatar--sm .pcvm-presence { width: 0.55rem; height: 0.55rem; }
.pcvm-presence.is-online { background: var(--pcvm-online-color); }
.pcvm-presence.is-offline { background: var(--pcvm-offline-color); }

.pcvm-avatar.is-group svg { width: 60%; height: 60%; }

/* Panes ---------------------------------------------------------------- */

.pcvm-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.pcvm-conversation-header {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.875rem;
    border-bottom: 1px solid var(--pcvm-border);
}

.pcvm-conversation-header .pcvm-presence { border-color: var(--pcvm-surface); }
.pcvm-conversation-text { flex: 1; min-width: 0; }
.pcvm-conversation-name { font-weight: 600; }
.pcvm-conversation-status { color: var(--pcvm-muted); font-size: 0.75rem; }

/* Panes: settings, new group, members -------------------------------- */

.pcvm-pane {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.pcvm-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid var(--pcvm-border);
}

.pcvm-pane-header h3 { margin: 0; font-size: 0.9375rem; font-weight: 600; }

.pcvm-pane-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 0;
    padding: 0.75rem 0.875rem;
    overflow-y: auto;
}

.pcvm-pane-body .pcvm-section,
.pcvm-pane-body .pcvm-people-list { padding-left: 0; padding-right: 0; }

.pcvm-pane-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.625rem 0.875rem;
    border-top: 1px solid var(--pcvm-border);
    color: var(--pcvm-muted);
    font-size: 0.75rem;
}

.pcvm-field { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.pcvm-field span { color: var(--pcvm-muted); font-size: 0.75rem; font-weight: 500; }

.pcvm-field input {
    width: 100%;
    padding: 0.45rem 0.625rem;
    border: 1px solid var(--pcvm-border);
    border-radius: 0.5rem;
    background: var(--pcvm-surface-alt);
    color: var(--pcvm-text);
    font: inherit;
    outline: none;
}

.pcvm-field input:focus { border-color: var(--pcvm-accent); box-shadow: 0 0 0 1px var(--pcvm-accent); }
.pcvm-field-error { margin: 0; color: var(--pcvm-badge-color); font-size: 0.75rem; }

.pcvm-inline-form { display: flex; align-items: flex-end; gap: 0.5rem; }

.pcvm-search--inline { padding: 0; }
.pcvm-search--inline svg { left: 0.625rem; }
.pcvm-picker { max-height: 14rem; overflow-y: auto; }

.pcvm-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.875rem;
    border-radius: 0.5rem;
    background: var(--pcvm-accent) !important;
    color: var(--pcvm-accent-text) !important;
    font-weight: 600 !important;
    font-size: 0.8125rem !important;
    white-space: nowrap;
}

.pcvm-button:disabled { opacity: 0.6; }
.pcvm-button--secondary { background: var(--pcvm-surface-alt) !important; color: var(--pcvm-text) !important; border: 1px solid var(--pcvm-border) !important; }
.pcvm-button--danger { background: transparent !important; color: var(--pcvm-badge-color) !important; border: 1px solid color-mix(in srgb, var(--pcvm-badge-color) 40%, transparent) !important; }

.pcvm-tag {
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    background: color-mix(in srgb, var(--pcvm-accent) 14%, transparent);
    color: var(--pcvm-accent);
    font-size: 0.6875rem;
    font-weight: 600;
}

.pcvm-checkbox { width: 1rem; height: 1rem; accent-color: var(--pcvm-accent); }

.pcvm-notice {
    margin: 0;
    padding: 0.625rem 0.75rem;
    border-radius: 0.625rem;
    background: color-mix(in srgb, var(--pcvm-accent) 10%, transparent);
    color: var(--pcvm-text);
    font-size: 0.8125rem;
}

.pcvm-notice--composer {
    margin: 0.625rem;
    color: var(--pcvm-muted);
    text-align: center;
}

.pcvm-switch-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--pcvm-border);
    cursor: pointer;
}

.pcvm-switch-row.is-muted { opacity: 0.5; cursor: not-allowed; }
.pcvm-switch-text { display: flex; flex: 1; flex-direction: column; gap: 0.125rem; }
.pcvm-switch-label { font-weight: 600; }
.pcvm-switch-help { color: var(--pcvm-muted); font-size: 0.75rem; }

.pcvm-switch {
    position: relative;
    flex-shrink: 0;
    width: 2.5rem;
    height: 1.4rem;
    margin: 0;
    border-radius: 9999px;
    background: var(--pcvm-border);
    appearance: none;
    cursor: inherit;
    transition: background-color 0.15s ease;
}

.pcvm-switch::after {
    position: absolute;
    top: 0.15rem;
    left: 0.15rem;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 9999px;
    background: #fff;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
    content: '';
    transition: transform 0.15s ease;
}

.pcvm-switch:checked { background: var(--pcvm-accent); }
.pcvm-switch:checked::after { transform: translateX(1.1rem); }
.pcvm-switch:focus-visible { outline: 2px solid var(--pcvm-accent); outline-offset: 2px; }

/* Popovers -------------------------------------------------------------- */

.pcvm-popovers {
    position: fixed;
    bottom: calc(var(--pcvm-y, 1.5rem) + 4.25rem);
    z-index: var(--pcvm-z, 40);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: min(20rem, calc(100vw - 2 * var(--pcvm-x, 1.5rem)));
}

.pcvm--right .pcvm-popovers { right: var(--pcvm-x, 1.5rem); align-items: flex-end; }
.pcvm--left .pcvm-popovers { left: var(--pcvm-x, 1.5rem); align-items: flex-start; }

.pcvm-popover {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    width: 100%;
    padding: 0.625rem 2rem 0.625rem 0.625rem;
    border: 1px solid var(--pcvm-border);
    border-radius: 1rem;
    border-bottom-right-radius: 0.25rem;
    background: var(--pcvm-surface);
    box-shadow: 0 12px 30px -8px rgb(0 0 0 / 0.3);
    cursor: pointer;
    animation: pcvm-pop 0.2s ease-out;
}

.pcvm--left .pcvm-popover { border-bottom-right-radius: 1rem; border-bottom-left-radius: 0.25rem; }
.pcvm-popover:hover { border-color: var(--pcvm-accent); }

@keyframes pcvm-pop {
    from { opacity: 0; transform: translateY(0.5rem) scale(0.97); }
}

.pcvm-popover-text { display: flex; flex: 1; flex-direction: column; min-width: 0; gap: 0.125rem; }
.pcvm-popover-title { font-weight: 600; }

.pcvm-popover-preview {
    display: -webkit-box;
    overflow: hidden;
    color: var(--pcvm-muted);
    font-size: 0.8125rem;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.pcvm-popover-close {
    position: absolute;
    top: 0.375rem;
    right: 0.375rem;
    display: grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 9999px;
    color: var(--pcvm-muted) !important;
}

.pcvm-popover-close:hover { background: var(--pcvm-surface-alt) !important; }
.pcvm-popover-close svg { width: 0.875rem; height: 0.875rem; }

/* Messages ------------------------------------------------------------ */

.pcvm-messages {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 0.875rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.pcvm-load-more {
    align-self: center;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    background: var(--pcvm-surface-alt) !important;
    color: var(--pcvm-muted) !important;
    font-size: 0.75rem !important;
}

.pcvm-day {
    align-self: center;
    margin: 0.5rem 0;
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    background: var(--pcvm-surface-alt);
    color: var(--pcvm-muted);
    font-size: 0.6875rem;
}

.pcvm-message {
    display: flex;
    max-width: 80%;
}

.pcvm-message-sender {
    color: var(--pcvm-accent);
    font-size: 0.75rem;
    font-weight: 600;
}

.dark .pcvm-message-sender { color: color-mix(in srgb, var(--pcvm-accent) 60%, #fff); }

.pcvm-system {
    align-self: center;
    max-width: 90%;
    margin: 0.25rem 0;
    color: var(--pcvm-muted);
    font-size: 0.75rem;
    font-style: italic;
    text-align: center;
}

.pcvm-message.is-mine { align-self: flex-end; }
.pcvm-message.is-theirs { align-self: flex-start; }

.pcvm-message-bubble {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 4.5rem;
    padding: 0.375rem 0.625rem 0.25rem;
    border-radius: 1rem;
    overflow-wrap: anywhere;
}

.is-mine .pcvm-message-bubble {
    border-bottom-right-radius: 0.25rem;
    background: var(--pcvm-accent);
    color: var(--pcvm-accent-text);
}

.is-theirs .pcvm-message-bubble {
    border-bottom-left-radius: 0.25rem;
    background: var(--pcvm-in-bg);
    color: var(--pcvm-in-text);
}

.pcvm-message-text a { text-decoration: underline; color: inherit; }

.pcvm-message-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
    font-size: 0.625rem;
    opacity: 0.8;
}

.pcvm-checks { display: inline-flex; color: var(--pcvm-check-color); }
.is-mine .pcvm-checks { color: color-mix(in srgb, var(--pcvm-check-color) 55%, var(--pcvm-accent-text)); }
.pcvm-checks--read,
.is-mine .pcvm-checks--read { color: var(--pcvm-check-read-color); }

.is-mine .pcvm-checks--read {
    padding: 0 0.125rem;
    border-radius: 0.25rem;
    background: rgb(255 255 255 / 0.9);
}

/* Attachments --------------------------------------------------------- */

.pcvm-attachments {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.25rem;
    margin: 0.125rem -0.375rem 0;
}

.pcvm-attachments.is-single { grid-template-columns: minmax(0, 1fr); }

.pcvm-thumb {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 1;
    min-width: 6rem;
    border-radius: 0.75rem;
    background: rgb(0 0 0 / 0.08) !important;
    padding: 0 !important;
}

.is-single .pcvm-thumb { aspect-ratio: auto; max-height: 16rem; }

.pcvm-thumb img,
.pcvm-thumb video {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 16rem;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.pcvm-thumb:hover img,
.pcvm-thumb:hover video { transform: scale(1.03); }

.pcvm-play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgb(0 0 0 / 0.25);
}

.pcvm-play svg { width: 2.5rem; height: 2.5rem; filter: drop-shadow(0 2px 4px rgb(0 0 0 / 0.4)); }

.pcvm-file {
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 0.625rem;
    background: rgb(0 0 0 / 0.08);
    color: inherit !important;
    text-decoration: none !important;
}

.pcvm-file:hover { background: rgb(0 0 0 / 0.14); }

.pcvm-file-icon {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
    background: var(--pcvm-surface);
    color: var(--pcvm-accent);
    font-size: 0.5625rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.pcvm-file-text,
.pcvm-chip-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.pcvm-file-name { font-weight: 500; font-size: 0.8125rem; }
.pcvm-file-size { font-size: 0.6875rem; opacity: 0.75; }

/* Composer ------------------------------------------------------------ */

.pcvm-composer {
    position: relative;
    padding: 0.5rem 0.625rem 0.625rem;
    border-top: 1px solid var(--pcvm-border);
}

.pcvm-composer-row {
    display: flex;
    align-items: flex-end;
    gap: 0.375rem;
}

.pcvm-composer textarea {
    flex: 1;
    min-height: 2.25rem;
    max-height: 8.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--pcvm-border);
    border-radius: 1.125rem;
    background: var(--pcvm-surface-alt);
    color: var(--pcvm-text);
    font: inherit;
    resize: none;
    outline: none;
}

.pcvm-composer textarea:focus { border-color: var(--pcvm-accent); box-shadow: 0 0 0 1px var(--pcvm-accent); }

.pcvm-attach { position: relative; width: 2.25rem; height: 2.25rem; }
.pcvm-attach input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.pcvm-send {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9999px;
    background: var(--pcvm-accent) !important;
    color: var(--pcvm-accent-text) !important;
}

.pcvm-send svg { width: 1.125rem; height: 1.125rem; }
.pcvm-send:disabled { opacity: 0.5; cursor: not-allowed; }

.pcvm-errors {
    margin: 0 0 0.375rem;
    padding: 0.375rem 0.625rem;
    border-radius: 0.5rem;
    background: color-mix(in srgb, var(--pcvm-badge-color) 12%, transparent);
    color: var(--pcvm-badge-color);
    font-size: 0.75rem;
    list-style: none;
}

.pcvm-pending {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin: 0 0 0.375rem;
    padding: 0;
    list-style: none;
}

.pcvm-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 12rem;
    padding: 0.25rem 0.25rem 0.25rem 0.25rem;
    border: 1px solid var(--pcvm-border);
    border-radius: 0.625rem;
    background: var(--pcvm-surface-alt);
}

.pcvm-chip img {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
    object-fit: cover;
}

.pcvm-chip .pcvm-file-icon { background: var(--pcvm-surface); }
.pcvm-chip.is-failed { border-color: var(--pcvm-badge-color); }

.pcvm-chip-remove {
    display: grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 9999px;
    color: var(--pcvm-muted) !important;
}

.pcvm-chip-remove:hover { background: var(--pcvm-surface) !important; color: var(--pcvm-text) !important; }
.pcvm-chip-remove svg { width: 0.875rem; height: 0.875rem; }

.pcvm-progress {
    display: block;
    height: 0.25rem;
    margin: 0.2rem 0;
    overflow: hidden;
    border-radius: 9999px;
    background: var(--pcvm-border);
}

.pcvm-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--pcvm-accent);
    transition: width 0.15s ease;
}

.pcvm-drop-hint {
    position: absolute;
    inset: 0.375rem;
    z-index: 2;
    display: grid;
    place-items: center;
    border: 2px dashed var(--pcvm-accent);
    border-radius: 0.75rem;
    background: color-mix(in srgb, var(--pcvm-surface) 90%, var(--pcvm-accent));
    color: var(--pcvm-accent);
    font-weight: 600;
    pointer-events: none;
}

/* Empty states -------------------------------------------------------- */

.pcvm-empty {
    padding: 1rem;
    color: var(--pcvm-muted);
    font-size: 0.8125rem;
    text-align: center;
}

.pcvm-empty--conversation { margin: auto; }

.pcvm-empty--main {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.pcvm-empty--main svg { width: 3rem; height: 3rem; opacity: 0.5; }
.pcvm-empty--main p { margin: 0; }
.pcvm-link { color: var(--pcvm-accent) !important; font-weight: 600; }

/* Lightbox ------------------------------------------------------------ */

.pcvm-lightbox {
    position: fixed;
    inset: 0;
    z-index: calc(var(--pcvm-z, 40) + 10);
    display: grid;
    place-items: center;
    padding: 2rem;
    background: rgb(0 0 0 / 0.85);
}

.pcvm-lightbox figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
}

.pcvm-lightbox img,
.pcvm-lightbox video {
    max-width: min(90vw, 80rem);
    max-height: calc(100vh - 8rem);
    border-radius: 0.5rem;
    object-fit: contain;
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.5);
}

.pcvm-lightbox audio { width: min(90vw, 28rem); }

.pcvm-lightbox figcaption {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    color: rgb(255 255 255 / 0.85);
    font-size: 0.8125rem;
}

.pcvm-lightbox figcaption a { color: #fff; text-decoration: underline; }

.pcvm-lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    background: rgb(255 255 255 / 0.12) !important;
    color: #fff !important;
}

.pcvm-lightbox-close svg { width: 1.25rem; height: 1.25rem; }

/* Small screens: one pane at a time ----------------------------------- */

@media (max-width: 640px) {
    .pcvm-window {
        inset: 0;
        width: 100%;
        height: 100%;
        border: 0;
        border-radius: 0;
    }

    .pcvm-list-toggle { display: inline-grid !important; }

    .pcvm-people {
        position: absolute;
        inset: 3.25rem 0 0 0;
        z-index: 3;
        width: 100%;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .pcvm-window.is-list-visible .pcvm-people,
    .pcvm-window:not(.has-conversation) .pcvm-people { transform: none; }

    .pcvm-message { max-width: 88%; }

    .pcvm-bubble[aria-expanded='true'] { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .pcvm *, .pcvm *::before, .pcvm *::after { transition: none !important; animation: none !important; }
}
