:root {
    --bg: #0d1117;
    --bg-soft: #141b24;
    --card: #1a2230;
    --card-edge: #232e40;
    --text: #e6edf3;
    --muted: #8b98a9;
    --brand: #3b82f6;
    --brand-2: #60a5fa;
    --ok: #2dd4a7;
    --warn: #fbbf24;
    --err: #f87171;
    --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    min-height: 100vh;
}

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

/* ---------- Login ---------- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at top, #16233a 0%, var(--bg) 60%);
    padding: 20px;
}
.login-box {
    width: 100%;
    max-width: 380px;
    background: var(--card);
    border: 1px solid var(--card-edge);
    border-radius: var(--radius);
    padding: 36px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand h1 { font-size: 24px; margin-top: 12px; }
.login-brand h1 span { color: var(--brand-2); font-weight: 300; }
.login-brand p { color: var(--muted); font-size: 13px; margin-top: 6px; }
.login-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 20px; }

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px; height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand), #7c3aed);
    color: #fff;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -.5px;
}

/* ---------- Formularios ---------- */
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
input[type=text], input[type=password], select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-soft);
    border: 1px solid var(--card-edge);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
}
input:focus, select:focus { border-color: var(--brand); }
.input-suffix { display: flex; align-items: center; gap: 8px; }
.input-suffix span { color: var(--muted); font-size: 14px; white-space: nowrap; }

.btn {
    display: inline-block;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--bg-soft);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.15); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; font-weight: 600; }
.btn-danger { background: transparent; border-color: var(--err); color: var(--err); }
.btn-danger:hover { background: var(--err); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--card-edge); color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; margin-top: 20px; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px;
    flex-shrink: 0;
    background: var(--bg-soft);
    border-right: 1px solid var(--card-edge);
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.side-brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 18px; }
.side-brand strong { display: block; font-size: 16px; }
.side-brand small { color: var(--muted); font-size: 12px; }

.side-server {
    display: flex; gap: 10px; align-items: center;
    background: var(--card);
    border: 1px solid var(--card-edge);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 18px;
}
.side-server strong { display: block; font-size: 13px; }
.side-server small { color: var(--muted); font-size: 11px; letter-spacing: .5px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot-ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }

.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 14px;
}
.sidebar nav a:hover { background: var(--card); color: var(--text); text-decoration: none; }
.sidebar nav a.active { background: var(--brand); color: #fff; font-weight: 600; }
.nav-ico { width: 18px; text-align: center; font-size: 15px; }

.side-foot {
    border-top: 1px solid var(--card-edge);
    padding-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.side-user strong { display: block; font-size: 13px; }
.side-user small { color: var(--muted); font-size: 11px; }

/* ---------- Main ---------- */
.main { flex: 1; padding: 24px 28px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.topbar h2 { font-size: 20px; font-weight: 600; }
.burger { display: none; background: none; border: none; color: var(--text); font-size: 22px; cursor: pointer; }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.card {
    background: var(--card);
    border: 1px solid var(--card-edge);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.card-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-title-row .card-title { margin-bottom: 4px; }

.stat-card canvas { max-height: 150px; margin: 6px auto; }
.stat-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.stat-pct { font-weight: 700; font-size: 15px; color: var(--ok); }
.stat-pct.warn { color: var(--warn); }
.stat-foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 4px; }

.mini-card small { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.mini-card strong { font-size: 16px; }

/* ---------- Estilo VPS: recursos, ficha y servicios ---------- */
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.meters { display: grid; gap: 14px; }
.meter-head { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; margin-bottom: 6px; }
.meter-head span:last-child { color: var(--muted); }
.meter-bar { height: 8px; border-radius: 6px; background: var(--bg-soft); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .4s; }
.meter-fill.warn { background: linear-gradient(90deg, #f59e0b, var(--warn)); }

.info-rows > div {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 9px 0; font-size: 13px;
    border-bottom: 1px solid var(--card-edge);
}
.info-rows > div:last-child { border-bottom: 0; }
.info-rows span { color: var(--muted); }
.info-rows strong { text-align: right; font-weight: 600; }

.svc-row {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 0; font-size: 13px;
    border-bottom: 1px solid var(--card-edge);
}
.svc-row:last-child { border-bottom: 0; }
.svc-row .badge { margin-left: auto; }
.dot-err { background: var(--err); box-shadow: 0 0 8px var(--err); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
    text-align: left;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--card-edge);
}
td { padding: 12px 10px; border-bottom: 1px solid rgba(35,46,64,.5); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.ta-r { text-align: right; }
.ta-c { text-align: center; }
.mono { font-family: 'Cascadia Code', 'Consolas', monospace; font-size: 13px; }
.muted { color: var(--muted); }
.note { font-size: 13px; margin-top: -4px; }

.bar {
    width: 120px; height: 6px;
    background: var(--bg-soft);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}
.bar span { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.bar span.bar-warn { background: var(--warn); }

/* ---------- Badges / alerts ---------- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-ok { background: rgba(45,212,167,.15); color: var(--ok); }
.badge-warn { background: rgba(251,191,36,.15); color: var(--warn); }
.badge-err { background: rgba(248,113,113,.15); color: var(--err); }
.badge-ghost { background: var(--bg-soft); color: var(--muted); }
.badge-demo { background: linear-gradient(135deg, #7c3aed, var(--brand)); color: #fff; letter-spacing: 1px; }

.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid;
}
.alert-ok { background: rgba(45,212,167,.1); border-color: rgba(45,212,167,.4); color: var(--ok); }
.alert-error { background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.4); color: var(--err); }
.alert-preview {
    background: rgba(124,58,237,.12);
    border-color: rgba(124,58,237,.5);
    color: #c4b5fd;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.preview-off { margin-left: auto; font-size: 13px; }

/* ---------- Modales ---------- */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(5,8,13,.7);
    backdrop-filter: blur(3px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal.open { display: flex; }
.modal-box {
    width: 100%;
    max-width: 420px;
    background: var(--card);
    border: 1px solid var(--card-edge);
    border-radius: var(--radius);
    padding: 26px;
}
.modal-box h3 { margin-bottom: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .burger { display: block; }
    .sidebar {
        position: fixed;
        left: -270px;
        z-index: 50;
        transition: left .25s;
        box-shadow: 20px 0 60px rgba(0,0,0,.5);
    }
    .sidebar.open { left: 0; }
    .main { padding: 18px 16px 60px; }
}

/* ---------- Terminal ---------- */
.term {
    background: #0a0e14;
    border: 1px solid var(--card-edge);
    border-radius: var(--radius);
    padding: 14px 16px;
    height: 62vh;
    min-height: 340px;
    overflow-y: auto;
    cursor: text;
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.5;
}
.term-out { white-space: pre-wrap; word-break: break-word; }
.term-out .cmd { color: var(--brand-2); }
.term-out .err { color: var(--err); }
.term-out .sys { color: var(--muted); }
.term-line { display: flex; align-items: baseline; gap: 8px; }
.term-prompt { color: var(--ok); white-space: nowrap; }
.term-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-family: inherit;
    font-size: inherit;
    caret-color: var(--brand-2);
}
.term.busy .term-prompt { opacity: .4; }
.term-hint { margin-top: 8px; font-size: 11px; }
