:root {
    --panel-bg: #f4f6fa;
    --panel-surface: #ffffff;
    --panel-border: #e3e8ef;
    --panel-text: #1b2333;
    --panel-muted: #6b7587;
    --panel-accent: #2563eb;
    --panel-accent-soft: #e8efff;
    --sidebar-bg: #0f1a2e;
    --sidebar-text: #b6c0d4;
    --sidebar-active: #1d2c4a;
    --radius: 10px;
}

body {
    background: var(--panel-bg);
    color: var(--panel-text);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
    font-size: 14px;
}

.mono, code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Layout --------------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    text-decoration: none;
}

.brand-mark {
    width: 32px; height: 32px;
    display: inline-grid; place-items: center;
    border-radius: 8px;
    background: var(--panel-accent);
    color: #fff;
}
.brand-mark.lg { width: 48px; height: 48px; font-size: 22px; border-radius: 12px; }

.nav-label {
    padding: 18px 20px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #6f7d99;
}

.nav-section { display: flex; flex-direction: column; padding: 0 10px; gap: 2px; }
.nav-section a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
}
.nav-section a:hover { color: #fff; background: rgba(255,255,255,.04); }
.nav-section a.active { color: #fff; background: var(--sidebar-active); }
.nav-section a i { font-size: 16px; width: 18px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 28px;
    background: var(--panel-surface);
    border-bottom: 1px solid var(--panel-border);
    position: sticky; top: 0; z-index: 10;
}
.page-title { font-size: 18px; font-weight: 600; margin: 0; }

.balance-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--panel-accent-soft);
    color: var(--panel-accent);
    font-weight: 600;
    text-decoration: none;
    font-variant-numeric: tabular-nums;
}

.content { padding: 24px 28px 48px; max-width: 1400px; width: 100%; }

/* Cards ---------------------------------------------------------------- */
.card {
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    box-shadow: none;
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--panel-border);
    font-weight: 600;
    padding: 14px 18px;
}
.card-body { padding: 18px; }

.stat .label { color: var(--panel-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.stat .value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 4px; }
.stat .sub { color: var(--panel-muted); font-size: 12px; }

.table { margin-bottom: 0; }
.table > :not(caption) > * > * { padding: 11px 14px; vertical-align: middle; }
.table thead th {
    font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--panel-muted); font-weight: 600; background: #fafbfd;
    border-bottom-color: var(--panel-border);
}
.table-hover tbody tr:hover { background: #f8fafc; }

.btn { border-radius: 8px; font-weight: 500; }
.form-control, .form-select { border-radius: 8px; border-color: #d5dce6; }
.form-label { font-weight: 500; font-size: 13px; }

.badge { font-weight: 600; letter-spacing: .02em; }

/* Environments --------------------------------------------------------- */
.env-name { font-weight: 600; color: var(--panel-text); text-decoration: none; }
.env-name:hover { color: var(--panel-accent); }
.env-domain { color: var(--panel-muted); font-size: 12px; }

.node-group-title {
    font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
    color: var(--panel-muted); font-weight: 600;
}

.ip-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 2px 8px;
    border-radius: 6px;
    background: #f1f4f9;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    margin: 2px 4px 2px 0;
}
.ip-chip button { border: 0; background: none; padding: 0; color: #c0392b; line-height: 1; }

.node-row-builder { border: 1px dashed var(--panel-border); border-radius: var(--radius); padding: 14px; background: #fbfcfe; }

.console-out {
    background: #0f1a2e; color: #d6e2ff;
    border-radius: 8px; padding: 12px;
    min-height: 120px; max-height: 360px; overflow: auto;
    font-size: 12px; white-space: pre-wrap;
}

.spinner-inline { width: 14px; height: 14px; border-width: 2px; }

.empty-state { text-align: center; padding: 48px 16px; color: var(--panel-muted); }
.empty-state i { font-size: 40px; display: block; margin-bottom: 8px; color: #b7c1d1; }

/* Guest ---------------------------------------------------------------- */
body.guest { background: linear-gradient(160deg, #0f1a2e 0%, #1d2c4a 100%); min-height: 100vh; }
.guest-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.guest-card {
    width: 100%; max-width: 420px;
    background: #fff; border-radius: 14px;
    padding: 32px 28px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

/* Responsive ----------------------------------------------------------- */
@media (max-width: 991.98px) {
    .sidebar { position: fixed; left: -260px; z-index: 1050; transition: left .2s; }
    .sidebar.open { left: 0; }
    .topbar { padding: 12px 16px; }
    .content { padding: 16px; }
}
