:root {
    --bg: #14161a;
    --panel: #1c1f25;
    --line: #2b2f38;
    --text: #dfe3ea;
    --muted: #8b93a1;
    --accent: #4f9cf9;
    --ok: #4ec97a;
    --err: #f2685c;
}

* { box-sizing: border-box; }

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

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

.topbar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: 0.04em; }
.topbar nav { display: flex; gap: 1rem; }
.signout { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.who { color: var(--muted); font-size: 0.9rem; }
.who em { color: var(--accent); font-style: normal; }

main { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }

h1 { font-size: 1.4rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.05rem; margin: 2rem 0 0.5rem; }

.muted { color: var(--muted); }
.ok { color: var(--ok); }
.off, .err { color: var(--err); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.85em; }

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}
.card.narrow { max-width: 380px; margin: 3rem auto; }
.card.issued { border-color: var(--ok); }
.token { display: block; word-break: break-all; padding: 0.6rem; background: #0f1114; border-radius: 6px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.server-card { display: block; color: inherit; }
.server-card:hover { border-color: var(--accent); text-decoration: none; }
.server-card h2 { margin: 0 0 0.25rem; }

label { display: block; margin: 0.75rem 0 0.25rem; color: var(--muted); font-size: 0.85rem; }
label.inline { display: inline-flex; align-items: center; gap: 0.35rem; margin-right: 1rem; }

input, select, button, textarea {
    font: inherit;
    color: var(--text);
    background: #0f1114;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.45rem 0.6rem;
}
input[type="checkbox"] { padding: 0; }
input:focus, select:focus, button:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button { cursor: pointer; background: #262b33; }
button:hover { border-color: var(--accent); }
button.danger { border-color: #5c2b2b; color: #ffb4ac; }
button.danger:hover { background: #3a2020; }

form.row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
form.row input[type="text"] { flex: 1 1 12rem; }
.toolbar { display: flex; align-items: center; gap: 1rem; margin: 1rem 0; }
.danger-form { margin-top: 0.75rem; }

.table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
.table th, .table td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
/* Not display:flex - that drops the cell out of the table layout and the
   buttons render outside the row. An inner wrapper keeps both. */
.table td.actions { white-space: nowrap; width: 1%; }
.table td.actions button { margin-right: 0.35rem; }
.table td.actions button:last-child { margin-right: 0; }
.table td.detail { max-width: 22rem; overflow-wrap: anywhere; color: var(--muted); font-size: 0.85em; }

.output {
    background: #0f1114;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.75rem;
    max-height: 20rem;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.flash { padding: 0.6rem 0.9rem; border-radius: 6px; border: 1px solid var(--line); }
.flash-ok { border-color: var(--ok); color: var(--ok); }
.flash-error { border-color: var(--err); color: var(--err); }

fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 0.75rem 0; }
legend { color: var(--muted); font-size: 0.85rem; padding: 0 0.4rem; }

/* ------------------------------------------------------------ console */

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
}
.page-head p { margin: 0.15rem 0 0; }
.page-head .toolbar { margin: 0; }

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 1.25rem 0 0;
    border-bottom: 1px solid var(--line);
}
.tab {
    background: none;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    color: var(--muted);
    padding: 0.5rem 0.9rem;
    margin-bottom: -1px;
}
.tab:hover { color: var(--text); border-color: var(--line); }
.tab.is-active {
    color: var(--text);
    background: var(--panel);
    border-color: var(--line);
    border-bottom: 1px solid var(--panel);
}

.pill {
    display: inline-block;
    min-width: 1.5rem;
    padding: 0 0.35rem;
    margin-left: 0.35rem;
    border-radius: 999px;
    background: #0f1114;
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.75rem;
    text-align: center;
}

.panel { display: none; padding-top: 1rem; }
.panel.is-active { display: block; }
.panel h2:first-child { margin-top: 0.5rem; }

.note { max-width: 60ch; margin: 0 0 0.5rem; font-size: 0.9rem; }
/* A search box does not need the whole window; past ~30rem it just makes the
   row it sits in harder to scan. */
.grow { flex: 1 1 18rem; max-width: 30rem; }
.nowrap { white-space: nowrap; }
.table th.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr:hover { background: #1a1d23; }
.table td.empty { color: var(--muted); padding: 1.25rem 0.6rem; }

.badge {
    display: inline-block;
    padding: 0.05rem 0.4rem;
    border-radius: 4px;
    border: 1px solid var(--line);
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--muted);
}
.badge-online { border-color: var(--ok); color: var(--ok); }
.badge-lobby { border-color: var(--accent); color: var(--accent); }

.aliases { display: block; color: var(--muted); font-size: 0.8em; margin-top: 0.15rem; }

.stack { display: flex; flex-direction: column; gap: 1rem; }
.box {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem 1.25rem 1.25rem;
}
.box h2 { margin: 0 0 0.35rem; }

.fields { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: flex-end; }
.fields .field { display: flex; flex-direction: column; }
.fields .field.grow { flex: 1 1 14rem; }
.fields label { margin: 0 0 0.25rem; }
.fields input, .fields select { width: 100%; }
.hint { color: var(--muted); font-size: 0.75rem; margin-top: 0.2rem; }

@media (max-width: 720px) {
    .page-head { align-items: flex-start; }
    .table { display: block; overflow-x: auto; }
}

/* status: silent unless something fails */

.live { display: flex; align-items: center; gap: 0.6rem; }
.live #refresh { background: none; border-color: transparent; color: var(--muted); padding: 0.35rem 0.5rem; }
.live #refresh:hover { color: var(--text); border-color: var(--line); }

.live-dot { color: var(--muted); font-size: 0.85rem; }
.live-dot.is-error { color: var(--err); }
