/* ============================================
   Photo Sorter - Caribbean Edition
   Caribbean Beach Bar Theme
   Inspired by La Hacienda, St. Maarten
   ============================================ */

:root {
    --bg-primary: #fdf6e3;
    --bg-secondary: #f5edd6;
    --bg-card: #ffffff;
    --bg-input: #faf3e0;
    --accent: #e8651a;
    --accent-hover: #ff7b2e;
    --secondary: #4caf50;
    --secondary-light: #81c784;
    --lime: #7cb342;
    --lime-light: #aed581;
    --lime-bg: #e8f5e9;
    --coral: #ff6f61;
    --coral-light: #ffab91;
    --sand: #d4a574;
    --sand-light: #f0dcc0;
    --ocean: #26a69a;
    --ocean-light: #80cbc4;
    --sunset: #ff9a56;
    --success: #43a047;
    --warning: #f9a825;
    --error: #e53935;
    --text-primary: #3e2723;
    --text-secondary: #6d4c41;
    --text-muted: #a1887f;
    --border: #e0d5c1;
    --shadow: 0 4px 20px rgba(62, 39, 35, 0.08);
    --shadow-lg: 0 8px 40px rgba(62, 39, 35, 0.12);
    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 22px;
    --transition: 0.2s ease;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ---- Navbar ---- */
.navbar {
    background: linear-gradient(135deg, #43a047, #66bb6a);
    border-bottom: 3px solid #388e3c;
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0 16px;
    box-shadow: 0 2px 12px rgba(56, 142, 60, 0.25);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    height: 56px;
    gap: 12px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 1.1rem;
    color: #fff;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.logo-icon { font-size: 1.4rem; }

.nav-links {
    display: flex;
    gap: 4px;
}

.nav-link {
    color: rgba(255,255,255,0.85);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
}

.nav-link:hover { color: #fff; background: rgba(255,255,255,0.15); }
.nav-link.active { color: #fff; background: rgba(255,255,255,0.25); font-weight: 700; }

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-user {
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
}

.logout-form { display: inline; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    min-height: 48px;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.btn-sm { padding: 8px 16px; font-size: 0.85rem; min-height: 36px; }
.btn-block { width: 100%; }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--sunset));
    color: white;
    box-shadow: 0 2px 8px rgba(232, 101, 26, 0.3);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--accent-hover), #ffb074); transform: translateY(-1px); }

.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--sunset));
    color: white;
    box-shadow: 0 2px 8px rgba(232, 101, 26, 0.3);
}
.btn-accent:hover { background: linear-gradient(135deg, var(--accent-hover), #ffb074); }

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--border);
}
.btn-outline:hover { color: var(--accent); border-color: var(--accent); }

.btn-filter {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--border);
}
.btn-filter.active {
    background: var(--lime);
    color: white;
    border-color: var(--lime);
}

/* ---- Main content ---- */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 16px;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    width: 100%;
}

/* Category filter chips (Scenery page) */
.category-filter {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0 12px;
    margin-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.category-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 2px solid var(--sand-medium);
    border-radius: 24px;
    background: var(--white);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    transition: all 0.2s;
}

.category-chip:hover {
    border-color: var(--accent);
    background: var(--sand-light);
}

.category-chip.active {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--white);
}

.category-chip.active .chip-badge {
    background: rgba(255,255,255,0.3);
    color: var(--white);
}

.chip-badge {
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--sand-light);
    color: var(--text-secondary);
    padding: 2px 7px;
    border-radius: 10px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.badge {
    background: var(--lime-bg);
    color: var(--lime);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    border: 1px solid var(--lime-light);
}

.filter-group {
    display: flex;
    gap: 4px;
}

/* ---- Albums Grid ---- */
.albums-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.album-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.album-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.album-card:active { transform: scale(0.97); }

.album-cover {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--sand-light);
}

.album-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.album-cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    background: linear-gradient(135deg, var(--lime-bg), var(--sand-light));
    color: var(--text-muted);
}

.album-info {
    padding: 12px 14px;
}

.album-label {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.album-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-top: 2px;
}

@media (min-width: 480px) {
    .albums-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 768px) {
    .albums-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1024px) {
    .albums-grid { grid-template-columns: repeat(5, 1fr); gap: 20px; }
}

/* ---- Masonry Grid ---- */
.masonry-grid {
    columns: 2;
    column-gap: 12px;
}

.photo-card {
    break-inside: avoid;
    margin-bottom: 12px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
    position: relative;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.photo-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.photo-card:active { transform: scale(0.97); }

.photo-thumb {
    width: 100%;
    display: block;
    opacity: 0;
    transition: opacity 0.4s;
    min-height: 120px;
    background: var(--sand-light);
}

.photo-thumb.loaded { opacity: 1; }

.photo-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 10px;
    background: linear-gradient(transparent, rgba(62,39,35,0.7));
    opacity: 0;
    transition: opacity 0.2s;
}

