/* MyCollectionView — Professional Stylesheet */

/* ─── Design Tokens ─────────────────────────────────────────────────── */
:root {
    --primary:        #1a73e8;
    --primary-dark:   #1557b0;
    --primary-light:  #e8f0fe;
    --secondary:      #5f6368;
    --success:        #188038;
    --success-light:  #e6f4ea;
    --danger:         #c5221f;
    --danger-light:   #fce8e6;
    --warning:        #b45309;
    --warning-light:  #fef3c7;
    --info:           #0277bd;

    --white:          #ffffff;
    --bg:             #f1f3f4;
    --surface:        #ffffff;
    --border:         #dadce0;
    --border-light:   #e8eaed;

    --text:           #202124;
    --text-secondary: #5f6368;
    --text-muted:     #80868b;

    --shadow-xs:  0 1px 2px rgba(60,64,67,.10);
    --shadow-sm:  0 1px 3px rgba(60,64,67,.12), 0 1px 2px rgba(60,64,67,.08);
    --shadow-md:  0 2px 6px rgba(60,64,67,.15), 0 1px 3px rgba(60,64,67,.10);
    --shadow-lg:  0 4px 16px rgba(60,64,67,.18), 0 2px 6px rgba(60,64,67,.12);
    --shadow-xl:  0 8px 28px rgba(60,64,67,.20), 0 4px 10px rgba(60,64,67,.14);

    --radius-sm:  6px;
    --radius:     10px;
    --radius-lg:  14px;
    --radius-xl:  20px;
    --radius-full: 999px;

    --spacing:    1rem;
    --header-h:   60px;

    --transition: 150ms cubic-bezier(.4,0,.2,1);
    --transition-slow: 250ms cubic-bezier(.4,0,.2,1);
}

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

html { height: 100%; overflow-x: hidden; scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); }

/* ─── Layout ────────────────────────────────────────────────────────── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.25rem;
    width: 100%;
}

.main {
    flex: 1;
    min-height: 0;
    padding: 1.5rem 0 2rem;
    display: flex;
    flex-direction: column;
}

.main .container {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* ─── Header ────────────────────────────────────────────────────────── */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 200;
    height: var(--header-h);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-h);
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    transition: opacity var(--transition);
}
.logo:hover { opacity: .85; }

.nav {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.nav a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.4rem 0.875rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
}
.nav a:hover { background: var(--bg); color: var(--text); }
.nav a.active  { color: var(--primary); background: var(--primary-light); }

.nav a.admin-link {
    background: var(--primary);
    color: var(--white);
    font-weight: 600;
}
.nav a.admin-link:hover { background: var(--primary-dark); color: var(--white); }

.nav-logout-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: inherit;
    font-family: inherit;
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius);
    white-space: nowrap;
}
.nav-logout-btn:hover { background: var(--bg); color: var(--text); }

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}
.mobile-menu-toggle:hover { background: var(--bg); }
.mobile-menu-toggle span {
    width: 22px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    display: block;
    transition: transform var(--transition);
}

/* ─── Buttons ───────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0 1.125rem;
    height: 36px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background var(--transition), box-shadow var(--transition),
                border-color var(--transition), color var(--transition), opacity var(--transition);
    white-space: nowrap;
    user-select: none;
}

.btn:hover { opacity: .92; }
.btn:active { transform: scale(.98); }

.btn-primary  { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-sm); opacity: 1; }

.btn-secondary {
    background: var(--white);
    color: var(--text-secondary);
    border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg); border-color: #bdc1c6; color: var(--text); opacity: 1; }

.btn-outline  { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg); opacity: 1; }
.btn-success  { background: var(--success); color: var(--white); }
.btn-danger   { background: var(--danger);  color: var(--white); }
.btn-warning  { background: var(--warning); color: var(--white); }

.btn-success-light { background: var(--success-light); color: var(--success); border-color: #a8d5b5; }
.btn-success-light:hover { background: #c8e6c9; opacity: 1; }
.btn-danger-light  { background: var(--danger-light);  color: var(--danger);  border-color: #f4b8b5; }
.btn-danger-light:hover  { background: #fad2d0; opacity: 1; }

.btn-sm   { height: 30px; padding: 0 0.875rem; font-size: 0.8125rem; }
.btn-block { width: 100%; border-radius: var(--radius); }

.btn-link {
    background: none;
    color: var(--primary);
    border: none;
    padding: 0;
    height: auto;
    font-weight: 500;
    border-radius: 0;
    text-decoration: none;
}
.btn-link:hover { text-decoration: underline; opacity: 1; }

.btn:disabled, .btn.btn--disabled {
    opacity: .45;
    cursor: not-allowed;
    pointer-events: none;
}

/* Backup-specific button variants — keep layout intact */
.backup-create-actions {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: nowrap;
}
.backup-create-actions .backup-create-form { display: inline-block; margin: 0; }

.btn-backup-create {
    min-width: 12rem;
    width: 12rem;
    height: 36px;
    padding: 0 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
}

