/* ===== AO Lego Collections v2.0 — Design System ===== */
@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@600;700&family=Quicksand:wght@400;500;600;700&display=swap');

:root {
    /* Brand */
    --red:    #E3000B;
    --blue:   #006CB7;
    --yellow: #FFD700;
    --green:  #00A651;
    --orange: #FF8C00;
    --gray:   #9E9E9E;

    /* Surface */
    --bg:      #FAFAFA;
    --surface: #FFFFFF;
    --border:  #EBEBEB;
    --text:    #1A1A1A;
    --text2:   #5A5A5A;

    /* Elevation */
    --shadow-1: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-2: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-3: 0 8px 24px rgba(0,0,0,0.12);
    --shadow-4: 0 20px 48px rgba(0,0,0,0.18);

    /* Radii */
    --radius:    20px;
    --radius-sm: 12px;
    --radius-xs: 8px;

    /* Motion */
    --ease:     cubic-bezier(0.22, 1, 0.36, 1);
    --dur-fast: 150ms;
    --dur-base: 220ms;
    --dur-slow: 350ms;

    /* Typography */
    --font-heading: 'Caveat', 'Segoe UI', system-ui, sans-serif;
    --font-body:    'Quicksand', system-ui, -apple-system, sans-serif;

    /* Z-index */
    --z-dropdown: 50;
    --z-sticky:   100;
    --z-preview:  200;
    --z-lightbox: 300;
    --z-toast:    400;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

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

* { scrollbar-width: thin; scrollbar-color: #ccc transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }

body {
    font-family: var(--font-body);
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4 { font-family: var(--font-heading); line-height: 1.2; }
h3 { margin-bottom: 0.75rem; }

/* ===== Card / Panel ===== */
.card-panel {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-2);
    border: 1px solid var(--border);
}

/* ===== Header ===== */
.header {
    background: var(--red);
    color: #fff;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    box-shadow: 0 4px 20px rgba(227,0,11,0.30);
}
.header h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.5px; }
.header h1 span { color: var(--yellow); }
.header-right { display: flex; align-items: center; gap: 0.75rem; }
.header a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    opacity: 0.88;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-xs);
    transition: background var(--dur-fast), opacity var(--dur-fast);
}
.header a:hover { opacity: 1; background: rgba(255,255,255,0.15); }
.header a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.header-count { font-size: 0.82rem; opacity: 0.75; }
.header-sep   { opacity: 0.4; }

/* LEGO / Mattel collection toggle — logo segmented control under the header */
.coll-toggle-row { text-align: center; margin: 1.1rem 0 0.25rem; }
.coll-toggle { display: inline-flex; align-items: center; gap: 4px; background: #ececec; border-radius: 999px; padding: 5px; box-shadow: inset 0 1px 2px rgba(0,0,0,0.08); }
.coll-toggle__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 1.15rem;
    border-radius: 999px;
    opacity: 0.5;
    border: none;
    background: transparent;
    cursor: pointer;
    font: inherit;
    color: inherit;
    -webkit-appearance: none;
    appearance: none;
    transition: background var(--dur-fast), opacity var(--dur-fast), box-shadow var(--dur-fast);
}
.coll-toggle__btn img { display: block; height: 40px; width: auto; max-width: 120px; object-fit: contain; }
.coll-toggle__btn:hover { opacity: 0.8; }
.coll-toggle__btn.active { background: #fff; opacity: 1; box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
@media (max-width: 768px) { .coll-toggle__btn img { height: 32px; } .coll-toggle__btn { padding: 0.3rem 0.9rem; } }

/* Clickable status stat-cards → filter the table */
.stat-card[data-status] { cursor: pointer; transition: transform var(--dur-fast), box-shadow var(--dur-fast); }
.stat-card[data-status]:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,0.10); }
.stat-card[data-status]:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.stat-card.active { box-shadow: 0 0 0 2px var(--red); }

/* Admin add-form tabs (LEGO / Mattel) */
.admin-tabs { display: flex; gap: 0.4rem; margin-bottom: 1rem; }
.admin-tab {
    background: var(--surface);
    border: 1.5px solid var(--border);
    color: var(--text2);
    font-weight: 700;
    font-size: 0.85rem;
    font-family: var(--font-body);
    padding: 0.45rem 1.2rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.admin-tab:hover { border-color: #aaa; }
.admin-tab.active { background: var(--red); border-color: var(--red); color: #fff; }

/* ===== Stats ===== */
.stats {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    flex-wrap: wrap;
    align-items: stretch;
}
.stat-card {
    background: var(--surface);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-2);
    border: 1px solid var(--border);
    padding: 1rem 0.75rem;
    text-align: center;
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    cursor: default;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-3); }
.stat-card .num {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}
.stat-card .label {
    font-size: 0.68rem;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 0.35rem;
    font-weight: 600;
    overflow-wrap: break-word;
    word-break: break-word;
    width: 100%;
}
.color-green  { color: var(--green); }
.color-orange { color: var(--orange); }
.color-red    { color: var(--red); }
.color-blue   { color: var(--blue); }
.color-gray   { color: var(--gray); }

/* ===== Progress bar ===== */
.progress-bar-wrap {
    padding: 0 1.5rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.progress-bar-track {
    flex: 1;
    height: 8px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: var(--green);
    border-radius: 999px;
    transition: width 0.8s var(--ease);
}
.progress-label { font-size: 0.82rem; color: var(--text2); white-space: nowrap; font-weight: 600; }

/* ===== Filters ===== */
.filters {
    padding: 0 1.5rem 1.25rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}
.search-box {
    flex: 1;
    min-width: 200px;
    padding: 0.65rem 1rem 0.65rem 2.5rem;
    border: 1.5px solid var(--border);
    border-radius: 999px;
    font-size: 0.95rem;
    font-family: var(--font-body);
    color: var(--text);
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235A5A5A' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 0.8rem center;
    outline: none;
    transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.search-box:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,108,183,0.12); }
.filter-select {
    padding: 0.65rem 2rem 0.65rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: 999px;
    font-size: 0.9rem;
    font-family: var(--font-body);
    color: var(--text);
    background: var(--surface);
    cursor: pointer;
    outline: none;
    transition: border-color var(--dur-fast);
}
.filter-select:focus { border-color: var(--blue); }

/* Multi-select dropdown */
.multi-select { position: relative; }
.multi-select-btn { text-align: left; white-space: nowrap; }
.multi-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-3);
    z-index: var(--z-dropdown);
    min-width: 160px;
    padding: 0.4rem 0;
}
.multi-select-dropdown.open { display: block; }
.multi-select-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background var(--dur-fast);
}
.multi-select-item:hover { background: #f5f0ea; }
.multi-select-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--blue); cursor: pointer; }

