:root {
    --bg: #f5f7f7;
    --panel: #ffffff;
    --text: #17201f;
    --muted: #63706d;
    --border: #dce5e2;
    --primary: #0c5a52;
    --primary-dark: #073f3a;
    --danger: #b42318;
    --warning: #9a4f1f;
    --success: #17612a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: inherit;
}

.shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    padding: 24px 18px;
    background: var(--primary-dark);
    color: #ffffff;
}

.brand {
    display: grid;
    gap: 4px;
    margin-bottom: 28px;
    color: #ffffff;
    text-decoration: none;
}

.brand strong {
    font-size: 22px;
}

.brand span {
    color: #badbd5;
    font-size: 13px;
}

.nav {
    display: grid;
    gap: 8px;
}

.nav a {
    padding: 10px 12px;
    border-radius: 8px;
    color: #dff1ed;
    text-decoration: none;
    font-weight: 700;
}

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

.main {
    min-width: 0;
    padding: 24px;
}

.topbar,
.section-head,
.panel {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding: 18px 20px;
}

.import-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding: 18px 20px;
}

.import-history {
    margin-bottom: 18px;
    padding: 18px 20px;
}

.import-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.detail-panel {
    display: grid;
    gap: 8px;
    padding: 18px;
}

.detail-panel span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.detail-panel strong {
    font-size: 20px;
}

h1,
h2,
h3,
p {
    margin: 0;
}

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

.section-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding: 20px;
}

.section-head h2 {
    margin-top: 4px;
}

.eyebrow {
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

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

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

.metric {
    display: grid;
    gap: 8px;
    min-height: 112px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    text-decoration: none;
}

.metric span {
    color: var(--muted);
    font-weight: 700;
}

.metric strong {
    font-size: 34px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
}

.table-wrap--embedded {
    margin-top: 14px;
    border-radius: 6px;
}

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

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

tr:last-child td {
    border-bottom: 0;
}

.empty-state {
    color: var(--muted);
    text-align: center;
}

.record-link {
    color: var(--primary);
    font-weight: 800;
    text-decoration: none;
}

.record-link:hover {
    text-decoration: underline;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: #eef2f7;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.badge--success {
    background: #d7f2df;
    color: var(--success);
}

.badge--warning {
    background: #fff1cf;
    color: var(--warning);
}

.badge--muted {
    background: #eef2f7;
    color: var(--muted);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 0;
    border-radius: 6px;
    background: var(--primary);
    color: #ffffff;
    font-weight: 800;
    text-decoration: none;
}

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

.button.compact {
    min-height: 30px;
    padding: 0 10px;
    font-size: 12px;
}

.auth-page {
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(420px, 100%);
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 18px 60px rgba(16, 24, 40, 0.12);
}

.auth-brand {
    display: grid;
    gap: 3px;
    margin-bottom: 22px;
}

.auth-brand strong {
    color: var(--primary);
    font-size: 24px;
}

.login-form {
    display: grid;
    gap: 14px;
    margin-top: 22px;
}

.login-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input {
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font: inherit;
}

input[type="file"] {
    width: auto;
    min-height: 38px;
    padding: 7px 10px;
    background: #ffffff;
}

.alert {
    margin-bottom: 16px;
    padding: 10px 12px;
    border-radius: 6px;
    background: #fee4e2;
    color: var(--danger);
    font-weight: 700;
}

.alert--success {
    background: #d7f2df;
    color: var(--success);
}

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

    .sidebar {
        position: static;
    }

    .metrics {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .topbar,
    .section-head,
    .import-panel,
    .import-form {
        align-items: flex-start;
        flex-direction: column;
    }

    .import-form,
    .import-form .button,
    input[type="file"] {
        width: 100%;
    }
}
