/* ── Premium design system ─────────────────────────────────────────────── */
:root {
    color-scheme: light;
    --font-display: "Cormorant Garamond", "Times New Roman", serif;
    --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    --color-bg: #f6f3ed;
    --color-bg-accent: radial-gradient(ellipse 80% 60% at 10% 0%, rgba(196, 169, 98, 0.12), transparent 55%),
        radial-gradient(ellipse 60% 50% at 90% 10%, rgba(196, 169, 98, 0.08), transparent 50%),
        #f6f3ed;
    --color-surface: rgba(255, 255, 255, 0.82);
    --color-surface-solid: #fffcf7;
    --color-surface-elevated: rgba(255, 255, 255, 0.94);
    --color-border: rgba(28, 25, 23, 0.08);
    --color-border-strong: rgba(28, 25, 23, 0.14);
    --color-text: #1c1917;
    --color-text-muted: #78716c;
    --color-accent: #b8954a;
    --color-accent-hover: #9a7a35;
    --color-accent-soft: rgba(184, 149, 74, 0.14);
    --color-accent-glow: rgba(196, 169, 98, 0.35);
    --color-primary: #1c1917;
    --color-primary-hover: #292524;
    --color-primary-text: #faf8f4;
    --color-secondary: rgba(28, 25, 23, 0.05);
    --color-secondary-hover: rgba(28, 25, 23, 0.09);
    --color-danger: #b91c1c;
    --color-warning: #b45309;
    --color-success: #047857;
    --color-focus: #b8954a;
    --color-sidebar: #0a0a0b;
    --color-sidebar-elevated: #141416;
    --color-sidebar-text: #f5f0e8;
    --color-sidebar-muted: #8a8580;
    --color-sidebar-active: rgba(196, 169, 98, 0.12);
    --color-sidebar-border: rgba(255, 255, 255, 0.06);
    --color-message-user: rgba(196, 169, 98, 0.1);
    --color-message-assistant: rgba(255, 255, 255, 0.7);
    --shadow-xs: 0 1px 2px rgba(28, 25, 23, 0.04);
    --shadow-sm: 0 4px 16px rgba(28, 25, 23, 0.06);
    --shadow-md: 0 12px 40px rgba(28, 25, 23, 0.1);
    --shadow-lg: 0 24px 64px rgba(28, 25, 23, 0.14);
    --shadow-gold: 0 8px 32px rgba(184, 149, 74, 0.22);
    --radius-sm: 0.5rem;
    --radius-md: 0.875rem;
    --radius-lg: 1.25rem;
    --radius-xl: 1.75rem;
    --sidebar-width: 17rem;
    --header-height: 4rem;
    --chat-sidebar-width: 18rem;
    --transition: 220ms cubic-bezier(0.4, 0, 0.2, 1);
    --glass: blur(20px) saturate(1.2);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --touch-min: 44px;
}

[data-theme="dark"] {
    color-scheme: dark;
    --color-bg: #09090b;
    --color-bg-accent: radial-gradient(ellipse 80% 60% at 10% 0%, rgba(196, 169, 98, 0.08), transparent 55%),
        radial-gradient(ellipse 60% 50% at 90% 10%, rgba(196, 169, 98, 0.05), transparent 50%),
        #09090b;
    --color-surface: rgba(24, 24, 27, 0.75);
    --color-surface-solid: #18181b;
    --color-surface-elevated: rgba(30, 30, 33, 0.92);
    --color-border: rgba(255, 255, 255, 0.07);
    --color-border-strong: rgba(255, 255, 255, 0.12);
    --color-text: #f5f0e8;
    --color-text-muted: #a8a29e;
    --color-accent: #d4bc7a;
    --color-accent-hover: #e8d5a3;
    --color-accent-soft: rgba(212, 188, 122, 0.12);
    --color-accent-glow: rgba(212, 188, 122, 0.25);
    --color-primary: #f5f0e8;
    --color-primary-hover: #ffffff;
    --color-primary-text: #0a0a0b;
    --color-secondary: rgba(255, 255, 255, 0.05);
    --color-secondary-hover: rgba(255, 255, 255, 0.09);
    --color-sidebar: #050506;
    --color-sidebar-elevated: #0f0f11;
    --color-message-user: rgba(196, 169, 98, 0.14);
    --color-message-assistant: rgba(255, 255, 255, 0.04);
    --shadow-sm: 0 4px 20px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 12px 48px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 24px 72px rgba(0, 0, 0, 0.55);
}

*, *::before, *::after {
    box-sizing: border-box;
}

/* Author display rules must not override the hidden attribute */
[hidden] {
    display: none !important;
}

html {
    height: 100%;
    height: 100dvh;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html, body {
    height: 100%;
    min-height: 100%;
    min-height: 100dvh;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg-accent);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior-y: none;
}

.brand-logo {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    object-fit: contain;
}

/* Loading skeletons — reserve space to avoid layout shift */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-secondary) 0%,
        var(--color-accent-soft) 45%,
        var(--color-secondary) 90%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.35s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

[data-theme="dark"] .skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.04) 0%,
        rgba(212, 188, 122, 0.12) 45%,
        rgba(255, 255, 255, 0.04) 90%
    );
    background-size: 200% 100%;
}

.skeleton-media {
    aspect-ratio: 1 / 1;
    width: 100%;
    max-width: min(100%, 36rem);
}

.skeleton-text {
    width: 100%;
    max-width: min(100%, 36rem);
    min-height: 6rem;
}

.message-pending--text .message-pending-preview {
    min-height: 6rem;
}

.skeleton-line {
    height: 0.75rem;
    width: 100%;
}

.skeleton-line-sm {
    height: 0.625rem;
    width: 60%;
}

@keyframes skeleton-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

h1, h2, h3, .display-font {
    font-family: var(--font-display);
    font-weight: 500;
    letter-spacing: -0.02em;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--color-accent-hover);
}

img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Inline SVGs — feste Größe, falls Stylesheet verzögert lädt */
.app-shell svg,
.auth-page svg {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}

.sidebar-logo svg {
    width: 1rem;
    height: 1rem;
}

.message-media {
    width: auto;
    height: auto;
    max-width: 100%;
}

