:root {
    --color-pass: #22c55e;
    --color-fail: #ef4444;
    --color-untested: #9ca3af;
    --color-bg: #f5f5f5;
    --color-card: white;
    --color-border: #e5e7eb;
    --color-text: #1f2937;
    --color-text-light: #6b7280;
    --color-primary: #3b82f6;
}

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

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

/* Main Container */
.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 1rem;
}

/* Dashboard */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.dashboard-header h2 {
    margin: 0;
    color: var(--color-text);
    font-size: 1.5rem;
}

.dashboard-nav {
    display: flex;
    gap: 0.5rem;
}

.dashboard-nav .btn {
    display: inline-block;
    padding: 6px 12px;
    font-size: 12px;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background-color: #6c757d;
    color: white;
}

.dashboard-nav .btn:hover {
    background-color: #5a6268;
}

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

.stat-card {
    background: var(--color-card);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card.pass .stat-value {
    color: var(--color-pass);
}

.stat-card.fail .stat-value {
    color: var(--color-fail);
}

.stat-card.untested .stat-value {
    color: var(--color-untested);
}

/* Wide Table Wrapper - scrolls both X and Y so sticky header works inside */
.table-wrapper {
    background: var(--color-card);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: auto;
    width: min(100vw - 2rem, 1768px);
    height: calc(100vh - 180px);
    position: relative;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    align-items: center;
}

.filter-bar input,
.filter-bar select {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 0.8rem;
}

.filter-bar input[type="text"] {
    width: 220px;
}

.filter-checkbox {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
}

/* Wide Table */
.wide-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    border: 2px solid #9ca3af;
}

.wide-table thead {
    background: #f9fafb;
}

.wide-table th {
    padding: 0.5rem 0.4rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.7rem;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid var(--color-border);
    background: #f9fafb;
    white-space: nowrap;
}

/* Ensure sticky header works properly - stick to top */
.wide-table thead th {
    position: -webkit-sticky;
    position: sticky;
    z-index: 10;
    background: #f9fafb;
}

.wide-table thead tr:first-child th {
    top: 0;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
}

