/* =============================================================================
   sref.site – Main Stylesheet
   Design: Clean indigo/purple UI inspired by modern app aesthetics
   ============================================================================= */

/* ── Google Fonts ────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variables ───────────────────────────────────────────────────────────── */
:root {
    --primary:        #0D9488;
    --primary-dark:   #0F766E;
    --primary-light:  #2DD4BF;
    --primary-bg:     #F0FDFA;
    --primary-soft:   rgba(13, 148, 136, 0.10);
    --white:          #FFFFFF;
    --bg:             #F5F8F8;
    --bg-alt:         #EBF0F0;
    --card-bg:        #FFFFFF;
    --text:           #0D2222;
    --text-muted:     #5C7A78;
    --text-light:     #8FAAA8;
    --border:         #DDE8E7;
    --border-dark:    #BDD0CE;
    --shadow-sm:      0 2px 8px rgba(13, 30, 28, 0.06);
    --shadow:         0 4px 20px rgba(13, 30, 28, 0.08);
    --shadow-lg:      0 8px 32px rgba(13, 30, 28, 0.12);
    --shadow-hover:   0 12px 40px rgba(13, 30, 28, 0.16);
    --radius-sm:      8px;
    --radius:         14px;
    --radius-lg:      20px;
    --radius-xl:      28px;
    --transition:     0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --navbar-h:       68px;
    --sidebar-w:      260px;
}

/* ── Dark Theme ──────────────────────────────────────────────────────────────── */
[data-theme="dark"] {
    --primary:        #2DD4BF;
    --primary-dark:   #0D9488;
    --primary-light:  #5EEAD4;
    --primary-bg:     rgba(13, 148, 136, 0.15);
    --primary-soft:   rgba(13, 148, 136, 0.12);
    --white:          #1C2D2B;
    --bg:             #0F1A19;
    --bg-alt:         #172423;
    --card-bg:        #1C2D2B;
    --text:           #E4F0EE;
    --text-muted:     #7DA5A2;
    --text-light:     #4D7470;
    --border:         #243433;
    --border-dark:    #2E4341;
    --shadow-sm:      0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow:         0 4px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg:      0 8px 32px rgba(0, 0, 0, 0.45);
    --shadow-hover:   0 12px 40px rgba(0, 0, 0, 0.55);
}

/* ── Reset & Base ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; display: block; }

/* ── Scrollbar ───────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-light); }

/* ── Navbar ──────────────────────────────────────────────────────────────────── */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--navbar-h);
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.navbar-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 40px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 24px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
    flex-shrink: 0;
    text-decoration: none;
}
.navbar-brand em { color: var(--primary); font-style: normal; }

.navbar-search {
    flex: 1;
    max-width: 440px;
    position: relative;
}

.navbar-search input {
    width: 100%;
    height: 42px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 100px;
    padding: 0 18px 0 44px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.navbar-search input:focus {
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.navbar-search input::placeholder { color: var(--text-light); }

.navbar-search .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1;
    text-decoration: none;
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
    box-shadow: 0 4px 16px rgba(108, 99, 255, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--primary-bg);
    color: var(--primary);
}
.btn-secondary:hover {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-outline:hover {
    background: var(--primary);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1.5px solid var(--border);
}
.btn-ghost:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}

.btn-danger {
    background: #FEE2E2;
    color: #DC2626;
}
.btn-danger:hover {
    background: #DC2626;
    color: #fff;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 7px;
}

.btn-lg {
    padding: 13px 28px;
    font-size: 15px;
    border-radius: 12px;
}

.btn-icon {
    padding: 8px;
    border-radius: 8px;
    background: var(--primary-bg);
    color: var(--primary);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    transition: all var(--transition);
}
.btn-icon:hover { background: var(--primary); color: #fff; }
.btn-icon svg { width: 16px; height: 16px; }

/* ── Layout ──────────────────────────────────────────────────────────────────── */
.page-layout {
    display: flex;
    min-height: calc(100vh - var(--navbar-h));
}

.page-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--white);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    position: sticky;
    top: var(--navbar-h);
    height: calc(100vh - var(--navbar-h));
    overflow-y: auto;
}

.sidebar-section { margin-bottom: 28px; }

.sidebar-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    padding: 0 8px;
    margin-bottom: 10px;
}