.photo-card:hover .photo-overlay { opacity: 1; }

.photo-name {
    font-size: 0.75rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Lightbox (see mobile-first lightbox section below) ---- */

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
    padding: 16px 0;
}

.page-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
}

/* ---- Loading ---- */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px;
}

.loading-spinner[hidden] {
    display: none !important;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Toast ---- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 16px;
    left: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 0.9rem;
    pointer-events: auto;
    animation: toastIn 0.3s ease;
    border-left: 4px solid var(--accent);
    max-width: 400px;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }
.toast.fade-out { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(20px); } }

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    background: linear-gradient(145deg, #c5e1a5 0%, #fff9c4 30%, #ffe0b2 60%, #ffccbc 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 80%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(124,179,66,0.15) 0%, transparent 70%);
    pointer-events: none;
}

.login-wrapper {
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    padding: 40px 28px;
    box-shadow: 0 12px 48px rgba(62, 39, 35, 0.15);
    border: 1px solid rgba(255,255,255,0.8);
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-emoji { font-size: 3rem; margin-bottom: 8px; }

.login-title {
    font-size: 1.8rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent), #ff6f61, var(--sunset));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 4px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input,
.form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
    min-height: 48px;
}

.form-group input:focus,
.form-input:focus {
    outline: none;
    border-color: var(--lime);
    box-shadow: 0 0 0 3px rgba(124,179,66,0.2);
}

.btn-login {
    margin-top: 8px;
    font-size: 1.1rem;
    padding: 16px;
    background: linear-gradient(135deg, var(--accent), var(--sunset));
    border-radius: var(--radius);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(232, 101, 26, 0.35);
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert-error {
    background: #ffeaea;
    color: var(--error);
    border: 1px solid #ffcdd2;
}

.login-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 20px;
    font-weight: 600;
}

/* ============================================
   SWIPE PAGE
   ============================================ */
.swipe-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 700px;
    margin: 0 auto;
    min-height: 0;
    padding-bottom: 20px;
}

/* Admin cluster picker */
.cluster-picker {
    width: 100%;
    margin-bottom: 12px;
    overflow: hidden;
}

.cluster-picker-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 2px 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.cluster-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px 6px 6px;
    border: 2px solid var(--sand-medium);
    border-radius: 24px;
    background: var(--white);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 0.85rem;
}

.cluster-chip:hover {
    border-color: var(--accent);
    background: var(--sand-light);
}

.cluster-chip.active {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--white);
}

.chip-face {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--sand-medium);
}

.cluster-chip.active .chip-face {
    border-color: var(--white);
}

.chip-label {
    font-weight: 700;
}

.chip-count {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Reference face + progress row */
.swipe-header-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.reference-face {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.reference-face img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
}

.ref-face-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
    white-space: nowrap;
}

.swipe-progress-container {
    width: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
}

.swipe-progress-bar {
    flex: 1;
    height: 10px;
    background: var(--sand-light);
    border-radius: 5px;
    overflow: hidden;
}

.swipe-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--lime), var(--secondary-light));
    border-radius: 5px;
    transition: width 0.4s ease;
}

.swipe-progress-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
    font-weight: 700;
}

/* Card area */
.swipe-area {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    min-height: 0;
}

.card-stack {
    width: 100%;
    max-width: 600px;
    position: relative;
}

.swipe-card {
    width: 100%;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--border);
    position: relative;
    touch-action: none;
    cursor: grab;
    transition: none;
    will-change: transform;
}

.swipe-card.releasing {
    transition: transform 0.3s ease;
}

.swipe-card-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.swipe-card-photo-side {
    position: relative;
    min-height: 250px;
    background: var(--sand-light);
    overflow: hidden;
}

.card-photo-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.card-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    min-height: 250px;
}

.face-bbox {
    position: absolute;
    border: 3px solid var(--sunset);
    border-radius: 4px;
    box-shadow: 0 0 12px rgba(255, 154, 86, 0.5);
    pointer-events: none;
}

.swipe-card-face-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    background: linear-gradient(180deg, var(--bg-primary), var(--sand-light));
}

.card-face {
    width: 100%;
    max-width: 200px;
    border-radius: var(--radius);
    border: 3px solid var(--lime-light);
}

.card-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 6px 0;
    text-align: center;
}

.card-label-face {
    margin-top: 12px;
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 800;
}

.confidence-badge {
    margin-top: 8px;
    background: var(--lime-bg);
    color: var(--lime);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    border: 1px solid var(--lime-light);
}

/* Swipe indicators */
.swipe-indicator {
    position: absolute;
    top: 20px;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-size: 1.2rem;
    font-weight: 800;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
    z-index: 10;
}

