/* --- TYPOGRAPHY --- */
h1 { font-family: 'Inter', sans-serif; font-weight: 700; text-transform: uppercase; font-size: 16px; margin: 0; letter-spacing: 0.8px; color: var(--accent); }
h3 { font-family: 'Inter', sans-serif; font-weight: 650; font-size: 14px; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; border-bottom: 1px solid var(--border); padding-bottom: 8px; letter-spacing: 0.3px; }
h4 { font-size: 11px; text-transform: uppercase; border-bottom: 1px solid var(--border); margin-bottom: 12px; color: var(--muted); font-weight: 600; letter-spacing: 0.5px; }
.section-label { font-size: 10px; margin-bottom: 2px; color: #666; font-weight: 600; text-transform: uppercase; display: block; font-family: 'Inter', sans-serif; }

@keyframes loading {
    0% { transform: translateX(-40px); }
    100% { transform: translateX(40px); }
}

/* --- NAVIGATION --- */
.nav-link {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--fg-soft);
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
    letter-spacing: 0.7px;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 7px 10px;
    white-space: nowrap;
}
.nav-link:hover { color: var(--accent); background: var(--surface-soft); }
.nav-link.active { color: var(--fg-soft); border-color: var(--border); background: var(--surface); }

.nav-dropdown {
    position: relative;
}

.nav-dropdown-trigger {
    user-select: none;
}

.nav-dropdown.open .nav-dropdown-trigger {
    color: var(--accent);
    background: var(--surface-soft);
    border-color: var(--border);
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 180px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow-md);
    z-index: 180;
}

.nav-dropdown.open .nav-dropdown-menu {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-dropdown-item {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 550;
    color: var(--fg-soft);
    padding: 8px 10px;
    border-radius: 7px;
    cursor: pointer;
    white-space: nowrap;
}

.nav-dropdown-item:hover {
    background: var(--surface-soft);
    color: var(--accent);
}

.logo-group { text-align: left; }
.logo-group img { height: 40px; display: block; margin-left: 0; }
.logo-group span { font-size: 9px; color: var(--muted); font-weight: 600; letter-spacing: 0.8px; display: block; margin-top: 3px; }

.gear-btn {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
    transition: transform 0.3s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}
.gear-btn:hover { color: var(--accent); border-color: var(--border-strong); transform: rotate(30deg); }

/* --- INPUTS --- */
input[type="text"], input[type="number"], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    box-sizing: border-box;
    outline: none;
    background: var(--surface);
    color: var(--fg);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.10);
}
textarea { resize: vertical; min-height: 80px; }

.search-compact {
    width: 250px !important; /* Force small width */
    padding: 8px 12px !important;
    font-size: 12px !important;
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
}
.search-compact:focus { border-color: #000 !important; }

.top-nav .nav-search {
    width: min(220px, 24vw) !important;
    min-width: 160px;
}

.top-nav #semantic-search-query {
    width: min(280px, 28vw) !important;
    min-width: 190px;
}

/* --- REGISTRY TOOLBAR --- */
.registry-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: -8px 0 14px;
}

.registry-toolbar-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.registry-toolbar-group label {
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.registry-toolbar-group input,
.registry-toolbar-group select {
    width: auto;
    min-width: 140px;
    padding: 7px 9px;
    font-size: 12px;
}

.registry-toolbar-group button {
    min-width: 94px;
    padding: 8px 10px;
    font-size: 10px;
}

@media (max-width: 1120px) {
    .registry-toolbar {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .registry-toolbar-group input,
    .registry-toolbar-group select {
        flex: 1 1 100%;
        min-width: 0;
    }
}

/* --- CARDS & REGISTRY --- */
.card {
    cursor: pointer;
    position: relative;
    background: var(--surface);
    padding: 10px;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
}
.card img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    display: block;
    background: var(--surface-soft);
    margin-bottom: 10px;
    border-radius: calc(var(--radius-sm) - 2px);
}
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-md); }

.card p { font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 600; margin: 0; line-height: 1.4; color: var(--accent); }
.card p span { font-weight: 400; color: var(--muted); font-size: 11px; }

.card-overlay {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--accent);
    color: #fff;
    padding: 4px 6px;
    font-size: 9px;
    font-weight: 700;
    z-index: 5;
    text-transform: uppercase;
    pointer-events: none;
    border-radius: 999px;
}
.card-actions { display: flex; gap: 4px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); opacity: 0; transition: opacity 0.2s ease; }
.card:hover .card-actions { opacity: 1; }