.sidebar-tags {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-tag {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.sidebar-tag:hover, .sidebar-tag.active {
    background: var(--primary-bg);
    color: var(--primary);
}

.sidebar-tag .tag-count {
    font-size: 12px;
    font-weight: 600;
    background: var(--bg);
    color: var(--text-muted);
    padding: 2px 7px;
    border-radius: 20px;
}

.sidebar-tag.active .tag-count {
    background: var(--primary-soft);
    color: var(--primary);
}

/* ── Main Content ────────────────────────────────────────────────────────────── */
.main-content {
    padding: 32px 40px;
}

/* ── Page Header Bar ─────────────────────────────────────────────────────────── */
.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.content-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.content-meta {
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Hero ───────────────────────────────────────────────────────────────────── */
.hero {
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 40px 0 28px;
}

.hero-brand {
    display: flex;
    align-items: center;
    font-size: 48px;
    font-weight: 800;
    font-family: 'Fraunces', Georgia, serif;
    color: var(--text);
    letter-spacing: -1px;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}
.hero-brand em { color: var(--primary); font-style: normal; }
.hero-brand:hover { color: var(--text); }

.hero-divider {
    width: 1px;
    background: var(--border-dark);
    flex-shrink: 0;
}

.hero-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-title {
    font-size: 17px;
    font-weight: 600;
    font-family: 'Fraunces', Georgia, serif;
    color: var(--text);
    margin-bottom: 3px;
    letter-spacing: -0.2px;
}

.hero-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.hero-desc strong { color: var(--text); font-weight: 600; }
.hero-desc code {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    background: var(--primary-bg);
    color: var(--primary);
    padding: 1px 5px;
    border-radius: 4px;
}
.hero-desc a { color: var(--primary); }

.hero-stats {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-light);
}
.hero-stat-divider { color: var(--border-dark); }

/* ── User Widget ─────────────────────────────────────────────────────────────── */
.user-widget {
    margin-left: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}
.user-widget-inner {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Login button */
.user-widget-guest {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}
.user-widget-pitch {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
    white-space: nowrap;
}
.user-widget-login {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #5865F2;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 100px;
    text-decoration: none;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
}
.user-widget-login:hover { background: #4752C4; color: #fff; transform: translateY(-1px); }

/* Logged-in state */
.user-widget-avatar img,
.user-widget-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-dark);
}
.user-widget-avatar-placeholder {
    background: var(--primary);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.user-widget-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.user-widget-logout {
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
    padding: 4px 10px;
    border: 1px solid var(--border-dark);
    border-radius: 100px;
    transition: all 0.15s;
}
.user-widget-logout:hover { border-color: var(--primary); color: var(--primary); }

/* ── Tag Filter Bar ──────────────────────────────────────────────────────────── */
.tag-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 18px;
    margin-bottom: 28px;
}

.tag-box-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.tag-search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 6px 14px;
    flex-shrink: 0;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.tag-search-form:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
    background: var(--white);
}
.tag-search-form svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    color: var(--text-light);
}
.tag-search-form input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    color: var(--text);
    width: 160px;
    font-family: inherit;
}
.tag-search-form input::placeholder { color: var(--text-muted); }

/* Accordion */
.tag-accordion {
    display: flex;
    flex-direction: column;
}

.tag-accordion-letters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.tag-accordion-divider {
    width: 1px;
    height: 16px;
    background: var(--border-dark);
    margin: 0 4px;
    flex-shrink: 0;
}

.tag-letter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 9px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    line-height: 1;
    text-decoration: none;
    font-family: inherit;
}
.tag-letter-btn:hover {
    color: var(--primary);
    background: var(--primary-bg);
}
.tag-letter-btn.open {
    color: var(--primary);
    background: var(--primary-bg);
    font-weight: 700;
}

.tag-browse-all {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-light);
    text-decoration: none;
    white-space: nowrap;
    padding: 4px 6px;
    margin-left: 2px;
    font-family: inherit;
}
.tag-browse-all:hover { color: var(--primary); }

.tag-accordion-panel {
    display: none;
}
.tag-accordion-panel.open {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px 2px 2px;
}





/* ── Tags Page ───────────────────────────────────────────────────────────────── */
.tags-page-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 32px;
}

.tags-letter-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-bg);
    text-decoration: none;
    transition: all var(--transition);
}
.tags-letter-link:hover {
    background: var(--primary);
    color: #fff;
}

