@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-main: #f8fafc;              /* Soft slate-white background */
    --bg-sidebar: #263957;           /* Corporate logo brand blue for sidebar */
    --bg-card: #ffffff;              /* Crisp white cards */
    --bg-card-hover: #f1f5f9;        /* Light hover slate-grey */
    --border-color: #e2e8f0;         /* Soft grey borders */
    --border-hover: rgba(38, 57, 87, 0.2); /* Soft logo-blue highlight on hover */
    --bg-body-start: #f1f5f9;
    --bg-body-end: #e2e8f0;
    
    --text-primary: #0f172a;         /* Dark slate text */
    --text-secondary: #475569;       /* Muted slate text */
    --text-muted: #64748b;           /* Soft muted slate text */
    
    --color-green: #10b981;
    --color-yellow: #f59e0b;         /* Amber yellow for contrast on light background */
    --color-red: #ef4444;
    --color-gray: #64748b;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --shadow-glow-green: 0 0 12px rgba(16, 185, 129, 0.15);
    --shadow-glow-yellow: 0 0 12px rgba(245, 158, 11, 0.15);
    --shadow-glow-red: 0 0 12px rgba(239, 68, 68, 0.15);
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode {
    --bg-main: #0f172a;              /* Dark slate-black background */
    --bg-sidebar: #1e293b;           /* Muted dark slate sidebar */
    --bg-card: #1e293b;              /* Dark card background */
    --bg-card-hover: #334155;        /* Dark hover slate-grey */
    --border-color: #334155;         /* Dark border color */
    --border-hover: rgba(96, 165, 250, 0.3); /* Blue hover glow */
    --bg-body-start: #0f172a;
    --bg-body-end: #020617;
    
    --text-primary: #f8fafc;         /* White text */
    --text-secondary: #cbd5e1;       /* Light grey secondary text */
    --text-muted: #94a3b8;           /* Muted grey text */
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

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

body {
    background: radial-gradient(circle at 60% 30%, var(--bg-body-start) 0%, var(--bg-body-end) 100%);
    color: var(--text-primary);
    font-family: var(--font-body);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* Sidebar layout */
.sidebar {
    width: 270px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-shrink: 0;
}

.logo-container {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.logo-img {
    height: 26px;
    border-radius: 4px;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #60a5fa, #ffffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Rollup Card (Looking for Healthy Intro Card) */
.rollup-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 24px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
}

.rollup-info h2 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.rollup-info p {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
    max-width: 650px;
}

.rollup-gauge-container {
    flex-shrink: 0;
}

.kpi-gauge-box {
    position: relative;
    width: 94px;
    height: 94px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.kpi-gauge-svg {
    transform: rotate(-90deg);
}

.kpi-gauge-bg {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 8;
}

.kpi-gauge-bar {
    fill: none;
    stroke: var(--color-green);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 238.7; /* Circumference of circle with r=38 */
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.5s ease;
}

.kpi-gauge-number {
    position: absolute;
    font-family: var(--font-heading);
    display: flex;
    flex-direction: column;
    align-items: center;
}

#rollup-score-text {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
}

.kpi-gauge-pct-lbl {
    font-size: 8px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-top: -2px;
}

.project-selector-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px 20px;
}

/* ---- EPS tree selector ---- */
.epssel {
    position: relative;
    width: 100%;
}
.epsfield {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 13px;
    color: #ffffff;
    cursor: pointer;
    text-align: left;
    transition: var(--transition-fast);
}
.epsfield:hover {
    border-color: #60a5fa;
    background-color: rgba(255, 255, 255, 0.08);
}
.epsfield .epscur {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.epsfield .epscur .eb {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: #7dd3fc;
    background: rgba(14, 26, 48, 0.5);
    border: 1px solid rgba(39, 75, 99, 0.5);
    border-radius: 4px;
    padding: 1px 5px;
    flex: none;
}
.epsfield .chev {
    color: rgba(255, 255, 255, 0.4);
    font-size: 11px;
    flex: none;
}
.epspanel {
    position: absolute;
    z-index: 60;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    padding: 6px;
}
.epspanel[hidden] {
    display: none;
}
.epsrow {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 8px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    user-select: none;
    color: rgba(255, 255, 255, 0.8);
    transition: var(--transition-fast);
}
.epsrow:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}
.epsrow.node {
    font-weight: 600;
    color: #ffffff;
}
.epsrow.leaf {
    color: rgba(255, 255, 255, 0.6);
}
.epsrow.leaf.sel {
    background: rgba(59, 130, 246, 0.25);
    color: #ffffff;
    box-shadow: inset 3px 0 0 #3b82f6;
}
.epsrow .tw {
    width: 13px;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    flex: none;
    font-size: 10px;
}
.epsrow .ic {
    flex: none;
    opacity: .9;
}
.epsrow .ct {
    margin-left: auto;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 1px 6px;
    flex: none;
}
.epschildren.collapsed {
    display: none;
}

.search-project-input {
    width: 100%;
    padding: 10px 14px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: #ffffff;
    font-family: var(--font-body);
    font-size: 13px;
    outline: none;
    margin-bottom: 12px;
    transition: var(--transition-fast);
}

.search-project-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.search-project-input:focus {
    border-color: #60a5fa;
    background-color: rgba(255, 255, 255, 0.1);
}

.project-list-title {
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 6px;
}

/* Scrollable Project List inside sidebar */
.project-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-right: 4px;
}

/* Sidebar project list scrollbar */
.project-list::-webkit-scrollbar {
    width: 4px;
}
.project-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.01);
    border-radius: 2px;
}
.project-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
}
.project-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}