.btn-action {
    width: 6.5rem;
    min-width: 6.5rem;
    height: 32px;
    padding: 0 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
}

.backup-table-actions {
    display: flex;
    flex-direction: row;
    gap: 0.375rem;
    align-items: center;
    flex-wrap: nowrap;
}
.backup-table-actions .backup-action-form { display: inline-block; margin: 0; }

@media (max-width: 480px) {
    .backup-create-actions { flex-direction: column; align-items: stretch; }
    .backup-create-actions .btn-backup-create { width: 100%; min-width: 0; }
    .backup-table-actions { flex-wrap: wrap; }
}

/* ─── Action Bar (edit page) ────────────────────────────────────────── */
.form-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    width: 100%;
    box-sizing: border-box;
}
.form-card .form { background: transparent; padding: 0; box-shadow: none; border: none; border-radius: 0; margin: 0; }
.form-card .action-bar { margin-top: 1.5rem; margin-bottom: 0; padding: 0; max-width: none; width: 100%; box-sizing: border-box; min-width: 0; }

.action-bar__row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: var(--spacing); min-width: 0; }
.action-bar__left { display: flex; gap: 0.5rem; align-items: stretch; min-width: 0; }
.action-bar__left .btn { min-height: 36px; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.action-bar__right { display: flex; flex-direction: row; align-items: center; gap: 0.5rem; min-width: 0; }
.action-bar__right .btn { min-height: 36px; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; }
.action-bar__delete-form { margin: 0; }
.action-bar__delete-form .btn { width: auto; }
.action-bar__hint { margin: 0; font-size: 0.75rem; color: var(--text-muted); line-height: 1.3; text-align: right; }
.action-bar__right .icon-lock { flex-shrink: 0; vertical-align: -0.2em; }

@media (max-width: 480px) {
    .action-bar__row { flex-direction: column; align-items: stretch; }
    .action-bar__left { flex-direction: column; }
    .action-bar__left .btn, .action-bar__right .btn { width: 100%; min-width: 0; }
    .action-bar__right { align-items: stretch; }
    .action-bar__delete-form { width: 100%; }
    .action-bar__delete-form .btn { width: 100%; }
    .action-bar__hint { text-align: left; }
}

/* ─── Forms ─────────────────────────────────────────────────────────── */
.form {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.form-group { margin-bottom: 1.25rem; }

.form-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
}
.form-group input[type="checkbox"],
.form-group input[type="radio"] {
    width: auto;
    height: auto;
    padding: 0;
    border: none;
    background: none;
    box-shadow: none;
    cursor: pointer;
    accent-color: var(--primary);
    -webkit-appearance: auto;
    appearance: auto;
}
.form-group input:not([type="checkbox"]):not([type="radio"]):hover,
.form-group select:hover,
.form-group textarea:hover { border-color: #bdc1c6; }

.form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,115,232,.14);
}

