/* Lab Budget Tracker — CSS */
:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --accent: #2563eb;
    --accent-light: #dbeafe;
    --green: #16a34a;
    --green-light: #dcfce7;
    --red: #dc2626;
    --red-light: #fee2e2;
    --yellow: #d97706;
    --yellow-light: #fef3c7;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* Nav */
.nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
    margin-right: 2rem;
    color: var(--accent);
}
.nav-links { display: flex; gap: 0.25rem; }
.nav-link {
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
}
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: var(--accent-light); color: var(--accent); }
.nav-logout { margin-left: auto; }

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

h1 { font-size: 1.5rem; margin-bottom: 1rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 0.75rem; color: var(--text); }
h3 { font-size: 1rem; margin: 1rem 0 0.5rem; }

/* Cards */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
}
.card-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.25rem;
}
.card-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.card-value-sm {
    font-size: 1rem;
    font-weight: 600;
}
.card-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
    margin-bottom: 1rem;
}
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
}
th, td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
th {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    background: var(--bg);
}
.num { text-align: right; font-variant-numeric: tabular-nums; }
td a { color: var(--accent); text-decoration: none; font-weight: 500; }
td a:hover { text-decoration: underline; }
.row-total { font-weight: 700; background: var(--bg); }
table.compact td, table.compact th { padding: 0.3rem 0.5rem; font-size: 0.85rem; }

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.status-active { background: var(--green-light); color: var(--green); }
.status-funded { background: var(--accent-light); color: var(--accent); }
.status-completed { background: var(--bg); color: var(--text-muted); }
.status-submitted { background: var(--yellow-light); color: var(--yellow); }
.status-planned { background: #f3e8ff; color: #7c3aed; }
.status-not_funded { background: var(--red-light); color: var(--red); }

.count-badge {
    display: inline-block;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.1rem 0.5rem;
    border-radius: 12px;
    font-weight: 500;
    vertical-align: middle;
}

/* Burn bars */
.burn-bar {
    width: 80px;
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}
.burn-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.3s;
}
.burn-warning { background: var(--yellow); }
.burn-danger { background: var(--red); }

/* Text colors */
.text-danger { color: var(--red); }
.text-warning { color: var(--yellow); }
.text-success { color: var(--green); }

/* Alerts */
.alerts-section { margin-bottom: 1.5rem; }
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}
.alert-danger { background: var(--red-light); color: var(--red); border-left: 3px solid var(--red); }
.alert-warning { background: var(--yellow-light); color: var(--yellow); border-left: 3px solid var(--yellow); }
.alert-success { background: var(--green-light); color: var(--green); border-left: 3px solid var(--green); }
.alert-error { background: var(--red-light); color: var(--red); border-left: 3px solid var(--red); }

/* Charts */
.chart-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    max-height: 400px;
}

/* Login */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    width: 360px;
    text-align: center;
    box-shadow: var(--shadow);
}
.login-card h1 { font-size: 1.3rem; margin-bottom: 0.25rem; }
.login-subtitle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }
.login-card input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    margin-bottom: 1rem;
}
.login-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.login-card button, button[type="submit"] {
    width: 100%;
    padding: 0.6rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}
.login-card button:hover, button[type="submit"]:hover { background: #1d4ed8; }

/* Upload */
.upload-area {
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.upload-area:hover, .upload-area.drag-over {
    border-color: var(--accent);
    background: var(--accent-light);
}
.upload-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.upload-area p { color: var(--text-muted); margin-bottom: 1rem; }
.upload-area input[type="file"] { display: none; }
.upload-area button {
    width: auto;
    padding: 0.5rem 1.5rem;
}
.upload-area button:disabled { opacity: 0.5; cursor: not-allowed; }
.upload-help {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.upload-help h3 { margin-top: 0; }
.upload-help ul { padding-left: 1.25rem; }
.upload-help li { margin-bottom: 0.35rem; font-size: 0.9rem; }

/* Detail page */
.detail-header { margin-bottom: 1rem; }
.back-link { color: var(--text-muted); text-decoration: none; font-size: 0.85rem; }
.back-link:hover { color: var(--accent); }
.notes-box {
    background: var(--yellow-light);
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* Person cards */
.person-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}
.person-card h2 { font-size: 1.1rem; margin-bottom: 0.25rem; }
.emp-number { font-size: 0.8rem; color: var(--text-muted); font-weight: 400; }
.person-role { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.5rem; }

/* Effort table */
.effort-table .month-col { min-width: 36px; font-size: 0.75rem; }
.has-effort { background: var(--accent-light); font-weight: 600; color: var(--accent); }

.empty-state { color: var(--text-muted); font-style: italic; }

/* Responsive */
@media (max-width: 768px) {
    .nav { padding: 0 0.75rem; }
    .nav-brand { margin-right: 1rem; font-size: 0.95rem; }
    .nav-link { padding: 0.4rem 0.5rem; font-size: 0.8rem; }
    .container { padding: 1rem; }
    .cards { grid-template-columns: repeat(2, 1fr); }
}
