/* ============================================================
   Panel Monitor - Estilo NOC Dark
   Inspirado en Grafana/Linear con personalidad técnica
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Surfaces - ascendente en luminosidad */
    --bg-base:        #0a0e14;
    --bg-surface:     #11161e;
    --bg-elevated:    #161c26;
    --bg-overlay:     #1c2330;
    --bg-hover:       #1f2733;

    /* Borders */
    --border-subtle:  #1f2733;
    --border-default: #2a3441;
    --border-strong:  #3a4555;

    /* Text */
    --text-primary:   #e6edf3;
    --text-secondary: #9ba9b8;
    --text-tertiary:  #6e7e8e;
    --text-muted:     #4a5563;

    /* Brand & status */
    --brand:          #4dd0a8;
    --brand-dim:      #2a8a6e;
    --brand-glow:     rgba(77, 208, 168, 0.15);

    --status-online:  #4dd0a8;
    --status-warn:    #f5c14e;
    --status-offline: #f25f5c;
    --status-unknown: #6e7e8e;

    /* Accent secondary (purple controlado, no morado AI) */
    --accent:         #8b9cf2;
    --accent-dim:     #5a6dc7;

    /* Shadows */
    --shadow-sm:      0 1px 2px rgba(0,0,0,0.3);
    --shadow-md:      0 4px 12px rgba(0,0,0,0.35);
    --shadow-lg:      0 12px 32px rgba(0,0,0,0.45);

    /* Type scale */
    --font-sans:      'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono:      'JetBrains Mono', 'SF Mono', Consolas, monospace;

    /* Layout */
    --sidebar-w:      240px;
    --header-h:       56px;
    --radius-sm:      4px;
    --radius-md:      6px;
    --radius-lg:      10px;
}

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

html, body {
    background: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-height: 100vh;
    /* Sutil noise para que no sea un dark plano */
    background-image:
        radial-gradient(circle at 1px 1px, rgba(255,255,255,0.015) 1px, transparent 0);
    background-size: 32px 32px;
}

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

code, pre, .mono { font-family: var(--font-mono); font-size: 13px; }

/* ============================================================
   LAYOUT
   ============================================================ */

.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--header-h) 1fr;
    grid-template-areas:
        "sidebar header"
        "sidebar main";
    min-height: 100vh;
}

.app--auth {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    grid-template-areas: "main";
    place-items: center;
}

/* SIDEBAR */
.sidebar {
    grid-area: sidebar;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar__brand {
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    border-bottom: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: -0.01em;
}

.sidebar__brand-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 12px var(--brand);
    animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.sidebar__nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar__group-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 12px 8px 6px;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.sidebar__link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar__link.is-active {
    background: var(--bg-elevated);
    color: var(--text-primary);
    box-shadow: inset 2px 0 0 var(--brand);
}

.sidebar__link-icon {
    width: 16px;
    height: 16px;
    opacity: 0.85;
}

.sidebar__footer {
    border-top: 1px solid var(--border-subtle);
    padding: 12px;
    font-size: 12px;
    color: var(--text-tertiary);
}

/* HEADER */
.header {
    grid-area: header;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header__title {
    font-size: 15px;
    font-weight: 600;
}

.header__actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header__live {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-tertiary);
    padding: 4px 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
}

.header__live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--status-online);
    animation: pulse 1.5s infinite;
}

/* MAIN */
.main {
    grid-area: main;
    padding: 24px 28px;
    overflow-y: auto;
}

/* ============================================================
   COMPONENTES
   ============================================================ */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-default);
}

.btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

.btn--primary {
    background: var(--brand);
    color: var(--bg-base);
    border-color: var(--brand);
    font-weight: 600;
}

.btn--primary:hover {
    background: var(--brand-dim);
    border-color: var(--brand-dim);
    color: var(--text-primary);
}

.btn--ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-secondary);
}

.btn--ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn--danger {
    background: transparent;
    color: var(--status-offline);
    border-color: var(--border-default);
}