/* ===== View toggle ===== */
.view-toggle {
    display: flex;
    gap: 0.5rem;
    padding: 0 1.5rem 1rem;
}
.view-btn {
    padding: 0.5rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--surface);
    color: var(--text2);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all var(--dur-fast);
}
.view-btn.active, .view-btn:hover { background: var(--red); color: #fff; border-color: var(--red); }
.view-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ===== Bento Gallery ===== */
.gallery {
    padding: 0 1.5rem 2rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}
.gallery-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-2);
    border: 1px solid var(--border);
    overflow: hidden;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: box-shadow var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
}
.gallery-card.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease),
                box-shadow var(--dur-base) var(--ease);
}
.gallery-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-3); }
.gallery-card:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.gallery-card__img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    object-position: center;
    background: #F5F5F5;
    display: block;
    padding: 0.75rem;
}
/* Override .thumb fixed dimensions inside gallery cards */
.gallery-card__img.thumb {
    width: 100%;
    height: auto;
    border-radius: 0;
    background: #F5F5F5;
}
.gallery-card__body {
    padding: 0.75rem 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    text-align: center;
}
.gallery-card__id {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text2);
}
.gallery-card__name {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.gallery-card__footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
    flex-wrap: wrap;
}
.gallery-card__link {
    color: var(--blue);
    opacity: 0.6;
    transition: opacity var(--dur-fast);
    display: inline-flex;
}
.gallery-card__link:hover { opacity: 1; }
.gallery-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #F0EDE8;
    color: var(--text2);
    opacity: 0.4;
}

/* ===== Table ===== */
.table-wrap { padding: 0 1.5rem 2rem; }
.table-container { padding: 1.25rem; }
table { width: 100%; border-collapse: separate; border-spacing: 0 0.5rem; }
thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
    background: var(--red);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    position: sticky;
    top: 60px;
    z-index: 10;
    box-shadow: 0 -4px 0 var(--bg);
    font-family: var(--font-body);
}
thead th:not([data-sort]) { cursor: default; }
thead th:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
thead th:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
thead th:hover { color: var(--yellow); }
thead th .sort-arrow { display: inline-block; min-width: 0.65em; margin-left: 4px; font-size: 0.7rem; }
thead { background: var(--red); }
tbody tr {
    background: var(--surface);
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
}
tbody tr:hover { transform: translateY(-2px); box-shadow: var(--shadow-3); }
tbody td { padding: 0.75rem 1rem; vertical-align: middle; }
/* Assembly=5th, Year=6th, Status=7th */
thead th:nth-child(5), tbody td:nth-child(5),
thead th:nth-child(6), tbody td:nth-child(6),
thead th:nth-child(7), tbody td:nth-child(7) { text-align: center !important; }
tbody tr td:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
tbody tr td:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.lego-id   { color: var(--blue); font-family: monospace; font-size: 1rem; }
.lego-name { font-weight: 600; }

.id-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    text-decoration: none;
    color: inherit;
}
.id-link:hover .lego-id { text-decoration: underline; }
.id-link svg { color: var(--blue); opacity: 0.7; flex-shrink: 0; }

/* Icon link */
.link-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem;
    border-radius: var(--radius-xs);
    color: var(--blue);
    transition: background var(--dur-fast);
    cursor: pointer;
    text-decoration: none;
}
.link-icon:hover { background: rgba(0,108,183,0.1); }
.link-icon:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

.pdf-icon {
    flex-direction: column;
    gap: 2px;
    margin: 0 auto;
}
.pdf-icon:hover { background: rgba(255,64,47,0.1); }
.pdf-size {
    font-size: 0.65rem;
    color: var(--text2);
    line-height: 1;
    font-family: monospace;
}

.pdf-url-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.pdf-url-row .form-input { flex: 1; min-width: 0; }

/* Thumbnails */
.thumb {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: var(--radius-xs);
    cursor: pointer;
    background: #f5f0ea;
}
.thumb-placeholder {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-xs);
    background: #f5f0ea;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
}

/* ===== Status badges ===== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    font-family: var(--font-body);
    white-space: nowrap;
}

/* ===== Type pills ===== */
.type-pill {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-xs);
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--font-body);
}

/* ===== Image hover preview ===== */
.thumb-wrap { position: relative; display: inline-block; }
.thumb-preview {
    display: none;
    position: fixed;
    top: 0; left: 0;
    max-width: 1024px;
    max-height: 80vh;
    width: auto; height: auto;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-4);
    border: 2px solid var(--border);
    background: var(--surface);
    z-index: var(--z-preview);
    pointer-events: none;
}

/* ===== Lightbox ===== */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.88);
    z-index: var(--z-lightbox);
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
.lightbox.active { display: flex; }
.lightbox__img {
    max-width: 90vw;
    max-height: 88vh;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-4);
    object-fit: contain;
}
.lightbox__nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 50%;
    width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    cursor: pointer;
    transition: background var(--dur-fast);
    z-index: 1;
}
.lightbox__nav:hover { background: rgba(255,255,255,0.30); }
.lightbox__nav:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lightbox__prev { left: 1rem; }
.lightbox__next { right: 1rem; }
.lightbox__counter {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    font-family: var(--font-body);
}