.tags-page-body {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.tags-letter-section { scroll-margin-top: 80px; }

.tags-letter-heading {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin: 0 0 10px;
}

.tags-letter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-full {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    transition: all var(--transition);
}
.tag-full:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.tag-full-count {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--primary-bg);
    border-radius: 100px;
    padding: 1px 7px;
}



/* ── Tag Chips ───────────────────────────────────────────────────────────────── */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    transition: all var(--transition);
    border: 1.5px solid transparent;
}

.tag:hover {
    background: var(--primary);
    color: #fff;
}

.tag.active {
    background: var(--primary);
    color: #fff;
}

.tag-sm {
    padding: 3px 9px;
    font-size: 11px;
}

/* ── Sort Bar ────────────────────────────────────────────────────────────────── */
.sort-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
}
.sort-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 2px;
}
.sort-btn {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    padding: 4px 12px;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: var(--white);
    transition: all 0.15s;
}
.sort-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.sort-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.sort-filter-badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
    padding: 4px 10px;
    border-radius: 100px;
}
.sort-filter-badge a {
    color: inherit;
    text-decoration: none;
    font-size: 14px;
    line-height: 1;
    opacity: 0.7;
}
.sort-filter-badge a:hover { opacity: 1; }
.sort-filter-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 2px;
}
.sort-divider {
    width: 1px;
    height: 16px;
    background: var(--border);
    margin: 0 4px;
    flex-shrink: 0;
}

/* ── Card Grid ───────────────────────────────────────────────────────────────── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

/* ── Related Styles section ─────────────────────────────────────────────────── */
.related-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}
.related-heading {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 20px;
    color: var(--text);
}

/* ── Keyboard shortcut hints ─────────────────────────────────────────────────── */
.kbd-hints {
    font-size: 12px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 5px;
    background: var(--white);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    font-family: inherit;
    line-height: 1;
}
@media (max-width: 680px) {
    .kbd-hints { display: none; }
}

/* ── Sref Card ───────────────────────────────────────────────────────────────── */
.sref-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    color: inherit;
}

.sref-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
    border-color: var(--primary-light);
    color: inherit;
}

/* Image grid — now an <a> link */
.sref-card-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    aspect-ratio: 1 / 1;
    background: var(--bg);
    overflow: hidden;
    position: relative;
    text-decoration: none;
    cursor: pointer;
}

/* Favourite button */
.fav-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,0.85);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 2;
    transition: background var(--transition), transform var(--transition);
    backdrop-filter: blur(4px);
}
.fav-btn svg {
    width: 15px;
    height: 15px;
    stroke: var(--text-muted);
    fill: none;
    transition: stroke var(--transition), fill var(--transition);
}
.fav-btn:hover { background: #fff; transform: scale(1.15); }
.fav-btn:hover svg { stroke: #e53e3e; }
.fav-btn.fav-active svg { stroke: #e53e3e; fill: #e53e3e; }

.favs-empty {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

.sref-card-images.images-1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.sref-card-images.images-2 { grid-template-rows: 1fr; }
.sref-card-images.images-3 .img-item:first-child { grid-row: 1 / 3; }

.img-item {
    overflow: hidden;
    position: relative;
}

.img-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.sref-card:hover .img-item img { transform: scale(1.06); }

.img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-bg) 0%, var(--bg-alt) 100%);
    color: var(--primary-light);
}

.img-placeholder svg { width: 48px; height: 48px; opacity: 0.4; }

/* Card body */
.sref-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.sref-code-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-bg);
    color: var(--primary);
    font-family: 'Courier New', monospace;
    font-size: 13px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    width: fit-content;
}

/* Copy button variant of the badge */
.sref-copy-btn {
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
    font-family: 'Courier New', monospace;
}
.sref-copy-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.sref-copy-btn .copy-icon {
    opacity: 0.5;
    margin-left: 2px;
}
.sref-copy-btn:hover .copy-icon {
    opacity: 1;
}

.sref-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
}

.sref-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