/* ── Media frames (aspect-ratio safe display) ─────────────────────────────── */
.media-frame {
    --media-aspect-ratio: 1 / 1;
    --media-frame-max-width: 100%;
    --media-frame-max-height: 28rem;
    aspect-ratio: var(--media-aspect-ratio);
    width: min(100%, var(--media-frame-max-width));
    max-height: var(--media-frame-max-height);
    margin-top: 0.625rem;
    background: var(--color-media-frame-bg, rgba(0, 0, 0, 0.55));
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.media-frame__element {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.media-frame__dimensions {
    position: absolute;
    inset-inline-end: 0.5rem;
    bottom: 0.5rem;
    padding: 0.125rem 0.4375rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    pointer-events: none;
}

.media-frame--chat {
    --media-frame-max-width: min(100%, 36rem);
    --media-frame-max-height: 36rem;
    width: 100%;
}

.media-frame--compare {
    --media-frame-max-width: 100%;
    --media-frame-max-height: 24rem;
    width: 100%;
    margin-top: 0;
}

.media-frame--gallery,
.media-frame--favorites {
    --media-frame-max-width: 100%;
    --media-frame-max-height: none;
    width: 100%;
    margin-top: 0;
    border-radius: 0;
    box-shadow: none;
}

.media-frame--share {
    --media-frame-max-width: 100%;
    --media-frame-max-height: min(72vh, 44rem);
    width: 100%;
    margin-top: 0;
    border-radius: var(--radius-md);
}

.media-frame--inline {
    --media-frame-max-height: 20rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
    min-height: 100dvh;
}

.app-sidebar {
    background: linear-gradient(180deg, var(--color-sidebar) 0%, var(--color-sidebar-elevated) 100%);
    color: var(--color-sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0.875rem;
    padding-top: max(1.25rem, var(--safe-top));
    padding-bottom: max(1.25rem, var(--safe-bottom));
    border-inline-end: 1px solid var(--color-sidebar-border);
    position: relative;
    z-index: 30;
}

.app-sidebar::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 2px;
    background: linear-gradient(180deg, transparent, var(--color-accent), transparent);
    opacity: 0.6;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    padding: 0.25rem 0.75rem 1.25rem;
    border-bottom: 1px solid var(--color-sidebar-border);
}

.sidebar-brand-link {
    display: block;
    text-decoration: none;
    line-height: 0;
}

.sidebar-brand-logo {
    max-width: 10.5rem;
    filter: brightness(1.05);
}

.sidebar-brand-copy strong {
    display: block;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.2;
    color: var(--color-sidebar-text);
}

.sidebar-brand-copy small {
    display: block;
    color: var(--color-sidebar-muted);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--touch-min);
    padding: 0.6875rem 0.875rem;
    border-radius: var(--radius-sm);
    color: var(--color-sidebar-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background var(--transition), color var(--transition), transform var(--transition);
    position: relative;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-link:hover {
    color: var(--color-sidebar-text);
    background: rgba(255, 255, 255, 0.04);
    text-decoration: none;
}

.sidebar-link.is-active {
    color: var(--color-sidebar-text);
    background: var(--color-sidebar-active);
    text-decoration: none;
}

.sidebar-link.is-active::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    border-radius: 0 2px 2px 0;
    background: linear-gradient(180deg, #e8d5a3, #b8954a);
}

.sidebar-icon {
    width: 1.125rem;
    height: 1.125rem;
    opacity: 0.85;
    flex-shrink: 0;
}

.sidebar-link.is-active .sidebar-icon {
    opacity: 1;
    color: var(--color-accent);
}

.sidebar-link-muted {
    color: var(--color-sidebar-muted);
    font-size: 0.8125rem;
    font-weight: 400;
}

.sidebar-footer {
    padding: 1rem 0.75rem 0.25rem;
    border-top: 1px solid var(--color-sidebar-border);
    margin-top: 0.5rem;
}

.sidebar-user-name {
    display: block;
    font-weight: 600;
    font-size: 0.8125rem;
    margin-bottom: 0.375rem;
    color: var(--color-sidebar-text);
}

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

.app-header {
    height: calc(var(--header-height) + var(--safe-top));
    min-height: calc(var(--header-height) + var(--safe-top));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    padding-top: var(--safe-top);
    padding-inline-end: max(1.5rem, var(--safe-right));
    padding-inline-start: max(1.5rem, var(--safe-left));
    background: var(--color-surface);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.app-content {
    flex: 1;
    padding: 1.5rem;
    min-height: 0;
}

.app-content-guest {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 2rem 1rem;
}

/* ── Page chrome ────────────────────────────────────────────────────────── */
.page-header h1,
.page-toolbar h1,
.gallery-toolbar h1,
.prompts-toolbar h1,
.favorites-header h1 {
    margin: 0;
    font-size: 1.375rem;
    font-weight: 600;
}

.page-subtitle {
    color: var(--color-text-muted);
    margin: 0.375rem 0 0;
    font-size: 0.9375rem;
}

.page-narrow {
    max-width: 32rem;
    margin: 0 auto;
}

.sidebar-toggle {
    display: none;
}

/* ── Buttons & forms ────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5625rem 1.125rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, #1c1917 0%, #292524 100%);
    color: var(--color-primary-text);
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .btn-primary {
    background: linear-gradient(135deg, #f5f0e8 0%, #d6d0c4 100%);
    color: #0a0a0b;
}

.btn-primary:hover {
    box-shadow: var(--shadow-md);
}

.btn-accent {
    background: linear-gradient(135deg, #c4a962 0%, #a8893f 100%);
    color: #0a0a0b;
    box-shadow: var(--shadow-gold);
}

.btn-accent:hover {
    filter: brightness(1.06);
}

.btn-secondary {
    background: var(--color-secondary);
    color: var(--color-text);
    border-color: var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-secondary-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-muted);
}

.btn-ghost:hover {
    background: var(--color-secondary);
    color: var(--color-text);
}

.btn-danger {
    background: var(--color-danger);
    color: #fff;
}

.btn-danger:hover {
    filter: brightness(0.92);
}

.btn-sm {
    padding: 0.4375rem 0.875rem;
    font-size: 0.8125rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-secondary);
    cursor: pointer;
    display: inline-grid;
    place-items: center;
    color: var(--color-text-muted);
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.btn-icon:hover {
    background: var(--color-secondary-hover);
    color: var(--color-text);
    border-color: var(--color-border-strong);
}

.btn-icon svg {
    width: 1.125rem;
    height: 1.125rem;
}

.form-control,
.form-select {
    width: 100%;
    padding: 0.6875rem 0.875rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface-solid);
    color: var(--color-text);
    font: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.form-select-sm,
.form-control-sm {
    padding: 0.4375rem 0.625rem;
    font-size: 0.8125rem;
}

.stack-form > div,
.stack-form fieldset {
    margin-bottom: 1rem;
}

.stack-form label,
.stack-form legend {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stack-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]),
.stack-form textarea,
.stack-form select,
.form-inline input:not([type="hidden"]):not([type="submit"]) {
    width: 100%;
    padding: 0.6875rem 0.875rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface-solid);
    color: var(--color-text);
    font: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.stack-form input:focus,
.stack-form textarea:focus,
.stack-form select:focus,
.form-inline input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.stack-form ul {
    list-style: none;
    margin: 0.375rem 0 0;
    padding: 0;
    color: var(--color-danger);
    font-size: 0.8125rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-check-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
    color: var(--color-text);
}

.form-actions {
    margin-top: 1.5rem;
}

.stack-form .form-group:last-of-type {
    margin-bottom: 0;
}

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.alert,
.flash {
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    border: 1px solid transparent;
}

.alert-error,
.flash-error {
    background: rgba(185, 28, 28, 0.08);
    color: var(--color-danger);
    border-color: rgba(185, 28, 28, 0.2);
}

.flash-success {
    background: rgba(4, 120, 87, 0.08);
    color: var(--color-success);
    border-color: rgba(4, 120, 87, 0.2);
}

.flash-warning {
    background: rgba(180, 83, 9, 0.08);
    color: var(--color-warning);
    border-color: rgba(180, 83, 9, 0.2);
}

.flash-info {
    background: rgba(28, 25, 23, 0.05);
    color: var(--color-text);
    border-color: var(--color-border-strong);
}

/* ── Toasts ─────────────────────────────────────────────────────────────── */
.toast-stack {
    position: fixed;
    top: calc(var(--header-height) + 0.75rem);
    right: max(0.75rem, env(safe-area-inset-right));
    left: auto;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    width: min(22rem, calc(100vw - 1.5rem));
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: var(--color-surface-elevated);
    color: var(--color-text);
    box-shadow: var(--shadow-md);
    backdrop-filter: var(--glass);
    font-size: 0.875rem;
    line-height: 1.45;
    opacity: 0;
    transform: translateY(-0.35rem);
    transition: opacity var(--transition), transform var(--transition);
    pointer-events: auto;
}

.toast--visible {
    opacity: 1;
    transform: translateY(0);
}

.toast--dismissing {
    opacity: 0;
    transform: translateY(-0.35rem);
}

.toast-body {
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.toast-close {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    margin: -0.125rem -0.25rem 0 0;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: inherit;
    opacity: 0.65;
    cursor: pointer;
    font-size: 1.125rem;
    line-height: 1;
}

.toast-close:hover {
    opacity: 1;
    background: var(--color-secondary);
}

.toast-success {
    border-color: rgba(4, 120, 87, 0.25);
    background: color-mix(in srgb, var(--color-surface-elevated) 92%, rgba(4, 120, 87, 0.12));
    color: var(--color-success);
}

.toast-error {
    border-color: rgba(185, 28, 28, 0.25);
    background: color-mix(in srgb, var(--color-surface-elevated) 92%, rgba(185, 28, 28, 0.1));
    color: var(--color-danger);
}

.toast-warning {
    border-color: rgba(180, 83, 9, 0.25);
    background: color-mix(in srgb, var(--color-surface-elevated) 92%, rgba(180, 83, 9, 0.1));
    color: var(--color-warning);
}

.toast-info {
    border-color: var(--color-border-strong);
}

[dir="rtl"] .toast-stack {
    right: auto;
    left: max(0.75rem, env(safe-area-inset-left));
}

/* ── Brand logo ─────────────────────────────────────────────────────────── */
.brand-logo {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    object-fit: contain;
}

/* ── Auth ───────────────────────────────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: clamp(1.5rem, 4vw, 3rem);
    padding-top: max(clamp(1.5rem, 4vw, 3rem), var(--safe-top));
    padding-bottom: max(clamp(1.5rem, 4vw, 3rem), var(--safe-bottom));
    padding-inline: max(clamp(1.5rem, 4vw, 3rem), var(--safe-left)) max(clamp(1.5rem, 4vw, 3rem), var(--safe-right));
    background: #f5f5f7;
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .auth-page {
    background: #000;
}

.auth-page::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 55% at 50% -10%, rgba(196, 169, 98, 0.14), transparent 60%),
        radial-gradient(ellipse 45% 35% at 100% 100%, rgba(28, 25, 23, 0.05), transparent 70%);
    pointer-events: none;
}

[data-theme="dark"] .auth-page::before {
    background:
        radial-gradient(ellipse 70% 55% at 50% -10%, rgba(212, 188, 122, 0.12), transparent 60%),
        radial-gradient(ellipse 45% 35% at 100% 100%, rgba(255, 255, 255, 0.04), transparent 70%);
}

.auth-shell {
    width: min(100%, 28rem);
    position: relative;
    z-index: 1;
    animation: landing-rise 700ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-top {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.auth-brand {
    display: inline-flex;
    text-decoration: none;
    line-height: 0;
    transition: opacity var(--transition), transform var(--transition);
}

.auth-brand:hover {
    opacity: 0.82;
    transform: translateY(-1px);
}

.auth-brand-logo {
    max-width: 12.5rem;
}

.auth-card {
    width: 100%;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(28px) saturate(1.4);
    -webkit-backdrop-filter: blur(28px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 1.5rem;
    padding: clamp(2rem, 5vw, 2.75rem);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.04),
        0 24px 80px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .auth-card {
    background: rgba(24, 24, 27, 0.72);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.2),
        0 24px 80px rgba(0, 0, 0, 0.45);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    margin: 0 0 0.5rem;
    font-family: var(--font-sans);
    font-size: clamp(1.75rem, 4vw, 2.125rem);
    font-weight: 600;
    letter-spacing: -0.03em;
}

.auth-header p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 1rem;
    line-height: 1.55;
}

.auth-error {
    background: rgba(185, 28, 28, 0.08);
    color: var(--color-danger);
    padding: 0.875rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    border: 1px solid rgba(185, 28, 28, 0.2);
}

.auth-form .btn-block {
    margin-top: 0.75rem;
    padding: 0.85rem;
    border-radius: 999px;
    font-weight: 600;
}

/* ── Landing page ───────────────────────────────────────────────────────── */
.app-content-guest:has(.landing-page) {
    display: block;
    padding: 0;
    min-height: 100vh;
}

.landing-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: #f5f5f7;
    color: #1d1d1f;
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .landing-page {
    background: #000;
    color: #f5f5f7;
}

.landing-page::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 55% at 50% -20%, rgba(196, 169, 98, 0.16), transparent 62%),
        radial-gradient(ellipse 50% 40% at 100% 0%, rgba(28, 25, 23, 0.04), transparent 70%);
    pointer-events: none;
}

[data-theme="dark"] .landing-page::before {
    background:
        radial-gradient(ellipse 80% 55% at 50% -20%, rgba(212, 188, 122, 0.14), transparent 62%),
        radial-gradient(ellipse 50% 40% at 100% 0%, rgba(255, 255, 255, 0.05), transparent 70%);
}

.landing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem clamp(1.25rem, 4vw, 2.5rem);
    padding-top: max(1rem, var(--safe-top));
    padding-inline-start: max(clamp(1.25rem, 4vw, 2.5rem), var(--safe-left));
    padding-inline-end: max(clamp(1.25rem, 4vw, 2.5rem), var(--safe-right));
    position: sticky;
    top: 0;
    z-index: 5;
    backdrop-filter: blur(18px) saturate(1.3);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    background: rgba(245, 245, 247, 0.72);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .landing-header {
    background: rgba(0, 0, 0, 0.55);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.landing-brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    line-height: 0;
    transition: opacity var(--transition), transform var(--transition);
}

.landing-brand:hover {
    opacity: 0.82;
    transform: translateY(-1px);
}

.landing-logo {
    max-width: clamp(9rem, 24vw, 12.5rem);
    height: auto;
}

.landing-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.landing-login {
    border-radius: 999px;
    padding-inline: 1.25rem;
}

.landing-main {
    flex: 1;
    width: min(100%, 68rem);
    margin: 0 auto;
    padding: clamp(2rem, 6vw, 4.5rem) clamp(1.25rem, 4vw, 2.5rem) clamp(3rem, 8vw, 5rem);
    position: relative;
    z-index: 1;
}

.landing-hero {
    text-align: center;
    max-width: 46rem;
    margin: 0 auto clamp(3rem, 8vw, 5rem);
    animation: landing-rise 800ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.landing-eyebrow {
    margin: 0 0 1.25rem;
    color: var(--color-accent);
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.landing-title {
    margin: 0 0 1.5rem;
    font-family: var(--font-sans);
    font-size: clamp(2.5rem, 6.5vw, 4.5rem);
    font-weight: 700;
    line-height: 1.02;
    letter-spacing: -0.045em;
}

.landing-title-line {
    display: inline-block;
    background: linear-gradient(180deg, currentColor 0%, color-mix(in srgb, currentColor 72%, var(--color-accent)) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.landing-lead {
    margin: 0 auto 2.25rem;
    max-width: 38rem;
    color: var(--color-text-muted);
    font-size: clamp(1.0625rem, 2.4vw, 1.25rem);
    line-height: 1.6;
}

.landing-hero-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

.landing-cta {
    padding: 0.9rem 1.85rem;
    font-size: 1rem;
    border-radius: 999px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(184, 149, 74, 0.22);
}

.landing-features {
    animation: landing-rise 900ms 120ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.landing-section-title {
    margin: 0 0 clamp(1.5rem, 4vw, 2.25rem);
    font-family: var(--font-sans);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    text-align: center;
}

.landing-feature-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 1rem;
}

.landing-feature-card {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(20px) saturate(1.25);
    -webkit-backdrop-filter: blur(20px) saturate(1.25);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 1.25rem;
    padding: 1.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
    transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] .landing-feature-card {
    background: rgba(24, 24, 27, 0.62);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.28);
}

.landing-feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.1);
}

.landing-feature-card-wide {
    grid-column: 1 / -1;
}

@media (min-width: 48rem) {
    .landing-feature-card-wide {
        grid-column: span 2;
    }

    .landing-feature-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 64rem) {
    .landing-feature-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .landing-feature-card-wide {
        grid-column: span 3;
    }
}

.landing-feature-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.875rem;
    background: rgba(184, 149, 74, 0.1);
    border: 1px solid rgba(184, 149, 74, 0.18);
    display: grid;
    place-items: center;
    color: var(--color-accent);
    margin-bottom: 1rem;
}

.landing-feature-card h3 {
    margin: 0 0 0.5rem;
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.landing-feature-card p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.9375rem;
    line-height: 1.55;
}

.landing-footer {
    padding: 1.5rem clamp(1.25rem, 4vw, 2.5rem);
    padding-bottom: max(1.5rem, var(--safe-bottom));
    padding-inline-start: max(clamp(1.25rem, 4vw, 2.5rem), var(--safe-left));
    padding-inline-end: max(clamp(1.25rem, 4vw, 2.5rem), var(--safe-right));
    text-align: center;
    position: relative;
    z-index: 1;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .landing-footer {
    border-top-color: rgba(255, 255, 255, 0.08);
}

.landing-footer p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.8125rem;
}

.share-brand,
.share-brand-logo {
    display: block;
    max-width: 10.5rem;
}

.share-brand {
    line-height: 0;
    transition: opacity var(--transition);
    flex-shrink: 0;
}

.share-brand:hover {
    opacity: 0.82;
}

@keyframes landing-rise {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .landing-header {
        padding-inline: 1rem;
    }

    .landing-main {
        padding-inline: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .landing-hero,
    .landing-features,
    .auth-shell,
    .landing-feature-card {
        animation: none;
        transition: none;
    }
}

/* ── Chat ───────────────────────────────────────────────────────────────── */
.chat-layout {
    display: grid;
    grid-template-columns: var(--chat-sidebar-width) 1fr;
    gap: 1.25rem;
    height: calc(100vh - var(--header-height) - 3rem);
    min-height: 32rem;
}

.chat-sidebar {
    background: var(--color-surface);
    backdrop-filter: var(--glass);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.chat-sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.chat-sidebar-header h2 {
    margin: 0 0 0.875rem;
    font-size: 1.125rem;
}

.conversation-list {
    list-style: none;
    margin: 0;
    padding: 0.625rem;
    overflow-y: auto;
    flex: 1;
}

.conversation-item {
    margin-bottom: 0.125rem;
}

.conversation-link {
    display: block;
    padding: 0.75rem 0.875rem;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    text-decoration: none;
    transition: background var(--transition);
}

.conversation-link:hover,
.conversation-item.is-active .conversation-link {
    background: var(--color-accent-soft);
    text-decoration: none;
}

.conversation-item.is-active .conversation-link {
    box-shadow: inset 2px 0 0 var(--color-accent);
}

.conversation-title {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-date {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.1875rem;
}

.conversation-empty {
    padding: 1.25rem;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.chat-main {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    backdrop-filter: var(--glass);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    min-width: 0;
    box-shadow: var(--shadow-sm);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.chat-empty {
    margin: auto;
    text-align: center;
    color: var(--color-text-muted);
    max-width: 26rem;
    padding: 2rem;
}

.chat-empty h2 {
    font-size: 1.375rem;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.message {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem 1.125rem;
    max-width: min(100%, 44rem);
    box-shadow: var(--shadow-xs);
}

.message-user {
    background: var(--color-message-user);
    align-self: flex-end;
    border-color: rgba(196, 169, 98, 0.2);
    max-width: min(100%, 40rem);
}

.message-assistant {
    background: var(--color-message-assistant);
    align-self: flex-start;
    max-width: min(100%, 52rem);
}

.message-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.625rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.message-header strong {
    color: var(--color-accent);
    font-weight: 600;
}

.message-text {
    margin: 0 0 0.75rem;
    white-space: pre-wrap;
    line-height: 1.65;
}

.message-prompt-block {
    margin-bottom: 0.75rem;
}

.message-prompt-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
}

.message-prompt-text {
    margin: 0;
    white-space: pre-wrap;
    line-height: 1.65;
    font-size: 0.9375rem;
}

.message-prompt-text.is-collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.message-prompt-text.is-collapsed.is-expanded {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}

.message-prompt-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.375rem;
}

.message-prompt-original {
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed var(--color-border);
}

.message-negative-prompt {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.message-negative-prompt summary {
    cursor: pointer;
    user-select: none;
}

.message-media,
.media-frame--chat {
    margin-top: 0.625rem;
}

.message-media-block {
    margin-top: 0.625rem;
}

.message-media-block .media-frame--chat {
    margin-top: 0;
}

.message-generated-text {
    margin-top: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-surface-elevated, var(--color-surface));
}

.message-generated-text-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.message-generated-text-body {
    white-space: pre-wrap;
    line-height: 1.6;
    font-size: 0.9375rem;
    max-height: 28rem;
    overflow-y: auto;
}

.chat-layout.is-text-mode .toolbar-group-compare,
.chat-layout.is-text-mode .edit-mode-toggle,
.chat-layout.is-text-mode .negative-prompt-details,
.chat-layout.is-text-mode [data-chat-target="strengthWrap"] {
    display: none;
}

.chat-layout.is-text-mode .composer-textarea {
    min-height: 8rem;
}

.message-reference-item {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: flex-start;
}

.message-reference-item figcaption {
    font-size: 0.6875rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.message-reference {
    max-width: 10rem;
    max-height: 10rem;
    width: auto;
    height: auto;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: 0;
    border: 1px solid var(--color-border);
}

.message-pending {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--color-secondary);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    margin-top: 0.625rem;
    min-width: 12rem;
    width: 100%;
    max-width: 36rem;
    border: 1px solid var(--color-border);
}

.message-pending-skeleton {
    max-width: none;
    border-radius: var(--radius-sm);
}

.message-pending-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.625rem;
    padding: 0 0.25rem 0.25rem;
}

.message-pending-label {
    font-weight: 600;
    color: var(--color-text);
}

.message-error-block {
    margin-top: 0.625rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.625rem;
    max-width: 36rem;
}

.message-retry-btn {
    flex-shrink: 0;
}

.message-error {
    color: var(--color-danger);
    font-size: 0.875rem;
    margin-top: 0.625rem;
    padding: 0.625rem 0.875rem;
    background: rgba(185, 28, 28, 0.08);
    border: 1px solid rgba(185, 28, 28, 0.2);
    border-radius: var(--radius-sm);
    line-height: 1.45;
}

.message-actions {
    margin-top: 0.625rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.message-seed {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.message-seed-value {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.8125rem;
    padding: 0.125rem 0.375rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
}

.message-seed-copy {
    min-height: auto;
    padding: 0.125rem 0.5rem !important;
    font-size: 0.75rem;
}

.aspect-ratio-chips {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.aspect-ratio-chip {
    padding: 0.3125rem 0.625rem;
    border-radius: 999px;
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface-solid);
    color: var(--color-text);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

.aspect-ratio-chip:hover,
.aspect-ratio-chip.is-active {
    border-color: var(--color-accent);
    background: var(--color-accent-soft);
}

.seed-input {
    width: 8rem;
    margin-top: 0.25rem;
}

.reference-strength {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.625rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.reference-strength-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text);
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-width: 9rem;
}

.reference-strength-value {
    color: var(--color-accent);
    font-variant-numeric: tabular-nums;
}

.reference-strength-slider {
    flex: 1;
    min-width: 8rem;
    max-width: 16rem;
    accent-color: var(--color-accent);
}

.reference-strength-hint {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    flex-basis: 100%;
}

.edit-mode-toggle {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.edit-mode-option {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
    cursor: pointer;
}

.edit-mode-option input {
    accent-color: var(--color-accent);
}

.inpaint-editor {
    margin-bottom: 0.75rem;
    padding: 0.875rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: border-color 0.15s ease;
}

.inpaint-editor.is-mask-ready {
    border-color: color-mix(in srgb, var(--color-accent) 55%, var(--color-border));
}

.inpaint-editor-header {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.625rem;
}

.inpaint-editor-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.inpaint-mask-status {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 999px;
}

.inpaint-mask-status.is-ready {
    color: var(--color-accent);
    border-color: color-mix(in srgb, var(--color-accent) 45%, var(--color-border));
    background: color-mix(in srgb, var(--color-accent) 8%, var(--color-bg));
}

.inpaint-editor-hint {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    line-height: 1.4;
}

.inpaint-canvas-wrap {
    position: relative;
    max-width: 100%;
    overflow: auto;
    border-radius: var(--radius-sm);
    background: #111;
    -webkit-overflow-scrolling: touch;
}

.inpaint-source-image {
    display: block;
    max-width: 100%;
}

.inpaint-mask-canvas {
    display: block;
    max-width: 100%;
    cursor: none;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.inpaint-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-top: 0.75rem;
}

.inpaint-tool-group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.inpaint-tool-group .btn.is-active,
.inpaint-tool-btn.is-active {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: color-mix(in srgb, var(--color-accent) 10%, transparent);
}

.inpaint-tool-btn {
    min-height: 2.25rem;
    min-width: 2.25rem;
}

.inpaint-brush-size {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    flex: 1 1 12rem;
    min-width: min(100%, 14rem);
}

.inpaint-brush-size input[type='range'] {
    flex: 1 1 6rem;
    width: auto;
    min-width: 5rem;
    accent-color: var(--color-accent);
}

.inpaint-brush-size-value {
    min-width: 2.75rem;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-muted);
    font-size: 0.75rem;
}

@media (max-width: 640px) {
    .inpaint-editor {
        padding: 0.75rem;
    }

    .inpaint-tools {
        flex-direction: column;
        align-items: stretch;
    }

    .inpaint-tool-group {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
    }

    .inpaint-tool-group .inpaint-tool-btn:nth-child(n + 4) {
        grid-column: span 1;
    }

    .inpaint-tool-btn {
        min-height: 2.75rem;
        padding-inline: 0.5rem;
        font-size: 0.8125rem;
    }

    .inpaint-brush-size {
        width: 100%;
    }
}

.inpaint-strength-hint {
    margin-top: 0.25rem;
}

.spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--color-border-strong);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.chat-composer {
    border-top: 1px solid var(--color-border);
    padding: 1rem 1.25rem 1.25rem;
    padding-bottom: max(1.25rem, var(--safe-bottom));
    background: var(--color-surface-elevated);
}

.composer-primary {
    display: grid;
    grid-template-columns: auto minmax(10rem, 1fr) auto;
    gap: 0.875rem 1rem;
    align-items: end;
    margin-bottom: 0.875rem;
}

.composer-primary-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
}

.composer-primary-actions .reference-upload {
    margin: 0;
    cursor: pointer;
}

.composer-primary-actions .send-btn {
    min-width: 7rem;
}

.composer-advanced {
    margin-top: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    padding: 0.625rem 0.875rem 0.875rem;
}

.composer-advanced > summary {
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-muted);
    user-select: none;
    list-style-position: outside;
}

.composer-advanced[open] > summary {
    margin-bottom: 0.75rem;
    color: var(--color-text);
}

.composer-toolbar-advanced {
    margin-bottom: 0.75rem;
}

.compare-model-subhint {
    margin: 0 0 0.375rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    line-height: 1.4;
}

.reference-attachments-wrap {
    margin-bottom: 0.75rem;
    padding: 0.625rem 0.75rem;
    background: var(--color-accent-soft);
    border: 1px solid rgba(196, 169, 98, 0.25);
    border-radius: var(--radius-md);
}

.reference-attachments-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.composer-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.875rem 1.25rem;
    margin-bottom: 0.875rem;
    align-items: flex-end;
}

.toolbar-group {
    display: flex;
    flex-direction: column;
    gap: 0.3125rem;
    min-width: 0;
}

.toolbar-label {
    font-size: 0.6875rem;
    color: var(--color-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.toolbar-check {
    justify-content: flex-end;
}

.btn-group {
    display: inline-flex;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--color-surface-solid);
}

.btn-toggle {
    cursor: pointer;
}

.btn-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.btn-toggle span {
    display: block;
    padding: 0.4375rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 600;
    background: transparent;
    color: var(--color-text-muted);
    transition: background var(--transition), color var(--transition);
}

.btn-toggle input:checked + span {
    background: var(--color-primary);
    color: var(--color-primary-text);
}

.batch-input {
    width: 4rem;
}

.compare-group {
    max-width: min(100%, 72rem);
    align-self: stretch;
}

.compare-group-prompt {
    margin-bottom: 0.875rem;
}

.compare-grid {
    display: grid;
    gap: 0.875rem;
    margin-top: 0.625rem;
}

.compare-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compare-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compare-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 900px) {
    .compare-grid-3,
    .compare-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .compare-grid-2,
    .compare-grid-3,
    .compare-grid-4 {
        grid-template-columns: 1fr;
    }
}

.compare-slot {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-solid);
    overflow: hidden;
    min-height: 12rem;
}

.compare-slot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-secondary);
    font-size: 0.75rem;
}

.compare-slot-model {
    font-weight: 600;
    color: var(--color-accent);
    letter-spacing: 0.04em;
}

.compare-slot-status {
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.compare-slot-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem;
    min-height: 10rem;
}

.compare-slot-media,
.media-frame--compare {
    width: 100%;
}

.compare-slot-pending {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    width: 100%;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.compare-slot-skeleton {
    max-width: none;
    --media-frame-max-height: 24rem;
    max-height: 24rem;
}

.compare-slot-pending-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
}

.compare-slot-error {
    color: var(--color-danger);
    font-size: 0.8125rem;
    line-height: 1.45;
    padding: 0.5rem;
    text-align: center;
}

.toolbar-group-compare {
    flex: 1 1 100%;
    max-width: 100%;
}

.compare-model-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.compare-model-chip {
    cursor: pointer;
}

.compare-model-chip span {
    display: inline-block;
    padding: 0.3125rem 0.625rem;
    border: 1px solid var(--color-border-strong);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    background: var(--color-surface-solid);
    transition: background var(--transition), border-color var(--transition), color var(--transition), opacity var(--transition);
}

.compare-model-chip.is-selected span {
    background: var(--color-accent-soft);
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.compare-model-chip.is-disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.compare-model-hint {
    margin: 0.25rem 0 0;
    font-size: 0.6875rem;
    color: var(--color-text-muted);
}

.composer-input-row {
    display: block;
    margin-bottom: 0.75rem;
}

.composer-prompt-wrap {
    position: relative;
    border-radius: var(--radius-md);
    transition: box-shadow var(--transition), background var(--transition);
}

.composer-prompt-wrap.is-drag-over {
    background: var(--color-accent-soft);
    box-shadow: inset 0 0 0 2px var(--color-accent);
}

.composer-textarea {
    width: 100%;
    min-height: 5.5rem;
    resize: vertical;
    padding: 0.875rem 11rem 0.875rem 1rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-surface-solid);
    color: var(--color-text);
    font: inherit;
    line-height: 1.55;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.composer-textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.enhance-btn {
    color: var(--color-accent) !important;
    font-weight: 600;
}

.composer-prompt-actions {
    position: absolute;
    inset-inline-end: 0.5rem;
    bottom: 0.5rem;
    display: flex;
    gap: 0.25rem;
}

.preset-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
}

.preset-chip {
    padding: 0.3125rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface-solid);
    color: var(--color-text);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

.preset-chip:hover {
    border-color: var(--color-accent);
    background: var(--color-accent-soft);
}

.preset-chip-system {
    border-color: rgba(196, 169, 98, 0.35);
}

.preset-chip-negative {
    border-color: rgba(220, 80, 80, 0.35);
    color: var(--color-text);
}

.preset-chip-negative:hover {
    border-color: rgba(220, 80, 80, 0.65);
    background: rgba(220, 80, 80, 0.08);
}

.negative-preset-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.5rem;
}

