/* Shared by every page: theme, page frame and the top bar. Page-specific styles stay in the page. */
:root {
    color-scheme: dark;
    font-family: system-ui, -apple-system, sans-serif;

    --bg: #0b1220;
    --panel: #111c2e;
    --border: #263244;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --faint: #64748b;
    --accent: #7dd3fc;
    --ok: #22c55e;
    --busy: #f59e0b;
    --bad: #ef4444;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--accent);
}

/* Top bar: the name on the left, the user on the far right. */
.topbar {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
}

.topbar .brand {
    color: var(--text);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 4px;
    text-decoration: none;
}

.topbar .user {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: 14px;
}

.topbar .avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--border);
    color: var(--muted);
}

.page {
    flex: 1;
}

/* Top bar navigation between the site's pages. */
.topbar nav {
    flex: 1;
    display: flex;
    gap: 22px;
    margin-left: 34px;
    font-size: 14px;
}

.topbar nav a {
    color: var(--muted);
    text-decoration: none;
}

.topbar nav a:hover,
.topbar nav a[aria-current="page"] {
    color: var(--text);
}

/* The state of something the site depends on, shown in the top bar: a dot and a few words. */
.topbar .state {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 22px;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.topbar .state i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--busy);
}

.topbar .state.ok i { background: var(--ok); }
.topbar .state.bad i { background: var(--bad); }

/* On a phone the top bar keeps the name, the links and the dots; the words give way. */
@media (max-width: 600px) {
    .topbar {
        padding: 0 14px;
    }

    .topbar .brand {
        font-size: 16px;
        letter-spacing: 3px;
    }

    .topbar nav {
        gap: 16px;
        margin-left: 18px;
    }

    .topbar .state {
        margin-right: 12px;
    }

    .topbar .state span,
    .topbar .user span:first-child {
        display: none;
    }
}

/* A choice in the top bar: a drop-down for what a page shows. A bar that has one keeps it on the same line as the
   name and the user, in the middle of the bar whatever the widths of the two are, on a phone as on a wide screen. */
.topbar:has(.choices) {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
}

.topbar .choices {
    display: flex;
    align-items: center;
}

.topbar:has(.choices) .user {
    justify-self: end;
}

.topbar select {
    height: 30px;
    max-width: 230px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 13px;
}
