/* ═══════════════════════════════════════════════════════════
   REPORT BUILDER MODAL
   ═══════════════════════════════════════════════════════════ */

#reportBuilderModal .modal-content {
    max-width: 900px;
    width: 95%;
}

.rb-steps { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; }
.rb-step { padding: 0.35rem 0.75rem; font-size: var(--text-xs); border: 1px solid var(--border-default); color: var(--text-muted); cursor: default; }
.rb-step.active { border-color: var(--corona); color: var(--corona-bright); }
.rb-step.done { border-color: var(--corona-deep); color: var(--corona-deep); }

.rb-template-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.rb-template-card {
    padding: 1.25rem; cursor: pointer;
    border: 1px solid var(--border-default);
    background: var(--surface);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.rb-template-card:hover { border-color: var(--corona); box-shadow: 0 0 20px rgba(74,173,224,0.08); }
.rb-template-card.selected { border-image: var(--grad-corona-border) 1; }
.rb-template-card h3 { font-size: var(--text-base); color: var(--text-primary); margin-bottom: 0.25rem; font-family: 'Space Grotesk', sans-serif; }
.rb-template-card p { font-size: var(--text-xs); color: var(--text-muted); line-height: 1.4; }

.rb-config-layout { display: flex; gap: 1.5rem; }
.rb-config-left { flex: 3; }
.rb-config-right { flex: 2; min-width: 200px; }

.rb-config-top { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.rb-config-top .form-group { flex: 1; min-width: 150px; }

.rb-block-group-title { font-size: var(--text-xs); color: var(--corona-bright); text-transform: uppercase; letter-spacing: 0.05em; margin: 1rem 0 0.5rem; font-weight: 600; }
.rb-block-item { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.4rem 0; cursor: pointer; }
.rb-block-item label { cursor: pointer; font-size: var(--text-sm); color: var(--text-secondary); flex: 1; }
.rb-block-item input[type="checkbox"] { margin-top: 2px; accent-color: var(--corona); }
.rb-block-item .rb-block-desc { font-size: var(--text-xs); color: var(--text-muted); }

.rb-block-textarea { width: 100%; margin-top: 0.4rem; padding: 0.5rem; font-size: var(--text-sm); background: var(--surface); border: 1px solid var(--border-default); color: var(--text-primary); font-family: 'Figtree', sans-serif; resize: vertical; min-height: 60px; }

.rb-selected-panel { border: 1px solid var(--border-default); padding: 1rem; background: var(--surface); }
.rb-selected-panel h4 { font-size: var(--text-sm); color: var(--corona-bright); margin-bottom: 0.75rem; }
.rb-selected-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.5rem; margin-bottom: 0.25rem; font-size: var(--text-xs); color: var(--text-secondary); border: 1px solid var(--border-default); cursor: grab; user-select: none; }
.rb-selected-item:active { cursor: grabbing; }
.rb-selected-item .rb-drag-handle { color: var(--text-muted); }
.rb-selected-item .rb-remove-block { margin-left: auto; cursor: pointer; color: var(--text-muted); }
.rb-selected-item .rb-remove-block:hover { color: var(--danger); }
.rb-selected-item.drag-over { border-color: var(--corona); }
.rb-page-estimate { margin-top: 0.75rem; font-size: var(--text-xs); color: var(--text-muted); }

.rb-preview-container { max-height: 380px; overflow-y: auto; margin-top: 0.75rem; border: 1px solid var(--border-default); }
.rb-preview-page { width: 100%; padding-bottom: 141.4%; position: relative; background: #050507; overflow: hidden; }
.rb-preview-inner { position: absolute; inset: 0; padding: 8px 10px; display: flex; flex-direction: column; }
.rb-preview-gradient-bar { height: 2px; min-height: 2px; background: linear-gradient(90deg, #489E46, #2489BD, #7CC8E6); margin-bottom: 6px; }
.rb-preview-masthead { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.rb-preview-logo { width: 10px; height: 10px; border-radius: 50%; background: linear-gradient(135deg, #489E46, #2489BD); flex-shrink: 0; }
.rb-preview-brand { font-size: 6px; color: rgba(255,255,255,0.5); font-family: 'Space Grotesk', sans-serif; }
.rb-preview-title { font-size: 10px; font-weight: 700; background: linear-gradient(90deg, #489E46, #2489BD, #7CC8E6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 2px; line-height: 1.3; }
.rb-preview-subtitle { font-size: 6px; color: rgba(255,255,255,0.4); margin-bottom: 4px; }
.rb-preview-separator { height: 1px; min-height: 1px; background: linear-gradient(90deg, #489E46, #2489BD, #7CC8E6); margin-bottom: 4px; opacity: 0.5; }
.rb-preview-block { background: #080810; border-top: 1px solid rgba(36,137,189,0.3); margin: 2px 0; padding: 4px 6px; }
.rb-preview-block-label { font-size: 5px; color: rgba(74,173,224,0.7); margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.03em; }
.rb-preview-stat-row { display: flex; gap: 3px; }
.rb-preview-stat-cell { flex: 1; text-align: center; padding: 2px; }
.rb-preview-stat-value { font-size: 8px; font-weight: 700; background: linear-gradient(90deg, #489E46, #2489BD); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.rb-preview-stat-label { font-size: 4px; color: rgba(255,255,255,0.35); }
.rb-preview-chart-placeholder { height: 40px; display: flex; align-items: center; justify-content: center; }
.rb-preview-chart-placeholder svg { opacity: 0.25; }
.rb-preview-table-placeholder { display: flex; flex-direction: column; gap: 1px; }
.rb-preview-table-row { height: 5px; background: rgba(255,255,255,0.04); }
.rb-preview-table-row:nth-child(odd) { background: rgba(255,255,255,0.07); }
.rb-preview-text-line { height: 3px; background: rgba(255,255,255,0.06); margin-bottom: 2px; }
.rb-preview-callout { border-left: 2px solid rgba(36,137,189,0.5); padding-left: 5px; }
.rb-preview-footer { margin-top: auto; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid rgba(36,137,189,0.15); padding-top: 3px; }
.rb-preview-footer span { font-size: 5px; color: rgba(255,255,255,0.3); }
.rb-preview-empty { display: flex; align-items: center; justify-content: center; position: absolute; inset: 0; font-size: var(--text-xs); color: var(--text-muted); }

body.light-mode .rb-preview-page { background: #ffffff; }
body.light-mode .rb-preview-block { background: #f8f9fa; border-top-color: rgba(36,137,189,0.15); }
body.light-mode .rb-preview-brand { color: rgba(0,0,0,0.4); }
body.light-mode .rb-preview-subtitle { color: rgba(0,0,0,0.35); }
body.light-mode .rb-preview-stat-label { color: rgba(0,0,0,0.4); }
body.light-mode .rb-preview-table-row { background: rgba(0,0,0,0.04); }
body.light-mode .rb-preview-table-row:nth-child(odd) { background: rgba(0,0,0,0.07); }
body.light-mode .rb-preview-text-line { background: rgba(0,0,0,0.06); }
body.light-mode .rb-preview-footer span { color: rgba(0,0,0,0.3); }
body.light-mode .rb-preview-footer { border-top-color: rgba(36,137,189,0.1); }

.rb-review-layout { display: flex; gap: 1.5rem; }
.rb-review-preview { flex: 3; }
.rb-review-sidebar { flex: 2; min-width: 180px; }

.rb-progress-overlay {
    position: absolute; inset: 0; background: rgba(5,5,7,0.92);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 10; gap: 1rem;
}
.rb-progress-overlay .rb-progress-text { font-size: var(--text-sm); color: var(--corona-bright); }
.rb-progress-overlay .rb-progress-bar { width: 200px; height: 3px; background: var(--surface-raised); overflow: hidden; }
.rb-progress-overlay .rb-progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #489E46, #2489BD); transition: width 0.3s; }

@media (max-width: 768px) {
    .rb-template-grid { grid-template-columns: 1fr; }
    .rb-config-layout { flex-direction: column; }
    .rb-review-layout { flex-direction: column; }
    #reportBuilderModal .modal-content { max-width: 100%; }
}

body.light-mode .rb-template-card { background: rgba(255,255,255,0.8); }
body.light-mode .rb-template-card h3 { color: #0F172A; }
body.light-mode .rb-selected-panel { background: rgba(255,255,255,0.6); }
body.light-mode .rb-block-textarea { background: #fff; border-color: rgba(36,137,189,0.15); color: #0F172A; }
body.light-mode .rb-progress-overlay { background: rgba(255,255,255,0.95); }

/* ─────────────────────────────────────────────────────────
   COMPLIANCE FRAMEWORK PAGE
   ───────────────────────────────────────────────────────── */

/* Jurisdiction country selector */
.compliance-jurisdiction-nav {
    display: flex;
    gap: 0;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-default);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.compliance-jurisdiction-nav::-webkit-scrollbar {
    display: none;
}

.jurisdiction-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: var(--text-base);
    font-family: 'Figtree', sans-serif;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.3s var(--ease-out-expo), border-color 0.3s var(--ease-out-expo);
}

.jurisdiction-btn:hover {
    color: var(--corona-bright);
    background: transparent;
    border-bottom-color: var(--corona-bright);
}

.jurisdiction-btn.active {
    background: transparent;
    color: var(--corona-bright);
    border-bottom-color: var(--corona-bright);
}

.compliance-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-default);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.compliance-tabs::-webkit-scrollbar {
    display: none;
}

.compliance-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: var(--text-base);
    font-family: 'Figtree', sans-serif;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.3s var(--ease-out-expo), border-color 0.3s var(--ease-out-expo);
}

.compliance-tab:hover {
    color: var(--corona-bright);
    background: transparent;
    border-bottom-color: var(--corona-bright);
}

.compliance-tab.active {
    background: transparent;
    color: var(--corona-bright);
    border-bottom-color: var(--corona-bright);
}

.compliance-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 0.25rem;
    background: rgba(74, 173, 224, 0.2);
    color: var(--corona-bright);
}

.compliance-tab.active .compliance-tab-badge {
    background: var(--corona-bright);
    color: #0a0a14;
}

.compliance-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 7.5rem;
    padding: 0.35rem 0.875rem;
    font-family: 'Space Grotesk', sans-serif;
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.compliance-status-badge.complete {
    background: rgba(36, 137, 189, 0.15);
    color: var(--corona-bright);
    border: 1px solid rgba(124, 200, 230, 0.3);
}

.compliance-status-badge.partial {
    background: rgba(124, 200, 230, 0.08);
    color: rgba(124, 200, 230, 0.65);
    border: 1px solid rgba(124, 200, 230, 0.15);
}

.compliance-status-badge.missing {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ── Battery Passport: compact layout ──────────────────── */

#batteryPassportPage .page-header {
    margin-bottom: 1rem;
}

#batteryPassportPage .page-header h1 {
    font-size: 1.25rem;
    margin-bottom: 0.125rem;
}

#batteryPassportPage .page-header p {
    font-size: var(--text-sm);
}

#batteryPassportPage .dm-tabs {
    margin-bottom: 0.75rem;
}

#batteryPassportPage .chart-card {
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
}

#batteryPassportPage .chart-card h3 {
    font-size: 0.8125rem;
    margin-bottom: 0.5rem;
}

#batteryPassportPage .data-table th,
#batteryPassportPage .data-table td {
    padding: 0.4rem 0.625rem;
    font-size: var(--text-xs);
}

.framework-view {
    display: none;
    animation: complianceFadeIn 0.3s ease;
}

.framework-view.active {
    display: block;
}

@keyframes complianceFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.compliance-gap-section {
    margin-top: 2rem;
}

.compliance-gap-item {
    background: linear-gradient(#0A0A0F, #0A0A0F) padding-box, var(--grad-corona-border) border-box;
    border: 1px solid transparent;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
}

.compliance-gap-ref {
    font-size: var(--text-xs);
    color: var(--corona-bright);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.compliance-gap-title {
    font-size: var(--text-sm);
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.compliance-gap-action {
    font-size: var(--text-xs);
    color: var(--text-muted);
    line-height: 1.5;
}

.compliance-data-points {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 180px;
    max-width: 260px;
}

.compliance-data-points .dp-item {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 2px 0;
    border-bottom: 1px solid rgba(124, 200, 230, 0.06);
}

.compliance-data-points .dp-item:last-child {
    border-bottom: none;
}

.compliance-data-points .dp-cat {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compliance-data-points .dp-val {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    text-align: right;
    color: var(--text-secondary);
}

.compliance-data-points .dp-more {
    font-style: italic;
    color: var(--corona-bright);
    opacity: 0.7;
    padding: 2px 0;
}

/* Light mode overrides */
body.light-mode .compliance-tab {
    background: none;
    border-image: none;
    color: #64748b;
}

body.light-mode .compliance-tab:hover {
    background: transparent;
    color: #489E46;
    border-bottom-color: #489E46;
}

body.light-mode .compliance-tab.active {
    background: transparent;
    color: #489E46;
    border-bottom-color: #489E46;
}

body.light-mode .compliance-tab-badge {
    background: rgba(72, 158, 70, 0.15);
    color: #489E46;
}

body.light-mode .compliance-tab.active .compliance-tab-badge {
    background: #489E46;
    color: #fff;
}

body.light-mode .jurisdiction-btn {
    background: none;
    border-image: none;
    color: #64748b;
}

body.light-mode .jurisdiction-btn:hover {
    background: transparent;
    color: #2489BD;
    border-bottom-color: #2489BD;
}

body.light-mode .jurisdiction-btn.active {
    background: transparent;
    color: #2489BD;
    border-bottom-color: #2489BD;
}

body.light-mode .compliance-gap-item {
    background: rgba(255, 255, 255, 0.8);
    border-image: none;
    border-color: rgba(36, 137, 189, 0.15);
}

body.light-mode .compliance-gap-ref {
    color: #2489BD;
}

body.light-mode .compliance-gap-title {
    color: #0F172A;
}

body.light-mode .compliance-status-badge.complete {
    background: rgba(36, 137, 189, 0.12);
    color: #2489BD;
    border-color: rgba(36, 137, 189, 0.25);
}

body.light-mode .compliance-status-badge.partial {
    background: rgba(36, 137, 189, 0.06);
    color: rgba(36, 137, 189, 0.65);
    border-color: rgba(36, 137, 189, 0.15);
}

body.light-mode .compliance-status-badge.missing {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-muted);
    border-color: rgba(0, 0, 0, 0.06);
}

/* ─────────────────────────────────────────────────────────
   PRINT STYLES
   ───────────────────────────────────────────────────────── */
@media print {
    .sidebar, .top-panel, .ai-float-button, .ai-chat-panel,
    .profile-popover, .toast, .modal { display: none !important; }
    .content { margin-left: 0 !important; }
    .content-wrapper { padding: 1rem !important; }
    body { background: white !important; color: black !important; }
    * { box-shadow: none !important; }
}

