:root {
    --bg: #0f1419;
    --bg-2: #171e26;
    --panel: #1c2530;
    --line: #2a3644;
    --text: #e8eef5;
    --muted: #8b9aab;
    --accent: #2dd4a8;
    --accent-2: #38bdf8;
    --danger: #f87171;
    --warn: #fbbf24;
    --ok: #34d399;
    --radius: 14px;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(45, 212, 168, 0.12), transparent 50%),
        radial-gradient(900px 500px at 100% 0%, rgba(56, 189, 248, 0.10), transparent 45%),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
}

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

.app {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: rgba(23, 30, 38, 0.92);
    border-right: 1px solid var(--line);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
}
.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 0 24px rgba(45, 212, 168, 0.35);
}
.brand strong { display: block; font-size: 1rem; }
.brand small { color: var(--muted); }

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sidebar nav a {
    color: var(--muted);
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
}
.sidebar nav a:hover,
.sidebar nav a.active {
    background: rgba(45, 212, 168, 0.1);
    color: var(--text);
}

.sidebar-action { margin-top: auto; }

.content {
    padding: 28px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}
.page-header h1 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.stat {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
}
.stat .label { color: var(--muted); font-size: 0.85rem; }
.stat .value { font-size: 1.8rem; font-weight: 700; margin-top: 4px; }
.stat.up .value { color: var(--ok); }
.stat.down .value { color: var(--danger); }
.stat.degraded .value { color: var(--warn); }

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}
.panel-header h2 {
    margin: 0;
    font-size: 1.05rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
th {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 650;
}
.badge::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}
.status-up { background: rgba(52, 211, 153, 0.15); color: var(--ok); }
.status-down { background: rgba(248, 113, 113, 0.15); color: var(--danger); }
.status-degraded { background: rgba(251, 191, 36, 0.15); color: var(--warn); }
.status-unknown { background: rgba(139, 154, 171, 0.15); color: var(--muted); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.92rem;
}
.btn:hover { text-decoration: none; opacity: 0.92; }
.btn-primary {
    background: linear-gradient(135deg, #2dd4a8, #22b8d4);
    color: #06241c;
}
.btn-secondary {
    background: transparent;
    border-color: var(--line);
    color: var(--text);
}
.btn-danger {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger);
    border-color: rgba(248, 113, 113, 0.3);
}
.btn-sm { padding: 6px 10px; font-size: 0.8rem; }
.btn-block { width: 100%; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.form-grid {
    display: grid;
    gap: 14px;
    padding: 18px;
}
.form-grid h2 {
    margin: 8px 0 0;
    font-size: 1rem;
}
label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 0.88rem;
}
input, select, textarea {
    width: 100%;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    padding: 11px 12px;
    font: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: rgba(45, 212, 168, 0.6);
    box-shadow: 0 0 0 3px rgba(45, 212, 168, 0.12);
}
small { color: var(--muted); }
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}
.checkbox-row input { width: auto; }

.alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.alert-success { background: rgba(52,211,153,0.12); border-color: rgba(52,211,153,0.3); color: #a7f3d0; }
.alert-error { background: rgba(248,113,113,0.12); border-color: rgba(248,113,113,0.3); color: #fecaca; }
.alert-info { background: rgba(56,189,248,0.12); border-color: rgba(56,189,248,0.3); color: #bae6fd; }
.alert-warning { background: rgba(251,191,36,0.12); border-color: rgba(251,191,36,0.3); color: #fde68a; }

.muted { color: var(--muted); }
.url-cell {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--muted);
}

.auth-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 20px;
}
.install-card {
    width: min(520px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 28px;
    box-shadow: var(--shadow);
}
.install-card h1 { margin: 0 0 6px; }

.two-col {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 16px;
}

@media (max-width: 980px) {
    .app { grid-template-columns: 1fr; }
    .sidebar {
        position: relative;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--line);
    }
    .sidebar nav { flex-direction: row; flex-wrap: wrap; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .two-col { grid-template-columns: 1fr; }
}