.swipe-indicator-accept {
    right: 20px;
    color: var(--success);
    border: 3px solid var(--success);
    background: rgba(67, 160, 71, 0.1);
    transform: rotate(15deg);
}

.swipe-indicator-reject {
    left: 20px;
    color: var(--error);
    border: 3px solid var(--error);
    background: rgba(229, 57, 53, 0.1);
    transform: rotate(-15deg);
}

.swipe-indicator.visible { opacity: 1; }

/* Swipe animations */
.swipe-out-left {
    transition: transform 0.3s ease, opacity 0.3s ease !important;
    transform: translateX(-150%) rotate(-20deg) !important;
    opacity: 0 !important;
}

.swipe-out-right {
    transition: transform 0.3s ease, opacity 0.3s ease !important;
    transform: translateX(150%) rotate(20deg) !important;
    opacity: 0 !important;
}

.swipe-out-down {
    transition: transform 0.3s ease, opacity 0.3s ease !important;
    transform: translateY(150%) !important;
    opacity: 0 !important;
}

/* Swipe buttons */
.swipe-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 20px;
    padding: 0 16px;
    width: 100%;
}

.swipe-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    width: 72px;
    height: 72px;
    cursor: pointer;
    transition: var(--transition);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 3px 12px rgba(0,0,0,0.1);
}

.swipe-btn:active { transform: scale(0.9); }

.swipe-btn-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.swipe-btn-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-top: 2px;
}

.swipe-btn-reject {
    background: #ffebee;
    color: var(--error);
    border: 3px solid var(--error);
}
.swipe-btn-reject:hover { background: #ffcdd2; }

.swipe-btn-skip {
    background: #f5f5f5;
    color: var(--text-muted);
    border: 3px solid var(--text-muted);
    width: 56px;
    height: 56px;
    align-self: center;
}
.swipe-btn-skip:hover { background: #e0e0e0; }
.swipe-btn-skip .swipe-btn-icon { font-size: 1.4rem; }

.swipe-btn-accept {
    background: #e8f5e9;
    color: var(--success);
    border: 3px solid var(--success);
}
.swipe-btn-accept:hover { background: #c8e6c9; }

.keyboard-hint {
    display: none;
    gap: 20px;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 12px;
}

kbd {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 8px;
    font-family: inherit;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Empty states */
.swipe-empty, .empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-icon { font-size: 3rem; margin-bottom: 16px; }

.swipe-empty h2 { color: var(--text-primary); margin-bottom: 8px; }

/* ============================================
   BATCH VERIFICATION (Admin - Google Photos style)
   ============================================ */
.verify-page {
    max-width: 700px;
    margin: 0 auto;
    padding-bottom: 100px;
}

.verify-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.verify-person {
    display: flex;
    align-items: center;
    gap: 12px;
}

.verify-ref-face {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent);
    flex-shrink: 0;
}

.verify-person-info {
    display: flex;
    flex-direction: column;
}

.verify-person-name {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--text);
}

.verify-progress-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.verify-progress-bar {
    height: 6px;
    background: var(--sand-light);
    border-radius: 3px;
    overflow: hidden;
}

.verify-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-dark));
    border-radius: 3px;
    transition: width 0.4s ease;
}

.verify-instruction {
    text-align: center;
    padding: 8px;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--sand-light);
    border-radius: 8px;
}

.verify-instruction strong {
    color: var(--error);
}

/* Face grid */
.verify-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

@media (min-width: 500px) {
    .verify-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.verify-tile {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    aspect-ratio: 1;
    background: var(--sand-light);
}

.verify-tile:active {
    transform: scale(0.95);
}

.verify-tile-img-wrap {
    width: 100%;
    height: 100%;
    position: relative;
}

.verify-tile-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Checkmark overlay (selected/confirmed) */
.verify-tile-check {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--success);
    color: white;
    font-size: 16px;
    font-weight: 900;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* X overlay (rejected) */
.verify-tile-x {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(220, 53, 69, 0.45);
    color: white;
    font-size: 40px;
    font-weight: 900;
    display: none;
    align-items: center;
    justify-content: center;
}

.verify-tile.selected {
    border: 3px solid var(--success);
}

.verify-tile.selected .verify-tile-check {
    display: flex;
}

.verify-tile.rejected {
    border: 3px solid var(--error);
    opacity: 0.7;
}

.verify-tile.rejected .verify-tile-x {
    display: flex;
}

.verify-tile-conf {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, transparent 100%);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 4px 6px 12px;
    text-align: center;
    pointer-events: none;
}

/* Sticky action bar */
.verify-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--sand-medium);
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 100;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
}