.project-item {
    position: relative;
    padding: 10px 14px 10px 22px; /* Leave space for left indicator bar */
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    transition: all var(--transition-fast);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid transparent;
    margin-bottom: 2px;
    background-color: rgba(255, 255, 255, 0.02);
}

/* Vertical indicator bar */
.project-item::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 14px;
    border-radius: 2px;
    transition: height var(--transition-fast), background-color var(--transition-fast);
}

.project-item.status-green::before {
    background-color: var(--color-green);
}
.project-item.status-yellow::before {
    background-color: var(--color-yellow);
}
.project-item.status-red::before {
    background-color: var(--color-red);
}

.project-item:hover::before {
    height: 20px;
}

.project-item:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    transform: translateX(2px);
}

.project-item.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
}

.project-item.active::before {
    height: 20px;
    width: 5px;
    left: 7px;
}

.project-kpi-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid transparent;
    transition: var(--transition-fast);
}

.project-item.status-green .project-kpi-badge,
.epsrow.leaf.status-green .project-kpi-badge {
    border-color: rgba(16, 185, 129, 0.35);
    background-color: rgba(16, 185, 129, 0.08);
    color: var(--color-green);
}
.project-item.status-yellow .project-kpi-badge,
.epsrow.leaf.status-yellow .project-kpi-badge {
    border-color: rgba(245, 158, 11, 0.35);
    background-color: rgba(245, 158, 11, 0.08);
    color: var(--color-yellow);
}
.project-item.status-red .project-kpi-badge,
.epsrow.leaf.status-red .project-kpi-badge {
    border-color: rgba(239, 68, 68, 0.35);
    background-color: rgba(239, 68, 68, 0.08);
    color: var(--color-red);
}

.project-item.active .project-kpi-badge {
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.2);
}

.upload-section {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background-color: rgba(0, 0, 0, 0.12);
}

.upload-title {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 6px;
}

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
}

.btn-upload {
    width: 100%;
    padding: 10px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: var(--transition-fast);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.btn-upload:hover {
    border-color: #60a5fa;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.25);
}

.btn-upload.drag-over {
    border-color: #60a5fa;
    color: #ffffff;
    background: rgba(59, 130, 246, 0.15);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

.file-input-wrapper input[type=file] {
    font-size: 100px;
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    cursor: pointer;
}

/* Main Dashboard Panel */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px 24px;
    overflow-y: auto;
}

/* Compact Header Layout */
.header-area {
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    flex-shrink: 0;
}

.project-info-block {
    display: flex;
    align-items: center;
    gap: 16px;
}

.project-title-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.project-info-block h1 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    line-height: 1.15;
}

