/* ═══════════════════════════════════════════════════════════
   NOK Media Library v2.0 — Stylesheet
   Industrial-utility aesthetic. Every element earns its space.
   ═══════════════════════════════════════════════════════════ */

/* ── Design Tokens ────────────────────────────────────────── */
:root {
    /* Brand */
    --nok-navy: #12457C;
    --nok-navy-light: #1a5699;
    --nok-blue: #0FACE4;
    --nok-blue-muted: rgba(15, 172, 228, 0.12);
    --nok-yellow: #FEC423;
    --nok-yellow-muted: rgba(254, 196, 35, 0.15);

    /* Surfaces */
    --nok-bg: #F3F4F6;
    --nok-surface: #FFFFFF;
    --nok-surface-raised: #FFFFFF;
    --nok-surface-hover: #F9FAFB;
    --nok-surface-active: #F0F4FF;

    /* Borders */
    --nok-border: #E5E7EB;
    --nok-border-hover: #D1D5DB;
    --nok-border-active: var(--nok-navy);

    /* Text */
    --nok-text: #111827;
    --nok-text-secondary: #6B7280;
    --nok-text-muted: #9CA3AF;
    --nok-text-inverse: #FFFFFF;

    /* Feedback */
    --nok-success: #059669;
    --nok-error: #DC2626;

    /* Shadows */
    --nok-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --nok-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --nok-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
    --nok-shadow-border: 0 0 0 1px var(--nok-border);

    /* Layout */
    --topbar-h: 52px;
    --section-header-h: 42px;
    --sidebar-w: 220px;
    --detail-w: 50vw;
    --bulk-h: 56px;

    /* Typography — Realist uses per-weight family names from RealistFull.css */
    --font-display: 'realistmedium', 'Lato', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display-bold: 'realistbold', 'Lato', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Lato', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;

    /* Motion */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --dur-fast: 120ms;
    --dur-normal: 200ms;
    --dur-slow: 350ms;

    /* Checkered background for transparency */
    --checker: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Crect width='8' height='8' fill='%23f0f0f0'/%3E%3Crect x='8' y='8' width='8' height='8' fill='%23f0f0f0'/%3E%3Crect x='8' width='8' height='8' fill='%23fafafa'/%3E%3Crect y='8' width='8' height='8' fill='%23fafafa'/%3E%3C/svg%3E");
}

/* ── Dark Mode Tokens ─────────────────────────────────────── */
[data-bs-theme="dark"] {
    --nok-bg: #0C0D10;
    --nok-surface: #16181D;
    --nok-surface-raised: #1E2028;
    --nok-surface-hover: #1E2028;
    --nok-surface-active: #1A2340;
    --nok-border: #2A2D35;
    --nok-border-hover: #3A3D45;
    --nok-border-active: var(--nok-blue);
    --nok-text: #E5E7EB;
    --nok-text-secondary: #9CA3AF;
    --nok-text-muted: #6B7280;
    --nok-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --nok-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --nok-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    --nok-shadow-border: 0 0 0 1px var(--nok-border);
    --checker: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Crect width='8' height='8' fill='%23222'/%3E%3Crect x='8' y='8' width='8' height='8' fill='%23222'/%3E%3Crect x='8' width='8' height='8' fill='%232a2a2a'/%3E%3Crect y='8' width='8' height='8' fill='%232a2a2a'/%3E%3C/svg%3E");
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--nok-bg);
    color: var(--nok-text);
    line-height: 1.5;
    overflow-x: hidden;
}

::selection {
    background: var(--nok-blue-muted);
    color: var(--nok-text);
}

/* ── Topbar ───────────────────────────────────────────────── */
.nok-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--nok-surface);
    border-bottom: 1px solid var(--nok-border);
    z-index: 100;
    box-shadow: var(--nok-shadow-sm);
}

.nok-topbar-inner {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 16px;
    gap: 16px;
}

.nok-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.nok-topbar-center { flex: 1; max-width: 480px; }
.nok-topbar-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.nok-sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border: none; border-radius: var(--radius-md);
    background: transparent;
    color: var(--nok-text-secondary);
    cursor: pointer;
    font-size: 16px;
    transition: background var(--dur-fast), color var(--dur-fast);
}
.nok-sidebar-toggle:hover { background: var(--nok-surface-hover); color: var(--nok-text); }

.nok-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--nok-text);
}
.nok-logo img { height: 28px; width: auto; }
.nok-logo-text {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.01em;
    color: var(--nok-navy);
    white-space: nowrap;
}
[data-bs-theme="dark"] .nok-logo-text { color: var(--nok-blue); }

.nok-logo-dark { display: none; }
[data-bs-theme="dark"] .nok-logo-light { display: none; }
[data-bs-theme="dark"] .nok-logo-dark { display: block; }