/* ===== Scroll-to-top ===== */
.scroll-top {
    position: fixed;
    bottom: 2rem;
    right: 1.5rem;
    width: 44px; height: 44px;
    background: var(--red);
    color: #fff;
    border: none;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-3);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity var(--dur-base), transform var(--dur-base) var(--ease);
    z-index: var(--z-dropdown);
}
.scroll-top.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.scroll-top:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ===== Empty states ===== */
.empty { text-align: center; padding: 3rem 1rem; color: var(--text2); }
.empty svg { opacity: 0.3; margin-bottom: 0.75rem; }

.empty-collection {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 5rem 2rem;
    text-align: center;
    color: var(--text2);
}
.empty-collection svg { opacity: 0.25; }
.empty-collection h2 { font-family: var(--font-heading); font-size: 1.75rem; color: var(--text); }
.empty-collection p  { font-size: 0.95rem; }
.empty-collection a  { color: var(--blue); font-weight: 600; text-decoration: none; }
.empty-collection a:hover { text-decoration: underline; }

/* ===== Mobile cards ===== */
.cards { display: none; padding: 0 1rem 2rem; }
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-2);
    border: 1px solid var(--border);
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 1rem;
    align-items: start;
    transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-3); }
.card-img { flex-shrink: 0; }
.card-img .thumb { width: 88px; height: 88px; cursor: pointer; }
.card-body { flex: 1; min-width: 0; }
.card-body .lego-id   { font-family: monospace; font-size: 0.78rem; color: var(--text2); display: block; }
.card-body .lego-name { font-weight: 700; font-size: 0.95rem; display: block; margin: 0.2rem 0 0.4rem; line-height: 1.3; }
.card-body .meta      { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.card-body .lego-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--blue);
    font-size: 0.8rem;
    text-decoration: none;
    margin-top: 0.4rem;
}
.card-body .lego-link:hover { text-decoration: underline; }

/* ===== Login ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.login-box { width: 100%; max-width: 380px; padding: 2.5rem 2rem; text-align: center; }
.login-box h2 { margin-bottom: 1.5rem; color: var(--red); font-size: 2rem; }
.login-back { margin-top: 1rem; }
.login-back a { color: var(--blue); font-size: 0.85rem; }

/* ===== Forms ===== */
.form-group  { margin-bottom: 1rem; text-align: left; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.3rem; color: var(--text2); }
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font-body);
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.form-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,108,183,0.12); }
.password-wrap { position: relative; }
.password-wrap .form-input { padding-right: 3rem; }
.pw-toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity var(--dur-fast);
    display: flex;
    align-items: center;
}
.pw-toggle:hover { opacity: 1; }
.form-select {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font-body);
    color: var(--text);
    background: var(--surface);
    cursor: pointer;
    outline: none;
    transition: border-color var(--dur-fast);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%235A5A5A'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
}
.form-select:focus { border-color: var(--blue); }
.field-error { display: block; color: var(--red); font-size: 0.78rem; margin-top: 0.25rem; font-weight: 600; }

.btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font-body);
    color: #fff;
    background: var(--red);
    cursor: pointer;
    box-shadow: var(--shadow-2);
    transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-3); }
.btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.btn-blue { background: var(--blue); }
.btn-sm   { padding: 0.45rem 1rem; font-size: 0.85rem; }
.btn-full { width: 100%; }
.half-width { width: 50%; }

