/* Teams / Coach Dashboard Styles */

.teams-login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
}

.login-container {
    text-align: center;
    padding: 3rem 2rem;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    max-width: 420px;
    width: 90%;
}

.login-logo {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    margin-bottom: 1.5rem;
}

.login-container h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    color: #0f172a;
}

.login-container p {
    color: #64748b;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.google-signin-container {
    display: flex;
    justify-content: center;
}

/* Header */
.teams-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.teams-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.teams-header-left h1 {
    font-size: 1.25rem;
    margin: 0;
}

.teams-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.coach-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.coach-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.back-link {
    font-size: 0.875rem;
    color: #3b82f6;
    text-decoration: none;
    display: block;
    margin-bottom: 0.25rem;
}

.back-link:hover {
    text-decoration: underline;
}

/* Main content */
.teams-main {
    padding-top: 2rem;
    padding-bottom: 4rem;
}

/* Teams Grid */
.teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.team-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.team-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.team-card h3 {
    margin: 0 0 0.5rem;
    font-size: 1.125rem;
}

.team-card-meta {
    font-size: 0.875rem;
    color: #64748b;
}

/* Sections */
.team-section {
    margin-bottom: 2.5rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.section-header h2 {
    font-size: 1.25rem;
    margin: 0;
}

.section-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Invites */
.invites-section {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 2rem;
}

.invites-section h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.invite-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #fde68a;
}

.invite-item:last-child {
    border-bottom: none;
}

/* Roster */
.roster-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.gender-filter {
    display: flex;
    gap: 0.25rem;
}

.filter-btn {
    padding: 0.375rem 0.75rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
    transition: all 0.15s;
}

.filter-btn:hover {
    background: #f1f5f9;
}

.filter-btn.active {
    background: #1e3a8a;
    color: #fff;
    border-color: #1e3a8a;
}

.roster-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.roster-table th {
    text-align: left;
    padding: 0.625rem 0.75rem;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    color: #475569;
    font-size: 0.8125rem;
}

.roster-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

.roster-table tbody tr:hover {
    background: #f8fafc;
}

.roster-table .actions-cell {
    text-align: right;
    white-space: nowrap;
}

.roster-table .actions-cell button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: #94a3b8;
    font-size: 0.875rem;
}

.roster-table .actions-cell button:hover {
    color: #1e3a8a;
}

.roster-table .actions-cell .delete-btn:hover,
.roster-table .actions-cell .archive-btn:hover {
    color: #f59e0b;
}
.roster-table .actions-cell .perm-delete-btn {
    color: #94a3b8;
    font-size: 1.1rem;
}
.roster-table .actions-cell .perm-delete-btn:hover {
    color: #ef4444;
}
.roster-table .actions-cell .restore-btn {
    font-size: 1.1rem;
}
.roster-table .actions-cell .restore-btn:hover {
    color: #16a34a;
}

/* Archive section */
.archive-section {
    margin-top: 1rem;
    border-top: 1px solid #e2e8f0;
    padding-top: 0.75rem;
}
.archive-toggle-btn {
    background: none;
    border: none;
    font-size: 0.8rem;
    font-weight: 500;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.25rem 0;
}
.archive-toggle-btn:hover {
    color: #64748b;
}
.archived-list {
    display: none;
    margin-top: 0.75rem;
}
.archived-list.visible {
    display: block;
}

.empty-cell {
    text-align: center;
    color: #94a3b8;
    padding: 2rem !important;
}

.roster-count {
    font-size: 0.8125rem;
    color: #64748b;
    margin-top: 0.75rem;
}

/* Coaches List */
.coaches-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.coach-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.coach-item-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.coach-item-info img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.coach-item-name {
    font-weight: 600;
}

.coach-item-role {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.coach-item-pending {
    font-size: 0.75rem;
    color: #f59e0b;
    font-style: italic;
}

/* Time Trials */
.time-trials-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.trial-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.trial-item-name {
    font-weight: 600;
}

.trial-item-meta {
    font-size: 0.8125rem;
    color: #64748b;
}

.empty-state-text {
    color: #94a3b8;
    text-align: center;
    padding: 2rem;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #fff;
    border-radius: 16px;
    padding: 2rem;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin: 0 0 1.25rem;
    font-size: 1.25rem;
}

.modal-sm {
    width: 90%;
    max-width: 480px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.375rem;
}

.form-input, .form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    box-sizing: border-box;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-row {
    display: flex;
    gap: 0.75rem;
}

.form-row .form-group {
    flex: 1;
}

.form-help {
    font-size: 0.8125rem;
    color: #64748b;
    margin-top: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
}

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

.btn-primary {
    background: #1e3a8a;
    color: #fff;
}

.btn-primary:hover {
    background: #1e40af;
}

.btn-outline {
    background: #fff;
    border-color: #d1d5db;
    color: #374151;
}

.btn-outline:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
}

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

