/* components.css — Reusable UI components extracted from style.css */

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h1 { font-size: 2.2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

.page-header {
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
}

.page-header p {
    color: var(--text-secondary);
    margin-top: 0.4rem;
    font-size: 0.95rem;
}

p {
    color: var(--text-secondary);
    line-height: 1.7;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-bright);
}

code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--code-bg);
    padding: 0.15em 0.5em;
    border-radius: var(--radius-sm);
    color: var(--code-color);
    border: 1px solid var(--border-subtle);
}

small {
    font-size: 0.85em;
    color: var(--text-secondary);
}

strong {
    font-weight: 600;
    color: var(--text-primary);
}

hr {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 1.5rem 0;
}


/* --- Cards (article) --- */
article, .card {
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

article:hover, .card:hover {
    border-color: var(--border-default);
}

article header, .card-header {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
    letter-spacing: -0.01em;
}

article footer {
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--border-subtle);
}


/* --- Grid --- */
.grid {
    display: grid;
    gap: 1rem;
}

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

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

@media (max-width: 767px) {
    .grid {
        grid-template-columns: 1fr;
    }
}


/* --- Stat Cards --- */
.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transition: border-color 0.2s ease;
}

.stat-card:hover {
    border-color: var(--border-default);
}

.stat-card.accent-border {
    border-left: 3px solid var(--accent);
}

.stat-label {
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1;
}

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

.stat-value.danger {
    color: var(--status-danger);
}

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

/* Split stat card (equal columns) */
.stat-card-split {
    min-width: 0;
}

.stat-split-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.stat-split-item {
    flex: 1;
    text-align: center;
}

.stat-split-value {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1;
    display: block;
}

.stat-split-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.2rem;
    display: block;
}

.stat-split-divider {
    width: 1px;
    height: 2rem;
    background: var(--border-subtle);
    flex-shrink: 0;
}


/* --- Tables --- */
figure {
    margin: 0;
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead {
    border-bottom: 2px solid var(--border-default);
}

thead th {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.75rem 1rem;
    text-align: left;
    white-space: nowrap;
}

tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    vertical-align: middle;
}

tbody tr {
    transition: background-color 0.15s ease;
}

tbody tr:hover {
    background-color: var(--surface-hover);
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr[onclick] {
    cursor: pointer;
}

.table-wrap {
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table-wrap table {
    margin-bottom: 0;
}

.table-wrap thead th {
    background: var(--surface-2);
    padding: 1rem;
}

.table-wrap tbody td {
    padding: 0.85rem 1rem;
}


/* --- Report Filter Bar --- */
.report-filters {
    display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
    padding: 0.75rem 1rem; margin-bottom: 1rem;
    background: var(--surface-2); border-radius: var(--radius-md);
    border: 1px solid var(--border);
}
.report-filters select {
    padding: 0.35rem 0.6rem; font-size: 0.8rem;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface-1); color: var(--text-primary);
    cursor: pointer; min-width: 120px;
}
.report-filters select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.report-filters::before {
    content: "Filter:"; font-size: 0.75rem; font-weight: 600;
    color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px;
    margin-right: 0.25rem;
}

/* --- Sortable Table Headers --- */
th[data-sort] { position: relative; padding-right: 1.25em !important; }
th[data-sort]::after { content: "\2195"; position: absolute; right: 0.3em; opacity: 0.3; font-size: 0.75em; }
th[data-sort].sort-asc::after { content: "\25B2"; opacity: 0.8; color: var(--accent); }
th[data-sort].sort-desc::after { content: "\25BC"; opacity: 0.8; color: var(--accent); }

/* --- Grade Badges --- */
.grade-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2em 0.7em;
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.8em;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-inverse);
}

.grade-badge.large {
    font-size: 1.8em;
    padding: 0.2em 0.5em;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.grade-excellent { background: var(--grade-excellent); }
.grade-good { background: var(--grade-good); }
.grade-fair { background: var(--grade-fair); color: var(--text-inverse); }
.grade-poor { background: var(--grade-poor); }
.grade-rough { background: var(--grade-rough); }
.grade-none { background: var(--grade-none); }


/* --- Disposition Badges --- */
.disposition-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    padding: 0.2em 0.65em;
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.8em;
    letter-spacing: 0.02em;
}

