:root {
    --bg: #08151f;
    --bg-soft: rgba(10, 24, 36, 0.85);
    --panel: rgba(11, 26, 39, 0.92);
    --panel-border: rgba(146, 198, 221, 0.16);
    --text: #edf6f8;
    --muted: #9db2bb;
    --accent: #78d7b6;
    --accent-strong: #4ec29b;
    --danger: #ff7d7d;
    --warning: #f7c766;
    --neutral: #8db0cb;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", "Trebuchet MS", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(22, 86, 109, 0.42), transparent 35%),
        linear-gradient(180deg, #08111b 0%, #0b1d2c 50%, #08151f 100%);
}

.background-glow {
    position: fixed;
    width: 18rem;
    height: 18rem;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.22;
    pointer-events: none;
}

.background-glow-a {
    top: 1rem;
    right: 2rem;
    background: #4ec29b;
}

.background-glow-b {
    bottom: 2rem;
    left: 2rem;
    background: #2c7aa5;
}

.topbar,
.nav-shell,
.page-shell {
    position: relative;
    z-index: 1;
}

.topbar,
.nav-shell,
.page-shell {
    width: min(1200px, calc(100% - 2rem));
    margin: 0 auto;
}

.topbar {
    padding: 2rem 0 1rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: start;
}

.brand {
    color: var(--text);
    text-decoration: none;
    font-size: 1.6rem;
    font-weight: 700;
}

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

.nav-shell {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.nav-link,
.button {
    text-decoration: none;
    color: var(--text);
    border-radius: 999px;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.nav-link {
    padding: 0.7rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-link:hover,
.button:hover {
    transform: translateY(-1px);
}

.page-shell {
    padding-bottom: 2rem;
}

.page-header,
.card,
.flash {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 1.3rem;
    box-shadow: var(--shadow);
}

.page-header,
.card {
    padding: 1.4rem;
}

.page-header {
    margin-bottom: 1rem;
}

.card-grid,
.stack-grid {
    display: grid;
    gap: 1rem;
}

.card-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.stack-grid {
    grid-template-columns: 1fr;
}

.card-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.card h1,
.card h2,
.page-header h1 {
    margin: 0;
}

.eyebrow {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--accent);
    font-size: 0.75rem;
    margin-bottom: 0.4rem;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.pill-online {
    background: rgba(78, 194, 155, 0.18);
    color: #89efcb;
}

.pill-error {
    background: rgba(255, 125, 125, 0.18);
    color: #ffadad;
}

.pill-warning {
    background: rgba(247, 199, 102, 0.18);
    color: #ffe19d;
}

.pill-neutral {
    background: rgba(141, 176, 203, 0.18);
    color: #c5def1;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.85rem 1rem;
    margin: 0;
}

.stats-grid dt {
    color: var(--muted);
    font-size: 0.82rem;
}

.stats-grid dd {
    margin: 0.2rem 0 0;
    font-weight: 600;
    word-break: break-word;
}

.button,
button {
    background: linear-gradient(135deg, var(--accent-strong), #2b839f);
    border: none;
    padding: 0.8rem 1rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.button-ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.topbar-meta,
.inline-form,
.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: end;
}

.inline-form .grow {
    flex: 1 1 220px;
}

label {
    display: grid;
    gap: 0.4rem;
    color: var(--muted);
    font-size: 0.92rem;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    padding: 0.8rem 0.9rem;
    font: inherit;
}

textarea {
    resize: vertical;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.full-width {
    grid-column: 1 / -1;
}

.flash-stack {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.flash {
    padding: 1rem 1.2rem;
}

.flash-success {
    border-color: rgba(78, 194, 155, 0.45);
}

.flash-error {
    border-color: rgba(255, 125, 125, 0.45);
}

.center-panel {
    display: grid;
    min-height: 70vh;
    place-items: center;
}

.auth-card {
    width: min(460px, 100%);
}

.table-wrap {
    overflow-x: auto;
}

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

th,
td {
    text-align: left;
    padding: 0.9rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    vertical-align: top;
}

.list-block {
    display: grid;
    gap: 0.7rem;
}

.list-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    padding: 0.8rem 0.9rem;
    border-radius: 0.95rem;
    background: rgba(255, 255, 255, 0.03);
}

.json-block,
.table-pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.84rem;
    color: #d8e8ee;
}

.inline-note {
    margin-top: 1rem;
    padding: 0.8rem 0.95rem;
    border-radius: 0.95rem;
}

.inline-note-error {
    background: rgba(255, 125, 125, 0.08);
    color: #ffbaba;
}

@media (max-width: 720px) {
    .topbar {
        flex-direction: column;
    }

    .card-head {
        align-items: start;
        flex-direction: column;
    }
}