.form-group small {
    display: block;
    margin-top: 0.3rem;
    color: var(--text-muted);
    font-size: 0.78125rem;
    line-height: 1.4;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-inline { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

.form-actions { display: flex; gap: 0.5rem; margin-top: 1.5rem; }
.form-actions--footer { padding-top: 1.25rem; border-top: 1px solid var(--border-light); justify-content: flex-end; }

.checkbox-group { display: flex; flex-direction: column; gap: 0.5rem; }
.checkbox-group label { display: flex; align-items: center; gap: 0.5rem; font-weight: normal; }

.checkbox-wrapper { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.checkbox-wrapper label { margin: 0; font-weight: normal; cursor: pointer; user-select: none; }
.checkbox-wrapper input[type="checkbox"] { width: auto; margin: 0; cursor: pointer; flex-shrink: 0; accent-color: var(--primary); }

/* Toggle switch */
.toggle-label { display: inline-flex; align-items: center; gap: 0.75rem; cursor: pointer; font-weight: normal; user-select: none; margin-bottom: 0.25rem; }
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
    position: absolute; inset: 0;
    background: var(--border); border-radius: var(--radius-full);
    cursor: pointer; transition: background var(--transition);
}
.toggle-slider::after {
    content: ''; position: absolute;
    top: 3px; left: 3px;
    width: 16px; height: 16px;
    border-radius: 50%; background: #fff;
    box-shadow: var(--shadow-xs);
    transition: transform var(--transition);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::after { transform: translateX(18px); }
.toggle-switch input:focus-visible + .toggle-slider { outline: 2px solid var(--primary); outline-offset: 2px; }

select[multiple] { min-height: 110px; padding: 0.375rem; }
select[multiple] option { padding: 0.375rem 0.5rem; margin: 1px 0; border-radius: 4px; }
select[multiple] option:checked { background: var(--primary-light); color: var(--primary); }

/* ─── Alerts ────────────────────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-light);
    color: #145523;
    border-color: #a8d5b5;
}
.alert-error {
    background: var(--danger-light);
    color: #7d1a18;
    border-color: #f4b8b5;
}
.alert-warning {
    background: var(--warning-light);
    color: #78350f;
    border-color: #fcd34d;
}

.alert-error ul { margin-left: 1.25rem; }

.alert-with-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.alert-with-actions .btn { flex-shrink: 0; }

/* ─── Cards ─────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    margin-bottom: var(--spacing);
}

/* ─── Page Header ───────────────────────────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header h1 {
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.page-actions { display: flex; gap: 0.5rem; }

/* ─── Stats Grid ────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: var(--surface);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    text-align: left;
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--transition-slow), transform var(--transition-slow);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-card h3 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
    line-height: 1;
}

.stat-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

/* ─── Search Box ────────────────────────────────────────────────────── */
.search-box {
    background: var(--surface);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    margin-bottom: 1.25rem;
}

.search-box form { display: flex; gap: 0.625rem; }

.search-box input[type="search"] {
    flex: 1;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.9375rem;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
    background: var(--bg);
}
.search-box input[type="search"]:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(26,115,232,.12);
}

/* ─── Items Grid ────────────────────────────────────────────────────── */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

@media (min-width: 768px) {
    .items-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

.item-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: transform var(--transition-slow), box-shadow var(--transition-slow), border-color var(--transition-slow);
    position: relative;
    box-shadow: var(--shadow-xs);
}
.item-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(26,115,232,.25);
}

.item-card a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.item-thumb {
    width: 100%;
    height: 148px;
    object-fit: cover;
    background: var(--bg);
    flex-shrink: 0;
}

.item-thumb-placeholder {
    width: 100%;
    height: 148px;
    background: linear-gradient(135deg, #e8f0fe 0%, #d2e3fc 100%);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.item-card-body {
    padding: 0.875rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.item-card h3, .item-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.35;
    margin: 0 0 0.2rem 0;
    color: var(--text);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.item-card-meta, .item-meta {
    font-size: 0.78125rem;
    color: var(--text-muted);
    margin: 0 0 0.5rem 0;
}

.item-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
    margin-top: auto;
    padding-top: 0.5rem;
}

/* ─── Badges ────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    font-size: 0.71875rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    background: var(--bg);
    color: var(--text-secondary);
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.item-card-badges .badge { font-size: 0.6875rem; }

.badge-value    { background: var(--success-light); color: var(--success); }
.badge-quantity { background: #e8eaf6; color: #3949ab; }

.badge-owned   { background: #e6f4ea; color: #137333; }
.badge-wanted  { background: #fef3c7; color: #92400e; }
.badge-sold    { background: var(--danger-light); color: var(--danger); }
.badge-traded  { background: #f3e8ff; color: #6b21a8; }
.badge-lost    { background: #fef2f2; color: #991b1b; }

.badge-category { background: #e8eaf6; color: #3949ab; }
.badge-location { background: #e0f2f1; color: #00695c; }
.badge-tag      { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }

/* ─── Item Detail ───────────────────────────────────────────────────── */
.item-detail {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1rem;
    margin-bottom: 1.25rem;
    align-items: start;
}
.item-detail--full-width { grid-template-columns: 1fr; }

.item-detail-main {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
}
.item-detail-main, .item-actions { grid-row: 1; }

.item-photos { margin-bottom: 1.25rem; }

.item-photo {
    width: 100%;
    max-width: 520px;
    height: auto;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    object-fit: contain;
}
@media (max-width: 768px) { .item-photo { max-width: 100%; } }

.item-info { display: flex; flex-direction: column; gap: 0.875rem; }

.info-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9375rem;
}
.info-row:last-child { border-bottom: none; }
.info-row strong { min-width: 145px; font-weight: 600; color: var(--text-secondary); font-size: 0.8125rem; }

.inline-form { display: inline; }

/* ─── Filters Panel ─────────────────────────────────────────────────── */
.filters-panel {
    background: var(--surface);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    margin-bottom: 1.25rem;
}

.filters-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    align-items: end;
}

.filter-group { margin: 0; }

.filter-group label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 0.3rem;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
}
.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,115,232,.12);
}

/* ─── Tables ────────────────────────────────────────────────────────── */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    font-size: 0.875rem;
}

.table thead { background: var(--bg); }