.btn--danger:hover {
    background: rgba(242, 95, 92, 0.1);
    border-color: var(--status-offline);
}

.btn--block { width: 100%; }
.btn--sm { height: 28px; padding: 0 10px; font-size: 12px; }

/* Inputs */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.field__label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.field__hint {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.input, .select, .textarea {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    background: var(--bg-base);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-glow);
}

.input--mono { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.04em; }

.textarea {
    height: auto;
    min-height: 96px;
    padding: 10px 12px;
    resize: vertical;
    font-family: var(--font-sans);
    line-height: 1.5;
}

/* Card */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card__header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card__title {
    font-size: 14px;
    font-weight: 600;
}

.card__body {
    padding: 20px;
}

/* Alerts (UI flash messages) */
.alert {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    background: var(--bg-elevated);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert--error {
    border-color: rgba(242, 95, 92, 0.4);
    background: rgba(242, 95, 92, 0.08);
    color: #ffb3b1;
}

.alert--success {
    border-color: rgba(77, 208, 168, 0.4);
    background: rgba(77, 208, 168, 0.08);
    color: #b8f0d9;
}

.alert--warning {
    border-color: rgba(245, 193, 78, 0.4);
    background: rgba(245, 193, 78, 0.08);
    color: #f5d896;
}

/* Status indicator */
.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

.status__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status--online .status__dot { background: var(--status-online); box-shadow: 0 0 8px var(--status-online); }
.status--warning .status__dot { background: var(--status-warn); box-shadow: 0 0 8px var(--status-warn); }
.status--offline .status__dot { background: var(--status-offline); box-shadow: 0 0 8px var(--status-offline); }
.status--unknown .status__dot { background: var(--status-unknown); }

.status--online { color: var(--status-online); }
.status--warning { color: var(--status-warn); }
.status--offline { color: var(--status-offline); }
.status--unknown { color: var(--status-unknown); }

/* ============================================================
   LOGIN / AUTH SCREENS
   ============================================================ */

.auth-shell {
    width: 100%;
    max-width: 400px;
    padding: 32px;
}

.auth-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

/* Sutil glow superior */
.auth-card::before {
    content: '';
    position: absolute;
    top: 0; left: 50%;
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--brand), transparent);
    transform: translateX(-50%);
    opacity: 0.6;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.auth-brand__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 12px var(--brand);
    animation: pulse 2.5s ease-in-out infinite;
}

.auth-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.auth-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.auth-footer-note {
    margin-top: 20px;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
}

/* TOTP code input */
.totp-input {
    text-align: center;
    font-family: var(--font-mono);
    font-size: 24px;
    letter-spacing: 0.5em;
    height: 56px;
    padding-left: 0.5em; /* compensar el letter-spacing */
}

