/* ===== Models & Providers section (WR-13) ===== */
.models-head {
    width: 100%;
    max-width: var(--section-max-width);
    min-height: 36px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.models-catalog {
    max-width: var(--section-max-width);
    margin: 16px auto 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.model-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 14px 0 2px;
}

.model-group-name {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Provider brand marks (Slice 6): inherit color, sized inline for chips/headers */
.provider-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
}

.model-key-badge {
    font-size: 10px;
    padding: 1px 8px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.model-key-badge.has-key {
    background: var(--accent-subtle);
    border-color: var(--accent);
    color: var(--accent);
}

/* Provider chips (Layout B): the "daily drivers" filter above the catalog */
.provider-chips {
    max-width: var(--section-max-width);
    margin: 4px auto 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* The two model roles, as current values. Shares the catalog's column width so
   it lines up with the cards below, and keeps a full row of clear space from
   the chips above — the previous prose version sat tight against them and read
   as part of the chip row. */
.model-roles {
    max-width: var(--section-max-width);
    margin: 20px auto 4px;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 24px;
}

.model-role {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.model-role-value {
    font-size: var(--text-sm);
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* "None" is a real state, not an error — quiet, not alarming. */
.model-role-value.none {
    color: var(--text-muted);
    font-style: italic;
}

/* Pushed to its own line: it is a footnote, not a third role. */
.model-role-how {
    flex-basis: 100%;
    margin: 0;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.provider-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    font-size: var(--text-sm);
    line-height: 1;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.provider-chip:hover:not(.soon) {
    border-color: var(--accent);
}

.provider-chip.active {
    background: var(--accent-subtle);
    border-color: var(--accent);
    color: var(--accent);
}

.provider-chip.soon {
    opacity: 0.55;
    cursor: default;
}

.chip-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.45;
}

.chip-dot.has-key {
    background: var(--accent);
    opacity: 1;
}

.chip-soon {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

/* Provider-owned API key: group-header button + editor popover (Slice 4) */
.model-group-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.group-key-btn {
    font-size: var(--text-xs);
    padding: 2px 10px;
    border-radius: var(--radius-full);
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.group-key-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.key-popover {
    position: absolute;
    width: 280px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    padding: 12px;
}

.key-popover-title {
    font-size: var(--text-sm);
    font-weight: 600;
    margin-bottom: 8px;
}

.key-popover-field {
    display: flex;
    gap: 6px;
}

/* Renders at body level (so it can escape a modal's stacking context), which
   once put it outside every input rule in the app and left it looking native.
   It now inherits the base field appearance like everything else and only
   states its own layout plus a slightly tighter pad for the popover. */
.key-popover-input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
}

.key-popover-eye {
    flex-shrink: 0;
    padding: 0 10px;
    font-size: var(--text-xs);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
}

.key-popover-eye:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.key-popover-help {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin: 8px 0 0;
    line-height: 1.4;
}

.key-popover-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.key-popover-save,
.key-popover-clear {
    padding: 6px 14px;
    font-size: var(--text-sm);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.key-popover-save {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
}

.key-popover-clear {
    background: none;
    color: var(--error);
    margin-right: auto;
}

/* Per-model detail view (Slice 5) */
.model-detail-panel {
    max-width: var(--section-max-width);
    margin: 0 auto;
}

.model-detail-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 2px;
}

.model-detail-head .settings-view-crumb {
    width: 100%;
    margin: 0;
}

.back-link {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: var(--text-sm);
    padding: 4px 8px 4px 0;
}

.back-link:hover {
    color: var(--accent);
}

.model-detail-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.model-detail-name {
    font-size: var(--text-lg);
    font-weight: 600;
}

.model-detail-title .modal-btn {
    margin-left: auto;
}

.model-detail-sub {
    width: 100%;
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin: 0 0 12px;
}

.param-group-title {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin: 20px 0 8px;
}

.param-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: var(--shadow-xs);
}

.param-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.param-row-inline {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.param-label {
    font-size: var(--text-sm);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.param-val {
    margin-left: auto;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
}

.param-unit {
    color: var(--text-muted);
    font-weight: 400;
}

.param-help {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

/* Stands in for controls the selected model rejects (Claude 4.6+/4.7+). */
.param-unavailable {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
    padding-left: 10px;
    border-left: 2px solid var(--border-color);
}

/* Appearance comes from the base field rules — these only set the widths, the
   one thing the base rule leaves to context. A stacked row's control spans the
   card; an inline row's sits at a fixed width beside its label. */
.param-row input[type="range"],
.param-row .param-tag-input {
    width: 100%;
}

/* The prefill field uses the shared resizable wrapper, so it gets the same box
   and drag-bar as the persona prompt and container instructions. The row's flex
   gap already spaces it — the wrapper's own bottom margin would double up. */
.param-row .textarea-resizable {
    margin-bottom: 0;
}

.param-row-inline input[type="number"],
.param-row-inline select {
    width: 150px;
    flex-shrink: 0;
}

.param-subgroup {
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.param-subgroup summary {
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.param-subgroup[open] summary {
    margin-bottom: 4px;
}

.param-subgroup .param-row {
    margin-top: 12px;
}

.param-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.param-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--text-xs);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.param-tag-x {
    color: var(--text-muted);
}

.param-tag:hover .param-tag-x {
    color: var(--error);
}

/* Model cards mirror the persona cards */
.model-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    box-shadow: var(--shadow-xs);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.model-card.active {
    border-color: var(--accent);
}

.model-card-open {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.model-card-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.model-card-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.model-card-sub {
    font-size: var(--text-xs);
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.model-card-menu {
    flex: 0 0 auto;
}

/* Per-message model tag (WR-14): small pill after the speaker name on
   assistant messages, recording which model generated the reply. */
.message-model-tag {
    margin-left: 8px;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 400;
    vertical-align: middle;
}

/* Unified model menu (WR-11): "no key" badge on provider group headers whose
   provider has no stored API key (models stay pickable; sending surfaces the
   missing-key error with guidance). */
.model-menu-nokey {
    margin-left: auto; /* pushed to the far edge of the flex group header */
    padding: 1px 6px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 10px;
    text-transform: none;
    letter-spacing: normal;
}

.context-menu-wide .context-menu-item {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Quick-switch dropdown (Slice 8): the model groups scroll, the footer
   ("Show all providers" / "Manage models…") stays pinned below them. */
.model-menu-scroll {
    max-height: 50vh;
    overflow-y: auto;
}

/* Wider than the stock wide menu: a row now carries a name, a role marker and
   a ⋯, and at 280px the longest model names were ellipsed to nothing useful.
   Wins over .context-menu-wide by source order — models.css loads after
   views.css, which is the cascade the <link> order defines. */
.model-menu {
    max-width: 340px;
}

/* A switcher row: the model button plus its role ⋯, side by side. The ⋯ is a
   sibling rather than a child of the button (nesting buttons is invalid). */
.model-menu-row {
    display: flex;
    align-items: stretch;
}

/* The row's "Primary" marker already says what the ✓ said, and a floated
   ::after inside a flex item is fragile besides. Suppressed only here — the
   persona and settings menus still use the check. */
.model-menu-row .context-menu-item.active::after {
    content: none;
}

.model-menu-row .context-menu-item {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.model-menu-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.model-menu-rowmenu {
    flex: 0 0 auto;
    padding: 0 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: var(--text-sm);
    cursor: pointer;
}

.model-menu-rowmenu:hover {
    color: var(--accent);
    background: var(--bg-tertiary);
}

.model-menu-provider {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chat file rows (CF-01b): the chat's own files, rendered in the file panel's
   browser view. Mirror the container file lists (same badge/size/download
   parts) so the three scopes read alike. */
.chat-file-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
}

.chat-file-row:hover {
    background: var(--bg-tertiary);
}

.chat-file-name {
    flex: 1;
    min-width: 0;
    padding: 0;
    border: none;
    background: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--text-sm);
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-file-name.clickable {
    cursor: pointer;
}

.chat-file-name.clickable:hover {
    color: var(--accent);
}

/* Escape hatch out of the daily-drivers filter — a quieter footer action than
   picking a model, since it changes what you're looking at, not what you use. */
.model-menu-more {
    color: var(--text-secondary);
    font-size: var(--text-xs);
}

.context-menu-item.active {
    color: var(--accent);
    font-weight: 600;
}

.context-menu-item.active::after {
    content: '✓';
    float: right;
    margin-left: 12px;
}

/* Empty states */
.empty-state {
    text-align: center;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    padding: 24px 16px;
}

.settings-section {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.settings-section h3 {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

.settings-section label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    margin-bottom: var(--space-2);
    color: var(--text-primary);
}

/* Appearance and focus come from the base field rule; a settings section only
   states its own layout. */
.settings-section input[type="text"],
.settings-section input[type="password"],
.settings-section select,
.settings-section textarea {
    width: 100%;
    margin-bottom: 12px;
}

.settings-section textarea {
    resize: none; /* native grip replaced by a themed handle (see below) */
    min-height: 125px;
}

/* Resizable textbox: the native corner grip clashed with (and sat on top of)
   the scrollbar. Replace it with a themed drag-bar along the bottom edge, so
   the scrollbar sits cleanly inside the box. */
/* The WRAPPER owns the border/radius and clips the inner textarea's scrollbar
   to the rounded corners (same trick the settings modal uses), so the scrollbar
   no longer pokes past the corners. */
.textarea-resizable {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    overflow: hidden;
    transition: border-color 0.2s;
}

.textarea-resizable:focus-within {
    border-color: var(--accent);
}

/* Inner textarea is borderless/transparent — the wrapper is the visible box.
   resize:none lives here (not just under .settings-section) so any wrapped
   textarea loses the native corner grip and is sized only via the drag handle. */
.textarea-resizable textarea,
.textarea-resizable textarea:focus {
    border: none;
    border-radius: 0;
    background: transparent;
    margin-bottom: 0;
    resize: none;
    /* Text styling lives here (not just .settings-section) so wrapped textareas
       outside the settings modal — e.g. container pages — don't fall back to
       the browser-default black, which is unreadable on dark themes. */
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: var(--text-sm);
    /* The wrapper has no padding, so the textarea owns its inner padding. Lives
       here (not just .settings-section) so wrapped textareas elsewhere — e.g. the
       project modal — aren't flush against the edge. */
    padding: 10px 12px;
}

/* No top border: the handle shares the wrapper's background, so a rule here
   only cut the box in two. The grip pill alone is enough affordance. */
.textarea-resize-handle {
    height: 14px;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    cursor: ns-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
}

.textarea-resize-handle::before {
    content: '';
    width: 28px;
    height: 3px;
    border-radius: var(--radius-full);
    background: var(--border-color);
    transition: background 0.2s ease;
}

.textarea-resize-handle:hover::before,
.textarea-resize-handle.dragging::before {
    background: var(--accent);
}

.api-key-wrapper {
    position: relative;
    display: flex;
    gap: 8px;
}

.api-key-wrapper input {
    flex: 1;
    margin-bottom: 0;
}

.toggle-visibility {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 12px;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.toggle-visibility:hover {
    background-color: var(--border-color);
}

.toggle-visibility svg {
    display: block;
}

.clear-api-key-btn {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 8px;
    background: transparent;
    color: var(--error);
    border: 1px solid var(--error);
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.clear-api-key-btn:hover {
    background-color: color-mix(in srgb, var(--error) 10%, transparent);
}

/* File Upload Styles */
.file-upload-wrapper {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.file-input-hidden {
    display: none;
}

.file-upload-btn {
    flex: 1;
    padding: 10px 16px;
    background-color: var(--bg-tertiary);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background-color 0.2s, opacity 0.2s;
    text-align: center;
}

.file-upload-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    border-style: solid;
}

.file-upload-btn svg {
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

.file-upload-btn:disabled {
    cursor: progress;
    opacity: 0.8;
}

/* Indeterminate spinner shown inside buttons during an in-flight upload */
.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 6px;
    vertical-align: -2px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.file-clear-btn {
    padding: 10px 14px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background-color 0.2s;
}

.file-clear-btn:hover {
    border-color: var(--error);
    color: var(--error);
}

/* Expression image preview in the modal. Sized and centered to match the
   persona Avatar tab — any interface for working with images should show the
   image big enough to actually judge it. */
.expression-image-preview {
    width: 200px;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    overflow: hidden;
}

.expression-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.expression-image-preview .preview-placeholder {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.toggle-visibility:hover {
    background-color: var(--border-color);
}

.help-text {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: 4px;
    margin-bottom: 12px;
}

.section-note {
    font-size: var(--text-xs);
    color: var(--accent);
    margin: -4px 0 12px 0;
    font-style: italic;
}

/* "n/max" counter shown inline in the tagline / role field labels */
.field-counter {
    float: right;
    font-size: var(--text-xs);
    font-weight: 400;
    color: var(--text-muted);
}

/* Size and Position Preset Buttons */
.size-preset-buttons,
.position-preset-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.size-preset-btn,
.position-preset-btn {
    flex: 1;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.size-preset-btn:hover,
.position-preset-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.size-preset-btn.active,
.position-preset-btn.active {
    background: var(--accent-subtle);
    border-color: var(--accent);
    color: var(--accent);
}

.position-preset-btn svg {
    display: block;
    margin: 0 auto;
}

/* Checkbox wrapper */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.checkbox-wrapper label {
    margin-bottom: 0;
    font-size: var(--text-sm);
}

/* ===== Expression grid =====
   Image-first: expressions are art, so each slot shows the face big enough to
   judge. Same 1:1 rounded frame as the persona portrait, one step smaller. */
.expression-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.expression-slot {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.expression-slot:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
    border-radius: var(--radius-md);
}

.expression-slot-face {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color 0.15s, transform 0.15s;
}

.expression-slot:hover .expression-slot-face {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.expression-slot-face img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.expression-slot-emoji {
    font-size: 34px;
    line-height: 1;
}

/* A slot with nothing at all is a gap to fill — say so quietly. */
.expression-slot.no-image .expression-slot-face {
    border-style: dashed;
    background: transparent;
}

/* Falling back to the default avatar: dashed border still marks "no art of its
   own", and the avatar sits back a little so the mood badge reads first. */
.expression-slot.fallback-avatar .expression-slot-face {
    border-style: dashed;
}

.expression-slot.fallback-avatar .expression-slot-face img {
    opacity: 0.55;
}

.expression-slot:hover .expression-slot-face img {
    opacity: 1;
}

/* Mood badge — the emoji worn over the default avatar. Mirrors the floating
   avatar's badge so the editor previews exactly what chat renders. */
.expression-slot-badge,
.avatar-mood-badge {
    position: absolute;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    line-height: 1;
}

.expression-slot-badge {
    width: 30px;
    height: 30px;
    margin: 4px;
    font-size: 15px;
}

/* Scales with the avatar, which is user-resizable from 32px to 480px. */
.avatar-mood-badge {
    width: 32%;
    height: 32%;
    max-width: 88px;
    max-height: 88px;
    min-width: 16px;
    min-height: 16px;
    margin: 4%;
    font-size: clamp(9px, 17cqw, 46px);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.expression-slot-face {
    position: relative;
}

.expression-slot-name {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Marks 'thinking' — driven by the UI while generating, not declared. */
.expression-slot-tag {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 1px 5px;
    border-radius: var(--radius-full);
}

.add-expression-btn {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background-color 0.2s;
}

.add-expression-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

