/* Imago Studio — tema scuro (Design System Performarsi) */
:root {
    --bg-primary: #0f1419;
    --bg-secondary: #1a2332;
    --bg-tertiary: #243447;
    --bg-card: #1e2d3d;
    --bg-hover: #2a3f54;
    --bg-input: #1a2332;

    --text-primary: #ffffff;
    --text-secondary: #8899a6;
    --text-muted: #5c6d7e;
    --text-placeholder: #4a5568;

    --accent-primary: #1da1f2;
    --accent-secondary: #17bf63;
    --accent-warning: #ffad1f;
    --accent-danger: #e0245e;
    --accent-purple: #794bc4;

    --border-color: #2f3e50;
    --border-light: #38444d;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,.4);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.5);

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --transition-fast: .15s ease;
    --transition-normal: .25s ease;

    --sidebar-width: 240px;
    --header-height: 60px;

    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Layout ===== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
}

.sidebar-brand { padding: 20px 20px 16px; border-bottom: 1px solid var(--border-color); }
.sidebar-brand .logo {
    font-size: 18px; font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.sidebar-brand .subtitle { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.sidebar-nav { padding: 12px; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: var(--radius-md);
    color: var(--text-secondary); cursor: pointer;
    transition: var(--transition-fast); font-weight: 500; margin-bottom: 4px;
    border: none; background: transparent; width: 100%; text-align: left; font-size: 14px;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: rgba(29,161,242,.12); color: var(--accent-primary); }
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar-footer { padding: 12px; border-top: 1px solid var(--border-color); }
.user-box { display: flex; align-items: center; gap: 10px; padding: 8px; }
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 14px; flex-shrink: 0;
}
.user-box .info { overflow: hidden; }
.user-box .name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-box .email { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 8px 12px; margin-top: 4px; border: none; background: transparent;
    color: var(--accent-danger); cursor: pointer; border-radius: var(--radius-md); font-size: 13px;
}
.logout-btn:hover { background: rgba(224,36,94,.1); }
.logout-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Icone dentro ai bottoni con etichetta (es. Genera, azioni) */
.btn svg, .mode-toggle button svg { flex-shrink: 0; }

.main { margin-left: var(--sidebar-width); flex: 1; min-width: 0; }
.content { padding: 32px 40px; max-width: 1400px; }

.page-title { font-size: 28px; font-weight: 700; line-height: 1.2; }
.page-subtitle { color: var(--text-secondary); margin-top: 6px; margin-bottom: 28px; }

.view { display: none; }
.view.active { display: block; }

/* ===== Generator layout ===== */
.generator-grid { display: grid; grid-template-columns: 480px 1fr; gap: 28px; align-items: start; }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}
.card-pad { padding: 24px; }

.section-label {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .5px; color: var(--text-muted); margin: 20px 0 12px;
}
.section-label:first-child { margin-top: 0; }

label.field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }

.form-control {
    width: 100%; padding: 10px 14px;
    background: var(--bg-input); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); color: var(--text-primary);
    font-size: 14px; font-family: inherit; outline: none; transition: var(--transition-fast);
}
.form-control::placeholder { color: var(--text-placeholder); }
.form-control:focus { border-color: var(--accent-primary); box-shadow: 0 0 0 3px rgba(29,161,242,.15); }
textarea.form-control { min-height: 130px; resize: vertical; line-height: 1.55; }
select.form-control { appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238899a6' stroke-width='2'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { margin-bottom: 16px; }
.form-helper { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* Toggle Auto / Personalizza */
.mode-toggle { display: flex; gap: 8px; margin: 18px 0; background: var(--bg-tertiary); padding: 4px; border-radius: var(--radius-md); }
.mode-toggle button {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px; border: none; background: transparent; color: var(--text-secondary);
    border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; font-weight: 600; transition: var(--transition-fast);
}
.mode-toggle button.active { background: var(--bg-card); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.mode-toggle button svg { width: 16px; height: 16px; }

.advanced-panel { display: none; }
.advanced-panel.open { display: block; }

.divider { height: 1px; background: var(--border-color); margin: 22px 0; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: var(--radius-md); font-weight: 600; font-size: 14px;
    cursor: pointer; border: 1px solid transparent; transition: var(--transition-fast); font-family: inherit;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--accent-primary); color: #fff; }
.btn-primary:hover { background: #1a91da; }
.btn-dark { background: #0d1620; color: #fff; border-color: var(--border-light); }
.btn-dark:hover { background: #0a1119; }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); border-color: var(--border-color); }
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--accent-primary); }
.btn-success { background: var(--accent-secondary); color: #fff; }
.btn-success:hover { filter: brightness(1.08); }
.btn-danger { background: transparent; color: var(--accent-danger); border-color: rgba(224,36,94,.4); }
.btn-danger:hover { background: rgba(224,36,94,.1); }
.btn-block { width: 100%; }
.btn-lg { padding: 14px; font-size: 15px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.loading { color: transparent; position: relative; }
.btn.loading::after {
    content: ''; position: absolute; width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%;
    animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Results / Triade ===== */
.result-panel { min-height: 540px; }

.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 540px; text-align: center; border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg); color: var(--text-muted);
}
.empty-state svg { width: 64px; height: 64px; opacity: .4; margin-bottom: 16px; }

.triad-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.triad-img {
    position: relative; border-radius: var(--radius-md); overflow: hidden;
    background: var(--bg-secondary); border: 1px solid var(--border-color);
}
/* La preview segue il formato reale dell'immagine (no crop) */
.triad-img img { width: 100%; height: auto; display: block; }
.triad-img .img-badge {
    position: absolute; top: 8px; left: 8px; background: rgba(15,20,25,.8);
    color: #fff; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 20px;
}
.triad-img .img-dl {
    position: absolute; bottom: 8px; right: 8px; width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(15,20,25,.82); border: 1px solid var(--border-light); color: #fff;
    border-radius: var(--radius-sm); cursor: pointer; opacity: 0; transition: var(--transition-fast);
}
.triad-img:hover .img-dl { opacity: 1; }
.triad-img .img-dl:hover { background: var(--accent-primary); }
.triad-img .img-dl svg { width: 18px; height: 18px; }

.result-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.result-actions .spacer { flex: 1; }

.comment-box {
    margin-top: 24px; padding: 20px 22px; border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(121,75,196,.10), rgba(29,161,242,.05));
    border: 1px solid var(--border-color);
}
.comment-box .comment-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.comment-box .comment-head svg { width: 20px; height: 20px; color: var(--accent-purple); }
.comment-box .comment-head h3 { font-size: 15px; font-weight: 700; }
.comment-box .comment-body { color: var(--text-secondary); white-space: pre-wrap; line-height: 1.65; }

.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip {
    font-size: 11px; padding: 4px 10px; border-radius: 20px;
    background: var(--bg-tertiary); color: var(--text-secondary); border: 1px solid var(--border-color);
}

/* Loading overlay sui risultati */
.gen-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 540px; gap: 18px; }
.gen-loading .spinner-lg { width: 44px; height: 44px; border: 3px solid var(--border-color); border-top-color: var(--accent-primary); border-radius: 50%; animation: spin .7s linear infinite; }
.gen-loading .msg { color: var(--text-secondary); }
.skeleton-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; width: 100%; }
.skeleton { aspect-ratio: 1/1; border-radius: var(--radius-md);
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ===== Archive ===== */
.archive-toolbar { display: flex; gap: 12px; margin-bottom: 24px; }
.archive-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.archive-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); overflow: hidden; transition: var(--transition-fast); }
.archive-card:hover { border-color: var(--border-light); box-shadow: var(--shadow-md); }
.archive-thumbs { display: grid; grid-template-columns: repeat(3,1fr); gap: 2px; background: var(--bg-secondary); }
.archive-thumbs img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; }
.archive-body { padding: 14px 16px; }
.archive-prompt { font-size: 13px; color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.archive-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--border-color); background: var(--bg-secondary); }
.archive-foot .date { font-size: 12px; color: var(--text-muted); }
.archive-foot .actions { display: flex; gap: 6px; }
.icon-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); background: var(--bg-tertiary); border: 1px solid var(--border-color); color: var(--text-secondary); cursor: pointer; }
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.icon-btn.danger:hover { color: var(--accent-danger); border-color: rgba(224,36,94,.4); }
.icon-btn svg { width: 16px; height: 16px; }