/* Spinner */
.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-default);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Utilities */
.text-mono { font-family: var(--font-mono); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--status-online); }
.text-warning { color: var(--status-warn); }
.text-danger { color: var(--status-offline); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

/* Responsive */
@media (max-width: 768px) {
    .app {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "main";
    }
    .sidebar { display: none; }
    .main { padding: 16px; }
}

/* ============================================================
   FASE 2 - Tablas, Badges, Forms avanzados
   ============================================================ */

/* Tables */
.table-wrap {
    overflow-x: auto;
    margin: 0 -20px;
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.table thead {
    background: var(--bg-base);
    border-bottom: 1px solid var(--border-default);
}
.table thead th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    white-space: nowrap;
}
.table tbody tr {
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.1s;
}
.table tbody tr:hover {
    background: var(--bg-hover);
}
.table tbody tr:last-child {
    border-bottom: none;
}
.table tbody td {
    padding: 12px 14px;
    color: var(--text-primary);
    vertical-align: middle;
}
.table .actions-col {
    text-align: right;
    white-space: nowrap;
}
.table .empty-row td {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
    font-style: italic;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
}
.badge--propio {
    background: rgba(139, 156, 242, 0.1);
    color: var(--accent);
    border-color: rgba(139, 156, 242, 0.3);
}
.badge--cliente {
    background: rgba(245, 193, 78, 0.1);
    color: var(--status-warn);
    border-color: rgba(245, 193, 78, 0.3);
}
.badge--success { background: rgba(77, 208, 168, 0.1); color: var(--status-online); border-color: rgba(77, 208, 168, 0.3); }
.badge--danger { background: rgba(242, 95, 92, 0.1); color: var(--status-offline); border-color: rgba(242, 95, 92, 0.3); }
.badge--neutral { background: var(--bg-elevated); color: var(--text-tertiary); }

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.toolbar__search {
    flex: 1;
    min-width: 200px;
    max-width: 320px;
}
.toolbar__filters {
    display: flex;
    gap: 4px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 3px;
}
.toolbar__filter-btn {
    padding: 6px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all 0.1s;
}
.toolbar__filter-btn:hover { color: var(--text-primary); }
.toolbar__filter-btn.is-active {
    background: var(--bg-overlay);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-grid--3 { grid-template-columns: repeat(3, 1fr); }
.form-grid--full { grid-column: 1 / -1; }

@media (max-width: 768px) {
    .form-grid, .form-grid--3 { grid-template-columns: 1fr; }
}

.form-section {
    margin-bottom: 28px;
}
.form-section__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-section__hint {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
}

.field--has-error .input,
.field--has-error .select,
.field--has-error .textarea {
    border-color: var(--status-offline);
}
.field__error {
    color: var(--status-offline);
    font-size: 11px;
    margin-top: 4px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
}
.checkbox-row input[type=checkbox] {
    width: 16px;
    height: 16px;
    accent-color: var(--brand);
    cursor: pointer;
}
.checkbox-row label {
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
}

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header__title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.page-header__subtitle {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* Empty state */
.empty-state {
    padding: 48px 24px;
    text-align: center;
}
.empty-state__icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    color: var(--text-muted);
    opacity: 0.5;
}
.empty-state__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.empty-state__text {
    font-size: 13px;
    color: var(--text-tertiary);
    max-width: 360px;
    margin: 0 auto 20px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 20px;
}
.tab {
    padding: 10px 16px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.1s;
    background: transparent;
    border-left: none;
    border-right: none;
    border-top: none;
    font-family: var(--font-sans);
}
.tab:hover { color: var(--text-primary); }
.tab.is-active {
    color: var(--text-primary);
    border-bottom-color: var(--brand);
}

/* QR code container (TOTP setup) */
.qr-container {
    background: white;
    padding: 16px;
    border-radius: var(--radius-md);
    display: inline-block;
    margin: 16px 0;
}
.qr-secret {
    font-family: var(--font-mono);
    font-size: 14px;
    background: var(--bg-base);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    word-break: break-all;
    user-select: all;
    color: var(--brand);
    letter-spacing: 0.05em;
}

/* Detail rows (vista de cliente, etc) */
.detail-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row__label {
    color: var(--text-tertiary);
    font-size: 12px;
}
.detail-row__value {
    color: var(--text-primary);
}
.detail-row__value.is-empty {
    color: var(--text-muted);
    font-style: italic;
}

/* Helpers */
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ============================================================
   FASE 4 — Dashboard NOC con anillos
   ============================================================ */

.live-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.svr-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 14px;
    transition: border-color 0.15s, transform 0.15s;
    text-decoration: none;
    color: inherit;
    display: block;
    cursor: pointer;
}
.svr-card:hover {
    border-color: var(--brand);
    transform: translateY(-1px);
}

.svr-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.svr-card__title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.svr-card__slug {
    font-size: 10px;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.svr-card__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
    flex-wrap: wrap;
}

.svr-card__client {
    font-size: 10px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
}

.svr-card__rings {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.ring-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ring {
    position: relative;
    width: 58px;
    height: 58px;
}
.ring svg {
    width: 58px;
    height: 58px;
    transform: rotate(-90deg);
}
.ring__bg {
    fill: none;
    stroke: var(--border-subtle);
    stroke-width: 5;
}
.ring__fg {
    fill: none;
    stroke-width: 5;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s, stroke 0.3s;
}
.ring__fg--good { stroke: var(--status-online); }
.ring__fg--warn { stroke: var(--status-warn); }
.ring__fg--crit { stroke: var(--status-offline); }
.ring__fg--muted { stroke: var(--border-default); }

.ring__value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-primary);
}
.ring__value--warn { color: var(--status-warn); }
.ring__value--crit { color: var(--status-offline); }
.ring__value--muted { color: var(--text-muted); }