.registry-card-title {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.registry-card-brand {
    font-size: 10px;
    color: #666;
    font-weight: 700;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.registry-card-sub {
    color: #888;
    font-size: 11px;
}

.registry-card-meta-secondary {
    color: #999;
    font-size: 10px;
    margin-top: 3px;
}

.registry-card-hardware {
    margin-top: 6px;
    font-size: 10px;
    color: #374151;
    background: #f8fafc;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 3px 6px;
    display: inline-block;
}

.registry-card-hardware-conflict {
    color: #9a3412;
    background: #fff7ed;
    border-color: #fdba74;
}

.registry-card-gap {
    margin-top: 6px;
    font-size: 10px;
    color: #9a3412;
    background: #fff7ed;
    border: 1px solid #fdba74;
    border-radius: 6px;
    padding: 4px 6px;
}

.registry-priority-lane {
    margin-bottom: 14px;
    border: 1px solid #fdba74;
    background: #fffaf4;
    border-radius: var(--radius-md);
    padding: 10px;
}

.registry-priority-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    color: #9a3412;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.registry-priority-hint {
    font-size: 10px;
    color: #7c2d12;
    margin: -2px 0 8px;
}

.registry-section-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--accent);
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: none;
    margin-bottom: 8px;
}

.registry-section-toggle:hover {
    background: #fff;
    border-color: var(--border-strong);
}

.registry-section-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.registry-section-count {
    font-size: 10px;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 7px;
    background: #fff;
}

.registry-collapse-icon {
    width: 12px;
    text-align: center;
    color: var(--muted);
}

#registry-container.registry-compact .grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

#registry-container.registry-compact .card {
    padding: 8px;
}

#registry-container.registry-compact .card img {
    margin-bottom: 7px;
}

#registry-container.registry-compact .registry-card-title {
    font-size: 12px;
}

#registry-container.registry-compact .registry-card-brand,
#registry-container.registry-compact .registry-card-sub,
#registry-container.registry-compact .registry-card-meta-secondary,
#registry-container.registry-compact .registry-card-gap,
#registry-container.registry-compact .registry-card-hardware {
    font-size: 9px;
}

#registry-container.registry-compact .registry-card-meta-secondary {
    display: none;
}

#registry-container.registry-compact .card-actions {
    margin-top: 6px;
    padding-top: 6px;
}