.prompt-history-dropdown {
    position: absolute;
    inset-inline: 0;
    top: calc(100% + 0.25rem);
    z-index: 20;
    margin: 0;
    padding: 0.25rem 0;
    list-style: none;
    max-height: 14rem;
    overflow-y: auto;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-surface-solid);
    box-shadow: var(--shadow-md);
}

.prompt-history-item {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 0;
    background: transparent;
    color: var(--color-text);
    text-align: start;
    font: inherit;
    cursor: pointer;
}

.prompt-history-item:hover,
.prompt-history-item.is-active {
    background: var(--color-accent-soft);
}

.prompt-history-text {
    display: block;
    font-size: 0.875rem;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prompt-history-empty {
    padding: 0.625rem 0.75rem;
    color: var(--color-text-muted);
    font-size: 0.8125rem;
}

.prompt-history-field {
    position: relative;
}

.prompts-section {
    margin-top: 2rem;
}

.prompts-section-header {
    margin-bottom: 0.75rem;
}

.prompts-section-header h2 {
    margin: 0 0 0.25rem;
    font-size: 1.25rem;
}

.prompts-negative-chips {
    margin-bottom: 1rem;
}

.negative-prompt-details {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
}

.negative-prompt-details summary {
    cursor: pointer;
    color: var(--color-text-muted);
    font-weight: 600;
    user-select: none;
}

.negative-prompt-details textarea {
    margin-top: 0.375rem;
}

.composer-side {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
}

.reference-upload {
    cursor: pointer;
}

.reference-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.reference-attachments .reference-attachment {
    margin-bottom: 0;
    flex: 1 1 14rem;
    max-width: 100%;
}

.message-references {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.625rem;
}

.message-references .message-reference {
    margin-bottom: 0;
}

.reference-attachment {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.625rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

.reference-attachment:hover {
    border-color: var(--color-border-strong);
    background: var(--color-surface-elevated);
}

.reference-attachment-thumb {
    width: 4rem;
    height: 4rem;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    flex-shrink: 0;
}

.reference-attachment-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.reference-attachment-remote {
    border-color: rgba(196, 169, 98, 0.35);
}

.reference-attachment-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
    min-width: 0;
    flex: 1;
}

.reference-attachment-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.reference-attachment-change {
    padding: 0 !important;
    min-height: auto;
    font-size: 0.75rem;
    color: var(--color-accent) !important;
}

.reference-attachment-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-muted);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition), color var(--transition);
}