/* ── Empty State ─────────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 80px 32px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    color: var(--border-dark);
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.empty-state p { font-size: 15px; margin-bottom: 24px; }

/* ── Batch Upload ────────────────────────────────────────────────────────────── */
.batch-drop-zone {
    border: 2px dashed var(--border-dark);
    border-radius: var(--radius-lg);
    padding: 56px 32px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--white);
    color: var(--text-muted);
}
.batch-drop-zone:hover, .batch-drop-zone.drag-over {
    border-color: var(--primary);
    background: var(--primary-bg);
    color: var(--primary);
}
.batch-drop-zone svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.5; }
.batch-drop-label { font-size: 16px; font-weight: 600; margin: 0 0 6px; color: var(--text); }
.batch-drop-hint  { font-size: 13px; margin: 0; }
.batch-browse-link { color: var(--primary); cursor: pointer; text-decoration: underline; }

.batch-queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 24px 0 12px;
    font-weight: 600;
    color: var(--text);
}
.batch-progress-bar-wrap {
    height: 6px;
    background: var(--border);
    border-radius: 99px;
    margin-bottom: 16px;
    overflow: hidden;
}
.batch-progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 99px;
    transition: width 0.3s ease;
    width: 0%;
}
.batch-list { display: flex; flex-direction: column; gap: 8px; }

.batch-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    transition: border-color var(--transition);
}
.batch-item.batch-done      { border-color: #22c55e; }
.batch-item.batch-error     { border-color: #ef4444; }
.batch-item.batch-duplicate { border-color: #f59e0b; }
.batch-item.batch-analysing,
.batch-item.batch-saving,
.batch-item.batch-resizing  { border-color: var(--primary); }

.batch-item-thumb canvas {
    width: 60px; height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    display: block;
    background: var(--bg);
}
.batch-item-info { flex: 1; min-width: 0; }
.batch-item-code { font-family: 'Courier New', monospace; font-weight: 700; font-size: 13px; color: var(--primary); }
.batch-item-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.batch-badge {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    padding: 3px 9px; border-radius: 99px; white-space: nowrap;
}
.badge-pending   { background: var(--bg); color: var(--text-muted); }
.badge-resizing,
.badge-analysing,
.badge-saving    { background: var(--primary-bg); color: var(--primary); }
.badge-done      { background: #dcfce7; color: #16a34a; }
.badge-error     { background: #fee2e2; color: #dc2626; }
.badge-duplicate { background: #fef3c7; color: #d97706; }
.badge-title-warn { background: #fef3c7; color: #d97706; }
.batch-item.batch-title-warn { border-color: #f59e0b; }

/* ── Pagination ──────────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    border: 1.5px solid var(--border);
    background: var(--white);
    text-decoration: none;
    transition: all var(--transition);
    padding: 0 8px;
}

.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }
.page-btn.disabled { opacity: 0.4; pointer-events: none; }

/* ── View Page (Single Sref) ─────────────────────────────────────────────────── */
.sref-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}
.sref-nav-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.sref-nav-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}
.sref-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    padding: 5px 14px;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: #fff;
    transition: all 0.15s;
}
.sref-nav-btn svg { width: 16px; height: 16px; }
.sref-nav-btn:hover { border-color: var(--primary); color: var(--primary); }
.sref-nav-btn.disabled { opacity: 0.35; pointer-events: none; }
.sref-nav-home {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    padding: 5px 14px;
}
.sref-nav-home:hover { color: var(--primary); }
.view-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.view-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.view-images.images-1 { grid-template-columns: 1fr; }

.view-img-item {
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg);
    aspect-ratio: 1 / 1;
}

.view-img-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    cursor: zoom-in;
}

.view-img-item img:hover { transform: scale(1.03); }

.view-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.view-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.view-code-display {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--primary-bg);
    border: 2px solid var(--border-dark);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 4px;
}

.view-code-display code {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 17px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.5px;
}

.view-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.3;
}

.view-description {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.7;
}

.view-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    margin-bottom: 10px;
}

.view-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

