.reid-inv {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 1.25rem;
    background: #fff;
}

/* Header */
.reid-inv-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.reid-inv-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    flex: 1;
}
.reid-inv-refresh {
    font-size: 12px;
    padding: 4px 10px;
    border: 1px solid #059669;
    background: #ecfdf5;
    color: #059669;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}
.reid-inv-refresh:hover { background: #d1fae5; }
.reid-inv-refresh:disabled { opacity: 0.5; cursor: not-allowed; }

/* Agent controls */
.reid-inv-agent-controls {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 10px;
    padding: 8px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    flex-wrap: wrap;
}
.reid-inv-control {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
    font-weight: 600;
    color: #374151;
}
.reid-inv-control input,
.reid-inv-control select {
    font-size: 12px;
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    min-width: 100px;
}
.reid-inv-status {
    font-size: 12px;
    padding: 4px 0;
    flex: 1;
    min-width: 120px;
}
.reid-inv-status.ok { color: #059669; }
.reid-inv-status.err { color: #dc2626; }

/* Badges */
.reid-inv-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
    white-space: nowrap;
}
.reid-inv-badge.stale { background: #fef3c7; color: #92400e; }
.reid-inv-badge.uplift { background: #ecfdf5; color: #065f46; }

/* Sections (accordion) */
.reid-inv-section {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0.6rem;
}
.reid-inv-summary {
    cursor: pointer;
    padding: 0.85rem 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    list-style: none;
    color: #333;
    background: #fafafa;
    border-left: 4px solid #1a73e8;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.15s;
}
.reid-inv-summary:hover { background: #f0f3f5; }
.reid-inv-summary::-webkit-details-marker { display: none; }
.reid-inv-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.reid-inv-body {
    padding: 0.75rem 1rem;
    background: #f7f8fa;
}

/* Traffic lights */
.reid-inv-traffic {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
    white-space: nowrap;
}
.reid-inv-traffic.green { background: #dcfce7; color: #166534; }
.reid-inv-traffic.amber { background: #fef3c7; color: #92400e; }
.reid-inv-traffic.red { background: #fee2e2; color: #991b1b; }

/* Stats grid */
.reid-inv-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}
.reid-inv-stat {
    text-align: center;
    padding: 8px;
    background: #f3f4f6;
    border-radius: 6px;
}
.reid-inv-stat-value {
    display: block;
    font-size: 16px;
    font-weight: 800;
    color: #111827;
}
.reid-inv-stat-label {
    display: block;
    font-size: 10px;
    color: #6b7280;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* EPC bands */
.reid-inv-epc-band {
    display: inline-block;
    font-size: 20px;
    font-weight: 900;
    width: 36px;
    height: 36px;
    line-height: 36px;
    text-align: center;
    border-radius: 6px;
    color: #fff;
}
.reid-inv-epc-a { background: #1a9641; }
.reid-inv-epc-b { background: #66bd63; }
.reid-inv-epc-c { background: #a6d96a; color: #333; }
.reid-inv-epc-d { background: #fee08b; color: #333; }
.reid-inv-epc-e { background: #fdae61; color: #333; }
.reid-inv-epc-f { background: #f46d43; }
.reid-inv-epc-g { background: #d73027; }

/* ROI bar */
.reid-inv-roi-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f9fafb;
    border-radius: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.reid-inv-roi-label { font-weight: 700; font-size: 12px; color: #6b7280; }
.reid-inv-roi-value { font-size: 18px; font-weight: 800; }
.reid-inv-roi-value.positive { color: #059669; }
.reid-inv-roi-value.negative { color: #dc2626; }
.reid-inv-roi-detail { font-size: 12px; color: #6b7280; }

/* Tables */
.reid-inv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-bottom: 8px;
}
.reid-inv-table th {
    background: #f3f4f6;
    padding: 6px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #6b7280;
    border-bottom: 2px solid #e5e7eb;
}
.reid-inv-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #f3f4f6;
}
.reid-inv-table tbody tr:hover { background: #f9fafb; }
.reid-inv-num { text-align: right; font-variant-numeric: tabular-nums; }
.reid-inv-na { color: #9ca3af; font-style: italic; }

/* Element grid (EPC building elements) */
.reid-inv-element-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 6px;
    margin-bottom: 10px;
}
.reid-inv-element {
    padding: 6px 8px;
    background: #f9fafb;
    border-radius: 4px;
    border-left: 3px solid #d1d5db;
}
.reid-inv-el-name { font-weight: 700; font-size: 12px; display: block; }
.reid-inv-el-eff {
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    display: inline-block;
    margin-top: 2px;
}
.reid-inv-el-eff.good { background: #dcfce7; color: #166534; }
.reid-inv-el-eff.avg { background: #fef3c7; color: #92400e; }
.reid-inv-el-eff.poor { background: #fee2e2; color: #991b1b; }
.reid-inv-el-desc { font-size: 11px; color: #6b7280; display: block; margin-top: 2px; }

/* Improvement items */
.reid-inv-improvement {
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    margin-bottom: 6px;
}
.reid-inv-improvement > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    list-style: none;
}
.reid-inv-improvement > summary::-webkit-details-marker { display: none; }
.reid-inv-imp-label { flex: 1; }
.reid-inv-imp-body { padding: 8px 10px; }
.reid-inv-imp-desc { font-size: 12px; color: #6b7280; margin: 0 0 8px; }
.reid-inv-imp-projection {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 8px;
    background: #ecfdf5;
    border-radius: 4px;
    margin-top: 6px;
}

/* Priority labels (agent only) */
.reid-inv-priority-high { font-size: 10px; background: #fee2e2; color: #991b1b; padding: 1px 4px; border-radius: 3px; margin-left: 4px; }
.reid-inv-priority-medium { font-size: 10px; background: #fef3c7; color: #92400e; padding: 1px 4px; border-radius: 3px; margin-left: 4px; }
.reid-inv-priority-low { font-size: 10px; background: #f3f4f6; color: #6b7280; padding: 1px 4px; border-radius: 3px; margin-left: 4px; }

/* Positive/negative values */
.positive { color: #059669; }
.negative { color: #dc2626; }
.reid-inv-pass { color: #059669; font-weight: 700; }
.reid-inv-fail { color: #dc2626; font-weight: 700; }

/* Saving highlight */
.reid-inv-saving {
    padding: 6px 8px;
    background: #ecfdf5;
    border-radius: 4px;
    font-size: 12px;
    margin-top: 6px;
}

/* Text blocks */
.reid-inv-text { font-size: 12px; line-height: 1.5; color: #374151; }
.reid-inv-text p { margin: 0 0 8px; }

/* Subheadings */
.reid-inv-subheading { font-size: 12px; font-weight: 600; color: #374151; margin: 12px 0 6px; padding: 0; }

/* Guide links */
.reid-inv-guide-link { margin-top: 12px; padding-top: 8px; border-top: 1px solid #e5e7eb; }
.reid-inv-link { font-size: 12px; color: #2563eb; text-decoration: none; font-weight: 500; }
.reid-inv-link:hover { text-decoration: underline; }

/* Total row in cost tables */
.reid-inv-table tr.reid-inv-total td { border-top: 2px solid #d1d5db; padding-top: 6px; }

/* Warning state */
.reid-inv-warn { color: #d97706; }
[data-bs-theme="dark"] .reid-inv-guide-link,
[data-theme="dark"] .reid-inv-guide-link,
.dark-mode .reid-inv-guide-link { border-top-color: #374151; }
[data-bs-theme="dark"] .reid-inv-link,
[data-theme="dark"] .reid-inv-link,
.dark-mode .reid-inv-link { color: #60a5fa; }
[data-bs-theme="dark"] .reid-inv-subheading,
[data-theme="dark"] .reid-inv-subheading,
.dark-mode .reid-inv-subheading { color: #d1d5db; }

/* Grants / PD / constraints */
.reid-inv-grants > summary,
.reid-inv-pd > summary,
.reid-inv-constraints > summary {
    cursor: pointer;
    list-style: none;
}
.reid-inv-grants > summary::-webkit-details-marker,
.reid-inv-pd > summary::-webkit-details-marker,
.reid-inv-constraints > summary::-webkit-details-marker { display: none; }
.reid-inv-grants > summary h5,
.reid-inv-pd > summary h5,
.reid-inv-constraints > summary h5 {
    display: inline;
    font-size: 12px;
    margin: 0;
}

/* Sub headings */
.reid-inv-body h5 { font-size: 12px; font-weight: 700; margin: 10px 0 6px; color: #374151; }
.reid-inv-energy-costs h5 { margin-top: 0; }

/* Meta / source */
.reid-inv-meta { font-size: 11px; color: #9ca3af; margin-top: 8px; }
.reid-inv-stale-notice {
    font-size: 11px;
    color: #d97706;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 4px;
    padding: 4px 8px;
    margin-top: 6px;
}
.reid-inv-disclaimer {
    font-size: 11px;
    color: #9ca3af;
    font-style: italic;
    padding: 8px;
    border-top: 1px solid #e5e7eb;
    margin-top: 8px;
}

/* Empty state */
.reid-inv-empty {
    text-align: center;
    color: #666;
    padding: 1rem;
}
.reid-inv-empty p { margin: 4px 0; }
.reid-inv-hint { font-size: 11px; color: #9ca3af; }

/* Dark mode */
[data-bs-theme="dark"] .reid-inv,
[data-theme="dark"] .reid-inv,
.dark-mode .reid-inv {
    background: #1e1e1e;
    border-color: #444;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .reid-inv-section,
[data-theme="dark"] .reid-inv-section,
.dark-mode .reid-inv-section { border-color: #444; }

[data-bs-theme="dark"] .reid-inv-summary,
[data-theme="dark"] .reid-inv-summary,
.dark-mode .reid-inv-summary { color: #f0f0f0; background: #2a2a2a; }

[data-bs-theme="dark"] .reid-inv-summary:hover,
[data-theme="dark"] .reid-inv-summary:hover,
.dark-mode .reid-inv-summary:hover { background: #353535; }

[data-bs-theme="dark"] .reid-inv-body,
[data-theme="dark"] .reid-inv-body,
.dark-mode .reid-inv-body { background: #1e1e1e; }

[data-bs-theme="dark"] .reid-inv-stat,
[data-theme="dark"] .reid-inv-stat,
.dark-mode .reid-inv-stat { background: #1f2937; }

[data-bs-theme="dark"] .reid-inv-stat-value,
[data-theme="dark"] .reid-inv-stat-value,
.dark-mode .reid-inv-stat-value { color: #f3f4f6; }

[data-bs-theme="dark"] .reid-inv-table th,
[data-theme="dark"] .reid-inv-table th,
.dark-mode .reid-inv-table th { background: #1f2937; color: #9ca3af; border-color: #374151; }

[data-bs-theme="dark"] .reid-inv-table td,
[data-theme="dark"] .reid-inv-table td,
.dark-mode .reid-inv-table td { border-color: #1f2937; }

[data-bs-theme="dark"] .reid-inv-table tbody tr:hover,
[data-theme="dark"] .reid-inv-table tbody tr:hover,
.dark-mode .reid-inv-table tbody tr:hover { background: #1f2937; }

[data-bs-theme="dark"] .reid-inv-element,
[data-theme="dark"] .reid-inv-element,
.dark-mode .reid-inv-element { background: #1f2937; border-left-color: #4b5563; }

[data-bs-theme="dark"] .reid-inv-roi-bar,
[data-theme="dark"] .reid-inv-roi-bar,
.dark-mode .reid-inv-roi-bar { background: #1f2937; }

[data-bs-theme="dark"] .reid-inv-improvement,
[data-theme="dark"] .reid-inv-improvement,
.dark-mode .reid-inv-improvement { border-color: #374151; }

[data-bs-theme="dark"] .reid-inv-agent-controls,
[data-theme="dark"] .reid-inv-agent-controls,
.dark-mode .reid-inv-agent-controls { background: #1a2e1a; border-color: #2d5a2d; }

[data-bs-theme="dark"] .reid-inv-stale-notice,
[data-theme="dark"] .reid-inv-stale-notice,
.dark-mode .reid-inv-stale-notice { background: #451a03; border-color: #92400e; color: #fbbf24; }

[data-bs-theme="dark"] .reid-inv-control input,
[data-bs-theme="dark"] .reid-inv-control select,
[data-theme="dark"] .reid-inv-control input,
[data-theme="dark"] .reid-inv-control select,
.dark-mode .reid-inv-control input,
.dark-mode .reid-inv-control select { background: #1f2937; color: #e5e7eb; border-color: #4b5563; }