.reference-attachment-remove:hover {
    background: var(--color-secondary-hover);
    color: var(--color-danger);
}

.send-btn {
    min-width: 6.5rem;
}

.send-btn:disabled,
.enhance-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Gallery & favorites ────────────────────────────────────────────────── */
.gallery-page,
.favorites-page {
    max-width: 80rem;
    margin: 0 auto;
    padding-bottom: 5rem;
}

.gallery-toolbar,
.favorites-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.gallery-toolbar-head {
    min-width: 0;
}

.gallery-toolbar-count {
    margin: 0.25rem 0 0;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.gallery-toolbar-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.gallery-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.gallery-toolbar-btn-icon {
    opacity: 0.72;
    font-size: 0.875rem;
}

.gallery-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.125rem;
    height: 1.125rem;
    padding: 0 0.3125rem;
    border-radius: 999px;
    background: var(--color-accent);
    color: var(--color-primary-text);
    font-size: 0.625rem;
    font-weight: 700;
}

.gallery-filter-pills {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    margin-bottom: 1rem;
    scrollbar-width: none;
}

.gallery-filter-pills::-webkit-scrollbar {
    display: none;
}

.gallery-filter-pill {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    padding: 0.4375rem 0.875rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
}

.gallery-filter-pill:hover {
    color: var(--color-text);
    border-color: var(--color-border-strong);
}

.gallery-filter-pill.is-active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-primary-text);
    box-shadow: var(--shadow-xs);
}

.gallery-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 1rem;
}

.gallery-active-filter {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    background: var(--color-accent-soft);
    border: 1px solid rgba(196, 169, 98, 0.22);
    color: var(--color-text);
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
}

.gallery-active-filter--reset {
    background: transparent;
    border-color: var(--color-border);
    color: var(--color-text-muted);
}

.gallery-panel {
    background: var(--color-surface);
    backdrop-filter: var(--glass);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.gallery-panel-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9375rem;
    list-style: none;
    user-select: none;
}

.gallery-panel-summary::-webkit-details-marker {
    display: none;
}

.gallery-panel-summary::after {
    content: '›';
    transform: rotate(90deg);
    transition: transform var(--transition);
    color: var(--color-text-muted);
    font-size: 1.125rem;
    line-height: 1;
}

.gallery-panel[open] .gallery-panel-summary::after {
    transform: rotate(-90deg);
}

.gallery-panel-hint {
    color: var(--color-text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
}

.gallery-panel-body {
    padding: 0 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.filters-card {
    background: var(--color-surface);
    backdrop-filter: var(--glass);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-xs);
}

.gallery-filters-panel[hidden] {
    display: none !important;
}

.filters-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.875rem 1.25rem;
    align-items: end;
}

.filters-search-group {
    grid-column: 1 / -1;
}

.filters-actions {
    display: flex;
    gap: 0.625rem;
    flex-wrap: wrap;
}

.gallery-grid,
.favorites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
    gap: 0.75rem;
}

.gallery-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.gallery-pagination-status {
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.gallery-card,
.favorites-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xs);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    content-visibility: auto;
    contain-intrinsic-size: auto 14rem;
}

.gallery-card[data-visible="false"] {
    opacity: 0;
    transform: translateY(0.75rem);
}

.gallery-card[data-visible="true"] {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 420ms cubic-bezier(0.4, 0, 0.2, 1), transform 420ms cubic-bezier(0.4, 0, 0.2, 1), border-color var(--transition), box-shadow var(--transition);
}

.gallery-card:hover,
.favorites-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(196, 169, 98, 0.22);
}

.gallery-card-media-wrap {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--color-secondary);
}

.gallery-card-media,
.favorites-card-media {
    background: transparent;
    display: block;
    overflow: hidden;
    position: relative;
    padding: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    min-height: 0;
}

.gallery-card-media .media-frame--gallery,
.favorites-card-media .media-frame--favorites {
    height: 100%;
    max-height: none;
}

.gallery-card-media-btn {
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    background: transparent;
    cursor: zoom-in;
    font: inherit;
    color: inherit;
    display: block;
}

.gallery-card-media-inner,
.media-frame--gallery {
    width: 100%;
    height: 100%;
}

.gallery-no-preview {
    color: var(--color-text-muted);
    font-size: 0.8125rem;
    display: grid;
    place-items: center;
    min-height: 100%;
    padding: 1rem;
}

.gallery-card-media-btn:disabled {
    cursor: default;
}

.gallery-card-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0.625rem;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, 0.72) 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-card:hover .gallery-card-overlay,
.gallery-card:focus-within .gallery-card-overlay {
    opacity: 1;
    pointer-events: auto;
}

.gallery-card-overlay-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    justify-content: center;
}

.gallery-overlay-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #1c1917;
    font-size: 0.8125rem;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    backdrop-filter: blur(12px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    transition: transform 160ms ease, background 160ms ease;
}

.gallery-overlay-btn:hover {
    transform: scale(1.08);
    background: #fff;
}

.gallery-overlay-btn.is-favorited {
    color: var(--color-accent);
}

.gallery-overlay-btn--danger:hover {
    background: #fee2e2;
    color: var(--color-danger);
}

