/* ============================================================================
   gestiona_vps — estilo corporativo «Warm Legal Intelligence»
   (design system del despacho: terracota + beige cremoso + oro apagado,
    Montserrat, glassmorphism suave, formas muy redondeadas)
   ============================================================================ */

:root {
    /* Paleta (DESIGN.md del paquete corporativo) */
    --surface: #fcf9f8;            /* fondo base beige cremoso */
    --surface-low: #f6f3f2;
    --surface-container: #f0eded;
    --card: #ffffff;
    --glass: rgba(255, 255, 255, .78);
    --ink: #1b1c1c;                /* charcoal */
    --muted: #55433d;              /* on-surface-variant cálido */
    --muted-2: #88726c;            /* outline */
    --line: #eae7e7;
    --line-warm: #dbc1b9;          /* outline-variant */

    --primary: #99462a;            /* terracota profundo */
    --primary-soft: #d97757;       /* terracota claro (container) */
    --primary-fixed: #ffdbd0;
    --on-primary: #ffffff;

    --gold: #b08d48;               /* oro apagado (tertiary-container) */
    --gold-soft: #ffdea5;

    --ok: #2e7d4f;
    --warn: #99462a;
    --bad: #ba1a1a;
    --bad-bg: #ffdad6;

    --shadow-soft: 0 18px 40px rgba(153, 70, 42, .10);
    --shadow-lift: 0 24px 55px rgba(153, 70, 42, .16);

    --r-card: 24px;                /* tarjetas */
    --r-input: 16px;               /* inputs */
    --r-pill: 100px;               /* botones píldora */
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Montserrat", "Segoe UI", system-ui, sans-serif;
    background: var(--surface);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.5;
}

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

.sidebar {
    width: 248px;
    flex: 0 0 248px;
    background: var(--surface-low);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    gap: 22px;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px; }
.brand strong {
    display: block;
    color: var(--primary);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}
.brand small {
    color: var(--muted-2);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
}
.brand-dot {
    width: 13px; height: 13px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-soft), var(--primary));
    box-shadow: 0 0 0 4px rgba(217, 119, 87, .22);
    flex: 0 0 13px;
}
.brand-logo {
    width: 34px; height: 34px; border-radius: 9px;
    flex: 0 0 34px; display: block;
    box-shadow: 0 2px 9px rgba(153, 70, 42, .22);
}
.login-card .brand-logo { width: 40px; height: 40px; flex-basis: 40px; }
.brand-center { justify-content: center; margin-bottom: 16px; }

.sidebar nav { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.sidebar nav a {
    display: flex; align-items: center; gap: 12px;
    color: var(--muted);
    text-decoration: none;
    padding: 11px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    font-weight: 600;
    transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}
.sidebar nav a .ico { width: 19px; height: 19px; flex: 0 0 19px; display: inline-flex; }
.sidebar nav a .ico svg { width: 100%; height: 100%; }
.sidebar nav a:hover { background: var(--surface-container); color: var(--ink); }
.sidebar nav a.active {
    background: linear-gradient(120deg, #b14e2e, var(--primary));
    color: var(--on-primary);
    box-shadow: var(--shadow-soft);
}

.sidebar-footer { border-top: 1px solid var(--line-warm); padding-top: 14px; }
.userbox { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding: 0 4px; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), #8a6c33);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    flex: 0 0 34px;
}
.userbox .who { min-width: 0; }
.userbox .who .name {
    font-size: 13px; font-weight: 700; color: var(--ink);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.userbox .who .role {
    font-size: 10px; font-weight: 600; color: var(--muted-2);
    letter-spacing: .08em; text-transform: uppercase;
}

.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { padding: 30px 34px 6px; }
.topbar h1 {
    margin: 0;
    font-size: 27px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--primary);
}
.topbar .subtitle { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.page { padding: 22px 34px 40px; }

/* ----------------------------------------------------------- tarjetas ----- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}
.card {
    position: relative;
    background: var(--glass);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, .9);
    border-radius: var(--r-card);
    padding: 20px 22px;
    box-shadow: var(--shadow-soft);
    transition: box-shadow .2s ease, transform .2s ease;
    overflow: hidden;
}
.card:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.card::before {
    /* acento dorado superior (Legal Insight Card) */
    content: "";
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--gold), var(--gold-soft));
    opacity: 0;
}
.card.accent-gold::before { opacity: 1; }
.card-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .09em;
}
.card-value {
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 6px 0 2px;
    color: var(--primary);
}
.card-sub { color: var(--muted-2); font-size: 12.5px; font-weight: 500; }
.card-ok   .card-value { color: var(--ok); }
.card-warn .card-value { color: var(--gold); }
.card-bad  { border-color: var(--bad-bg); background: #fff6f5; }
.card-bad  .card-value { color: var(--bad); }

/* ------------------------------------------------------------- paneles ---- */
.panel {
    background: var(--glass);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, .9);
    border-radius: var(--r-card);
    padding: 24px 28px;
    box-shadow: var(--shadow-soft);
}
.panel h2 {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink);
}
.panel-empty { text-align: center; padding: 52px 28px; }
.muted { color: var(--muted-2); }
.steps { line-height: 2; padding-left: 20px; color: var(--muted); }
.steps strong { color: var(--primary); font-weight: 700; }

/* ---------------------------------------------------------- formularios --- */
label {
    display: block;
    margin: 14px 0 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
}
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
select, textarea {
    width: 100%;
    padding: 11px 15px;
    border: 1px solid transparent;
    border-radius: var(--r-input);
    font: inherit;
    font-size: 14px;
    background: var(--surface-container);
    color: var(--ink);
    transition: box-shadow .18s ease, background .18s ease, border-color .18s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    background: #fff;
    border-color: var(--line-warm);
    box-shadow: 0 0 0 4px rgba(217, 119, 87, .18); /* glow terracota suave */
}

