:root {
    color-scheme: light dark;
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #eef1f5;
    --text: #171a1f;
    --muted: #667085;
    --border: #d9dee7;
    --accent: #1d6f5f;
    --accent-strong: #145447;
    --danger: #b42318;
    --success: #087443;
    --shadow: 0 12px 32px rgba(15, 23, 42, 0.07);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #111418;
        --surface: #191d23;
        --surface-2: #232933;
        --text: #edf1f7;
        --muted: #a4acb9;
        --border: #333b48;
        --accent: #42b39a;
        --accent-strong: #62d6bc;
        --shadow: none;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: "Work Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    letter-spacing: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 0;
    border-radius: 7px;
    padding: 0 16px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.button.small {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
}

button.ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
}

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

.sidebar {
    border-right: 1px solid var(--border);
    background: var(--surface);
    padding: 22px 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    margin-bottom: 28px;
}

.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: contain;
}

nav {
    display: grid;
    gap: 4px;
}

nav a {
    padding: 10px 12px;
    border-radius: 7px;
    color: var(--muted);
    font-weight: 500;
}

nav a.active,
nav a:hover {
    background: var(--surface-2);
    color: var(--text);
}

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

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

.topbar h1,
.auth-card h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.2;
}

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

.eyebrow {
    margin: 0 0 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
}

.notice {
    border-radius: 7px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.notice.success {
    color: var(--success);
}

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

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

.metric,
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.metric {
    padding: 18px;
}

.metric span {
    display: block;
    color: var(--muted);
    margin-bottom: 8px;
}

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

.panel {
    padding: 18px;
    margin-bottom: 18px;
}

.panel.narrow {
    max-width: 720px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.panel h2 {
    margin: 0 0 14px;
    font-size: 18px;
}

.panel-head h2 {
    margin: 0;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

th,
td {
    text-align: left;
    padding: 11px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

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

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 0 10px;
    background: var(--surface-2);
    color: var(--text);
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

.form {
    display: grid;
    gap: 14px;
}

.form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-weight: 600;
}

.form label.check {
    display: flex;
    align-items: center;
    gap: 8px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text);
    min-height: 42px;
    padding: 9px 11px;
    font: inherit;
}

textarea {
    resize: vertical;
}

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

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

.auth-card {
    width: min(440px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 28px;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.auth-logo {
    width: 58px;
    height: 58px;
    object-fit: contain;
    flex: 0 0 auto;
}

.auth-wordmark {
    width: min(220px, calc(100% - 72px));
    height: auto;
    object-fit: contain;
}

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

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--border);
        padding: 14px;
    }

    nav {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    nav a {
        white-space: nowrap;
    }

    .main {
        padding: 18px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .metric-grid,
    .split {
        grid-template-columns: 1fr;
    }
}
