:root {
    color-scheme: dark;
    --bg: #0b1120;
    --surface: #111827;
    --surface-raised: #182235;
    --border: #263449;
    --text: #e5edf7;
    --muted: #91a0b5;
    --accent: #36c7b2;
    --accent-hover: #55dfc9;
    --danger: #f07178;
    --success: #42c99a;
    --warning: #e8b65b;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.muted {
    color: var(--muted);
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.8px;
}

.login-screen {
    display: grid;
    min-height: 100vh;
    padding: 24px;
    place-items: center;
    background:
        radial-gradient(ellipse at 50% 0%, #173447 0%, transparent 55%),
        var(--bg);
}

.login-card {
    display: flex;
    width: 100%;
    max-width: 400px;
    flex-direction: column;
    padding: 36px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 24px 80px #0005;
}

.brand-mark {
    display: grid;
    width: 44px;
    height: 44px;
    margin-bottom: 24px;
    place-items: center;
    border-radius: 12px;
    background: #153d42;
    color: var(--accent);
    font-size: 17px;
    font-weight: 800;
}

.login-card h1 {
    margin: 0;
    font-size: 28px;
}

.login-card > .muted {
    margin: 10px 0 28px;
    font-size: 14px;
}

label {
    margin: 16px 0 8px;
    color: var(--muted);
    font-size: 13px;
}

input,
select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    background: #0d1625;
    color: var(--text);
}

input:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px #36c7b21c;
}

.primary-button,
.secondary-button {
    min-height: 42px;
    padding: 0 18px;
    border-radius: 8px;
    font-weight: 650;
}

.primary-button {
    border: 0;
    background: var(--accent);
    color: #08201e;
}

.primary-button:hover {
    background: var(--accent-hover);
}

.login-card .primary-button {
    margin-top: 24px;
}

.secondary-button {
    border: 1px solid var(--border);
    background: var(--surface-raised);
    color: var(--text);
}

.secondary-button:hover {
    border-color: var(--accent);
}

.error-message {
    min-height: 18px;
    margin: 10px 0 0;
    color: var(--danger);
    font-size: 13px;
}

.app-screen {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    width: 250px;
    flex-direction: column;
    padding: 26px 18px;
    border-right: 1px solid var(--border);
    background: var(--surface);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 32px;
}

.sidebar-brand .brand-mark {
    flex-shrink: 0;
    margin: 0;
}

.sidebar-brand strong,
.sidebar-brand span {
    display: block;
}

.sidebar-brand strong {
    font-size: 14px;
    letter-spacing: 1px;
}

.sidebar-brand span {
    margin-top: 5px;
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 1.4px;
}

.navigation {
    display: grid;
    gap: 6px;
}

.nav-item {
    min-height: 44px;
    padding: 0 13px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    text-align: left;
}

.nav-item:hover {
    background: var(--surface-raised);
    color: var(--text);
}

.nav-item.active {
    border-color: #36c7b22b;
    background: #36c7b215;
    color: var(--accent);
}

.sidebar-footer {
    display: flex;
align-items: center;
    gap: 9px;
    margin-top: auto;
    padding: 16px 8px;
    color: var(--muted);
    font-size: 12px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 10px #42c99a66;
}

.main-content {
    width: calc(100% - 250px);
    min-width: 0;
    margin-left: 250px;
    padding: 34px 40px;
}

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

.topbar h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 650;
}

.page-content {
    padding-top: 28px;
}

.loading-state,
.empty-state,
.error-state {
    padding: 32px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--muted);
    text-align: center;
}

.error-state {
    color: var(--danger);
}

.dashboard-section-title {
    margin: 28px 0 16px;
    font-size: 17px;
    font-weight: 650;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.metric-card {
    min-width: 0;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.metric-card h3 {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.metric-value {
    margin: 0 0 12px;
    color: var(--text);
    font-size: clamp(20px, 2vw, 28px);
    font-weight: 700;
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
}

.metric-card .muted {
    font-size: 12px;
}

.project-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
}

.project-table {
    width: 100%;
    min-width: 620px;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.project-table th,
.project-table td {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.project-table th {
    color: var(--muted);
    background: var(--surface-raised);
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
}

.project-table td {
    color: var(--text);
    font-size: 14px;
}

.project-table tbody tr:last-child td {
    border-bottom: 0;
}

.project-table tbody tr:hover {
    background: var(--surface-raised);
}

.project-table td:first-child {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

@media (max-width: 760px) {
    .project-table th,
    .project-table td {
        padding: 12px 10px;
        font-size: 12px;
    }
}

@media (max-width: 1100px) {
    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .app-screen {
        display: block;
    }

    .sidebar {
        position: static;
        width: 100%;
        padding: 14px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-brand {
        padding: 0 4px 14px;
    }

    .navigation {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .nav-item {
        font-size: 13px;
    }

    .sidebar-footer {
        display: none;
    }

    .main-content {
        width: 100%;
        margin: 0;
        padding: 24px 16px;
    }

    .topbar h1 {
        font-size: 22px;
    }

    .login-card {
        padding: 26px;
    }
}