.project-desc-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 3px;
    opacity: 0.95;
}

.data-date-pill {
    background-color: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.15);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: #2563eb;
}

/* Horizontal Statistics Ribbon */
.stats-ribbon {
    display: flex;
    gap: 12px;
    align-items: center;
}

.ribbon-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    box-shadow: var(--shadow-sm);
}

.ribbon-label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.ribbon-val {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ribbon-bl-val {
    font-size: 9px;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 1px;
    font-family: var(--font-body);
}

.project-baseline-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 2px;
    opacity: 0.85;
}
body.dark-mode .project-baseline-subtitle {
    color: var(--text-muted);
}

.project-labor-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 3px;
    opacity: 0.9;
    line-height: 1.5;
}
body.dark-mode .project-labor-subtitle {
    color: var(--text-muted);
}

/* 6-Column Compact Grid Layout */
.grid-section {
    flex: 1;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

/* Section Title style */
.section-title {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Compact Metric Card - Horizontal Row Layout */
.metric-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 12px;
    height: 96px; /* Optimized height for 14-inch screens */
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
    cursor: pointer;
}

.metric-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.metric-card-details {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    flex: 1;
    min-width: 0; /* Prevents text overflow */
}

.metric-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.metric-card-num-box {
    display: flex;
    align-items: center;
    gap: 6px;
}

.metric-card-num {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-muted);
    background-color: #f1f5f9;
    padding: 2px 5px;
    border-radius: 4px;
    flex-shrink: 0;
}

.metric-card-title {
    font-family: var(--font-heading);
    font-size: 11px; /* Slightly smaller to fit 14-inch screens */
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 30px; /* Fixed height for consistent layout alignment */
    margin-top: 4px;
}

.metric-card-counts {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: auto; /* Push to bottom */
}

.metric-card-counts span {
    font-weight: 600;
    color: var(--text-primary);
}

/* Compliance rate pill styling (bordered and filled badge) */
.metric-card-score {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 62px;
    height: 44px;
    flex-shrink: 0;
}

.metric-card-score.score-green {
    border-color: rgba(16, 185, 129, 0.35);
    background-color: rgba(16, 185, 129, 0.08);
    color: var(--color-green);
}

.metric-card-score.score-yellow {
    border-color: rgba(245, 158, 11, 0.35);
    background-color: rgba(245, 158, 11, 0.08);
    color: var(--color-yellow);
}

.metric-card-score.score-red {
    border-color: rgba(239, 68, 68, 0.35);
    background-color: rgba(239, 68, 68, 0.08);
    color: var(--color-red);
}

.metric-card-score.score-gray {
    border-color: rgba(100, 116, 139, 0.35);
    background-color: rgba(100, 116, 139, 0.08);
    color: var(--color-gray);
}

.metric-card-score span:first-child {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.1;
}

.metric-card-score .score-lbl {
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

/* Legend Card Styling */
.legend-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 12px;
    height: 96px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
}

.legend-title {
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 9px;
    color: var(--text-secondary);
}

.legend-color-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-green { background-color: var(--color-green); box-shadow: 0 0 4px rgba(16, 185, 129, 0.4); }
.legend-yellow { background-color: var(--color-yellow); box-shadow: 0 0 4px rgba(245, 158, 11, 0.4); }
.legend-red { background-color: var(--color-red); box-shadow: 0 0 4px rgba(239, 68, 68, 0.4); }

/* Circle indicators in cards */
.status-indicator {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    display: inline-block;
}
.bg-green { background-color: var(--color-green); }
.bg-yellow { background-color: var(--color-yellow); }
.bg-red { background-color: var(--color-red); }
.bg-gray { background-color: var(--color-gray); }

/* Tooltip container styling */
.tooltip-info-icon {
    position: relative; /* Context for absolute tooltip positioning */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 1px solid var(--text-muted);
    font-size: 8px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: help;
}

.tooltip-info-icon:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
}

.tooltip-info-icon .tooltip-text {
    visibility: hidden;
    position: absolute;
    z-index: 100;
    width: 200px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    text-align: left;
    padding: 10px;
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    left: 50%;
    transform: translateX(-50%);
    bottom: 20px;
}