/* ── Search ───────────────────────────────────────────────── */
.nok-search {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}
.nok-search-icon {
    position: absolute;
    left: 12px;
    color: var(--nok-text-muted);
    font-size: 13px;
    pointer-events: none;
}
.nok-search-input {
    width: 100%;
    height: 36px;
    padding: 0 72px 0 34px;
    border: 1px solid var(--nok-border);
    border-radius: var(--radius-md);
    background: var(--nok-bg);
    color: var(--nok-text);
    font-family: var(--font-body);
    font-size: 13px;
    outline: none;
    transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-fast);
}
.nok-search-input::placeholder { color: var(--nok-text-muted); }
.nok-search-input:focus {
    border-color: var(--nok-navy);
    box-shadow: 0 0 0 3px var(--nok-blue-muted);
    background: var(--nok-surface);
}
[data-bs-theme="dark"] .nok-search-input:focus {
    border-color: var(--nok-blue);
}
.nok-search-kbd {
    position: absolute;
    right: 10px;
    padding: 2px 6px;
    border: 1px solid var(--nok-border);
    border-radius: 3px;
    background: var(--nok-surface);
    color: var(--nok-text-muted);
    font-family: var(--font-body);
    font-size: 11px;
    line-height: 1.4;
    pointer-events: none;
    transition: opacity var(--dur-fast);
}
.nok-search-input:focus ~ .nok-search-kbd { opacity: 0; }
.nok-search-count {
    position: absolute;
    right: 10px;
    font-size: 11px;
    color: var(--nok-text-muted);
    display: none;
    pointer-events: none;
}
.nok-search-count.visible { display: block; }
.nok-search-count.visible ~ .nok-search-kbd { display: none; }

/* ── View Toggle ──────────────────────────────────────────── */
.nok-view-toggle {
    display: flex;
    border: 1px solid var(--nok-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.nok-view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 32px;
    border: none;
    background: var(--nok-surface);
    color: var(--nok-text-muted);
    cursor: pointer;
    font-size: 13px;
    transition: background var(--dur-fast), color var(--dur-fast);
}
.nok-view-btn:hover { color: var(--nok-text-secondary); background: var(--nok-surface-hover); }
.nok-view-btn.active { color: var(--nok-navy); background: var(--nok-blue-muted); }
[data-bs-theme="dark"] .nok-view-btn.active { color: var(--nok-blue); }
.nok-view-btn + .nok-view-btn { border-left: 1px solid var(--nok-border); }

/* ── Dark Mode Toggle ─────────────────────────────────────── */
.nok-darkmode-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border: none; border-radius: var(--radius-md);
    background: transparent;
    color: var(--nok-text-muted);
    cursor: pointer;
    font-size: 14px;
    transition: background var(--dur-fast), color var(--dur-fast);
}
.nok-darkmode-btn:hover { background: var(--nok-surface-hover); color: var(--nok-text); }
.nok-darkmode-btn .fa-sun { display: none; }
[data-bs-theme="dark"] .nok-darkmode-btn .fa-moon { display: none; }
[data-bs-theme="dark"] .nok-darkmode-btn .fa-sun { display: inline; }

.nok-topbar-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: var(--radius-md);
    color: var(--nok-text-muted);
    font-size: 13px;
    text-decoration: none;
    transition: background var(--dur-fast), color var(--dur-fast);
}
.nok-topbar-link:hover { background: var(--nok-surface-hover); color: var(--nok-text); }

/* ── Size Slider ──────────────────────────────────────────── */
.nok-size-slider {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 4px;
}
.nok-size-icon-sm, .nok-size-icon-lg {
    color: var(--nok-text-muted);
    font-size: 10px;
    flex-shrink: 0;
}
.nok-size-icon-lg { font-size: 14px; }
.nok-size-slider input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 4px;
    border-radius: 2px;
    background: var(--nok-border);
    outline: none;
    cursor: pointer;
}
.nok-size-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--nok-navy);
    border: 2px solid var(--nok-surface);
    box-shadow: var(--nok-shadow-sm);
    cursor: pointer;
    transition: background var(--dur-fast);
}
.nok-size-slider input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--nok-navy-light);
}
[data-bs-theme="dark"] .nok-size-slider input[type="range"]::-webkit-slider-thumb {
    background: var(--nok-blue);
}
.nok-size-slider input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--nok-navy);
    border: 2px solid var(--nok-surface);
    box-shadow: var(--nok-shadow-sm);
    cursor: pointer;
}
[data-bs-theme="dark"] .nok-size-slider input[type="range"]::-moz-range-thumb {
    background: var(--nok-blue);
}

/* ── Sidebar ──────────────────────────────────────────────── */
.nok-sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--nok-surface);
    border-right: 1px solid var(--nok-border);
    display: flex;
    flex-direction: column;
    z-index: 90;
    overflow: hidden;
    transition: transform var(--dur-slow) var(--ease-out);
}

.nok-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--nok-border) transparent;
}

.nok-sidebar-header {
    padding: 16px 16px 8px;
}
.nok-sidebar-label {
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--nok-text-muted);
}

.nok-sidebar-list {
    list-style: none;
    padding: 0 8px 16px;
}
.nok-sidebar-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    margin: 1px 0;
    border-radius: var(--radius-md);
    color: var(--nok-text-secondary);
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--dur-fast), color var(--dur-fast);
    user-select: none;
}
.nok-sidebar-item:hover {
    background: var(--nok-surface-hover);
    color: var(--nok-text);
}
.nok-sidebar-item.active {
    background: var(--nok-blue-muted);
    color: var(--nok-navy);
    font-weight: 600;
}
[data-bs-theme="dark"] .nok-sidebar-item.active { color: var(--nok-blue); }