.gallery-fav-indicator {
    position: absolute;
    top: 0.5rem;
    inset-inline-end: 0.5rem;
    z-index: 1;
    color: var(--color-accent);
    font-size: 0.875rem;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

.gallery-media-badge {
    position: absolute;
    inset-inline-end: 0.5rem;
    bottom: 0.5rem;
    z-index: 1;
    padding: 0.1875rem 0.5rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    pointer-events: none;
}

.gallery-card-media img,
.gallery-card-media video,
.favorites-card-media img,
.favorites-card-media video,
.gallery-card-media .media-frame__element,
.favorites-card-media .media-frame__element {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-card:hover .gallery-card-media .media-frame__element,
.gallery-card:hover .gallery-card-media img,
.gallery-card:hover .gallery-card-media video,
.favorites-card:hover .favorites-card-media .media-frame__element,
.favorites-card:hover .favorites-card-media img,
.favorites-card:hover .favorites-card-media video {
    transform: scale(1.04);
}

.gallery-card-details {
    border-top: 1px solid var(--color-border);
}

.gallery-card-details[hidden] {
    display: none !important;
}

.gallery-card-body,
.favorites-card-body {
    padding: 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    flex: 1;
}

.gallery-card-prompt,
.favorites-card-prompt {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gallery-card-meta,
.favorites-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.gallery-badge,
.favorites-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1875rem 0.5625rem;
    border-radius: 999px;
    background: var(--color-accent-soft);
    color: var(--color-accent);
    font-weight: 600;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.gallery-card-actions,
.favorites-card-actions {
    display: flex;
    gap: 0.375rem;
    margin-top: auto;
    flex-wrap: wrap;
}

.gallery-empty,
.favorites-empty {
    text-align: center;
    padding: 4rem 1.5rem;
    color: var(--color-text-muted);
    background: var(--color-surface);
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius-lg);
}

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
}

.gallery-lightbox[hidden] {
    display: none !important;
    pointer-events: none;
}

.gallery-lightbox-backdrop {
    position: absolute;
    inset: 0;
    border: none;
    background: rgba(0, 0, 0, 0.82);
    cursor: pointer;
}

.gallery-lightbox-content {
    position: relative;
    z-index: 1;
    width: min(92vw, 72rem);
    max-height: 92vh;
    display: grid;
    place-items: center;
    padding: 2.5rem 0.5rem 0.5rem;
}

.gallery-lightbox-close {
    position: absolute;
    top: 0.375rem;
    inset-inline-end: 0.375rem;
    z-index: 2;
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    min-width: 2.25rem;
    min-height: 2.25rem;
    background: rgba(0, 0, 0, 0.55);
    border-color: rgba(255, 255, 255, 0.2);
}

.gallery-lightbox-close:hover {
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
}

.gallery-lightbox-media {
    max-width: 100%;
    max-height: 92vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

body.gallery-lightbox-open {
    overflow: hidden;
}

.btn-favorited {
    color: var(--color-accent) !important;
}

.albums-card {
    background: transparent;
    backdrop-filter: none;
    border: none;
    border-radius: 0;
    padding: 0;
    margin-bottom: 0;
    box-shadow: none;
}

.albums-card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.875rem;
    margin-bottom: 1rem;
}

.albums-card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.album-create-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex: 1;
    min-width: min(100%, 16rem);
    max-width: 28rem;
}

.album-create-form .form-control {
    flex: 1;
    min-width: 8rem;
}

.album-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.album-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.1875rem 0.375rem 0.1875rem 0.1875rem;
    border-radius: 999px;
    background: var(--color-accent-soft);
    border: 1px solid rgba(196, 169, 98, 0.2);
    font-size: 0.8125rem;
}

.album-chip.is-active {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 1px rgba(196, 169, 98, 0.18);
}

.album-chip-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.125rem 0.375rem;
    border-radius: 999px;
    color: inherit;
    text-decoration: none;
}

.album-chip-name {
    font-weight: 600;
    color: var(--color-text);
}

.album-chip-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.3125rem;
    border-radius: 999px;
    background: var(--color-secondary);
    color: var(--color-text-muted);
    font-size: 0.6875rem;
    font-weight: 700;
}

.album-chip-delete {
    min-width: auto;
    padding: 0 0.25rem;
    line-height: 1;
    font-size: 1rem;
}

