/* Base styles */
:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --danger: #ef4444;
    --success: #22c55e;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.5;
}

/* Navigation */
.navbar {
    background: var(--gray-900);
    color: white;
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: white;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-links a {
    color: var(--gray-300);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: white;
    background: var(--gray-700);
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Typography */
h1 {
    font-size: 1.875rem;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--gray-700);
}

/* Breadcrumb */
.breadcrumb {
    margin-bottom: 1rem;
    color: var(--gray-500);
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

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

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-align: center;
}

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

.stat-label {
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* Section */
.section {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.data-table th {
    font-weight: 600;
    color: var(--gray-700);
    background: var(--gray-50);
}

.data-table a {
    color: var(--primary);
    text-decoration: none;
}

.data-table a:hover {
    text-decoration: underline;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    text-decoration: none;
    transition: background 0.2s;
}

.btn:hover {
    background: var(--primary-dark);
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: #dc2626;
}

/* Labels */
.label-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.label-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    background: var(--gray-100);
    border-radius: 9999px;
    font-size: 0.875rem;
}

.label-tag.primary {
    background: var(--primary);
    color: white;
}

.label-tag .count,
.label-tag .confidence {
    color: var(--gray-500);
    font-size: 0.75rem;
}

.label-tag.primary .confidence {
    color: rgba(255,255,255,0.7);
}

/* Person tags */
.person-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--success);
    color: white;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.person-tag.large {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-weight: 500;
}

.people-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Info grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

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

.info-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
}

.info-value {
    font-weight: 600;
}

/* Scenes grid */
.scenes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.scene-card {
    background: var(--gray-50);
    border-radius: 0.5rem;
    padding: 1rem;
}

.scene-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.scene-num {
    font-weight: 600;
}