.tooltip-info-icon:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Detail Drawer styling */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.detail-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 50%;
    max-width: 800px;
    min-width: 450px;
    height: 100vh;
    background-color: var(--bg-card);
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 30px rgba(15, 23, 42, 0.05);
    z-index: 101;
    transform: translateX(100%);
    transition: transform var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.detail-drawer.open {
    transform: translateX(0);
}

.drawer-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-title-box h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.drawer-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.btn-close-drawer {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition-fast);
    padding: 2px 10px;
    border-radius: 4px;
}

.btn-close-drawer:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.drawer-controls {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.drawer-search {
    flex: 1;
    padding: 8px 14px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 12px;
    outline: none;
    transition: var(--transition-fast);
}

.drawer-search:focus {
    border-color: #2563eb;
    background-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.btn-export {
    background-color: #1d4ed8;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 14px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-export:hover {
    background-color: #2563eb;
}

.drawer-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.violations-count-summary {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.violations-count-summary span {
    font-weight: 700;
    color: var(--color-red);
}

/* Violation detail table styling */
.violation-table-container {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.violation-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    text-align: left;
}

.violation-table th {
    background-color: var(--bg-main);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 12px;
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.violation-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.violation-table tr:last-child td {
    border-bottom: none;
}

.violation-table tr:hover td {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
}

.violation-table code {
    background-color: #eff6ff;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 11px;
    color: #1d4ed8;
    border: 1px solid #dbeafe;
}

.no-violations-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.no-violations-icon {
    font-size: 36px;
    color: var(--color-green);
    margin-bottom: 12px;
}

.no-violations-title {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

/* Loading Spinner Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-main);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(59, 130, 246, 0.1);
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Theme Toggle styles */
.theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    padding: 0;
    margin-left: 8px;
}
.theme-toggle:hover {
    border-color: var(--border-hover);
    transform: scale(1.05);
}
.theme-toggle .toggle-icon-light {
    display: none;
    font-size: 14px;
}
.theme-toggle .toggle-icon-dark {
    display: block;
    font-size: 14px;
}
body.dark-mode .theme-toggle .toggle-icon-light {
    display: block;
}
body.dark-mode .theme-toggle .toggle-icon-dark {
    display: none;
}

/* Drag overlay styles */
.drag-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(38, 57, 87, 0.9);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    color: #ffffff;
    border: 4px dashed rgba(255, 255, 255, 0.4);
    margin: 10px;
    box-sizing: border-box;
    border-radius: 12px;
}
.drag-overlay.active {
    display: flex;
}
.drag-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
}
.drag-icon {
    font-size: 48px;
}

/* Badges for metric cards */
.metric-badge {
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid transparent;
    display: inline-block;
}
.badge-dcma {
    background-color: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.2);
    color: #2563eb;
}
body.dark-mode .badge-dcma {
    background-color: rgba(96, 165, 250, 0.15);
    border-color: rgba(96, 165, 250, 0.3);
    color: #60a5fa;
}

.badge-bp {
    background-color: rgba(100, 116, 139, 0.08);
    border-color: rgba(100, 116, 139, 0.2);
    color: #64748b;
}
body.dark-mode .badge-bp {
    background-color: rgba(148, 163, 184, 0.15);
    border-color: rgba(148, 163, 184, 0.3);
    color: #cbd5e1;
}

.badge-prop {
    background-color: rgba(219, 39, 119, 0.08);
    border-color: rgba(219, 39, 119, 0.2);
    color: #db2777;
}
body.dark-mode .badge-prop {
    background-color: rgba(244, 114, 182, 0.15);
    border-color: rgba(244, 114, 182, 0.3);
    color: #f472b6;
}

/* Ensure metric-card-num-box aligns items */
.metric-card-num-box {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Public showcase overrides (awplabs.cl) ──
   Navigate-only demo: preloaded P6 sample programs, DB upload hidden. */
.upload-section { display: none !important; }
#drag-overlay { display: none !important; }
.logo-container:hover .logo-back { color: #60a5fa !important; }
