/* ===========================================================================
 * sec.evolia.es — ONSITE_SECURITY
 * Dark control-room design. Geist sans + Geist Mono via Google Fonts.
 * ========================================================================== */

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

:root {
    --bg:           #08080d;
    --surface:      #0f0f17;
    --surface-2:    #161620;
    --surface-3:    #1f1f2c;
    --line:         #25252f;
    --line-strong:  #34344a;
    --text:         #e8e8ee;
    --text-2:       #b3b3c4;
    --muted:        #6e6e84;
    --accent:       #5957ff;
    --accent-soft:  #1b17ff;
    --danger:       #ef4444;
    --warn:         #f59e0b;
    --ok:           #22c55e;

    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 16px;

    --sidebar-w: 240px;

    --font-sans: 'Geist', ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img, video { display: block; max-width: 100%; }
h1, h2, h3 { letter-spacing: -0.02em; font-weight: 600; margin: 0; }
p { margin: 0; }

/* ---------------------------------------------------------- Layout shell -- */
body:not(.login-body) {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 22px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px;
}
.brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background:
        radial-gradient(circle at 30% 30%, #ffffff20 0 1px, transparent 1px) 0 0/4px 4px,
        linear-gradient(135deg, #1b17ff 0%, #5957ff 100%);
    box-shadow: 0 0 0 1px #ffffff10 inset, 0 6px 16px -8px var(--accent);
    flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-weight: 600; font-size: 14px; }
.brand-text small { color: var(--muted); font-size: 11px; font-family: var(--font-mono); margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-size: 13.5px;
    transition: background 0.12s, color 0.12s;
    position: relative;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.is-active {
    background: var(--surface-2);
    color: var(--text);
    box-shadow: inset 2px 0 0 var(--accent);
}
.nav-item.is-disabled { color: var(--muted); cursor: default; }
.nav-item.is-disabled:hover { background: transparent; color: var(--muted); }

.nav-glyph {
    width: 18px; height: 18px; flex-shrink: 0;
    background: currentColor;
    -webkit-mask: var(--mask, none) center / contain no-repeat;
            mask: var(--mask, none) center / contain no-repeat;
    opacity: 0.85;
}
.nav-item.is-active .nav-glyph { color: var(--accent); opacity: 1; }
.nav-tag {
    margin-left: auto;
    font-style: normal;
    font-size: 10px;
    color: var(--muted);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sidebar-footer { margin-top: auto; padding: 0 8px; display: flex; flex-direction: column; gap: 8px; }
.user {
    display: flex; align-items: center; gap: 8px;
    color: var(--muted); font-size: 12px; font-family: var(--font-mono);
}
.user-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 12px var(--ok);
    animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 0.7; } 50% { opacity: 1; } }
.logout {
    color: var(--muted);
    font-size: 12px;
    text-transform: lowercase;
    transition: color 0.12s;
}
.logout:hover { color: var(--text); }

.main {
    padding: 36px 40px 56px;
    max-width: 1400px;
    width: 100%;
}

/* ---------------------------------------------------------- Page heads ---- */
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}
.page-head h1 {
    font-size: 28px;
    font-weight: 500;
    letter-spacing: -0.025em;
}
.page-head .lead {
    color: var(--text-2);
    font-size: 14px;
    margin-top: 6px;
    max-width: 540px;
}
.page-meta { color: var(--muted); font-family: var(--font-mono); font-size: 12px; }

.now::before { content: ''; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: var(--surface-2);
    border: 1px solid var(--line);
}
.badge-live { color: #fca5a5; border-color: #7f1d1d; background: #2a0e0e; }
.badge-live .dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #ef4444; box-shadow: 0 0 8px #ef4444;
    animation: pulse 1.6s ease-in-out infinite;
}

/* ---------------------------------------------------------- Cards / grid -- */
.grid { display: grid; gap: 16px; }
.grid-modules { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.card {
    --accent: #1b17ff;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 22px;
    transition: border-color 0.18s, transform 0.18s, background 0.18s;
    position: relative;
    overflow: hidden;
}
.card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), transparent 70%);
    opacity: 0.55;
}
.card:hover:not(.is-disabled) {
    border-color: var(--line-strong);
    background: var(--surface-2);
    transform: translateY(-1px);
}
.card.is-disabled { opacity: 0.55; cursor: default; }