/* --- BUTTONS --- */
button {
    width: 100%;
    padding: 11px 12px;
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}
button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
button:active {
    transform: translateY(0);
}
button.ghost {
    background: var(--surface);
    color: var(--accent);
    border: 1px solid var(--border);
    box-shadow: none;
}
button.ghost:hover { border-color: var(--border-strong); background: var(--surface-soft); box-shadow: var(--shadow-sm); }
button.danger { color: var(--danger); border-color: var(--danger); background: #fff; box-shadow: none; }
button.danger:hover { background: #fff5f5; box-shadow: var(--shadow-sm); }
button.small-btn { font-size: 10px; padding: 6px 10px; background: #fff; color: var(--accent); border: 1px solid var(--border); width: auto; text-transform: uppercase; box-shadow: none; }

.action-btn {
    flex: 1;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    color: var(--accent);
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    padding: 6px 0;
    border-radius: 6px;
    font-weight: 600;
    box-shadow: none;
}
.action-btn:hover { background: var(--accent); color: #fff; }

/* --- PROFILE / MODAL LAYOUT HELPERS --- */
.split-view {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
    gap: 20px;
    align-items: start;
    min-height: 0;
}

.split-view.tight {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.compact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.compact-label {
    display: block;
    margin-bottom: 4px;
    font-size: 10px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.compact-input {
    width: 100%;
    padding: 8px 10px;
    font-size: 12px;
}

.tri-view {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.tri-view.compact .view-slot {
    min-height: 120px;
}

.face-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 8px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.modal-window .modal-actions {
    margin-top: 14px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.modal-actions button {
    width: auto;
    min-width: 120px;
}

.modal-actions .grow {
    flex: 1 1 auto;
    min-width: 140px;
}

.stylist-modal-window {
    width: min(560px, 95vw) !important;
}

.stylist-modal-actions {
    margin-top: 12px;
}

.stylist-option-actions {
    margin-top: 12px;
    justify-content: flex-start;
}

.stylist-option-actions button {
    width: auto;
    min-width: 128px;
}

#stylist-focus-context .stylist-focus-close {
    width: 28px;
    min-width: 28px;
    height: 28px;
    padding: 0;
    margin-left: auto;
    border-radius: 999px;
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.modal-window-compact {
    width: min(460px, 94vw) !important;
}

.modal-window h3:first-child {
    margin-top: 0;
}

.modal-subtitle {
    margin: -4px 0 2px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--fg-soft);
}

.feedback-profile-status {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 10px;
    min-height: 16px;
}

.feedback-profile-content {
    max-height: 56vh;
    overflow: auto;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.feedback-profile-meta {
    font-size: 10px;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 8px;
    background: var(--surface-soft);
}

.feedback-profile-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    background: var(--surface);
}

.feedback-profile-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 6px;
}

.feedback-profile-copy {
    font-size: 12px;
    color: var(--fg-soft);
    line-height: 1.5;
}

.feedback-profile-pre {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: var(--fg);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.feedback-profile-list {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--fg-soft);
}

.feedback-profile-empty {
    font-size: 11px;
    color: var(--muted);
    font-style: italic;
}

.semantic-search-results {
    max-height: 56vh;
    overflow: auto;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.semantic-search-row {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    background: var(--surface);
}

.semantic-search-row-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 4px;
}

.semantic-search-score {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: var(--fg-soft);
    white-space: nowrap;
}

.semantic-search-item-id {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    color: var(--muted);
}

.semantic-search-row-sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 3px;
}

.semantic-search-row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.semantic-search-row-actions button {
    width: auto;
    min-width: 108px;
}

.semantic-search-empty {
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-size: 12px;
    color: var(--muted);
    background: var(--surface-soft);
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.field-group:last-child {
    margin-bottom: 0;
}

.field-group label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.35px;
    text-transform: uppercase;
}

.field-group input[type="file"] {
    padding: 8px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 12px 0 8px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--fg-soft);
    text-transform: none;
    font-size: 12px;
    font-weight: 500;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    margin: 0;
}

/* --- MARKETPLACE --- */
.marketplace-list-shell {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 260px;
    overflow: auto;
    padding-right: 4px;
}

.marketplace-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 10px;
    padding: 10px;
}

.marketplace-merch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.marketplace-merch-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.marketplace-merch-media {
    width: 100%;
    height: 180px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.marketplace-merch-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.marketplace-merch-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
}

.marketplace-card-media {
    width: 72px;
    height: 92px;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface-soft);
    display: flex;
    align-items: center;
    justify-content: center;
}

.marketplace-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.marketplace-img-fallback {
    font-size: 9px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.marketplace-card-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.marketplace-card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.marketplace-card-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--fg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.marketplace-pill {
    font-size: 9px;
    font-weight: 700;
    color: var(--accent);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.marketplace-card-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 10px;
    color: var(--muted);
}

.marketplace-card-price {
    font-size: 11px;
    font-weight: 700;
    color: var(--fg);
}

.marketplace-card-note {
    font-size: 11px;
    color: var(--fg-soft);
    line-height: 1.4;
}

.marketplace-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.marketplace-empty {
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 11px;
    color: var(--muted);
    background: var(--surface-soft);
}

.marketplace-ledger-row {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    background: var(--surface);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.marketplace-ledger-reason {
    font-size: 11px;
    font-weight: 600;
    color: var(--fg);
}

.marketplace-ledger-time {
    font-size: 10px;
    color: var(--muted);
}

.marketplace-ledger-positive {
    font-size: 12px;
    font-weight: 700;
    color: #027a48;
}

.marketplace-ledger-negative {
    font-size: 12px;
    font-weight: 700;
    color: #b42318;
}

/* --- MISC --- */
.login-input { background:#fff; color:var(--accent); padding:15px; width:280px; text-align:center; border:1px solid #ddd; border-radius: 4px; font-family:'Inter', sans-serif; font-size: 14px; margin-bottom:15px; outline:none; font-weight:500; transition: all 0.2s; }
.login-btn { padding:15px; width:280px; }

.login-screen {
    position: fixed;
    inset: 0;
    overflow: hidden;
    align-items: flex-start;
    justify-content: center;
    padding-left: clamp(12px, 8vw, 120px);
    background-image:
        linear-gradient(95deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.40) 44%, rgba(255, 255, 255, 0.72) 100%),
        url('/background_1.png?v=20260216m');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

.login-screen::before {
    content: none;
}

.login-auth-card {
    position: relative;
    z-index: 1;
    width: min(440px, 92vw);
    margin-left: clamp(0px, 18vw, 260px);
    background: rgba(255, 255, 255, 0.84);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 22px;
}

/* Keep modal headers etc */
.view-slot { aspect-ratio: 3/4; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; background: var(--surface-soft); overflow: hidden; }
.view-slot:hover { border-color: var(--accent); background: #fff; }
.view-slot input[type="file"] { display: none; }
.view-slot img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; z-index: 1; display: none; }
.view-slot span { font-size: 10px; font-weight: 600; color: var(--muted); z-index: 2; position: relative; background: rgba(255,255,255,0.9); padding: 4px 8px; border-radius: 4px; pointer-events: none; }
.face-grid img { width: 100%; height: 60px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.dna-box { background:var(--surface-soft); border:1px solid var(--border); border-radius: var(--radius-sm); padding:15px; margin-top:15px; }
.dna-box label { color: var(--accent); font-weight:700; font-size: 10px; text-transform: uppercase; display:block; margin-bottom: 8px; }
.modal-header-inline { display: flex; align-items: baseline; gap: 15px; border-bottom: 1px solid var(--border); margin-bottom: 20px; padding-bottom: 10px; }
.modal-header-inline h3 { border: none; margin: 0; padding: 0; }
.mimic-grid { display:flex; gap:16px; margin-bottom:20px; }
.mimic-box { flex:1; height:140px; display:flex; align-items:center; justify-content:center; overflow:hidden; border:1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-soft); }
.mimic-box.results { border:1px solid var(--border); background: var(--surface); overflow-y:auto; align-items:flex-start; align-content: flex-start; flex-wrap: wrap; padding: 10px; gap: 8px; }

/* Try-on result modal should always keep full image in viewport. */
#tryon-modal {
    padding: 12px;
    box-sizing: border-box;
}

#tryon-modal .modal-window {
    width: min(760px, 96vw) !important;
    height: min(94vh, 920px);
    max-height: 94vh;
    overflow: hidden;
}

#tryon-result-container {
    flex: 1 1 auto;
    min-height: 0 !important;
    margin-bottom: 14px !important;
}

#tryon-result-container .tryon-result-image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    cursor: zoom-in;
}

#tryon-context {
    max-height: 120px;
    overflow-y: auto;
}