.table th {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #f8faff; }

/* ─── Admin user list ───────────────────────────────────────────────── */
.admin-user-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.admin-user-row {
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
}
.admin-user-row:last-child { border-bottom: none; }

/* View row */
.admin-user-view {
    display: grid;
    grid-template-columns: 1fr 1.5fr auto auto auto;
    align-items: center;
    gap: 0.75rem 1rem;
    padding: 0.75rem 1rem;
}

.admin-user-name { font-weight: 600; font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-user-email { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-user-date { color: var(--text-muted); font-size: 0.75rem; white-space: nowrap; }

.admin-user-btns {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.admin-user-edit-row .admin-user-btns {
    padding-top: 1.15rem;
    align-self: end;
}

/* Edit form — zelfde rij-layout als view */
.admin-user-edit-form {
    background: var(--bg);
    border-top: 1px solid var(--border-light);
}

.admin-user-edit-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.625rem 1rem;
}

.admin-user-form-fields {
    flex: 1;
    display: grid;
    grid-template-columns: 0.8fr 1.2fr 0.9fr 0.8fr;
    gap: 0.25rem 0.5rem;
    min-width: 0;
}

.admin-user-field label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.admin-user-edit-row .admin-user-btns {
    flex-shrink: 0;
}

.admin-user-form-fields .form-control-sm {
    min-width: 0;
    width: 100%;
}

/* Mobile: stack everything as cards */
@media (max-width: 640px) {
    .admin-user-list {
        border: none;
        box-shadow: none;
        gap: 0.625rem;
    }
    .admin-user-row {
        border: 1px solid var(--border-light);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-sm);
    }
    .admin-user-view {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto auto;
    }
    .admin-user-name  { grid-column: 1; grid-row: 1; }
    .admin-user-email { grid-column: 1; grid-row: 2; }
    .admin-user-date  { display: none; }
    .badge            { grid-column: 2; grid-row: 1; justify-self: end; }
    .admin-user-btns  { grid-column: 1 / -1; grid-row: 3; }
    .admin-user-btns .btn { flex: 1; }
    .admin-user-edit-row { flex-direction: column; align-items: stretch; }
    .admin-user-form-fields { grid-template-columns: 1fr; }
    .admin-user-edit-row .admin-user-btns .btn { flex: 1; }
}

/* ─── Lists ─────────────────────────────────────────────────────────── */
.list-group { display: flex; flex-direction: column; gap: 0.625rem; }

.list-item {
    background: var(--surface);
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.875rem;
    transition: box-shadow var(--transition), border-color var(--transition);
}
.list-item:hover { box-shadow: var(--shadow-sm); border-color: var(--border); }

.location-tree { list-style: none; margin-left: 1.25rem; }
.location-tree li { margin-bottom: 0.75rem; }

/* ─── Pagination ────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.375rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}

.pagination a { color: var(--primary); background: var(--white); border: 1px solid var(--border); }
.pagination a:hover { background: var(--primary-light); border-color: var(--primary); }
.pagination span { background: var(--primary); color: var(--white); border: 1px solid var(--primary); font-weight: 700; }

/* ─── Empty State ───────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3.5rem 2rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}
.empty-state p { color: var(--text-muted); margin-bottom: 1.25rem; font-size: 0.9375rem; }

/* ─── Section ───────────────────────────────────────────────────────── */
.section {
    background: var(--surface);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    margin-bottom: 1.25rem;
}
.section h2 { margin-bottom: 1rem; font-size: 1.125rem; font-weight: 700; color: var(--text); }

/* ─── Auth ──────────────────────────────────────────────────────────── */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 0;
    padding: 2rem 1rem;
    background: var(--bg);
}

.auth-card {
    background: var(--white);
    padding: 2.5rem 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border-light);
}

.auth-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--text);
    letter-spacing: -0.3px;
}

.auth-footer { text-align: center; margin-top: 1.25rem; color: var(--text-muted); font-size: 0.875rem; }
.auth-footer a { color: var(--primary); text-decoration: none; font-weight: 500; }
.auth-footer a:hover { text-decoration: underline; }

/* ─── Error Pages ───────────────────────────────────────────────────── */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    gap: 1rem;
    padding: 2rem;
}
.error-page h1    { font-size: 5rem; color: var(--primary); margin-bottom: 0.5rem; font-weight: 800; line-height: 1; }
.error-subtitle   { font-size: 1.5rem; font-weight: 600; color: var(--text); margin-bottom: 0.75rem; }
.error-description { color: var(--text-muted); max-width: 380px; text-align: center; margin-bottom: 1.5rem; }
.error-actions    { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; margin-top: 0.5rem; }

/* ─── Footer ────────────────────────────────────────────────────────── */
.footer {
    background: var(--white);
    border-top: 1px solid var(--border-light);
    padding: 1rem 0;
    margin-top: auto;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* ─── Mobile FAB ────────────────────────────────────────────────────── */
.mobile-fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.375rem;
    font-weight: 400;
    box-shadow: var(--shadow-xl);
    z-index: 50;
    background: var(--primary);
    color: var(--white);
    border: none;
    text-decoration: none;
}
.mobile-fab:hover { background: var(--primary-dark); color: var(--white); }

.desktop-only { display: inline-flex; }