.ring__label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 4px;
}

.svr-card__services {
    display: flex;
    gap: 8px 10px;
    flex-wrap: wrap;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
    margin-bottom: 8px;
    min-height: 18px;
}

.svc-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}
.svc-pill__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.svc-pill__dot--up { background: var(--status-online); }
.svc-pill__dot--down { background: var(--status-offline); }

.svr-card__footer {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
}

.svr-card__banner {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    text-align: center;
    margin-bottom: 8px;
}
.svr-card__banner--warn {
    background: rgba(245, 193, 78, 0.1);
    color: var(--status-warn);
}
.svr-card__banner--err {
    background: rgba(242, 95, 92, 0.1);
    color: var(--status-offline);
}
.svr-card__banner--muted {
    background: var(--bg-base);
    color: var(--text-tertiary);
}

.svr-card__empty {
    text-align: center;
    padding: 20px 0;
    color: var(--text-tertiary);
    font-size: 12px;
}

/* Indicador live con countdown */
.live-pulse {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}
.live-pulse__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--status-online);
    animation: pulse 2s ease-in-out infinite;
}
.live-pulse--stale .live-pulse__dot {
    background: var(--status-offline);
    animation: none;
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

/* Skeleton para carga inicial */
.svr-card--skeleton {
    pointer-events: none;
    opacity: 0.6;
}
.skeleton-line {
    background: linear-gradient(90deg,
        var(--bg-base) 0%,
        var(--border-subtle) 50%,
        var(--bg-base) 100%);
    background-size: 200% 100%;
    animation: skel 1.5s infinite;
    border-radius: 3px;
    height: 10px;
}
@keyframes skel {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Stats grid del dashboard */
.stats-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
}
.stats-grid__card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    min-width: 0;
}

/* ============================================================
   FASE 4 — Clases adicionales (sin estilos inline para CSP)
   ============================================================ */

/* Stats grid */
.stats-grid__label {
    font-size: 10px;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    text-transform: uppercase;
    font-family: var(--font-mono);
}
.stats-grid__value {
    font-size: 22px;
    font-weight: 600;
    margin-top: 4px;
}
.stats-grid__sub {
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* Live header */
.dashboard__live-header {
    margin-bottom: 12px;
}
.dashboard__live-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    margin: 0;
}

/* Live grid loading */
.live-grid__loading {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-tertiary);
    padding: 30px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
}

/* Live grid empty */
.live-grid__empty {
    grid-column: 1 / -1;
}
.live-grid__empty-body {
    text-align: center;
    padding: 40px;
}
.live-grid__empty-btn {
    margin-top: 12px;
}

/* Server card refinements */
.svr-card__head-left {
    min-width: 0;
    flex: 1;
}
.svr-card__type {
    font-size: 9px;
    padding: 1px 6px;
}
.svr-card__status {
    font-size: 9px;
}

/* Bottom section */
.dashboard__bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 720px) {
    .dashboard__bottom {
        grid-template-columns: 1fr;
    }
}

.card__body-note {
    font-size: 13px;
}

.table--compact {
    font-size: 12px;
}

.text-xs {
    font-size: 11px;
}

