:root {
    --color-bg: #0a0f0d;
    --color-sidebar: #0d1210;
    --color-card: #131a16;
    --color-card-hover: #1a2420;
    --color-border: #1e2a24;
    --color-text: #e8efe8;
    --color-muted: #8a9b91;
    --color-accent: #3dd68c;
    --sidebar-width: 240px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
}

.icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.icon-lg {
    width: 24px;
    height: 24px;
}

.icon-xl {
    width: 48px;
    height: 48px;
}

.expand-chevron {
    transition: transform 0.2s;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--color-sidebar);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    z-index: 30;
    overflow: hidden;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--color-border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo-icon {
    width: 28px;
    height: 28px;
    background: var(--color-accent);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    color: var(--color-bg);
}

.sidebar-logo-text {
    font-size: 14px;
    font-weight: 600;
}

.compare-controls {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    display: none;
}

.compare-controls.active {
    display: block;
}

.compare-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.compare-count {
    font-size: 12px;
    color: var(--color-muted);
}

.compare-count strong {
    color: var(--color-accent);
}

.compare-buttons {
    display: flex;
    gap: 8px;
}

.btn {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--color-accent);
    color: var(--color-bg);
}

.btn-primary:hover {
    filter: brightness(1.1);
}

.btn-primary:disabled {
    background: var(--color-border);
    color: var(--color-muted);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--color-card);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-card-hover);
}

.lens-groups {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.lens-group {
    margin-bottom: 4px;
}

.lens-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
}

.lens-group-header:hover {
    background: var(--color-card);
}

.lens-group-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lens-group-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    text-transform: capitalize;
}

.lens-group-count {
    font-size: 11px;
    color: var(--color-muted);
    background: var(--color-card);
    padding: 2px 6px;
    border-radius: 10px;
}

.lens-group-chevron {
    transition: transform 0.2s;
}

.lens-group.collapsed .lens-group-chevron {
    transform: rotate(-90deg);
}

.lens-group.collapsed .timeline {
    display: none;
}

.timeline {
    position: relative;
    padding-left: 16px;
    margin-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--color-border);
}

.timeline-item {
    position: relative;
    padding: 8px 12px 8px 16px;
    cursor: pointer;
    border-left: 3px solid transparent;
    margin-left: -3px;
    transition: all 0.15s;
}

.timeline-item:hover {
    background: var(--color-card);
}

.timeline-item.selected {
    border-left-color: var(--color-accent);
    background: rgba(61, 214, 140, 0.08);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -9px;
    top: 14px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-border);
    border: 2px solid var(--color-sidebar);
}

.timeline-item.selected::before {
    background: var(--color-accent);
}

.timeline-date {
    font-size: 12px;
    color: var(--color-text);
    margin-bottom: 4px;
}

.timeline-stats {
    display: flex;
    align-items: center;
    gap: 6px;
}

.timeline-finding-count {
    font-size: 11px;
    color: var(--color-muted);
}

.timeline-severity-dots {
    display: flex;
    gap: 3px;
}

.severity-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.timeline-checkbox {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    accent-color: var(--color-accent);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}

.compare-mode .timeline-checkbox {
    opacity: 1;
}

.timeline-item:hover .timeline-checkbox {
    opacity: 0.5;
}

.compare-mode .timeline-item:hover .timeline-checkbox {
    opacity: 1;
}

/* Main Wrapper */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.header {
    background: var(--color-sidebar);
    border-bottom: 1px solid var(--color-border);
    padding: 16px 24px;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Comparison Overlay */
.comparison-overlay {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    background: var(--color-bg);
    z-index: 25;
    display: none;
    overflow-y: auto;
}

.comparison-overlay.active {
    display: block;
}

.comparison-header {
    background: var(--color-sidebar);
    border-bottom: 1px solid var(--color-border);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 5;
}

.comparison-title {
    font-size: 16px;
    font-weight: 600;
}

.comparison-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    cursor: pointer;
    color: var(--color-muted);
    transition: all 0.15s;
}

.comparison-close:hover {
    background: var(--color-card-hover);
    color: var(--color-text);
}

.comparison-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px;
}

.comparison-cards {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: stretch;
    margin-bottom: 24px;
}

