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

:root {
    --bg: #f8f9fa;
    --surface: #ffffff;
    --text: #1a1a2e;
    --text-muted: #6c757d;
    --heading: #1e3a5f;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --border: #e5e7eb;
    --radius: 10px;
    --shadow: 0 2px 4px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
}

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

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

/* Layout */
.app { display: flex; min-height: 100vh; }

nav {
    width: 220px;
    background: var(--text);
    color: #fff;
    padding: 1.5rem 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

nav .logo {
    font-size: 1.25rem;
    font-weight: 700;
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 1rem;
}

nav a {
    display: block;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
    transition: all 0.15s;
}

nav a:hover, nav a.active {
    color: #fff;
    background: rgba(255,255,255,0.08);
}

nav a.active { border-left: 3px solid var(--primary); }

main {
    flex: 1;
    margin-left: 220px;
    padding: 2rem;
    max-width: 1400px;
}

/* Page header */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--heading);
}

.page-header p {
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

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

.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

/* Tables */
.table-container {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 2rem;
}

.table-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}
.table-header h2 { font-size: 1.1rem; }
.table-subtitle { font-size: 0.8rem; color: var(--text-muted); }

/* Callout */
.callout {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    line-height: 1.6;
}
.callout a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}
.callout a:hover { text-decoration: underline; }

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    background: var(--bg);
}

tr:hover { background: #f1f5f9; }

td a {
    color: var(--primary);
    text-decoration: none;
}

td a:hover { text-decoration: underline; }

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-high { background: #fee2e2; color: var(--danger); }
.badge-medium { background: #fef3c7; color: var(--warning); }
.badge-low { background: #dcfce7; color: var(--success); }

/* Score bar */
.score-bar {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.score-bar .bar {
    width: 60px;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.score-bar .bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

/* Tooltip */
.tooltip-wrap {
    position: relative;
    cursor: help;
}

.tooltip-wrap .tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: var(--text);
    color: #fff;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    line-height: 1.5;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.tooltip-wrap:hover .tooltip {
    display: block;
}

.table-container {
    overflow: visible;
}

/* Charts */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.chart-card h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

/* Filters */
.filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filters select, .filters input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: var(--surface);
}

.filters select:focus, .filters input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}

/* Company profile */
.board-health {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.health-item {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.health-item .metric {
    font-size: 1.5rem;
    font-weight: 700;
}

.health-item .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Loading */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1100;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0.65rem;
    cursor: pointer;
    box-shadow: var(--shadow);
    font-size: 1.25rem;
    line-height: 1;
}

.nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
}

body.nav-open .nav-backdrop { display: block; }

/* Responsive */
@media (max-width: 768px) {
    .nav-toggle { display: block; }
    nav {
        transform: translateX(-220px);
        transition: transform 0.2s ease;
        z-index: 1000;
    }
    body.nav-open nav { transform: translateX(0); }
    main { margin-left: 0; padding: 1rem; padding-top: 4rem; }
    .chart-grid { grid-template-columns: 1fr; }
}