/* ── Breadcrumb ──────────────────────────────────────────────────────────────── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.breadcrumb a { color: var(--primary); font-weight: 500; }
.breadcrumb svg { width: 14px; height: 14px; }

/* ── Flash Message ───────────────────────────────────────────────────────────── */
.flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.flash-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.flash-error   { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.flash-info    { background: var(--primary-bg); color: var(--primary-dark); border: 1px solid var(--border-dark); }
.flash svg     { width: 18px; height: 18px; flex-shrink: 0; }

/* ── Forms ───────────────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 7px;
}

.form-label span { color: #DC2626; margin-left: 2px; }

.form-control {
    width: 100%;
    height: 44px;
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

textarea.form-control {
    height: auto;
    padding: 12px 14px;
    resize: vertical;
    min-height: 100px;
}

.form-control::placeholder { color: var(--text-light); }

.form-hint {
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-light);
}

/* ── Image Upload Grid ───────────────────────────────────────────────────────── */
.upload-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.upload-slot {
    aspect-ratio: 1;
    border-radius: var(--radius);
    border: 2px dashed var(--border-dark);
    overflow: hidden;
    position: relative;
    background: var(--bg);
    cursor: pointer;
    transition: all var(--transition);
}

.upload-slot:hover { border-color: var(--primary); background: var(--primary-bg); }

.upload-slot.has-image { border-style: solid; border-color: var(--border); }

.upload-slot input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.upload-slot-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-light);
    pointer-events: none;
    font-size: 12px;
    text-align: center;
    padding: 8px;
}

.upload-slot-inner svg { width: 28px; height: 28px; }

.upload-preview {
    position: absolute;
    inset: 0;
    object-fit: cover;
    width: 100%;
    height: 100%;
}

.upload-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    background: rgba(220, 38, 38, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    z-index: 10;
    transition: background var(--transition);
}

.upload-remove:hover { background: #DC2626; }

/* ── Tags Input ──────────────────────────────────────────────────────────────── */
.tags-input-wrap {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--white);
    padding: 8px;
    min-height: 44px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: flex-start;
    transition: border-color var(--transition), box-shadow var(--transition);
    cursor: text;
}

.tags-input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--primary-bg);
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    padding: 3px 8px 3px 10px;
    border-radius: 100px;
}

.tag-chip button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary);
    display: flex;
    align-items: center;
    padding: 0;
    font-size: 15px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity var(--transition);
}

.tag-chip button:hover { opacity: 1; }

#tag-text-input {
    border: none;
    outline: none;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    flex: 1;
    min-width: 120px;
    background: none;
    padding: 2px 4px;
}

.tag-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 50;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.tag-suggestions.show { display: block; }

.tag-suggestion-item {
    padding: 9px 14px;
    font-size: 14px;
    cursor: pointer;
    transition: background var(--transition);
}

.tag-suggestion-item:hover { background: var(--primary-bg); color: var(--primary); }

.tag-create-hint {
    padding: 9px 14px;
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* ── Admin Layout ────────────────────────────────────────────────────────────── */
.admin-layout {
    display: flex;
    min-height: calc(100vh - var(--navbar-h));
}

.admin-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--white);
    border-right: 1px solid var(--border);
    padding: 24px 12px;
    position: sticky;
    top: var(--navbar-h);
    height: calc(100vh - var(--navbar-h));
    overflow-y: auto;
}

.admin-nav-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-light);
    padding: 0 10px;
    margin: 20px 0 8px;
}

.admin-nav-label:first-child { margin-top: 0; }

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition);
    cursor: pointer;
}

.admin-nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.admin-nav-item:hover, .admin-nav-item.active {
    background: var(--primary-bg);
    color: var(--primary);
}

.admin-main {
    flex: 1;
    padding: 32px;
    min-width: 0;
}

/* ── Admin Table ─────────────────────────────────────────────────────────────── */
.data-table-wrap {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.data-table-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 12px 20px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-light);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td { background: var(--primary-bg); }

.data-table .actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.table-thumb {
    display: flex;
    gap: 3px;
}

.table-thumb img {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.table-thumb .thumb-more {
    width: 36px;
    height: 36px;
    background: var(--primary-bg);
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Admin Form Card ─────────────────────────────────────────────────────────── */
.form-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 28px;
    max-width: 760px;
}

.form-card-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ── Stats Cards ─────────────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.stat-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--primary-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.stat-card-icon svg { width: 22px; height: 22px; }

.stat-card-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card-label {
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Login Page ──────────────────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-bg) 0%, #E0DFFF 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -1px;
}

.login-logo p {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.login-card h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
    text-align: center;
}