.comparison-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 16px;
}

.comparison-card-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-muted);
    margin-bottom: 8px;
}

.comparison-card-date {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.comparison-card-findings {
    font-size: 24px;
    font-weight: 600;
}

.comparison-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-muted);
}

.comparison-trend {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin-bottom: 24px;
}

.comparison-trend.improving {
    background: rgba(61, 214, 140, 0.1);
    border-color: rgba(61, 214, 140, 0.3);
}

.comparison-trend.regressing {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.comparison-trend.stable {
    background: rgba(107, 114, 128, 0.1);
    border-color: rgba(107, 114, 128, 0.3);
}

.trend-indicator {
    font-size: 32px;
    margin-bottom: 8px;
}

.trend-label {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.trend-label.improving {
    color: #3dd68c;
}

.trend-label.regressing {
    color: #ef4444;
}

.trend-label.stable {
    color: #6b7280;
}

.trend-percentage {
    font-size: 12px;
    color: var(--color-muted);
    margin-top: 4px;
}

.severity-delta-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.severity-delta-item {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.severity-delta-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.severity-delta-values {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 600;
}

.severity-delta-arrow {
    color: var(--color-muted);
}

.severity-delta-change {
    font-size: 12px;
    margin-top: 4px;
}

.severity-delta-change.positive {
    color: #3dd68c;
}

.severity-delta-change.negative {
    color: #ef4444;
}

.severity-delta-change.neutral {
    color: var(--color-muted);
}

.breakdown-section {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
}

.breakdown-tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-sidebar);
}

.breakdown-tab {
    flex: 1;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-muted);
    cursor: pointer;
    text-align: center;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.breakdown-tab:hover {
    color: var(--color-text);
}

.breakdown-tab.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

.breakdown-tab[data-tab="resolved"].active {
    color: #3dd68c;
    border-bottom-color: #3dd68c;
}

.breakdown-tab[data-tab="new"].active {
    color: #ef4444;
    border-bottom-color: #ef4444;
}

.breakdown-tab[data-tab="improved"].active {
    color: #22d3ee;
    border-bottom-color: #22d3ee;
}

.breakdown-tab[data-tab="worsened"].active {
    color: #f97316;
    border-bottom-color: #f97316;
}

.breakdown-tab-count {
    display: inline-block;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 6px;
    background: var(--color-card);
    border-radius: 9px;
    font-size: 10px;
    line-height: 18px;
}

.breakdown-content {
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.breakdown-panel {
    display: none;
}

.breakdown-panel.active {
    display: block;
}

.breakdown-item {
    background: var(--color-sidebar);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 8px;
    border-left: 4px solid;
}

.breakdown-item:last-child {
    margin-bottom: 0;
}

.breakdown-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.breakdown-item-category {
    font-weight: 500;
    font-size: 13px;
}

.breakdown-item-severity {
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
}

.breakdown-item-description {
    font-size: 12px;
    color: var(--color-muted);
    line-height: 1.4;
}

.breakdown-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-muted);
}

.breakdown-empty-icon {
    margin-bottom: 8px;
    opacity: 0.5;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--color-accent);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--color-bg);
}

.logo-text {
    font-size: 16px;
    font-weight: 600;
}

.project-name {
    color: var(--color-muted);
    font-size: 14px;
}

.stats {
    display: flex;
    gap: 24px;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-accent);
}

.stat-label {
    font-size: 10px;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.audit-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.audit-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    transition: background 0.15s;
}

.audit-card:hover {
    background: var(--color-card-hover);
}

.audit-header {
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.audit-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.audit-top-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lens-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.confidence-badge {
    font-size: 9px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.timestamp {
    color: var(--color-muted);
    font-size: 13px;
}

.audit-stats {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--color-muted);
}

.audit-stats span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.severity-pills {
    display: flex;
    gap: 8px;
    align-items: center;
}

.severity-pill {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
}

.audit-card.expanded .expand-chevron {
    transform: rotate(180deg);
}

.audit-detail {
    display: none;
    border-top: 1px solid var(--color-border);
}

.audit-card.expanded .audit-detail {
    display: block;
}

.detail-tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-sidebar);
}

