/* =============================================
   GUARDIAN DASHBOARD - INTELIX BRAND DESIGN
   ============================================= */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- Design Tokens --- */
:root {
    --bg-deep: #050a15;
    --bg-main: #0a101f;
    --bg-card: #0a1628;
    --bg-card-hover: #0f1d32;
    --bg-elevated: #111a2e;

    --primary: #00d4c8;
    --primary-dim: rgba(0, 212, 200, 0.15);
    --primary-glow: rgba(0, 212, 200, 0.4);
    --secondary: #4da6ff;
    --secondary-dim: rgba(77, 166, 255, 0.15);

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #8b5cf6;

    --text-primary: #f0f4f8;
    --text-secondary: #94a3b8;
    --text-muted: #475569;

    --border-subtle: rgba(0, 212, 200, 0.08);
    --border-hover: rgba(0, 212, 200, 0.25);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(0, 212, 200, 0.1);

    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    overflow: hidden; /* No global scroll */
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Animated Network Background --- */
.network-bg {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    background: var(--bg-deep);
    pointer-events: none;
}

.network-bg::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-image:
        radial-gradient(circle, rgba(0, 212, 200, 0.08) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: gridPulse 8s ease-in-out infinite alternate;
}

@keyframes gridPulse {
    0% { opacity: 0.3; }
    100% { opacity: 0.6; }
}

/* --- App Container --- */
.app {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Top Navigation Bar --- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 60px;
    background: rgba(10, 22, 40, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-brand img {
    height: 32px;
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.topbar-brand h1 {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 2px;
    margin: 0;
    padding: 0;
    white-space: nowrap;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- Mode Switcher Buttons --- */
.mode-btn {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 6px 15px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 1px;
    transition: var(--transition);
}

.mode-btn.active {
    background: rgba(0, 212, 200, 0.1);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 15px rgba(0, 212, 200, 0.15);
}

.mode-btn:hover:not(.active) {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.topbar-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--success);
    padding: 6px 14px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 20px;
    animation: statusPulse 3s ease-in-out infinite;
}

.topbar-status .dot {
    width: 7px; height: 7px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--success);
}

@keyframes statusPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* --- Server Tabs --- */
.server-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 1.5rem;
    height: 46px;
    background: rgba(10, 22, 40, 0.6);
    border-bottom: 1px solid var(--border-subtle);
    overflow-x: auto;
    scrollbar-width: none;
}

.server-tabs::-webkit-scrollbar { display: none; }

.server-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    white-space: nowrap;
    border: 1px solid transparent;
    border-bottom: none;
    position: relative;
}

.server-tab:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.server-tab.active {
    background: var(--bg-card);
    color: var(--primary);
    border-color: var(--border-hover);
    border-bottom: 2px solid var(--primary);
    font-weight: 600;
}

.server-tab .tab-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.server-tab .tab-dot.ok { background: var(--success); box-shadow: 0 0 6px var(--success); }
.server-tab .tab-dot.warning { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.server-tab .tab-dot.critical { background: var(--danger); box-shadow: 0 0 6px var(--danger); animation: blink 1s infinite; }
.server-tab .tab-dot.offline { background: #64748b; box-shadow: 0 0 6px rgba(100, 116, 139, 0.75); }

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes network-pulse {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.6; }
    100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}
.network-pulse {
    animation: network-pulse 2s infinite cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.topbar-alerts-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.topbar-alerts-btn:hover {
    border-color: var(--border-hover);
    background: var(--bg-hover);
}

.topbar-alerts-btn span {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.65rem;
    transition: var(--transition);
}

/* --- Rooms Topology Bubbles --- */
.room-bubble {
    position: absolute;
    width: 90px;
    height: 90px;
    background: var(--bg-card);
    border: 2px solid var(--border-subtle);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 5;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.room-bubble:hover {
    transform: scale(1.15);
    z-index: 10;
    border-color: var(--primary);
}

.room-bubble .room-icon { font-size: 1.5rem; margin-bottom: 2px; }
.room-bubble .room-name { font-size: 0.6rem; font-weight: 800; color: var(--text-primary); text-transform: uppercase; max-width: 80%; line-height: 1.1; }
.room-bubble .room-status { font-size: 0.5rem; font-weight: 700; margin-top: 4px; padding: 2px 6px; border-radius: 4px; }

.room-bubble.online { border-color: var(--success); }
.room-bubble.online .room-status { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.room-bubble.offline { border-color: var(--danger); animation: criticalPulse 2s infinite; }
.room-bubble.offline .room-status { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

/* Master Room Center */
.master-hub {
    position: absolute;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle at center, rgba(0, 212, 200, 0.2), transparent);
    border: 3px solid var(--primary);
    border-radius: 50%;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 50px rgba(0, 212, 200, 0.3);
    z-index: 10;
}

@keyframes criticalPulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 20px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

.topbar-alerts-btn.has-alerts span {
    background: var(--danger);
    color: white;
    animation: blink 1s infinite;
}

.server-tab .tab-info {
    font-size: 0.65rem;
    opacity: 0.5;
    margin-left: 2px;
}

.history-btn {
    background: rgba(0, 212, 200, 0.1);
    border: 1px solid rgba(0, 212, 200, 0.2);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s;
    margin-left: 5px;
}
.history-btn:hover {
    background: var(--primary);
    color: #0a1628;
}

/* --- Admin Tabs --- */
.admin-tabs-container {
    display: flex;
    gap: 10px;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 10px;
}
.admin-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s;
}
.admin-tab-btn.active {
    background: rgba(0, 212, 200, 0.1);
    color: var(--primary);
}
.admin-tab-content {
    display: none;
}
.admin-tab-content.active {
    display: block;
}

.no-servers-msg {
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- Settings Modal --- */
.cfg-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 5px;
    outline: none;
    margin-bottom: 8px;
}

.cfg-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--warning);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.cfg-slider.crit::-webkit-slider-thumb {
    background: var(--danger);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.settings-group label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- Main Content Area --- */
.main-content {
    flex: 1;
    padding: 1rem 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    overflow-y: auto; /* Internal scroll only */
    scrollbar-width: thin;
}

#rooms-view.main-content {
    max-width: none;
}

.rooms-layout {
    display: flex;
    gap: 16px;
    position: relative;
    padding: 10px 12px 18px;
    z-index: 2;
    align-items: stretch;
}

.rooms-layout.is-status-page {
    height: auto !important;
    overflow: visible !important;
}

.rooms-sidebar {
    flex: 0 0 clamp(280px, 18vw, 320px);
    min-width: 280px;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 110;
    transition: width 0.3s ease, opacity 0.3s ease;
}

.rooms-grid-area {
    flex: 1 1 auto;
    min-width: 0;
    position: relative;
    z-index: 10;
    overflow-y: auto;
    padding: 10px 2px 10px 10px;
    display: flex;
    flex-direction: column;
}

.rooms-grid-toolbar {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 15px;
    padding: 10px 0 6px;
    align-content: start;
}

.expert-card-node {
    overflow: hidden;
    transform: translateY(0);
    transition: transform 0.3s ease, box-shadow 0.3s ease, filter 0.3s ease, background 0.3s ease;
    will-change: transform, box-shadow;
}

.expert-card-node::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--room-accent-soft, rgba(0, 212, 200, 0.08)) 0%, transparent 62%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.expert-card-node:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.28), 0 0 18px var(--room-accent-glow, rgba(0, 212, 200, 0.18)), inset 0 0 14px var(--room-accent-soft, rgba(0, 212, 200, 0.08)) !important;
    filter: brightness(1.03);
}