.albums-empty {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.gallery-card-albums {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.gallery-album-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.4375rem 0.125rem 0.5625rem;
    border-radius: 999px;
    background: var(--color-secondary);
    border: 1px solid var(--color-border);
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.gallery-album-badge-remove {
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    font-size: 0.875rem;
}

.gallery-album-badge-remove:hover {
    color: var(--color-danger, #c44);
}

.gallery-album-select-wrap {
    flex: 1 1 100%;
    margin: 0;
}

.gallery-album-select {
    width: 100%;
}

.gallery-batch-toolbar {
    display: none;
}

.gallery-batch-bar {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 90;
    padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(20px) saturate(1.4);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -8px 32px rgba(28, 25, 23, 0.08);
}

[data-theme="dark"] .gallery-batch-bar {
    background: rgba(24, 24, 27, 0.9);
}

.gallery-batch-bar[hidden] {
    display: none !important;
}

.gallery-batch-bar-inner {
    max-width: 80rem;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.gallery-batch-count {
    font-size: 0.875rem;
    font-weight: 600;
}

.gallery-batch-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.gallery-select-all {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 0.875rem;
    cursor: pointer;
}

.gallery-select-all--compact {
    font-size: 0.8125rem;
}

.gallery-page {
    position: relative;
}

.gallery-page--select-mode .gallery-card-select {
    opacity: 1;
    pointer-events: auto;
}

.gallery-page--select-mode .gallery-card-overlay {
    display: none;
}

.gallery-page--select-mode .gallery-card {
    cursor: pointer;
}

.gallery-card {
    position: relative;
}

.gallery-card-select {
    position: absolute;
    top: 0.5rem;
    inset-inline-start: 0.5rem;
    z-index: 3;
    margin: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

.gallery-page--select-mode .gallery-card-select,
.gallery-card-select:focus-within,
.gallery-card:hover .gallery-card-select,
.gallery-card.is-selected .gallery-card-select {
    opacity: 1;
    pointer-events: auto;
}

.gallery-card-select input {
    width: 1.125rem;
    height: 1.125rem;
    cursor: pointer;
    accent-color: var(--color-accent);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.gallery-card.is-selected {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(196, 169, 98, 0.25);
}

.gallery-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.gallery-tag-link {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    background: var(--color-secondary);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.6875rem;
    font-weight: 600;
    text-decoration: none;
}

.gallery-tag-link:hover {
    color: var(--color-accent);
    border-color: rgba(196, 169, 98, 0.35);
}

.gallery-tags-edit {
    display: flex;
    gap: 0.375rem;
    align-items: center;
}

.gallery-tags-input {
    flex: 1;
    min-width: 0;
}

.album-chip-download {
    min-width: auto;
    padding-inline: 0.4375rem;
    line-height: 1.2;
}

.gallery-share-dialog {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg, 12px);
    padding: 0;
    max-width: 32rem;
    width: calc(100% - 2rem);
    background: var(--color-surface);
    color: var(--color-text);
}

.gallery-share-dialog::backdrop {
    background: rgba(0, 0, 0, 0.55);
}

.gallery-share-form {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.gallery-share-form h2 {
    margin: 0;
    font-size: 1.125rem;
}

.gallery-share-hint {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.9375rem;
}

.gallery-share-access {
    border: 0;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gallery-share-access legend {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.gallery-share-access-option {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.9375rem;
    cursor: pointer;
}

.gallery-share-access-option input {
    margin-top: 0.2rem;
}

.ui-floater-share-form {
    margin: 0;
}

.ui-floater-share-select {
    width: 100%;
    font-size: 0.875rem;
}

.gallery-share-url-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.gallery-share-url-row .form-control {
    flex: 1;
}

.gallery-share-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.25rem;
}

.share-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: clamp(1rem, 3vw, 2rem) clamp(0.875rem, 4vw, 1.5rem);
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    background:
        radial-gradient(ellipse 80% 55% at 50% -20%, rgba(196, 169, 98, 0.12), transparent 62%),
        var(--color-bg);
}

.share-topbar {
    width: min(840px, 100%);
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin-bottom: 1rem;
}

.share-topbar-copy {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.share-product-name {
    font-family: var(--font-display, 'Cormorant Garamond', serif);
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.2;
}

.share-product-tagline {
    color: var(--color-text-muted);
    font-size: 0.8125rem;
}

.share-card {
    width: min(840px, 100%);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
    box-shadow: var(--shadow-md, 0 8px 24px rgba(0, 0, 0, 0.12));
}

.share-media-stage {
    background: var(--color-media-frame-bg, rgba(0, 0, 0, 0.55));
    border-bottom: 1px solid var(--color-border);
}

.share-media-stage .media-frame {
    margin-top: 0;
    border-radius: 0;
    box-shadow: none;
    width: 100%;
    max-width: none;
}

.share-body {
    padding: clamp(1rem, 3vw, 1.5rem);
}

.share-heading {
    margin-bottom: 0.75rem;
}

.share-header {
    text-align: center;
    margin-bottom: 1rem;
}

.share-header h1,
.share-heading h1 {
    margin: 0;
    font-size: clamp(1.25rem, 3vw, 1.5rem);
}

.share-subtitle {
    margin: 0.35rem 0 0;
    color: var(--color-text-muted);
    font-size: 0.9375rem;
}

.share-media {
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
    background: var(--color-bg-muted, #111);
}

.share-media-element,
.media-frame--share {
    display: block;
    width: 100%;
}

.share-prompt {
    margin: 0 0 1rem;
    padding: 0.875rem 1rem;
    line-height: 1.55;
    border-inline-start: 3px solid var(--color-accent, #c4a962);
    background: var(--color-bg-muted, rgba(0, 0, 0, 0.04));
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.9375rem;
}

[data-theme="dark"] .share-prompt {
    background: rgba(255, 255, 255, 0.04);
}

.share-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.share-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    margin-top: 1.25rem;
}

.share-download {
    min-width: 10rem;
    border-radius: 999px;
    padding-inline: 1.25rem;
}

.share-download svg {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}

.share-details {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.share-expiry {
    margin: 0;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.share-access-badge {
    margin: 0.5rem 0 0;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.share-card-unavailable {
    width: min(840px, 100%);
    text-align: center;
    padding: clamp(2rem, 6vw, 3rem) clamp(1rem, 4vw, 2rem);
}

.share-unavailable-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    margin-bottom: 1rem;
    border-radius: 999px;
    background: var(--color-bg-muted, rgba(0, 0, 0, 0.06));
    color: var(--color-text-muted);
}

.share-footer {
    width: min(840px, 100%);
    margin-top: auto;
    padding-top: 1.5rem;
    text-align: center;
}

.share-footer-brand {
    display: inline-block;
    line-height: 0;
    margin-bottom: 0.5rem;
    opacity: 0.85;
    transition: opacity var(--transition);
}

.share-footer-brand:hover {
    opacity: 1;
}

.share-footer-logo {
    display: block;
    max-width: 7.5rem;
    margin: 0 auto;
}

.share-footer p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.8125rem;
}

.app-content-guest:has(.share-page) {
    display: block;
    padding: 0;
    min-height: 100vh;
}

@media (max-width: 640px) {
    .share-topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.625rem;
    }

    .share-actions {
        flex-direction: column;
    }

    .share-actions .btn {
        width: 100%;
    }

    .share-download {
        min-width: 0;
    }

    .media-frame--share {
        --media-frame-max-height: min(62vh, 28rem);
    }
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Prompts ────────────────────────────────────────────────────────────── */
.prompts-page {
    max-width: 58rem;
    margin: 0 auto;
}

.prompts-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.prompts-table-wrap {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

.prompts-table {
    width: 100%;
    border-collapse: collapse;
}

.prompts-table th,
.prompts-table td {
    padding: 0.875rem 1.125rem;
    text-align: start;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

.prompts-table th {
    background: var(--color-secondary);
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.prompts-table tr:last-child td {
    border-bottom: none;
}

.prompts-name {
    font-weight: 600;
}

.prompts-text {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    white-space: pre-wrap;
    max-width: 28rem;
}

.prompts-text-muted {
    color: var(--color-text-muted);
    font-style: italic;
}

.prompts-badge {
    display: inline-block;
    margin-inline-start: 0.375rem;
    padding: 0.125rem 0.4375rem;
    border-radius: 999px;
    background: var(--color-accent-soft);
    color: var(--color-accent);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.prompts-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3125rem;
}

.prompts-tag {
    padding: 0.1875rem 0.5rem;
    border-radius: 999px;
    background: var(--color-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.prompts-category {
    display: inline-flex;
    padding: 0.1875rem 0.5625rem;
    border-radius: 999px;
    background: var(--color-accent-soft);
    color: var(--color-accent);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.prompts-actions {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.prompts-empty {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--color-text-muted);
}

.prompts-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 11, 0.55);
    backdrop-filter: blur(4px);
    display: grid;
    place-items: center;
    z-index: 50;
    padding: 1rem;
}

.prompts-modal {
    width: min(100%, 32rem);
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.prompts-modal h2 {
    margin: 0 0 1rem;
    font-size: 1.375rem;
}

.prompts-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.625rem;
    margin-top: 1.25rem;
}

.prompts-toolbar-intro {
    flex: 1 1 auto;
    min-width: 0;
}

.prompts-toolbar-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.prompts-controls {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    margin-bottom: 1.25rem;
}

.prompts-search-wrap {
    width: 100%;
}

.prompts-search {
    width: 100%;
}

.prompts-kind-tabs {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.prompts-kind-tab {
    padding: 0.4375rem 0.875rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.prompts-kind-tab:hover,
.prompts-kind-tab.is-active {
    background: var(--color-accent-soft);
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.prompts-category-filters {
    display: flex;
    gap: 0.375rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.125rem;
}

.prompts-category-filters::-webkit-scrollbar {
    display: none;
}

.prompts-category-chip {
    flex: 0 0 auto;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-secondary);
    color: var(--color-text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.prompts-category-chip.is-active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}

.prompts-results-meta {
    margin-bottom: 0.75rem;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.prompts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
    gap: 1rem;
}

.prompts-card {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    padding: 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}

.prompts-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.prompts-card-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
}

.prompts-card-title .prompts-name {
    margin: 0;
    font-size: 1rem;
}

.prompts-card-kind {
    display: flex;
}

.prompts-kind-badge {
    display: inline-flex;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.prompts-kind-badge--positive {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}

.prompts-kind-badge--negative {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.prompts-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.prompts-card-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}

.prompts-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: auto;
    padding-top: 0.375rem;
}

.prompts-fab {
    display: none;
    position: fixed;
    inset-inline-end: 1rem;
    bottom: 1rem;
    width: 3.25rem;
    height: 3.25rem;
    border: none;
    border-radius: 50%;
    background: var(--color-accent);
    color: #fff;
    font-size: 1.75rem;
    line-height: 1;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    z-index: 40;
}

.prompts-fab-menu {
    position: fixed;
    inset-inline-end: 1rem;
    bottom: 5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 12rem;
    padding: 0.75rem;
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 40;
}

.prompts-empty--filtered {
    margin-top: 1rem;
}

/* ── Admin (shared tokens) ──────────────────────────────────────────────── */
.admin-shell {
    min-height: 100vh;
    background: var(--color-bg-accent);
}

.admin-header {
    background: var(--color-surface);
    backdrop-filter: var(--glass);
    border-bottom: 1px solid var(--color-border);
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 20;
}

.admin-header-inner {
    max-width: 72rem;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--header-height);
    gap: 1rem;
}

.admin-brand {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--color-text);
    text-decoration: none;
    letter-spacing: 0.02em;
}

.admin-nav {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    flex-wrap: wrap;
}

.admin-nav a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color var(--transition);
}

.admin-nav a:hover,
.admin-nav a.active {
    color: var(--color-accent);
}

.admin-user {
    color: var(--color-text-muted);
    font-size: 0.8125rem;
}

.admin-main {
    max-width: 72rem;
    margin: 0 auto;
    padding: 1.5rem;
}

.admin-main h1 {
    margin: 0 0 1.25rem;
    font-size: 1.375rem;
}

.admin-main h2 {
    margin: 0 0 0.875rem;
    font-size: 1.25rem;
}

.admin-card,
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.375rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-xs);
}

.card-spaced {
    margin-top: 1rem;
}

.analytics-grid {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.analytics-tables {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 1.25rem;
    margin-top: 0.75rem;
}

.analytics-tables h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: var(--color-text-muted);
}

.analytics-empty {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    margin: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 1rem;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 600;
    color: var(--color-accent);
    line-height: 1;
}

.stat-label {
    color: var(--color-text-muted);
    font-size: 0.8125rem;
    margin-top: 0.375rem;
}

.stats-section {
    margin-bottom: 1.5rem;
}

.stats-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    margin: 0 0 0.75rem;
}

.stat-card {
    margin-bottom: 0;
}

.stat-meta {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.stat-value-success {
    color: var(--color-success);
}

.stats-grid-wide {
    grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
}

.admin-page-header {
    margin-bottom: 1.5rem;
}

.admin-page-lead {
    margin: 0.375rem 0 0;
    font-size: 0.875rem;
    max-width: 42rem;
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.card-header-row h2 {
    margin: 0;
}

.provider-health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
    gap: 0.75rem;
}

.provider-health-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.875rem;
    background: var(--color-secondary);
}

.provider-health-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
}

.provider-health-code {
    display: block;
    font-size: 0.6875rem;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.provider-health-capabilities,
.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.provider-health-healthy {
    border-inline-start: 3px solid var(--color-success);
}

.provider-health-degraded {
    border-inline-start: 3px solid #b45309;
}

.provider-health-unhealthy {
    border-inline-start: 3px solid var(--color-danger);
}

.analytics-count {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.summary-chips,
.provider-status-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.summary-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    border-radius: 999px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.summary-chip strong {
    color: var(--color-text);
}

.summary-chip-success {
    border-color: rgba(4, 120, 87, 0.25);
}

.summary-chip-warning {
    border-color: rgba(180, 83, 9, 0.25);
}

.summary-chip-danger {
    border-color: rgba(185, 28, 28, 0.25);
}

.admin-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    align-items: center;
    margin-bottom: 1rem;
}

.admin-search-input,
.admin-filter-select {
    width: auto;
    min-width: 12rem;
    flex: 1 1 12rem;
    max-width: 20rem;
    padding: 0.5625rem 0.75rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface-solid);
    color: var(--color-text);
    font: inherit;
    margin-bottom: 0;
}

.admin-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-data-table {
    min-width: 40rem;
}

.admin-data-table tr.is-current-user {
    background: rgba(196, 169, 98, 0.08);
}

.admin-empty-state {
    text-align: center;
    color: var(--color-text-muted);
}

.provider-capability-hint {
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    line-height: 1.4;
}

.admin-code-wrap {
    word-break: break-all;
}

.provider-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
    gap: 1rem;
}

.provider-status-card h2 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
}

.provider-status-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.875rem;
}

.provider-status-details {
    display: grid;
    gap: 0.75rem;
    margin: 0;
}

.provider-status-details dt {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
}

.provider-status-details dd {
    margin: 0;
}

.admin-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
}

.admin-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 0.3125rem;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-solid);
    cursor: pointer;
}

.admin-nav-toggle-bar {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--color-text);
    border-radius: 1px;
}

.admin-nav-backdrop {
    display: none;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body.admin-nav-open {
    overflow: hidden;
}

.admin-table,
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

.admin-table th,
.admin-table td,
table th,
table td {
    padding: 0.875rem 1.125rem;
    text-align: start;
    border-bottom: 1px solid var(--color-border);
}

.admin-table th,
table th {
    background: var(--color-secondary);
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.admin-table tr:last-child td,
table tr:last-child td {
    border-bottom: none;
}

.badge {
    display: inline-block;
    padding: 0.1875rem 0.5625rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-success {
    background: rgba(4, 120, 87, 0.12);
    color: var(--color-success);
}

.badge-danger {
    background: rgba(185, 28, 28, 0.12);
    color: var(--color-danger);
}

.badge-warning {
    background: rgba(180, 83, 9, 0.14);
    color: #b45309;
}

[data-theme="dark"] .badge-warning {
    color: #fbbf24;
}

.badge-muted {
    background: var(--color-secondary);
    color: var(--color-text-muted);
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.actions {
    display: flex;
    gap: 0.625rem;
    flex-wrap: wrap;
    align-items: center;
}

form.inline {
    display: inline;
}

.admin-main label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-main input[type="text"],
.admin-main input[type="email"],
.admin-main input[type="password"],
.admin-main input[type="number"],
.admin-main select,
.admin-main textarea,
.admin-main .form-control,
.admin-main .form-select {
    width: 100%;
    padding: 0.6875rem 0.875rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    font: inherit;
    margin-bottom: 1rem;
    background: var(--color-surface-solid);
    color: var(--color-text);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 0.875rem;
}

.form-check input {
    width: auto;
    margin: 0;
}

.form-check label {
    margin: 0;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
    color: var(--color-text);
}

.form-help {
    color: var(--color-text-muted);
    font-size: 0.8125rem;
    margin-top: -0.75rem;
    margin-bottom: 1rem;
}

.form-errors {
    color: var(--color-danger);
    font-size: 0.8125rem;
    margin-bottom: 0.625rem;
}

.roles-group {
    margin-bottom: 1rem;
}

.header-spacer {
    flex: 1;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 11, 0.45);
    z-index: 90;
    border: none;
    padding: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-backdrop.is-visible {
    display: block;
}

body.sidebar-open {
    overflow: hidden;
}

/* ── Floating locale / theme (bottom-left) ──────────────────────────────── */
.ui-floater {
    position: fixed;
    inset-inline-start: max(1rem, var(--safe-left));
    bottom: max(1rem, var(--safe-bottom));
    z-index: 60;
}

.ui-floater-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: var(--touch-min);
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--color-border-strong);
    border-radius: 999px;
    background: var(--color-surface-elevated);
    backdrop-filter: var(--glass);
    color: var(--color-text);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: box-shadow var(--transition), transform var(--transition);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.ui-floater-trigger:hover {
    box-shadow: var(--shadow-lg);
}

.ui-floater-panel {
    display: none;
    position: absolute;
    inset-inline-start: 0;
    bottom: calc(100% + 0.5rem);
    width: min(18rem, calc(100vw - 2rem));
    max-height: min(24rem, 60vh);
    overflow-y: auto;
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0.875rem;
}

.ui-floater-panel.is-open {
    display: block;
}

.ui-floater-section + .ui-floater-section {
    margin-top: 0.875rem;
    padding-top: 0.875rem;
    border-top: 1px solid var(--color-border);
}

.ui-floater-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.ui-floater-theme-btn {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-secondary);
    color: var(--color-text);
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
}

.ui-floater-theme-btn:hover {
    background: var(--color-secondary-hover);
}

.ui-floater-languages {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ui-floater-locale-form {
    margin: 0;
}

.ui-floater-locale-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.4375rem 0.625rem;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text);
    font: inherit;
    font-size: 0.875rem;
    text-align: start;
    cursor: pointer;
}

.ui-floater-locale-btn:hover {
    background: var(--color-secondary);
}

.ui-floater-locale-btn.is-active {
    background: var(--color-accent-soft);
    color: var(--color-accent);
    font-weight: 600;
}

/* ── Profile ────────────────────────────────────────────────────────────── */
.page-content {
    max-width: 42rem;
}

.alert-success {
    background: rgba(4, 120, 87, 0.08);
    color: var(--color-success);
    border: 1px solid rgba(4, 120, 87, 0.2);
    padding: 1rem 1.125rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
}

.api-key-display {
    display: block;
    margin: 0.625rem 0;
    padding: 0.75rem 1rem;
    background: var(--color-secondary);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    word-break: break-all;
}

.api-key-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.api-key-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.625rem;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--color-border);
}

.api-key-list li:last-child {
    border-bottom: none;
}

.api-keys-page .page-header p {
    max-width: 42rem;
}

