:root {
    color-scheme: dark;
    --ink: #f4f4f5;
    --muted: #a1a1aa;
    --line: #2a2a2e;
    --paper: #0c0c0e;
    --card: #161618;
    --raised: #222226;
    --green: #3dba6a;
    --green-dark: #101012;
    --danger: #ff6b6b;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

.shell { display: flex; min-height: 100vh; }

.side {
    width: 292px;
    flex: none;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 18px 14px 14px;
    background: #101012;
    border-right: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.01em;
    padding: 0 8px 16px;
}

.brand img {
    width: 40px;
    height: 40px;
    border-radius: 12px;
}

.side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
    padding: 10px 12px;
    border-radius: 14px;
    color: #e4e4e7;
    font-weight: 700;
    text-decoration: none;
}

.side-link:hover { background: #1c1c20; text-decoration: none; }

.console-mark {
    width: 22px;
    color: var(--green);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    font-weight: 800;
}

.side-link.active {
    background: #18241c;
    box-shadow: inset 3px 0 0 var(--green);
}

.status-dot {
    width: 10px;
    height: 10px;
    flex: none;
    border-radius: 50%;
    background: #71717a;
    box-shadow: 0 0 0 4px rgba(113, 113, 122, 0.16);
}

.status-dot.on {
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(61, 186, 106, 0.18);
}

.status-dot.off {
    background: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.16);
}

.status-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.status-hero img {
    width: 72px;
    height: 72px;
    border-radius: 20px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-weight: 800;
}

.status-hero h2 { margin: 2px 0 0; }

.console {
    min-height: calc(100vh - 170px);
    max-height: calc(100vh - 170px);
    overflow: auto;
    padding: 16px 18px;
    border-radius: 18px;
    background: #09090b;
    border: 1px solid var(--line);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.6;
}

.console-empty { margin: 0; color: var(--muted); }