#tryon-thumbnails {
    flex: 0 0 auto;
}

/* --- ZOOM OVERLAY --- */
#zoom-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2200;
    background: rgba(10, 10, 12, 0.78);
    backdrop-filter: blur(2px);
    justify-content: center;
    align-items: center;
    padding: 30px;
    box-sizing: border-box;
}

#zoom-modal .zoom-frame {
    position: relative;
    max-width: min(92vw, 1000px);
    max-height: 90vh;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    padding: 14px;
    box-shadow: var(--shadow-lg);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--radius-md);
}

#zoom-modal #zoom-img {
    display: block;
    max-width: calc(92vw - 120px);
    max-height: calc(90vh - 100px);
    width: auto;
    height: auto;
    object-fit: contain;
    background: #fff;
}

#zoom-close-btn {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--accent);
    font-size: 20px;
    line-height: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    padding: 0;
    z-index: 1;
}

#zoom-hint {
    position: absolute;
    left: 14px;
    bottom: 10px;
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.5px;
    color: var(--muted);
    text-transform: uppercase;
}

/* Profile modal should fit laptop-height screens */
#profile-modal .modal-window {
    width: min(980px, 94vw) !important;
    max-height: 92vh;
    overflow: hidden;
}

@media (max-width: 980px) {
    .top-nav .nav-search {
        width: min(170px, 38vw) !important;
        min-width: 128px;
    }

    .top-nav #semantic-search-query {
        width: min(170px, 38vw) !important;
        min-width: 128px;
    }

    .logo-group img {
        height: 34px;
    }
}

@media (max-width: 780px) {
    .search-compact {
        width: 100% !important;
        max-width: 280px;
    }

    .card-actions {
        opacity: 1;
    }

    .login-screen {
        align-items: center;
        padding-left: 0;
    }

    .login-screen::before {
        content: none;
    }

    .login-screen {
        background-image:
            linear-gradient(180deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0.68) 68%, rgba(255, 255, 255, 0.88) 100%),
            url('/background_1.png?v=20260216m');
    }

    .login-auth-card {
        margin-left: 0;
        width: min(420px, 92vw);
        padding: 18px;
    }
}

#profile-modal .split-view > div {
    min-height: 0;
    overflow-y: auto;
    max-height: calc(92vh - 250px);
    padding-right: 2px;
}

@media (max-width: 960px) {
    .split-view {
        grid-template-columns: 1fr;
    }

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

    #profile-modal .modal-window {
        width: min(760px, 96vw) !important;
        max-height: 94vh;
        padding: 20px;
    }

    #profile-modal .split-view > div {
        max-height: none;
        overflow: visible;
    }
}