.disposition-pending {
    background: rgba(107, 114, 128, 0.15);
    color: var(--disp-pending);
    border: 1px solid rgba(107, 114, 128, 0.2);
}

.disposition-recondition {
    background: rgba(96, 165, 250, 0.12);
    color: var(--disp-recondition);
    border: 1px solid rgba(96, 165, 250, 0.2);
}

.disposition-wholesale {
    background: rgba(251, 146, 60, 0.12);
    color: var(--disp-wholesale);
    border: 1px solid rgba(251, 146, 60, 0.2);
}

.disposition-retail {
    background: rgba(16, 185, 129, 0.12);
    color: var(--status-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}


/* --- Status Labels --- */
.status-reviewed {
    color: var(--status-success);
    font-weight: 600;
    font-size: 0.85em;
}

.status-pending {
    color: var(--status-warning);
    font-weight: 600;
    font-size: 0.85em;
}

/* --- Pipeline Stage Badges --- */
.pipeline-badge {
    display: inline-block;
    padding: 0.15em 0.55em;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: default;
}
.pipeline-draft {
    background: rgba(107, 114, 128, 0.12);
    color: #6b7280;
    border: 1px solid rgba(107, 114, 128, 0.25);
}
.pipeline-pending-acv {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.25);
}
.pipeline-not-analyzed {
    background: rgba(107, 114, 128, 0.12);
    color: #6b7280;
    border: 1px solid rgba(107, 114, 128, 0.25);
}
.pipeline-pending-review {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.25);
}
.pipeline-reviewed {
    background: rgba(20, 184, 166, 0.12);
    color: #0d9488;
    border: 1px solid rgba(20, 184, 166, 0.25);
}
.pipeline-deal-submitted {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.25);
}
.pipeline-approved {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.25);
}
.pipeline-countered {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.25);
}
.pipeline-finalized {
    background: rgba(99, 102, 241, 0.12);
    color: #4f46e5;
    border: 1px solid rgba(99, 102, 241, 0.25);
}

[data-theme="dark"] .pipeline-draft {
    background: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
}
[data-theme="dark"] .pipeline-pending-acv {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}
[data-theme="dark"] .pipeline-not-analyzed {
    background: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
}
[data-theme="dark"] .pipeline-pending-review {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}
[data-theme="dark"] .pipeline-reviewed {
    background: rgba(20, 184, 166, 0.2);
    color: #5eead4;
}
[data-theme="dark"] .pipeline-deal-submitted {
    background: rgba(59, 130, 246, 0.2);
    color: #93b8fc;
}
[data-theme="dark"] .pipeline-approved {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}
[data-theme="dark"] .pipeline-countered {
    background: rgba(59, 130, 246, 0.2);
    color: #93b8fc;
}
[data-theme="dark"] .pipeline-finalized {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}


/* --- Severity Labels --- */
.severity-minor { color: var(--sev-minor); font-weight: 500; }
.severity-moderate { color: var(--sev-moderate); font-weight: 600; }
.severity-severe { color: var(--sev-severe); font-weight: 700; }


/* --- Score Cards --- */
.score-card {
    text-align: center;
    padding: 1.25rem;
    background: var(--surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    transition: border-color 0.2s ease;
}

.score-card:hover {
    border-color: var(--border-default);
}

.score-card strong {
    display: block;
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.score-bar-container {
    background: var(--surface-4);
    border-radius: 100px;
    height: 8px;
    margin: 0.5rem 0;
    overflow: hidden;
    position: relative;
}

.score-bar {
    height: 100%;
    border-radius: 100px;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    background: var(--grade-none);
}
.score-bar.score-high     { background: var(--score-high); }
.score-bar.score-mid-high { background: var(--score-mid-high); }
.score-bar.score-mid      { background: var(--score-mid); }
.score-bar.score-mid-low  { background: var(--score-mid-low); }
.score-bar.score-low      { background: var(--score-low); }

.score-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 100px;
    background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, transparent 100%);
}