.nok-sidebar-count {
    font-size: 11px;
    color: var(--nok-text-muted);
    font-variant-numeric: tabular-nums;
    min-width: 20px;
    text-align: right;
}
.nok-sidebar-item.active .nok-sidebar-count { color: var(--nok-navy); }
[data-bs-theme="dark"] .nok-sidebar-item.active .nok-sidebar-count { color: var(--nok-blue); }

.nok-sidebar-sublist {
    list-style: none;
    padding: 0 0 0 12px;
}
.nok-sidebar-subitem {
    font-size: 12px;
    padding: 5px 10px;
    color: var(--nok-text-muted);
}
.nok-sidebar-subitem:hover { color: var(--nok-text-secondary); }
.nok-sidebar-subitem .nok-sidebar-count { font-size: 10px; }

/* ── Sidebar Section Groups ──────────────────────────────── */
.nok-sidebar-section {
    list-style: none;
    margin-top: 14px;
}
.nok-sidebar-section:first-child {
    margin-top: 0;
}
.nok-sidebar-section-label {
    display: block;
    margin: 4px 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--nok-text-muted);
    border-bottom: 1px solid;
}
.nok-sidebar-section-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nok-sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--nok-border);
}
.nok-sidebar-footer,
.nok-sidebar-footer a {
    font-size: 12px;
    color: var(--nok-text-muted);
}
.nok-sidebar-support {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: color var(--dur-fast);
}
.nok-sidebar-support:hover { color: var(--nok-text); }
.nok-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 85;
}

/* ── Main Content ─────────────────────────────────────────── */
.nok-main {
    margin-top: var(--topbar-h);
    margin-left: var(--sidebar-w);
    min-height: calc(100vh - var(--topbar-h));
}

.nok-main-inner {
    padding: 24px 28px 80px;
    max-width: 1600px;
}

/* ── Section Groups ───────────────────────────────────────── */
.nok-section-group {
    margin-bottom: 8px;
}
.nok-section-group-header {
    padding: 10px 0 0;
}
.nok-section-group-title {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--nok-text-muted);
    margin: 0;
}

/* ── Category Sections ────────────────────────────────────── */
.nok-section,
.nok-subdir {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 8px 0;
}
.nok-subdir {
    border-bottom: 1px dashed var(--nok-border);
}
.nok-section-header {
    position: sticky;
    top: var(--topbar-h);
    height: var(--section-header-h);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--nok-bg);
    cursor: pointer;
    user-select: none;
}
[data-bs-theme="dark"] .nok-section-header { background: var(--nok-bg); }

.nok-section-title {
    font-family: var(--font-display-bold);
    font-size: 18px;
    font-weight: normal;
    color: var(--nok-text);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 10px;
}
.nok-section-badge,
.nok-subdir-badge {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 10px;
    background: var(--nok-blue-muted);
    color: var(--nok-navy);
}
.nok-section-badge {
    background: var(--nok-blue);
    color: white;
}
[data-bs-theme="dark"] .nok-section-badge { color: var(--nok-blue); }


.nok-section-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border: none; border-radius: var(--radius-sm);
    background: transparent;
    color: var(--nok-text-muted);
    cursor: pointer;
    font-size: 12px;
    transition: background var(--dur-fast), color var(--dur-fast), transform var(--dur-normal);
}
.nok-section-toggle:hover { background: var(--nok-surface-hover); color: var(--nok-text); }
.nok-section.collapsed .nok-section-toggle { transform: rotate(-90deg); }

.nok-section-body {
    overflow: clip;
    transition: max-height var(--dur-slow) var(--ease-out), opacity var(--dur-normal);
}
.nok-section.collapsed .nok-section-body {
    max-height: 0 !important;
    opacity: 0;
    visibility: hidden;
    content-visibility: hidden;
}

/* ── Subdir Headers ───────────────────────────────────────── */
/* ── Subdir (collapsible) ──────────────────────────────────── */
.nok-subdir-header {
    color: var(--nok-text);
    font-family: var(--font-display-bold);
    font-weight: normal;
    position: sticky;
    top: calc(var(--topbar-h) + var(--section-header-h));
    height: var(--section-header-h);
    z-index: 19;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    background: var(--nok-bg);
    cursor: pointer;
    user-select: none;
}
.nok-subdir-header:hover { color: var(--nok-text); }

.nok-subdir-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px; height: 24px;
    border: none; border-radius: var(--radius-sm);
    background: transparent;
    color: var(--nok-text-muted);
    cursor: pointer;
    font-size: 11px;
    transition: transform var(--dur-normal), color var(--dur-fast);
}
.nok-subdir-toggle:hover { color: var(--nok-text); }
.nok-subdir.collapsed .nok-subdir-toggle { transform: rotate(-90deg); }

.nok-subdir.collapsed .nok-grid,
.nok-subdir.collapsed .nok-sub-subdir {
    display: none;
}

/* ── Sub-subdir (within subdir) ──────────────────────────── */
.nok-sub-subdir {
    margin-bottom: 4px;
    margin-left: 2.5%;
}

.nok-sub-subdir-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-body);
    font-weight: 600;
    margin: 8px 0;
    cursor: pointer;
    user-select: none;
    border-radius: 3px;
    font-size: 1rem;
}
.nok-sub-subdir.collapsed .nok-sub-subdir-header {
    margin-bottom: 0;
}
.nok-sub-subdir-header:hover { color: var(--nok-text-secondary); }

