:root {
    --bg: #09090b;
    --bg-elevated: #0f0f12;
    --sidebar: #0c0c0e;
    --panel: #131316;
    --panel-hover: #18181c;
    --border: #27272a;
    --border-soft: #1f1f23;
    --text: #fafafa;
    --text-dim: #a1a1aa;
    --text-faint: #71717a;
    --brand: #00d4aa;
    --brand-dim: rgba(0, 212, 170, 0.14);
    --brand-hover: #2aefc4;
    --accent: #38bdf8;
    --ok: #34d399;
    --down: #f87171;
    --warn: #fbbf24;
    --muted: #52525b;
    --radius: 12px;
    --radius-sm: 8px;
    --font: "Sora", "Segoe UI", sans-serif;
    --mono: "JetBrains Mono", "Consolas", monospace;
    --shadow: 0 0 0 1px rgba(255,255,255,0.03), 0 20px 50px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

body.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    background:
        radial-gradient(900px 500px at 0% 0%, rgba(0, 212, 170, 0.07), transparent 55%),
        radial-gradient(700px 400px at 100% 0%, rgba(56, 189, 248, 0.05), transparent 50%),
        var(--bg);
}

/* ---------- Sidebar ---------- */
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0.9rem;
    background: linear-gradient(180deg, #0e0e11 0%, var(--sidebar) 100%);
    border-right: 1px solid var(--border-soft);
    z-index: 20;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0.65rem 1.4rem;
    text-decoration: none;
    color: var(--text);
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background:
        linear-gradient(135deg, var(--brand) 0%, #0ea5e9 100%);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #04120e;
    letter-spacing: -0.04em;
    box-shadow: 0 0 24px rgba(0, 212, 170, 0.35);
    animation: brandPulse 4s ease-in-out infinite;
}

@keyframes brandPulse {
    0%, 100% { box-shadow: 0 0 18px rgba(0, 212, 170, 0.25); }
    50% { box-shadow: 0 0 28px rgba(0, 212, 170, 0.45); }
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}
.brand-text strong {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.03em;
}
.brand-text span {
    font-size: 0.68rem;
    color: var(--text-faint);
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text);
    transform: translateX(2px);
}

.sidebar-nav a.active {
    background: var(--brand-dim);
    color: var(--brand-hover);
}

.nav-ico {
    width: 18px;
    opacity: 0.85;
    font-family: var(--mono);
    font-size: 0.78rem;
}

.sidebar-foot {
    padding: 0.75rem;
    border-top: 1px solid var(--border-soft);
    margin-top: 1rem;
}

.sidebar-foot .user-chip {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}
.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--panel);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    font-size: 0.7rem;
    font-family: var(--mono);
    color: var(--brand);
}
.user-meta { font-size: 0.78rem; color: var(--text-dim); }
.user-meta strong { display: block; color: var(--text); font-size: 0.82rem; }

/* ---------- Main ---------- */
.main {
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.75rem;
    border-bottom: 1px solid var(--border-soft);
    background: rgba(9, 9, 11, 0.72);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-title {
    font-size: 0.82rem;
    color: var(--text-faint);
    font-family: var(--mono);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.topbar-actions { display: flex; gap: 0.5rem; align-items: center; }

.container {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 1.75rem 1.75rem 3rem;
    animation: fadeUp 0.35s ease both;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Login (full bleed) ---------- */
body.login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    background:
        radial-gradient(800px 500px at 20% 10%, rgba(0, 212, 170, 0.12), transparent 55%),
        radial-gradient(600px 400px at 90% 80%, rgba(56, 189, 248, 0.08), transparent 50%),
        linear-gradient(180deg, #0a0a0c 0%, #09090b 100%);
}

.login-shell {
    width: min(420px, calc(100% - 2rem));
    animation: fadeUp 0.45s ease both;
}

.login-brand {
    text-align: center;
    margin-bottom: 1.75rem;
}
.login-brand .brand-mark {
    margin: 0 auto 1rem;
    width: 48px;
    height: 48px;
    font-size: 1.1rem;
    border-radius: 14px;
}
.login-brand h1 {
    font-size: 1.65rem;
    font-weight: 600;
    letter-spacing: -0.04em;
    margin: 0 0 0.35rem;
}
.login-brand p {
    margin: 0;
    color: var(--text-dim);
    font-size: 0.92rem;
}

.login-box {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: var(--shadow);
}

.login-box .btn { width: 100%; margin-top: 1.35rem; }

/* ---------- Typography / forms ---------- */
h1, h2, h3 { margin-top: 0; letter-spacing: -0.035em; font-weight: 600; }
h1 { font-size: 1.65rem; margin-bottom: 0.35rem; }
h3 { font-size: 0.95rem; margin-bottom: 0.85rem; color: var(--text); }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.page-header .lede {
    margin: 0.25rem 0 0;
    color: var(--text-dim);
    font-size: 0.92rem;
    max-width: 42rem;
}
.header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

label {
    display: block;
    margin: 1rem 0 0.4rem;
    font-size: 0.78rem;
    font-weight: 550;
    color: var(--text-dim);
    letter-spacing: 0.02em;
}

input, select {
    width: 100%;
    padding: 0.7rem 0.85rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.92rem;
    font-family: var(--font);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea {
    width: 100%;
    padding: 0.7rem 0.85rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.88rem;
    font-family: var(--mono);
    line-height: 1.45;
    resize: vertical;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: rgba(0, 212, 170, 0.55);
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.12);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: var(--brand);
    color: #04120e;
    border: none;
    padding: 0.62rem 1.1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: var(--font);
    text-decoration: none;
    margin-top: 0;
    transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover {
    background: var(--brand-hover);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(0, 212, 170, 0.18);
}
.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--panel-hover);
    border-color: #3f3f46;
    box-shadow: none;
}
.btn-danger {
    background: transparent;
    color: #fca5a5;
    border: 1px solid rgba(248, 113, 113, 0.35);
}
.btn-danger:hover {
    background: rgba(248, 113, 113, 0.12);
    box-shadow: none;
}
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }

/* ---------- Cards / projects ---------- */
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.35rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.card:hover { border-color: #3f3f46; }

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.stat-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: "";
    position: absolute;
    inset: auto -20% -40% auto;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(0,212,170,0.12), transparent 70%);
    pointer-events: none;
}
.stat-card .stat-label {
    font-size: 0.72rem;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: var(--mono);
}
.stat-card .stat-value {
    font-size: 1.65rem;
    font-weight: 600;
    letter-spacing: -0.04em;
    margin-top: 0.25rem;
}