/* Charts en ver.php (alturas fijas para evitar bug Chart.js) */
.charts__loading {
    padding: 30px;
    text-align: center;
    font-size: 13px;
    color: var(--text-tertiary);
}
.charts__empty {
    text-align: center;
    padding: 30px;
    color: var(--text-tertiary);
    font-size: 13px;
}
.charts__info {
    text-align: right;
    font-size: 10px;
    margin-top: 8px;
}
.charts__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 720px) {
    .charts__grid {
        grid-template-columns: 1fr;
    }
}
.chart-box {
    min-width: 0;
}
.chart-box__label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
    font-family: var(--font-mono);
}
.chart-box__canvas-wrap {
    position: relative;
    height: 200px;
    width: 100%;
}
.chart-box__canvas-wrap canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
}

/* ============================================================
   ver.php — clases para limpieza de estilos inline
   ============================================================ */

/* Métricas grid (Estado actual) */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}
.metric-box {
    padding: 12px;
    background: var(--bg-base);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}
.metric-box__label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: var(--font-mono);
}
.metric-box__label--mb {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
    font-family: var(--font-mono);
}
.metric-box__value {
    font-size: 22px;
    font-weight: 600;
    margin-top: 4px;
}
.metric-box__value--md {
    font-size: 18px;
    font-weight: 600;
    margin-top: 4px;
}
.metric-box__value--sm {
    font-size: 14px;
    font-weight: 600;
    margin-top: 4px;
}

/* Two column grid */
.two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
@media (max-width: 720px) {
    .two-col-grid {
        grid-template-columns: 1fr;
    }
}

/* Iconos pequeños */
.icon-fixed {
    flex-shrink: 0;
    margin-top: 1px;
}

/* Tipografía mini */
.text-12 { font-size: 12px; }
.text-md-bold { font-size: 14px; font-weight: 600; }
.text-xs-break { font-size: 11px; word-break: break-all; }
.pre-wrap { white-space: pre-wrap; }
.pre-wrap-note { white-space: pre-wrap; font-size: 13px; color: var(--text-secondary); }
.pre-wrap-mono {
    white-space: pre-wrap;
    font-size: 13px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    margin-top: 6px;
}
.section-divider {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}
.section-divider-label {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 16px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Modal del agente */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-backdrop.is-open {
    display: flex;
}
.modal-content {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-body {
    padding: 22px;
}
.modal-footer {
    padding: 18px 22px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.btn-close-modal {
    background: none;
    border: 0;
    color: var(--text-tertiary);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.modal-metric-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 12px;
}
.modal-mini-metric {
    background: var(--bg-base);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}
.modal-mini-metric__label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 3px;
}
.modal-mini-metric__value {
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-mono);
}
.svc-pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

/* Flex helpers */
.hflex-sm {
    display: flex;
    align-items: center;
    gap: 8px;
}
.fl-wrap-sm {
    flex-wrap: wrap;
    gap: 6px;
}

/* Badges sm */
.badge-sm-pill {
    font-size: 11px;
    padding: 2px 8px;
}
.badge-xs-pill {
    font-size: 10px;
    padding: 1px 6px;
}

/* Auto-generadas v-N */
.v-1 { padding: 30px; text-align: center; font-size: 13px; }
.v-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.v-3 { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.v-4 { max-height: 180px; }
.v-5 { text-align: center; padding: 30px; color: var(--text-tertiary); font-size: 13px; }
.v-6 { text-align: right; font-size: 10px; margin-top: 8px; }
.v-7 { text-align: center; padding: 30px; color: var(--text-secondary); }
.v-8 { margin-top: 14px; }
.v-9 { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.v-10 { display: flex; flex-wrap: wrap; gap: 6px; }
.v-11 { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-subtle); }
.v-12 { margin-top: 14px; font-size: 13px; color: var(--text-secondary); }
.v-13 { margin-top: 8px; padding-left: 20px; }

@media (max-width: 720px) {
    .v-2 { grid-template-columns: 1fr; }
}