.nok-ssd-icon-closed { display: none; }
.nok-sub-subdir.collapsed .nok-ssd-icon-open { display: none; }
.nok-sub-subdir.collapsed .nok-ssd-icon-closed { display: inline; }

.nok-sub-subdir-header > span > .fas {
    margin-right: 0.5em;
}
.nok-sub-subdir-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--nok-text-muted);
    cursor: pointer;
    font-size: 10px;
    transition: transform var(--dur-normal), color var(--dur-fast);
}
.nok-sub-subdir-toggle:hover { color: var(--nok-text); }
.nok-sub-subdir.collapsed .nok-sub-subdir-toggle { transform: rotate(-90deg); }

.nok-sub-subdir.collapsed .nok-grid {
    display: none;
}

/* ── Grid View ────────────────────────────────────────────── */
.nok-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-size-local, var(--card-size, 200px)), 1fr));
    gap: 14px;
}

/* ── Asset Card ───────────────────────────────────────────── */
.nok-card {
    position: relative;
    background: var(--nok-surface);
    border: 1px solid var(--nok-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: border-color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast);
    user-select: none;
}
.nok-card:hover {
    border-color: var(--nok-border-hover);
    box-shadow: var(--nok-shadow-md);
    transform: translateY(-1px);
}
.nok-card.selected {
    border-color: var(--nok-navy);
    box-shadow: 0 0 0 2px var(--nok-blue-muted);
    background: var(--nok-blue-muted);
}
[data-bs-theme="dark"] .nok-card.selected { border-color: var(--nok-blue); }
.nok-card.active {
    border-color: var(--nok-navy);
    box-shadow: 0 0 0 2px rgba(18, 69, 124, 0.25);
}
[data-bs-theme="dark"] .nok-card.active { border-color: var(--nok-blue); box-shadow: 0 0 0 2px rgba(15, 172, 228, 0.2); }

/* Card thumbnail */
.nok-card-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 16 / 9;
    padding: .2rem;
    overflow: hidden;
    background: var(--checker);
    border-bottom: 1px solid var(--nok-border);
}
.nok-card-thumb.square { aspect-ratio: 1; }
.nok-card-thumb.video-thumb { background: #111; }

/* File type placeholder (non-displayable formats) */
.nok-card-filetype {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%; height: 100%;
    color: var(--nok-text-muted);
    background: var(--nok-bg);
    margin: -1rem;
    padding: 1rem;
}
.nok-card-filetype i { font-size: 28px; }
.nok-card-filetype span {
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--nok-text-muted);
}
.nok-card-filetype-lg i { font-size: 48px; }
.nok-card-filetype-lg span { font-size: 13px; }

.nok-card-thumb img {
    max-width: 100%;
    width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: filter var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out), opacity var(--dur-normal);
}
.nok-card-thumb img.placeholder {
    filter: blur(8px);
    transform: scale(1.05);
    opacity: 1;
}
.nok-card-thumb img.loading { opacity: 0; }
.nok-card-thumb img.loaded { filter: blur(0); transform: scale(1); opacity: 1; }

/* Card body */
.nok-card-body {
    padding: 10px 12px;
}
.nok-card-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--nok-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    margin-bottom: 4px;
}
.nok-card-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