.scene-time {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.scene-body {
    margin-bottom: 0.75rem;
}

.scene-duration {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.scene-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.scene-faces {
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* Scenes list with snapshots */
.scenes-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.scene-card-wide {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    overflow: hidden;
}

.scene-snapshots {
    display: flex;
    gap: 2px;
    background: var(--gray-200);
    flex-shrink: 0;
}

.scene-snapshot {
    width: 160px;
    height: 120px;
    object-fit: cover;
}

.no-snapshots {
    width: 160px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    color: var(--gray-400);
    font-size: 0.75rem;
}

.scene-info {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.scene-card-wide .scene-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 0;
}

.scene-card-wide .scene-duration {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--gray-500);
    margin-bottom: 0;
}

.scene-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: auto;
}

/* Faces grid */
.faces-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

.face-card {
    background: var(--gray-50);
    border-radius: 0.5rem;
    overflow: hidden;
}

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

.face-info {
    padding: 0.5rem;
    text-align: center;
}

.face-time {
    font-weight: 500;
}

.face-score {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Clusters page */
.cluster-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-btn {
    background: var(--gray-200);
    color: var(--gray-700);
}

.filter-btn.active {
    background: var(--primary);
    color: white;
}

.people-quick-add {
    display: flex;
    gap: 0.5rem;
}

.people-quick-add input {
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    width: 200px;
}

.clusters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.cluster-card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.cluster-header {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.cluster-title {
    font-weight: 600;
}

.cluster-count {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.cluster-thumbnails {
    padding: 0.5rem;
}

.cluster-grid-img {
    width: 100%;
    border-radius: 0.375rem;
}

.cluster-assignment {
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
}

.assigned-person {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.person-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    background: white;
}

/* Add person form */
.add-person-form {
    display: flex;
    gap: 0.5rem;
    max-width: 400px;
}

.add-person-form input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
}

/* Empty state */
.empty-state {
    color: var(--gray-500);
    text-align: center;
    padding: 2rem;
}

/* Labels editor */
.labels-editor {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.add-label-btn {
    background: var(--gray-200);
    color: var(--gray-700);
}

.manual-badge {
    font-size: 0.625rem;
    background: var(--gray-300);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    margin-left: 0.25rem;
}

/* Inline editing for labels and people */
.scene-labels.editable {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.scene-labels .label-tag {
    position: relative;
    padding-right: 1.5rem;
}

.scene-labels .remove-btn,
.scene-people .remove-btn {
    position: absolute;
    right: 0.25rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--gray-500);
    padding: 0;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s;
}

.scene-labels .label-tag:hover .remove-btn,
.scene-people .person-tag:hover .remove-btn {
    opacity: 1;
}

.scene-labels .remove-btn:hover,
.scene-people .remove-btn:hover {
    color: var(--danger);
}

.add-label-inline,
.add-person-inline {
    display: inline-flex;
}

.label-select {
    padding: 0.25rem 0.5rem;
    border: 1px dashed var(--gray-300);
    border-radius: 9999px;
    background: transparent;
    color: var(--gray-500);
    font-size: 0.875rem;
    cursor: pointer;
}

.label-select:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.person-input {
    padding: 0.25rem 0.5rem;
    border: 1px dashed var(--gray-300);
    border-radius: 0.375rem;
    background: transparent;
    font-size: 0.875rem;
    width: 100px;
}

.person-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Scene people */
.scene-people {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.scene-people .person-tag {
    position: relative;
    padding-right: 1.5rem;
}

.scene-people .person-tag.from-cluster {
    background: var(--primary);
}

.source-badge {
    font-size: 0.625rem;
    background: rgba(255,255,255,0.3);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    margin-left: 0.25rem;
}

/* Export bar */
.export-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--gray-900);
    color: white;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: -2rem -2rem 1rem -2rem;
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

.export-bar.visible {
    transform: translateY(0);
    opacity: 1;
}

.export-info {
    font-weight: 500;
}

.export-duration {
    color: var(--gray-400);
    margin-left: 0.5rem;
}

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

.btn-primary {
    background: var(--primary);
}

/* Scene selection toggle */
.select-toggle {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--gray-300);
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.select-toggle .check-icon {
    opacity: 0;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.select-toggle:hover {
    border-color: var(--primary);
}

.select-toggle.active {
    background: var(--success);
    border-color: var(--success);
}

.select-toggle.active .check-icon {
    opacity: 1;
}

.scene-card-wide {
    position: relative;
}

.scene-card-wide.selected {
    box-shadow: 0 0 0 2px var(--success);
}

.scene-card-wide .scene-snapshots {
    padding-left: 40px;
}

/* Large scene snapshots for scene detail page */
.scene-snapshots-large {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.scene-snapshot-large {
    height: 200px;
    border-radius: 0.5rem;
    object-fit: cover;
}

/* Hint text */
.hint {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 0.5rem;
}

/* People grid on people list page */
.people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.person-card {
    display: block;
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.person-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.person-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--gray-900);
}

.person-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.person-stats .stat {
    font-size: 0.875rem;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

/* Person detail page */
.person-summary {
    margin-bottom: 1.5rem;
}

.summary-stats {
    display: flex;
    gap: 1rem;
}

.stat-item {
    background: var(--gray-100);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    color: var(--gray-700);
}

.starred-stat {
    background: #fef3c7;
    color: #92400e;
}

.video-group {
    border-left: 4px solid var(--primary);
}

.video-group h2 {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.video-group h2 a {
    color: var(--gray-900);
    text-decoration: none;
}

.video-group h2 a:hover {
    color: var(--primary);
}

.video-year {
    color: var(--gray-500);
    font-weight: 400;
    font-size: 1rem;
}

.scene-count-badge {
    background: var(--gray-200);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--gray-600);
}

.scenes-list.compact .scene-card-wide {
    margin-bottom: 0;
}

.scenes-list.compact .scene-snapshot {
    width: 120px;
    height: 90px;
}

/* Progress bars */
.progress-bar-container {
    position: relative;
    background: var(--gray-200);
    border-radius: 9999px;
    height: 22px;
    overflow: hidden;
    min-width: 180px;
}

.progress-bar-container.large {
    height: 28px;
    min-width: 100%;
}

.progress-bar {
    height: 100%;
    background: var(--success);
    border-radius: 9999px;
    transition: width 0.3s;
}

.progress-bar.complete {
    background: var(--success);
}

.progress-bar.empty {
    background: transparent;
}

.progress-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-700);
    white-space: nowrap;
}

.progress-bar-container.large .progress-text {
    font-size: 0.875rem;
}

/* Completion summary on video page */
.completion-summary {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.completion-detail {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.completion-detail.complete-msg {
    color: var(--success);
    font-weight: 500;
}

/* Scene card highlight for missing people */
.scene-card-wide.needs-people {
    border-left: 3px solid #f59e0b;
}

/* Video player overlay */
.video-player-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-player-container {
    background: var(--gray-900);
    border-radius: 0.75rem;
    overflow: hidden;
    max-width: 900px;
    width: 90vw;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.video-player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    color: white;
    font-weight: 500;
}

.video-player-header .btn {
    background: var(--gray-700);
    font-size: 1rem;
    padding: 0.25rem 0.75rem;
}

.video-player-header .btn:hover {
    background: var(--gray-500);
}

.video-player-container video {
    width: 100%;
    display: block;
}

/* Play button styling */
.btn-play {
    background: var(--gray-700);
}

.btn-play:hover {
    background: var(--gray-900);
}

.cluster-actions {
    padding: 0.5rem;
    text-align: center;
}

/* Reviewed toggle button */
.reviewed-toggle {
    background: var(--gray-200);
    color: var(--gray-500);
    font-size: 0.8125rem;
    min-width: 110px;
}

.reviewed-toggle.reviewed {
    background: var(--success);
    color: white;
}

.reviewed-toggle:hover {
    opacity: 0.85;
}

/* Section header with filter */
.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-header-row h2 {
    margin-bottom: 0;
}

/* Person filter dropdown */
.person-filter-select {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background: white;
}

/* Person count cells */
.person-count-cell {
    text-align: center;
    font-weight: 600;
}

.person-count-zero {
    color: var(--gray-300);
}

.person-count-has {
    color: var(--success);
}

/* Notes */
.notes-section {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
    position: relative;
}

.notes-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--gray-200);
    border-radius: 0.375rem;
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
    min-height: 2.5rem;
    background: var(--gray-50);
    color: var(--gray-700);
}

.notes-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

.notes-input.dirty {
    border-color: #f59e0b;
}

.notes-status {
    position: absolute;
    right: 0.5rem;
    bottom: 0.5rem;
    font-size: 0.75rem;
    color: var(--success);
}

.scene-notes-inline {
    margin-bottom: 0.25rem;
}

.scene-notes-input {
    width: 100%;
    padding: 0.25rem 0.5rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    font-family: inherit;
    font-size: 0.8125rem;
    background: transparent;
    color: var(--gray-600);
}

.scene-notes-input:hover {
    border-color: var(--gray-200);
    background: var(--gray-50);
}

.scene-notes-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

.scene-notes-input.dirty {
    border-color: #f59e0b;
}

/* Star toggle */
.star-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--gray-300);
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.star-toggle:hover {
    color: #facc15;
}

.star-toggle.active {
    color: #facc15;
}

/* Page title with action button */
.page-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-title-row h1 {
    margin-bottom: 0;
}

/* Nav right (language, user) */
.nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-lang {
    color: var(--gray-300);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--gray-500);
    border-radius: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 600;
}

.nav-lang:hover {
    color: white;
    border-color: white;
}

.nav-user {
    color: var(--gray-300);
    font-size: 0.875rem;
}

.nav-logout {
    color: var(--gray-500);
    text-decoration: none;
    font-size: 0.8125rem;
}

.nav-logout:hover {
    color: white;
}

/* Auth pages */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--gray-900);
}