/* ===== Settings ===== */
.settings-grid { max-width: 760px; }
.settings-section { margin-bottom: 28px; }
.settings-section h2 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.settings-section .desc { color: var(--text-secondary); font-size: 13px; margin-bottom: 18px; }
.key-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.key-status.set { color: var(--accent-secondary); }
.key-status.unset { color: var(--text-muted); }
.key-status .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.model-option { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--border-color); border-radius: var(--radius-md); margin-bottom: 10px; }
.model-option .mo-name { font-weight: 600; }
.model-option .mo-meta { font-size: 12px; color: var(--text-muted); }
.model-option.disabled { opacity: .5; }

/* ===== Toast ===== */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 10000; display: flex; flex-direction: column; gap: 12px; }
.toast { display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); min-width: 280px; max-width: 420px; animation: slideInRight .3s ease; border-left: 4px solid var(--accent-primary); }
.toast.success { border-left-color: var(--accent-secondary); }
.toast.error { border-left-color: var(--accent-danger); }
.toast.warning { border-left-color: var(--accent-warning); }
.toast .msg { flex: 1; font-size: 14px; }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== Modal ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; z-index: 9999; padding: 24px; opacity: 0; visibility: hidden; transition: var(--transition-normal); }
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-xl); width: 100%; max-width: 520px; max-height: 100%; display: flex; flex-direction: column; transform: scale(.96); transition: var(--transition-normal); }
.modal-overlay.open .modal { transform: scale(1); }
.modal-header { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border-color); }
.modal-title { font-size: 18px; font-weight: 600; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1 1 auto; min-height: 0; -webkit-overflow-scrolling: touch; }
.modal-footer { flex-shrink: 0; display: flex; justify-content: flex-end; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--border-color); }
.modal-close { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 22px; line-height: 1; }
.modal-wide { max-width: 1000px; }
.detail-prompt { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 14px 16px; color: var(--text-secondary); font-size: 13px; line-height: 1.6; white-space: pre-wrap; }
.archive-open { cursor: pointer; }
.archive-open:hover .archive-prompt { color: var(--text-primary); }

/* ===== Lightbox ===== */
.lightbox-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; z-index: 10001; opacity: 0; visibility: hidden; transition: var(--transition-normal); }
.lightbox-overlay.open { opacity: 1; visibility: visible; }
.lightbox-img { max-width: 92vw; max-height: 88vh; border-radius: 8px; box-shadow: var(--shadow-lg); }
.lightbox-close { position: absolute; top: 18px; right: 24px; font-size: 34px; line-height: 1; color: #fff; background: transparent; border: none; cursor: pointer; opacity: .8; }
.lightbox-close:hover { opacity: 1; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,.12); border: none; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.lightbox-nav:hover { background: rgba(255,255,255,.25); }
.lightbox-nav svg { width: 26px; height: 26px; }
.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }
.lightbox-counter { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 13px; background: rgba(0,0,0,.5); padding: 5px 14px; border-radius: 20px; }
.lightbox-dl { position: absolute; bottom: 18px; right: 24px; width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.12); border: none; color: #fff; border-radius: var(--radius-md); cursor: pointer; }
.lightbox-dl:hover { background: var(--accent-primary); }
.lightbox-dl svg { width: 20px; height: 20px; }
.triad-img img { cursor: zoom-in; }