/* Format badges */
.nok-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 5px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
    border: 1px solid;
}
.nok-badge-png { color: #0284C7; border-color: #BAE6FD; background: #F0F9FF; }
.nok-badge-svg { color: #C2410C; border-color: #FED7AA; background: #FFF7ED; }
.nok-badge-jpg, .nok-badge-jpeg { color: #15803D; border-color: #BBF7D0; background: #F0FDF4; }
.nok-badge-gif { color: #A16207; border-color: #FDE68A; background: #FEFCE8; }
.nok-badge-webp { color: #7C3AED; border-color: #DDD6FE; background: #F5F3FF; }
.nok-badge-ai, .nok-badge-eps { color: #FCD34D; border-color: #5C4A1E; background: #332A0C; }
.nok-badge-pdf { color: #DC2626; border-color: #FECACA; background: #FEF2F2; }
.nok-badge-tif, .nok-badge-tiff { color: #BE185D; border-color: #FBCFE8; background: #FDF2F8; }
.nok-badge-zip { color: #6D28D9; border-color: #DDD6FE; background: #F5F3FF; }
.nok-badge-mp4, .nok-badge-webm, .nok-badge-mov, .nok-badge-avi, .nok-badge-mkv {
    color: #0369A1; border-color: #BAE6FD; background: #F0F9FF;
}

[data-bs-theme="dark"] .nok-badge-png { color: #7DD3FC; border-color: #0C4A6E; background: #0C1D2E; }
[data-bs-theme="dark"] .nok-badge-svg { color: #FDBA74; border-color: #7C2D12; background: #2A1508; }
[data-bs-theme="dark"] .nok-badge-jpg, [data-bs-theme="dark"] .nok-badge-jpeg { color: #86EFAC; border-color: #14532D; background: #052E16; }
[data-bs-theme="dark"] .nok-badge-gif { color: #FDE68A; border-color: #713F12; background: #2A1F06; }
[data-bs-theme="dark"] .nok-badge-webp { color: #C4B5FD; border-color: #5B21B6; background: #1E1040; }
[data-bs-theme="dark"] .nok-badge-pdf { color: #FCA5A5; border-color: #7F1D1D; background: #2A0808; }
[data-bs-theme="dark"] .nok-badge-tif, [data-bs-theme="dark"] .nok-badge-tiff { color: #F9A8D4; border-color: #831843; background: #2A0818; }
[data-bs-theme="dark"] .nok-badge-zip { color: #C4B5FD; border-color: #5B21B6; background: #1E1040; }
[data-bs-theme="dark"] .nok-badge-mp4, [data-bs-theme="dark"] .nok-badge-webm, [data-bs-theme="dark"] .nok-badge-mov { color: #7DD3FC; border-color: #0C4A6E; background: #0C1D2E; }

/* Card hover actions */
.nok-card-actions {
    position: absolute;
    top: 6px; right: 6px;
    z-index: 3;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--dur-fast);
}
.nok-card:hover .nok-card-actions,
.nok-card.selected .nok-card-actions { opacity: 1; }

.nok-card-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border: none; border-radius: var(--radius-sm);
    background: var(--nok-surface);
    color: var(--nok-text-secondary);
    cursor: pointer;
    font-size: 12px;
    box-shadow: var(--nok-shadow-sm), var(--nok-shadow-border);
    transition: background var(--dur-fast), color var(--dur-fast);
}
.nok-card-action:hover { background: var(--nok-navy); color: var(--nok-text-inverse); }
[data-bs-theme="dark"] .nok-card-action:hover { background: var(--nok-blue); color: #000; }

.nok-card-check {
    position: absolute;
    top: 6px; left: 6px;
    z-index: 3;
    width: 22px; height: 22px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--nok-border);
    background: var(--nok-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    cursor: pointer;
    font-size: 11px;
    color: transparent;
    box-shadow: var(--nok-shadow-sm);
    transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.nok-card:hover .nok-card-check { border-color: var(--nok-border-hover); }
.nok-card.selected .nok-card-check {
    opacity: 1;
    background: var(--nok-navy);
    border-color: var(--nok-navy);
    color: #fff;
}
[data-bs-theme="dark"] .nok-card.selected .nok-card-check {
    background: var(--nok-blue);
    border-color: var(--nok-blue);
    color: #000;
}

/* ── List View ────────────────────────────────────────────── */
.nok-list { display: flex; flex-direction: column; gap: 1px; }

.nok-list-row {
    display: grid;
    grid-template-columns: 48px 1fr auto auto auto;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--nok-surface);
    border: 1px solid var(--nok-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color var(--dur-fast), background var(--dur-fast);
    user-select: none;
}
.nok-list-row:hover {
    border-color: var(--nok-border-hover);
    background: var(--nok-surface-hover);
}
.nok-list-row.selected {
    border-color: var(--nok-navy);
    background: var(--nok-surface-active);
}
.nok-list-row.active {
    border-color: var(--nok-navy);
    background: var(--nok-surface-active);
}
[data-bs-theme="dark"] .nok-list-row.selected,
[data-bs-theme="dark"] .nok-list-row.active { border-color: var(--nok-blue); }

.nok-list-thumb {
    width: 48px; height: 36px;
    border-radius: 3px;
    overflow: hidden;
    background: var(--checker);
    flex-shrink: 0;
}
.nok-list-thumb img {
    width: 100%; height: 100%;
    object-fit: contain;
}
.nok-list-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--nok-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nok-list-badges { display: flex; gap: 3px; flex-shrink: 0; }
.nok-list-dims {
    font-size: 11px;
    color: var(--nok-text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    min-width: 80px;
    text-align: right;
}
.nok-list-actions { display: flex; gap: 4px; flex-shrink: 0; }
.nok-list-check {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px; height: 20px;
    border-radius: 3px;
    border: 2px solid var(--nok-border);
    background: var(--nok-surface);
    cursor: pointer;
    font-size: 10px;
    color: transparent;
    transition: all var(--dur-fast);
    flex-shrink: 0;
    margin-right: 4px;
}
.nok-list-row:hover .nok-list-check { border-color: var(--nok-border-hover); }
.nok-list-row.selected .nok-list-check {
    background: var(--nok-navy);
    border-color: var(--nok-navy);
    color: #fff;
}

/* ── Detail Panel ─────────────────────────────────────────── */
.nok-detail {
    position: fixed;
    top: var(--topbar-h);
    right: 0;
    height: calc(100vh - var(--topbar-h));
    height: calc(100dvh - var(--topbar-h));
    width: var(--detail-w);
    background: var(--nok-surface);
    border-left: 1px solid var(--nok-border);
    z-index: 80;
    overflow: hidden;
    transform: translateX(100%);
    transition: transform var(--dur-slow) var(--ease-out);
    box-shadow: var(--nok-shadow-lg);
}
.nok-detail.open { transform: translateX(0); }

.nok-detail-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
    overflow: auto;
}

.nok-detail-close {
    position: absolute;
    top: 12px; right: 12px;
    width: 32px; height: 32px;
    border: none; border-radius: var(--radius-md);
    background: var(--nok-surface);
    color: var(--nok-text-secondary);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    box-shadow: var(--nok-shadow-sm);
    transition: background var(--dur-fast), color var(--dur-fast);
    padding: 1rem;
}
.nok-detail-close:hover { background: var(--nok-surface-hover); color: var(--nok-text); }

.nok-detail-preview {
    position: relative;
    width: 100%;
    min-height: max(80px, 25vw);
    flex: 1 1 auto;
    background: var(--checker);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 16px;
    border-bottom: 1px solid var(--nok-border);
}
.nok-detail-preview img {
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 1;
}
.nok-detail-preview video {
    width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.nok-detail-preview.video-preview {
    background: #000;
}
.nok-detail-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nok-detail-info {
    padding: 16px 20px;
    border-bottom: 1px solid var(--nok-border);
    flex-shrink: 0;
}
.nok-detail-name {
    font-family: var(--font-display-bold);
    font-size: 16px;
    font-weight: normal;
    color: var(--nok-text);
    margin-bottom: 4px;
    word-break: break-word;
}
.nok-detail-meta {
    font-size: 12px;
    color: var(--nok-text-muted);
    display: flex;
    gap: 12px;
    align-items: center;
}

.nok-detail-section {
    padding: 14px 20px;
    border-bottom: 1px solid var(--nok-border);
    flex-shrink: 0;
}
.nok-detail-section:last-child { border-bottom: none; }
.nok-detail-section-title {
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--nok-text-muted);
    margin-bottom: 10px;
}
.nok-detail-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}
.nok-detail-section-header .nok-detail-section-title { margin-bottom: 0; }
.nok-detail-section-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px; height: 24px;
    border: none; border-radius: var(--radius-sm);
    background: transparent;
    color: var(--nok-text-muted);
    cursor: pointer;
    font-size: 11px;
    transition: transform var(--dur-normal), color var(--dur-fast), background var(--dur-fast);
}
.nok-detail-section-toggle:hover { background: var(--nok-surface-hover); color: var(--nok-text); }
.nok-detail-section.collapsed .nok-detail-section-toggle { transform: rotate(-90deg); }
.nok-detail-section-body {
    overflow: hidden;
    transition: max-height var(--dur-slow) var(--ease-out), opacity var(--dur-normal);
}
.nok-detail-section-header + .nok-detail-section-body { margin-top: 10px; }
.nok-detail-section.collapsed .nok-detail-section-body {
    max-height: 0 !important;
    opacity: 0;
    margin-top: 0;
}

/* Format pills in detail */
.nok-detail-formats {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.nok-detail-format-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid var(--nok-border);
    border-radius: var(--radius-md);
    background: var(--nok-surface);
    color: var(--nok-text);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--dur-fast), border-color var(--dur-fast);
}
.nok-detail-format-btn:hover {
    background: var(--nok-surface-hover);
    border-color: var(--nok-border-hover);
}
.nok-detail-format-btn i { font-size: 11px; color: var(--nok-text-muted); }
.nok-detail-format-btn.nok-convert-btn { border-style: dashed; }

/* Vector format indicator */
.nok-vector-icon {
    font-size: 9px !important;
    color: var(--nok-success) !important;
}

/* Download tracks — two visually distinct download paths */
.nok-dl-track {
    padding: 16px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--nok-border);
    margin: 0 14px 10px;
}
.nok-detail-info + .nok-dl-track {
    margin-top: 14px;
}
.nok-dl-track-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
}
.nok-dl-track-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    font-size: 13px;
}
.nok-dl-track--originals .nok-dl-track-icon,
.nok-dl-track--resize .nok-dl-track-icon {
    background: var(--nok-text-muted);
    color: #fff;
}
.nok-dl-track-head-text {
    min-width: 0;
    padding-top: 1px;
}
.nok-dl-track-title {
    font-family: var(--font-display-bold);
    font-size: 13px;
    font-weight: 700;
    color: var(--nok-text);
    line-height: 1.3;
}
.nok-dl-track-desc {
    font-size: 11px;
    color: var(--nok-text-muted);
    line-height: 1.4;
    margin-top: 2px;
}

/* Steps inside a track lose their own borders */
.nok-dl-track .nok-dl-step {
    border: none;
    padding: 0;
    margin-bottom: 14px;
}
.nok-dl-track .nok-dl-step:last-of-type {
    margin-bottom: 0;
}
.nok-dl-track .nok-dl-step-header {
    margin-bottom: 8px;
}
/* Nested sections inside a track: remove redundant padding/borders */
.nok-dl-track .nok-detail-section {
    padding: 0;
    border-bottom: none;
    margin-top: 14px;
}

/* Download form — stepped layout */
.nok-download-form { margin: 0; }
.nok-dl-step {
    padding: 12px 14px;
    border: 1px solid var(--nok-border);
    border-radius: var(--radius-md);
    margin-bottom: 6px;
}
.nok-dl-step-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.nok-dl-step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--nok-navy);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 1;
}
[data-bs-theme="dark"] .nok-dl-step-num {
    background: var(--nok-blue);
}
.nok-dl-step-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--nok-text-secondary);
}
.nok-dl-format-pills {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.nok-dl-format-pill {
    padding: 4px 12px;
    border: 1px solid var(--nok-border);
    border-radius: 100px;
    background: transparent;
    color: var(--nok-text-secondary);
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--dur-fast);
    line-height: 1.4;
}
.nok-dl-format-pill:hover {
    border-color: var(--nok-border-hover);
    background: var(--nok-surface-hover);
    color: var(--nok-text);
}
.nok-dl-format-pill.active {
    background: var(--nok-navy);
    border-color: var(--nok-navy);
    color: #fff;
}
[data-bs-theme="dark"] .nok-dl-format-pill.active {
    background: var(--nok-blue);
    border-color: var(--nok-blue);
}

/* Preset download grid */
.nok-preset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
}
.nok-preset-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border: 1px solid var(--nok-border);
    border-radius: var(--radius-md);
    background: var(--nok-surface);
    color: var(--nok-text);
    font-size: 12px;
    cursor: pointer;
    transition: background var(--dur-fast), border-color var(--dur-fast);
}
.nok-preset-btn:hover {
    background: var(--nok-surface-hover);
    border-color: var(--nok-border-hover);
}
.nok-preset-btn:active {
    background: var(--nok-surface-active);
}
.nok-preset-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}
.nok-preset-label { font-weight: 600; }
.nok-preset-size { color: var(--nok-text-muted); font-variant-numeric: tabular-nums; }
.nok-preset-btn .fa-download {
    font-size: 10px;
    color: var(--nok-text-muted);
    margin-left: 6px;
}

/* Upscale warning on preset buttons */
.nok-preset-btn.nok-preset-upscale {
    border-color: var(--nok-yellow);
    background: var(--nok-yellow-muted);
}
.nok-preset-btn.nok-preset-upscale:hover {
    border-color: #E5A800;
}
.nok-upscale-icon {
    font-size: 9px;
    color: #B45309;
    margin-left: 4px;
    vertical-align: 1px;
}
[data-bs-theme="dark"] .nok-upscale-icon {
    color: var(--nok-yellow);
}

/* Custom size form */
.nok-custom-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.nok-form-row {
    display: flex;
    gap: 10px;
}
.nok-form-row label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    color: var(--nok-text-secondary);
    flex: 1;
}
.nok-form-row input[type="number"],
.nok-form-row select {
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--nok-border);
    border-radius: var(--radius-md);
    background: var(--nok-bg);
    color: var(--nok-text);
    font-family: var(--font-body);
    font-size: 13px;
    outline: none;
    transition: border-color var(--dur-fast);
}
.nok-form-row input[type="number"]:focus,
.nok-form-row select:focus {
    border-color: var(--nok-navy);
    box-shadow: 0 0 0 2px var(--nok-blue-muted);
}
[data-bs-theme="dark"] .nok-form-row input[type="number"]:focus,
[data-bs-theme="dark"] .nok-form-row select:focus {
    border-color: var(--nok-blue);
}

.nok-radio-group {
    display: flex;
    gap: 16px;
}
.nok-radio-group label {
    flex-direction: row;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    cursor: pointer;
}
.nok-radio-group input[type="radio"] {
    accent-color: var(--nok-navy);
}
[data-bs-theme="dark"] .nok-radio-group input[type="radio"] {
    accent-color: var(--nok-blue);
}

/* Detail actions */
.nok-detail-actions {
    display: flex;
    gap: 8px;
}

/* ── Buttons ──────────────────────────────────────────────── */
.nok-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 36px;
    padding: 0 16px;
    border: 1px solid var(--nok-border);
    border-radius: var(--radius-md);
    background: var(--nok-surface);
    color: var(--nok-text);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast);
}
.nok-btn:hover { background: var(--nok-surface-hover); border-color: var(--nok-border-hover); }
.nok-btn:active { background: var(--nok-surface-active); }

.nok-btn-primary {
    background: var(--nok-navy);
    border-color: var(--nok-navy);
    color: #fff;
}
.nok-btn-primary:hover { background: var(--nok-navy-light); border-color: var(--nok-navy-light); }
[data-bs-theme="dark"] .nok-btn-primary {
    background: var(--nok-blue);
    border-color: var(--nok-blue);
    color: #000;
}

.nok-btn-ghost {
    border-color: transparent;
    background: transparent;
}
.nok-btn-ghost:hover { background: var(--nok-surface-hover); border-color: var(--nok-border); }

.nok-btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.nok-btn-full { width: 100%; }

/* ── Bulk Action Bar ──────────────────────────────────────── */
.nok-bulk-bar {
    position: fixed;
    bottom: 0; left: var(--sidebar-w); right: 0;
    height: var(--bulk-h);
    background: var(--nok-surface);
    border-top: 1px solid var(--nok-border);
    z-index: 70;
    transform: translateY(100%);
    transition: transform var(--dur-slow) var(--ease-out);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
}
.nok-bulk-bar.visible { transform: translateY(0); }

.nok-bulk-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 24px;
}
.nok-bulk-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--nok-text);
}
.nok-bulk-actions { display: flex; gap: 8px; }

