:root {
    --bg: #f6f8fb;
    --panel: #ffffff;
    --text: #172033;
    --muted: #667085;
    --line: #d9e0ea;
    --accent: #0f766e;
    --accent-dark: #115e59;
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
}

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

.brand {
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
}

.nav {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--muted);
}

.nav form {
    margin: 0;
}

.page {
    width: min(1120px, calc(100% - 32px));
    margin: 32px auto;
}

.auth-page {
    width: min(420px, calc(100% - 32px));
    margin: 72px auto;
}

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

.stack {
    display: grid;
    gap: 16px;
}

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

label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

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

select {
    width: 100%;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 10px;
    background: #ffffff;
    font: inherit;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 0;
    border-radius: 6px;
    padding: 0 14px;
    background: var(--accent);
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

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

.secondary {
    background: #eef4f3;
    color: var(--accent-dark);
}

.secondary:hover {
    background: #d9ebe8;
}

.link-button {
    min-height: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent);
}

.link-button:hover {
    background: transparent;
    color: var(--accent-dark);
}

.error {
    color: var(--danger);
    background: #fff1f0;
    border: 1px solid #fecdca;
    border-radius: 6px;
    padding: 10px 12px;
}

.success {
    color: #05603a;
    background: #ecfdf3;
    border: 1px solid #abefc6;
    border-radius: 6px;
    padding: 10px 12px;
}

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

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.stat {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.stat-value {
    margin-top: 8px;
    font-size: 28px;
    font-weight: 700;
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.grid-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: 16px;
}

.grid-form .wide {
    grid-column: span 3;
}

.form-actions {
    display: flex;
    align-items: end;
    gap: 8px;
}

.metadata-list {
    display: grid;
    gap: 12px;
}

.metadata-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

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

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

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

th {
    color: var(--muted);
    font-size: 13px;
}

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

.inline-form {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) auto;
    gap: 8px;
    min-width: 260px;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
}

.checkbox-field input {
    width: auto;
    height: auto;
}

@media (max-width: 760px) {
    .topbar {
        padding: 0 16px;
    }

    .page-heading,
    .metadata-row {
        display: grid;
    }

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

    .grid-form .wide {
        grid-column: auto;
    }
}

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