.auth-container {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    max-width: 420px;
    width: 90vw;
}

.auth-container h1 {
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--gray-500);
    margin-bottom: 2rem;
}

.auth-error {
    color: var(--danger);
    margin-bottom: 1rem;
}

.auth-message {
    color: var(--gray-700);
    font-size: 1.05rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.auth-message-secondary {
    color: var(--gray-500);
    font-size: 0.9rem;
    line-height: 1.6;
}

.btn-google {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 2rem;
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-google:hover {
    background: #3367d6;
}

/* Search */
.search-form {
    display: flex;
    gap: 0.5rem;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.5rem;
    font-size: 1rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.search-result {
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-result a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.search-result a:hover {
    text-decoration: underline;
}

.search-result-type {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--gray-500);
    background: var(--gray-200);
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    min-width: 60px;
    text-align: center;
}

.search-result-meta {
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* Labels grid */
.labels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.label-card {
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.label-card:hover {
    border-color: var(--primary);
}

.label-card-name {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.label-card-count {
    color: var(--primary);
    font-weight: 500;
}

.label-card-category {
    color: var(--gray-500);
    font-size: 0.75rem;
    text-transform: uppercase;
    margin-top: 0.25rem;
}

/* Clickable tags */
.person-tag.clickable,
.label-tag.clickable {
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.person-tag.clickable:hover,
.label-tag.clickable:hover {
    opacity: 0.8;
}

/* Combo form */
.combo-form {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

/* People nav */
.people-nav {
    margin-bottom: 1rem;
}

/* Admin */
.admin-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.admin-input {
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    width: 200px;
}

.admin-input-sm {
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    width: 60px;
    text-align: center;
}

.admin-input-full {
    width: 100%;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--gray-200);
    border-radius: 0.25rem;
    font-size: 0.8125rem;
}

.invite-result {
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

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

.pagination .btn-primary {
    pointer-events: none;
}

.pagination-dots {
    padding: 0.25rem 0.5rem;
    color: var(--gray-500);
}

.invite-result code {
    background: var(--gray-200);
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
}

/* ===========================
   RESPONSIVE: Tablet (iPad portrait, <=768px)
   =========================== */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    /* Nav: wrap links and shrink */
    .navbar {
        padding: 0.5rem 1rem;
        gap: 0.5rem;
    }

    .nav-links {
        gap: 0.25rem;
        flex-wrap: wrap;
    }

    .nav-links a {
        padding: 0.375rem 0.5rem;
        font-size: 0.8125rem;
    }

    .nav-right {
        gap: 0.5rem;
    }

    .nav-user {
        display: none;
    }

    /* Stats: smaller cards */
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    /* Tables: horizontal scroll */
    .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem;
        font-size: 0.8125rem;
        white-space: nowrap;
    }

    /* Scene cards: snapshots side by side, info below */
    .scene-card-wide {
        flex-direction: column;
    }

    .scene-snapshots {
        flex-shrink: unset;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .scene-snapshot {
        width: 140px;
        height: 105px;
    }

    .scene-card-wide .scene-snapshots {
        padding-left: 0;
    }

    .select-toggle {
        top: 0.25rem;
        left: 0.25rem;
        width: 24px;
        height: 24px;
    }

    .scene-info {
        padding: 0.75rem;
    }

    .scene-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .scene-meta {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Clusters */
    .clusters-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }

    /* People grid */
    .people-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    /* Labels grid */
    .labels-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    /* Person summary stats: wrap */
    .summary-stats {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .stat-item {
        font-size: 0.8125rem;
        padding: 0.375rem 0.75rem;
    }

    /* Section header */
    .section-header-row {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Page title */
    .page-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    /* Video player: wider */
    .video-player-container {
        width: 95vw;
        border-radius: 0.5rem;
    }

    /* Export bar */
    .export-bar {
        margin: -1rem -1rem 0.5rem -1rem;
        padding: 0.5rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Progress bars */
    .progress-bar-container {
        min-width: 120px;
    }

    /* Pagination */
    .pagination {
        gap: 0.125rem;
    }

    .pagination .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    /* Filter group */
    .filter-group {
        flex-wrap: wrap;
    }

    /* Search */
    .search-result {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Compact scene list */
    .scenes-list.compact .scene-snapshot {
        width: 100px;
        height: 75px;
    }

    /* Video group */
    .video-group h2 {
        font-size: 1rem;
    }

    /* Auth */
    .auth-container {
        padding: 2rem 1.5rem;
    }
}

/* ===========================
   RESPONSIVE: Phone (iPhone, <=480px)
   =========================== */
@media (max-width: 480px) {
    .container {
        padding: 0.75rem;
    }

    h1 {
        font-size: 1.25rem;
    }

    h2 {
        font-size: 1.05rem;
    }

    /* Nav: stack brand + links */
    .navbar {
        position: relative;
        padding: 0.5rem 0.75rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .nav-brand {
        font-size: 1.1rem;
    }

    .nav-links {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        gap: 0.125rem;
        padding-bottom: 0.25rem;
    }

    .nav-links a {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    .nav-right {
        position: absolute;
        top: 0.5rem;
        right: 0.75rem;
        gap: 0.5rem;
    }

    /* Stats: 2 columns on phone */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    /* Section: less padding */
    .section {
        padding: 0.75rem;
        border-radius: 0.375rem;
    }

    /* Scene snapshots: full width scroll */
    .scene-snapshot {
        width: 120px;
        height: 90px;
    }

    .scenes-list.compact .scene-snapshot {
        width: 90px;
        height: 68px;
    }

    .scene-info {
        padding: 0.5rem;
        gap: 0.375rem;
    }

    .scene-header {
        font-size: 0.875rem;
    }

    .scene-time, .scene-duration {
        font-size: 0.75rem;
    }

    /* Buttons: slightly bigger touch targets */
    .btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
    }

    .btn-sm {
        padding: 0.375rem 0.625rem;
    }

    /* Star toggle: bigger on touch */
    .star-toggle {
        font-size: 1.5rem;
        padding: 0.25rem;
    }

    /* Scene notes */
    .scene-notes-input {
        font-size: 0.875rem;
        padding: 0.375rem;
    }

    /* People grid */
    .people-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .person-card {
        padding: 1rem;
    }

    .person-name {
        font-size: 1rem;
    }

    /* Labels */
    .labels-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Clusters */
    .clusters-grid {
        grid-template-columns: 1fr;
    }

    /* Video player: full screen on phone */
    .video-player-container {
        width: 100vw;
        max-width: 100vw;
        border-radius: 0;
    }

    .video-player-overlay {
        align-items: flex-start;
        padding-top: 2rem;
    }

    /* Export bar */
    .export-bar {
        font-size: 0.8125rem;
    }

    .export-actions {
        flex-wrap: wrap;
    }

    /* Completion summary */
    .completion-detail {
        font-size: 0.75rem;
    }

    /* Info grid */
    .info-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    /* Search */
    .search-form {
        flex-direction: column;
    }

    .search-result-type {
        min-width: 50px;
        font-size: 0.625rem;
    }

    /* Breadcrumb */
    .breadcrumb {
        font-size: 0.8125rem;
    }

    /* Combo form */
    .combo-form {
        flex-direction: column;
        gap: 1rem;
    }

    /* Video group heading */
    .video-group h2 {
        font-size: 0.9rem;
    }

    .scene-count-badge {
        font-size: 0.75rem;
    }

    /* Auth */
    .auth-container {
        padding: 1.5rem 1rem;
        border-radius: 0.5rem;
    }

    .auth-container h1 {
        font-size: 1.25rem;
    }

    .btn-google {
        padding: 0.625rem 1.5rem;
        font-size: 0.875rem;
    }
}