/* ===== Assistente (chat) ===== */
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 210px); min-height: 460px; max-width: 920px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); overflow: hidden; }
.chat-messages { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }
.chat-bubble { max-width: 80%; padding: 12px 16px; border-radius: 16px; line-height: 1.55; white-space: pre-wrap; font-size: 14px; }
.chat-msg.assistant .chat-bubble { background: var(--bg-tertiary); border: 1px solid var(--border-color); border-top-left-radius: 4px; color: var(--text-primary); }
.chat-msg.user .chat-bubble { background: var(--accent-primary); color: #fff; border-top-right-radius: 4px; }
.chat-prompt-card { align-self: flex-start; max-width: 88%; background: linear-gradient(180deg, rgba(121,75,196,.14), rgba(29,161,242,.06)); border: 1px solid var(--border-color); border-radius: 16px; padding: 16px 18px; }
.cpc-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--accent-purple); font-weight: 700; margin-bottom: 8px; }
.cpc-text { font-size: 14px; color: var(--text-primary); line-height: 1.6; white-space: pre-wrap; margin-bottom: 14px; }
.chat-input-row { border-top: 1px solid var(--border-color); padding: 14px; display: flex; gap: 12px; align-items: flex-end; background: var(--bg-secondary); }
.chat-input-row textarea { flex: 1; min-height: 46px; max-height: 160px; resize: none; }
.chat-input-actions { display: flex; gap: 8px; }
.typing { display: inline-flex; gap: 5px; align-items: center; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); animation: pulse 1s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }

/* ===== Login ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-xl); padding: 36px 32px; box-shadow: var(--shadow-lg); }
.login-card .logo { font-size: 24px; font-weight: 700; text-align: center; background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.login-card .sub { text-align: center; color: var(--text-muted); font-size: 13px; margin: 4px 0 28px; }
.login-error { background: rgba(224,36,94,.1); border: 1px solid rgba(224,36,94,.3); color: var(--accent-danger); padding: 10px 14px; border-radius: var(--radius-md); font-size: 13px; margin-bottom: 16px; display: none; }
.login-error.show { display: block; }

/* ===== Responsive ===== */

/* Topbar mobile + burger + backdrop: nascosti su desktop */
.topbar { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 1100px) {
    .generator-grid { grid-template-columns: 1fr; }
    .result-panel, .empty-state, .gen-loading { min-height: 360px; }
}

/* Tablet / smartphone: sidebar a scomparsa con burger */
@media (max-width: 900px) {
    .topbar {
        display: flex; align-items: center; gap: 12px;
        position: fixed; top: 0; left: 0; right: 0; height: 56px;
        padding: 0 14px; background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color); z-index: 60;
    }
    .topbar-title {
        font-weight: 700; font-size: 16px;
        background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
        -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    }
    .burger {
        width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
        background: var(--bg-tertiary); border: 1px solid var(--border-color);
        border-radius: var(--radius-md); color: var(--text-primary); cursor: pointer; flex-shrink: 0;
    }
    .burger svg { width: 22px; height: 22px; }

    .sidebar { left: -100%; width: 272px; max-width: 84vw; z-index: 100; transition: left .25s ease; }
    .sidebar.open { left: 0; box-shadow: var(--shadow-lg); }

    .sidebar-backdrop {
        display: block; position: fixed; inset: 0; background: rgba(0,0,0,.55);
        z-index: 90; opacity: 0; visibility: hidden; transition: var(--transition-normal);
    }
    .sidebar-backdrop.open { opacity: 1; visibility: visible; }

    .main { margin-left: 0; padding-top: 56px; }
    .content { padding: 18px; }
    .page-title { font-size: 22px; }
    .page-subtitle { margin-bottom: 20px; }

    .form-row { grid-template-columns: 1fr; }
    .triad-grid, .skeleton-grid { grid-template-columns: 1fr; }
    .archive-grid { grid-template-columns: 1fr; }
    .archive-toolbar { flex-wrap: wrap; }
    .archive-toolbar .form-control { max-width: none; flex: 1; }

    .result-actions { flex-wrap: wrap; }
    .result-actions .spacer { display: none; flex: 0; }

    .chat-wrap { height: calc(100vh - 210px); min-height: 380px; }

    .modal-wide { max-width: 100%; }
}

@media (max-width: 480px) {
    .content { padding: 14px; }
    .card-pad { padding: 18px; }
    .modal-overlay { padding: 12px; }
    .modal-body { padding: 16px; }
    .result-actions .btn { flex: 1 1 auto; }
    .lightbox-nav { width: 40px; height: 40px; }
    .lightbox-prev { left: 10px; }
    .lightbox-next { right: 10px; }
    .login-card { padding: 28px 22px; }
}
