:root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --ink: #17202a;
    --muted: #6b7280;
    --line: #dfe4ea;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --danger: #b42318;
    --danger-bg: #fef3f2;
    --success-bg: #ecfdf3;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Tahoma, Arial, sans-serif;
    line-height: 1.6;
}

a {
    color: inherit;
}

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

.auth-card {
    width: min(440px, 100%);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 28px;
    box-shadow: 0 18px 50px rgba(23, 32, 42, .08);
}

.auth-card h1,
.auth-card p {
    margin-top: 0;
}

.auth-card p,
.muted,
small {
    color: var(--muted);
}

.auth-link {
    display: inline-block;
    margin-top: 18px;
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 700;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.topbar div {
    display: flex;
    align-items: center;
    gap: 16px;
}

.layout {
    width: min(1240px, calc(100% - 32px));
    margin: 24px auto;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stats div {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    color: var(--muted);
}

.stats span {
    display: block;
    color: var(--ink);
    font-size: 28px;
    font-weight: 800;
}

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

.tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tabs a {
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    text-decoration: none;
    font-weight: 700;
}

.tabs a.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

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

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

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    background: white;
}

textarea {
    resize: vertical;
}

.button {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 14px;
    background: white;
    color: var(--ink);
    font: inherit;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

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

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

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

.button.ghost {
    background: transparent;
}

.button.small {
    min-height: 34px;
    padding: 5px 10px;
    font-size: 14px;
}

.alert {
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    background: var(--success-bg);
    font-weight: 700;
}

.alert.danger {
    background: var(--danger-bg);
    color: var(--danger);
}

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

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

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

th {
    background: #f9fafb;
    white-space: nowrap;
}

td strong,
td span,
td small {
    display: block;
}

.badge {
    display: inline-block;
    width: fit-content;
    border-radius: 999px;
    background: #edf7f6;
    color: var(--primary-dark);
    padding: 4px 10px;
    font-weight: 800;
}

.metrics {
    display: grid;
    gap: 4px;
    min-width: 220px;
}

.mini-form {
    display: grid;
    gap: 8px;
    min-width: 260px;
    margin-top: 10px;
}

summary {
    width: fit-content;
    list-style: none;
}

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

@media (max-width: 780px) {
    .topbar,
    .toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar div,
    .search {
        align-items: stretch;
        flex-direction: column;
    }

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