/* ─── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .nav {
        display: none;
        position: absolute;
        top: var(--header-h);
        left: 0;
        right: 0;
        background: var(--white);
        flex-direction: column;
        padding: 0.75rem;
        box-shadow: var(--shadow-md);
        border-top: 1px solid var(--border-light);
        gap: 0.125rem;
        z-index: 199;
    }
    .nav.active { display: flex; }
    .nav a { padding: 0.625rem 1rem; border-radius: var(--radius); }

    .mobile-menu-toggle { display: flex; }

    .item-detail { grid-template-columns: 1fr; }

    .page-header { flex-direction: column; align-items: stretch; }
    .page-header > div { display: flex; flex-direction: row; width: 100%; gap: 0.5rem; }
    .page-header > div .btn { flex: 1; }

    .page-actions { width: 100%; }
    .page-actions .btn { flex: 1; }

    .mobile-fab { display: flex; }
    .desktop-only { display: none; }

    .filters-form { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }

    .items-grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 0.75rem; }

    .main { padding: 1rem 0 1.5rem; }
}

@media (max-width: 480px) {
    :root { --spacing: 0.75rem; }
    .filters-form { grid-template-columns: 1fr; }
    .items-grid { grid-template-columns: repeat(2, 1fr); gap: 0.625rem; }
    .stats-grid { grid-template-columns: 1fr; }
    .container { padding: 0 0.875rem; }
}

/* ─── Breadcrumbs ───────────────────────────────────────────────────── */
.breadcrumbs { margin-bottom: 1rem; padding: 0.375rem 0; }

.breadcrumbs ol {
    list-style: none;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
}

.breadcrumbs li { display: inline-flex; align-items: center; }
.breadcrumbs li.separator { color: var(--text-muted); margin: 0 0.125rem; font-size: 0.875rem; }

.breadcrumbs a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: color var(--transition);
}
.breadcrumbs a:hover { color: var(--primary-dark); text-decoration: underline; }
.breadcrumbs li.active { color: var(--text-secondary); font-size: 0.8125rem; font-weight: 500; }

/* ─── Utility ───────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted   { color: var(--text-muted); }

.mt-1 { margin-top: var(--spacing); }
.mt-2 { margin-top: calc(var(--spacing) * 2); }
.mb-1 { margin-bottom: var(--spacing); }
.mb-2 { margin-bottom: calc(var(--spacing) * 2); }

/* ─── Sensitive Value Blur ──────────────────────────────────────────── */
.sensitive-value {
    filter: blur(7px);
    cursor: pointer;
    user-select: none;
    transition: filter var(--transition-slow);
    border-radius: 4px;
}
.sensitive-value:hover { filter: blur(4px); }
.sensitive-value.revealed { filter: none; cursor: default; }
.sensitive-value:focus { outline: 2px solid var(--primary); outline-offset: 2px; }

.sensitive-value.guest-blurred {
    filter: blur(7px);
    cursor: not-allowed;
    pointer-events: none;
}
.sensitive-value.guest-blurred:hover { filter: blur(7px); }

/* ─── Photos ────────────────────────────────────────────────────────── */
.photo-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.75rem;
    flex-shrink: 0;
}

.photo-item { display: flex; flex-direction: column; gap: 0.375rem; }

.photo-thumbnail-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 280px;
    border-radius: var(--radius);
    overflow: hidden;
}

.photo-thumbnail-wrapper img {
    width: 100%;
    max-width: 280px;
    max-height: 220px;
    object-fit: contain;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    display: block;
    transition: opacity var(--transition);
}
.photo-thumbnail-wrapper:hover img { opacity: .92; }

.photo-delete-form {
    position: absolute;
    top: 0.375rem;
    right: 0.375rem;
    margin: 0;
    padding: 0;
}

.photo-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    background: rgba(197,34,31,.88);
    color: var(--white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition), opacity var(--transition);
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
    opacity: 0;
    pointer-events: none;
}

.photo-thumbnail-wrapper:hover .photo-delete-btn,
.photo-thumbnail-wrapper:focus-within .photo-delete-btn { opacity: 1; pointer-events: auto; }
.photo-delete-btn:hover { background: var(--danger); transform: scale(1.1); }
.photo-delete-btn:focus { outline: 2px solid var(--primary); outline-offset: 2px; opacity: 1; pointer-events: auto; }
.photo-delete-btn svg { width: 13px; height: 13px; pointer-events: none; }

@media (max-width: 768px) { .photo-delete-btn { opacity: 1; pointer-events: auto; } }
@media (hover: none) { .photo-delete-btn { opacity: 1; pointer-events: auto; } }

.photo-thumbnail-clickable { transition: opacity var(--transition); cursor: zoom-in; }
.photo-thumbnail-clickable:hover { opacity: .85; }

