:root {
    --bg: #f3f4f6;
    --card: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --danger: #dc2626;
    --ok: #047857;
    --nav: #0f172a;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    background: var(--nav);
    color: #fff;
    padding: 0 24px;
    min-height: 56px;
}

.topbar a {
    color: #e5e7eb;
    text-decoration: none;
}

.topbar a.is-active,
.topbar a:hover {
    color: #fff;
}

.brand {
    font-weight: 700;
    color: #fff !important;
}

.topbar nav {
    display: flex;
    gap: 16px;
    flex: 1;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #cbd5e1;
}

.topbar-user form {
    margin: 0;
}

.page {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 24px 48px;
}

.page-guest {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

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

.page-head h1,
.login-card h1 {
    margin: 0 0 4px;
    font-size: 24px;
}

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

.actions form {
    margin: 0;
}

.page-head form {
    margin: 0;
}

.cooldown {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    text-align: right;
    max-width: 28rem;
}

.flash {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
}

.flash-ok {
    background: #ecfdf5;
    color: var(--ok);
}

.flash-error {
    background: #fef2f2;
    color: var(--danger);
}

.login-card,
.form-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 28px;
    width: 100%;
    max-width: 440px;
}

.form-card {
    max-width: 560px;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 600;
}

label.grow {
    flex: 1;
}

input,
select {
    font: inherit;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.check {
    flex-direction: row;
    align-items: center;
    font-weight: 500;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 8px 14px;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover {
    background: var(--accent-hover);
    text-decoration: none;
    color: #fff;
}

.btn-secondary {
    background: #e5e7eb;
    color: var(--text);
}

.btn-secondary:hover {
    background: #d1d5db;
    color: var(--text);
}

.btn-danger {
    background: #fee2e2;
    color: var(--danger);
}

.btn-danger:hover {
    background: #fecaca;
    color: var(--danger);
}

.btn-small {
    padding: 5px 9px;
    font-size: 13px;
}

.linkish {
    background: none;
    border: 0;
    color: #93c5fd;
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.filters {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
}

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

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

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

table.data th {
    background: #f8fafc;
    font-size: 13px;
    white-space: nowrap;
}

table.data tbody tr:last-child td {
    border-bottom: 0;
}

.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.clip {
    max-width: 280px;
    overflow-wrap: anywhere;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
}

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

.row-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    white-space: nowrap;
}

.row-actions form {
    margin: 0;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e5e7eb;
    font-size: 12px;
}

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

.error-note {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
}

.sort {
    color: inherit;
}

.sort.is-sorted::after {
    content: " ▴";
}

.sort.is-sorted.is-desc::after {
    content: " ▾";
}

@media (max-width: 720px) {
    .filters,
    .page-head,
    .topbar {
        flex-wrap: wrap;
    }

    .topbar {
        padding: 12px 16px;
    }
}