.btn {
    display: inline-block;
    border: 1px solid transparent;
    border-radius: var(--r-pill);
    padding: 11px 24px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: .02em;
    cursor: pointer;
    transition: background-position .35s ease, box-shadow .2s ease, transform .15s ease;
}
.btn-primary {
    /* botón «sliding»: el degradado terracota se desliza al pasar el ratón */
    background: linear-gradient(110deg, var(--primary-soft) 0%, var(--primary) 55%, #7a2f15 100%);
    background-size: 220% 100%;
    background-position: 0% 0%;
    color: var(--on-primary);
    box-shadow: 0 10px 26px rgba(153, 70, 42, .28);
}
.btn-primary:hover { background-position: 95% 0%; box-shadow: 0 14px 32px rgba(153, 70, 42, .36); }
.btn-primary:active { transform: scale(.98); }
.btn-ghost {
    background: var(--glass);
    color: var(--primary);
    border-color: var(--line-warm);
}
.btn-ghost:hover { background: #fff; box-shadow: var(--shadow-soft); }
.btn-sm { padding: 7px 16px; font-size: 12px; }
.btn-block { width: 100%; margin-top: 20px; }

/* --------------------------------------------------------------- login ---- */
.login-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(900px 500px at 85% -10%, rgba(217, 119, 87, .16), transparent 60%),
        radial-gradient(700px 420px at -10% 105%, rgba(176, 141, 72, .14), transparent 60%),
        var(--surface);
}
.login-card {
    width: 400px; max-width: calc(100vw - 32px);
    background: var(--glass);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, .95);
    border-radius: var(--r-card);
    padding: 34px 36px;
    box-shadow: var(--shadow-lift);
}
.login-card .brand strong { font-size: 19px; }
.login-foot {
    color: var(--muted-2);
    font-size: 11.5px;
    text-align: center;
    margin-top: 20px;
    line-height: 1.6;
}
.login-card pre {
    background: var(--surface-container);
    border: 1px solid var(--line);
    border-radius: var(--r-input);
    padding: 12px 14px;
    font-size: 12px;
    overflow-x: auto;
}
.login-card code { color: var(--primary); font-weight: 600; }

/* -------------------------------------------------------------- alertas --- */
.alert {
    border-radius: var(--r-input);
    padding: 11px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 500;
}
.alert-error { background: var(--bad-bg); color: #93000a; border: 1px solid #ffc4bd; }
.alert-warn  { background: #fff3dd; color: #5d4201; border: 1px solid var(--gold-soft); }
.alert-ok    { background: #e2f3e8; color: #1d5a38; border: 1px solid #bfe5cd; }

/* ------------------------------------------------- tablas (próximos pasos) - */
table.grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--glass);
    border: 1px solid rgba(255, 255, 255, .9);
    border-radius: var(--r-card);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}
table.grid th, table.grid td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    font-size: 13.5px;
}
table.grid th {
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: .09em;
    background: var(--surface-low);
}
table.grid tr:last-child td { border-bottom: none; }
table.grid tr:hover td { background: rgba(255, 255, 255, .65); }

/* -------------------------------------------------- formularios CRUD ------ */
.actions-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 18px;
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 22px;
}
.form-span2 { grid-column: 1 / -1; }
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}
label.check {
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: none;
    letter-spacing: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    background: var(--surface-container);
    border-radius: var(--r-input);
    padding: 11px 15px;
    cursor: pointer;
}
label.check input[type="checkbox"] {
    width: 17px; height: 17px;
    accent-color: var(--primary);
    flex: 0 0 17px;
}
@media (max-width: 900px) {
    .form-grid { grid-template-columns: 1fr; }
}

/* ------------------------------------------------ jobs / programación ----- */
.inline-form {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.inline-form select, .inline-form input { width: auto; min-width: 180px; }

/* ---- Diálogo de confirmación propio (sustituye al confirm() nativo) ---- */
.gv-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(31, 36, 48, .45);
    backdrop-filter: blur(3px);
    display: none;
    align-items: center; justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.gv-modal-overlay.open { display: flex; }
.gv-modal {
    width: 420px; max-width: calc(100vw - 40px);
    background: var(--card);
    border-radius: var(--r-card);
    box-shadow: var(--shadow-lift);
    border: 1px solid rgba(255, 255, 255, .9);
    padding: 26px 28px 22px;
    animation: gv-pop .14s ease-out;
}
@keyframes gv-pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.gv-modal-body { font-size: 15px; line-height: 1.5; color: var(--ink); }
.gv-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

.hn-edit summary { list-style: none; cursor: pointer; display: inline-block; }
.hn-edit summary::-webkit-details-marker { display: none; }
.hn-form { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.hn-form input[type="text"] { width: auto; min-width: 180px; padding: 6px 10px; font-size: 13px; }

.log-box {
    background: #241d1a;            /* charcoal cálido, terminal-like */
    color: #f3e9e4;
    border-radius: var(--r-input);
    padding: 16px 18px;
    font-family: Consolas, "Cascadia Mono", monospace;
    font-size: 12.5px;
    line-height: 1.65;
    max-height: 480px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* píldoras de estado (para clientes/servidores/jobs de los próximos pasos) */
.pill {
    display: inline-block;
    border-radius: var(--r-pill);
    padding: 3px 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
}
.pill-ok    { background: #e2f3e8; color: var(--ok); }
.pill-warn  { background: #fff3dd; color: #775a19; }
.pill-bad   { background: var(--bad-bg); color: #93000a; }
.pill-info  { background: var(--primary-fixed); color: var(--primary); }
.pill-muted { background: var(--surface-container); color: var(--muted-2); }
