/* ============================================================
   SIDEBAR IMPROVEMENTS
   ============================================================ */
.sidebar {
    display: flex;
    flex-direction: column;
}
.nav-links a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}
.nav-icon { font-size: 1rem; width: 1.2rem; text-align: center; }
.nav-active {
    background: rgba(37, 99, 235, 0.18) !important;
    color: #60a5fa !important;
    border-left: 3px solid #2563eb;
    padding-left: calc(1rem - 3px) !important;
}
.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.logout-link {
    color: var(--muted);
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
    display: block;
    border-radius: 10px;
}
.logout-link:hover { background: rgba(239,68,68,0.1); color: #f87171; text-decoration: none; }

/* ============================================================
   STATUS DOTS
   ============================================================ */
.status-dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
    border: 2px solid rgba(148,163,184,0.5);
    flex-shrink: 0;
}
.dot-online  { background: #22c55e; border-color: #16a34a; box-shadow: 0 0 6px rgba(34,197,94,0.6); }
.dot-warn    { background: #f59e0b; border-color: #d97706; box-shadow: 0 0 6px rgba(245,158,11,0.6); }
.dot-offline { background: transparent; border-color: rgba(148,163,184,0.5); }
.dot-lg { width: 14px; height: 14px; }

/* ============================================================
   STATUS BADGES (inline table cells)
   ============================================================ */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.badge-success { background: rgba(34,197,94,0.15);  color: #4ade80; }
.badge-warn    { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-danger  { background: rgba(239,68,68,0.15);  color: #f87171; }
.badge-muted   { background: rgba(148,163,184,0.12); color: #9fb0cd; }
.badge-high    { background: rgba(239,68,68,0.15);  color: #f87171; }
.badge-medium  { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-low     { background: rgba(34,197,94,0.15);  color: #4ade80; }

/* ============================================================
   STATUS PILLS (larger, used in device detail summary)
   ============================================================ */
.status-pill {
    display: inline-block;
    padding: 0.3rem 0.85rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}
.pill-success { background: rgba(34,197,94,0.18);  color: #4ade80;  border: 1px solid rgba(34,197,94,0.3); }
.pill-warn    { background: rgba(245,158,11,0.18); color: #fbbf24;  border: 1px solid rgba(245,158,11,0.3); }
.pill-danger  { background: rgba(239,68,68,0.18);  color: #f87171;  border: 1px solid rgba(239,68,68,0.3); }
.pill-muted   { background: rgba(148,163,184,0.12); color: #9fb0cd; border: 1px solid var(--border); }
.pill-success-sm { color: #4ade80; font-size: 0.8rem; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-action {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.55rem 1.1rem;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.btn-action:hover { opacity: 0.85; }
.btn-action-secondary { background: #1e293b; }
.btn-sm {
    background: #1e293b;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.35rem 0.9rem;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-sm:hover { background: #263148; }
.btn-primary-sm { background: var(--primary); border-color: var(--primary); }
.btn-danger-sm  { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.3); color: #f87171; }

/* ============================================================
   DEVICES PAGE
   ============================================================ */
.devices-header { margin-bottom: 0; }
.devices-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.devices-title-row h2 { margin: 0; font-size: 1.8rem; }
.devices-actions { display: flex; gap: 0.6rem; }

.device-filter-bar {
    display: flex;
    align-items: center;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 0;
    overflow-x: auto;
}
.filter-tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    color: var(--muted);
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    transition: color 0.15s;
}
.filter-tab:hover { color: var(--text); text-decoration: none; }
.filter-tab.active { color: #60a5fa; border-bottom-color: #2563eb; }
.filter-count {
    background: rgba(148,163,184,0.15);
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
}
.filter-tab.active .filter-count { background: rgba(37,99,235,0.25); color: #60a5fa; }
.filter-tab-spacer { flex: 1; }
.filters-groups-btn { margin-left: auto; color: var(--muted); font-family: inherit; }

.devices-panel { border-radius: 0 0 16px 16px; border-top: none; padding: 0; }
.devices-sub-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.2rem;
    border-bottom: 1px solid var(--border);
}
.filtered-label { color: var(--muted); font-size: 0.85rem; margin-left: 0.5rem; }
.filtered-value { color: var(--text); }

.devices-table { width: 100%; border-collapse: collapse; }
.devices-table thead tr { background: rgba(15,23,42,0.6); }
.devices-table th {
    padding: 0.7rem 0.9rem;
    text-align: left;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.devices-table td {
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    vertical-align: middle;
}
.device-row { cursor: pointer; transition: background 0.1s; }
.device-row:hover { background: rgba(37,99,235,0.06); }
.col-status { width: 28px; }
.col-hostname a { color: #60a5fa; font-weight: 500; }
.col-hostname a:hover { text-decoration: underline; }
.site-link { color: #38bdf8 !important; }
.site-link:hover { text-decoration: underline; }

.empty-row { text-align: center; color: var(--muted); padding: 2rem !important; }
.table-footer {
    padding: 0.75rem 1.2rem;
    color: var(--muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
}

/* ============================================================
   DEVICE DETAIL — LAYOUT
   ============================================================ */
.dd-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.dd-header-left { display: flex; align-items: center; gap: 0.9rem; }
.dd-hostname { font-size: 1.7rem; margin: 0 0 0.15rem; }
.dd-breadcrumb { color: var(--muted); font-size: 0.85rem; }
.dd-breadcrumb a { color: var(--muted); }
.dd-breadcrumb a:hover { color: var(--text); }
.os-icon { font-size: 1rem; margin-left: 0.35rem; color: var(--muted); }
.dd-header-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.dd-layout {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1rem;
    align-items: start;
}
.dd-sidenav {
    background: rgba(15,23,42,0.7);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.5rem;
    position: sticky;
    top: 1rem;
}
.dd-navitem {
    display: block;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.88rem;
    text-decoration: none;
    transition: all 0.15s;
}
.dd-navitem:hover { background: rgba(37,99,235,0.1); color: var(--text); text-decoration: none; }
.dd-navitem.active { background: rgba(37,99,235,0.18); color: #60a5fa; font-weight: 600; }

.dd-main { min-width: 0; }
.dd-section { margin-bottom: 0; }
.panel-section-title { margin: 0 0 1.2rem; font-size: 1.1rem; font-weight: 700; }

/* ============================================================
   DEVICE DETAIL — SUMMARY PANEL
   ============================================================ */
.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.summary-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border);
}
.summary-field label {
    font-size: 0.78rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.field-value { font-size: 0.92rem; color: var(--text); }
.field-mono  { font-family: monospace; font-size: 0.82rem; color: #9fb0cd; }
.field-link  { color: #60a5fa; cursor: pointer; }
.site-link-text { color: #38bdf8; }
.summary-divider { height: 1px; background: var(--border); margin: 0.75rem 0; }
.summary-status-block { display: grid; gap: 0.5rem; }
.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.status-row label { font-size: 0.85rem; color: var(--muted); }

/* ============================================================
   DEVICE DETAIL — INFO GRID (system tab)
   ============================================================ */
.info-grid-2col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}
.info-item {
    background: rgba(8,17,32,0.5);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
}
.info-item label {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.4rem;
}
.info-item strong { font-size: 0.95rem; }

/* ============================================================
   DEVICE DETAIL — PATCH PANEL
   ============================================================ */
.patch-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.2rem; }
.patch-header .panel-section-title { margin: 0; }
.patch-actions { display: flex; gap: 0.5rem; }
.patch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 1.5rem; }
.sub-section-title { font-size: 0.9rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin: 1.25rem 0 0.75rem; }

/* ============================================================
   DEVICE DETAIL — MONITORS
   ============================================================ */
.monitors-actions { margin-bottom: 1rem; }
.count-badge {
    display: inline-block;
    background: rgba(37,99,235,0.2);
    color: #60a5fa;
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    margin-left: 0.4rem;
}
.toggle-on { color: #22c55e; font-size: 1.1rem; }

/* ============================================================
   DEVICE DETAIL — SECURITY
   ============================================================ */
.security-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.75rem; }
.security-header .panel-section-title { margin: 0; }
.no-alerts-badge {
    background: rgba(34,197,94,0.15);
    color: #4ade80;
    border: 1px solid rgba(34,197,94,0.25);
    border-radius: 999px;
    padding: 0.25rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 600;
}
.security-actions { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; }
.security-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.security-block-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin: 0 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}
.security-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

/* ============================================================
   DEVICE DETAIL — STORAGE
   ============================================================ */
.storage-drive { margin-bottom: 1.5rem; }
.drive-label { display: flex; gap: 1.5rem; margin-bottom: 0.6rem; }
.drive-letter { font-weight: 700; color: #60a5fa; }
.drive-type { color: var(--muted); font-size: 0.88rem; }
.drive-bar-wrap { display: flex; flex-direction: column; gap: 0.35rem; }
.drive-bar {
    height: 10px;
    background: rgba(148,163,184,0.12);
    border-radius: 999px;
    overflow: hidden;
}
.drive-bar-fill { height: 100%; background: #2563eb; border-radius: 999px; }
.drive-stats { color: var(--muted); font-size: 0.82rem; }
.drive-total { color: var(--text); font-size: 0.88rem; font-weight: 600; }

/* ============================================================
   DEVICE DETAIL — METRICS CHART
   ============================================================ */
.metrics-chart-wrap {
    background: rgba(8,17,32,0.5);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.2rem;
    margin-bottom: 1rem;
}
.metrics-legend { display: flex; gap: 1.5rem; margin-bottom: 1rem; font-size: 0.85rem; color: var(--muted); align-items: center; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 0.35rem; }

/* ============================================================
   DATA TABLE (shared)
   ============================================================ */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead { background: rgba(15,23,42,0.5); }
.data-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}
.data-table td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.data-table tbody tr:hover { background: rgba(37,99,235,0.04); }
.data-table tfoot td { padding: 0.75rem 1rem; font-size: 0.9rem; }

.empty-msg {
    padding: 2rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.92rem;
}

/* ============================================================
   NETWORK section
   ============================================================ */
.network-ext-ip { color: var(--muted); margin-bottom: 1rem; font-size: 0.9rem; }
.network-ext-ip strong { color: var(--text); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .dd-layout { grid-template-columns: 1fr; }
    .dd-sidenav { position: static; display: flex; flex-wrap: wrap; gap: 0.25rem; border-radius: 10px; }
    .dd-navitem { padding: 0.4rem 0.7rem; }
    .summary-grid { grid-template-columns: 1fr; }
    .patch-grid, .security-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .devices-title-row { flex-direction: column; align-items: flex-start; }
    .dd-header { flex-direction: column; align-items: flex-start; }
    .dd-header-actions { flex-wrap: wrap; }
}
