:root {
    color-scheme: light;
    --bg: #f6f7f9;
    --panel: #ffffff;
    --text: #17202a;
    --muted: #647082;
    --line: #d8dee8;
    --primary: #1d4ed8;
    --primary-dark: #173ea8;
    --danger: #b42318;
    --warn: #a15c07;
    --ok: #067647;
}

* {
    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;
    text-decoration: none;
}

main {
    width: min(1320px, calc(100% - 32px));
    margin: 24px auto;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.brand {
    font-weight: 750;
}

.topbar nav {
    display: flex;
    gap: 10px;
}

.topbar nav a,
.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--primary);
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

.topbar nav a,
.button.secondary {
    background: #fff;
    color: var(--primary);
}

button:hover,
.button:hover {
    background: var(--primary-dark);
    color: #fff;
}

.grid {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.panel,
.auth-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
}

.panel.narrow,
.auth-panel {
    width: min(520px, 100%);
    margin: 64px auto;
}

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

h1,
h2 {
    margin: 0 0 12px;
    line-height: 1.15;
}

.panel-head h2 {
    margin-bottom: 4px;
}

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

.alert {
    padding: 10px 12px;
    border-radius: 6px;
}

.alert.error {
    background: #fef3f2;
    color: var(--danger);
    border: 1px solid #fecdca;
}

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

label {
    display: grid;
    gap: 6px;
    color: #344054;
    font-size: 0.92rem;
    font-weight: 650;
}

.inline-check {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 32px;
}

.inline-check input {
    width: auto;
    min-height: auto;
}

input,
select,
textarea {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 10px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-weight: 500;
}

textarea {
    resize: vertical;
}

.project-list {
    display: grid;
    gap: 8px;
}

.project {
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.project.active {
    border-color: var(--primary);
    background: #eff6ff;
}

.project span {
    color: var(--muted);
    font-size: 0.9rem;
}

.toolbar {
    display: grid;
    grid-template-columns: 90px 130px 190px 160px 110px auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.export-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: -4px 0 18px;
    padding: 12px;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    background: #eff6ff;
}

.export-bar span {
    margin-right: 6px;
    color: #1e3a8a;
    font-weight: 750;
}

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

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

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

th {
    color: #475467;
    font-size: 0.84rem;
    text-transform: uppercase;
}

code {
    display: inline-block;
    padding: 3px 6px;
    border-radius: 4px;
    background: #eef2f6;
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: 0.92rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 750;
}

.badge.ok {
    color: var(--ok);
    background: #ecfdf3;
}

.badge.bad {
    color: var(--danger);
    background: #fef3f2;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 360px;
}

.actions form {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.actions input {
    width: 170px;
}

button.small {
    min-height: 32px;
    padding: 0 10px;
    font-size: 0.85rem;
}

button.warn {
    background: var(--warn);
    border-color: var(--warn);
}

button.danger {
    background: var(--danger);
    border-color: var(--danger);
}

@media (max-width: 980px) {
    .grid,
    .toolbar {
        grid-template-columns: 1fr;
    }

    .actions {
        min-width: 0;
    }
}

@media (max-width: 640px) {
    main {
        width: min(100% - 20px, 1320px);
        margin: 16px auto;
    }

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

    .topbar nav {
        width: 100%;
    }

    .topbar nav a {
        flex: 1;
    }

    .panel,
    .auth-panel {
        padding: 14px;
    }
}