.score-card span {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.no-data {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
}


/* --- Overall Score Display --- */
.overall-score-card {
    text-align: center;
}

.score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 0 0.5rem;
}

.score-number {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}

.recon-cost {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--status-danger);
    letter-spacing: -0.03em;
    line-height: 1;
}

.recon-cost-small {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--status-danger);
    letter-spacing: -0.02em;
    padding: 0.5rem 0;
}


/* --- Recon Status --- */
.recon-status {
    display: inline-flex;
    align-items: center;
    padding: 0.15em 0.55em;
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-size: 0.8em;
    font-weight: 600;
}

.recon-status-pending {
    color: var(--disp-pending);
    background: rgba(107, 114, 128, 0.1);
}
.recon-status-in_progress {
    color: var(--status-info);
    background: rgba(96, 165, 250, 0.1);
}
.recon-status-completed {
    color: var(--status-success);
    background: rgba(52, 211, 153, 0.1);
}
.recon-status-skipped {
    color: var(--text-muted);
    background: rgba(107, 114, 128, 0.1);
    text-decoration: line-through;
}


/* --- Forms --- */
fieldset {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    background: var(--surface-1);
    min-width: 0;
}

legend {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    padding: 0 0.75rem;
}

label {
    display: block;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="tel"],
select,
textarea {
    display: block;
    width: 100%;
    padding: 0.65rem 0.9rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--surface-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    margin-top: 0.35rem;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238f9a90' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

input[type="file"] {
    display: block;
    width: 100%;
    padding: 0.5rem;
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--surface-2);
    border: 1px dashed var(--border-default);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    margin-top: 0.35rem;
}

input[type="file"]:hover {
    border-color: var(--accent);
    background: var(--brand-tint-alpha);
}

input[type="file"]::file-selector-button {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.8rem;
    padding: 0.35em 0.75em;
    margin-right: 0.75em;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

input[type="file"]::file-selector-button:hover {
    background: var(--surface-4);
    border-color: var(--accent);
}

input[type="checkbox"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.required {
    color: var(--status-danger);
}


/* --- Buttons --- */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

button, .btn-primary {
    background: var(--accent);
    color: var(--text-inverse);
}

button:hover, .btn-primary:hover {
    background: var(--accent-bright);
    box-shadow: 0 0 24px var(--accent-glow-strong);
    transform: translateY(-1px);
}

button:active, .btn-primary:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary, button.secondary {
    background: var(--surface-3);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
}

.btn-secondary:hover, button.secondary:hover {
    background: var(--surface-4);
    border-color: var(--border-strong);
    box-shadow: none;
}

button.secondary.outline, .btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
}

button.secondary.outline:hover, .btn-outline:hover {
    background: var(--surface-3);
    color: var(--text-primary);
    border-color: var(--border-strong);
    box-shadow: none;
    transform: none;
}

.btn-danger {
    background: rgba(248, 113, 113, 0.12);
    color: var(--status-danger);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.2);
    box-shadow: none;
}

.btn-lg {
    font-size: 1rem;
    padding: 0.8rem 2.5rem;
}


/* --- Image Grid --- */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.image-grid figure {
    margin: 0;
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    background: var(--surface-2);
}

.image-grid img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.image-grid figure:hover img {
    transform: scale(1.05);
}

.image-grid figcaption {
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    padding: 0.6rem 0.75rem;
    background: var(--surface-2);
    text-align: center;
}


/* --- Image Delete Button --- */
.image-delete-form {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    margin: 0;
    z-index: 2;
}

.image-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease;
    backdrop-filter: blur(4px);
}

.image-grid figure:hover .image-delete-btn {
    opacity: 1;
}

.image-delete-btn:hover {
    background: var(--status-danger);
}


/* --- Image Lightbox --- */
.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    cursor: zoom-out;
    animation: lightbox-fade-in 0.2s ease;
}

.lightbox-overlay.active {
    display: flex;
}

@keyframes lightbox-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    z-index: 10000;
    line-height: 1;
    padding: 0.25rem 0.5rem;
}