.project-grid {
    display: grid;
    gap: 0.75rem;
}

.project-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 1.1rem 1.25rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s ease, transform 0.18s ease, background 0.2s ease;
}
.project-card:hover {
    border-color: rgba(0, 212, 170, 0.35);
    background: var(--panel-hover);
    transform: translateY(-2px);
}
.project-card .name-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}
.project-card .name-row strong {
    font-size: 1rem;
    letter-spacing: -0.02em;
}
.project-card .meta-line {
    margin-top: 0.35rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}
.project-card .repo {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-faint);
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.status-up {
    background: var(--ok);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18);
    animation: livePulse 2.2s ease-in-out infinite;
}
.status-down { background: var(--down); }

@keyframes livePulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.15); }
    50% { box-shadow: 0 0 0 5px rgba(52, 211, 153, 0.08); }
}

.subdomain-link {
    color: var(--text-dim);
    font-size: 0.82rem;
    text-decoration: none;
    font-family: var(--mono);
}
.subdomain-link:hover { color: var(--brand-hover); }

.actions { display: flex; gap: 0.45rem; align-items: center; flex-wrap: wrap; }

pre.log {
    background: #050506;
    color: #6ee7b7;
    padding: 1rem 1.1rem;
    border-radius: var(--radius-sm);
    overflow: auto;
    max-height: 520px;
    font-size: 0.78rem;
    line-height: 1.5;
    font-family: var(--mono);
    border: 1px solid var(--border);
}

.error-box, .success-box {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.error-box {
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: #fecaca;
}
.success-box {
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.28);
    color: #a7f3d0;
}

.hint { color: var(--text-dim); font-size: 0.84rem; margin-top: 0.35rem; line-height: 1.45; }

.empty-state {
    text-align: center;
    padding: 3.5rem 1.5rem;
    color: var(--text-dim);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.01);
}
.empty-state a { color: var(--brand-hover); }

.badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.68rem;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-family: var(--mono);
}
.badge-ok { background: rgba(52, 211, 153, 0.12); color: #6ee7b7; }
.badge-down { background: rgba(248, 113, 113, 0.12); color: #fca5a5; }
.badge-warn { background: rgba(251, 191, 36, 0.12); color: #fcd34d; }
.badge-muted { background: rgba(113, 113, 122, 0.18); color: #d4d4d8; }

.tabs {
    display: flex;
    gap: 0.2rem;
    flex-wrap: wrap;
    margin: 1.25rem 0 1rem;
    padding: 0.25rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    width: fit-content;
    max-width: 100%;
}
.tab {
    color: var(--text-dim);
    text-decoration: none;
    padding: 0.45rem 0.8rem;
    border-radius: 7px;
    font-size: 0.82rem;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}
.tab:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.tab.active {
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 0 0 1px var(--border);
}

.filters { display: flex; gap: 0.4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.chip {
    color: var(--text-dim);
    text-decoration: none;
    padding: 0.35rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.chip:hover, .chip.active {
    border-color: rgba(0, 212, 170, 0.45);
    color: var(--brand-hover);
    background: var(--brand-dim);
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}
.meta-label {
    display: block;
    color: var(--text-faint);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: var(--mono);
    margin-bottom: 0.3rem;
}

.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th, .table td {
    text-align: left;
    padding: 0.7rem 0.45rem;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}
.table th {
    color: var(--text-faint);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--mono);
}
.table tr:hover td { background: rgba(255,255,255,0.015); }

.checkbox-row { display: flex !important; align-items: center; gap: 0.5rem; margin-top: 1rem; }
.checkbox-row input, .checkbox-inline input { width: auto; }
.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin: 0;
    color: var(--text-dim);
    font-size: 0.82rem;
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; }
.inline-form { margin-bottom: 1rem; max-width: 300px; }

code {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: #7dd3fc;
    background: rgba(56, 189, 248, 0.08);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

.project-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}
.project-hero h1 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 1.25rem;
    color: var(--text-faint);
    text-decoration: none;
    font-size: 0.85rem;
}
.back-link:hover { color: var(--brand-hover); }

.mobile-nav {
    display: none;
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(9,9,11,0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    justify-content: space-between;
    align-items: center;
}

@media (max-width: 900px) {
    body.app-shell { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .mobile-nav { display: flex; }
    .stats-row { grid-template-columns: 1fr; }
    .container { padding: 1.25rem 1rem 2.5rem; }
    .row-2 { grid-template-columns: 1fr; }
    .project-card { grid-template-columns: 1fr; }
}