/* ── Footer ──────────────────────────────────────────────────────────────────── */
.site-footer {
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 20px 32px;
    text-align: center;
    font-size: 13px;
    color: var(--text-light);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.site-footer a { color: var(--primary); }
.footer-stats {
    width: 100%;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin: 0 0 4px;
}

/* Theme toggle */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: none;
    border: 1px solid var(--border-dark);
    color: var(--text-muted);
    font-size: 12px;
    font-family: inherit;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 100px;
    cursor: pointer;
    transition: all var(--transition);
}
.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.theme-toggle svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ── Privacy page ────────────────────────────────────────────────────────────── */
.privacy-page { padding: 40px 32px 80px; }
.privacy-container {
    max-width: 720px;
    margin: 0 auto;
}
.privacy-container h1 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}
.privacy-updated {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 32px;
}
.privacy-container h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin: 32px 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.privacy-container h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin: 20px 0 6px;
}
.privacy-container p, .privacy-container li {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-muted);
}
.privacy-container ul { padding-left: 20px; margin: 8px 0; }
.privacy-container li { margin-bottom: 4px; }
.privacy-container a { color: var(--primary); }
.privacy-container code {
    font-size: 12px;
    background: var(--bg-alt);
    padding: 1px 5px;
    border-radius: 4px;
    color: var(--text);
}

/* ── Cookie Notice ───────────────────────────────────────────────────────────── */
.cookie-notice {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    background: var(--card-bg);
    border: 1px solid var(--border-dark);
    border-radius: 14px;
    box-shadow: var(--shadow-hover);
    padding: 14px 18px;
    display: none;
    align-items: center;
    gap: 16px;
    max-width: 600px;
    width: calc(100vw - 40px);
    font-size: 13px;
}
.cookie-notice p { margin: 0; color: var(--text-muted); line-height: 1.5; }
.cookie-notice a { color: var(--primary); }
.cookie-notice code {
    font-size: 11px;
    background: var(--bg-alt);
    padding: 1px 4px;
    border-radius: 3px;
}
.cookie-notice-btn {
    flex-shrink: 0;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 100px;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.cookie-notice-btn:hover { background: var(--primary-dark); }

/* ── Lightbox ────────────────────────────────────────────────────────────────── */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 30, 0.92);
    z-index: 999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.lightbox.open { display: flex; }

.lightbox-inner {
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
}

.lightbox-inner img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: var(--radius);
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 32px;
    height: 32px;
    background: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text);
    line-height: 1;
    box-shadow: var(--shadow);
    transition: all var(--transition);
}

.lightbox-close:hover { background: var(--primary); color: white; }

/* ── Notification Toast ──────────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--text);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast svg  { width: 16px; height: 16px; }

/* ── Utilities ───────────────────────────────────────────────────────────────── */
.text-primary { color: var(--primary); }
.text-muted   { color: var(--text-muted); }
.fw-bold      { font-weight: 700; }
.mt-0  { margin-top: 0; }
.mb-0  { margin-bottom: 0; }
.gap-8 { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .view-layout { grid-template-columns: 1fr; }
    .view-sidebar { max-width: 600px; }
}

@media (max-width: 900px) {
    .sidebar { display: none; }
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
    .upload-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 680px) {
    :root { --navbar-h: 58px; }
    .main-content { padding: 16px; }
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
    .admin-sidebar { display: none; }
    .admin-main { padding: 16px; }
    .form-row { grid-template-columns: 1fr; }
    .navbar-search { display: none; }
    .login-card { padding: 28px 20px; }

    /* ── Hero ── */
    .hero {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 24px 0 20px;
    }
    .hero-brand { font-size: 36px; }
    .hero-divider { display: none; }
    .hero-text { width: 100%; }
    .hero-title { font-size: 15px; }
    .user-widget { margin-left: 0; width: 100%; justify-content: flex-start; }
    .user-widget-pitch { display: none; }

    /* ── Tag box ── */
    .tag-box { padding: 12px 14px; }
    .tag-box-header { flex-direction: column; align-items: stretch; gap: 10px; }
    .tag-search-form { width: 100%; box-sizing: border-box; }
    .tag-search-form input { width: 100%; }
    .tag-accordion-letters { gap: 3px; }
    .tag-letter-btn { min-width: 26px; height: 26px; padding: 0 7px; font-size: 11px; }

    /* ── Sort bar ── */
    .sort-bar {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        gap: 5px;
        margin-left: -16px;
        margin-right: -16px;
        padding-left: 16px;
        padding-right: 16px;
    }
    .sort-bar::-webkit-scrollbar { height: 0; }
    .sort-btn { white-space: nowrap; flex-shrink: 0; padding: 4px 10px; font-size: 11px; }
    .sort-label { white-space: nowrap; flex-shrink: 0; }
    .sort-filter-badge { flex-shrink: 0; }
}
