/* ==========================================================================
   Vigía IRC — tablero de vigilancia estilo consola
   Layout "grill": sidebar con icono+label y píldora activa, contenido en cards.
   Tipografía monoespaciada en todo para alinear nick/host/IP/hora como terminal.
   --font-mono es la ÚNICA fuente: cámbiala aquí y cambia todo el panel.
   ========================================================================== */

:root {
    /* Fondo cálido tipo papel, superficies claras */
    --bg:          #F7F4EF;
    --surface:     #FFFFFF;
    --surface-2:   #FBF8F3;
    --border:      #E7DFD3;
    --border-strong:#D8CCBB;

    --text:        #1F1B17;
    --text-soft:   #6B6157;
    --text-faint:  #9A9186;

    /* Naranja = marca (nav, píldora activa, acentos, enlaces) */
    --primary-900: #7A3B0E;
    --primary-800: #9A4A12;  /* píldora activa */
    --primary-700: #B85916;
    --primary-500: #E07B27;  /* acento / iconos */
    --primary-100: #FBEDDD;  /* tints */

    /* Estados: paleta propia, no se mezcla con el naranja de marca */
    --ok-700:      #2E7D5B;  --ok-100: #E3F3EC;   /* en línea */
    --warn-700:    #C08A00;  --warn-100:#FBF0CC;  /* netsplit */
    --danger-700:  #C62828;  --danger-100:#FBE9E9;/* caído */
    --info-700:    #4B5563;  --info-100:#EEF0F2;  /* sin señal */

    --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', 'Cascadia Code',
                 'Source Code Pro', Menlo, Consolas, 'Liberation Mono', monospace;

    --radius: 8px;
    --sidebar-w: 232px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-700); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------- Estructura ------------------------------------------------------- */

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

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 18px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.brand-mark {
    width: 30px; height: 30px;
    border-radius: 7px;
    background: var(--primary-800);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    letter-spacing: -1px;
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.3px; }
.brand-sub  { font-size: 11px; color: var(--text-faint); }

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: var(--radius);
    color: var(--text-soft);
    font-size: 13px;
    transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav-item.active {
    background: var(--primary-800);
    color: #fff;
}
.nav-item.active .nav-icon { color: #fff; }
.nav-item .nav-icon { width: 18px; height: 18px; color: var(--primary-500); flex-shrink: 0; }
.nav-item .badge {
    margin-left: auto;
    background: var(--danger-100);
    color: var(--danger-700);
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
}
.nav-item.active .badge { background: rgba(255,255,255,.22); color: #fff; }

.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }

/* ------- Contenido -------------------------------------------------------- */

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

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 16px; margin: 0; font-weight: 700; letter-spacing: -0.3px; }
.topbar .spacer { flex: 1; }

.vigia-pulse {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 12px; padding: 5px 11px;
    border-radius: 999px; border: 1px solid var(--border);
    background: var(--surface-2);
}
.vigia-pulse .dot { width: 8px; height: 8px; border-radius: 50%; }
.vigia-pulse.up   .dot { background: var(--ok-700);   box-shadow: 0 0 0 3px var(--ok-100); }
.vigia-pulse.down .dot { background: var(--danger-700); box-shadow: 0 0 0 3px var(--danger-100); }
.vigia-pulse.up   { color: var(--ok-700); }
.vigia-pulse.down { color: var(--danger-700); }

.content { padding: 24px 28px 48px; max-width: 1180px; }

.logout { font-size: 12px; color: var(--text-faint); }

/* ------- Banner de aviso -------------------------------------------------- */

.notice {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 14px; border-radius: var(--radius);
    background: var(--warn-100); color: var(--warn-700);
    border: 1px solid #EAD9A0;
    font-size: 13px; margin-bottom: 18px;
}
.notice.danger { background: var(--danger-100); color: var(--danger-700); border-color: #F0C9C9; }
.notice svg { width: 17px; height: 17px; flex-shrink: 0; }

/* ------- Cards / secciones ------------------------------------------------ */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
}
.card-head {
    display: flex; align-items: center; gap: 10px;
    padding: 13px 18px; border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}
.card-head h2 { font-size: 13px; margin: 0; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--text-soft); }
.card-head.vps-down { background: var(--danger-100); }
.card-head.vps-down h2 { color: var(--danger-700); }
.card-head .count { color: var(--text-faint); font-size: 12px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 4px 0; }
.card-pad  { padding: 18px; }