.api-keys-docs-link {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.api-keys-setup .api-keys-steps {
    margin: 1rem 0 1.25rem;
    padding-left: 1.25rem;
    color: var(--color-text);
}

.api-keys-setup .api-keys-steps li + li {
    margin-top: 0.5rem;
}

.api-keys-auth-note {
    margin: 0;
    padding: 0.875rem 1rem;
    background: var(--color-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
}

.api-keys-auth-note code {
    display: block;
    margin-top: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    word-break: break-all;
}

.api-key-reveal-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.api-key-reveal .api-key-display {
    flex: 1;
    min-width: 14rem;
    margin: 0;
}

.api-keys-example-grid {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

@media (min-width: 900px) {
    .api-keys-example-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.api-keys-example-card {
    padding: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-solid);
}

.api-keys-example-card h3 {
    margin: 0 0 0.875rem;
    font-size: 1rem;
}

.api-keys-snippet + .api-keys-snippet {
    margin-top: 0.875rem;
}

.api-keys-snippet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.api-keys-snippet pre {
    margin: 0;
    padding: 0.75rem;
    overflow-x: auto;
    background: var(--color-secondary);
    border-radius: var(--radius-sm);
}

.api-keys-snippet code {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.5;
    white-space: pre;
}

.form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.875rem;
    align-items: flex-end;
}

.form-inline label {
    flex: 1;
    min-width: 12rem;
}

.inline-form {
    display: inline;
    margin-inline-start: auto;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: var(--sidebar-width);
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        z-index: 100;
        transform: translate3d(-100%, 0, 0);
        -webkit-transform: translate3d(-100%, 0, 0);
        transition: transform var(--transition);
        box-shadow: var(--shadow-lg);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: max(1rem, var(--safe-bottom));
        pointer-events: none;
        visibility: hidden;
    }

    [dir="rtl"] .app-sidebar {
        inset: 0 0 0 auto;
        transform: translate3d(100%, 0, 0);
        -webkit-transform: translate3d(100%, 0, 0);
    }

    .app-sidebar.is-open {
        transform: translate3d(0, 0, 0);
        -webkit-transform: translate3d(0, 0, 0);
        pointer-events: auto;
        visibility: visible;
    }

    [dir="rtl"] .app-sidebar.is-open {
        transform: translate3d(0, 0, 0);
        -webkit-transform: translate3d(0, 0, 0);
    }

    .sidebar-backdrop.is-visible {
        display: block;
    }

    .sidebar-toggle {
        display: inline-grid;
        position: relative;
        z-index: 110;
        min-width: var(--touch-min);
        min-height: var(--touch-min);
        touch-action: manipulation;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .chat-layout {
        grid-template-columns: 1fr;
        height: auto;
        min-height: calc(100vh - var(--header-height) - 2rem);
    }

    .chat-sidebar {
        max-height: 13rem;
    }

    .composer-primary {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .composer-primary-actions {
        width: 100%;
    }

    .composer-primary-actions .send-btn {
        flex: 1;
    }

    .composer-input-row {
        grid-template-columns: 1fr;
    }

    .composer-side {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .reference-attachment {
        margin-bottom: 0.625rem;
    }

    .reference-attachment-name {
        max-width: 100%;
    }

    .send-btn {
        flex: 1;
    }

    .message {
        max-width: 100%;
    }

    .app-content,
    .admin-main,
    .app-content-guest:not(:has(.landing-page)) {
        padding-bottom: 5rem;
    }
}

@media (max-width: 768px) {
    .app-content {
        padding: 1rem;
    }

    .app-header {
        padding: 0 1rem;
    }

    .page-header h1,
    .page-toolbar h1,
    .gallery-toolbar h1,
    .prompts-toolbar h1,
    .favorites-header h1 {
        font-size: 1.25rem;
    }

    .chat-layout {
        gap: 0.875rem;
        min-height: auto;
    }

    .chat-messages {
        padding: 1rem;
        gap: 1rem;
    }

    .chat-composer {
        padding: 0.875rem 1rem 1rem;
    }

    .composer-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .toolbar-group {
        width: 100%;
        flex: 1 1 100%;
    }

    .toolbar-group .form-select,
    .toolbar-group .form-control,
    .toolbar-group .btn-group,
    .toolbar-group .aspect-ratio-chips,
    .toolbar-group .compare-model-picker {
        width: 100%;
        max-width: 100%;
    }

    .btn-group {
        flex-wrap: wrap;
    }

    .btn-toggle span {
        padding: 0.4375rem 0.625rem;
        font-size: 0.75rem;
    }

    .aspect-ratio-chips {
        display: flex;
    }

    .aspect-ratio-chip {
        flex: 1 1 auto;
        min-width: 0;
        text-align: center;
    }

    .seed-input {
        width: 100%;
        max-width: none;
    }

    .composer-textarea {
        padding-inline-end: 1rem;
        padding-bottom: 0.875rem;
        min-height: 4.5rem;
    }

    .composer-prompt-wrap {
        display: flex;
        flex-direction: column;
        min-width: 0;
    }

    .composer-prompt-actions {
        position: static;
        flex-wrap: wrap;
        padding: 0.375rem 0 0;
        gap: 0.375rem;
    }

    .composer-prompt-actions .btn {
        flex: 1 1 auto;
        min-width: 0;
        white-space: normal;
        text-align: center;
    }

    .reference-strength {
        flex-direction: column;
        align-items: stretch;
    }

    .reference-strength-label {
        min-width: 0;
    }

    .reference-strength-slider {
        flex: 1 1 auto;
        width: 100%;
        max-width: none;
    }

    .reference-attachment-thumb {
        width: 4.5rem;
        height: 4.5rem;
    }

    .message-actions {
        gap: 0.375rem 0.5rem;
    }

    .message-actions .btn {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 0;
        justify-content: center;
        text-align: center;
    }

    .message-seed + .btn,
    .message-actions .message-seed {
        flex: 1 1 100%;
    }

    .message-header {
        flex-wrap: wrap;
        gap: 0.25rem 0.75rem;
        font-size: 0.6875rem;
    }

    .message-header strong {
        min-width: 0;
    }

    .message-seed {
        flex-wrap: wrap;
        width: 100%;
        gap: 0.25rem 0.5rem;
    }

    .message-seed-value {
        max-width: 100%;
        word-break: break-all;
    }

    .message-actions {
        gap: 0.375rem 0.5rem;
    }

    .compare-slot-header {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 0.25rem 0.5rem;
    }

    .compare-slot-model {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex: 1 1 auto;
    }

    .compare-slot-status {
        flex-shrink: 0;
        font-size: 0.6875rem;
    }

    .compare-model-chip span {
        font-size: 0.6875rem;
        padding: 0.25rem 0.5rem;
    }

    .preset-chips,
    .negative-preset-chips {
        gap: 0.3125rem;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 0.25rem;
    }

    .preset-chips::-webkit-scrollbar,
    .negative-preset-chips::-webkit-scrollbar {
        display: none;
    }

    .preset-chip {
        font-size: 0.75rem;
        padding: 0.4375rem 0.75rem;
        min-height: 2.75rem;
        flex: 0 0 auto;
    }

    .prompts-toolbar-actions--desktop {
        display: none;
    }

    .prompts-fab {
        display: grid;
        place-items: center;
    }

    .prompts-grid {
        grid-template-columns: 1fr;
    }

    .prompts-card-actions .btn {
        flex: 1 1 calc(50% - 0.25rem);
        min-height: 2.75rem;
    }

    .prompts-modal-backdrop {
        align-items: end;
        padding: 0;
    }

    .prompts-modal {
        width: 100%;
        max-height: 92vh;
        overflow-y: auto;
        border-end-start-radius: 0;
        border-end-end-radius: 0;
        border-bottom: none;
    }

    .prompts-category-filters {
        margin-inline: -1rem;
        padding-inline: 1rem;
    }

    .filters-form {
        grid-template-columns: 1fr;
    }

    .filters-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .filters-actions .btn {
        width: 100%;
    }

    .gallery-batch-bar-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .gallery-batch-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .gallery-batch-actions .btn {
        width: 100%;
    }

    .gallery-toolbar-actions {
        width: 100%;
    }

    .gallery-toolbar-actions .btn {
        flex: 1;
    }

    .albums-card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .album-create-form {
        max-width: none;
        width: 100%;
    }

    .album-chip {
        max-width: 100%;
    }

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

    .gallery-grid,
    .favorites-grid {
        grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
        gap: 1rem;
    }

    .gallery-card-meta,
    .favorites-card-meta {
        font-size: 0.6875rem;
    }

    .prompts-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .prompts-table thead {
        display: none;
    }

    .prompts-table tr {
        display: block;
        padding: 0.875rem 0;
        border-bottom: 1px solid var(--color-border);
    }

    .prompts-table td {
        display: block;
        border: none;
        padding: 0.3125rem 1.125rem;
    }

    .prompts-text {
        max-width: none;
    }

    .admin-header {
        padding: 0 1rem;
    }

    .admin-header-inner {
        flex-direction: column;
        align-items: stretch;
        padding: 0.75rem 0;
        min-height: auto;
        position: relative;
    }

    .admin-nav-toggle {
        display: flex;
    }

    .admin-nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 29;
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--transition);
    }

    .admin-nav-backdrop.is-visible {
        opacity: 1;
        pointer-events: auto;
    }

    .admin-nav {
        position: fixed;
        inset-block: 0;
        inset-inline-end: 0;
        width: min(18rem, 88vw);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 1rem;
        background: var(--color-surface-solid);
        border-inline-start: 1px solid var(--color-border);
        box-shadow: var(--shadow-lg);
        z-index: 30;
        transform: translateX(100%);
        transition: transform var(--transition);
        overflow-y: auto;
    }

    [dir="rtl"] .admin-nav {
        transform: translateX(-100%);
    }

    .admin-nav.is-open {
        transform: translateX(0);
    }

    .admin-nav a {
        padding: 0.75rem 0.5rem;
        border-bottom: 1px solid var(--color-border);
    }

    .admin-user {
        padding: 0.75rem 0.5rem;
        border-bottom: 1px solid var(--color-border);
    }

    .admin-main {
        padding: 1rem;
    }

    .stats-grid,
    .stats-grid-wide {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat-value {
        font-size: 1.75rem;
    }

    .provider-health-grid,
    .provider-status-grid {
        grid-template-columns: 1fr;
    }

    .admin-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-search-input,
    .admin-filter-select {
        width: 100%;
        max-width: none;
        min-width: 0;
    }

    .admin-data-table {
        min-width: 0;
        border: none;
        background: transparent;
        box-shadow: none;
    }

    .admin-data-table thead {
        display: none;
    }

    .admin-data-table tbody {
        display: grid;
        gap: 0.75rem;
    }

    .admin-data-table tr {
        display: block;
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-lg);
        padding: 0.875rem;
        box-shadow: var(--shadow-xs);
    }

    .admin-data-table td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 1rem;
        padding: 0.4375rem 0;
        border: none;
        text-align: end;
    }

    .admin-data-table td::before {
        content: attr(data-label);
        font-size: 0.6875rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--color-text-muted);
        text-align: start;
        flex: 0 0 40%;
    }

    .admin-data-table td[data-label]:last-child {
        flex-direction: column;
        align-items: stretch;
        padding-top: 0.625rem;
        margin-top: 0.375rem;
        border-top: 1px solid var(--color-border);
    }

    .admin-data-table td[data-label]:last-child::before {
        flex: none;
        margin-bottom: 0.375rem;
    }

    .admin-data-table td[data-label]:last-child .actions {
        width: 100%;
    }

    .admin-data-table td[data-label]:last-child .actions .btn {
        flex: 1 1 auto;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .form-inline label {
        min-width: 0;
    }

    .auth-card {
        padding: 1.75rem 1.25rem;
    }

    .auth-page {
        padding: 1.5rem 1rem 5rem;
    }

    .ui-floater {
        inset-inline-start: 0.75rem;
        bottom: 0.75rem;
    }

    .ui-floater-trigger {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
        max-width: calc(100vw - 1.5rem);
    }

    .ui-floater-trigger span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .ui-floater-panel {
        width: min(16rem, calc(100vw - 1.5rem));
    }
}

@media (max-width: 480px) {
    .app-content {
        padding: 0.75rem;
    }

    .chat-messages {
        padding: 0.75rem;
    }

    .chat-composer {
        padding: 0.75rem;
        padding-bottom: max(0.75rem, var(--safe-bottom));
    }

    .composer-toolbar .toolbar-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .toolbar-group {
        gap: 0.25rem;
    }

    .aspect-ratio-chip {
        font-size: 0.6875rem;
        padding: 0.25rem 0.4375rem;
    }

    .compare-model-hint {
        font-size: 0.625rem;
        line-height: 1.35;
    }

    .message-header {
        letter-spacing: 0.04em;
    }

    .message-seed-label {
        flex: 1 1 100%;
    }

    .message-seed-copy {
        font-size: 0.6875rem;
        padding: 0.125rem 0.375rem !important;
    }

    .gallery-grid,
    .favorites-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .gallery-card-overlay {
        opacity: 1;
        pointer-events: auto;
        background: linear-gradient(180deg, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.55) 100%);
    }

    .gallery-overlay-btn {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.75rem;
    }

    .gallery-overlay-btn--details {
        display: none;
    }

    .gallery-card-actions,
    .favorites-card-actions {
        flex-direction: column;
    }

    .gallery-card-actions .btn,
    .favorites-card-actions .btn {
        width: 100%;
    }

    .album-list {
        gap: 0.375rem;
    }

    .album-chip {
        font-size: 0.75rem;
        flex-wrap: wrap;
    }

    .admin-brand {
        font-size: 1.0625rem;
    }

    .stats-grid,
    .stats-grid-wide {
        grid-template-columns: 1fr;
    }

    .summary-chips,
    .provider-status-summary {
        flex-direction: column;
    }

    .summary-chip {
        width: 100%;
        justify-content: space-between;
    }

    .admin-user {
        flex: none;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .ui-floater-trigger {
        padding: 0.4375rem 0.625rem;
        font-size: 0.6875rem;
        gap: 0.375rem;
        min-height: var(--touch-min);
    }

    .auth-card {
        padding: 1.5rem 1rem;
    }

    .auth-header h1 {
        font-size: 1.375rem;
    }

    .composer-side {
        flex-direction: column;
        width: 100%;
    }

    .composer-side .btn,
    .reference-upload {
        width: 100%;
    }

    .reference-upload .btn {
        display: flex;
        width: 100%;
    }

    .send-btn {
        width: 100%;
    }
}

/* ── Coding studio ───────────────────────────────────────────────────────── */
.coding-page {
    max-width: 72rem;
    margin: 0 auto;
    padding: 0 0 2rem;
}

.coding-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.coding-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.coding-filter-free {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    cursor: pointer;
}

.coding-model-select {
    min-width: 14rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface-solid);
    color: var(--color-text);
    font: inherit;
}