.alert { padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: 0.9rem; }
.alert-error   { background: #FDECEC; color: var(--red); }
.alert-success { background: #E8F8EF; color: var(--green); }

/* ===== Admin panel ===== */
.admin-layout  { display: flex; min-height: calc(100vh - 56px); }
.admin-sidebar { width: 80px; background: #2d2d3d; flex-shrink: 0; display: flex; flex-direction: column; padding-top: 0.5rem; gap: 0.25rem; position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; align-self: flex-start; }
.nav-item      { cursor: pointer; padding: 0.625rem 0.25rem; text-align: center; border-radius: 6px; margin: 0 0.375rem; color: #9a9ab0; transition: background 0.15s, color 0.15s; user-select: none; }
.nav-item:hover  { background: #3d3d5a; color: #fff; }
.nav-item.active { background: var(--red); color: #fff; }
.nav-icon  { font-size: 1.25rem; display: block; }
.nav-label { font-size: 0.65rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; margin-top: 0.2rem; display: block; }
.admin-main  { flex: 1; padding: 1.5rem; background: var(--bg); min-width: 0; }
.admin-panel { display: none; }
.admin-panel.active { display: block; }
.type-stats   { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.form-row     { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { margin-top: 1.25rem; display: flex; gap: 0.75rem; flex-wrap: wrap; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.admin-table th, .admin-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    height: 3rem;
}
.admin-table th {
    color: #fff;
    background: var(--red);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: var(--font-body);
    position: sticky;
    top: 60px;
    z-index: 10;
    box-shadow: 0 -4px 0 var(--bg);
}
.admin-table th[data-col] { cursor: pointer; user-select: none; white-space: nowrap; }
.admin-table th[data-col]::after { content: ' ⇅'; opacity: 0.45; font-size: 0.7rem; }
.admin-table th[data-col][data-sort-dir="asc"]::after  { content: ' ▲'; opacity: 1; }
.admin-table th[data-col][data-sort-dir="desc"]::after { content: ' ▼'; opacity: 1; }
.admin-table td:last-child, .admin-table th:last-child { white-space: nowrap; }
.admin-table .del-form { display: inline; }
.mt-actions { display: flex; flex-wrap: nowrap; align-items: center; gap: 0.4rem; }
.mt-actions .mt-del-form { display: inline; margin: 0; }
.list-img-cell { text-align: center; white-space: nowrap; vertical-align: middle; }
.list-img-cell img { max-width: 20px; max-height: 30px; display: block; margin: 0 auto 2px; object-fit: contain; }
.list-img-name { font-size: 0.65rem; display: block; max-width: 80px; overflow: hidden; text-overflow: ellipsis; text-align: center; }

.quick-status {
    padding: 0.25rem 1.8rem 0.25rem 0.5rem;
    border: none;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    outline: none;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: opacity var(--dur-fast);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%235A5A5A'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    max-width: 150px;
}
.quick-status:hover { opacity: 0.8; }
.quick-status.saving { opacity: 0.5; }
.quick-status option { background: #fff; color: var(--text); }

.btn-edit, .btn-del {
    padding: 0.35rem 0.75rem;
    border: none;
    border-radius: var(--radius-xs);
    font-size: 0.8rem;
    font-family: var(--font-body);
    cursor: pointer;
    font-weight: 600;
    transition: background var(--dur-fast);
}
.btn-edit { background: #E6F2FB; color: var(--blue); }
.btn-del  { background: #FDECEC; color: var(--red); }
.btn-edit:hover { background: #D0E6F7; }
.btn-del:hover  { background: #FACFCF; }

/* ===== Manage Types ===== */
.type-manager { display: flex; flex-direction: column; gap: 1rem; }

.type-add-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.type-name-input { flex: 1; min-width: 160px; }

.type-color-wrap  { display: flex; align-items: center; gap: 0.4rem; }
.type-color-label { font-size: 0.82rem; font-weight: 600; color: var(--text2); white-space: nowrap; }
.type-color-picker {
    width: 38px;
    height: 38px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 2px;
    cursor: pointer;
    background: none;
}

.type-manager-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    overflow: hidden;
}
.type-manager-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.type-manager-item:last-child { border-bottom: none; }
.type-manager-item:hover { background: var(--bg); }
.type-manager-item .type-pill { flex-shrink: 0; }
.type-use-count { font-size: 0.72rem; color: var(--text2); font-weight: 600; white-space: nowrap; }
.type-in-use    { font-size: 0.68rem; color: var(--text2); font-style: italic; }
.btn-del-xs, .btn-edit-type, .btn-edit-status {
    padding: 0.2rem 0.6rem;
    font-size: 0.78rem;
    border-radius: var(--radius-xs);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.type-color-row { display: flex; align-items: center; gap: 0.6rem; }
.type-hex-input { width: 100px; font-family: monospace; font-size: 0.88rem; }

.img-toggle { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.current-img-label { display: block; font-size: 0.78rem; color: var(--text2); margin-bottom: 0.4rem; }
.current-img-label a { color: var(--text2); text-decoration: underline; }
#imageFileGroup { display: none; }
#editImageFileGroup { display: none; }

/* ===== EDIT entry list ===== */
.edit-list { border: 1px solid var(--border); border-radius: var(--radius-xs); margin-bottom: 1rem; }
.edit-list-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.45rem 0.75rem; cursor: pointer; border-bottom: 1px solid var(--border); transition: background 0.1s; }
.edit-list-row:last-child { border-bottom: none; }
.edit-list-row:hover { background: #fdf0e8; }
.edit-list-row.selected { background: #E3000B1A; border-left: 3px solid var(--red); padding-left: calc(0.75rem - 3px); }
.edit-row-id   { font-weight: 700; color: var(--blue); min-width: 3rem; font-size: 0.82rem; flex-shrink: 0; }
.edit-row-name { flex: 1; font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.edit-modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 400; align-items: center; justify-content: center; padding: 1rem; }
.edit-modal.open { display: flex; }
.edit-modal-inner { background: var(--surface); border-radius: var(--radius); padding: 1.5rem; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: 0 8px 40px rgba(0,0,0,0.25); }
.edit-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.edit-form-title { font-size: 0.95rem; font-weight: 700; color: var(--red); }
.edit-modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 0.25rem; line-height: 1; border-radius: var(--radius-xs); transition: color 0.15s; }
.edit-modal-close:hover { color: var(--red); }

.img-preview-modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.82); z-index: 450; align-items: center; justify-content: center; cursor: zoom-out; }
.img-preview-modal.open { display: flex; }
.img-preview-modal img { max-width: 90vw; max-height: 88vh; object-fit: contain; border-radius: var(--radius-xs); box-shadow: 0 8px 40px rgba(0,0,0,0.5); cursor: default; }
.img-preview-close { position: absolute; top: 1rem; right: 1rem; background: rgba(255,255,255,0.15); border: none; border-radius: 50%; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #fff; transition: background 0.15s; }
.img-preview-close:hover { background: rgba(255,255,255,0.30); }
#resetFilters { white-space: nowrap; padding: 0.65rem 1.25rem; font-size: 0.9rem; }
#emptyTable, #emptyCards, #emptyGallery { display: none; }

/* ===== Toast notifications ===== */
.toast-wrap {
    position: fixed;
    bottom: 5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: var(--z-toast);
    pointer-events: none;
}
.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-3);
    padding: 0.75rem 1.25rem;
    font-size: 0.88rem;
    font-family: var(--font-body);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    pointer-events: auto;
    max-width: 320px;
    opacity: 0;
    transform: translateX(16px);
    transition: opacity var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
}
.toast.show    { opacity: 1; transform: translateX(0); }
.toast-success { border-left: 4px solid var(--green); color: var(--green); }
.toast-error   { border-left: 4px solid var(--red);   color: var(--red); }
.toast-info    { border-left: 4px solid var(--blue);  color: var(--blue); }
.toast-confirm { flex-wrap: wrap; align-items: flex-start; }
.toast-confirm span { flex: 1; min-width: 0; }
.toast-confirm-btns { display: flex; gap: 0.4rem; width: 100%; margin-top: 0.5rem; }
.toast-confirm-yes, .toast-confirm-cancel {
    padding: 0.3rem 0.75rem;
    border: none;
    border-radius: var(--radius-xs);
    font-size: 0.8rem;
    font-family: var(--font-body);
    font-weight: 700;
    cursor: pointer;
}
.toast-confirm-yes    { background: var(--red);    color: #fff; }
.toast-confirm-cancel { background: var(--border); color: var(--text); }
.toast-confirm-yes:hover    { opacity: 0.85; }
.toast-confirm-cancel:hover { background: #d0d0d0; }

.list-search-wrap { margin-bottom: 0.75rem; }

/* ===== Batch image panel ===== */
.batch-empty       { text-align: center; padding: 3rem 1rem; color: var(--green); }
.batch-empty svg   { display: block; margin: 0 auto 0.75rem; stroke: var(--green); }
.batch-empty p     { font-size: 1.05rem; font-weight: 700; margin: 0 0 0.3rem; }
.batch-empty small { font-size: 0.82rem; color: var(--text2); }
.batch-summary     { font-size: 0.88rem; color: var(--text2); margin-bottom: 0.75rem; }
.size-warn         { color: var(--red); font-weight: 700; }
.btn-run-batch     { background: var(--red); color: #fff; }
.btn-run-batch:hover { background: #c0001a; }

/* ===== Footer ===== */
.footer { text-align: center; padding: 1.5rem; font-size: 0.8rem; color: var(--text2); margin-top: auto; }
.footer a { color: var(--blue); text-decoration: none; }
.footer-browse-link { color: var(--text2); text-decoration: none; }
.footer-browse-link:hover { text-decoration: underline; }

/* ===== Responsive — consolidated ===== */

@media (max-width: 1100px) {
    .gallery { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    /* Header */
    .header { padding: 0.65rem 1rem; }
    .header h1 { font-size: 1.5rem; }

    /* Stats */
    .stats { padding: 1rem; gap: 0.5rem; display: grid; grid-template-columns: repeat(3, 1fr); }
    .stat-card { padding: 0.75rem 0.5rem; flex: unset; }
    .stat-card .num { font-size: 1.6rem; }

    /* Progress bar */
    .progress-bar-wrap { padding: 0 1rem 1rem; flex-direction: column; align-items: flex-start; gap: 0.4rem; }

    /* Filters */
    .filters { padding: 0 1rem 1rem; gap: 0.5rem; }
    .search-box { min-width: 0; width: 100%; }

    /* View toggle */
    .view-toggle { padding: 0 1rem 0.75rem; }
    .view-btn { flex: 1; justify-content: center; }

    /* Gallery */
    .gallery { grid-template-columns: repeat(2, 1fr); padding: 0 1rem 2rem; }

    /* Table → cards */
    .table-wrap { display: none; }
    .cards { display: block; }

    /* Admin */
    .admin-main { padding: 1rem; }
    .admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .admin-table th { position: static; }
    .form-row { grid-template-columns: 1fr; }

    /* Toasts */
    .toast-wrap { right: 1rem; left: 1rem; bottom: 4rem; }
    .toast { max-width: 100%; }
}

@media (max-width: 480px) {
    /* Header */
    .header h1 { font-size: 1.25rem; }
    .header-count { display: none; }

    /* Stats */
    .stats { gap: 0.3rem; grid-template-columns: repeat(3, 1fr); }
    .stat-card { padding: 0.6rem 0.4rem; }
    .stat-card .num { font-size: 1.3rem; }
    .stat-card .label { font-size: 0.6rem; letter-spacing: 0; }

    /* Gallery: single column */
    .gallery { grid-template-columns: 1fr; }

    /* Filters: stack */
    .filters { flex-direction: column; align-items: stretch; }
    .multi-select, .multi-select-btn { width: 100%; }
    .multi-select-dropdown { width: 100%; }
    #resetFilters { width: 100%; text-align: center; }

    /* Lightbox */
    .lightbox__nav { width: 40px; height: 40px; }
    .lightbox__prev { left: 0.5rem; }
    .lightbox__next { right: 0.5rem; }

    /* Scroll-to-top */
    .scroll-top { bottom: 1.25rem; right: 1rem; }
}

@media (max-width: 375px) {
    .header { padding: 0.5rem 0.75rem; }
    .stats { padding: 0.75rem; }
    .filters { padding: 0 0.75rem 0.75rem; }
    .gallery { padding: 0 0.75rem 1.5rem; }
    .cards { padding: 0 0.75rem 1.5rem; }
    .admin-main { padding: 0.75rem; }
}

/* ── v2.3.0 Set Lookup ───────────────────────────────────────────────────── */
.lookup-badge {
    display: none;
    font-size: 0.78rem;
    margin-top: 0.35rem;
    padding: 0.28rem 0.6rem;
    border-radius: var(--radius-xs, 6px);
    gap: 0.4rem;
    align-items: center;
    line-height: 1.4;
}
.lookup-badge.show     { display: flex; }
.lookup-badge.found    { background: #00A6511F; color: #00A651; }
.lookup-badge.notfound { background: #E3000B1F; color: #E3000B; }
.lookup-badge.loading  { background: #6061691F; color: #606169; }
.lookup-badge.error    { background: #E3000B1F; color: #E3000B; }

.type-prompt {
    display: none;
    margin-top: 0.45rem;
    padding: 0.55rem 0.7rem;
    background: #006CB70F;
    border: 1px solid #006CB730;
    border-radius: var(--radius-xs, 6px);
    font-size: 0.78rem;
    color: #006CB7;
    flex-direction: column;
    gap: 0.4rem;
}
.type-prompt.show      { display: flex; }
.type-prompt-row       { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.type-prompt-colorpick { display: none; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.type-prompt-colorpick.show { display: flex; }

.lookup-img-preview {
    display: none;
    margin-top: 0.5rem;
    max-height: 72px;
    max-width: 72px;
    object-fit: contain;
    border-radius: var(--radius-xs, 6px);
    border: 1px solid #F0EBE4;
    background: #fff;
}
.lookup-img-preview.show { display: block; }

.year-tag {
    font-weight: 500;
    white-space: nowrap;
}

.year-pill {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-xs);
    font-size: 0.75rem;
    font-weight: 600;
    background: #F0EDE8;
    color: var(--text2);
    font-family: var(--font-body);
    white-space: nowrap;
}

.lego-link-pdf { color: #ff402f; }
.lego-link-pdf:hover { color: #c0001a; }

/* ===== sc.php — Speed Champions Set List ===== */
.page-sc { overflow-x: hidden; }
.page-sc h1.page-title { font-family: system-ui, sans-serif; font-size: 1.4rem; font-weight: 700; margin-bottom: 0.25rem; }
.page-sc h1.page-title span { color: #E3000B; }
.page-sc p.sub { color: #888; font-size: 0.85rem; margin-bottom: 1.5rem; }
.page-sc .title-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.25rem; }
.page-sc .table-scroll { overflow-x: auto; overflow-y: auto; max-height: calc(100vh - 230px); -webkit-overflow-scrolling: touch; border-radius: 8px; box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.page-sc table { width: 100%; min-width: 560px; border-collapse: collapse; background: #fff; }
.page-sc thead { background: #E3000B; color: #fff; }
.page-sc th { padding: 0.75rem 1rem; text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; cursor: pointer; user-select: none; white-space: nowrap; position: sticky; top: 0; z-index: 2; background: #E3000B; color: #fff; }
.page-sc th:hover { background: #c8001a; }
.page-sc th.no-sort { cursor: default; }
.page-sc th.no-sort:hover { background: #E3000B; }
.page-sc .pill.active { background: #E3000B; color: #fff; border-color: #E3000B; }

/* ===== t.php — Technic Set List ===== */
.page-t { overflow-x: hidden; }
.page-t h1.page-title { font-family: system-ui, sans-serif; font-size: 1.4rem; font-weight: 700; margin-bottom: 0.25rem; }
.page-t h1.page-title span { color: #D84315; }
.page-t p.sub { color: #888; font-size: 0.85rem; margin-bottom: 1.5rem; }
.page-t .title-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.25rem; }
.page-t .table-scroll { overflow-x: auto; overflow-y: auto; max-height: calc(100vh - 230px); -webkit-overflow-scrolling: touch; border-radius: 8px; box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.page-t table { width: 100%; min-width: 620px; border-collapse: collapse; background: #fff; }
.page-t thead { background: #D84315; color: #fff; }
.page-t th { padding: 0.75rem 1rem; text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; cursor: pointer; user-select: none; white-space: nowrap; position: sticky; top: 0; z-index: 2; background: #D84315; color: #fff; }
.page-t th:hover { background: #bf360c; }
.page-t th.no-sort { cursor: default; }
.page-t th.no-sort:hover { background: #D84315; }
.page-t .pill.active { background: #D84315; color: #fff; border-color: #D84315; }
.page-t .theme { font-size: 0.78rem; color: #888; }

/* ===== sc.php + t.php — Shared Table Styles ===== */
.page-sc td, .page-t td { padding: 0.55rem 1rem; border-bottom: 1px solid #f0f0f0; vertical-align: middle; font-size: 0.9rem; }
.page-sc tr:last-child td, .page-t tr:last-child td { border-bottom: none; }
.page-sc tr:hover td, .page-t tr:hover td { background: #fafafa; }
.page-sc tr[data-id], .page-t tr[data-id] { cursor: pointer; }
.page-sc th.sort-asc::after,  .page-t th.sort-asc::after  { content: ' ▲'; font-size: 0.65rem; }
.page-sc th.sort-desc::after, .page-t th.sort-desc::after { content: ' ▼'; font-size: 0.65rem; }
.page-sc .id, .page-t .id { font-family: monospace; font-size: 0.85rem; color: #555; }
.page-sc .id-link, .page-t .id-link { font-family: monospace; font-size: 0.85rem; color: #006CB7; text-decoration: none; display: inline; }
.page-sc .id-link:hover, .page-t .id-link:hover { text-decoration: underline; }
.page-sc .year, .page-t .year { font-size: 0.85rem; color: #666; text-align: center; }
.page-sc .parts, .page-t .parts { font-size: 0.8rem; text-align: right; }
.page-sc img, .page-t img { width: 60px; height: 60px; object-fit: contain; border-radius: 4px; background: #f5f0ea; display: block; cursor: zoom-in; }
.page-sc img.broken, .page-t img.broken { opacity: 0.2; cursor: default; }
.page-sc #img-preview, .page-t #img-preview { position: fixed; display: none; pointer-events: none; z-index: 9999; background: #fff; border-radius: 10px; padding: 8px; box-shadow: 0 8px 32px rgba(0,0,0,0.22); }
.page-sc #img-preview img, .page-t #img-preview img { width: auto; height: auto; object-fit: contain; display: block; border-radius: 6px; background: #f5f0ea; cursor: default; }
.page-sc .filter-pills, .page-t .filter-pills { display: flex; gap: 0.4rem; }
.page-sc .pill, .page-t .pill { padding: 0.3rem 0.85rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; cursor: pointer; border: 1.5px solid #ddd; background: #fff; color: #555; transition: all 0.15s; }
.page-sc .pill:hover, .page-t .pill:hover { border-color: #aaa; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skel { display: inline-block; width: 100%; height: 14px; border-radius: 4px; background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.skel-img  { height: 48px; width: 48px; border-radius: 4px; }
.skel-name { width: 72%; }
.skel-sm   { width: 50%; }
.skel-xs   { width: 28%; }
.skel-row:hover td { background: transparent !important; }

/* ===== mf.php — Minifigures List ===== */
.page-mf { overflow-x: hidden; }
.page-mf h1.page-title { font-family: system-ui, sans-serif; font-size: 1.4rem; font-weight: 700; margin-bottom: 0.25rem; }
.page-mf h1.page-title span { color: #006CB7; }
.page-mf p.sub { color: #888; font-size: 0.85rem; }
.page-mf .title-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.25rem; }
.page-mf .table-scroll { overflow-x: auto; overflow-y: auto; max-height: calc(100vh - 290px); -webkit-overflow-scrolling: touch; border-radius: 8px; box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.page-mf table { width: 100%; min-width: 560px; border-collapse: collapse; background: #fff; }
.page-mf thead { background: #006CB7; color: #fff; }
.page-mf th { padding: 0.75rem 1rem; text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; cursor: pointer; user-select: none; white-space: nowrap; position: sticky; top: 0; z-index: 2; background: #006CB7; color: #fff; }
.page-mf th:hover { background: #00558f; }
.page-mf th.no-sort { cursor: default; }
.page-mf th.no-sort:hover { background: #006CB7; }
.page-mf th.sort-asc::after  { content: ' ▲'; font-size: 0.65rem; }
.page-mf th.sort-desc::after { content: ' ▼'; font-size: 0.65rem; }
.page-mf td { padding: 0.55rem 1rem; border-bottom: 1px solid #f0f0f0; vertical-align: middle; font-size: 0.9rem; }
.page-mf tr:last-child td { border-bottom: none; }
.page-mf tr:hover td { background: #fafafa; }
.page-mf .id { font-family: monospace; font-size: 0.85rem; color: #555; }
.page-mf .id-link { font-family: monospace; font-size: 0.85rem; color: #006CB7; text-decoration: none; display: inline; }
.page-mf .id-link:hover { text-decoration: underline; }
.page-mf .year { font-size: 0.85rem; color: #666; }
.page-mf .parts { font-size: 0.8rem; }
.page-mf img { width: 60px; height: 60px; object-fit: contain; border-radius: 4px; background: #f5f0ea; display: block; cursor: zoom-in; }
.page-mf #img-preview { position: fixed; display: none; pointer-events: none; z-index: 9999; background: #fff; border-radius: 10px; padding: 8px; box-shadow: 0 8px 32px rgba(0,0,0,0.22); }
.page-mf #img-preview img { width: auto; height: auto; object-fit: contain; display: block; border-radius: 6px; background: #f5f0ea; cursor: default; }
.page-mf .filter-pills { display: flex; gap: 0.4rem; }
.page-mf .pill { padding: 0.3rem 0.85rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; cursor: pointer; border: 1.5px solid #ddd; background: #fff; color: #555; transition: all 0.15s; }
.page-mf .pill:hover { border-color: #aaa; }
.page-mf .pill.active { background: #006CB7; color: #fff; border-color: #006CB7; }
.page-mf .mf-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; margin: 0.25rem 0 1rem; }
.page-mf .mf-search { flex: 1 1 280px; max-width: 360px; background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-xs); padding: 0.55rem 0.9rem; font-size: 0.9rem; font-family: var(--font-body); color: var(--text); box-shadow: var(--shadow-1); transition: border-color var(--dur-fast); }
.page-mf .mf-search:focus { outline: none; border-color: #006CB7; }
.page-mf .mf-pager { display: flex; align-items: center; justify-content: center; gap: 0.85rem; margin-top: 1rem; flex-wrap: wrap; }
.page-mf .pager-btn { background: #006CB7; color: #fff; border: none; cursor: pointer; border-radius: var(--radius-xs); padding: 0.45rem 1rem; font-size: 0.82rem; font-weight: 700; font-family: var(--font-body); transition: background var(--dur-fast); }
.page-mf .pager-btn:hover:not(:disabled) { background: #00558f; }
.page-mf .pager-btn:disabled { background: #cfd8dc; cursor: default; }
.page-mf .pager-info { font-size: 0.82rem; color: var(--text2); font-family: var(--font-body); }

/* ===== hw.php + mattel.php — Hot Wheels Brick Shop ===== */
.page-hw .hw-badge { display: inline-block; padding: 0.12rem 0.5rem; border-radius: 999px; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: #fff; }
.page-hw .hw-premium { background: #7B1FA2; }
.page-hw .hw-elite   { background: #E3000B; }
.page-hw .hw-speed   { background: #F57C00; }
.page-hw .hw-link { font-size: 0.8rem; color: #006CB7; text-decoration: none; white-space: nowrap; }
.page-hw .hw-link:hover { text-decoration: underline; }
.page-hw .badge { display: inline-block; padding: 0.18rem 0.55rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }

/* ===== info.php — Set Lookup Page ===== */
.info-wrap { max-width: 660px; margin: 1.5rem auto; padding: 0 1rem; }
.search-label { font-size: 0.75rem; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.5rem; }
.search-row { display: flex; gap: 0.5rem; }
.search-input { flex: 1; background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-xs); padding: 0.65rem 1rem; font-size: 0.95rem; font-family: var(--font-body); color: var(--text); box-shadow: var(--shadow-1); transition: border-color var(--dur-fast); }
.search-input:focus { outline: none; border-color: var(--red); }
.search-btn { background: var(--red); color: #fff; border: none; cursor: pointer; border-radius: var(--radius-xs); padding: 0.65rem 1.25rem; font-size: 0.9rem; font-weight: 700; font-family: var(--font-body); box-shadow: 0 2px 8px rgba(227,0,11,0.3); transition: background var(--dur-fast), transform var(--dur-fast); }
.search-btn:hover { background: #c8001a; transform: translateY(-1px); }
.search-btn:active { transform: none; }
.search-hint { margin-top: 0.4rem; font-size: 0.75rem; color: #bbb; }
.not-found { margin-top: 1.25rem; padding: 1rem 1.25rem; background: #fff8f8; border: 1.5px solid #ffd0d0; border-radius: var(--radius-sm); color: #c0001a; font-size: 0.9rem; }
.not-found code { font-family: monospace; font-weight: 700; }
.suggestion-panel { margin-top: 1.25rem; overflow: hidden; }
.suggestion-header { padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.25rem; }
.suggestion-header .s-title { font-size: 0.82rem; color: var(--text2); }
.suggestion-header .s-title strong { color: var(--text); }
.suggestion-overflow { font-size: 0.75rem; color: #bbb; }
.suggestion-row { display: flex; align-items: center; gap: 0.85rem; padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; transition: background var(--dur-fast); }
.suggestion-row:last-child { border-bottom: none; }
.suggestion-row:hover { background: #fafafa; }
.suggestion-row:hover .s-name { color: var(--red); }
.s-thumb { width: 48px; height: 48px; object-fit: contain; border-radius: 8px; background: #f5f0ea; flex-shrink: 0; display: block; }
.s-thumb-placeholder { width: 48px; height: 48px; border-radius: 8px; background: #f5f0ea; flex-shrink: 0; }
.s-info { flex: 1; min-width: 0; }
.s-name { font-size: 0.88rem; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color var(--dur-fast); }
.s-meta { font-size: 0.75rem; color: var(--text2); margin-top: 0.1rem; }
.s-id { font-family: monospace; font-size: 0.78rem; color: #bbb; flex-shrink: 0; }
.s-arrow { color: #ccc; font-size: 1.1rem; flex-shrink: 0; margin-left: 0.25rem; }
.result-card { margin-top: 1.25rem; overflow: hidden; }
.img-section { background: linear-gradient(160deg, #f5f0ea, #ece6dc); display: flex; align-items: center; justify-content: space-between; padding: 1.5rem 1.5rem 1.5rem 1.75rem; border-bottom: 1px solid #f0ece6; gap: 1.25rem; }
.img-aside { flex: 1; min-width: 0; }
.set-name { font-family: var(--font-heading); font-size: 1.7rem; font-weight: 700; color: var(--text); line-height: 1.2; margin-bottom: 0.25rem; }
.set-meta { font-size: 0.82rem; color: var(--text2); margin-bottom: 0.6rem; }
.owned-badge { display: inline-flex; align-items: center; gap: 0.3rem; background: #00A6511F; color: var(--green); border-radius: var(--radius-xs); padding: 0.28rem 0.65rem; font-size: 0.75rem; font-weight: 700; }
.theme-pill { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 0.72rem; font-weight: 700; margin-bottom: 0.5rem; }
.set-img-wrap { position: relative; flex-shrink: 0; width: 130px; height: 130px; border-radius: 16px; cursor: zoom-in; overflow: hidden; }
.set-img { width: 130px; height: 130px; object-fit: contain; background: #e8e0d4; border-radius: 16px; display: block; box-shadow: 0 6px 18px rgba(0,0,0,.14); transition: transform 0.22s var(--ease), filter 0.22s; }
.set-img-placeholder { width: 130px; height: 130px; background: #e8e0d4; border-radius: 16px; box-shadow: 0 6px 18px rgba(0,0,0,.14); flex-shrink: 0; }
.zoom-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.set-img-wrap:hover .set-img { transform: scale(1.06); filter: brightness(0.72); }
.set-img-wrap:hover .zoom-overlay { opacity: 1; }
.zoom-icon { background: rgba(255,255,255,0.92); border-radius: 50%; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 12px rgba(0,0,0,0.22); transform: scale(0.7); transition: transform 0.2s var(--ease); }
.set-img-wrap:hover .zoom-icon { transform: scale(1); }
.zoom-icon svg { width: 18px; height: 18px; stroke: var(--text); stroke-width: 2; fill: none; }
.stats-section { padding: 1.1rem 1.35rem 0.85rem; }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; }
.kv { background: #fafafa; border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 0.6rem 0.85rem; }
.kv-k { font-size: 0.67rem; color: #bbb; text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 0.15rem; }
.kv-v { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.kv-v.price { color: var(--red); }
.links-section { padding: 0.85rem 1.35rem 1.35rem; border-top: 1px solid var(--border); }
.links-label { font-size: 0.67rem; color: #bbb; text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 0.55rem; }
.links-row { display: flex; gap: 0.55rem; flex-wrap: wrap; }
.info-btn { flex: 1; min-width: 100px; text-align: center; border-radius: var(--radius-xs); padding: 0.55rem 0.75rem; font-size: 0.78rem; font-weight: 700; font-family: var(--font-body); display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; text-decoration: none; cursor: pointer; border: none; background: none; transition: opacity var(--dur-fast), transform var(--dur-fast); white-space: nowrap; }
.info-btn:hover { opacity: 0.85; transform: translateY(-1px); }
.info-btn:active { transform: none; }
.info-btn.red { background: var(--red); color: #fff; box-shadow: 0 2px 8px rgba(227,0,11,0.25); }
.info-btn.red-ol { border: 1.5px solid var(--red); color: var(--red); }
.info-btn.blue-ol { border: 1.5px solid var(--blue); color: var(--blue); }
.modal-backdrop { position: fixed; inset: 0; z-index: var(--z-lightbox); background: rgba(10,10,18,0.82); display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); opacity: 0; pointer-events: none; transition: opacity 0.25s; }
.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal-box { background: var(--surface); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow-4); display: flex; flex-direction: column; align-items: center; gap: 1rem; width: min(95vw, 800px); max-height: 95vh; overflow-y: auto; transform: scale(0.88); transition: transform 0.25s var(--ease); }
.modal-backdrop.open .modal-box { transform: scale(1); }
.modal-img { width: 100%; max-height: calc(95vh - 9rem); object-fit: contain; background: #f5f0ea; border-radius: var(--radius-sm); display: block; box-shadow: var(--shadow-2); }
.modal-img-placeholder { width: 100%; height: min(600px, calc(95vh - 9rem)); background: #f5f0ea; border-radius: var(--radius-sm); }
.modal-name { font-family: var(--font-heading); font-size: 1.3rem; color: var(--text); font-weight: 700; text-align: center; }
.modal-sub { font-size: 0.78rem; color: var(--text2); text-align: center; }
.modal-close { background: #f0f0f0; color: var(--text2); border: none; cursor: pointer; border-radius: var(--radius-xs); padding: 0.45rem 1.5rem; font-size: 0.82rem; font-weight: 700; font-family: var(--font-body); transition: background var(--dur-fast); }
.modal-close:hover { background: #e0e0e0; }