/* ─── Lightbox ──────────────────────────────────────────────────────── */
.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    inset: 0;
    background: rgba(0,0,0,.92);
}
.lightbox-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.lightbox-content {
    display: block;
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    animation: zoomIn .25s ease;
    border-radius: var(--radius);
}
@keyframes zoomIn { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.lightbox-close {
    position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    color: rgba(255,255,255,.85);
    font-size: 2.25rem;
    font-weight: 300;
    cursor: pointer;
    transition: color var(--transition);
    z-index: 10000;
    line-height: 1;
    background: none;
    border: none;
}
.lightbox-close:hover { color: var(--white); }

@media (max-width: 768px) {
    .lightbox-close { top: 1rem; right: 1rem; font-size: 1.75rem; }
    .lightbox-content { max-width: 95%; max-height: 85vh; }
}

/* ─── Audit Log ─────────────────────────────────────────────────────── */
.audit-log { margin-top: 0.75rem; display: flex; flex-direction: column; flex: 0 1 auto; }

.audit-entries { display: flex; flex-direction: column; padding-bottom: 0.25rem; }

.audit-entry {
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.audit-entry:last-child { border-bottom: none; padding-bottom: 0; }
.audit-entry:first-child { padding-top: 0; }

.audit-message { font-size: 0.8125rem; color: var(--text-secondary); line-height: 1.5; word-break: break-word; }
.audit-message strong { font-weight: 600; color: var(--text); }

.audit-meta { font-size: 0.71875rem; color: var(--text-muted); margin-top: 0.2rem; line-height: 1.4; }

/* ─── Item Actions Sidebar ──────────────────────────────────────────── */
.item-actions {
    background: var(--surface);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    align-self: stretch;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - 8rem);
}

.item-actions h3 { margin-bottom: 0.75rem; font-size: 1rem; font-weight: 700; margin-top: 0; flex-shrink: 0; color: var(--text); }
.item-actions h3:first-child { margin-top: 0; }

.item-actions::-webkit-scrollbar { width: 5px; }
.item-actions::-webkit-scrollbar-track { background: var(--bg); border-radius: 3px; }
.item-actions::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.item-actions > .photo-list { flex-shrink: 0; }
.item-actions > .audit-log { flex: 0 1 auto; }

/* ─── View Toggle Button ────────────────────────────────────────────── */
.view-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
    margin-left: auto;
    flex-shrink: 0;
}
.view-toggle-btn:hover { background: var(--bg); color: var(--text); border-color: var(--primary); }
.view-toggle-btn:active { transform: scale(.95); }
.view-toggle-btn svg { width: 17px; height: 17px; display: block; }

/* ─── Items List View ───────────────────────────────────────────────── */
.items-view { margin-bottom: 1.25rem; }
.items-list-view { background: transparent; border-radius: var(--radius-lg); overflow: hidden; }

.items-list-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--white);
    box-shadow: var(--shadow-sm);
}

.items-list-container::-webkit-scrollbar { height: 7px; }
.items-list-container::-webkit-scrollbar-track { background: var(--bg); }
.items-list-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.items-list-container::-webkit-scrollbar-thumb:hover { background: #bdc1c6; }

.items-list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    table-layout: auto;
}
.items-list-table.compact-table { font-size: 0.78125rem; }

.items-list-table thead { background: var(--bg); position: sticky; top: 0; z-index: 10; }

.items-list-table th {
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    user-select: none;
}
.items-list-table.compact-table th { padding: 0.4rem 0.5rem; font-size: 0.625rem; }