.btn-success-sm {
    background: #16a34a;
    color: #fff;
    padding: 0.25rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: 6px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
    grid-column: 1 / -1;
}

/* Responsive */
@media (max-width: 640px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .section-actions {
        width: 100%;
    }
    .roster-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── Results Section ──────────────────────────────────────── */

.results-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    border-bottom: 2px solid #e2e8f0;
}

.results-tab {
    padding: 0.5rem 1.25rem;
    background: none;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.results-tab:hover { color: #1e3a8a; }
.results-tab.active { color: #1e3a8a; border-bottom-color: #1e3a8a; }

/* View toggle (By Date / All Results / Personal Bests) */
.view-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 1.25rem;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
}
.view-toggle-btn {
    flex: 1;
    padding: 0.45rem 0.75rem;
    background: none;
    border: none;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.view-toggle-btn:hover { color: #1e3a8a; }
.view-toggle-btn.active {
    background: #fff;
    color: #1e3a8a;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Gender filter bar */
.gender-filter-bar {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
    max-width: 280px;
}
.gender-filter-btn {
    flex: 1;
    padding: 0.35rem 0.75rem;
    background: none;
    border: none;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.gender-filter-btn:hover { color: #1e3a8a; }
.gender-filter-btn.active {
    background: #fff;
    color: #1e3a8a;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Recurring event cards */
.recurring-card {
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 0.5rem;
    transition: background 0.15s, border-color 0.15s;
}
.recurring-card:hover {
    background: #eff6ff;
    border-color: #93c5fd;
}
.recurring-card-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.95rem;
}
.recurring-card-meta {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.25rem;
}

/* Trial items (standalone list) */
.trial-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.15s;
}
.trial-item:hover { background: #f8fafc; }
.trial-item-name { font-weight: 500; color: #1e293b; }
.trial-item-meta { font-size: 0.8rem; color: #64748b; margin-top: 2px; }

/* Detail panel */
.results-detail-panel {
    margin-top: 0.5rem;
}
.detail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.detail-header h3 { margin: 0; font-size: 1.1rem; color: #1e293b; flex: 1; }
.detail-meta { font-size: 0.85rem; color: #64748b; }

/* Danger outline button */
.btn-danger-outline {
    color: #ef4444;
    border: 1px solid #fca5a5;
    background: transparent;
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    margin-left: auto;
}
.btn-danger-outline:hover { background: #fef2f2; }

/* Inline edit/delete action buttons */
.actions-col { width: 4rem; text-align: right; white-space: nowrap; }
.btn-icon {
    background: none; border: none; cursor: pointer; padding: 0.2rem 0.35rem;
    font-size: 0.9rem; border-radius: 4px; transition: background 0.15s;
    opacity: 0.4;
}
tr:hover .btn-icon { opacity: 1; }
.btn-edit:hover { background: #eff6ff; color: #2563eb; }
.btn-delete:hover { background: #fef2f2; color: #ef4444; }
.btn-save { opacity: 1; color: #16a34a; font-weight: bold; }
.btn-save:hover { background: #f0fdf4; }
.btn-cancel { opacity: 1; color: #64748b; }
.btn-cancel:hover { background: #f1f5f9; }

/* Inline edit input */
.inline-edit-input {
    border: 1px solid #cbd5e1; border-radius: 4px; padding: 0.25rem 0.5rem;
    font-size: 0.8125rem; width: 5.5rem; font-family: inherit;
}
.inline-edit-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,0.15); }
.editing-row { background: #fffbeb; }
.cst-edit { width: 3rem !important; text-align: center; }
.instance-delete { opacity: 0; margin-left: auto; font-size: 0.8rem; }
.instance-header:hover .instance-delete { opacity: 0.6; }
.instance-header:hover .instance-delete:hover { opacity: 1; }

/* Cross-roster match chips */
.match-chip.cross { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.match-chip.cross small { color: #6b7280; font-size: 0.7rem; margin-left: 2px; }

/* Roster cleanup panel */
.cleanup-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.cleanup-header h4 { margin: 0; }
.cleanup-desc { font-size: 0.8125rem; color: #64748b; margin-bottom: 1rem; }
.cleanup-row {
    display: flex; flex-direction: column; gap: 0.5rem;
    padding: 0.75rem 1rem; border: 1px solid #e2e8f0; border-radius: 8px;
    margin-bottom: 0.5rem; background: #fff;
}
.cleanup-athletes { display: flex; align-items: center; gap: 0.75rem; }
.cleanup-athlete { display: flex; flex-direction: column; }
.cleanup-meta { font-size: 0.75rem; color: #64748b; }
.cleanup-vs { color: #94a3b8; font-size: 1.1rem; }
.cleanup-warn { font-size: 0.75rem; color: #f59e0b; font-weight: 500; }
.cleanup-actions { display: flex; gap: 0.5rem; }
.form-help { font-size: 0.75rem; color: #64748b; margin-top: 0.25rem; }

/* Instance cards (recurring history) */
.instances-list { display: flex; flex-direction: column; gap: 0.5rem; }
.instance-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}
.instance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    background: #f8fafc;
    transition: background 0.15s;
}
.instance-header:hover { background: #eff6ff; }
.instance-date { font-weight: 600; color: #1e293b; }
.instance-meta { font-size: 0.8rem; color: #64748b; }

.instance-results {
    display: none;
    padding: 0;
}
.instance-card.expanded .instance-results { display: block; }

/* Results table */
.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.results-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    color: #475569;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.results-table td {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}
.results-table tbody tr:hover { background: #f8fafc; }
.time-cell { font-variant-numeric: tabular-nums; font-weight: 500; }

/* PB badge */
.pb-badge {
    display: inline-block;
    background: #dcfce7;
    color: #16a34a;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    letter-spacing: 0.03em;
}

/* Athlete link */
.athlete-link {
    color: #2563eb;
    cursor: pointer;
    text-decoration: none;
}
.athlete-link:hover { text-decoration: underline; }

/* CSV import textarea */
.csv-textarea {
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 0.8rem;
    resize: vertical;
}

/* Loading / error text */
.loading-text { color: #64748b; text-align: center; padding: 2rem; }
.error-text { color: #ef4444; text-align: center; padding: 2rem; }

/* ── Manual Entry Modal ─────────────────────────────────── */

.modal-lg { max-width: 800px; width: 95vw; }

.entry-body {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1rem;
    margin: 1rem 0;
    min-height: 300px;
}

.entry-roster-pool label,
.entry-results-area label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.5rem;
}

.entry-roster-pool label small {
    font-weight: 400;
    color: #94a3b8;
}

.athlete-pool {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.pool-athlete {
    padding: 0.375rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8125rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pool-athlete:hover { background: #f1f5f9; }

.pool-gender {
    color: #94a3b8;
    font-size: 0.75rem;
}

.pool-empty {
    color: #94a3b8;
    font-size: 0.8125rem;
    text-align: center;
    padding: 1rem;
}

.entry-results-list {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
}

.entry-empty {
    color: #94a3b8;
    font-size: 0.875rem;
    text-align: center;
    padding: 2rem;
}

.entry-results-header {
    display: grid;
    grid-template-columns: 1fr 150px 30px;
    gap: 0.5rem;
    padding: 0 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 0.5rem;
}

.entry-result-row {
    display: grid;
    grid-template-columns: 1fr 150px 30px;
    gap: 0.5rem;
    align-items: center;
    padding: 0.25rem;
}

.entry-result-row:hover { background: #f8fafc; }

.entry-athlete-name {
    font-size: 0.8125rem;
    font-weight: 500;
}

.entry-value-input {
    padding: 0.375rem 0.5rem !important;
    font-size: 0.8125rem !important;
    text-align: center;
}

.entry-remove-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.entry-remove-btn:hover { color: #ef4444; }

/* Canadian Strength Test entry */
.cst-header-row {
    display: grid;
    grid-template-columns: 1fr repeat(5, 48px) 50px 30px;
    gap: 4px;
    padding: 0 0.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 0.5rem;
}

.cst-row {
    display: grid;
    grid-template-columns: 1fr repeat(5, 48px) 50px 30px;
    gap: 4px;
    align-items: center;
    padding: 0.25rem;
}

.cst-row:hover { background: #f8fafc; }

.cst-name-col { font-size: 0.8125rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cst-score-col { text-align: center; }
.cst-total-col { text-align: center; font-weight: 600; }
.cst-remove-col { text-align: center; }
.cst-total-value { color: #16a34a; }

.cst-input {
    padding: 0.25rem !important;
    font-size: 0.75rem !important;
    text-align: center;
    width: 100%;
}

/* Result type tag on recurring cards */
.result-type-tag {
    display: inline-block;
    background: #ede9fe;
    color: #7c3aed;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 0.375rem;
    vertical-align: middle;
}

/* Responsive: stack entry modal on mobile */
@media (max-width: 600px) {
    .entry-body { grid-template-columns: 1fr; min-height: auto; }
    .entry-roster-pool { max-height: 150px; overflow-y: auto; }
    .cst-header-row, .cst-row { grid-template-columns: 1fr repeat(5, 40px) 44px 24px; gap: 2px; }
    .cst-input { font-size: 0.7rem !important; padding: 0.2rem !important; }
}

/* ── CSV Import Wizard ──────────────────────────────────── */

.wizard-steps {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

.wizard-step {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #94a3b8;
    border-radius: 6px;
    background: #f8fafc;
}

.wizard-step.active {
    color: #1e3a8a;
    background: #dbeafe;
    font-weight: 600;
}

.wizard-step.done {
    color: #16a34a;
    background: #dcfce7;
}

/* Source tabs (file vs URL) */
.source-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.source-tab {
    flex: 1;
    padding: 0.5rem 1rem;
    border: none;
    background: #f8fafc;
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.source-tab:not(:last-child) {
    border-right: 1px solid #e2e8f0;
}

.source-tab.active {
    background: #2563eb;
    color: #fff;
}

.source-tab:hover:not(.active) {
    background: #e2e8f0;
}

/* URL input */
.url-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.url-input-row input {
    flex: 1;
}

.csv-url-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.csv-url-info span { color: #15803d; font-weight: 600; }

/* File drop zone */
.file-drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.file-drop-zone:hover, .file-drop-zone.dragover {
    border-color: #2563eb;
    background: #eff6ff;
}

.file-drop-zone p { margin: 0; color: #64748b; font-size: 0.875rem; }
.file-drop-zone a { color: #2563eb; cursor: pointer; text-decoration: underline; }
.file-drop-hint { font-size: 0.75rem !important; color: #94a3b8 !important; margin-top: 0.25rem !important; }

.csv-file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    font-size: 0.875rem;
}

.csv-file-info #csv-file-name { font-weight: 600; color: #15803d; }
.csv-file-info #csv-row-count { color: #64748b; flex: 1; }

/* CSV preview table */
.csv-preview-scroll {
    max-height: 200px;
    overflow: auto;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-top: 0.5rem;
}

.csv-preview-tbl { font-size: 0.75rem; }
.csv-preview-tbl th { white-space: nowrap; }
.csv-preview-tbl td { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Field mapping */
.mapping-section {
    margin-bottom: 1rem;
}

.mapping-section h4 {
    font-size: 0.8125rem;
    color: #334155;
    margin: 0 0 0.5rem;
}

.mapping-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.mapping-row label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
    min-width: 80px;
}

.csv-map-select { max-width: 200px; }

/* Match UI */
.match-section {
    margin-bottom: 1.25rem;
}

.match-section-header {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: #334155;
}

.match-list-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.match-chip {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.match-chip.exact { background: #dcfce7; color: #15803d; }

.match-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
    flex-wrap: wrap;
}

.match-csv-name {
    font-size: 0.875rem;
    font-weight: 500;
    min-width: 140px;
    color: #1e293b;
}

.match-arrow { color: #94a3b8; font-size: 1rem; }

.match-select { max-width: 240px; }

.match-pct {
    font-size: 0.75rem;
    color: #f59e0b;
    font-weight: 600;
}

.match-checkbox {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    cursor: pointer;
    color: #475569;
}

.match-checkbox input { cursor: pointer; }

.match-section.match-fuzzy .match-section-header { color: #d97706; }
.match-section.match-none .match-section-header { color: #dc2626; }

.match-summary {
    font-size: 0.8125rem;
    color: #475569;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.match-bulk-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.match-chip { cursor: pointer; transition: opacity 0.15s; }
.match-chip.skipped { opacity: 0.4; text-decoration: line-through; }
.match-chip:hover { opacity: 0.8; }

.match-import-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.match-action-label {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-left: auto;
}

/* Share link buttons */
.btn-share {
    color: #1e3a8a !important;
    border-color: #1e3a8a !important;
}
.btn-share:hover {
    background: #1e3a8a !important;
    color: #fff !important;
}

.btn-share-inline {
    opacity: 0.35;
    font-size: 0.85rem;
    padding: 0 0.2rem;
    margin-left: 0.25rem;
    vertical-align: middle;
    transition: opacity 0.15s;
}
.btn-share-inline:hover {
    opacity: 1;
}
.instance-share {
    opacity: 0.3;
    margin-right: 0.25rem;
}
.instance-share:hover {
    opacity: 1;
}

/* Help button */
.btn-ghost {
    background: none;
    border: 1px solid #cbd5e1;
    color: #64748b;
    font-weight: 700;
    font-size: 0.9rem;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-ghost:hover {
    background: #f1f5f9;
    color: #1e3a8a;
    border-color: #1e3a8a;
}

/* Onboarding Guide */
.onboarding-guide {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.guide-header h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.25rem 0;
}
.guide-header p {
    color: #64748b;
    font-size: 0.875rem;
    margin: 0 0 1.25rem 0;
}
.guide-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.guide-step {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}
.guide-step.active {
    background: #f0f9ff;
    border-color: #93c5fd;
}
.guide-step.done {
    background: #f0fdf4;
    border-color: #bbf7d0;
}
.guide-step.upcoming {
    opacity: 0.5;
}
.guide-step-number {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    color: #fff;
    background: #94a3b8;
    margin-top: 2px;
}
.guide-step.active .guide-step-number {
    background: #1e3a8a;
}
.guide-step.done .guide-step-number {
    background: #16a34a;
    font-size: 1rem;
}
.guide-step-content h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 0.4rem 0;
}
.guide-step-content p {
    font-size: 0.85rem;
    color: #475569;
    margin: 0 0 0.5rem 0;
    line-height: 1.5;
}
.guide-step-content ol {
    margin: 0.25rem 0 0.5rem 0;
    padding-left: 1.25rem;
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.7;
}
.guide-step-content ol strong {
    color: #1e3a8a;
}
.guide-tip {
    background: #fefce8;
    border-left: 3px solid #f59e0b;
    padding: 0.5rem 0.75rem;
    border-radius: 0 6px 6px 0;
    font-size: 0.8rem !important;
    color: #92400e !important;
}
.guide-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.guide-option {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
}
.guide-option strong {
    font-size: 0.85rem;
    color: #1e3a8a;
    display: block;
    margin-bottom: 0.15rem;
}
.guide-option p {
    font-size: 0.8rem !important;
    margin: 0 !important;
    color: #64748b !important;
}
.guide-done {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.guide-done-text {
    flex: 1;
    font-size: 0.875rem;
    color: #475569;
}

@media (max-width: 600px) {
    .mapping-row { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
    .csv-map-select { max-width: 100%; }
    .match-row { flex-direction: column; align-items: flex-start; }
    .match-select { max-width: 100%; }
    .guide-step { flex-direction: column; gap: 0.5rem; }
    .guide-step-number { width: 28px; height: 28px; min-width: 28px; font-size: 0.8rem; }
}

/* Profile / Results URL Section */
.profile-section {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.profile-section .section-header { margin-bottom: 0.75rem; }
.profile-section .section-header h2 { font-size: 1rem; }

.profile-slug-row {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.slug-prefix {
    font-size: 0.8125rem;
    color: #64748b;
    white-space: nowrap;
}
.slug-input {
    width: 160px !important;
    padding: 6px 10px !important;
    font-size: 0.8125rem !important;
    border-radius: 6px !important;
}
.slug-status {
    font-size: 0.8125rem;
    margin-top: 4px;
    min-height: 1.2em;
}
.slug-status.available { color: #16a34a; }
.slug-status.taken { color: #ef4444; }
.slug-link {
    margin-top: 8px;
    font-size: 0.8125rem;
}
.slug-link a {
    color: #3b82f6;
    text-decoration: none;
}
.slug-link a:hover { text-decoration: underline; }
.slug-separator { color: #cbd5e1; margin: 0 8px; }
.slug-secondary-link { color: #64748b !important; }