.detail-tab {
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.detail-tab:hover {
    color: var(--color-text);
}

.detail-tab.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

.tab-content {
    display: none;
    padding: 20px;
}

.tab-content.active {
    display: block;
}

.section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-muted);
    margin-bottom: 12px;
}

.findings-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.finding-item {
    background: var(--color-sidebar);
    border-radius: 6px;
    padding: 16px;
    border-left: 4px solid;
}

.finding-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.finding-category {
    font-weight: 600;
    font-size: 14px;
}

.finding-severity {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 3px;
    text-transform: uppercase;
}

.finding-description {
    font-size: 13px;
    color: var(--color-text);
    margin-bottom: 12px;
    line-height: 1.6;
}

.finding-remediation {
    background: rgba(61, 214, 140, 0.1);
    border: 1px solid rgba(61, 214, 140, 0.2);
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 12px;
}

.finding-remediation-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}

.finding-remediation-text {
    font-size: 13px;
    color: var(--color-text);
    line-height: 1.5;
}

.finding-files {
    font-size: 12px;
    color: var(--color-muted);
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.finding-files .icon {
    margin-top: 2px;
}

.finding-files-list {
    margin: 0;
    padding-left: 16px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

.finding-files-list li {
    margin: 2px 0;
}

.steps-timeline {
    position: relative;
    padding-left: 24px;
}

.steps-timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--color-border);
}

.step-item {
    position: relative;
    padding: 12px 0 12px 16px;
}

.step-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 18px;
    width: 12px;
    height: 12px;
    background: var(--color-accent);
    border-radius: 50%;
    border: 2px solid var(--color-bg);
}

.step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.step-number {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-accent);
}

.step-timestamp {
    font-size: 11px;
    color: var(--color-muted);
}

.step-name {
    font-size: 13px;
    color: var(--color-text);
    margin-bottom: 8px;
}

.step-files {
    font-size: 12px;
    color: var(--color-muted);
}

.step-files-count {
    color: var(--color-accent);
    font-weight: 500;
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 8px;
}

.file-item {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 12px;
    padding: 8px 12px;
    background: var(--color-sidebar);
    border-radius: 4px;
    color: var(--color-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-item:hover {
    color: var(--color-text);
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.meta-item {
    background: var(--color-sidebar);
    border-radius: 6px;
    padding: 16px;
}

.meta-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--color-muted);
    margin-bottom: 4px;
}

.meta-value {
    font-size: 14px;
    color: var(--color-text);
    word-break: break-all;
}

.meta-value.mono {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 12px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-muted);
}

.empty-state .icon-xl {
    margin-bottom: 16px;
}

.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
}

.empty-state-text {
    font-size: 14px;
}

.no-findings {
    text-align: center;
    padding: 40px;
    color: var(--color-muted);
}

.no-findings .icon-lg {
    margin-bottom: 8px;
}

/* Export Buttons */
.export-buttons {
    display: flex;
    gap: 8px;
}

.export-btn {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--color-border);
    background: var(--color-card);
    color: var(--color-text);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.export-btn:hover {
    background: var(--color-card-hover);
    border-color: var(--color-accent);
}

.export-btn .icon {
    width: 14px;
    height: 14px;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 280px;
    max-width: 400px;
    animation: toast-slide-in 0.3s ease-out;
}

.toast.toast-exit {
    animation: toast-slide-out 0.2s ease-in forwards;
}

.toast-icon {
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 12px;
    color: var(--color-muted);
}

.toast-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--color-muted);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
}

.toast-close:hover {
    background: var(--color-card-hover);
    color: var(--color-text);
}

.toast.toast-success {
    border-left: 3px solid #3dd68c;
}

.toast.toast-success .toast-icon {
    color: #3dd68c;
}

.toast.toast-error {
    border-left: 3px solid #ef4444;
}

.toast.toast-error .toast-icon {
    color: #ef4444;
}

.toast.toast-warning {
    border-left: 3px solid #eab308;
}

.toast.toast-warning .toast-icon {
    color: #eab308;
}

.toast.toast-info {
    border-left: 3px solid #3b82f6;
}

.toast.toast-info .toast-icon {
    color: #3b82f6;
}

@keyframes toast-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toast-slide-out {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}
