* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f7f8;
    color: #1f2937;
}

.app-shell {
    display: flex;
    min-height: calc(100vh - 120px);
}

.sidebar {
    width: 240px;
    background: #071a2f;
    color: white;
    padding: 24px;
}

.sidebar h2 {
    margin-bottom: 4px;
}

.sidebar p {
    margin-top: 0;
    opacity: 0.8;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 30px;
}

.sidebar nav a {
    color: white;
    text-decoration: none;
    padding: 12px;
    border-radius: 10px;
}

.sidebar nav a.active,
.sidebar nav a:hover {
    background: rgba(116, 227, 255, 0.16);
}

.logout-btn {
    width: 100%;
    margin-top: 30px;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: #ef4444;
    color: white;
    cursor: pointer;
    font-weight: 700;
}

.main-content {
    flex: 1;
    padding: 30px;
}

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

.page-header h1 {
    margin: 0;
}

.page-header p {
    color: #64748b;
}

.print-btn {
    border: none;
    border-radius: 10px;
    background: #0f766e;
    color: white;
    padding: 12px 16px;
    font-weight: 700;
    cursor: pointer;
}

.toolbar {
    background: white;
    padding: 18px;
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
}

.toolbar select {
    width: 100%;
    max-width: 420px;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
}

.report-card {
    background: white;
    border-radius: 18px;
    padding: 26px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
}

.report-title {
    margin: 0 0 8px;
    color: #0f766e;
}

.report-meta {
    color: #64748b;
    line-height: 1.6;
}

.report-info {
    margin: 18px 0;
    color: #475569;
    font-size: 14px;
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin: 20px 0 28px;
}

.report-stat {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 18px;
}

.report-stat p {
    margin: 0 0 8px;
    color: #64748b;
}

.report-stat h2 {
    margin: 0;
    color: #0f766e;
}

.question-report-card {
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 22px;
    margin: 20px 0;
    page-break-inside: avoid;
}

.question-report-card h3 {
    margin: 0 0 8px;
    color: #0f172a;
}

.question-meta {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 18px;
}

.bar-row {
    margin-bottom: 14px;
}

.bar-label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 700;
}

.bar-track {
    width: 100%;
    height: 16px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0f766e, #22c55e);
    border-radius: 999px;
}

.insight-box {
    margin-top: 18px;
    padding: 14px;
    border-left: 4px solid #0f766e;
    background: #f0fdfa;
    color: #134e4a;
    border-radius: 10px;
    line-height: 1.5;
}

.empty-state {
    text-align: center;
    color: #64748b;
    padding: 40px 20px;
}

/* BUILDFRAME FOOTER */

.buildframe-footer {
    width: 100%;
    padding: 16px 18px;
    background: linear-gradient(135deg, #071a2f, #0f2f52);
    color: #ffffff;
    text-align: center;
    border-top: 1px solid rgba(116, 227, 255, 0.22);
}

.buildframe-credit {
    max-width: 980px;
    margin: 0 auto;
}

.buildframe-credit strong {
    display: block;
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 3px;
}

.buildframe-credit span {
    display: block;
    font-size: 11px;
    opacity: 0.85;
    margin-bottom: 8px;
    color: #ffffff;
}

.buildframe-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px 14px;
    flex-wrap: wrap;
}

.buildframe-links a {
    color: #ffffff;
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    opacity: 0.9;
}

.buildframe-links a:hover {
    opacity: 1;
    text-decoration: underline;
}

@media (max-width: 900px) {
    .app-shell {
        flex-direction: column;
        min-height: auto;
    }

    .sidebar {
        width: 100%;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
}

@media print {
    body {
        background: white;
    }

    .sidebar,
    .toolbar,
    .print-btn,
    .buildframe-footer {
        display: none !important;
    }

    .app-shell {
        display: block;
        min-height: auto;
    }

    .main-content {
        padding: 0;
    }

    .page-header {
        display: block;
        margin-bottom: 18px;
    }

    .report-card {
        box-shadow: none;
        border-radius: 0;
        padding: 0;
    }

    .question-report-card {
        break-inside: avoid;
    }
}

.report-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.excel-btn {
    border: none;
    border-radius: 10px;
    background: #2563eb;
    color: white;
    padding: 12px 16px;
    font-weight: 700;
    cursor: pointer;
}

.excel-btn:hover {
    background: #1d4ed8;
}