.lightbox-close:hover {
    opacity: 1;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 82vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    cursor: default;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

.lightbox-caption {
    color: rgba(255, 255, 255, 0.8);
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 0.75rem;
}

.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5rem;
    z-index: 10000;
    transition: background 0.2s, border-color 0.2s;
    -webkit-user-select: none;
    user-select: none;
}

.lightbox-arrow:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: none;
    transform: translateY(-50%);
}

.lightbox-arrow-prev { left: 1.25rem; }
.lightbox-arrow-next { right: 1.25rem; }

.lightbox-counter {
    color: rgba(255, 255, 255, 0.6);
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 500;
    margin-top: 0.4rem;
}

@media (max-width: 640px) {
    .lightbox-arrow { width: 40px; height: 40px; font-size: 1.25rem; }
    .lightbox-arrow-prev { left: 0.5rem; }
    .lightbox-arrow-next { right: 0.5rem; }
}


/* --- Image Upload Entries --- */
.image-entry {
    background: var(--surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.2s ease;
}

.image-entry:hover {
    border-color: var(--border-default);
}

.image-preview {
    margin-top: 0.5rem;
}

.image-preview img {
    max-width: 180px;
    max-height: 120px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    object-fit: cover;
}


/* --- Details / Accordions --- */
details {
    background: var(--surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    overflow: hidden;
}

details > summary {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    padding: 0.85rem 1.25rem;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.15s ease;
}

details > summary:hover {
    background: var(--surface-3);
}

details > summary::after {
    content: '';
    width: 6px;
    height: 6px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(-45deg);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

details[open] > summary::after {
    transform: rotate(45deg);
}

details > summary::-webkit-details-marker {
    display: none;
}

details > :not(summary) {
    padding: 0 1.25rem 1.25rem;
}


/* --- Feedback --- */
.feedback-entry {
    margin: 0.75rem 0;
    padding: 1rem 1.25rem;
    background: var(--surface-2);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--accent);
}

.feedback-entry p {
    margin-bottom: 0.35rem;
}


/* --- Stagger Animation --- */
.stagger-in {
    opacity: 0;
    transform: translateY(12px);
    animation: stagger-fade-in 0.45s ease forwards;
}

@keyframes stagger-fade-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stagger-in:nth-child(1) { animation-delay: 0.04s; }
.stagger-in:nth-child(2) { animation-delay: 0.08s; }
.stagger-in:nth-child(3) { animation-delay: 0.12s; }
.stagger-in:nth-child(4) { animation-delay: 0.16s; }
.stagger-in:nth-child(5) { animation-delay: 0.2s; }
.stagger-in:nth-child(6) { animation-delay: 0.24s; }
.stagger-in:nth-child(7) { animation-delay: 0.28s; }
.stagger-in:nth-child(8) { animation-delay: 0.32s; }
.stagger-in:nth-child(9) { animation-delay: 0.36s; }
.stagger-in:nth-child(10) { animation-delay: 0.4s; }


/* --- Fade In --- */
.fade-in {
    opacity: 0;
    transform: translateY(8px);
    animation: fade-in 0.5s ease forwards;
}

@keyframes fade-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* --- Alert banners --- */
.alert-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
    color: var(--grade-poor);
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 10px;
}

.alert-success {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
    color: var(--grade-excellent);
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 10px;
}

/* --- Admin users table --- */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.admin-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}

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

.admin-table tbody tr:hover {
    background: var(--surface-hover);
}

.action-cell {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.inline-form {
    display: inline;
}

/* --- Role & status badges --- */
.role-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.role-admin {
    background: rgba(0, 166, 81, 0.12);
    color: var(--accent);
    border: 1px solid rgba(0, 166, 81, 0.2);
}

.role-user {
    background: rgba(0, 112, 192, 0.08);
    color: var(--secondary);
    border: 1px solid rgba(0, 112, 192, 0.15);
}

.status-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
}