.expert-card-node:hover::before,
.expert-card-node:focus-visible::before {
    opacity: 1;
}

.expert-card-node:focus-visible {
    outline: none;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.28), 0 0 18px var(--room-accent-glow, rgba(0, 212, 200, 0.18)), inset 0 0 14px var(--room-accent-soft, rgba(0, 212, 200, 0.08)) !important;
}

/* --- Bento Grid --- */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(140px, auto);
    gap: 1rem;
}

/* --- Card Base --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(0, 212, 200, 0.03) 0%, transparent 60%);
    opacity: 0;
    transition: var(--transition);
}

.card:hover {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), 0 0 15px rgba(0, 212, 200, 0.1);
}

.card:hover::before { opacity: 1; }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.card-icon {
    font-size: 0.9rem;
    opacity: 0.5;
}

/* --- Span Classes for Bento --- */
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.row-2 { grid-row: span 2; }

/* --- Circular Progress Ring --- */
.ring-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.ring-wrapper {
    position: relative;
    width: 110px;
    height: 110px;
}

.ring-svg {
    width: 110px;
    height: 110px;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 8;
}

.ring-progress {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 6px currentColor);
}

.ring-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -1px;
}

.ring-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

/* --- Chart Card --- */
.chart-container {
    width: 100%;
    height: 180px;
    position: relative;
}