.card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.card-glyph {
    width: 28px; height: 28px;
    background: currentColor;
    color: var(--accent);
    -webkit-mask: var(--mask, none) center / contain no-repeat;
            mask: var(--mask, none) center / contain no-repeat;
}
.card-tag {
    font-style: normal;
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    background: var(--surface-3);
    padding: 3px 8px;
    border-radius: 999px;
}
.card h2 { font-size: 18px; font-weight: 500; margin-bottom: 6px; }
.card p { color: var(--text-2); font-size: 13px; }
.card-kpi { display: flex; align-items: baseline; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.card-kpi strong { font-size: 22px; font-weight: 500; font-family: var(--font-mono); color: var(--accent); }
.card-kpi span { color: var(--muted); font-size: 12px; }

/* ---------------------------------------------------------- Cameras ------ */
.cam-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
}
@media (max-width: 900px) { .cam-shell { grid-template-columns: 1fr; } }

.cam-list { display: flex; flex-direction: column; gap: 6px; }
.cam-list-item {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    transition: background 0.12s, border-color 0.12s;
}
.cam-list-item:hover { background: var(--surface-2); border-color: var(--line-strong); }
.cam-list-item.is-active { background: var(--surface-2); border-color: var(--accent); }
.cam-list-item.is-offline { opacity: 0.55; }

.cam-list-glyph {
    width: 18px; height: 18px;
    background: currentColor;
    color: var(--text-2);
    -webkit-mask: var(--mask, none) center / contain no-repeat;
            mask: var(--mask, none) center / contain no-repeat;
}
.cam-list-item.is-active .cam-list-glyph { color: var(--accent); }
.cam-list-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.cam-list-text strong { font-size: 13px; font-weight: 500; }
.cam-list-text small { color: var(--muted); font-size: 11px; margin-top: 2px; font-family: var(--font-mono); }
.cam-list-state {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ok);
}
.cam-list-item.is-offline .cam-list-state { color: var(--muted); }

.cam-stage {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.cam-stage.empty { color: var(--muted); padding: 60px; text-align: center; font-family: var(--font-mono); }

.cam-stage-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.cam-stage-head h2 { font-size: 20px; font-weight: 500; }
.cam-stage-head p { color: var(--muted); font-size: 12px; font-family: var(--font-mono); margin-top: 2px; }

.cam-controls { display: flex; gap: 6px; }
.cam-controls button {
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text-2);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: all 0.12s;
}
.cam-controls button:hover { color: var(--text); border-color: var(--line-strong); }
.cam-controls .quality-btn.is-active { background: var(--accent); border-color: var(--accent); color: white; }

.cam-frame {
    position: relative;
    background: black;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16 / 9;
    width: 100%;
}
.cam-frame:fullscreen { aspect-ratio: auto; height: 100vh; }
.cam-frame video-stream {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.cam-frame video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: black;
}
.cam-frame video-stream .info {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
.cam-frame video-stream .info .mode {
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}
.cam-frame video-stream .info .status {
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    color: #fca5a5;
}
.cam-frame video-stream .info .status:empty,
.cam-frame video-stream .info .mode:empty { display: none; }

.cam-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--text-2);
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: linear-gradient(180deg, rgba(0,0,0,0.4), rgba(0,0,0,0.7));
    backdrop-filter: blur(2px);
    transition: opacity 0.4s;
}
.cam-overlay.is-hidden { opacity: 0; pointer-events: none; }
.cam-overlay-state::before {
    content: '';
    display: inline-block;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent);
    margin-right: 10px;
    animation: pulse 1.2s ease-in-out infinite;
    vertical-align: middle;
}
.cam-overlay.is-error { background: rgba(40,0,0,0.85); color: #fca5a5; }
.cam-overlay.is-error .cam-overlay-state::before { background: var(--danger); box-shadow: 0 0 12px var(--danger); }

.cam-stats {
    position: absolute;
    bottom: 12px; left: 12px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    color: var(--text-2);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.4;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s;
}
.cam-frame:hover .cam-stats { opacity: 1; }

.cam-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.cam-meta > div {
    padding: 12px 14px;
    background: var(--surface-2);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.cam-meta span {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: var(--font-mono);
}
.cam-meta strong { font-weight: 500; font-size: 14px; font-family: var(--font-mono); }

/* ---------------------------------------------------------- Tabs --------- */
.tab-nav {
    display: flex;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 3px;
}
.tab {
    padding: 7px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    transition: background 0.12s, color 0.12s;
}
.tab:hover { color: var(--text); }
.tab.is-active {
    background: var(--surface-3);
    color: var(--text);
    box-shadow: inset 0 0 0 1px var(--line-strong);
}

/* ---------------------------------------------------------- Recordings -- */
.rec-meta {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.rec-shell {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 16px;
}
@media (max-width: 900px) { .rec-shell { grid-template-columns: 1fr; } }

.rec-days {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 600px;
    overflow-y: auto;
}
.rec-day {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    transition: background 0.12s, border-color 0.12s;
}
.rec-day:hover { background: var(--surface-2); border-color: var(--line-strong); }
.rec-day.is-active { background: var(--surface-2); border-color: var(--accent); }
.rec-day strong { font-size: 13px; font-weight: 500; text-transform: capitalize; }
.rec-day span { color: var(--muted); font-size: 11px; font-family: var(--font-mono); }
.rec-empty { color: var(--muted); font-family: var(--font-mono); font-size: 11px; padding: 12px; text-align: center; }

.rec-main { display: flex; flex-direction: column; gap: 12px; }

#recPlayer {
    width: 100%;
    height: 100%;
    background: black;
    object-fit: contain;
}

.rec-segments {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
}
.rec-segments-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.rec-segments-head strong { font-size: 13px; font-weight: 500; }
.rec-seg-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 4px;
    max-height: 240px;
    overflow-y: auto;
}
.rec-seg-btn {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text-2);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 11px;
    text-align: left;
    transition: all 0.12s;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.rec-seg-btn:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface-3); }