/* ── Toast ────────────────────────────────────────────────── */
.nok-toast-container {
    position: fixed;
    bottom: 20px; right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.nok-toast {
    padding: 10px 16px;
    border-radius: var(--radius-md);
    background: var(--nok-text);
    color: var(--nok-bg);
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--nok-shadow-lg);
    pointer-events: auto;
    animation: nok-toast-in var(--dur-slow) var(--ease-out);
}
.nok-toast.out { animation: nok-toast-out var(--dur-normal) var(--ease-in-out) forwards; }

@keyframes nok-toast-in {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes nok-toast-out {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-8px) scale(0.96); }
}

/* ── Loader ───────────────────────────────────────────────── */
.nok-loader {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}
.nok-loader.visible { display: flex; }
.nok-loader-content {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 28px;
    border-radius: var(--radius-lg);
    background: var(--nok-surface);
    box-shadow: var(--nok-shadow-lg);
}
.nok-loader-text { font-size: 14px; font-weight: 600; color: var(--nok-text); }

.nok-spinner {
    width: 22px; height: 22px;
    border: 2.5px solid var(--nok-border);
    border-top-color: var(--nok-navy);
    border-radius: 50%;
    animation: nok-spin 0.7s linear infinite;
}
[data-bs-theme="dark"] .nok-spinner { border-top-color: var(--nok-blue); }
@keyframes nok-spin { to { transform: rotate(360deg); } }