/* --- Metric Value (for simple cards) --- */
.metric-big {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 0.25rem;
}

.metric-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* --- Security Log --- */
.security-log {
    max-height: 120px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-elevated) transparent;
}

.log-entry {
    font-size: 0.72rem;
    padding: 4px 0;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255,255,255,0.03);
    font-family: 'Courier New', monospace;
}

.log-entry.CRITICAL { color: var(--danger); font-weight: 600; }
.log-entry.WARNING { color: var(--warning); }

/* --- Updates Badge --- */
.updates-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* --- Server Info Bar --- */
.info-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1.5rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    background: rgba(10, 22, 40, 0.4);
}

.info-bar span { display: flex; align-items: center; gap: 6px; }

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-main);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    width: 90%;
    max-width: 650px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.close-modal {
    position: absolute;
    top: 16px; right: 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 1.2rem;
    width: 32px; height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.close-modal:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.detail-item {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.detail-label {
    font-size: 0.65rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 1.05rem;
    font-weight: 600;
}

/* --- Scrollbar Styling --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* --- Responsive --- */

/* Large Desktops (default) — 4 cols */

/* Medium Desktops/Laptops */
@media (max-width: 1400px) {
    .bento-grid { grid-template-columns: repeat(4, 1fr); gap: 0.85rem; }
    .rooms-sidebar { flex-basis: 300px; min-width: 270px; max-width: 300px; }
    .rooms-grid { grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); }
}

/* Small Desktops / Large Tablets (landscape) */
@media (max-width: 1100px) {
    .bento-grid { grid-template-columns: repeat(3, 1fr); }
    .span-2 { grid-column: span 2; }
    .span-3 { grid-column: span 3; }
    .span-4 { grid-column: span 3; }

    .ring-wrapper { width: 90px; height: 90px; }
    .ring-svg { width: 90px; height: 90px; }
    .ring-value { font-size: 1.3rem; }

    .rooms-layout {
        flex-direction: column;
        height: auto !important;
        overflow: visible !important;
        padding: 8px;
    }

    .rooms-sidebar {
        width: 100%;
        max-width: none;
        min-width: 0;
        flex-basis: auto;
    }

    .rooms-grid-area {
        overflow: visible;
        padding: 0;
    }

    .rooms-grid {
        grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
        gap: 14px;
    }
}

/* Tablets (portrait) */
@media (max-width: 800px) {
    .bento-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
    .span-2 { grid-column: span 2; }
    .span-3, .span-4 { grid-column: span 2; }
    .row-2 { grid-row: span 1; }

    .main-content { padding: 1rem; }

    .topbar-brand h1 { font-size: 0.95rem; letter-spacing: 2px; }
    .topbar { padding: 0 1rem; height: 52px; }

    .info-bar { flex-direction: column; align-items: flex-start; gap: 4px; font-size: 0.68rem; }

    .chart-container { height: 140px; }

    .ring-wrapper { width: 85px; height: 85px; }
    .ring-svg { width: 85px; height: 85px; }
    .ring-value { font-size: 1.2rem; }

    .modal-content { padding: 1.5rem; border-radius: var(--radius-lg); }
    .detail-grid { grid-template-columns: 1fr 1fr; }

    .rooms-layout {
        gap: 12px;
        padding: 6px;
    }

    .rooms-grid-toolbar {
        flex-wrap: wrap;
    }

    .rooms-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 12px;
    }
}