/* ------- Resumen (contadores) --------------------------------------------- */

.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 15px 17px;
}
.stat .n { font-size: 26px; font-weight: 700; letter-spacing: -1px; }
.stat .l { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); margin-top: 2px; }
.stat.down .n { color: var(--danger-700); }
.stat.split .n { color: var(--warn-700); }
.stat.ok .n { color: var(--ok-700); }

@media (max-width: 760px) { .summary { grid-template-columns: repeat(2, 1fr); } }

/* ------- Tabla tipo consola ----------------------------------------------- */

table.board { width: 100%; border-collapse: collapse; font-size: 13px; }
table.board th {
    text-align: left; padding: 9px 18px;
    font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-faint); font-weight: 700;
    border-bottom: 1px solid var(--border);
}
table.board td { padding: 11px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.board tr:last-child td { border-bottom: none; }
table.board tr:hover td { background: var(--surface-2); }
.nick { font-weight: 700; }
.muted { color: var(--text-faint); }
.host  { color: var(--text-soft); }

/* Fila caída resaltada */
tr.is-down td { background: var(--danger-100) !important; }
tr.is-down:hover td { background: #F8DEDE !important; }

/* ------- Pills de estado -------------------------------------------------- */

.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 700; white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.pill.ok     { background: var(--ok-100);     color: var(--ok-700); }
.pill.ok .dot     { background: var(--ok-700); }
.pill.split  { background: var(--warn-100);   color: var(--warn-700); }
.pill.split .dot  { background: var(--warn-700); }
.pill.down   { background: var(--danger-100); color: var(--danger-700); }
.pill.down .dot   { background: var(--danger-700); }
.pill.none   { background: var(--info-100);   color: var(--info-700); }
.pill.none .dot   { background: var(--info-700); }

/* ------- Botones / formularios -------------------------------------------- */

.btn {
    display: inline-flex; align-items: center; gap: 7px;
    font-family: var(--font-mono); font-size: 13px; font-weight: 600;
    padding: 8px 14px; border-radius: var(--radius);
    border: 1px solid var(--border-strong); background: var(--surface);
    color: var(--text); cursor: pointer; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--primary-800); border-color: var(--primary-800); color: #fff; }
.btn.primary:hover { background: var(--primary-900); }
.btn.danger { color: var(--danger-700); border-color: #EBC9C9; }
.btn.danger:hover { background: var(--danger-100); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-soft); }
.btn.ghost:hover { background: var(--surface-2); }

.row-actions { display: flex; gap: 7px; justify-content: flex-end; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-soft); margin-bottom: 5px; }
.field input, .field select, .field textarea {
    width: 100%; font-family: var(--font-mono); font-size: 13px;
    padding: 8px 11px; border: 1px solid var(--border-strong);
    border-radius: var(--radius); background: var(--surface); color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }

/* ------- Login ------------------------------------------------------------ */

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 340px; }
.login-card .brand { justify-content: center; border: none; padding-bottom: 8px; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: var(--text-faint); font-size: 12px; margin-bottom: 22px; }
.login-err { background: var(--danger-100); color: var(--danger-700); padding: 9px 12px; border-radius: var(--radius); font-size: 13px; margin-bottom: 14px; }

/* ------- Timeline de eventos ---------------------------------------------- */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 9px 18px; border-bottom: 1px solid var(--border); font-size: 13px; }
.timeline li:last-child { border-bottom: none; }
.timeline .ev-time { color: var(--text-faint); white-space: nowrap; min-width: 116px; }
.timeline .ev-tag { font-weight: 700; min-width: 66px; }
.ev-JOIN, .ev-REJOIN, .ev-SEEN { color: var(--ok-700); }
.ev-QUIT, .ev-PART { color: var(--danger-700); }
.ev-SPLIT { color: var(--warn-700); }
.ev-NICK { color: var(--primary-700); }
.timeline .ev-detail { color: var(--text-soft); }

.empty { text-align: center; color: var(--text-faint); padding: 40px 20px; font-size: 13px; }

@media (max-width: 720px) {
    .sidebar { position: fixed; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
    .sidebar.open { transform: translateX(0); }
    .form-grid { grid-template-columns: 1fr; }
    .content { padding: 18px 16px 40px; }
    .topbar { padding: 14px 16px; }
}