.verify-actions-inner {
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.verify-count {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.verify-confirm-btn {
    min-width: 140px;
    font-size: 1rem;
    padding: 12px 24px;
}

/* Empty state */
.verify-empty {
    text-align: center;
    padding: 48px 16px;
}

.verify-empty h2 {
    color: var(--text);
    margin-bottom: 8px;
}

.verify-empty p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}


/* Batch Reassignment Panel */
.reassign-panel {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 500;
    display: none;
    align-items: flex-end;
    justify-content: center;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.reassign-panel.visible {
    display: flex;
}

.reassign-panel-content {
    background: var(--white);
    border-radius: 20px 20px 0 0;
    padding: 20px 12px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    max-width: 700px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.2);
}

.reassign-panel-header {
    text-align: center;
    margin-bottom: 16px;
}

.reassign-panel-header h3 {
    font-size: 1.15rem;
    margin-bottom: 4px;
    color: var(--text);
}

.reassign-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Rejected faces row */
.reassign-faces-row {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 8px 4px;
    margin-bottom: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.reassign-face-thumb {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 14px;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
    border: 3px solid var(--sand-medium);
    transition: border-color 0.15s, opacity 0.15s, transform 0.15s;
}

.reassign-face-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.reassign-face-thumb.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
}

.reassign-face-thumb.selected::before {
    content: '\2713';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-size: 12px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.reassign-face-thumb.done {
    opacity: 0.45;
    cursor: default;
    border-color: var(--success);
}

.reassign-face-thumb.done::after {
    content: '\2713';
    position: absolute;
    inset: 0;
    background: rgba(40, 167, 69, 0.55);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 900;
}

.reassign-face-status {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.75);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    text-align: center;
    padding: 2px 2px;
    display: none;
}

.reassign-face-thumb.done .reassign-face-status {
    display: block;
}

/* Divider + label */
.reassign-clusters-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    padding-top: 12px;
    border-top: 1px solid var(--sand-medium);
}

/* Cluster options grid */
.reassign-clusters-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 20px;
}

@media (min-width: 500px) {
    .reassign-clusters-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.reassign-cluster-opt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 4px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    border: 2px solid transparent;
}

.reassign-cluster-opt:active {
    transform: scale(0.93);
    background: var(--sand-light);
    border-color: var(--accent);
}

.reassign-cluster-opt img {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--sand-medium);
}

.reassign-cluster-name {
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
    color: var(--text);
    line-height: 1.2;
    word-break: break-word;
    white-space: normal;
    background: var(--sand-light);
    padding: 2px 6px;
    border-radius: 6px;
}

.reassign-panel-footer {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding-top: 4px;
}


/* ============================================
   ADMIN PAGE
   ============================================ */
.admin-stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.stat-card-accent { border-color: var(--lime); border-width: 2px; }

.stat-value {
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-primary);
}

.stat-card-accent .stat-value { color: var(--lime); }

.stat-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

.admin-section {
    margin-bottom: 32px;
}

.admin-section h2 {
    font-size: 1.2rem;
    margin-bottom: 16px;
    color: var(--text-primary);
    font-weight: 800;
}

.clusters-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.cluster-card {
    display: flex;
    gap: 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.cluster-face {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--sand-light);
    border: 3px solid var(--lime-light);
}

.cluster-face img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cluster-info { flex: 1; min-width: 0; }

.cluster-label {
    font-weight: 800;
    font-size: 1rem;
    margin-bottom: 4px;
}

.cluster-meta {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.cluster-user { color: var(--accent); font-weight: 700; }

.mini-progress {
    height: 6px;
    background: var(--sand-light);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.mini-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--lime), var(--secondary-light));
    border-radius: 3px;
    transition: width 0.4s;
}