/* ── Modal ────────────────────────────────────────────────── */
.nok-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 250;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}
.nok-modal-overlay.visible { display: flex; }
.nok-modal {
    width: 480px;
    max-width: 90vw;
    max-height: 85vh;
    background: var(--nok-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--nok-shadow-lg);
    overflow-y: auto;
}
.nok-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--nok-border);
}
.nok-modal-header h3 {
    font-family: var(--font-display-bold);
    font-size: 16px;
    font-weight: normal;
}
.nok-modal-close {
    width: 32px; height: 32px;
    border: none; border-radius: var(--radius-md);
    background: transparent;
    color: var(--nok-text-secondary);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--dur-fast);
}
.nok-modal-close:hover { background: var(--nok-surface-hover); }
.nok-modal-body { padding: 20px; }
.nok-modal-desc { font-size: 13px; color: var(--nok-text-secondary); margin-bottom: 14px; }
/* Modal body download form spacing */
.nok-modal-body .nok-download-form { margin-top: 4px; }
.nok-modal-body .nok-detail-section { border-left: none; border-right: none; }

/* ── Empty / No Results ───────────────────────────────────── */
.nok-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}
.nok-empty-icon {
    font-size: 32px;
    color: var(--nok-text-muted);
    margin-bottom: 12px;
}
.nok-empty-text {
    font-size: 14px;
    color: var(--nok-text-secondary);
}

