/* ControlRed · estilo inspirado en la consola de AWS */
:root {
    --nav-bg: #232f3e;
    --nav-bg-2: #16191f;
    --accent: #ff9900;
    --primary: #0972d3;
    --primary-hover: #065299;
    --bg: #f2f3f3;
    --panel: #ffffff;
    --border: #d5dbdb;
    --border-strong: #7d8998;
    --text: #16191f;
    --muted: #5f6b7a;
    --green: #037f0c;
    --green-bg: #f2fcf3;
    --red: #d91515;
    --red-bg: #fff7f7;
    --blue-bg: #f2f8fd;
    --orange: #8d6605;
    --orange-bg: #fffce9;
    --radius: 8px;
    --shadow: 0 1px 1px rgba(0, 28, 36, .3), 1px 1px 1px rgba(0, 28, 36, .15), -1px 1px 1px rgba(0, 28, 36, .15);
    --font: "Amazon Ember", "Segoe UI", "Helvetica Neue", Roboto, Arial, sans-serif;
    --mono: "Cascadia Mono", Consolas, Monaco, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.45; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { width: 16px; height: 16px; flex: none; }
h1 { font-size: 24px; font-weight: 700; margin: 0 0 4px; }
h2 { font-size: 18px; font-weight: 700; margin: 0; }
code, .mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 12px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.inline-form { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
[hidden] { display: none !important; }

/* ---------- Barra superior ---------- */
.topbar {
    position: sticky; top: 0; z-index: 10;
    height: 52px; padding: 0 20px;
    display: flex; align-items: center; justify-content: space-between;
    background: var(--nav-bg); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-flex; color: var(--accent); }
.brand-mark svg { width: 26px; height: 26px; }
.brand-name { font-weight: 700; font-size: 17px; }
.brand-sub { color: #aab7b8; font-size: 13px; padding-left: 10px; border-left: 1px solid #414d5c; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 16px;
    background: #2f3d4f; color: #d1d5db; font-size: 13px;
}
.chip-warn { background: var(--accent); color: var(--nav-bg-2); font-weight: 700; }
.btn-topbar {
    background: transparent; border: 1px solid #5f6b7a; color: #fff;
    border-radius: 16px; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer;
}
.btn-topbar:hover { border-color: #fff; }

/* ---------- Estructura ---------- */
.shell { display: flex; min-height: calc(100vh - 52px); }
.sidebar {
    width: 240px; flex: none; padding: 16px 0;
    background: var(--panel); border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
}
.sidebar-title { padding: 14px 24px 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    margin: 1px 12px; padding: 8px 12px; border-radius: 6px;
    color: var(--text); font-weight: 500;
}
.nav-item:hover { background: #f4f4f4; text-decoration: none; color: var(--primary); }
.nav-item.active { background: var(--blue-bg); color: var(--primary); font-weight: 700; box-shadow: inset 3px 0 0 var(--primary); }
.sidebar-foot { margin-top: auto; padding: 16px 24px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); }

.content { flex: 1; min-width: 0; padding: 20px 32px 48px; max-width: 1400px; }
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.breadcrumb .sep { margin: 0 6px; }
.breadcrumb span:last-child { color: var(--text); }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 20px; }
.page-header p { max-width: 760px; }

/* ---------- Paneles ---------- */
.panel { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.panel-header {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
    padding: 16px 20px; border-bottom: 1px solid #eaeded;
}
.panel-header .count { color: var(--muted); font-weight: 400; }
.panel-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel-body { padding: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 20px; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 28px; font-weight: 300; }
.stat-warn .stat-value { color: var(--red); font-weight: 500; }

/* ---------- Botones ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 6px 18px; min-height: 34px; border-radius: 20px;
    border: 2px solid transparent; font: inherit; font-weight: 700; cursor: pointer;
    text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-normal { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-normal:hover { background: var(--blue-bg); color: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger-outline { background: #fff; color: var(--red); border-color: var(--red); }
.btn-danger-outline:hover { background: var(--red-bg); }
.btn-link { background: transparent; color: var(--primary); }
.btn-link:hover { background: var(--blue-bg); }
.btn-sm { padding: 2px 10px; min-height: 28px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.field-label { font-weight: 700; font-size: 14px; }
.field-hint { color: var(--muted); font-size: 12px; }
.field-error { color: var(--red); font-size: 12px; font-weight: 700; }
.field-error:empty { display: none; }
.optional { color: var(--muted); font-weight: 400; font-style: italic; }
.input {
    width: 100%; padding: 6px 10px; min-height: 34px;
    border: 2px solid var(--border-strong); border-radius: 8px;
    font: inherit; color: var(--text); background: #fff;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(9, 114, 211, .2); }
.input[readonly] { background: #f4f4f4; border-color: #b6bec9; color: var(--muted); }
.input.input-validation-error { border-color: var(--red); }
.input-search { width: 280px; }
select.input { cursor: pointer; }
.form-stack { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; }
.checks { display: flex; gap: 20px; flex-wrap: wrap; padding-top: 6px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }

.rule-grid { display: grid; grid-template-columns: 1.3fr .8fr 1fr 1.6fr 1fr; gap: 16px; align-items: start; }
.addr-input { margin-top: 6px; }
.summary {
    margin-top: 20px; padding: 12px 16px; border-radius: 8px;
    background: var(--blue-bg); border: 1px solid #b5d6f4; color: #033160;
}
.summary:empty { display: none; }
.summary strong { font-weight: 700; }

details.advanced { border-top: 1px solid #eaeded; }
details.advanced summary { padding: 14px 20px; cursor: pointer; font-weight: 700; color: var(--primary); }

/* Segmentado (filtros y Permitir/Bloquear) */
.segmented { display: inline-flex; border: 2px solid var(--border-strong); border-radius: 20px; overflow: hidden; }
.segmented a, .segmented label { padding: 5px 14px; color: var(--text); font-weight: 700; font-size: 13px; cursor: pointer; }
.segmented a + a, .segmented label + label { border-left: 1px solid var(--border); }
.segmented a:hover { text-decoration: none; background: #f4f4f4; }
.segmented a.on { background: var(--nav-bg); color: #fff; }
.segmented-input input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-input label { display: flex; align-items: center; min-height: 30px; }
.segmented-input label:has(input:checked).seg-allow { background: var(--green); color: #fff; }
.segmented-input label:has(input:checked).seg-block { background: var(--red); color: #fff; }
.segmented-input label:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: -2px; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left; padding: 10px; font-weight: 700; font-size: 13px; color: var(--muted);
    background: #fafafa; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 10px; border-bottom: 1px solid #eaeded; vertical-align: middle; }
.table tbody tr:hover { background: #f9fafb; }
.table th.right, .table td.right { text-align: right; }
.row-disabled td { color: var(--muted); }
.rule-name { font-weight: 700; color: var(--text); }
.row-disabled .rule-name { color: var(--muted); }
.rule-desc { font-size: 12px; color: var(--muted); max-width: 320px; }
.cell-name { min-width: 200px; }
.cell-type { min-width: 120px; }
.cell-addr { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-details { max-width: 520px; font-size: 13px; color: #414d5c; overflow-wrap: anywhere; }
.td-actions { display: flex; gap: 8px; justify-content: flex-end; }
.table td.right .inline-form { margin-left: 4px; }
.table td.right { width: 1%; }
.empty-filter { padding: 24px; text-align: center; color: var(--muted); }

.badge {
    display: inline-block; padding: 1px 10px; border-radius: 12px;
    font-size: 12px; font-weight: 700; border: 1px solid transparent; white-space: nowrap;
}
.badge-green { color: var(--green); background: var(--green-bg); border-color: #9ad6a0; }
.badge-red { color: var(--red); background: var(--red-bg); border-color: #f5b5b5; }
.badge-blue { color: var(--primary); background: var(--blue-bg); border-color: #b5d6f4; }
.badge-orange { color: var(--orange); background: var(--orange-bg); border-color: #f2d27d; }
.badge-grey { color: #414d5c; background: #f4f4f4; border-color: var(--border); }
.tag { display: inline-block; margin-top: 4px; padding: 0 8px; font-size: 11px; border-radius: 4px; font-weight: 700; }
.tag-system { background: #eaeded; color: #414d5c; }

/* Interruptor */
.switch {
    position: relative; width: 36px; height: 20px; padding: 0; flex: none;
    border: none; border-radius: 10px; background: #8c96a3; cursor: pointer; transition: background .15s;
}
.switch .knob {
    position: absolute; top: 3px; left: 3px; width: 14px; height: 14px;
    border-radius: 50%; background: #fff; transition: left .15s;
}
.switch.on { background: var(--primary); }
.switch.on .knob { left: 19px; }
.switch:disabled { opacity: .5; cursor: not-allowed; }
.status-text { font-size: 13px; white-space: nowrap; }

/* Vacío */
.empty { padding: 48px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty-title { font-weight: 700; font-size: 16px; }

/* Filtros auditoría */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 16px 20px; border-bottom: 1px solid #eaeded; }
.filters .field { min-width: 150px; }
.filters .field-grow { flex: 1; min-width: 200px; }
.filter-actions { display: flex; gap: 8px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; }
.pager div { display: flex; gap: 8px; }

/* ---------- Alertas ---------- */
.alert { padding: 12px 16px; border-radius: 8px; border: 2px solid; margin-bottom: 16px; }
.alert-success { background: var(--green-bg); border-color: var(--green); }
.alert-error { background: var(--red-bg); border-color: var(--red); }
.alert-warning { background: var(--orange-bg); border-color: #f2b705; }
.alert-info { background: var(--blue-bg); border-color: var(--primary); }
.alert ul { margin: 0; padding-left: 18px; }
.validation-summary-valid { display: none; }
.alert.fade { opacity: 0; transition: opacity .6s; }

/* ---------- Login / MFA ---------- */
.auth-body { background: linear-gradient(160deg, var(--nav-bg) 0%, var(--nav-bg-2) 55%, #0f1b2a 100%); min-height: 100vh; }
.auth-wrap { max-width: 440px; margin: 0 auto; padding: 56px 16px; }
.auth-brand { display: flex; align-items: center; gap: 12px; color: #fff; margin-bottom: 20px; }
.auth-brand .brand-mark svg { width: 40px; height: 40px; }
.auth-brand-name { font-size: 22px; font-weight: 700; }
.auth-brand-sub { font-size: 13px; color: #aab7b8; }
.auth-card { background: #fff; border-radius: 12px; padding: 28px; box-shadow: 0 10px 40px rgba(0, 0, 0, .35); }
.auth-title { font-size: 22px; margin-bottom: 4px; }
.auth-card .alert { margin: 16px 0 0; }
.auth-foot { color: #8d99a8; font-size: 12px; text-align: center; margin-top: 16px; }
.input-otp { font-family: var(--mono); font-size: 26px; letter-spacing: 10px; text-align: center; padding: 10px; }

.steps-mini { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 16px; }
.step-dot {
    width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; background: #eaeded; color: var(--muted);
}
.step-dot.on { background: var(--primary); color: #fff; }
.step-dot.done { background: var(--green); color: #fff; }
.step-line { width: 48px; height: 2px; background: #eaeded; }
.step-line.on { background: var(--green); }

.enroll-steps { padding-left: 20px; margin: 16px 0 0; display: flex; flex-direction: column; gap: 14px; }
.enroll-steps li { padding-left: 4px; }
.enroll-steps li strong { display: block; }
.qr-box { display: flex; justify-content: center; margin: 12px 0 8px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.qr-box img { width: 200px; height: 200px; image-rendering: pixelated; }
.manual-key summary { cursor: pointer; color: var(--primary); font-size: 13px; }
.manual-key .key { display: block; margin-top: 8px; padding: 10px; background: #f4f4f4; border-radius: 6px; font-size: 15px; letter-spacing: 1px; word-break: break-all; }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
    .rule-grid { grid-template-columns: 1fr 1fr; }
}
.nav-toggle { display: none; }
.nav-backdrop { display: none; }
.only-mobile { display: none; }

@media (max-width: 800px) {
    /* Menú lateral como panel deslizable */
    .nav-toggle {
        display: inline-flex; align-items: center; justify-content: center;
        width: 38px; height: 38px; margin-right: 6px; padding: 0;
        background: transparent; border: 1px solid #414d5c; border-radius: 8px; color: #fff; cursor: pointer;
    }
    .nav-toggle svg { width: 20px; height: 20px; }
    .topbar { padding: 0 12px; }
    .topbar-right { gap: 6px; }
    .sidebar {
        position: fixed; top: 52px; left: 0; bottom: 0; z-index: 30; width: 270px;
        overflow-y: auto; transform: translateX(-100%); transition: transform .2s ease;
        box-shadow: 4px 0 16px rgba(0, 0, 0, .25);
    }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .nav-backdrop { display: block; position: fixed; inset: 52px 0 0 0; background: rgba(0, 0, 0, .4); z-index: 25; }
    body.nav-open { overflow: hidden; }
    .nav-item { padding: 12px; }
    .only-mobile { display: inline; }

    /* Evita el zoom automático de iOS al tocar un campo */
    .input { font-size: 16px; }

    .bar-row { grid-template-columns: 1fr 48px auto; padding: 10px 14px; }
    .bar-row-ports { grid-template-columns: 1fr 48px; }
    .bar-label { grid-column: 1 / -1; }
    .filters .field { min-width: 0; flex: 1 1 140px; }
    .filter-check { padding-top: 0; }
    .panel-header, .panel-body { padding-left: 14px; padding-right: 14px; }
    .pager { justify-content: center; }
    .form-actions { flex-direction: column-reverse; }
    .form-actions .btn { width: 100%; }
    .content { padding: 16px; }
    .grid-2, .stat-row, .rule-grid { grid-template-columns: 1fr; }
    .brand-sub, .topbar .chip { display: none; }
    .page-header { flex-direction: column; }
    .input-search { width: 100%; }
}

/* ---------- Intentos de conexión ---------- */
.stat-row-4 { grid-template-columns: repeat(4, 1fr); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.log-status { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.log-chip {
    display: inline-flex; align-items: center; gap: 8px; padding: 3px 12px; border-radius: 16px;
    background: var(--green-bg); border: 1px solid #9ad6a0; color: var(--green); font-weight: 700; font-size: 13px;
}
.log-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.log-chip-off { background: #f4f4f4; border-color: var(--border); color: var(--muted); }
.log-chip-off .dot { background: #8c96a3; }
.bar-row {
    display: grid; grid-template-columns: minmax(150px, 190px) 1fr 56px 110px; gap: 12px; align-items: center;
    padding: 8px 20px; border-bottom: 1px solid #eaeded;
}
.bar-row:last-child { border-bottom: none; }
.bar-row-ports { grid-template-columns: minmax(150px, 190px) 1fr 56px; }
.bar-label { display: flex; flex-direction: column; min-width: 0; }
.bar { height: 10px; background: #eaeded; border-radius: 5px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--red); transition: width .4s; }
.bar-orange span { background: var(--accent); }
.bar-n { text-align: right; font-weight: 700; }
.geo-code {
    display: inline-block; min-width: 26px; margin-right: 4px; padding: 0 4px; border-radius: 3px;
    background: #eaeded; color: #414d5c; font-size: 11px; font-weight: 700; text-align: center;
}
.check-block { align-items: flex-start; }
.check-block input { margin-top: 3px; }
.form-stack-tight { display: flex; flex-direction: column; gap: 18px; }
.field-narrow { max-width: 320px; }

@media (max-width: 1100px) {
    .two-col, .stat-row-4 { grid-template-columns: 1fr 1fr; }
    .two-col { grid-template-columns: 1fr; }
}

/* ---------- Páginas de error (404, 403, 400…) ---------- */
.status-code { font-size: 56px; font-weight: 300; color: var(--accent); line-height: 1; margin-bottom: 8px; }
.status-panel { max-width: 640px; margin: 40px auto; padding: 32px; text-align: center; }
.status-panel p { margin-bottom: 16px; }
.auth-card .status-code { text-align: left; }

/* ---------- Orden por columna y paginación ---------- */
.th-sortable { cursor: pointer; user-select: none; }
.th-sortable:hover, .th-sort:hover { color: var(--primary); }
.th-sortable::after, .th-sort::after { content: "↕"; margin-left: 6px; opacity: .35; font-size: 12px; }
.th-sortable[aria-sort="ascending"]::after, .th-sort.sorted.asc::after { content: "▲"; opacity: 1; color: var(--primary); }
.th-sortable[aria-sort="descending"]::after, .th-sort.sorted.desc::after { content: "▼"; opacity: 1; color: var(--primary); }
.th-sortable[aria-sort], .th-sort.sorted { color: var(--text); }
.th-sort { color: var(--muted); text-decoration: none; white-space: nowrap; }
.th-sort:hover { text-decoration: none; }

.pager { flex-wrap: wrap; gap: 12px; border-top: 1px solid #eaeded; }
.pager-controls { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.pager-size { display: inline-flex; align-items: center; gap: 6px; }
.input-sm { min-height: 28px; padding: 2px 8px; width: auto; font-size: 13px; }
.pages { display: inline-flex; align-items: center; gap: 4px; }
.page-btn {
    min-width: 30px; height: 30px; padding: 0 8px; border-radius: 15px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid transparent; background: transparent; color: var(--primary);
    font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; text-decoration: none;
}
.page-btn:hover { background: var(--blue-bg); text-decoration: none; }
.page-btn.current { background: var(--primary); color: #fff; cursor: default; }
.page-btn.disabled, .page-btn:disabled { color: #b6bec9; cursor: default; background: transparent; }
.page-gap { color: var(--muted); padding: 0 2px; }
.filter-check { align-self: center; padding-top: 18px; white-space: nowrap; }

@media (max-width: 800px) {
    .stat-row, .stat-row-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat { padding: 10px 14px; }
    .stat-value { font-size: 22px; }
    .page-header .btn { align-self: flex-start; }
}

/* ---------- Amenazas ---------- */
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b01111; }
.stat-link { color: inherit; display: block; }
.stat-link:hover { text-decoration: none; box-shadow: 0 0 0 2px var(--primary); }
.stat-critical { background: #fff0f0; }
.stat-critical .stat-value { color: var(--red); font-weight: 700; }
.threat-list { display: flex; flex-direction: column; }
.threat {
    display: grid; grid-template-columns: 90px 1fr auto; gap: 16px; align-items: start;
    padding: 16px 20px; border-bottom: 1px solid #eaeded; border-left: 4px solid transparent;
}
.threat:last-child { border-bottom: none; }
.threat-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.threat-summary { margin: 0 0 6px; color: #414d5c; }
.threat-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.threat-blocked { opacity: .6; }
.sev-badge {
    display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 700;
    color: #fff; background: #8c96a3; white-space: nowrap;
}
.sev-critical { border-left-color: #7d0000; }
.sev-critical .sev-badge, .sev-badge.sev-critical { background: #7d0000; }
.sev-high { border-left-color: var(--red); }
.sev-high .sev-badge, .sev-badge.sev-high { background: var(--red); }
.sev-medium { border-left-color: #f2b705; }
.sev-medium .sev-badge, .sev-badge.sev-medium { background: #e8a200; }
.sev-inline { margin-left: 6px; font-size: 11px; padding: 0 8px; }
.help-panel summary { padding: 14px 20px; cursor: pointer; font-weight: 700; color: var(--primary); }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; padding-top: 0; }
.help-grid p { margin: 4px 0 0; }
.help-foot { padding: 0 20px 16px; }
.nav-badge {
    margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px;
    background: var(--red); color: #fff; font-size: 12px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}
@media (max-width: 800px) {
    .threat { grid-template-columns: 1fr; gap: 8px; }
    .threat-actions { justify-content: flex-start; }
    .help-grid { grid-template-columns: 1fr; }
}

/* ---------- Diálogo de confirmación ---------- */
.confirm-dialog {
    border: none; padding: 0; border-radius: 14px; width: min(460px, calc(100vw - 32px));
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35); color: var(--text);
}
.confirm-dialog::backdrop { background: rgba(15, 27, 42, .55); backdrop-filter: blur(2px); }
.confirm-dialog[open] { animation: confirm-in .15s ease-out; }
@keyframes confirm-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.confirm-box { display: grid; grid-template-columns: 44px 1fr; gap: 4px 16px; padding: 24px 24px 18px; margin: 0; }
.confirm-icon {
    width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: var(--red-bg); color: var(--red); border: 1px solid #f5b5b5;
}
.confirm-icon svg { width: 22px; height: 22px; }
.confirm-primary .confirm-icon { background: var(--blue-bg); color: var(--primary); border-color: #b5d6f4; }
.confirm-title { font-size: 18px; margin: 2px 0 6px; }
.confirm-message { margin: 0; color: #414d5c; }
.confirm-detail {
    margin-top: 12px; padding: 8px 12px; border-radius: 8px; background: #f4f4f4; border: 1px solid var(--border);
    font-size: 14px; font-weight: 700; word-break: break-all;
}
.confirm-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
@media (max-width: 480px) {
    .confirm-box { grid-template-columns: 1fr; }
    .confirm-actions { flex-direction: column-reverse; }
    .confirm-actions .btn { width: 100%; }
}

/* ---------- Bloqueos automáticos ---------- */
.nav-chip {
    margin-left: auto; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 700;
    background: var(--orange-bg); color: var(--orange); border: 1px solid #f2d27d;
}
.nav-badge-grey { background: #414d5c; }
.autoblock-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mode-card {
    display: flex; align-items: center; gap: 16px; padding: 16px 20px; margin-bottom: 20px;
    background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); border-left: 5px solid #8c96a3;
}
.mode-card .mode-text { flex: 1; }
.mode-title { font-size: 16px; }
.mode-icon { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #f4f4f4; color: #5f6b7a; flex: none; }
.mode-icon svg { width: 22px; height: 22px; }
.mode-activo { border-left-color: var(--green); }
.mode-activo .mode-icon { background: var(--green-bg); color: var(--green); }
.mode-simulacion { border-left-color: #e8a200; }
.mode-simulacion .mode-icon { background: var(--orange-bg); color: var(--orange); }
.mode-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mode-option {
    display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; cursor: pointer;
    border: 2px solid var(--border); border-radius: 10px;
}
.mode-option input { margin-top: 3px; accent-color: var(--primary); }
.mode-option:has(input:checked) { border-color: var(--primary); background: var(--blue-bg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.whitelist-form { display: grid; grid-template-columns: 1fr 1.3fr auto; gap: 10px; border-bottom: 1px solid #eaeded; }
@media (max-width: 800px) {
    .mode-options, .grid-3, .whitelist-form { grid-template-columns: 1fr; }
    .mode-card { flex-wrap: wrap; }
}

/* ---------- País con "…" y motivo con detalle flotante ---------- */
.cell-country { max-width: 170px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-reason { min-width: 280px; max-width: 420px; }
.clamp-2 {
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.popover-trigger { cursor: help; border-radius: 6px; outline: none; }
.popover-trigger:hover strong, .popover-trigger:focus-visible strong { color: var(--primary); }
.popover-trigger:focus-visible { box-shadow: 0 0 0 2px var(--primary); }
.floating-popover {
    position: fixed; z-index: 50; max-width: 420px; padding: 14px 16px; border-radius: 10px;
    background: #16191f; color: #e9ebed; font-size: 13px; line-height: 1.5;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .35); pointer-events: none;
    animation: confirm-in .12s ease-out;
}
.floating-popover p { margin: 6px 0 10px; }
.floating-popover .popover-title { font-weight: 700; font-size: 14px; color: #fff; }
.popover-meta { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; padding-top: 8px; border-top: 1px solid #414d5c; }
.popover-meta dt { color: #aab7b8; }
.popover-meta dd { margin: 0; color: #fff; }

.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 300px; margin-left: auto; }
.time-left { font-weight: 700; }
.row-actions .inline-form { margin: 0; }

/* ---------- Indicador de carga ---------- */
.page-loading {
    position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 100;
    background: linear-gradient(90deg, var(--accent), #ffb84d);
    box-shadow: 0 0 8px rgba(255, 153, 0, .7); opacity: 0; pointer-events: none;
}
.page-loading.active { opacity: 1; animation: loading-progress 8s cubic-bezier(.1, .7, .2, 1) forwards; }
.page-loading.done { width: 100% !important; animation: none; opacity: 0; transition: width .2s ease, opacity .3s ease .1s; }
@keyframes loading-progress { 0% { width: 0; } 20% { width: 45%; } 60% { width: 75%; } 100% { width: 92%; } }

html.is-busy, html.is-busy * { cursor: progress !important; }

.spinner {
    display: inline-block; width: 14px; height: 14px; flex: none;
    border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn.is-loading { pointer-events: none; opacity: .85; }
.btn.is-loading::before {
    content: ""; width: 13px; height: 13px; flex: none;
    border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
    animation: spin .7s linear infinite;
}
.btn.is-loading:disabled { opacity: .85; cursor: progress; }

.loading-toast {
    position: fixed; left: 50%; bottom: 24px; z-index: 90; transform: translate(-50%, 20px);
    display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-radius: 22px;
    background: #16191f; color: #fff; font-weight: 700; font-size: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .3); opacity: 0; pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}
.loading-toast.show { opacity: 1; transform: translate(-50%, 0); }
.loading-toast .spinner { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
    .page-loading.active { animation: none; width: 70%; }
    .spinner, .btn.is-loading::before { animation-duration: 1.6s; }
}

/* ---------- Columnas largas: recorte uniforme en todas las grillas ---------- */
.cell-ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-user { max-width: 140px; }
.cell-rule { max-width: 170px; }
.cell-reason-short { max-width: 220px; }
.cell-detail { min-width: 200px; max-width: 300px; font-size: 13px; color: #414d5c; }
.cell-detail .popover-trigger { overflow-wrap: anywhere; }
.text-ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rule-desc { max-width: 300px; }
.cell-name { max-width: 340px; }
.floating-popover p { overflow-wrap: anywhere; }
.floating-popover p + p { margin-top: -4px; }
@media (max-width: 800px) {
    .cell-detail { min-width: 220px; }
}
.table td.cell-date { font-size: 12.5px; white-space: nowrap; }

/* ---------- Revisión de seguridad ---------- */
.score-row { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.score-card { display: flex; align-items: center; gap: 18px; padding: 14px 20px; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); }
.score-ring {
    --score: 0; --ring: var(--green);
    width: 72px; height: 72px; border-radius: 50%; flex: none; display: grid; place-items: center;
    background: conic-gradient(var(--ring) calc(var(--score) * 1%), #eaeded 0);
}
.score-ring span { width: 56px; height: 56px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 700; }
.score-mid .score-ring { --ring: #e8a200; }
.score-bad .score-ring { --ring: var(--red); }
.score-title { font-size: 16px; font-weight: 700; }
.stat-critical-soft .stat-value { color: var(--red); font-weight: 600; }
.stat-warn-soft .stat-value { color: #b07d00; font-weight: 600; }
.stat-ok-soft .stat-value { color: var(--green); font-weight: 600; }
.check-list { display: flex; flex-direction: column; }
.check { display: grid; grid-template-columns: 34px 1fr auto; gap: 14px; padding: 16px 20px; border-bottom: 1px solid #eaeded; align-items: start; }
.check:last-child { border-bottom: none; }
.check-icon {
    width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
    font-weight: 700; font-size: 14px; color: #fff; background: #8c96a3;
}
.chk-ok .check-icon { background: var(--green); }
.chk-warn .check-icon { background: #e8a200; }
.chk-crit .check-icon { background: var(--red); }
.chk-info .check-icon { background: var(--primary); }
.check-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.check-badge { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 10px; background: #f4f4f4; color: #5f6b7a; }
.chk-crit .check-badge { background: var(--red-bg); color: var(--red); }
.chk-warn .check-badge { background: var(--orange-bg); color: var(--orange); }
.chk-ok .check-badge { background: var(--green-bg); color: var(--green); }
.check-detail { margin: 4px 0 0; color: #414d5c; }
.check-reco { margin: 6px 0 0; font-size: 13px; color: #414d5c; background: #f9fafb; border-left: 3px solid var(--primary); padding: 6px 10px; border-radius: 0 6px 6px 0; }
.chk-ok .check-detail { color: var(--muted); }
.check-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.check-rules { margin-top: 10px; border: 1px solid #eaeded; border-radius: 8px; }
.cell-rule-wide { max-width: 320px; }
.dot-crit, .dot-warn { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot-crit { background: var(--red); }
.dot-warn { background: #e8a200; }

/* ---------- Notificaciones ---------- */
.panel-footer { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid #eaeded; background: #fafafa; }
.switch-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; }
.toggle {
    appearance: none; width: 36px; height: 20px; border-radius: 10px; background: #8c96a3; position: relative; cursor: pointer; transition: background .15s; margin: 0;
}
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle:checked { background: var(--green); }
.toggle:checked::after { left: 19px; }
.toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.grid-3-smtp { grid-template-columns: 2fr 0.8fr 1.4fr; }
.event-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.event-option { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 2px solid var(--border); border-radius: 10px; cursor: pointer; }
.event-option input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--primary); flex: none; }
.event-option span { display: flex; flex-direction: column; gap: 2px; }
.event-option:has(input:checked) { border-color: var(--primary); background: var(--blue-bg); }
.border-top { border-top: 1px solid #eaeded; }
.panel-note { padding: 0 20px 14px; margin: 0; }
.help-inline summary { cursor: pointer; color: var(--primary); font-weight: 700; font-size: 13px; }
.help-inline ol { margin: 8px 0 0; padding-left: 20px; font-size: 13px; color: #414d5c; }
.help-inline li { margin-bottom: 4px; }

/* ---------- Respaldos ---------- */
.input-note { width: 220px; }
.file-drop {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 22px;
    border: 2px dashed var(--border-strong); border-radius: 10px; cursor: pointer; text-align: center; color: var(--muted);
}
.file-drop:hover { border-color: var(--primary); background: var(--blue-bg); color: var(--primary); }
.file-drop input { font-size: 13px; max-width: 100%; }
.file-drop-text { font-weight: 700; }
.change-list { list-style: none; margin: 0; padding: 8px 20px; }
.change-list li { padding: 6px 0; border-bottom: 1px solid #eaeded; }
.change-list li:last-child { border-bottom: none; }
.change-list .popover-trigger { display: flex; gap: 10px; align-items: center; }
.btn-link-danger { color: var(--red); }
.btn-link-danger:hover { background: var(--red-bg); }
.check-block.indent { margin-left: 28px; }
.restore-panel { border: 2px solid #b5d6f4; }

@media (max-width: 1100px) {
    .score-row { grid-template-columns: 1fr 1fr; }
    .event-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 800px) {
    .score-row, .event-grid, .grid-3-smtp { grid-template-columns: 1fr; }
    .check { grid-template-columns: 28px 1fr; }
    .check-actions { grid-column: 2; align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
    .input-note { width: 100%; }
    .check-block.indent { margin-left: 0; }
}

.row-actions-inline { flex-wrap: nowrap; max-width: none; }
.file-drop { position: relative; }
.file-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-drop::before { content: "⇪"; font-size: 22px; }

/* ---------- Pestañas ---------- */
.page-header-compact { margin-bottom: 14px; }
.tabs-panel { overflow: visible; }
.tabs-alert { margin: 16px 20px 0; }
.tabs {
    display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--border);
    overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs [role=tab] {
    display: inline-flex; align-items: center; gap: 8px; flex: none;
    padding: 14px 14px 12px; border: none; background: none; cursor: pointer;
    font: inherit; font-weight: 700; color: var(--muted);
    border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs [role=tab]:hover { color: var(--text); }
.tabs [role=tab][aria-selected=true] { color: var(--primary); border-bottom-color: var(--primary); }
.tabs [role=tab]:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: 6px 6px 0 0; }
.tab-state {
    font-size: 11px; padding: 1px 8px; border-radius: 10px; background: #f4f4f4; color: var(--muted); border: 1px solid var(--border);
}
.tab-state.on { background: var(--green-bg); color: var(--green); border-color: #9ad6a0; }
.tab-count {
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 12px;
    display: inline-flex; align-items: center; justify-content: center; background: var(--blue-bg); color: var(--primary);
}
.tab-panel { padding: 18px 20px 4px; }
.tab-intro { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 16px; }
.form-grid .span-2 { grid-column: span 2; }
.tab-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.help-card { background: #f9fafb; border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; }
.help-card-title { font-weight: 700; margin-bottom: 6px; }
.help-card ol { margin: 0; padding-left: 20px; font-size: 13px; color: #414d5c; }
.help-card li { margin-bottom: 4px; }
.help-card code { overflow-wrap: anywhere; }
.tab-footer { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; padding: 12px 0; border-top: 1px dashed var(--border); }
.tabs-actions {
    display: flex; align-items: center; justify-content: flex-end; gap: 16px;
    padding: 14px 20px; border-top: 1px solid #eaeded; background: #fafafa; border-radius: 0 0 var(--radius) var(--radius);
}
.tab-panel .event-grid { gap: 10px; }
.tab-panel .event-option { padding: 9px 12px; }

@media (max-width: 800px) {
    .tabs { padding: 0 4px; }
    .tabs [role=tab] { padding: 12px 10px 10px; gap: 6px; }
    .tabs [role=tab] svg { display: none; }
    .tab-panel { padding: 14px 14px 4px; }
    .form-grid, .tab-columns { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
    .tab-intro { flex-direction: column; align-items: flex-start; gap: 6px; }
    .tabs-actions { position: sticky; bottom: 0; z-index: 5; justify-content: space-between; padding: 10px 14px; box-shadow: 0 -4px 12px rgba(0,0,0,.08); }
    .tabs-actions .muted { display: none; }
    .tabs-actions .btn { width: 100%; }
}

/* ---------- Escritorio remoto ---------- */
.rdp-status { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.rdp-card { background: #fff; border: 1px solid var(--border); border-left: 4px solid #aab7b8; border-radius: var(--radius); padding: 14px 16px; box-shadow: 0 1px 1px rgba(0,28,36,.1); }
.rdp-card-label { color: var(--muted); font-size: 13px; }
.rdp-card-value { font-size: 20px; font-weight: 700; margin: 2px 0 4px; }
.rdp-good { border-left-color: var(--green); } .rdp-good .rdp-card-value { color: var(--green); }
.rdp-bad { border-left-color: var(--red); background: #fff8f8; } .rdp-bad .rdp-card-value { color: var(--red); }
.rdp-warn { border-left-color: #f2b705; } .rdp-warn .rdp-card-value { color: #b07d00; }
.rdp-info { border-left-color: var(--orange); } .rdp-info .rdp-card-value { color: var(--orange); }
.alert-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.alert-buttons { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.rdp-cols { margin-bottom: 20px; align-items: start; }
.rdp-cols .panel { margin-bottom: 0; }
.rdp-form { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px 14px; border-bottom: 1px solid #eaeded; }
.rdp-form .span-all { grid-column: 1 / -1; }
.rdp-form-actions { display: flex; justify-content: flex-end; }
.panel-note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 20px; border-top: 1px solid #eaeded; background: #fafafa; font-size: 13px; color: #414d5c; border-radius: 0 0 var(--radius) var(--radius); }
.panel-note svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--primary); }
.public-rdp { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.public-rdp-text p { margin: 0 0 8px; }
.public-rules { margin: 0 0 8px; padding: 0; list-style: none; display: grid; gap: 6px; }
.nav-badge-orange { background: var(--orange); }
@media (max-width: 1000px) {
    .rdp-status { grid-template-columns: 1fr; gap: 8px; }
    .rdp-card { padding: 10px 14px; }
    .rdp-card-value { font-size: 17px; }
    .public-rdp { flex-direction: column; align-items: stretch; }
}
@media (max-width: 800px) {
    .rdp-form { grid-template-columns: 1fr; }
    .rdp-form-actions .btn, .public-rdp .btn { width: 100%; }
    .public-rdp form { display: block; }
}
@media (max-width: 800px) {
    .hide-sm { display: none; }

}

/* ---------- Acceso a servicios ---------- */
.services-table td { vertical-align: middle; }
.add-service { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; border-top: 1px solid #eaeded; background: #fafafa; }
.add-service .field { flex: 0 1 380px; margin: 0; }
.add-service .field-narrow { flex: 0 1 110px; }
.add-service [hidden] { display: none; }
.service-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 1px solid var(--border); border-radius: 16px; background: #fff; cursor: pointer; font-size: 14px; }
.chip-check:has(input:checked) { border-color: var(--primary); background: var(--blue-bg); color: var(--primary); font-weight: 600; }
.chip-check input { margin: 0; }
.service-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.panel-note-standalone { border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 20px; }
.text-warn { color: #b07d00; }
@media (max-width: 800px) {
    .add-service .field, .add-service .field-narrow { flex: 1 1 100%; }
    .add-service .btn { width: 100%; }
    /* Tablas que en celular se ven como tarjetas: 2 columnas y acciones abajo */
    table.stack-sm thead { display: none; }
    table.stack-sm tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid #eaeded; }
    table.stack-sm td { padding: 0; border: none; width: auto !important; max-width: none; }
    table.stack-sm td.hide-sm { display: none; }
    table.stack-sm td:last-child { grid-column: 1 / -1; text-align: left; }
    table.stack-sm td:last-child .row-actions-inline { flex-direction: row; justify-content: flex-start; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
    table.stack-sm td:last-child:empty { display: none; }
}
.other-picker { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.other-picker .field { flex: 1 1 200px; margin: 0; }
.other-picker .field-narrow { flex: 0 1 130px; }
.other-picker [hidden] { display: none; }
@media (max-width: 800px) { .other-picker .field, .other-picker .field-narrow { flex: 1 1 100%; } }

/* ---------- Listas de bloqueo ---------- */
.intel-cols { align-items: start; margin-bottom: 20px; }
.intel-cols > .panel, .intel-side .panel { margin-bottom: 16px; }
.intel-list { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.intel-list input { margin-top: 3px; }
.intel-desc { display: block; margin-top: 2px; }
.intel-lists td { vertical-align: top; }
.intel-options { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid #eaeded; }
.field-inline { display: flex; align-items: center; gap: 10px; margin: 0; }
.field-inline .input { width: auto; }
.lookup-form { display: flex; gap: 8px; }
.lookup-form .input { flex: 1; }
.lookup-result { border-top: 1px solid #eaeded; padding-top: 12px; font-size: 14px; }
.custom-list > summary { cursor: pointer; list-style: none; }
.custom-list > summary::-webkit-details-marker { display: none; }
.custom-list > summary h2::before { content: "+ "; color: var(--primary); }
.custom-list[open] > summary h2::before { content: "− "; }

/* ---------- Límite por país ---------- */
.country-search { max-width: 260px; }
.country-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; max-height: 55vh; overflow-y: auto; padding: 2px; }
.country-option { justify-content: flex-start; border-radius: 8px; }
.country-option[hidden] { display: none; }
.country-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
@media (max-width: 800px) {
    .country-search { max-width: none; width: 100%; }
    .country-grid { grid-template-columns: 1fr 1fr; max-height: none; }
}
.intel-options .switch-label { display: flex; align-items: flex-start; gap: 10px; }
.intel-options .switch-label .toggle { flex: none; margin-top: 2px; }
.intel-options .switch-label .muted { font-weight: 400; }
.intel-options .field-inline { flex-direction: row; align-items: center; justify-content: flex-start; text-align: left; }
.intel-options .field-inline .field-label { margin: 0; }

/* ---------- Usuarios, Mi cuenta y Acceso a la consola ---------- */
.generated-password { display: flex; align-items: center; gap: 12px; }
.password-value { font-size: 16px; padding: 2px 8px; background: #fff; border: 1px dashed #b07d00; border-radius: 6px; user-select: all; }
.role-form { display: inline-flex; align-items: center; gap: 4px; }
.role-form .input-sm { width: auto; }
.profile-cols { align-items: start; }
.profile-cols .panel { margin-bottom: 0; }
.console-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 24px; border-top: 1px solid #eaeded; }
.console-whitelist { margin-bottom: 16px; display: flex; align-items: flex-start; gap: 10px; }
.console-whitelist .toggle { flex: none; margin-top: 2px; }
.console-whitelist .muted { font-weight: 400; }
.country-label { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.country-label .country-search { margin-left: auto; }
.country-grid-compact { max-height: 320px; }
.chip-readonly { background: #fff4e5; color: #8a5300; }
form.is-readonly { opacity: .6; }
@media (max-width: 800px) {
    .console-grid { grid-template-columns: 1fr; }
    .country-label .country-search { margin-left: 0; }
    .generated-password { flex-direction: column; align-items: flex-start; }
}
.chip-link { text-decoration: none; color: inherit; }
.chip-link:hover { background: rgba(255,255,255,.18); }
.topbar .chip-readonly { background: #ffe8c2; color: #6b4100; font-weight: 700; }
.add-service .field-role { flex: 0 1 180px; }

/* Página única de error */
.status-icon { color: #d13212; margin-bottom: 8px; }
.status-panel .status-icon { display: flex; justify-content: center; }
.status-icon svg { width: 52px !important; height: 52px !important; }

/* Confirmación con Google Authenticator */
.confirm-panel { max-width: 480px; margin: 40px auto; padding: 28px; }
.confirm-panel .input-otp { max-width: 220px; }

/* Lista blanca */
.wl-effects { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.wl-effect { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.wl-effect .ico { flex: 0 0 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.wl-effect.yes .ico { background: #e6f4ea; color: #1d8102; }
.wl-effect.no .ico { background: #fdecea; color: #d13212; }
.wl-cols { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.wl-form .panel-body { display: flex; flex-direction: column; gap: 12px; }
.wl-dur { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.wl-dur .input { width: auto; }
.wl-dur[hidden], .wl-dur [hidden] { display: none; }
.wl-lock { display: flex; gap: 8px; align-items: flex-start; background: #f2f8fd; border: 1px solid #b9d7f0; border-radius: 8px; padding: 8px 10px; font-size: 12.5px; color: #0f4c81; }
.wl-lock svg { flex: 0 0 16px; width: 16px; height: 16px; margin-top: 1px; }
.wl-me { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: #f7f7f7; border-radius: 8px; padding: 8px 10px; font-size: 13px; flex-wrap: wrap; }
.wl-toolbar { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.wl-toolbar .input-search { max-width: 240px; }
.wl-type { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.wl-manual { background: #e8f1fb; color: #0f4c81; }
.wl-temporal { background: #fff4e5; color: #8a4b00; }
.wl-automatica { background: #eef0f2; color: #414d5c; }
.wl-fijo { background: #e6f4ea; color: #1d6b0f; }
.wl-warn-row td { background: #fff8f7; }
.wl-flag { display: block; color: #d13212; font-size: 12px; font-weight: 700; margin-top: 3px; }
.wl-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; align-items: flex-start; }
.wl-actions .btn { white-space: nowrap; }
.wl-extend { position: relative; }
.wl-extend > summary { list-style: none; cursor: pointer; }
.wl-extend > summary::-webkit-details-marker { display: none; }
.wl-extend-box { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; display: flex; gap: 6px; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .12); }
.wl-note { padding: 10px 16px; border-top: 1px solid var(--border); }
@media (max-width: 1100px) { .wl-effects { grid-template-columns: repeat(2, minmax(0, 1fr)); } .wl-cols { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .wl-effects { grid-template-columns: 1fr; }
  .wl-toolbar .input-search { max-width: none; width: 100%; }
  .wl-toolbar .segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .wl-toolbar .segmented a { white-space: nowrap; }
  .wl-extend-box { right: auto; left: 0; }
}

/* Página "Acceso no autorizado" de la restricción de la consola */
.deny-card { text-align: center; padding-top: 30px; }
.deny-icon { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: #fdecea; color: #d13212; }
.deny-icon svg { width: 34px; height: 34px; }
.deny-title { margin-bottom: 6px; }
.deny-text { margin: 0 auto 18px; max-width: 320px; }
.deny-info { text-align: left; background: #f7f8f9; border: 1px solid var(--border); border-radius: 10px; padding: 4px 14px; margin: 0 0 16px; }
.deny-info > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid #e9ebed; font-size: 13.5px; }
.deny-info > div:last-child { border-bottom: 0; }
.deny-info dt { color: #5f6b7a; }
.deny-info dd { margin: 0; font-weight: 700; color: #16191f; text-align: right; word-break: break-all; }
.deny-help { font-size: 13px; color: #414d5c; margin: 0; }

/* ================= Inicio (panel de las últimas 24 horas) ================= */
.dash-head { display:flex; justify-content:space-between; align-items:flex-end; gap:12px; flex-wrap:wrap; margin-bottom:14px; }
.dash-head h1 { margin:0; }
.dash-meta { display:flex; gap:10px; align-items:center; color:var(--muted); font-size:13px; }
.kpis { display:grid; grid-template-columns:repeat(6, minmax(0,1fr)); gap:12px; margin-bottom:14px; }
.kpi { background:#fff; border-radius:8px; box-shadow:var(--shadow); padding:12px 14px; display:flex; flex-direction:column; gap:2px; min-width:0; }
.kpi-label { font-size:12.5px; color:var(--muted); font-weight:700; }
.kpi-value { font-size:28px; font-weight:800; line-height:1.15; letter-spacing:-.5px; }
.kpi-value small { font-size:15px; font-weight:700; color:var(--muted); }
.kpi-sub { font-size:12px; color:var(--muted); }
.delta { font-size:12px; font-weight:700; }
.delta.up-bad { color:#b0270f; } .delta.down-good { color:#037f0c; } .delta.flat { color:var(--muted); }
.kpi-sev { display:flex; gap:6px; flex-wrap:wrap; margin-top:2px; }
.sev-pill { display:inline-flex; gap:4px; align-items:center; font-size:11.5px; font-weight:700; border-radius:10px; padding:1px 7px; }
.sev-crit { background:#fdecea; color:#b0170f; } .sev-high { background:#fff1e0; color:#8a4300; } .sev-med { background:#fffbe0; color:#6b5300; }
.score-bar { width:100%; height:6px; display:block; margin-top:6px; }
.dash-grid { display:grid; gap:14px; margin-bottom:14px; align-items:start; }
.dash-grid > .panel { margin:0; }
.chart-wrap { padding:6px 16px 10px; }
.chart-wrap svg { width:100%; height:auto; display:block; }
.chart-narrow { display:none !important; }
@media (max-width: 640px) { .chart-wide { display:none !important; } .chart-narrow { display:block !important; } }
.chart-legend { display:flex; gap:14px; font-size:12px; color:var(--muted); padding:0 16px 10px; flex-wrap:wrap; }
.chart-legend i { display:inline-block; width:10px; height:10px; border-radius:2px; margin-right:5px; vertical-align:-1px; }
.hbars { list-style:none; margin:0; padding:8px 16px 14px; display:flex; flex-direction:column; gap:9px; }
.hbar { display:grid; grid-template-columns: 158px minmax(0,1fr) 50px; gap:10px; align-items:center; font-size:13px; }
.hbar .name { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.hbar .track { width:100%; height:10px; display:block; }
.hbar .val { text-align:right; font-variant-numeric:tabular-nums; font-weight:700; }
.feed { list-style:none; margin:0; padding:4px 16px 12px; }
.feed li { display:grid; grid-template-columns:44px 1fr; gap:8px; padding:8px 0; border-bottom:1px solid #eef0f2; font-size:13px; }
.feed li:last-child { border-bottom:0; }
.feed time { color:var(--muted); font-variant-numeric:tabular-nums; }
.sys-checks { list-style:none; margin:0; padding:6px 16px 12px; }
.sys-checks li { display:flex; gap:10px; align-items:flex-start; padding:7px 0; font-size:13px; border-bottom:1px solid #eef0f2; }
.sys-checks li:last-child { border-bottom:0; }
.ck { flex:0 0 20px; height:20px; border-radius:50%; display:grid; place-items:center; font-size:12px; font-weight:800; }
.ck.ok { background:#e6f4ea; color:#037f0c; } .ck.warn { background:#fffbe0; color:#8d6605; }
.panel-link { font-size:13px; font-weight:700; }
.mini-list { list-style:none; margin:0; padding:4px 16px 12px; }
.mini-list li { display:flex; justify-content:space-between; gap:10px; padding:8px 0; border-bottom:1px solid #eef0f2; font-size:13px; }
.mini-list li:last-child { border-bottom:0; }
@media (max-width: 1350px) { .kpis { grid-template-columns:repeat(3, minmax(0,1fr)); } }
@media (max-width: 640px) { .kpis { grid-template-columns:repeat(2, minmax(0,1fr)); } .kpi-value { font-size:24px; } .hbar { grid-template-columns: 128px minmax(0,1fr) 46px; } }
.posture { display:inline-flex; gap:8px; align-items:center; font-weight:700; font-size:13px; border-radius:16px; padding:5px 12px; }
.posture.bad { background:#fdecea; color:#b0170f; } .posture .dot { width:9px; height:9px; border-radius:50%; background:currentColor; }
.actions-list { list-style:none; margin:0; padding:0; }
.act { display:grid; grid-template-columns: 92px minmax(0,1fr) auto; gap:12px; align-items:center; padding:12px 16px; border-bottom:1px solid #eef0f2; }
.act:last-child { border-bottom:0; }
.act-what { font-size:14px; font-weight:700; }
.act-why { font-size:12.5px; color:var(--muted); margin-top:2px; }
.act .btn { white-space:nowrap; }
.sev-low { background:#eef0f2; color:#414d5c; }
.expo { list-style:none; margin:0; padding:4px 16px 12px; }
.expo li { display:flex; justify-content:space-between; gap:10px; align-items:center; padding:9px 0; border-bottom:1px solid #eef0f2; font-size:13px; }
.expo li:last-child { border-bottom:0; }
.expo .state { font-size:12px; font-weight:700; border-radius:10px; padding:2px 8px; white-space:nowrap; }
.st-open { background:#fdecea; color:#b0170f; } .st-ok { background:#e6f4ea; color:#1d6b0f; } .st-web { background:#e8f1fb; color:#0f4c81; }
.flag-new { display:inline-block; font-size:11px; font-weight:800; background:#fff1e0; color:#8a4300; border-radius:8px; padding:1px 6px; margin-left:4px; }
.kpi.kpi-alert { box-shadow: inset 0 0 0 2px #d91515, var(--shadow); }
.chart-title-sm { font-size:13px; font-weight:700; color:var(--text); padding:10px 16px 0; }
@media (max-width: 640px) { .act { grid-template-columns: 1fr; gap:6px; } .act .btn { justify-self:start; } }
.posture.warn { background:#fffbe0; color:#6b5300; } .posture.good { background:#e6f4ea; color:#1d6b0f; }
.dash-grid { grid-template-columns: repeat(3, minmax(0,1fr)); align-items: stretch; }
.dash-grid > .span-2 { grid-column: span 2; }
.dash-grid > .panel { display:flex; flex-direction:column; }
.dash-grid > .panel > .wl-note, .dash-grid > .panel > .chart-legend { margin-top:auto; }
.dash-grid > .panel > .wl-note { padding:10px 16px 12px; border-top:1px solid #eef0f2; }
.kpis { align-items: stretch; }
.kpi { justify-content:flex-start; }
.dash-empty { display:flex; gap:10px; align-items:center; padding:14px 16px; font-size:13px; }
.dash-meta form.inline { display:inline; margin:0; }
.panel-header .count { color:var(--muted); font-weight:700; }
.hbar .name .flag-new { margin-left:6px; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } .dash-grid > .span-2 { grid-column: auto; } }
.act .sev-pill { justify-self:start; }
.posture { white-space:nowrap; }
.dash-meta { flex-wrap:wrap; }

/* ================= Parámetros ================= */
.cfg-banner { display:flex; gap:12px; align-items:flex-start; background:#f2f8fd; border:1px solid #b5d6f4; border-left:4px solid #0972d3; border-radius:8px; padding:10px 14px; margin-bottom:14px; font-size:13.5px; }
.cfg-banner .ico { flex:0 0 22px; height:22px; border-radius:50%; background:#0972d3; color:#fff; display:grid; place-items:center; font-weight:800; font-size:13px; }
.cfg-lock { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; background:#fffbf2; border:1px solid #f2d39b; border-radius:8px; padding:10px 14px; margin-bottom:14px; font-size:13.5px; }
.cfg-rows { list-style:none; margin:0; padding:0; }
.cfg-row { display:grid; grid-template-columns:minmax(0,1fr) 170px 190px; gap:16px; align-items:center; padding:14px 16px; border-bottom:1px solid #eef0f2; }
.cfg-row:last-child { border-bottom:0; }
.cfg-name { display:block; font-weight:700; font-size:14px; }
.cfg-desc { font-size:12.5px; color:var(--muted); margin-top:2px; }
.cfg-input { display:flex; align-items:center; gap:8px; }
.cfg-input .input { width:90px; text-align:right; font-variant-numeric:tabular-nums; }
.cfg-unit { font-size:12.5px; color:var(--muted); }
.cfg-meta { font-size:12px; color:var(--muted); line-height:1.5; }
.cfg-meta strong { color:var(--text); }
.cfg-row.loose { background:#fffbf2; }
.cfg-row.changed { background:#f7fbff; }
.cfg-row.changed .input { border-color:#0972d3; box-shadow:0 0 0 1px #0972d3; }
.cfg-flag { display:inline-block; margin:6px 6px 0 0; font-size:11.5px; font-weight:700; border-radius:8px; padding:1px 7px; background:#fff1e0; color:#8a4300; }
.cfg-flag.blue { background:#e8f1fb; color:#0f4c81; }
.cfg-flag[hidden] { display:none; }
.cfg-actions { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; background:#fff; border:1px solid var(--border); padding:12px 16px; border-radius:8px; margin:0 0 14px; box-shadow:var(--shadow); }
.cfg-actions .grp { display:flex; gap:8px; flex-wrap:wrap; }
.cfg-summary { display:flex; flex-direction:column; gap:6px; font-size:13.5px; }
.cfg-summary.loose { background:#fffbf2; }
.ro-list { list-style:none; margin:0; padding:4px 16px 12px; }
.ro-list li { display:grid; grid-template-columns:240px minmax(0,1fr); gap:12px; padding:9px 0; border-bottom:1px solid #eef0f2; font-size:13px; }
.ro-list li:last-child { border-bottom:0; }
@media (max-width: 900px) {
  .cfg-row { grid-template-columns:auto minmax(0,1fr); gap:10px 16px; }
  .cfg-row > div:first-child { grid-column:1 / -1; }
  .ro-list li { grid-template-columns:1fr; gap:2px; }
}