.cluster-swipe-stats {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.admin-actions-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.admin-action-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.admin-action-card h3 {
    font-size: 1rem;
    margin-bottom: 4px;
    font-weight: 800;
}

.admin-action-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.form-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.form-row .form-input {
    flex: 1;
    min-width: 100px;
}

.unclaimed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.unclaimed-face {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    text-align: center;
    box-shadow: var(--shadow);
}

.unclaimed-face img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.unclaimed-info {
    padding: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ============================================
   RESPONSIVE - Tablet
   ============================================ */
@media (min-width: 640px) {
    .masonry-grid { columns: 3; }

    .admin-stats-row { grid-template-columns: repeat(4, 1fr); }

    .clusters-grid { grid-template-columns: repeat(2, 1fr); }

    .admin-actions-section { grid-template-columns: repeat(2, 1fr); }

    .swipe-card-inner { min-height: 350px; }
}

/* ============================================
   RESPONSIVE - Desktop
   ============================================ */
@media (min-width: 1024px) {
    .masonry-grid { columns: 4; column-gap: 16px; }

    .photo-card { margin-bottom: 16px; }

    .keyboard-hint { display: flex; }

    .swipe-btn { width: 80px; height: 80px; }
    .swipe-btn-skip { width: 64px; height: 64px; }

    .swipe-card-inner { min-height: 400px; }

    .clusters-grid { grid-template-columns: repeat(3, 1fr); }

    .nav-link { padding: 8px 16px; }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--sand); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- Album shortcut cards ---- */
.album-cards {
    display: flex;
    gap: 12px;
    padding: 16px 0 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.album-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 90px;
    padding: 14px 16px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e8e8e8;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    text-decoration: none;
    color: var(--text-primary);
    transition: transform 0.15s, box-shadow 0.15s;
}

.album-card:active {
    transform: scale(0.96);
    box-shadow: 0 0 0 2px #43a047;
}

.album-card-icon {
    font-size: 1.8rem;
}

.album-card-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ---- Bottom tab bar ---- */
/* Base styles always applied so SVGs are never unsized */
.bottom-tabs {
    display: none; /* hidden on desktop by default */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
    padding: 4px 0;
    padding-bottom: env(safe-area-inset-bottom, 4px);
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 4px;
    color: #999;
    font-size: 0.65rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s;
}

.tab-item svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
}

.tab-item.active,
.tab-item:active {
    color: #43a047;
}

.tab-item.active svg {
    stroke: #43a047;
}

/* Mobile: show bottom tabs, hide desktop nav */
@media (max-width: 768px) {
    .nav-links-desktop { display: none !important; }
    .nav-user { display: none; }

    .bottom-tabs {
        display: flex;
    }

    .main-content {
        padding-bottom: 72px;
    }

    .navbar {
        padding: 0 12px;
    }

    .nav-inner {
        height: 48px;
    }
}

@media (max-width: 480px) {
    .logo-text { display: none; }
}

/* Mobile swipe layout — stack vertically, no whitespace gap */
@media (max-width: 768px) {
    .swipe-page {
        padding: 0;
        height: calc(100vh - 48px - 72px); /* top bar + bottom tabs */
    }

    .swipe-progress-container {
        padding: 8px 16px 4px;
    }

    .swipe-area {
        padding: 4px 8px 0;
    }

    .swipe-card-inner {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
    }

    .swipe-card-photo-side {
        min-height: 200px;
        max-height: 45vh;
    }

    .card-photo {
        min-height: 200px;
        max-height: 45vh;
    }

    .swipe-card-face-side {
        padding: 12px;
        flex-direction: row;
        gap: 12px;
        justify-content: flex-start;
        background: var(--bg-card);
    }

    .card-face {
        width: 80px;
        max-width: 80px;
        border-radius: 8px;
    }

    .card-label {
        font-size: 0.85rem;
    }

    .swipe-actions {
        padding: 8px 0 0;
        gap: 16px;
    }

    .swipe-btn {
        width: 56px;
        height: 56px;
    }

    .swipe-btn-skip {
        width: 44px;
        height: 44px;
    }

    .keyboard-hint {
        display: none;
    }
}

/* ---- Scenery category filter chips ---- */
.category-chips {
    display: flex;
    gap: 8px;
    padding: 8px 0 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.category-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s;
}

.category-chip.active {
    background: #43a047;
    color: #fff;
    border-color: #43a047;
}

.category-chip:active {
    transform: scale(0.95);
}

.category-chip-count {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* ============================================
   Admin - Rename Cluster
   ============================================ */

.cluster-label-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cluster-rename-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}

.cluster-rename-row .form-input-sm {
    padding: 4px 8px;
    font-size: 0.85rem;
    width: 140px;
}

.btn-xs {
    padding: 2px 8px;
    font-size: 0.75rem;
    border-radius: 4px;
}

.cluster-archived {
    opacity: 0.4;
    border: 2px dashed var(--text-muted, #888);
}

.cluster-archived:hover {
    opacity: 0.7;
}

.archive-btn {
    margin-top: 6px;
    font-size: 0.7rem;
}

.rename-btn {
    opacity: 0.5;
    font-size: 0.7rem;
    transition: opacity 0.2s;
}

.cluster-card:hover .rename-btn {
    opacity: 1;
}

/* Cluster sample expansion */
.cluster-face {
    cursor: pointer;
    position: relative;
}

.expand-hint {
    position: absolute;
    bottom: 4px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.65rem;
    color: var(--text-muted, #888);
    opacity: 0;
    transition: opacity 0.2s;
}

.cluster-face:hover .expand-hint {
    opacity: 1;
}

.cluster-samples {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 12px;
    background: var(--bg-hover, rgba(255, 255, 255, 0.03));
    border-top: 1px solid var(--border, rgba(255, 255, 255, 0.1));
}

.cluster-samples[hidden] {
    display: none !important;
}

.sample-item {
    text-align: center;
}

.sample-face {
    width: 100%;
    max-width: 120px;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.sample-face:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.samples-loading, .samples-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted, #888);
    padding: 8px;
    font-size: 0.85rem;
}

/* ============================================
   "Who Is This?" Modal
   ============================================ */

.who-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.who-modal[hidden] {
    display: none !important;
}

.who-modal-content {
    background: var(--bg-card, #1e1e2e);
    border-radius: 16px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.who-modal-header {
    text-align: center;
    margin-bottom: 16px;
}

.who-modal-header h3 {
    margin: 0 0 4px;
    font-size: 1.3rem;
}

.who-subtitle {
    color: var(--text-muted, #888);
    font-size: 0.85rem;
    margin: 0;
}

.who-face-preview {
    text-align: center;
    margin-bottom: 20px;
}

.who-face-preview img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent, #f59e0b);
}

.who-clusters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.who-cluster-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    border-radius: 12px;
    background: var(--bg-hover, rgba(255, 255, 255, 0.05));
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
    text-align: center;
}

.who-cluster-option:hover {
    background: var(--bg-active, rgba(255, 255, 255, 0.1));
    transform: scale(1.05);
}

.who-cluster-option:active {
    transform: scale(0.95);
}

.who-cluster-option img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 6px;
}

.who-cluster-label {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90px;
}

.who-cluster-count {
    font-size: 0.7rem;
    color: var(--text-muted, #888);
}

.who-modal-footer {
    text-align: center;
}

/* ============================================
   People / Browse Albums
   ============================================ */

.people-page .page-subtitle {
    color: var(--text-muted, #888);
    margin: 0;
}

.people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 16px;
    padding: 16px 0;
}

.person-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    border-radius: 12px;
    background: var(--bg-card, #1e1e2e);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    text-align: center;
}

.person-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.person-avatar img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 8px;
}

.person-name {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.person-count {
    font-size: 0.8rem;
    color: var(--text-muted, #888);
}

.album-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
}

.album-count {
    color: var(--text-muted, #888);
    font-size: 0.9rem;
}

/* ============================================
   MOBILE-FIRST LIGHTBOX - MEDIA + TAG MANAGEMENT
   ============================================
   Pattern: "Split Panel" with collapsible media
   - Media occupies top 40% (not more) on mobile
   - Tag panel occupies bottom 60% (scrollable)
   - Tag picker slides up as bottom sheet
   - Desktop: side-by-side at 768px+
   ============================================ */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

/* ---- Lightbox Top Bar ---- */
.lightbox-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    min-height: 44px;
    flex-shrink: 0;
    background: var(--bg-secondary, #16161e);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 10;
}

.lightbox-topbar-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin: 0 12px;
    text-align: center;
}

.lightbox-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    border-radius: var(--radius-sm, 8px);
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
    background: rgba(255, 255, 255, 0.1);
}

.lightbox-close:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.lightbox-close svg {
    width: 20px;
    height: 20px;
}

.lightbox-download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s;
    flex-shrink: 0;
}

.lightbox-download-btn:active {
    background: rgba(255,255,255,0.25);
}

.lightbox-download-btn svg {
    width: 22px;
    height: 22px;
}

.lightbox-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    color: var(--text-muted, #888);
    cursor: pointer;
    border-radius: var(--radius-sm, 8px);
    transition: background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.lightbox-nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.lightbox-nav-btn svg {
    width: 18px;
    height: 18px;
}

/* ---- Main Content Area ---- */
.lightbox-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ---- Media Section (constrained to 40vh on mobile) ---- */
.lightbox-photo-wrap {
    position: relative;
    flex-shrink: 0;
    max-height: 40vh;
    min-height: 180px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.lightbox-photo-wrap img,
.lightbox-photo-wrap video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

/* Face bbox overlays on the photo */
.lightbox-bbox-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.lightbox-bbox {
    position: absolute;
    border: 2px solid var(--accent, #e8651a);
    border-radius: 4px;
    pointer-events: auto;
}

.lightbox-bbox-unknown {
    border-color: #ef4444;
    border-style: dashed;
    animation: pulse-border 1.5s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.lightbox-bbox-unknown-label {
    background: #ef4444 !important;
    color: #fff !important;
}

.lightbox-bbox-label {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent, #e8651a);
    color: #000;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

/* Collapse toggle handle */
.lightbox-media-toggle {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 20px;
    background: var(--bg-card, #ffffff);
    border-radius: var(--radius-sm, 8px) var(--radius-sm, 8px) 0 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: none;
    cursor: pointer;
    z-index: 5;
    transition: background 0.15s ease;
}

.lightbox-media-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
}

.lightbox-media-toggle-icon {
    width: 24px;
    height: 3px;
    background: var(--text-muted, #888);
    border-radius: 2px;
    transition: transform 0.25s ease;
}

.lightbox-photo-wrap.collapsed {
    max-height: 120px;
    min-height: 120px;
}

.lightbox-photo-wrap.collapsed .lightbox-media-toggle-icon {
    transform: rotate(180deg);
}

/* ---- Sidebar / Tag Panel ---- */
.lightbox-sidebar {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-card, #ffffff);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.lightbox-tags-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 8px;
    flex-shrink: 0;
}

.lightbox-tags-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #3e2723);
    letter-spacing: 0.01em;
    margin: 0;
}

.lightbox-tags-count {
    font-size: 12px;
    color: var(--text-muted, #888);
    font-weight: 500;
}

/* ---- Tags List ---- */
.lightbox-tags {
    flex: 1;
    overflow-y: auto;
    padding: 4px 16px 12px;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.lightbox-tags::-webkit-scrollbar {
    width: 4px;
}

.lightbox-tags::-webkit-scrollbar-track {
    background: transparent;
}

.lightbox-tags::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
}

/* Individual tag chip */
.face-tag-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 6px;
    background: rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-sm, 8px);
    transition: background 0.15s ease;
    min-height: 44px;
}

.face-tag-label:hover {
    background: rgba(255, 255, 255, 0.1);
}

.face-tag-avatar {
    width: 36px;
    height: 36px;
    border-radius: 9999px;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.08);
}

.face-tag-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #333);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.face-tag-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    color: var(--text-muted, #888);
    cursor: pointer;
    border-radius: 9999px;
    transition: background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
    margin: -4px -6px -4px 0;
}

.face-tag-remove:hover,
.face-tag-remove:focus-visible {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.face-tag-remove:focus-visible {
    outline: 2px solid #ef4444;
    outline-offset: -2px;
}

.face-tag-remove svg {
    width: 16px;
    height: 16px;
}

/* Unassigned face chip */
.face-tag-unassigned {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.05);
}

.face-tag-avatar-unknown {
    width: 36px;
    height: 36px;
    border-radius: 9999px;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.face-tag-identify-btn,
.face-tag-dismiss-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}

.face-tag-identify-btn {
    color: var(--accent, #e8651a);
}

.face-tag-identify-btn:hover {
    background: rgba(232, 101, 26, 0.15);
}

.face-tag-dismiss-btn {
    color: #ef4444;
}

.face-tag-dismiss-btn:hover {
    background: rgba(239, 68, 68, 0.15);
}

.face-tag-identify-btn svg,
.face-tag-dismiss-btn svg {
    width: 18px;
    height: 18px;
}

/* Empty state */
.lightbox-tags-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted, #888);
    gap: 8px;
}

.lightbox-tags-empty svg {
    width: 32px;
    height: 32px;
    opacity: 0.5;
}

.lightbox-tags-empty p {
    font-size: 13px;
    line-height: 1.4;
}

/* ---- Add Tag Button (sticky at bottom of panel) ---- */
.lightbox-add-tag-wrap {
    flex-shrink: 0;
    padding: 8px 16px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: var(--bg-card, #ffffff);
}

.lightbox-add-tag {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 10px 16px;
    background: var(--accent, #e8651a);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm, 8px);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.lightbox-add-tag:hover {
    background: var(--accent-hover, #ff7b2e);
}

.lightbox-add-tag:active {
    transform: scale(0.98);
}

.lightbox-add-tag:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.lightbox-add-tag svg {
    width: 18px;
    height: 18px;
}

/* ---- Face Tag Picker (bottom sheet) ---- */
.face-tag-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.face-tag-overlay.active {
    opacity: 1;
    visibility: visible;
}

.face-tag-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.face-tag-picker {
    position: relative;
    z-index: 1;
    background: var(--bg-card, #ffffff);
    border-radius: 20px 20px 0 0;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 300ms cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
}

.face-tag-overlay.active .face-tag-picker {
    transform: translateY(0);
}

/* Picker drag handle */
.face-tag-picker-handle {
    display: flex;
    justify-content: center;
    padding: 10px 0 4px;
    flex-shrink: 0;
    cursor: grab;
}

.face-tag-picker-handle span {
    width: 36px;
    height: 4px;
    background: var(--text-muted, #888);
    border-radius: 2px;
    opacity: 0.5;
}

.face-tag-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px 12px;
    flex-shrink: 0;
}

.face-tag-picker-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #3e2723);
    margin: 0;
}

.face-tag-picker-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    color: var(--text-muted, #888);
    cursor: pointer;
    border-radius: 9999px;
    transition: background 0.15s ease;
}

.face-tag-picker-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.face-tag-picker-close svg {
    width: 20px;
    height: 20px;
}

/* Search input inside picker */
.face-tag-picker-search {
    padding: 0 16px 12px;
    flex-shrink: 0;
}

.face-tag-picker-search input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    background: var(--bg-secondary, #f5edd6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm, 8px);
    color: var(--text-primary, #3e2723);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s ease;
}

.face-tag-picker-search input::placeholder {
    color: var(--text-muted, #888);
}

.face-tag-picker-search input:focus {
    border-color: var(--accent, #e8651a);
}

/* Picker grid */
.face-tag-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 0 16px 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

@media (min-width: 390px) {
    .face-tag-picker-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.face-tag-picker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 4px;
    background: var(--bg-secondary, #f5edd6);
    border: 2px solid transparent;
    border-radius: var(--radius, 12px);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    min-height: 44px;
}

.face-tag-picker-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.face-tag-picker-item:focus-visible {
    outline: 2px solid var(--accent, #e8651a);
    outline-offset: -2px;
}

.face-tag-picker-item.disabled {
    opacity: 0.35;
    pointer-events: none;
}

.face-tag-picker-avatar {
    width: 52px;
    height: 52px;
    border-radius: 9999px;
    object-fit: cover;
}

.face-tag-picker-name {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-primary, #3e2723);
    text-align: center;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Safe area for notched phones ---- */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .lightbox-add-tag-wrap {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
    .face-tag-picker-grid {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
}

/* ---- Desktop breakpoint: side-by-side layout ---- */
@media (min-width: 768px) {
    .lightbox-container {
        flex-direction: row;
    }

    .lightbox-photo-wrap {
        flex: 1;
        max-height: none;
        min-height: 0;
    }

    .lightbox-media-toggle {
        display: none;
    }

    .lightbox-sidebar {
        width: 320px;
        flex: none;
        border-top: none;
        border-left: 1px solid rgba(255, 255, 255, 0.08);
    }

    .face-tag-picker-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1024px) {
    .lightbox-sidebar {
        width: 360px;
    }
}

/* ---- Video badge & thumb ---- */
.video-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    pointer-events: none;
}

.photo-card video.photo-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.empty-text, .loading-text {
    font-size: 0.8rem;
    color: var(--text-muted, #888);
}

/* ---- Unknown cluster chip ---- */
.chip-face-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--sand-light, #f0dcc0);
    color: var(--text-muted, #a1887f);
    font-size: 1.2rem;
    font-weight: 800;
    flex-shrink: 0;
}

/* ---- Swipe queue tabs ---- */
.swipe-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    width: 100%;
    background: var(--bg-secondary, #f5edd6);
    border-radius: var(--radius-sm, 10px);
    padding: 4px;
}

.swipe-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-sm, 8px);
    background: transparent;
    color: var(--text-secondary, #6d4c41);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.swipe-tab.active {
    background: var(--bg-card, #fff);
    color: var(--text-primary, #3e2723);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.tab-badge {
    background: var(--accent, #e8651a);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 4px;
}

.tab-badge:empty {
    display: none;
}

.unknown-chip {
    border: 2px dashed var(--text-muted, #a1887f) !important;
}

/* ---- Video badge overlay ---- */
.video-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: rgba(0,0,0,0.55);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.4rem;
    pointer-events: none;
    z-index: 2;
}

.lightbox-video {
    max-width: 95vw;
    max-height: 80vh;
    border-radius: var(--radius, 12px);
    background: #000;
}

#video-player[hidden] {
    display: none !important;
}

/* Audit & Login History Tables */
.section-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}
.section-toggle:hover { color: var(--accent, #3b82f6); }
.toggle-arrow { font-size: 0.8em; transition: transform 0.2s; }

.audit-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.audit-table th {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 2px solid var(--border, #334155);
    color: var(--text-secondary, #94a3b8);
    font-weight: 600;
    white-space: nowrap;
}
.audit-table td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--border, #1e293b);
    vertical-align: top;
}
.audit-table tr:hover td {
    background: var(--bg-hover, rgba(255,255,255,0.03));
}
.audit-table code {
    font-size: 0.8em;
    background: var(--bg-card, #1e293b);
    padding: 2px 6px;
    border-radius: 4px;
}
.detail-cell {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.action-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.action-swipe_me { background: #064e3b; color: #6ee7b7; }
.action-swipe_not_me { background: #7f1d1d; color: #fca5a5; }
.action-tag { background: #1e3a5f; color: #93c5fd; }
.action-untag { background: #4a1d5e; color: #d8b4fe; }
.action-claim { background: #3b3410; color: #fde68a; }
.action-dismiss_face { background: #4a1d1d; color: #fca5a5; }

.audit-filters {
    margin-bottom: 12px;
}
.audit-filters select {
    max-width: 220px;
}

.collapsible-section {
    margin-top: 8px;
}
