/* Shared chat presentation. Surface layout and transport controls stay local. */
.msg.computer-activity {
    align-self: flex-start;
    width: 320px;
    max-width: 100%;
    padding: 0;
    margin: 8px 0;
    background: transparent;
    border: 0;
}
.computer-activity-caption {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 6px;
    color: var(--dim, #888);
    font-size: 12px;
    line-height: 1.5;
}
.computer-activity-caption::before {
    content: '';
    flex: 0 0 12px;
    height: 9px;
    border: 1px solid currentColor;
    border-radius: 2px;
    box-shadow: 0 3px 0 -2px currentColor;
}
.computer-activity[data-state="running"] .computer-activity-caption { color: var(--accent, #007aff); }
.computer-activity[data-state="error"] .computer-activity-caption { color: var(--danger, #d64b4b); }
.computer-activity-preview {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: min(40dvh, 320px);
    height: auto;
    border-radius: 10px;
    border: 1px solid var(--border, rgba(127,127,127,.2));
    box-sizing: border-box;
    cursor: zoom-in;
}
.computer-activity-preview[hidden] { display: none; }
.computer-activity[data-kind="shell"] .computer-activity-caption::before {
    content: '>_';
    font-family: monospace;
    height: auto;
    flex-basis: 16px;
    border: 0;
    box-shadow: none;
}
.computer-preview-dialog {
    width: min(1280px, 96vw, calc((94dvh - 84px) * var(--computer-preview-ratio, 1.6)));
    max-width: 96vw;
    max-height: 94dvh;
    padding: 12px;
    border: 1px solid var(--border, #888);
    border-radius: 14px;
    background: var(--bg, var(--bg-primary, #fff));
    color: var(--text, #222);
}
.computer-preview-dialog::backdrop { background: rgba(0, 0, 0, .7); }
.computer-preview-dialog, .computer-input-dialog { margin: auto; }
.computer-preview-dialog img { display: block; width: 100%; height: auto; }
.computer-preview-close { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin: 0 0 10px auto; padding: 0; font-size: 26px; line-height: 1; cursor: pointer; color: inherit; background: var(--surface, var(--bg-secondary, #fff)); border: 1px solid var(--border, #bbb); border-radius: 50%; }
.msg.computer-task {
    align-self: flex-start;
    width: 560px;
    max-width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    margin: 8px 0;
    border: 1px solid var(--border, rgba(127,127,127,.2));
    border-radius: 12px;
    background: var(--surface, var(--bg-widget, transparent));
    text-align: left;
    overflow-wrap: anywhere;
}
.computer-task-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.computer-task-title { flex: 1; min-width: 100px; font-size: 13px; font-weight: 600; color: var(--text, inherit); }
.computer-task-state { font-size: 11px; color: var(--dim, #888); }
.computer-task-detail { font-size: 13px; line-height: 1.5; margin: 6px 0 0 24px; white-space: pre-wrap; color: var(--text, inherit); }
.computer-task-icon { width: 16px; height: 16px; flex: 0 0 16px; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; color: var(--dim, #888); }
.computer-task[data-state="running"] .computer-task-icon {
    border: 2px solid var(--border, #ddd); border-top-color: var(--accent, #007aff); border-radius: 50%;
    animation: computer-task-spin .8s linear infinite;
}
.computer-task[data-state="done"] .computer-task-icon { color: var(--success, #29985b); font-weight: 700; }
.computer-task[data-state="failed"] .computer-task-icon { color: var(--danger, #d64b4b); }
.computer-task > .computer-activity { width: 320px; max-width: 100%; margin-bottom: 0; }

/* The task owns the busy state while the computer runs or waits for input.
   Keep reasoning in the timeline so it can resume after the task finishes. */
#messages:has(.computer-task:is([data-state="running"], [data-state="waiting"])) :is(#thinkingMsg, .reasoning-active) {
    display: none;
}

#messages:has(.reasoning-active) #thinkingMsg,
#messages .reasoning-active:has(~ .reasoning-active) {
    display: none;
}

/* Parallel tasks retain their status, with one spinner on the latest task. */
#messages .computer-task[data-state="running"]:has(~ .computer-task[data-state="running"]) .computer-task-icon {
    visibility: hidden;
    animation: none;
}
/* Computer launch: "Launch computer" under the assistant's note; inactive once tapped. */
.computer-launch-btn { margin-top: 10px; }
.computer-launch-btn:disabled { opacity: .5; cursor: default; filter: none; }
/* Computer input: the chat card for a browser request ("Waiting for your input"). */
.msg.computer-input {
    --ci-card-fg: var(--text, #e5e5e5);
    --ci-card-muted: color-mix(in srgb, var(--ci-card-fg) 62%, transparent);
    --ci-card-accent: var(--accent, #007aff);
    align-self: flex-start;
    width: 560px;
    max-width: 100%;
    box-sizing: border-box;
    margin: 8px 0;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    column-gap: 12px;
    row-gap: 1px;
    align-items: center;
    border: 1px solid var(--border, rgba(127, 127, 127, .2));
    border-radius: 12px;
    background: var(--surface, var(--bg-widget, transparent));
    color: var(--ci-card-fg);
    text-align: left;
    white-space: normal;
}
.computer-input-icon {
    grid-row: 1 / span 2;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: var(--ci-card-accent);
    background: color-mix(in srgb, var(--ci-card-accent) 14%, transparent);
}
.computer-input-icon svg { width: 18px; height: 18px; }
.msg.computer-input > strong {
    grid-column: 2;
    align-self: end;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.computer-input-state {
    grid-column: 2;
    align-self: start;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    color: var(--ci-card-muted);
    font-size: 12.5px;
    line-height: 1.4;
}
.msg.computer-input[data-state="pending"] .computer-input-state::before {
    content: '';
    flex: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ci-card-accent);
    animation: computer-input-pulse 1.6s ease-in-out infinite;
}
.msg.computer-input[data-state="answered"] .computer-input-icon {
    color: var(--green, #22c55e);
    background: color-mix(in srgb, var(--green, #22c55e) 15%, transparent);
}
.msg.computer-input:is([data-state="cancelled"], [data-state="expired"]) .computer-input-icon {
    color: var(--ci-card-muted);
    background: color-mix(in srgb, var(--ci-card-fg) 8%, transparent);
}
.msg.computer-input:is([data-state="cancelled"], [data-state="expired"]) > strong { color: color-mix(in srgb, var(--ci-card-fg) 75%, transparent); }
.computer-input-open {
    grid-column: 3;
    grid-row: 1 / span 2;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    margin: 0;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    background: var(--ci-card-accent);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s, transform .1s;
}
.computer-input-open:hover { background: color-mix(in srgb, var(--ci-card-accent) 88%, #fff); }
.computer-input-open:active { transform: scale(.97); }
.computer-input-open:focus-visible { outline: 2px solid var(--ci-card-accent); outline-offset: 2px; }
/* Loading the form: only show the spinner if it takes a moment. */
.msg.computer-input[aria-busy="true"] .computer-input-open { pointer-events: none; animation: computer-input-hide-label 0s .2s forwards; }
.msg.computer-input[aria-busy="true"] .computer-input-open::after {
    content: '';
    position: absolute;
    inset: 0;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid #fff;
    border-right-color: transparent;
    border-radius: 50%;
    opacity: 0;
    animation: computer-input-spin .7s linear infinite, computer-input-show 0s .2s forwards;
}
@media (max-width: 599px) {
    .msg.computer-input { grid-template-columns: 36px minmax(0, 1fr); }
    .computer-input-open { grid-column: 1 / -1; grid-row: 3; width: 100%; min-height: 44px; margin-top: 12px; font-size: 15px; }
}

/* Computer input: the request sheet (centered dialog >= 600px, bottom sheet on phones). */
.computer-input-dialog {
    --ci-bg: var(--bg-secondary, #141414);
    --ci-fg: var(--text, #e5e5e5);
    --ci-body: color-mix(in srgb, var(--ci-fg) 80%, transparent);
    --ci-muted: color-mix(in srgb, var(--ci-fg) 62%, transparent);
    --ci-surface: color-mix(in srgb, var(--ci-fg) 6%, transparent);
    --ci-surface-hover: color-mix(in srgb, var(--ci-fg) 10%, transparent);
    --ci-line: color-mix(in srgb, var(--ci-fg) 12%, transparent);
    --ci-line-strong: color-mix(in srgb, var(--ci-fg) 26%, transparent);
    --ci-accent: var(--accent, #007aff);
    --ci-ring: color-mix(in srgb, var(--ci-accent) 24%, transparent);
    --ci-danger: var(--red, #ef4444);
    --ci-danger-text: color-mix(in srgb, var(--ci-danger) 86%, #fff);
    --ci-warning-text: var(--orange, #f59e0b);
    --ci-success: var(--green, #22c55e);
    --ci-ease: cubic-bezier(.32, .72, 0, 1);
    box-sizing: border-box;
    width: 440px;
    max-width: calc(100vw - 32px);
    max-height: min(820px, calc(100dvh - 48px));
    margin: auto;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--ci-line);
    border-radius: 22px;
    background: var(--ci-bg);
    color: var(--ci-fg);
    box-shadow: 0 24px 64px var(--shadow-heavy, rgba(0, 0, 0, .5));
    font-size: 15px;
    line-height: 1.45;
    text-align: left;
    color-scheme: dark;
    -webkit-tap-highlight-color: transparent;
}
[data-theme="light"] .computer-input-dialog {
    --ci-danger-text: color-mix(in srgb, var(--ci-danger) 78%, #000);
    --ci-warning-text: color-mix(in srgb, var(--orange, #ff9500) 62%, #000);
    --ci-success: color-mix(in srgb, var(--green, #34c759) 80%, #000);
    color-scheme: light;
}
.computer-input-dialog[open] { display: flex; flex-direction: column; animation: computer-input-pop .26s var(--ci-ease); }
.computer-input-dialog::backdrop {
    background: rgba(0, 0, 0, .55);
    background: var(--backdrop-color, rgba(0, 0, 0, .55));
    animation: computer-input-fade .2s ease;
}
.computer-input-dialog *, .computer-input-dialog *::before, .computer-input-dialog *::after { box-sizing: border-box; }
.computer-input-form { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; margin: 0; }
.computer-input-body { flex: 1 1 auto; min-height: 0; overflow: hidden auto; overscroll-behavior: contain; padding: 24px 24px 6px; }
.computer-input-footer { flex: none; padding: 14px 24px 24px; border-top: 1px solid transparent; transition: border-color .2s; }
.computer-input-form[data-overflow] .computer-input-footer { border-top-color: var(--ci-line); }
.computer-input-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Header: who asks, what, why. */
.computer-input-site {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    margin: 0 0 14px;
    padding: 4px 11px 4px 8px;
    border: 1px solid var(--ci-line);
    border-radius: 14px;
    background: var(--ci-surface);
    color: var(--ci-body);
    font-size: 13px;
    font-weight: 500;
    line-height: 18px;
}
.computer-input-site > [aria-hidden] { display: flex; flex: none; color: var(--ci-muted); }
.computer-input-site svg { width: 14px; height: 14px; }
.computer-input-host { min-width: 0; overflow-wrap: anywhere; }
.computer-input-site[data-insecure] > [aria-hidden], .computer-input-insecure { color: var(--ci-warning-text); }
.computer-input-insecure { flex: none; font-weight: 600; }
.computer-input-insecure::before { content: '·'; margin: 0 6px 0 2px; color: var(--ci-muted); font-weight: 400; }
.computer-input-dialog h2 {
    margin: 0;
    font-size: 21px;
    font-weight: 650;
    line-height: 1.25;
    letter-spacing: -.01em;
    text-wrap: balance;
    overflow-wrap: anywhere;
}
.computer-input-description {
    margin: 8px 0 0;
    color: var(--ci-body);
    font-size: 15px;
    line-height: 1.45;
    white-space: pre-line;
    text-wrap: pretty;
    overflow-wrap: anywhere;
}

/* CAPTCHA / screenshot: framed, never wider than the sheet. */
.computer-input-figure {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 18px 0 0;
    padding: 12px;
    border: 1px solid var(--ci-line);
    border-radius: 16px;
    background: var(--ci-surface);
}
.computer-input-image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: min(300px, 36dvh);
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
}

/* Fields */
.computer-input-fields { display: flex; flex-direction: column; gap: 18px; margin-top: 22px; }
.computer-input-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.computer-input-label {
    display: block;
    margin: 0 0 8px;
    padding: 0;
    color: var(--ci-fg);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: anywhere;
}
.computer-input-optional { margin-left: 4px; color: var(--ci-muted); font-size: 13px; font-weight: 400; }
.computer-input-control { position: relative; }
.computer-input-input {
    display: block;
    width: 100%;
    min-height: 50px;
    margin: 0;
    padding: 13px 14px;
    border: 1px solid var(--ci-line);
    border-radius: 14px;
    background: var(--ci-surface);
    color: var(--ci-fg);
    font: inherit;
    font-size: 16px;
    line-height: 22px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.computer-input-input::placeholder { color: var(--ci-muted); opacity: 1; }
.computer-input-input:hover { border-color: var(--ci-line-strong); }
.computer-input-input:focus { border-color: var(--ci-accent); background: transparent; box-shadow: 0 0 0 3px var(--ci-ring); }
.computer-input-input[aria-invalid="true"] { border-color: var(--ci-danger); }
.computer-input-input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ci-danger) 22%, transparent); }
textarea.computer-input-input { min-height: 104px; line-height: 1.45; resize: vertical; }
select.computer-input-input { padding-inline-end: 44px; cursor: pointer; text-overflow: ellipsis; }
.computer-input-control[data-kind="select"]::after {
    content: '';
    position: absolute;
    top: 50%;
    inset-inline-end: 16px;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    background: var(--ci-muted);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4.25 6 8.25l4-4' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4.25 6 8.25l4-4' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    pointer-events: none;
}
.computer-input-input::-webkit-date-and-time-value { text-align: start; }
.computer-input-control[data-kind="password"] .computer-input-input { padding-inline-end: 54px; }
.computer-input-reveal {
    position: absolute;
    top: 5px;
    inset-inline-end: 5px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ci-muted);
    cursor: pointer;
    transition: background-color .15s, color .15s;
}
.computer-input-reveal:hover { background: var(--ci-surface-hover); color: var(--ci-fg); }
.computer-input-reveal:focus-visible { outline: 2px solid var(--ci-accent); outline-offset: 0; }
.computer-input-reveal[aria-pressed="true"] { color: var(--ci-accent); }
.computer-input-reveal svg { width: 20px; height: 20px; }
/* CAPTCHA answers and one-time codes: monospace so 0/O and l/1 read clearly. */
.computer-input-code {
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
    font-size: 19px;
    letter-spacing: .12em;
}
.computer-input-code[data-otp] { min-height: 58px; font-size: 22px; font-weight: 600; letter-spacing: .32em; text-align: center; text-indent: .32em; }
.computer-input-code::placeholder { color: color-mix(in srgb, var(--ci-fg) 36%, transparent); font-weight: 400; }

/* Choices: radio / multiselect rows and the single checkbox. */
.computer-input-options { display: flex; flex-direction: column; gap: 8px; }
.computer-input-option, .computer-input-check {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 50px;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--ci-line);
    border-radius: 14px;
    background: var(--ci-surface);
    color: var(--ci-fg);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.35;
    cursor: pointer;
    transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.computer-input-option:hover, .computer-input-check:hover { border-color: var(--ci-line-strong); }
.computer-input-option:has(:checked), .computer-input-check:has(:checked) {
    border-color: color-mix(in srgb, var(--ci-accent) 65%, transparent);
    background: color-mix(in srgb, var(--ci-accent) 10%, transparent);
}
.computer-input-option:has(:focus-visible), .computer-input-check:has(:focus-visible) { box-shadow: 0 0 0 3px var(--ci-ring); }
.computer-input-option:has([aria-invalid="true"]), .computer-input-check:has([aria-invalid="true"]) { border-color: var(--ci-danger); }
.computer-input-option-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.computer-input-tick {
    flex: none;
    width: 22px;
    height: 22px;
    margin: 0;
    border: 1.5px solid var(--ci-line-strong);
    border-radius: 7px;
    background: var(--ci-bg);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}
.computer-input-tick[type="radio"] { border-radius: 50%; }
.computer-input-tick:checked { border-color: var(--ci-accent); background-color: var(--ci-accent); }
.computer-input-tick[type="checkbox"]:checked {
    background: var(--ci-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.4 6.6 11.4 12.5 5' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 15px no-repeat;
}
.computer-input-tick[type="radio"]:checked { background: radial-gradient(circle, #fff 0 3.5px, transparent 4.5px) var(--ci-accent); }

/* Help, inline errors, privacy note, request error. */
.computer-input-help { display: block; margin: 8px 0 0; color: var(--ci-muted); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.computer-input-message {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 8px 0 0;
    color: var(--ci-danger-text);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
.computer-input-message[hidden], .computer-input-error[hidden] { display: none; }
.computer-input-message::before, .computer-input-error::before {
    content: '';
    flex: none;
    width: 15px;
    height: 15px;
    margin-top: 1.5px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9.5' fill='none' stroke='%23000' stroke-width='2'/%3E%3Cpath d='M12 7.5v5.5' stroke='%23000' stroke-width='2.2' stroke-linecap='round'/%3E%3Ccircle cx='12' cy='16.6' r='1.3'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9.5' fill='none' stroke='%23000' stroke-width='2'/%3E%3Cpath d='M12 7.5v5.5' stroke='%23000' stroke-width='2.2' stroke-linecap='round'/%3E%3Ccircle cx='12' cy='16.6' r='1.3'/%3E%3C/svg%3E") center / contain no-repeat;
}
.computer-input-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 20px 0 0;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--ci-surface);
    color: var(--ci-body);
    font-size: 13px;
    line-height: 1.45;
}
.computer-input-note > [aria-hidden] { display: flex; flex: none; color: var(--ci-success); }
.computer-input-note[data-kind="private"] > [aria-hidden] { color: var(--ci-muted); }
.computer-input-note svg { width: 18px; height: 18px; }
.computer-input-error {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 14px;
    padding: 11px 14px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--ci-danger) 12%, transparent);
    color: var(--ci-danger-text);
    font-size: 14px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
.computer-input-error::before { width: 18px; height: 18px; margin-top: 0; }

/* Actions */
/* Buttons share the row; a long confirm label takes more room or wraps below. */
.computer-input-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.computer-input-actions button {
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    min-height: 50px;
    margin: 0;
    padding: 12px 18px;
    border: 0;
    border-radius: 14px;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    overflow-wrap: anywhere;
    cursor: pointer;
    transition: background-color .15s, opacity .15s, transform .1s;
}
.computer-input-cancel { background: var(--ci-surface-hover); color: var(--ci-fg); }
.computer-input-cancel:hover { background: color-mix(in srgb, var(--ci-fg) 14%, transparent); }
.computer-input-confirm { background: var(--ci-accent); color: #fff; }
.computer-input-confirm:hover { background: color-mix(in srgb, var(--ci-accent) 88%, #fff); }
.computer-input-actions button:active { transform: scale(.985); }
.computer-input-actions button:focus-visible { outline: 2px solid var(--ci-accent); outline-offset: 2px; }
.computer-input-actions button:disabled { opacity: .45; cursor: default; transform: none; }
.computer-input-form[data-pending="confirm"] .computer-input-confirm,
.computer-input-form[data-pending="cancel"] .computer-input-cancel { opacity: .8; cursor: progress; }
.computer-input-form[data-pending="confirm"] .computer-input-confirm::before,
.computer-input-form[data-pending="cancel"] .computer-input-cancel::before {
    content: '';
    flex: none;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: computer-input-spin .7s linear infinite;
}

/* Phones: bottom sheet with safe-area padding, lifted above the keyboard. */
@media (max-width: 599px) {
    .computer-input-dialog {
        width: 100%;
        max-width: 100%;
        max-height: calc(var(--computer-input-viewport, 100dvh) - env(safe-area-inset-top, 0px) - 12px);
        margin: auto 0 var(--computer-input-keyboard, 0px);
        border-width: 1px 0 0;
        border-radius: 22px 22px 0 0;
        box-shadow: 0 -16px 48px var(--shadow-heavy, rgba(0, 0, 0, .5));
    }
    .computer-input-dialog[open] { animation: computer-input-sheet-up .38s var(--ci-ease); }
    .computer-input-body { padding: 22px 20px 6px; }
    .computer-input-footer { padding: 12px 20px max(20px, env(safe-area-inset-bottom)); }
    .computer-input-dialog h2 { font-size: 20px; }
}

@keyframes computer-input-pop { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes computer-input-sheet-up { from { transform: translateY(100%); } }
@keyframes computer-input-fade { from { opacity: 0; } }
@keyframes computer-input-spin { to { transform: rotate(360deg); } }
@keyframes computer-input-pulse { 50% { opacity: .3; } }
@keyframes computer-input-show { to { opacity: 1; } }
@keyframes computer-input-hide-label { to { color: transparent; } }
@media (prefers-reduced-motion: reduce) {
    .computer-input-dialog[open], .computer-input-dialog::backdrop,
    .msg.computer-input[data-state="pending"] .computer-input-state::before { animation: none; }
    .computer-input-dialog *, .computer-input-open { transition: none; }
    .computer-input-form[data-pending] button::before, .msg.computer-input[aria-busy="true"] .computer-input-open::after { animation-duration: 1.6s, 0s; }
}
@keyframes computer-task-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .computer-task[data-state="running"] .computer-task-icon { animation: none; } }

.fork-chat {
    --fork-chat-bg: var(--bg, var(--bg-secondary, #0b0b0f));
    --fork-chat-text: var(--text, var(--text-primary, #f3f3f5));
    --fork-chat-surface: var(--surface, var(--bg-tertiary, #202028));
    --fork-chat-accent: var(--accent, #007aff);
    --fork-chat-on-accent: var(--on-accent, #fff);
    --fork-chat-muted: var(--dim, var(--text-muted, #9a9aa6));
    --fork-chat-border: var(--border, rgba(255, 255, 255, .09));
}

.fork-chat-row {
    display: flex;
    width: 100%;
    max-width: 100%;
}
.fork-chat-row--start { justify-content: flex-start; }
.fork-chat-row--end { justify-content: flex-end; }
.fork-chat-row--full { display: block; }

.fork-chat-message {
    position: relative;
    max-width: min(85%, 560px);
    padding: 9px 13px;
    border-radius: 18px;
    color: var(--fork-chat-text);
    font-size: 15px;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.fork-chat-message--mine {
    background: var(--fork-chat-accent);
    color: var(--fork-chat-on-accent);
    border-bottom-right-radius: 5px;
}
.fork-chat-message--theirs {
    background: var(--fork-chat-surface);
    border-bottom-left-radius: 5px;
}
.fork-chat-message--assistant {
    width: 100%;
    max-width: 100%;
    padding: 4px 4px 8px;
    background: none;
    border-radius: 0;
    font-size: 15px;
    line-height: 1.5;
    white-space: normal;
}
.fork-chat-message--photos-only { padding: 0; background: transparent; }
.fork-chat-message__text { white-space: pre-wrap; }
.fork-chat-message__time {
    display: block;
    margin-top: 4px;
    color: currentColor;
    font-size: 10px;
    line-height: 1;
    opacity: .62;
    text-align: right;
}

/* Markdown owns its block spacing, including inside plain-text widget bubbles. */
.fork-chat-message__content { white-space: normal; }
.fork-chat-message__content:empty { display: none; }
.fork-chat-message__content p { margin: 0 0 8px; }
.fork-chat-message__content p:last-child { margin-bottom: 0; }
.fork-chat-message__content code {
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(127, 127, 127, .18);
    font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
    font-size: .9em;
}
.fork-chat-message__content pre {
    margin: 8px 0;
    padding: 10px 12px;
    overflow-x: auto;
    border-radius: 8px;
    background: rgba(0, 0, 0, .32);
}
[data-theme="light"] .fork-chat-message__content pre { background: rgba(0, 0, 0, .06); }
.fork-chat-message__content pre code { padding: 0; background: none; font-size: 12px; line-height: 1.5; }
.fork-chat-message__content ul,
.fork-chat-message__content ol { margin: 6px 0; padding-left: 20px; }
.fork-chat-message__content li { margin: 2px 0; }
.fork-chat-message__content h1,
.fork-chat-message__content h2,
.fork-chat-message__content h3,
.fork-chat-message__content h4 { margin: 10px 0 6px; line-height: 1.3; }
.fork-chat-message__content h1 { font-size: 1.3em; }
.fork-chat-message__content h2 { font-size: 1.15em; }
.fork-chat-message__content h3 { font-size: 1.05em; }
.fork-chat-message__content blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--fork-chat-accent); color: var(--fork-chat-muted); }
.fork-chat-message__content a { color: var(--fork-chat-accent); text-decoration: none; }
.fork-chat-message__content a:hover { text-decoration: underline; }
.fork-chat-message__content hr { margin: 10px 0; border: 0; border-top: 1px solid var(--fork-chat-border); }
.fork-chat-message__content table { width: 100%; margin: 8px 0; border-collapse: collapse; table-layout: fixed; }
.fork-chat-message__content th,
.fork-chat-message__content td { width: 1%; padding: 4px 8px; border: 1px solid var(--fork-chat-border); overflow-wrap: anywhere; vertical-align: top; }

/* Ordinary Markdown photos share the same layout in history, live replies,
   messenger windows and shared chats. No HTML from the model is needed. */
:is(.msg-content, .fork-chat-message__content) img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 8px 0;
    border-radius: 12px;
}
.fork-chat-image-card {
    container: fork-image-card / inline-size;
    width: 100%;
    margin: 0 0 20px;
    white-space: normal;
}
.fork-chat-image-card__body {
    display: flow-root;
}
.fork-chat-image-card__intro { min-width: 0; margin-bottom: 10px; }
.fork-chat-image-card__intro > :first-child { margin-top: 0; }
.fork-chat-image-card__intro > :last-child { margin-bottom: 0; }
.fork-chat-image-card__intro > :is(h1, h2, h3, h4):first-child { margin-bottom: 7px; font-size: 1.35em; line-height: 1.25; }
.fork-chat-image-card__name {
    display: block;
    margin-bottom: 5px;
    font-size: 1.3em;
    line-height: 1.25;
}
.fork-chat-md-image { max-width: min(280px, 100%); margin: 12px 0; }
.fork-chat-image-card__body > .fork-chat-md-image:first-child {
    float: left;
    width: 140px;
    max-width: 100%;
    margin: 0 20px 12px 0;
}
/* Structured blocks need their full width; ordinary text wraps naturally. */
.fork-chat-image-card__body > :is(ul, ol, table, pre, blockquote, hr),
.fork-chat-image-card__body > .fork-chat-md-image:not(:first-child) { clear: both; }
.fork-chat-md-image__open {
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: none;
    color: inherit;
    font: inherit;
    line-height: 0;
    text-align: left;
    cursor: zoom-in;
    overflow: hidden;
}
.fork-chat-image-card__body > .fork-chat-md-image:first-child .fork-chat-md-image__open { aspect-ratio: 7 / 10; }
.fork-chat-md-image__open:disabled { cursor: default; }
figure.fork-chat-md-image img.fork-chat-md-image__image {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain;
    object-position: left top;
    margin: 0;
    border-radius: 12px;
}
.fork-chat-md-image__source {
    margin-top: 7px;
    color: var(--fork-chat-muted, var(--text-muted, #888));
    font-size: 11px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.fork-chat-md-image__source a { color: var(--fork-chat-accent, var(--accent, #007aff)); }
.fork-chat-image-pending {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 4 / 3;
    padding: 12px;
    box-sizing: border-box;
    border-radius: 12px;
    background: var(--hover-overlay, rgba(127, 127, 127, .1));
    color: var(--fork-chat-muted, var(--text-muted, #888));
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
    animation: fork-chat-image-pending 1.2s ease-in-out infinite alternate;
}
.fork-chat-md-image__open .fork-chat-image-pending { position: absolute; inset: 0; height: 100%; aspect-ratio: auto; overflow: hidden; }
@keyframes fork-chat-image-pending { from { opacity: .55; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .fork-chat-image-pending { animation: none; } }
@container fork-image-card (max-width: 440px) {
    .fork-chat-image-card__body > .fork-chat-md-image:first-child { width: 120px; margin-right: 16px; }
}
@container fork-image-card (max-width: 320px) {
    .fork-chat-image-card__body > .fork-chat-md-image:first-child { width: 96px; margin-right: 14px; }
}
@container fork-image-card (max-width: 260px) {
    .fork-chat-image-card__body > .fork-chat-md-image:first-child { float: none; width: 120px; margin: 0 0 14px; }
}
.fork-chat-markdown-lightbox {
    margin: auto;
    max-width: 94vw;
    max-height: 94dvh;
    padding: 12px;
    border: 1px solid var(--border, rgba(127, 127, 127, .3));
    border-radius: 14px;
    background: var(--bg, var(--bg-primary, #fff));
    color: var(--text, var(--text-primary, #222));
}
.fork-chat-markdown-lightbox::backdrop { background: rgba(0, 0, 0, .8); }
.fork-chat-markdown-lightbox img { display: block; max-width: 88vw; max-height: 80dvh; width: auto; height: auto; margin: 0; }
.fork-chat-markdown-lightbox__close { display: block; width: 40px; height: 40px; margin: 0 0 8px auto; border: 0; border-radius: 50%; background: var(--hover-overlay, rgba(127, 127, 127, .15)); color: inherit; font-size: 26px; cursor: pointer; }

.fork-chat-photos { display: flex; flex-wrap: wrap; gap: 4px; }
.fork-chat-photos:not(:last-child) { margin-bottom: 6px; }
.fork-chat-photo {
    width: 160px;
    max-width: 70vw;
    max-height: 300px;
    object-fit: cover;
    display: block;
    border-radius: 14px;
    background: var(--fork-chat-surface);
    cursor: pointer;
}

.fork-chat-attachments { display: flex; flex-direction: column; gap: 6px; margin: 2px 0 7px; }
.fork-chat-attachment {
    min-width: min(210px, 100%);
    max-width: 100%;
    padding: 9px 11px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--fork-chat-border);
    border-radius: 12px;
    background: rgba(127, 127, 140, .14);
    color: inherit;
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.fork-chat-message--mine .fork-chat-attachment { border-color: rgba(255, 255, 255, .2); background: rgba(0, 0, 0, .12); }
.fork-chat-attachment__icon { flex: 0 0 auto; display: flex; }
.fork-chat-attachment__copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fork-chat-attachment__title { overflow: hidden; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.fork-chat-attachment__subtitle { font-size: 11px; opacity: .72; }
.fork-chat-attachment--app-errors { cursor: default; }
.fork-chat-attachment--app-errors .fork-chat-attachment__icon { color: #ff5a5f; }

.fork-chat-voice { display: flex; flex-direction: column; gap: 6px; }
.fork-chat-voice__player { min-width: 168px; max-width: 260px; display: flex; align-items: center; gap: 10px; }
.fork-chat-voice__button {
    width: 34px; height: 34px; padding: 0; flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center;
    border: 0; border-radius: 50%; background: rgba(255, 255, 255, .2); color: inherit; cursor: pointer;
}
.fork-chat-message--theirs .fork-chat-voice__button { background: rgba(127, 127, 140, .22); }
.fork-chat-voice__track { height: 4px; flex: 1 1 auto; position: relative; border-radius: 999px; background: rgba(255, 255, 255, .3); cursor: pointer; }
.fork-chat-message--theirs .fork-chat-voice__track { background: rgba(127, 127, 140, .3); }
.fork-chat-voice__fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: currentColor; }
.fork-chat-voice__bars { height: 26px; min-width: 0; flex: 1 1 auto; display: flex; align-items: center; gap: 2px; cursor: pointer; }
.fork-chat-voice__bar { min-width: 2px; flex: 1 1 0; border-radius: 2px; background: currentColor; opacity: .38; transition: opacity .1s linear; }
.fork-chat-voice__bar.is-played { opacity: .95; }
.fork-chat-voice__time { flex: 0 0 auto; font-size: 12px; font-variant-numeric: tabular-nums; opacity: .8; }
.fork-chat-voice__transcript { font-size: 13px; line-height: 1.35; opacity: .85; white-space: pre-wrap; overflow-wrap: anywhere; }
.fork-chat-voice__transcript:empty { display: none; }
.fork-chat-voice__transcript.transcribing::after {
    content: "";
    width: 4px; height: 4px; margin-left: 4px; display: inline-block;
    border-radius: 50%; background: currentColor; animation: forkChatPulse 1s ease-in-out infinite;
}

.fork-chat-reasoning {
    width: 100%;
    padding: 3px 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--fork-chat-muted);
    font-size: 14px;
    line-height: 1.35;
}
.fork-chat-reasoning-icon { width: 14px; height: 14px; flex: 0 0 auto; display: inline-flex; }
.fork-chat-reasoning-icon svg { width: 14px; height: 14px; }
.fork-chat-reasoning-spinner {
    width: 13px; height: 13px; display: inline-block; border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--fork-chat-muted) 28%, transparent);
    border-top-color: var(--fork-chat-muted);
    animation: forkChatSpin .72s linear infinite;
}
.fork-chat-reasoning-sources { display: inline-flex; gap: 3px; margin-left: 2px; }
.fork-chat-reasoning-sources img { width: 15px; height: 15px; border-radius: 4px; }

.fork-chat-generated-media { margin: 8px 0 4px; }
.fork-chat-generated-media__frame { position: relative; max-width: 100%; overflow: hidden; border-radius: 12px; background: #0a0a12; }
.fork-chat-generated-media__frame img,
.fork-chat-generated-media__frame video { width: 100%; height: 100%; display: block; object-fit: cover; opacity: 0; transition: opacity .4s; }
.fork-chat-generated-media__frame img { cursor: pointer; }
.fork-chat-generated-media__frame.is-loaded img,
.fork-chat-generated-media__frame.is-loaded video { opacity: 1; }
.fork-chat-generated-media__loader { position: absolute; inset: 0; z-index: 1; transition: opacity .4s; }
/* Generating placeholder (mirrors app.css): img-fx mosaic + "Generating image · 0:12". */
.media-gen-fallback, .media-gen-fx { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; }
.has-gen-fx .media-gen-fallback { display: none; }
.media-gen-pending { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #0f0f0f; }
.media-gen-spinner { display: block; width: 26px; height: 26px; border: 2px solid rgba(255, 255, 255, 0.16); border-top-color: rgba(255, 255, 255, 0.75); border-radius: 50%; animation: media-gen-spin 0.8s linear infinite; }
.has-gen-info .media-gen-spinner { margin-bottom: 84px; }
.has-gen-info:not(.has-gen-fx) .media-gen-info { background: none; }
[data-theme="light"] .media-gen-pending { background: #f5f5f5; }
[data-theme="light"] .media-gen-spinner { border-color: rgba(0, 0, 0, 0.12); border-top-color: rgba(0, 0, 0, 0.6); }
@keyframes media-gen-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .media-gen-spinner { animation: none; } }
.imgfx-layer { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.imgfx-overlay { z-index: 1; }
.media-gen-info { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 0 20px; text-align: center; line-height: 1.25; color: #fff; background: radial-gradient(ellipse 70% 42% at 50% 50%, rgba(10, 10, 10, .55), rgba(10, 10, 10, 0) 100%); pointer-events: none; }
.media-gen-title { display: flex; max-width: 100%; font-size: 15px; font-weight: 600; white-space: pre; }
.media-gen-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.media-gen-time { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.media-gen-hint { font-size: 13px; opacity: .62; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
[data-theme="light"] .media-gen-info { color: #111; background: radial-gradient(ellipse 70% 42% at 50% 50%, rgba(245, 245, 245, .75), rgba(245, 245, 245, 0) 100%); }
.video-dream-loader { position: relative; width: 100%; height: 100%; overflow: hidden; filter: blur(40px); background: #0a0a12; }
.video-dream-blob { position: absolute; border-radius: 50%; mix-blend-mode: screen; }
.video-dream-blob-1 { width: 70%; height: 70%; top: -10%; left: -10%; background: radial-gradient(circle, rgba(90, 50, 200, .8) 0%, transparent 70%); animation: forkChatDream1 8s ease-in-out infinite; }
.video-dream-blob-2 { width: 60%; height: 60%; right: -10%; bottom: -10%; background: radial-gradient(circle, rgba(20, 140, 190, .7) 0%, transparent 70%); animation: forkChatDream2 10s ease-in-out infinite; }
.video-dream-blob-3 { width: 50%; height: 50%; top: 30%; left: 30%; background: radial-gradient(circle, rgba(200, 60, 120, .7) 0%, transparent 70%); animation: forkChatDream3 12s ease-in-out infinite; }
.fork-chat-generated-media__play {
    width: 54px; height: 54px; padding: 0; position: absolute; z-index: 2; top: 50%; left: 50%;
    display: flex; align-items: center; justify-content: center;
    transform: translate(-50%, -50%); border: 0; border-radius: 50%;
    background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; backdrop-filter: blur(4px);
}
.fork-chat-generated-media__frame.is-playing .fork-chat-generated-media__play { opacity: 0; pointer-events: none; }
.fork-chat-generated-media__failed { display: inline-flex; padding: 10px 14px; border: 1px solid rgba(220, 38, 38, .25); border-radius: 12px; background: rgba(220, 38, 38, .12); color: var(--fork-chat-muted); font-size: 13px; }

.fork-chat-state {
    width: min(480px, 100%);
    margin: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--fork-chat-muted);
    text-align: center;
}
.fork-chat-state__spinner {
    width: 28px; height: 28px; border: 3px solid color-mix(in srgb, var(--fork-chat-accent) 18%, transparent);
    border-top-color: var(--fork-chat-accent); border-radius: 50%; animation: forkChatSpin .72s linear infinite;
}
.fork-chat-state__retry { margin-top: 12px; padding: 8px 14px; border: 1px solid var(--fork-chat-border); border-radius: 999px; background: var(--fork-chat-surface); color: var(--fork-chat-text); cursor: pointer; }
.fork-chat-state__icon { margin-bottom: 10px; color: var(--fork-chat-accent); }
.fork-chat-state__title { color: var(--fork-chat-text); font-size: 15px; font-weight: 600; line-height: 1.3; }
.fork-chat-state__subtitle { margin-top: 5px; font-size: 13px; line-height: 1.4; }

@keyframes forkChatSpin { to { transform: rotate(360deg); } }
.fork-chat-direct-typing,
.fork-chat-direct-typing-exit {
    align-self: flex-start;
    flex-shrink: 0;
    margin: 6px 0;
    overflow-wrap: anywhere;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 180ms ease, transform 180ms ease;
}
.fork-chat-direct-typing.is-visible { opacity: 1; transform: translateY(0); }
.fork-chat-direct-typing-exit { pointer-events: none; }
.fork-chat-direct-typing-icon {
    display: inline-flex;
    flex: 0 0 20px;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 14px;
}
.fork-chat-direct-typing-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    opacity: .4;
    animation: forkChatTypingDot 1100ms ease-in-out infinite;
}
.fork-chat-direct-typing-dot:nth-child(2) { animation-delay: 140ms; }
.fork-chat-direct-typing-dot:nth-child(3) { animation-delay: 280ms; }
.fork-chat-direct-typing-label { min-width: 0; }
@keyframes forkChatTypingDot {
    0%, 60%, 100% { opacity: .4; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}
@keyframes forkChatPulse { 0%, 100% { opacity: 1; } 50% { opacity: .2; } }
@keyframes forkChatDream1 { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(40%, 20%) scale(1.2); } 66% { transform: translate(10%, 50%) scale(.9); } }
@keyframes forkChatDream2 { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(-30%, -20%) scale(1.1); } 66% { transform: translate(-50%, 10%) scale(1.3); } }
@keyframes forkChatDream3 { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(20%, -40%) scale(1.2); } 66% { transform: translate(-30%, 20%) scale(.8); } }
@media (prefers-reduced-motion: reduce) {
    .fork-chat-state__spinner,
    .fork-chat-reasoning-spinner { animation-duration: 1.5s; }
    .fork-chat-direct-typing,
    .fork-chat-direct-typing-exit { transition: none; transform: none; }
    .fork-chat-direct-typing-dot { animation: none; opacity: .65; }
}

/* The shared renderer drives fades on an absolute Web Animations timeline.
   Relative top preserves normal wrapping, including long URLs and code. */
.tw-word-fade { position: relative; }
@media (prefers-reduced-motion: reduce) {
    .tw-word-fade, .tw-char-fade { opacity: 1 !important; top: 0 !important; }
}

/* Shared manager chat controls and participants. */
.chat-audience { border: 1px solid var(--border, #ddd); border-radius: 999px; padding: 5px 10px; background: transparent; color: inherit; font: inherit; font-size: 12px; cursor: pointer; }
.chat-audience[hidden] { display: none; }
.chat-members-dialog { margin: auto; color: var(--text, #202020); background: var(--bg-primary, #fff); border: 1px solid var(--border, #ddd); border-radius: 20px; padding: 24px; width: min(460px, calc(100vw - 32px)); max-height: 80vh; overflow: auto; box-sizing: border-box; box-shadow: 0 20px 80px #0003; }
.chat-members-dialog::backdrop { background: #0007; }
.chat-members-dialog h2 { font-size: 20px; margin: 0 32px 12px 0; }
.chat-members-hint { font-size: 13px; line-height: 1.5; opacity: .7; }
.chat-members-close { position: absolute; right: 16px; top: 12px; background: transparent; border: 0; color: inherit; font-size: 28px; cursor: pointer; }
.chat-member-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border, #ddd); font-size: 14px; }
.chat-member-row span { overflow-wrap: anywhere; }
.chat-member-row small { opacity: .6; }
.chat-members-search { display: flex; gap: 8px; margin-top: 20px; }
.chat-members-search[hidden] { display: none; }
.chat-members-search input { min-width: 0; flex: 1; padding: 10px; border: 1px solid var(--border, #ddd); border-radius: 10px; color: inherit; background: transparent; font: inherit; }
.chat-member-row button, .chat-members-search button { border: 1px solid var(--border, #ddd); border-radius: 10px; background: transparent; color: inherit; padding: 8px 12px; cursor: pointer; font: inherit; font-size: 13px; }
.chat-members-dialog button:disabled { opacity: .5; cursor: wait; }
.chat-members-error { color: #d45a4c; font-size: 13px; white-space: pre-wrap; }
.chat-peer-message { align-self: flex-start !important; }
.chat-sender { font-size: 12px; opacity: .65; margin: 0 0 5px; }