.rec-seg-time { font-size: 13px; }
.rec-seg-size { color: var(--muted); font-size: 10px; }

/* ---------------------------------------------------------- Coming-soon -- */
.coming-soon {
    --accent: #1b17ff;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 80px 40px;
    text-align: center;
    color: var(--text-2);
}
.coming-soon .card-glyph {
    width: 48px; height: 48px;
    margin: 0 auto 24px;
    color: var(--accent);
    opacity: 0.6;
}
.coming-soon h2 { font-size: 24px; font-weight: 500; color: var(--text); margin-bottom: 8px; }

/* ---------------------------------------------------------- Login -------- */
.login-body { background: var(--bg); }
.login-main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    gap: 24px;
    background:
        radial-gradient(ellipse at top, rgba(89,87,255,0.10), transparent 50%),
        radial-gradient(ellipse at bottom, rgba(27,23,255,0.06), transparent 50%);
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 36px 36px 32px;
    width: 100%;
    max-width: 380px;
}
.brand-login { margin-bottom: 28px; padding: 0; }
.login-card h1 { font-size: 22px; font-weight: 500; margin-bottom: 6px; }
.login-card .lead { color: var(--text-2); font-size: 13px; margin-bottom: 24px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field span {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.field input {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 11px 14px;
    font-family: var(--font-mono);
    font-size: 14px;
    transition: border-color 0.12s, background 0.12s;
}
.field input:focus { outline: none; border-color: var(--accent); background: var(--bg); }

.btn {
    border: none;
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.12s, transform 0.05s;
    width: 100%;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #4845ff; }
.btn-primary:active { transform: translateY(1px); }

.alert {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
}

.login-foot {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ---------------------------------------------------------- Icons (SVG mask) */
[data-glyph] { --mask: none; }
[data-glyph="grid"]   { --mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='3' width='7' height='7' rx='1.5'/><rect x='14' y='3' width='7' height='7' rx='1.5'/><rect x='3' y='14' width='7' height='7' rx='1.5'/><rect x='14' y='14' width='7' height='7' rx='1.5'/></svg>"); }
[data-glyph="video"]  { --mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><rect x='2.5' y='6' width='13' height='12' rx='2'/><path d='M15.5 10.5l5-3v9l-5-3z'/></svg>"); }
[data-glyph="shield"] { --mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3l8 3v6c0 5-3.5 8.5-8 9.5C7.5 20.5 4 17 4 12V6z'/><path d='M9 12l2 2 4-4'/></svg>"); }
[data-glyph="radar"]  { --mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='9'/><circle cx='12' cy='12' r='5.5'/><circle cx='12' cy='12' r='2'/><path d='M12 12L19 7'/></svg>"); }
[data-glyph="flame"]  { --mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3c1 4 5 4 5 9a5 5 0 11-10 0c0-2 1-3 2-4 0 2 1 3 3 3-1-3 0-6 0-8z'/></svg>"); }
[data-glyph="network"] { --mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3v3M12 18v3M3 12h3M18 12h3'/><circle cx='12' cy='12' r='3'/><path d='M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M5.6 18.4l2.1-2.1M16.3 7.7l2.1-2.1'/></svg>"); }
[data-glyph="gauge"]   { --mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M3 14a9 9 0 1118 0'/><path d='M12 14l5-4'/><circle cx='12' cy='14' r='1.5' fill='%23000' stroke='none'/></svg>"); }
[data-glyph="pulse"]   { --mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M3 12h4l2-6 4 12 2-6h6'/></svg>"); }

/* ---------------------------------------------------------- Hub additions */

/* Nav groups */
.nav-group-label {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 14px 10px 4px;
}

/* Hub overview tiles */
.hub-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}
.hub-stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color 0.18s, background 0.18s;
    position: relative;
    overflow: hidden;
}
.hub-stat::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    background: var(--accent);
    opacity: 0.5;
}
a.hub-stat:hover { border-color: var(--line-strong); background: var(--surface-2); }
.hub-stat.is-good::before { background: var(--ok); }
.hub-stat.is-warn::before { background: var(--warn); }
.hub-stat.is-bad::before { background: var(--danger); }

.hub-stat-head {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.hub-stat-icon {
    width: 16px; height: 16px;
    background: currentColor;
    color: var(--text-2);
    -webkit-mask: var(--mask, none) center / contain no-repeat;
            mask: var(--mask, none) center / contain no-repeat;
}
.hub-stat-value {
    font-family: var(--font-mono);
    font-size: 26px;
    line-height: 1.1;
    letter-spacing: -0.02em;
}
.hub-stat-value em {
    display: block;
    margin-top: 4px;
    font-style: normal;
    font-family: var(--font-sans);
    font-size: 12px;
    color: var(--text-2);
    letter-spacing: 0;
}
.hub-stat.is-bad .hub-stat-value { color: #fca5a5; }
.hub-stat.is-warn .hub-stat-value { color: #fcd34d; }
.hub-stat.is-good .hub-stat-value { color: var(--ok); }
.hub-stat-foot {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11px;
    margin-top: auto;
}

.hub-witnesses { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.hub-witnesses li {
    display: grid;
    grid-template-columns: 12px 1fr auto;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}
.hub-witnesses li small { color: var(--muted); font-family: var(--font-mono); font-size: 11px; }

.hub-alerts {
    background: rgba(239, 68, 68, 0.07);
    border: 1px solid rgba(239, 68, 68, 0.22);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 28px;
}
.hub-alerts h3 { font-size: 13px; color: #fca5a5; margin: 0 0 8px; font-family: var(--font-mono); letter-spacing: 0.05em; text-transform: uppercase; }
.hub-alerts ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.hub-alerts li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }

.hub-modules { margin-top: 32px; }
.hub-modules h3 {
    font-size: 12px; color: var(--muted); font-family: var(--font-mono);
    text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 12px;
}

/* Network module */
.net-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
    margin-bottom: 32px;
}
.net-tile {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
}
.net-tile h3 {
    font-size: 11px; color: var(--muted); font-family: var(--font-mono);
    text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px; font-weight: 500;
}
.net-tile-kpi { font-family: var(--font-mono); font-size: 22px; letter-spacing: -0.02em; }
.net-tile-kpi.ok { color: var(--ok); }
.net-tile-kpi.warn { color: var(--warn); }
.net-tile-kpi.danger { color: #fca5a5; }
.net-tile-kpi.muted { color: var(--muted); }
.net-tile-sub { color: var(--text-2); font-size: 12.5px; margin-top: 8px; line-height: 1.5; }
.net-tile-foot { color: var(--muted); font-family: var(--font-mono); font-size: 11px; margin-top: 10px; }
.net-tile-list {
    list-style: none; padding: 0; margin: 8px 0 0;
    display: flex; flex-direction: column; gap: 6px;
}
.net-tile-list li {
    display: grid; grid-template-columns: 12px 1fr auto;
    align-items: center; gap: 10px; font-size: 13px;
}
.net-tile-list li small { color: var(--muted); font-family: var(--font-mono); font-size: 11px; }

.net-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.net-dot-ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.net-dot-warn { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.net-dot-danger { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.net-dot-muted { background: var(--muted); }

.net-group { margin-bottom: 24px; }
.net-group > h3 {
    font-size: 11px; color: var(--muted); font-family: var(--font-mono);
    text-transform: uppercase; letter-spacing: 0.1em;
    margin-bottom: 10px; font-weight: 500;
}
.net-host-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}
.net-host {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
}
.net-host header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.net-host strong { font-size: 13px; font-weight: 500; flex: 1; min-width: 0; }
.net-host-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--muted); }
.net-host.is-up .net-host-dot { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.net-host.is-down .net-host-dot { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.net-host.is-down { border-color: rgba(239, 68, 68, 0.35); }
.net-host.is-stale { opacity: 0.55; }
/* Hosts criticos: un guion lateral discreto, solo informativo. */
.net-host.is-critical { border-left: 2px solid var(--accent-soft); }
.net-host.is-critical.is-down { border-left-color: var(--danger); }
.net-host dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.net-host dl > div { display: flex; flex-direction: column; gap: 2px; }
.net-host dt { font-size: 10px; color: var(--muted); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; }
.net-host dd { margin: 0; font-size: 12px; font-family: var(--font-mono); color: var(--text); }

.net-outage-log { margin-top: 32px; }
.net-outage-log h3 {
    font-size: 11px; color: var(--muted); font-family: var(--font-mono);
    text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 10px;
}
.net-outage-log table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.net-outage-log th { text-align: left; color: var(--muted); font-weight: 500; font-family: var(--font-mono); padding: 8px 12px; border-bottom: 1px solid var(--line); }
.net-outage-log td { padding: 8px 12px; border-bottom: 1px solid var(--line); font-family: var(--font-mono); }

/* Sensors module */
.sensors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}
.sensor-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
}
.sensor-card.is-old { opacity: 0.55; border-color: rgba(245, 158, 11, 0.3); }
.sensor-card header { margin-bottom: 16px; }
.sensor-card header strong { display: block; font-size: 15px; font-weight: 500; }
.sensor-card header small { display: block; color: var(--muted); font-family: var(--font-mono); font-size: 11px; margin-top: 3px; }
.sensor-readings { display: flex; gap: 28px; margin-bottom: 16px; }
.sensor-metric { display: flex; flex-direction: column; gap: 4px; }
.sensor-metric-value { font-family: var(--font-mono); font-size: 30px; letter-spacing: -0.02em; line-height: 1; }
.sensor-metric-value em { font-style: normal; font-size: 14px; color: var(--muted); margin-left: 2px; }
.sensor-metric-label { font-size: 11px; color: var(--muted); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; }
.sensor-card footer {
    display: flex; gap: 16px; flex-wrap: wrap;
    color: var(--muted); font-size: 11px; font-family: var(--font-mono);
    padding-top: 12px; border-top: 1px solid var(--line);
}

.badge-warn { color: #fcd34d; border-color: #92400e; background: #2a1c0a; }
.badge-danger { color: #fca5a5; border-color: #7f1d1d; background: #2a0e0e; }
.empty { color: var(--muted); font-style: italic; padding: 40px 0; text-align: center; }
.muted { color: var(--muted); }

/* ---------------------------------------------------------- Asistente ---- */
.filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.filters a {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text-2);
    font-size: 12px;
    font-family: var(--font-mono);
    text-transform: lowercase;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.filters a:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--text); }
.filters a.on { background: var(--accent-soft); border-color: var(--accent); color: #fff; }

.asistente-list table.data,
.asistente-detalle table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table.data th {
    text-align: left;
    color: var(--muted);
    font-weight: 500;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 11px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
}
table.data td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
table.data tr:hover td { background: var(--surface-2); }
table.data td.num { font-family: var(--font-mono); }
table.data td.num a { color: var(--accent); }
table.data td.ts { font-family: var(--font-mono); color: var(--text-2); white-space: nowrap; }

.state {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text-2);
}
.state-abierto { color: #fcd34d; border-color: #92400e; background: #2a1c0a; }
.state-cerrado_resuelto { color: #86efac; border-color: #14532d; background: #0a2418; }
.state-cerrado_no_resuelto { color: #fca5a5; border-color: #7f1d1d; background: #2a0e0e; }
.state-escalado_gorka { color: #fdba74; border-color: #7c2d12; background: #2a1408; }

.fb {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text-2);
}
.fb-bien { color: #86efac; border-color: #14532d; background: #0a2418; }
.fb-mejorable { color: #fcd34d; border-color: #92400e; background: #2a1c0a; }
.fb-mal { color: #fca5a5; border-color: #7f1d1d; background: #2a0e0e; }
.fb-escalado_bien { color: #93c5fd; border-color: #1e3a8a; background: #0c1a36; }
.fb-escaló_innecesariamente { color: #fdba74; border-color: #7c2d12; background: #2a1408; }
.fb-acción_dañina { color: #fda4af; border-color: #9f1239; background: #2a0a15; }

/* Detalle */
.exp-grid {
    display: grid;
    grid-template-columns: minmax(260px, 320px) 1fr;
    gap: 20px;
    margin-bottom: 24px;
}
@media (max-width: 900px) {
    .exp-grid { grid-template-columns: 1fr; }
}

.exp-meta,
.exp-chat,
.exp-tools,
.exp-feedback {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
}
.exp-meta h3,
.exp-chat h3,
.exp-tools h3,
.exp-feedback h3 {
    font-size: 11px;
    color: var(--muted);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 14px;
    font-weight: 500;
}

.exp-meta dl { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.exp-meta dl > div { display: flex; flex-direction: column; gap: 2px; }
.exp-meta dt { font-size: 10px; color: var(--muted); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; }
.exp-meta dd { margin: 0; font-size: 13px; }
.exp-meta dd small { color: var(--muted); font-family: var(--font-mono); }

.exp-res { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.exp-res h4 { font-size: 10px; color: var(--muted); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; font-weight: 500; }
.exp-res p { font-size: 13px; color: var(--text-2); }

.chat { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.msg {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--surface-2);
    border: 1px solid var(--line);
    align-items: start;
}
.msg .rol {
    font-family: var(--font-mono);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    padding-top: 2px;
}
.msg .t { font-size: 13px; line-height: 1.55; color: var(--text); white-space: pre-wrap; word-wrap: break-word; }
.msg .ts { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.msg-empleado { border-left: 2px solid var(--accent); }
.msg-asistente { border-left: 2px solid var(--ok); }
.msg-asistente .rol { color: var(--ok); }
.msg-sistema { border-left: 2px solid var(--muted); opacity: 0.85; }
.msg-sistema .t { color: var(--text-2); font-style: italic; }

.exp-tools { margin-bottom: 24px; }
.exp-tools .tools { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.exp-tools .tools li {
    display: grid;
    grid-template-columns: 44px 1fr auto auto auto;
    gap: 12px;
    align-items: center;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 12px;
}
.exp-tools .tier { color: var(--muted); }
.exp-tools code { color: var(--text); background: transparent; padding: 0; }
.exp-tools .result.ok { color: var(--ok); }
.exp-tools .result.err { color: var(--danger); }
.exp-tools .lat,
.exp-tools .ts { color: var(--muted); }

.exp-feedback form { display: flex; flex-direction: column; gap: 14px; }
.exp-feedback fieldset.fb-tags {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.exp-feedback fieldset.fb-tags legend {
    font-size: 10px;
    color: var(--muted);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0 6px;
}
.fb-radio { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.fb-radio input[type="radio"] { accent-color: var(--accent); }
.fb-nota { display: flex; flex-direction: column; gap: 6px; }
.fb-nota > span { font-size: 11px; color: var(--muted); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; }
.fb-nota textarea {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 13px;
    padding: 10px 12px;
    resize: vertical;
}
.fb-nota textarea:focus { outline: none; border-color: var(--accent); }
.fb-ejemplo { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.fb-ejemplo input[type="checkbox"] { accent-color: var(--accent); }
.fb-actions { display: flex; gap: 8px; }
.exp-feedback button {
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    color: #fff;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    transition: background 0.12s, transform 0.12s;
}
.exp-feedback button:hover { background: var(--accent); }
.exp-feedback button:active { transform: translateY(1px); }
.form-error {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 12px;
}

.page-meta .back { color: var(--text-2); }
.page-meta .back:hover { color: var(--accent); }