.wide-table thead tr:nth-child(2) th {
    top: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.wide-table thead tr {
    background: #f9fafb;
}

.wide-table th.platform-group-header {
    background: #d1d5db;
    color: #1f2937;
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
    border-left: 2px solid #9ca3af;
    border-right: 2px solid #9ca3af;
}

.wide-table th.version-header {
    background: #e0e7ff;
    color: var(--color-primary);
    font-size: 0.7rem;
    padding: 0.3rem 0.2rem;
    line-height: 1.2;
    min-width: 35px;
}

/* Visual separator between platform groups */
.platform-start {
    border-left: 2px solid #9ca3af !important;
}

.wide-table td {
    padding: 0.4rem 0.4rem;
    border: 1px solid var(--color-border);
    font-size: 0.7rem;
}

.wide-table tbody tr:hover {
    background: #f9fafb;
}

/* Sticky First Column */
.sticky-col {
    position: sticky;
    left: 0;
    background: white;
    z-index: 5;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
    font-weight: 500;
    text-align: left !important;
    min-width: 140px;
    max-width: 180px;
}

/* Sticky column in header needs higher z-index */
.wide-table thead .sticky-col {
    z-index: 15;
    background: #f9fafb;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.wide-table tbody tr:hover .sticky-col {
    background: #f9fafb;
}

/* Cell Types */
.function-name {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
}

.function-name a {
    color: var(--color-primary);
    text-decoration: none;
}

.function-name a:hover {
    text-decoration: underline;
}

.function-name .tc-link {
    text-decoration: none;
    font-size: 0.7rem;
    opacity: 0.7;
}

.function-name .tc-link:hover {
    opacity: 1;
    text-decoration: none;
}

.file-path {
    font-size: 0.65rem;
    color: var(--color-text-light);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.numeric {
    text-align: center;
    font-family: monospace;
}

.commit {
    font-family: monospace;
    font-size: 0.65rem;
    text-align: center;
}

.test-cell {
    text-align: center;
    padding: 0.3rem 0.2rem;
    background: white;
    min-width: 35px;
}

.test-cell.out-of-range {
    background: #f0f0f0;
}

.test-cell.outdated-code {
    background: #ffccbc;
}

.test-cell.outdated-tc {
    background: #fff9c4;
}

.all-pass-cell {
    text-align: center;
    padding: 0.3rem 0.4rem;
    background: white;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    font-size: 1rem;
    font-weight: 700;
}

.status-badge.pass {
    color: #16a34a;
}

.status-badge.fail {
    color: var(--color-fail);
}

.status-badge.untested {
    color: var(--color-untested);
}

a.status-badge {
    text-decoration: none;
}
a.status-badge:hover {
    opacity: 0.7;
}

.status-badge.pass.coverage {
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Maturity Column */
.maturity-cell {
    text-align: center;
    padding: 0.3rem 0.4rem;
    background: white;
}

.maturity-badge {
    display: inline-block;
    width: 1.4em;
    height: 1.4em;
    line-height: 1.4em;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
    color: white;
}

.maturity-badge.maturity-4 {
    background: #16a34a;
}

.maturity-badge.maturity-3 {
    background: #f59e0b;
}

.maturity-badge.maturity-2 {
    background: #f97316;
}

.maturity-badge.maturity-1 {
    background: #ef4444;
}

.maturity-badge.maturity-null {
    background: none;
    color: #9ca3af;
}

/* Review Table */
.review-count {
    font-size: 1rem;
    font-weight: 400;
    color: var(--color-text-light);
}

.review-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    border: 2px solid #9ca3af;
}

.review-table th {
    padding: 0.6rem 0.8rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid var(--color-border);
    background: #f9fafb;
    position: sticky;
    top: 0;
    z-index: 10;
}

.review-table td {
    padding: 0.5rem 0.8rem;
    border: 1px solid var(--color-border);
    vertical-align: top;
}

.review-table tbody tr:hover {
    background: #f9fafb;
}

.review-log {
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
    background: #f8f8f8;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
}

.btn-dismiss {
    padding: 4px 12px;
    font-size: 0.75rem;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-dismiss:hover {
    background: #dc2626;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--color-text-light);
}

/* Footer */
footer {
    text-align: center;
    padding: 1rem;
    color: var(--color-text-light);
    font-size: 0.875rem;
}

/* Code Viewer */
.code-viewer {
    background: var(--color-card);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.code-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
    background: #f9fafb;
}

.code-header h2 {
    margin: 0;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
}

.code-meta {
    font-size: 0.8rem;
    color: var(--color-text-light);
}

.btn-back {
    margin-left: auto;
    padding: 4px 12px;
    font-size: 0.75rem;
    background: #6c757d;
    color: white;
    text-decoration: none;
    border-radius: 4px;
}

.btn-back:hover {
    background: #5a6268;
}

.code-container {
    overflow: auto;
    max-height: calc(100vh - 160px);
}

.code-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    tab-size: 4;
}

.code-table td {
    padding: 0 0.5rem;
    white-space: pre;
    vertical-align: top;
}

.code-table .line-number {
    width: 1px;
    min-width: 3.5rem;
    text-align: right;
    color: #9ca3af;
    user-select: none;
    border-right: 1px solid var(--color-border);
    background: #f9fafb;
}

.code-table .line-number a {
    color: inherit;
    text-decoration: none;
}

.code-table .line-number a:hover {
    color: var(--color-primary);
}

.code-table tr:target {
    background: #fffbeb;
}

.code-table tr:target .line-number {
    background: #fef3c7;
    color: #92400e;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-content {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .container {
        padding: 0 0.5rem;
        margin: 1rem auto;
    }

    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .wide-table {
        font-size: 0.65rem;
    }

    .wide-table th,
    .wide-table td {
        padding: 0.3rem 0.2rem;
    }

    .sticky-col {
        min-width: 150px;
        max-width: 180px;
    }
}

/* Print styles */
@media print {
    .navbar,
    .stats-cards,
    footer {
        display: none;
    }

    .wide-table {
        font-size: 8pt;
    }
}