/* ── Search Highlight ─────────────────────────────────────── */
mark.nok-highlight {
    background: var(--nok-yellow-muted);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}
[data-bs-theme="dark"] mark.nok-highlight { background: rgba(254, 196, 35, 0.25); }

/* ── Draggable indicator ──────────────────────────────────── */
.nok-card[draggable="true"]:active {
    cursor: grabbing;
    opacity: 0.7;
}

/* ── Keyboard focus ring ──────────────────────────────────── */
.nok-card.kb-focus {
    outline: 2px solid var(--nok-blue);
    outline-offset: 2px;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
    .nok-sidebar {
        transform: translateX(-100%);
    }
    .nok-sidebar.open {
        transform: translateX(0);
        box-shadow: var(--nok-shadow-lg);
    }
    .nok-sidebar-overlay.visible { display: block; }
    .nok-sidebar-toggle { display: flex; }
    .nok-main { margin-left: 0; }
    .nok-bulk-bar { left: 0; }
    .nok-detail { width: 100%; max-width: 400px; }
    .nok-logo-text { display: none; }
}

@media (max-width: 640px) {
    .nok-main-inner { padding: 16px 14px 80px; }
    .nok-grid { grid-template-columns: repeat(auto-fill, minmax(min(var(--card-size-local, var(--card-size, 140px)), 100%), 1fr)); gap: 10px; }
    .nok-size-slider { display: none; }
    .nok-topbar-center { max-width: none; }
    .nok-view-toggle { display: none; }
    .nok-detail { width: 100%; max-width: 100%; }
    .nok-list-dims { display: none; }
    .nok-list-row { grid-template-columns: 40px 1fr auto auto; }
}

/* ── Scrollbar ────────────────────────────────────────────── */
.nok-main::-webkit-scrollbar,
.nok-detail::-webkit-scrollbar,
.nok-sidebar-nav::-webkit-scrollbar { width: 6px; }
.nok-main::-webkit-scrollbar-track,
.nok-detail::-webkit-scrollbar-track,
.nok-sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.nok-main::-webkit-scrollbar-thumb,
.nok-detail::-webkit-scrollbar-thumb,
.nok-sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--nok-border);
    border-radius: 3px;
}
.nok-main:before {
    display: block;
    inset: 0;
    position: fixed;
    background: transparent;
    z-index: 25;
    content: "";
    pointer-events: none;
}
.nok-main.detail-open:before {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    pointer-events: all;
    transition: background var(--dur-slow) var(--ease-out);
}

/* ── Print ────────────────────────────────────────────────── */
@media print {
    .nok-topbar, .nok-sidebar, .nok-detail, .nok-bulk-bar { display: none !important; }
    .nok-main { margin: 0 !important; }
}
