:root {
    --bg: #f7f8fb;
    --surface: #ffffff;
    --text: #172033;
    --muted: #697386;
    --line: #d9dee8;
    --accent: #1662c4;
    --accent-dark: #104d9b;
    --danger: #b42318;
    --success: #147a46;
    --warning: #9a5b00;
}

* {
    box-sizing: border-box;
}

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

body.modal-open {
    overflow: hidden;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.auth-shell {
    width: min(440px, calc(100% - 32px));
}

.auth-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 28px;
}

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

.topbar,
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.toolbar {
    margin: 24px 0 12px;
}

h1 {
    margin: 0 0 8px;
    font-size: 32px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.muted {
    margin: 0 0 20px;
    color: var(--muted);
}

.tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 20px;
}

label {
    display: block;
    margin: 14px 0 6px;
    font-weight: 700;
}

input,
button {
    min-height: 42px;
    border-radius: 8px;
    font: inherit;
}

input {
    width: 100%;
    border: 1px solid var(--line);
    padding: 0 12px;
    background: #fff;
    color: var(--text);
}

button {
    border: 0;
    padding: 0 16px;
    cursor: pointer;
    font-weight: 700;
}

.primary {
    margin-top: 18px;
    background: var(--accent);
    color: #fff;
}

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

.secondary,
.tab {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
}

.tab.active {
    border-color: var(--accent);
    color: var(--accent);
}

.message {
    min-height: 24px;
    color: var(--success);
    overflow-wrap: anywhere;
}

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

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

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

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

th {
    background: #eef2f7;
    font-size: 14px;
}

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

.mono {
    font-family: Consolas, monospace;
    overflow-wrap: anywhere;
}

.ok {
    color: var(--success);
    font-weight: 700;
}

.warn {
    color: var(--warning);
    font-weight: 700;
}

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

.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(23, 32, 51, 0.45);
}

.modal[hidden] {
    display: none;
}

.modal-card {
    width: min(520px, 100%);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 24px 60px rgba(23, 32, 51, 0.18);
}

.modal-card h2 {
    margin: 0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

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

    .toolbar .primary {
        width: 100%;
        margin-top: 0;
    }

    .modal-actions {
        flex-direction: column-reverse;
    }

    .modal-actions button {
        width: 100%;
    }
}
