:root {
    --bg-dark: #0f172a;
    --panel-bg: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;

    --green: #10b981;
    --yellow: #f59e0b;
    --red: #ef4444;

    --paint-color: #3b82f6;
    --glass-color: #0d9488;
    --wheels-color: #d97706;
    --interior-color: #7c3aed;
    --engine-color: #e11d48;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Top Nav */
.top-nav {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

/* Auth Section */
.login-form {
    display: flex;
    gap: 0.5rem;
}

.login-form input {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    color: white;
    font-size: 0.9rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-profile.hidden {
    display: none;
}

.login-form.hidden {
    display: none;
}

.avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-main);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* App Container */
.app-container {
    flex: 1;
    padding: 2rem;
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.app-container.locked .report-wrapper {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
}

.lock-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.5);
    display: none;
}

.app-container.locked .lock-overlay {
    display: flex;
}

.lock-message {
    background: var(--panel-bg);
    padding: 3rem;
    border-radius: 16px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

.lock-message i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

/* Report Header */
.report-header {
    background: var(--panel-bg);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.header-titles {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
}

.header-titles h1 {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.header-titles h2 {
    font-size: 1.5rem;
    color: var(--text-main);
    font-weight: 700;
}

.meta-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    width: 100%;
}

.meta-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.meta-group label {
    font-weight: 600;
    width: 130px;
    color: var(--text-muted);
    font-size: 0.9rem;
    white-space: nowrap;
}

.meta-group input {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
}

/* Report Grid */
.report-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
}

/* Sections */
.section {
    background: var(--panel-bg);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.section-header {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
}

.section-header h3 {
    flex: 1;
    font-size: 1.1rem;
}

.section-header.paint {
    background: var(--paint-color);
}

.section-header.glass {
    background: var(--glass-color);
}

.section-header.wheels {
    background: var(--wheels-color);
}

.section-header.interior {
    background: var(--interior-color);
}

.section-header.engine {
    background: var(--engine-color);
}

.section-body {
    padding: 1rem;
}

.row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 40px;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.row:last-child {
    border-bottom: none;
}

.col-desc {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.col-desc i {
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-top: 0.2rem;
}

.col-desc small {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.col-input input,
.col-input textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.col-input textarea {
    height: 100%;
    min-height: 80px;
    resize: none;
}

.col-input.double {
    display: flex;
    gap: 0.5rem;
}

.col-input.options {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
}

.col-input.options label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}

.status-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin: 0 auto;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.2s;
}

.status-dot:hover {
    transform: scale(1.2);
}

.status-dot.green {
    background: var(--green);
}

.status-dot.yellow {
    background: var(--yellow);
}

.status-dot.red {
    background: var(--red);
}

/* Summary Card */
.summary-card {
    background: var(--panel-bg);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: sticky;
    top: 5rem;
}

.summary-card h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    text-align: center;
}

.recommendation-text {
    font-size: 0.85rem;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.text-green {
    color: var(--green);
}

.text-yellow {
    color: var(--yellow);
}

.text-red {
    color: var(--red);
}

.gauge-container {
    text-align: center;
    margin-bottom: 2rem;
}

.gauge {
    width: 200px;
    height: 100px;
    margin: 0 auto 1rem;
    /* Center is at bottom (50% 100%). Visible arc = gradient 90°→270° (left→top→right).
       Each visible third = 60°.
       Red   fills 0°→150° (first 90° hidden below, 90°→150° = left third visible)
       Yellow fills 150°→210° (centre third visible)
       Green  fills 210°→360° (210°→270° = right third visible, rest hidden below) */
    background: conic-gradient(from 180deg at 50% 100%,
            var(--red) 0deg 150deg,
            var(--yellow) 150deg 210deg,
            var(--green) 210deg 360deg);
    border-top-left-radius: 100px;
    border-top-right-radius: 100px;
    position: relative;
    overflow: hidden;
}

.gauge::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 140px;
    height: 70px;
    background: var(--panel-bg);
    border-top-left-radius: 70px;
    border-top-right-radius: 70px;
}

.gauge-needle {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 4px;
    height: 80px;
    background: var(--text-main);
    transform-origin: bottom center;
    transform: translateX(-50%) rotate(-45deg);
    /* Default pointing yellow */
    z-index: 10;
    border-radius: 4px;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.gauge-needle::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: -4px;
    width: 12px;
    height: 12px;
    background: var(--text-main);
    border-radius: 50%;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.action-buttons .btn {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
}

/* ─── Report Modal ──────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.hidden {
    display: none;
}

.modal-box {
    background: var(--panel-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.75rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: var(--text-main);
}

.modal-body {
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.modal-section-header {
    margin-bottom: 0.5rem;
}

.modal-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.6rem 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
}

.modal-gauge-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.badge {
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
}

.badge.green {
    background: rgba(16, 185, 129, 0.15);
    color: var(--green);
}

.badge.yellow {
    background: rgba(245, 158, 11, 0.15);
    color: var(--yellow);
}

.badge.red {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
}

.badge.overall {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
}

.modal-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.4rem;
    margin-top: 0.5rem;
}

.modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.modal-table th,
.modal-table td {
    text-align: left;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-table th {
    color: var(--text-muted);
    font-weight: 600;
}

.modal-table tbody tr:last-child td {
    border-bottom: none;
}

.dot-badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.dot-badge.green {
    background: rgba(16, 185, 129, 0.15);
    color: var(--green);
}

.dot-badge.yellow {
    background: rgba(245, 158, 11, 0.15);
    color: var(--yellow);
}

.dot-badge.red {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
}

/* ─── Print Styles ─────────────────────────────────────────────────── */
@media print {

    .top-nav,
    .print-hidden,
    .action-buttons,
    .modal-overlay {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .app-container {
        padding: 0 !important;
        max-width: 100% !important;
    }

    .section,
    .summary-card,
    .report-header {
        border: 1px solid #ccc !important;
        background: white !important;
        color: black !important;
        box-shadow: none !important;
    }

    .section-header h3,
    .col-desc strong,
    .col-desc small,
    .meta-group label {
        color: #333 !important;
    }

    .col-input input,
    .col-input textarea,
    .meta-group input {
        background: white !important;
        color: black !important;
        border: 1px solid #ccc !important;
    }

    .status-dot.green {
        background: #10b981 !important;
    }

    .status-dot.yellow {
        background: #f59e0b !important;
    }

    .status-dot.red {
        background: #ef4444 !important;
    }
}