/* Mobile (large) */
@media (max-width: 560px) {
    .bento-grid { grid-template-columns: 1fr; gap: 0.65rem; }
    .span-2, .span-3, .span-4 { grid-column: span 1; }

    .topbar { height: 48px; padding: 0 0.75rem; }
    .topbar-brand img { height: 26px; }
    .topbar-brand h1 { font-size: 0.85rem; letter-spacing: 1px; }
    .topbar-status { font-size: 0.65rem; padding: 5px 10px; }
    .topbar-status .dot { width: 6px; height: 6px; }

    .server-tabs { padding: 0 0.75rem; gap: 2px; }
    .server-tab { padding: 6px 12px; font-size: 0.72rem; }

    .main-content { padding: 0.75rem; }
    .card { padding: 1rem; }
    .card-title { font-size: 0.65rem; }

    .rooms-grid {
        grid-template-columns: 1fr;
    }

    .ring-wrapper { width: 80px; height: 80px; }
    .ring-svg { width: 80px; height: 80px; }
    .ring-value { font-size: 1.1rem; }

    .metric-big { font-size: 1.6rem; }
    .chart-container { height: 120px; }

    .modal-content { padding: 1.25rem; width: 95%; border-radius: var(--radius-md); }
    .detail-grid { grid-template-columns: 1fr; }
    .close-modal { top: 12px; right: 12px; }

    /* Fix Topbar crowding on mobile */
    .topbar { padding: 0 0.75rem; }
    .topbar-brand h1 { display: none; }
    .topbar-brand img { width: 32px; height: 32px; }
    
    .topbar-alerts-btn { 
        padding: 0 10px; 
        font-size: 0; /* Hide text */
        width: 40px; 
        height: 40px; 
        display: flex; 
        align-items: center; 
        justify-content: center;
    }
    .topbar-alerts-btn::before { font-size: 1.2rem; } /* Restore icon size */
    .topbar-alerts-btn span { font-size: 0.9rem; margin: 0; } /* Keep numbers */
    
    /* Individual overrides to keep icons visible */
    button[onclick*="settings"] { font-size: 0; } 
    button[onclick*="settings"]::after { content: '⚙️'; font-size: 1.2rem; }
    
    button[onclick*="export"] { font-size: 0; }
    button[onclick*="export"]::after { content: '📥'; font-size: 1.2rem; }

    button[onclick*="alerts"] { font-size: 0; gap: 0; }
    button[onclick*="alerts"] #active-alert-count { font-size: 0.8rem; background: var(--danger); padding: 2px 6px; border-radius: 10px; margin-left: 2px; }
    button[onclick*="alerts"]::after { content: '🔔'; font-size: 1.2rem; }

    .topbar-status span:not(.dot) { display: none; }
    #online-users-bubbles { margin-left: 5px; }
}

/* Very Small Mobile */
@media (max-width: 380px) {
    .server-tab .tab-info { display: none; }
    .metric-big { font-size: 1.4rem; }
    #online-users-bubbles { display: none; } /* Hide bubbles on tiny screens */
}

/* --- Historial Separado (Dos Columnas) --- */
.historial-separado {
    display: flex;
    gap: 15px;
    width: 100%;
    margin-top: 10px;
}

.columna-dispositivo {
    flex: 1; 
    background: rgba(10, 22, 40, 0.4);
    border: 1px solid rgba(0, 212, 200, 0.15);
    border-radius: 12px;
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.titulo-columna {
    font-size: 0.75rem;
    background: #00d4c8;
    color: #050a15;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: -15px -15px 15px -15px;
    padding: 12px;
    border-radius: 10px 10px 0 0;
    font-weight: 900;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.item-registro {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    transition: 0.2s;
}

.item-registro:hover {
    background: rgba(0, 212, 200, 0.05);
    border-color: rgba(0, 212, 200, 0.2);
}

.info-principal {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-dot.conectado {
    background-color: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

.status-dot.desconectado {
    background-color: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

.nombre-dispositivo {
    font-weight: 700;
    font-size: 0.82rem;
    color: #f1f5f9;
}

.fecha-registro {
    font-size: 0.65rem;
    color: #94a3b8;
    align-self: flex-end;
    margin-top: -16px;
    font-family: 'Inter', sans-serif;
}

.estado-texto {
    font-size: 0.65rem;
    font-weight: 800;
    margin-top: 6px;
    letter-spacing: 0.5px;
}