.items-list-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    background: var(--white);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8125rem;
}
.items-list-table.compact-table td { padding: 0.375rem 0.5rem; font-size: 0.75rem; border-bottom-color: #f1f3f4; }

.items-list-table tbody tr { transition: background var(--transition); }
.items-list-table tbody tr:nth-child(even) td { background: #fafbfc; }
.items-list-table tbody tr:hover td { background: var(--primary-light) !important; cursor: pointer; }
.items-list-table tbody tr:last-child td { border-bottom: none; }

/* Sortable Headers */
.items-list-table th.sortable { cursor: pointer; position: relative; padding-right: 1.375rem; transition: background var(--transition); }
.items-list-table th.sortable:hover { background: #e8eaed; }
.items-list-table th.sortable:not([data-sort-type]) { cursor: default; padding-right: 0.75rem; }
.items-list-table th.sortable[data-sort="none"][data-sort-type] { padding-right: 0.75rem; }
.items-list-table.compact-table th.sortable { padding-right: 1.125rem; }
.items-list-table.compact-table th.sortable[data-sort="none"][data-sort-type] { padding-right: 0.5rem; }

.sort-indicator {
    position: absolute;
    right: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6875rem;
    color: var(--text-muted);
    opacity: .35;
    transition: opacity var(--transition);
}
.items-list-table.compact-table .sort-indicator { right: 0.3rem; }
.items-list-table th.sortable:hover .sort-indicator { opacity: .65; }
.items-list-table th.sortable[data-sort="asc"]  .sort-indicator::before { content: '↑'; opacity: 1; color: var(--primary); }
.items-list-table th.sortable[data-sort="desc"] .sort-indicator::before { content: '↓'; opacity: 1; color: var(--primary); }
.items-list-table th.sortable[data-sort="none"][data-sort-type] .sort-indicator::before { content: '↕'; opacity: .3; }
.items-list-table th.sortable:not([data-sort-type]) .sort-indicator { display: none; }

/* List View Columns */
.col-thumbnail { width: 44px; min-width: 44px; text-align: left; padding: 0.25rem 0.375rem !important; }
.col-thumbnail .item-list-thumb-slot { margin: 0; padding: 0; }
.col-name { min-width: 120px; max-width: 200px; font-weight: 600; }
.col-quantity { width: 44px; min-width: 44px; text-align: center; }
.col-barcode { min-width: 80px; max-width: 110px; }
.col-collection-number { min-width: 60px; max-width: 90px; }
.col-brand { min-width: 70px; max-width: 110px; }
.col-serie { min-width: 70px; max-width: 110px; }
.col-location { min-width: 90px; max-width: 130px; }
.col-status { width: 72px; min-width: 72px; }
.col-category { min-width: 90px; max-width: 140px; }
.col-tags { min-width: 90px; max-width: 140px; }
.col-purchase-price, .col-estimated-value { width: 80px; min-width: 80px; text-align: right; font-weight: 600; }
.col-purchase-date { width: 82px; min-width: 82px; }

/* List Thumbnail */
.item-list-thumb-slot {
    display: block;
    width: 32px;
    height: 32px;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.item-list-thumb-slot .item-list-thumb {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
    background: var(--bg);
}

.item-list-thumb-slot .item-list-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e8f0fe 0%, #d2e3fc 100%);
    color: var(--primary);
    font-size: 0.6875rem;
    font-weight: 700;
    border-radius: 5px;
}

.item-list-thumb {
    display: block;
    width: 32px; height: 32px;
    min-width: 32px; min-height: 32px;
    object-fit: cover;
    border-radius: 5px;
    background: var(--bg);
}

.item-list-thumb-placeholder {
    width: 32px; height: 32px;
    min-width: 32px; min-height: 32px;
    background: linear-gradient(135deg, #e8f0fe 0%, #d2e3fc 100%);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 700;
    border-radius: 5px;
}

.item-list-name {
    color: var(--text);
    text-decoration: none;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    font-size: 0.8125rem;
    font-weight: 600;
}
.item-list-name:hover { color: var(--primary); text-decoration: underline; }

.badge-tag-more { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }

.items-list-table .badge { padding: 0.15rem 0.5rem; font-size: 0.6875rem; line-height: 1.3; }
.items-list-table.compact-table .badge { padding: 0.1rem 0.35rem; font-size: 0.625rem; }

/* Mobile list layout */
@media (max-width: 768px) {
    .items-list-container { overflow-x: hidden; }

    .items-list-table {
        --thumb-slot: 34px;
        --badge-col: 72px;
        display: block;
    }
    .items-list-table thead { display: none; }
    .items-list-table tbody { display: block; }

    .items-list-table tbody tr {
        display: grid;
        grid-template-columns: var(--thumb-slot) 1fr var(--badge-col);
        grid-template-rows: auto auto;
        gap: 0 0.375rem;
        align-items: center;
        min-height: 2.75rem;
        padding: 0.375rem 0.75rem;
        border: none;
        border-bottom: 1px solid var(--border-light);
        border-radius: 0;
        background: var(--white);
        box-shadow: none;
    }
    .items-list-table tbody tr:last-child { border-bottom: none; }
    .items-list-table tbody tr:hover { background: #f8faff; }

    .items-list-table tbody td.cell-empty,
    .items-list-table tbody td.col-barcode,
    .items-list-table tbody td.col-collection-number,
    .items-list-table tbody td.col-brand,
    .items-list-table tbody td.col-serie,
    .items-list-table tbody td.col-location,
    .items-list-table tbody td.col-tags,
    .items-list-table tbody td.col-purchase-price,
    .items-list-table tbody td.col-purchase-date,
    .items-list-table tbody td.col-estimated-value,
    .items-list-table tbody td.col-release-date { display: none !important; }

    .items-list-table tbody td {
        box-sizing: border-box;
        border: none;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.8125rem;
        padding: 0;
    }
    .items-list-table tbody td::before { display: none; }

    .items-list-table .col-thumbnail {
        grid-column: 1;
        grid-row: 1 / -1;
        align-self: center;
        display: block;
        margin: 0;
    }
    .items-list-table .col-thumbnail .item-list-thumb-slot {
        width: var(--thumb-slot);
        height: var(--thumb-slot);
        min-width: var(--thumb-slot);
        min-height: var(--thumb-slot);
        border-radius: 6px;
        overflow: hidden;
        display: block;
    }

    .items-list-table .col-name {
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
        align-self: end;
        font-size: 0.8125rem;
        font-weight: 600;
    }
    .items-list-table .col-quantity {
        grid-column: 2;
        grid-row: 2;
        min-width: 0;
        align-self: start;
        font-size: 0.625rem;
        color: var(--text-muted);
    }

    .items-list-table .col-status,
    .items-list-table .col-category {
        grid-column: 3;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        justify-content: center;
        gap: 0.125rem;
        min-width: 0;
    }
    .items-list-table .col-status { grid-row: 1; }
    .items-list-table .col-category { grid-row: 2; }

    .items-list-table tbody tr:not(:has(.col-category:not(.cell-empty))) .col-status { grid-row: 1 / -1; }

    .items-list-table tbody .col-status .badge,
    .items-list-table tbody .col-category .badge {
        padding: 0.1rem 0.35rem;
        font-size: 0.5625rem;
        border-radius: 4px;
        white-space: nowrap;
    }

    .items-list-table th.sortable .sort-indicator { display: none; }

    .item-list-name {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
        line-height: 1.25;
        color: var(--text);
        font-weight: 600;
    }
}

/* ─── Admin Tabs ─────────────────────────────────────────────────────── */
.admin-tabs {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.tab-nav {
    display: flex;
    border-bottom: 2px solid var(--border);
    background: var(--light);
}

.tab-btn {
    padding: 1rem 2rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    background: var(--white);
    color: var(--text);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--white);
}

.tab-content {
    display: none;
    padding: var(--spacing);
}

.tab-content.active {
    display: block;
}

@media (max-width: 768px) {
    .tab-nav {
        flex-wrap: wrap;
    }

    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

/* ─── Utility Classes ────────────────────────────────────────────── */
.d-none            { display: none; }
.d-inline          { display: inline; }
.flex-1            { flex: 1; }
.gap-xs            { gap: 0.375rem; }
.gap-sm            { gap: 0.5rem; }
.mt-xs             { margin-top: 0.5rem; }
.mt-sm             { margin-top: 1rem; }
.mt-md             { margin-top: 1.5rem; }
.mb-xs             { margin-bottom: 0.25rem; }
.mb-sm             { margin-bottom: 1rem; }
.mb-md             { margin-bottom: 1.25rem; }
.ml-xs             { margin-left: 0.25rem; }
.text-right        { text-align: right; }
.visibility-hidden { visibility: hidden; }
.cursor-pointer    { cursor: pointer; }
.field-error       { border-color: #dc3545 !important; }

/* ─── Login Page ─────────────────────────────────────────────────── */
.login-header   { text-align: center; margin-bottom: 1.75rem; }
.login-icon     { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; background: var(--primary-light); border-radius: 50%; margin-bottom: 1rem; }
.login-title    { font-size: 1.5rem; font-weight: 700; color: var(--text); letter-spacing: -0.3px; margin: 0; }
.login-subtitle { color: var(--text-muted); font-size: 0.875rem; margin-top: 0.25rem; }
.login-submit   { height: 42px; font-size: 0.9375rem; }

/* ─── Page Layout Helpers ────────────────────────────────────────── */
.page-header-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.page-subtitle       { color: var(--text-muted); font-size: 0.875rem; margin-top: 0.125rem; }
.page-title-truncate { max-width: 70%; overflow: hidden; text-overflow: ellipsis; }
.section-footer      { margin-top: 1rem; text-align: right; }
.admin-portal-link   { font-weight: 600; text-decoration: underline; margin-left: 0.25rem; }

/* ─── Empty State ────────────────────────────────────────────────── */
.empty-state-icon  { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty-state-title { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.375rem; }
.empty-state-text  { font-size: 0.875rem; }

/* ─── Filter Bar ─────────────────────────────────────────────────── */
.filter-actions-group { display: flex; flex-direction: column; justify-content: flex-end; gap: 0.375rem; }
.filter-label-hidden  { visibility: hidden; font-size: 0.75rem; }
.filter-buttons       { display: flex; gap: 0.375rem; }

/* ─── Tag Quick-Add ──────────────────────────────────────────────── */
.tag-add-row { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }

/* ─── Settings ───────────────────────────────────────────────────── */
.setting-checkbox-row   { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem; }
.setting-checkbox       { all: revert; width: 16px; height: 16px; cursor: pointer; accent-color: #1a73e8; margin: 0; flex-shrink: 0; }
.setting-checkbox-label { all: revert; margin: 0; font-size: 0.9375rem; font-weight: normal; cursor: pointer; user-select: none; }
.setting-hint           { color: #6b7280; font-size: 0.8125rem; }

/* ─── Image Preview ──────────────────────────────────────────────── */
.image-preview { max-width: 200px; margin-top: 0.5rem; border-radius: 4px; }

/* ─── Footer Text ────────────────────────────────────────────────── */
.footer-text { color: var(--text-muted); font-size: 0.8125rem; }

/* ─── Items view preference — applied before first paint via inline script ── */
html[data-view-pref="list"]  #items-grid-view  { display: none; }
html[data-view-pref="list"]  #items-list-view  { display: block; }
html[data-view-pref="list"]  #view-toggle-icon-grid { display: block; }
html[data-view-pref="list"]  #view-toggle-icon-list { display: none; }
html[data-view-pref="grid"]  #items-list-view  { display: none; }
html[data-view-pref="grid"]  #view-toggle-icon-grid { display: none; }
html[data-view-pref="grid"]  #view-toggle-icon-list { display: block; }