.console-line {
    display: grid;
    grid-template-columns: 78px 64px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.console-line time,
.console-line .lvl { color: #71717a; }

.console-line.warn { color: #f5d48a; }
.console-line.warn .lvl { color: #f5d48a; }
.console-line.error { color: #ffb4b4; }
.console-line.error .lvl { color: #ff8f8f; }

.console-line pre {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font: inherit;
}

.side-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 8px 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.side-head span {
    color: #d4d4d8;
    letter-spacing: 0;
}

.side-search {
    width: calc(100% - 8px);
    margin: 0 4px 10px;
    padding: 9px 12px;
    border: 1px solid #34343a;
    border-radius: 10px;
    background: #0c0c0e;
    color: var(--ink);
    font: inherit;
}

.servers {
    overflow: auto;
    flex: 1;
    padding-right: 2px;
}

.server {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
    padding: 8px;
    border-radius: 14px;
    color: #e4e4e7;
    text-decoration: none;
}

.server:hover { background: #1c1c20; text-decoration: none; }

.server.active {
    background: #18241c;
    box-shadow: inset 3px 0 0 var(--green);
}

.server-icon,
.server-fallback {
    width: 42px;
    height: 42px;
    flex: none;
    border-radius: 14px;
}

.server-fallback {
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
}

.server-copy { min-width: 0; display: grid; }

.server-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 650;
}

.who-name {
    display: block;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.25;
}

.server-state { color: var(--muted); font-size: 12px; }

.side-user {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
    padding: 12px 8px 4px;
    border-top: 1px solid var(--line);
}

.side-user-copy { min-width: 0; flex: 1; }
.avatar { width: 36px; height: 36px; flex: none; border-radius: 50%; }
.logout { display: inline-block; margin-top: 2px; color: #d4d4d8; font-size: 13px; }

.workspace { flex: 1; min-width: 0; }
.workspace-head {
    padding: 28px 28px 0;
}
.eyebrow {
    margin: 0 0 4px;
    color: var(--green);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.workspace-head h1 { margin: 0; font-size: 34px; letter-spacing: -0.03em; }
.workspace-body { margin: 18px 28px 48px; }

main {
    width: min(980px, calc(100% - 32px));
    margin: 28px auto 48px;
}

h1, h2 { line-height: 1.2; margin: 0 0 14px; }
h2 { font-size: 20px; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 22px;
    margin-bottom: 18px;
}

.card.narrow { max-width: 520px; margin-left: auto; margin-right: auto; }

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.card-head h2 { margin: 0; }

.muted { color: var(--muted); }

.flash {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 12px;
}

.flash.ok { background: #143222; color: #b6f0c8; }
.flash.error { background: #3a1818; color: #ffc1c1; }

.facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 18px;
}

.facts div {
    padding: 14px;
    border-radius: 14px;
    background: var(--raised);
}

.facts-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 4px 0 0; font-weight: 700; }

.stack {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
}

.stack > button { grid-column: 1 / -1; justify-self: start; }
label { display: grid; gap: 6px; font-weight: 650; }

select option { background: #1c1c1c; color: #f2f2f2; }

input[type="text"], input[type="search"], select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #3a3a40;
    border-radius: 12px;
    background: #101012;
    color: var(--ink);
    font: inherit;
    font-weight: 400;
}

button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    padding: 11px 16px;
    background: linear-gradient(180deg, #49c772, #2f9d56);
    color: #06210f;
    font: inherit;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

button:hover, .button:hover { text-decoration: none; filter: brightness(1.05); }

.button.secondary, button.text {
    background: transparent;
    color: var(--green);
    padding: 0;
}

button.danger { background: #9d2c2c; color: #fff; }
button.text { font-weight: 700; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }

th, td {
    text-align: left;
    padding: 12px 8px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

th { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }

.companies,
.companies th,
.companies td,
.bot-servers,
.bot-servers th,
.bot-servers td {
    text-align: center;
}
tr:hover td { background: rgba(255, 255, 255, 0.02); }
.actions { white-space: nowrap; }
.actions a { margin-right: 12px; font-weight: 700; }
.back { margin-top: 0; color: var(--muted); }

.role-list { list-style: none; padding: 0; margin: 0 0 16px; }
.role-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.picker {
    max-height: 240px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 6px;
    background: #101012;
}

.picker label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
}

.picker label:hover { background: var(--raised); }

.picker label:has(input:checked) {
    background: rgba(61, 186, 106, 0.14);
}

.picker input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    margin: 0;
    flex: none;
    border: 1.5px solid #4a4a52;
    border-radius: 6px;
    background: #0c0c0e;
    cursor: pointer;
}

.picker input[type="checkbox"]:hover {
    border-color: var(--green);
}

.picker input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--green);
    outline-offset: 2px;
}

.picker input[type="checkbox"]:checked {
    border-color: var(--green);
    background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2306210f' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.2l3 3.1 6-6.6'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.note { color: var(--muted); font-size: 13px; }
.add-form { margin-top: 14px; }
.danger-zone { border-color: #5c2a2a; }

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at top, rgba(250, 30, 78, 0.18), transparent 36%),
        var(--paper);
}

.login-card {
    width: min(440px, calc(100% - 32px));
    text-align: center;
    background: #161618;
    border: 1px solid #2c2c32;
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: 36px 32px;
}

.login-logo { width: 96px; height: 96px; border-radius: 22px; }
.login-card h1 { margin-top: 8px; letter-spacing: -0.03em; }
.login-card p { color: var(--muted); }
.button.discord { width: 100%; background: #5865f2; color: #fff; }

@media (max-width: 860px) {
    .shell { display: block; }
    .side { width: auto; height: auto; position: relative; }
    .servers { display: flex; gap: 8px; overflow-x: auto; }
    .server { min-width: 220px; margin-bottom: 0; }
    .workspace-head, .workspace-body { width: auto; margin-left: 16px; margin-right: 16px; padding-left: 0; padding-right: 0; }
    .facts, .card-head { grid-template-columns: 1fr; align-items: flex-start; flex-direction: column; }
    .facts-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