.status-active {
    background: rgba(16, 185, 129, 0.12);
    color: var(--grade-excellent);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-disabled {
    background: rgba(107, 114, 128, 0.12);
    color: var(--grade-rough);
    border: 1px solid rgba(107, 114, 128, 0.2);
}

/* --- Small action buttons --- */
.btn-sm {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    background: var(--surface);
    color: var(--text-secondary);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-sm:hover {
    background: var(--surface-hover);
}

.btn-sm.btn-warning {
    color: var(--grade-fair);
    border-color: rgba(245, 158, 11, 0.3);
}

.btn-sm.btn-warning:hover {
    background: rgba(245, 158, 11, 0.08);
}

.btn-sm.btn-success {
    color: var(--grade-excellent);
    border-color: rgba(16, 185, 129, 0.3);
}

.btn-sm.btn-success:hover {
    background: rgba(16, 185, 129, 0.08);
}

.btn-sm.btn-secondary {
    color: var(--secondary);
    border-color: rgba(0, 112, 192, 0.3);
}

.btn-sm.btn-secondary:hover {
    background: rgba(0, 112, 192, 0.08);
}

.btn-sm.btn-outline {
    color: var(--text-muted);
}

.btn-sm.btn-outline:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.btn-sm.btn-danger {
    color: var(--grade-poor);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-sm.btn-danger:hover {
    background: rgba(239, 68, 68, 0.08);
}

.table-responsive {
    overflow-x: auto;
}

.text-muted {
    color: var(--text-muted);
}

/* ============================================
   Role Badges
   ============================================ */
.role-badge {
    display: inline-block;
    padding: 0.15em 0.55em;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: middle;
}

.role-trade_in_sales {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.role-marketing {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.role-director {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.role-admin {
    background: rgba(139, 92, 246, 0.12);
    color: #7c3aed;
    border: 1px solid rgba(139, 92, 246, 0.25);
}

/* Legacy role badge aliases */
.role-evaluator {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.25);
}
.role-management {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.25);
}
.role-user {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

[data-theme="dark"] .role-trade_in_sales {
    background: rgba(59, 130, 246, 0.2);
    color: #93b8fc;
}
[data-theme="dark"] .role-marketing {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}
[data-theme="dark"] .role-director {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}
[data-theme="dark"] .role-admin {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
}
[data-theme="dark"] .role-evaluator {
    background: rgba(59, 130, 246, 0.2);
    color: #93b8fc;
}
[data-theme="dark"] .role-management {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}
[data-theme="dark"] .role-user {
    background: rgba(59, 130, 246, 0.2);
    color: #93b8fc;
}

/* Role select in admin table */
.role-select-sm {
    padding: 0.25rem 2rem 0.25rem 0.4rem;
    font-size: 0.78rem;
    border-radius: 6px;
    border: 1px solid var(--border-default);
    background-color: var(--surface-1);
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    color: var(--text-primary);
    cursor: pointer;
    min-width: 110px;
}

.role-change-form {
    display: inline;
    margin: 0;
}


/* --- Module Cards (Platform Home) --- */
.module-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.module-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.module-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 20px rgba(0, 166, 81, 0.08);
    transform: translateY(-2px);
    color: inherit;
}

.module-card-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-tint-alpha, rgba(0, 166, 81, 0.08));
    border-radius: var(--radius-md);
    color: var(--accent);
}

.module-card-icon svg {
    width: 24px;
    height: 24px;
}

.module-card-body h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.module-card-body p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.module-card-stats {
    display: flex;
    gap: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-subtle);
}

.module-stat {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.module-stat strong {
    color: var(--text-primary);
    font-weight: 600;
}

.module-stat-pending strong {
    color: var(--status-warning);
}

.module-card-coming-soon {
    opacity: 0.5;
    cursor: default;
    border-style: dashed;
}

.module-card-coming-soon:hover {
    border-color: var(--border-subtle);
    box-shadow: none;
    transform: none;
}

.module-card-coming-soon .module-card-icon {
    background: var(--surface-3);
    color: var(--text-muted);
}

@media (max-width: 640px) {
    .module-cards {
        grid-template-columns: 1fr;
    }
}


/* --- Modal Overlay --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}
.modal-box {
    background: var(--surface-1);
    border: 1px solid var(--surface-4);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}
.modal-box h3 {
    margin: 0 0 0.75rem;
    font-size: 1.1rem;
}
.modal-box p {
    margin: 0 0 1rem;
    line-height: 1.5;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.25rem;
}