.coding-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.coding-step {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-muted);
    font: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.coding-step:hover,
.coding-step.is-active {
    color: var(--color-text);
    border-color: var(--color-accent);
    background: var(--color-accent-soft);
}

.coding-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 999px;
    background: var(--color-secondary);
    font-size: 0.6875rem;
    font-weight: 700;
}

.coding-panel-title {
    margin: 0 0 0.75rem;
    font-size: 1.375rem;
}

.coding-template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: 0.875rem;
}

.coding-template-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.375rem;
    padding: 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    background: var(--color-surface-elevated);
    box-shadow: var(--shadow-xs);
    text-align: left;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.coding-template-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-accent);
    box-shadow: var(--shadow-md);
}

.coding-template-card strong {
    font-family: var(--font-sans);
    font-size: 0.9375rem;
}

.coding-template-card span:last-child {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    line-height: 1.45;
}

.coding-template-icon {
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-sm);
    background: var(--color-accent-soft);
    position: relative;
}

.coding-template-icon::after {
    content: '</>';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--color-accent);
}

.coding-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 1rem;
    align-items: start;
}

.coding-spec,
.coding-output,
.coding-export {
    padding: 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    background: var(--color-surface-elevated);
    box-shadow: var(--shadow-sm);
}

.coding-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-bottom: 0.875rem;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.coding-field select,
.coding-field textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface-solid);
    color: var(--color-text);
    font: inherit;
    resize: vertical;
}

.coding-spec-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.coding-output-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.625rem;
}

.coding-output-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.coding-output-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.coding-code-block {
    margin: 0;
    padding: 1rem;
    border-radius: var(--radius-md);
    background: #0d1117;
    color: #e6edf3;
    overflow: auto;
    max-height: 28rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.55;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .coding-code-block {
    background: #050506;
}

.coding-code-block code {
    white-space: pre;
    display: block;
}

.coding-code-block--loading {
    opacity: 0.75;
}

.coding-help {
    color: var(--color-text-muted);
    margin: 0 0 1rem;
}

.coding-status {
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--color-accent-soft);
    color: var(--color-text);
    font-size: 0.8125rem;
}

.coding-export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.coding-sessions {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.coding-sessions h2 {
    font-size: 1rem;
    margin: 0 0 0.75rem;
}

.coding-session-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.coding-session-link {
    display: inline-flex;
    padding: 0.375rem 0.75rem;
    border-radius: 999px;
    background: var(--color-secondary);
    color: var(--color-text);
    font-size: 0.8125rem;
}

.coding-session-link:hover {
    background: var(--color-accent-soft);
    color: var(--color-accent-hover);
}

@media (max-width: 900px) {
    .coding-workspace {
        grid-template-columns: 1fr;
    }

    .coding-code-block {
        max-height: 20rem;
    }
}

/* ── Mobile / PWA polish (touch, safe areas, CLS) ─────────────────────────── */
@media (pointer: coarse), (max-width: 960px) {
    .btn,
    .btn-sm,
    .btn-icon,
    .btn-toggle,
    .aspect-ratio-chip,
    .preset-chip,
    .negative-preset-chip,
    .compare-model-chip span,
    .album-chip-delete,
    .album-chip-download,
    .gallery-album-badge-remove,
    .ui-floater-theme-btn,
    .ui-floater-locale-btn,
    .landing-login,
    .landing-cta,
    .send-btn,
    .composer-prompt-actions .btn,
    .message-actions .btn,
    .gallery-card-actions .btn,
    .favorites-card-actions .btn,
    .prompts-actions .btn,
    .filters-actions .btn,
    .gallery-batch-toolbar .btn,
    .gallery-pagination .btn,
    .admin-nav a {
        min-height: var(--touch-min);
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .btn-icon,
    .album-chip-delete,
    .album-chip-download,
    .gallery-album-badge-remove {
        min-width: var(--touch-min);
    }

    .form-control,
    .form-select,
    .form-control-sm,
    .form-select-sm {
        min-height: var(--touch-min);
        font-size: 1rem; /* iOS zoom prevention */
    }

    .aspect-ratio-chip,
    .preset-chip,
    .compare-model-chip span {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding-block: 0.5rem;
    }

    .gallery-card-select input,
    .gallery-select-checkbox {
        width: 1.25rem;
        height: 1.25rem;
        min-width: 1.25rem;
        min-height: 1.25rem;
    }

    .gallery-card-select {
        min-width: var(--touch-min);
        min-height: var(--touch-min);
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

@media (max-width: 960px) {
    .app-content {
        padding-bottom: max(5rem, calc(4rem + var(--safe-bottom)));
    }

    .chat-layout {
        min-height: calc(100dvh - var(--header-height) - var(--safe-top) - 2rem);
    }

    .ui-floater {
        inset-inline-start: max(0.75rem, var(--safe-left));
        bottom: max(0.75rem, var(--safe-bottom));
    }

    .ui-floater-panel {
        max-height: min(24rem, calc(60dvh - var(--safe-bottom)));
    }
}

@media (max-width: 768px) {
    .app-header {
        padding-inline-end: max(1rem, var(--safe-right));
        padding-inline-start: max(1rem, var(--safe-left));
    }

    .app-content {
        padding-inline-end: max(1rem, var(--safe-right));
        padding-inline-start: max(1rem, var(--safe-left));
    }

    .chat-composer {
        padding-bottom: max(1rem, var(--safe-bottom));
    }

    .page-header,
    .gallery-toolbar,
    .prompts-toolbar,
    .favorites-header {
        min-height: 3.25rem;
    }

    .gallery-grid,
    .favorites-grid {
        contain: layout style;
    }

    .gallery-card,
    .favorites-card {
        content-visibility: auto;
        contain-intrinsic-size: auto 11rem;
    }
}

/* Prefer dynamic viewport units for standalone PWA */
@media (display-mode: standalone) {
    .app-shell,
    .app-content-guest,
    .landing-page,
    .auth-page,
    .share-page {
        min-height: 100dvh;
    }

    .app-header {
        padding-top: max(var(--safe-top), 0.25rem);
        height: calc(var(--header-height) + max(var(--safe-top), 0.25rem));
        min-height: calc(var(--header-height) + max(var(--safe-top), 0.25rem));
    }
}

/* --- Video generation UX --- */

.composer-model-select--hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.video-model-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
    gap: 0.5rem;
    margin-top: 0.375rem;
    width: 100%;
}

.video-model-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.375rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
    text-align: start;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
    min-height: 5.5rem;
}

.video-model-card:hover {
    border-color: rgba(196, 169, 98, 0.45);
    box-shadow: var(--shadow-xs);
}

.video-model-card.is-selected {
    border-color: var(--color-accent, #c4a962);
    box-shadow: 0 0 0 1px rgba(196, 169, 98, 0.35);
    background: rgba(196, 169, 98, 0.08);
}

.video-model-card__header {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    width: 100%;
}

.video-model-card__name {
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1.25;
}

.video-model-card__provider {
    font-size: 0.6875rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.video-model-card__hint {
    font-size: 0.6875rem;
    line-height: 1.35;
    color: var(--color-text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-model-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: auto;
}

.video-model-badge {
    display: inline-block;
    padding: 0.125rem 0.4375rem;
    border-radius: 999px;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--color-secondary);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.video-model-badge--key {
    background: rgba(180, 83, 9, 0.12);
    color: #b45309;
    border-color: rgba(180, 83, 9, 0.25);
}

.message-pending--video {
    max-width: min(100%, 28rem);
}

.message-pending-preview {
    position: relative;
}

.message-pending-type-badge {
    position: absolute;
    inset-inline-end: 0.5rem;
    top: 0.5rem;
    padding: 0.125rem 0.4375rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
}

.message-pending-progress {
    height: 0.25rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.message-pending-progress-bar {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--color-accent, #c4a962), #e8d5a0);
    transition: width 1s linear;
}

.message-pending-model {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    flex: 1 1 100%;
}

.message-pending-elapsed {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
    margin-inline-start: auto;
}

.message-pending-hint {
    margin: 0;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    line-height: 1.4;
}

.media-frame--video-preview {
    position: relative;
}

.video-play-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    border: none;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    cursor: pointer;
    transition: background var(--transition);
}

.video-play-overlay:hover {
    background: rgba(0, 0, 0, 0.48);
}

.video-play-overlay__icon {
    width: 3rem;
    height: 3rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    font-size: 1.125rem;
    padding-inline-start: 0.2rem;
}

.gallery-card.is-highlighted {
    outline: 2px solid var(--color-accent, #c4a962);
    outline-offset: 2px;
    animation: gallery-highlight-pulse 1.5s ease-in-out 2;
}

@keyframes gallery-highlight-pulse {
    0%, 100% { box-shadow: var(--shadow-xs); }
    50% { box-shadow: 0 0 0 4px rgba(196, 169, 98, 0.25); }
}

@media (max-width: 960px) {
    .chat-layout.is-video-mode .composer-primary {
        flex-direction: column;
        align-items: stretch;
    }

    .video-model-picker {
        grid-template-columns: 1fr;
        max-height: 14rem;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .message-pending--video,
    .message-media-block .media-frame--chat {
        --media-frame-max-height: min(52vh, 24rem);
    }

    .media-frame--chat .media-frame__element {
        max-height: min(52vh, 24rem);
    }
}

@media (max-width: 480px) {
    .message-pending-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .message-pending-elapsed {
        margin-inline-start: 0;
    }

    .message-actions .btn {
        flex: 1 1 calc(50% - 0.375rem);
        justify-content: center;
    }
}
