/**
 * TaleClip Security & Forensics Dashboard
 * Glassmorphic design system — uses --tc-glass-* variables from style.css
 *
 * Glass tokens (defined in style.css :root):
 *   --tc-glass-bg           standard card / panel background
 *   --tc-glass-bg-hover     hover state
 *   --tc-glass-bg-active    active / pressed state
 *   --tc-glass-bg-input     form inputs
 *   --tc-glass-bg-sidebar   sidebar panels
 *   --tc-glass-bg-topbar    top-bar background
 *   --tc-glass-blur / blur-heavy / blur-light
 *   --tc-glass-border / border-hover / border-focus / border-subtle
 *   --tc-radius-sm / md / lg / xl
 *   --tc-shadow-sm / md / lg / xl / 2xl
 *   --tc-primary / success / warning / danger
 */

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

.sec-dashboard {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #0a0e1a;
    color: #e2e8f0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    overflow: hidden;
}

/* Top bar */
.sec-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    background: var(--tc-glass-bg-topbar);
    backdrop-filter: blur(var(--tc-glass-blur-heavy)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-heavy)) saturate(140%);
    border-bottom: var(--tc-glass-border);
    flex-shrink: 0;
    z-index: 100;
}

.sec-topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sec-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 15px;
    color: #f1f5f9;
    text-decoration: none;
}

.sec-logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #7c3aed 0%, var(--tc-primary, #3b82f6) 100%);
    border-radius: var(--tc-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
    box-shadow: var(--tc-shadow-sm);
}

.sec-logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.sec-logo-sub {
    font-size: 10px;
    font-weight: 500;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sec-topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-icon { display: none; }
[data-theme="dark"] .theme-icon-moon { display: block; }
[data-theme="light"] .theme-icon-sun { display: block; }
html:not([data-theme]) .theme-icon-moon { display: block; }

.sec-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tc-success, #22c55e);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
    animation: sec-pulse 2s infinite;
}

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

.sec-topbar-user {
    font-size: 12px;
    color: #94a3b8;
}

.sec-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-sm);
    background: var(--tc-glass-bg);
    backdrop-filter: blur(var(--tc-glass-blur-light));
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-light));
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.sec-btn:hover {
    background: var(--tc-glass-bg-hover);
    border: var(--tc-glass-border-hover);
    box-shadow: var(--tc-shadow-sm);
}

.sec-btn-primary {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    border-color: rgba(124, 58, 237, 0.4);
    color: white;
    box-shadow: 0 0 12px rgba(124, 58, 237, 0.25);
}

.sec-btn-primary:hover {
    background: linear-gradient(135deg, #6d28d9, #5b21b6);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.4);
}

.sec-btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

.sec-btn-danger {
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--tc-danger, #ef4444);
}

.sec-btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.15);
}

/* Main content area */
.sec-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left panel (AD tree) — sidebar glass */
.sec-tree-panel {
    width: 300px;
    min-width: 260px;
    max-width: 400px;
    background: var(--tc-glass-bg-sidebar);
    backdrop-filter: blur(var(--tc-glass-blur-heavy)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-heavy)) saturate(140%);
    border-right: var(--tc-glass-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

.sec-tree-panel.collapsed {
    width: 0;
    min-width: 0;
    border-right: none;
}

.sec-tree-header {
    padding: 12px 16px;
    border-bottom: var(--tc-glass-border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sec-tree-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
}

.sec-tree-search {
    padding: 8px 12px;
    border-bottom: var(--tc-glass-border-subtle);
}

.sec-tree-search input {
    width: 100%;
    padding: 6px 10px;
    background: var(--tc-glass-bg-input);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-sm);
    color: #e2e8f0;
    font-size: 12px;
    outline: none;
    transition: all 0.2s ease;
}

.sec-tree-search input:focus {
    border: var(--tc-glass-border-focus);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.sec-tree-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.sec-tree-node {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 16px;
    font-size: 12px;
    cursor: pointer;
    color: #94a3b8;
    transition: all 0.2s ease;
    border-radius: 0;
}

.sec-tree-node:hover {
    background: var(--tc-glass-bg-hover);
    color: #e2e8f0;
}

.sec-tree-node.active {
    background: rgba(124, 58, 237, 0.15);
    color: #a78bfa;
    box-shadow: inset 3px 0 0 #7c3aed;
}

.sec-tree-node-icon {
    font-size: 14px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.sec-tree-node-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sec-tree-indent {
    padding-left: 32px;
}

.sec-tree-indent-2 {
    padding-left: 48px;
}

.sec-tree-count {
    margin-left: auto;
    background: var(--tc-glass-bg);
    color: #64748b;
    padding: 1px 6px;
    border-radius: var(--tc-radius-sm);
    font-size: 10px;
    font-weight: 600;
}

/* Main content */
.sec-main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Nav tabs */
.sec-nav {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 24px;
    background: var(--tc-glass-bg-topbar);
    backdrop-filter: blur(var(--tc-glass-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur)) saturate(140%);
    border-bottom: var(--tc-glass-border);
    flex-shrink: 0;
}

.sec-nav-tab {
    padding: 12px 18px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sec-nav-tab:hover {
    color: #94a3b8;
    background: var(--tc-glass-bg-hover);
}

.sec-nav-tab.active {
    color: #a78bfa;
    border-bottom-color: #7c3aed;
}

.sec-nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--tc-radius-sm);
    font-size: 10px;
    font-weight: 700;
    margin-left: 6px;
}

.sec-nav-badge-danger {
    background: var(--tc-danger, #ef4444);
    color: white;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

.sec-nav-badge-warn {
    background: var(--tc-warning, #f59e0b);
    color: #0f172a;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

/* Content padding */
.sec-content {
    padding: 20px 24px;
}

/* ============================================================
   KPI CARDS — glass bg with ambient status glow
   ============================================================ */

.sec-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.sec-kpi {
    background: var(--tc-glass-bg);
    backdrop-filter: blur(var(--tc-glass-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur)) saturate(140%);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--tc-shadow-sm);
    transition: all 0.2s ease;
}

.sec-kpi:hover {
    background: var(--tc-glass-bg-hover);
    border: var(--tc-glass-border-hover);
    box-shadow: var(--tc-shadow-md);
    transform: translateY(-1px);
}

.sec-kpi-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.sec-kpi-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
}

.sec-kpi-critical .sec-kpi-value { color: var(--tc-danger, #ef4444); }
.sec-kpi-high .sec-kpi-value { color: var(--tc-warning, #f59e0b); }
.sec-kpi-info .sec-kpi-value { color: var(--tc-primary, #3b82f6); }
.sec-kpi-ok .sec-kpi-value { color: var(--tc-success, #22c55e); }
.sec-kpi-purple .sec-kpi-value { color: #a78bfa; }

/* Ambient glow per severity */
.sec-kpi-critical { box-shadow: var(--tc-shadow-sm), 0 0 20px rgba(239, 68, 68, 0.08); }
.sec-kpi-high     { box-shadow: var(--tc-shadow-sm), 0 0 20px rgba(245, 158, 11, 0.08); }
.sec-kpi-info     { box-shadow: var(--tc-shadow-sm), 0 0 20px rgba(59, 130, 246, 0.08); }
.sec-kpi-ok       { box-shadow: var(--tc-shadow-sm), 0 0 20px rgba(34, 197, 94, 0.08); }
.sec-kpi-purple   { box-shadow: var(--tc-shadow-sm), 0 0 20px rgba(167, 139, 250, 0.08); }

/* ============================================================
   CHARTS / PANELS — glass cards
   ============================================================ */

.sec-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.sec-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.sec-panel {
    background: var(--tc-glass-bg);
    backdrop-filter: blur(var(--tc-glass-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur)) saturate(140%);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-md);
    overflow: hidden;
    box-shadow: var(--tc-shadow-sm);
    transition: all 0.2s ease;
}

.sec-panel:hover {
    border: var(--tc-glass-border-hover);
    box-shadow: var(--tc-shadow-md);
}

.sec-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: var(--tc-glass-border-subtle);
}

.sec-panel-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
}

.sec-panel-body {
    padding: 16px;
}

.sec-panel-body-flush {
    padding: 0;
}

/* ============================================================
   DATA TABLE — glass rows with subtle hover glow
   ============================================================ */

.sec-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.sec-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    border-bottom: var(--tc-glass-border);
    background: var(--tc-glass-bg-sidebar);
    backdrop-filter: blur(var(--tc-glass-blur-light));
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-light));
    position: sticky;
    top: 0;
    z-index: 1;
}

.sec-table td {
    padding: 8px 12px;
    border-bottom: var(--tc-glass-border-subtle);
    color: #cbd5e1;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.sec-table tr:hover td {
    background: var(--tc-glass-bg-hover);
    box-shadow: inset 0 0 20px rgba(124, 58, 237, 0.04);
}

.sec-table tr.clickable {
    cursor: pointer;
}

/* ============================================================
   BADGES / PILLS
   ============================================================ */

.sec-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--tc-radius-sm);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    backdrop-filter: blur(var(--tc-glass-blur-light));
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-light));
}

.sec-sev-critical { background: rgba(239, 68, 68, 0.15); color: var(--tc-danger, #ef4444); border: 1px solid rgba(239, 68, 68, 0.3); box-shadow: 0 0 8px rgba(239, 68, 68, 0.1); }
.sec-sev-high     { background: rgba(245, 158, 11, 0.15); color: var(--tc-warning, #f59e0b); border: 1px solid rgba(245, 158, 11, 0.3); box-shadow: 0 0 8px rgba(245, 158, 11, 0.1); }
.sec-sev-med      { background: rgba(59, 130, 246, 0.15); color: var(--tc-primary, #3b82f6); border: 1px solid rgba(59, 130, 246, 0.3); box-shadow: 0 0 8px rgba(59, 130, 246, 0.1); }
.sec-sev-low      { background: rgba(34, 197, 94, 0.15);  color: var(--tc-success, #22c55e); border: 1px solid rgba(34, 197, 94, 0.3); box-shadow: 0 0 8px rgba(34, 197, 94, 0.1); }

.sec-outcome-success { background: rgba(34, 197, 94, 0.15);  color: var(--tc-success, #22c55e); }
.sec-outcome-fail    { background: rgba(239, 68, 68, 0.15);  color: var(--tc-danger, #ef4444); }
.sec-outcome-blocked { background: rgba(245, 158, 11, 0.15); color: var(--tc-warning, #f59e0b); }

.sec-cat-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--tc-radius-sm);
    font-size: 10px;
    font-weight: 600;
    background: var(--tc-glass-bg);
    color: #94a3b8;
}

.sec-status-open         { background: rgba(239, 68, 68, 0.15); color: var(--tc-danger, #ef4444); }
.sec-status-acknowledged { background: rgba(245, 158, 11, 0.15); color: var(--tc-warning, #f59e0b); }
.sec-status-resolved     { background: rgba(34, 197, 94, 0.15); color: var(--tc-success, #22c55e); }
.sec-status-false_positive { background: rgba(100, 116, 139, 0.15); color: #94a3b8; }

/* ============================================================
   FILTERS BAR — glass inputs with focus glow ring
   ============================================================ */

.sec-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.sec-filter-input {
    padding: 6px 10px;
    background: var(--tc-glass-bg-input);
    backdrop-filter: blur(var(--tc-glass-blur-light));
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-light));
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-sm);
    color: #e2e8f0;
    font-size: 12px;
    outline: none;
    min-width: 140px;
    transition: all 0.2s ease;
}

.sec-filter-input:focus {
    border: var(--tc-glass-border-focus);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.sec-filter-select {
    padding: 6px 10px;
    background: var(--tc-glass-bg-input);
    backdrop-filter: blur(var(--tc-glass-blur-light));
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-light));
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-sm);
    color: #e2e8f0;
    font-size: 12px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sec-filter-select:focus {
    border: var(--tc-glass-border-focus);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

/* ============================================================
   TIMELINE BAR CHART (pure CSS)
   ============================================================ */

.sec-timeline-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 120px;
    padding: 8px 0;
}

.sec-timeline-bar {
    flex: 1;
    min-width: 4px;
    border-radius: 3px 3px 0 0;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.sec-timeline-bar:hover {
    opacity: 0.85;
    box-shadow: 0 -4px 12px rgba(255, 255, 255, 0.1);
}

.sec-bar-auth   { background: linear-gradient(180deg, var(--tc-primary, #3b82f6), rgba(59, 130, 246, 0.6)); }
.sec-bar-waf    { background: linear-gradient(180deg, var(--tc-danger, #ef4444), rgba(239, 68, 68, 0.6)); }
.sec-bar-app    { background: linear-gradient(180deg, #a78bfa, rgba(167, 139, 250, 0.6)); }
.sec-bar-admin  { background: linear-gradient(180deg, var(--tc-warning, #f59e0b), rgba(245, 158, 11, 0.6)); }
.sec-bar-system { background: linear-gradient(180deg, var(--tc-success, #22c55e), rgba(34, 197, 94, 0.6)); }
.sec-bar-default { background: linear-gradient(180deg, #475569, rgba(71, 85, 105, 0.6)); }

/* ============================================================
   TOP-N LIST
   ============================================================ */

.sec-topn-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 12px;
    transition: all 0.2s ease;
}

.sec-topn-row:hover {
    background: var(--tc-glass-bg-hover);
    border-radius: var(--tc-radius-sm);
}

.sec-topn-rank {
    width: 20px;
    text-align: center;
    font-weight: 700;
    color: #64748b;
    font-size: 10px;
}

.sec-topn-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #cbd5e1;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.sec-topn-bar-wrap {
    width: 80px;
    height: 6px;
    background: var(--tc-glass-bg-input);
    border-radius: 3px;
    overflow: hidden;
}

.sec-topn-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #7c3aed, var(--tc-primary, #3b82f6));
    transition: width 0.3s ease;
}

.sec-topn-count {
    width: 50px;
    text-align: right;
    font-weight: 600;
    color: #94a3b8;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
}

/* ============================================================
   ENTITY PANE (slide-in detail) — glass elevated with heavy blur
   ============================================================ */

.sec-entity-pane {
    position: fixed;
    top: 0;
    right: 0;
    width: 480px;
    height: 100vh;
    background: #0f172a;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-left: var(--tc-glass-border-hover);
    z-index: 200;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
    box-shadow: var(--tc-shadow-2xl);
}

.sec-entity-pane.open {
    transform: translateX(0);
}

.sec-entity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: var(--tc-glass-border-subtle);
}

.sec-entity-title {
    font-size: 15px;
    font-weight: 700;
    color: #f1f5f9;
}

.sec-entity-close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: all 0.2s ease;
    border-radius: var(--tc-radius-sm);
}

.sec-entity-close:hover {
    color: #e2e8f0;
    background: var(--tc-glass-bg-hover);
}

.sec-entity-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.sec-entity-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}

.sec-entity-stat {
    background: var(--tc-glass-bg);
    backdrop-filter: blur(var(--tc-glass-blur-light));
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-light));
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-sm);
    padding: 10px 12px;
    transition: all 0.2s ease;
}

.sec-entity-stat:hover {
    background: var(--tc-glass-bg-hover);
    border: var(--tc-glass-border-hover);
}

.sec-entity-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #f1f5f9;
}

.sec-entity-stat-label {
    font-size: 10px;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 600;
}

/* ============================================================
   LOADING / EMPTY STATES
   ============================================================ */

.sec-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #64748b;
    font-size: 13px;
}

.sec-loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--tc-glass-bg-hover);
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: sec-spin 0.6s linear infinite;
    margin-right: 10px;
}

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

.sec-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #475569;
    text-align: center;
}

.sec-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.sec-empty-text {
    font-size: 14px;
    font-weight: 500;
}

/* ============================================================
   SECTION TITLE
   ============================================================ */

.sec-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: var(--tc-glass-border-subtle);
}

/* ============================================================
   SCROLLBAR
   ============================================================ */

.sec-dashboard ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.sec-dashboard ::-webkit-scrollbar-track {
    background: transparent;
}

.sec-dashboard ::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.15);
    border-radius: 3px;
}

.sec-dashboard ::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.25);
}

/* ============================================================
   TABS CONTENT
   ============================================================ */

.sec-tab-content {
    display: none;
}

.sec-tab-content.active {
    display: block;
}

/* ============================================================
   EVENT DETAIL ROW (expandable) — glass surfaces
   ============================================================ */

.sec-event-row {
    cursor: pointer;
}

.sec-event-detail {
    display: none;
    background: var(--tc-glass-bg-sidebar);
    backdrop-filter: blur(var(--tc-glass-blur-light));
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-light));
    padding: 12px 16px;
    border-bottom: var(--tc-glass-border);
}

.sec-event-detail.open {
    display: block;
}

.sec-event-raw {
    background: var(--tc-glass-bg-input);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-sm);
    padding: 10px 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #94a3b8;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ============================================================
   RULE EDITOR — glass form inputs with focus glow
   ============================================================ */

.sec-rule-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.sec-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sec-form-group.full-width {
    grid-column: 1 / -1;
}

.sec-form-label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sec-form-input {
    padding: 8px 10px;
    background: var(--tc-glass-bg-input);
    backdrop-filter: blur(var(--tc-glass-blur-light));
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-light));
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-sm);
    color: #e2e8f0;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
}

.sec-form-input:focus {
    border: var(--tc-glass-border-focus);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

textarea.sec-form-input {
    resize: vertical;
    min-height: 60px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1200px) {
    .sec-grid-2 { grid-template-columns: 1fr; }
    .sec-grid-3 { grid-template-columns: 1fr 1fr; }
    .sec-tree-panel { width: 240px; min-width: 200px; }
}

/* ============================================================
   AD USER DETAIL PANEL (overlay in SIEM context) — glass elevated
   ============================================================ */

.sec-dashboard > .dir-detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 60vw;
    height: 100vh;
    background: #0f172a;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-left: var(--tc-glass-border-hover);
    z-index: 210;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
    box-shadow: var(--tc-shadow-2xl);
    overflow-y: auto;
}

.sec-dashboard > .dir-detail-panel.dir-detail-panel--dialog {
    transform: translateX(0);
    padding: 0 !important;
}

.sec-dashboard > .dir-detail-panel .dir-detail-empty {
    display: none;
}

.sec-dashboard > .dir-detail-panel .up-profile,
.sec-dashboard > .dir-detail-panel .up-header {
    background: #0f172a;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* ============================================================
   MOBILE — iPhone Pro Max (~430px) and all phones
   ============================================================ */

@media (max-width: 768px) {

    /* --- Top bar --- */
    .sec-topbar {
        padding: 0 10px;
        height: 48px;
        gap: 6px;
    }

    .sec-topbar-left { gap: 8px; }

    .sec-logo-icon { width: 28px; height: 28px; font-size: 14px; border-radius: var(--tc-radius-sm); }
    .sec-logo-text span:first-child { font-size: 13px; }
    .sec-logo-sub { font-size: 8px; }

    .sec-topbar-right { gap: 6px; }
    .sec-topbar-right .sec-btn { padding: 4px 8px; font-size: 11px; }
    .sec-topbar-user { display: none; }
    .sec-status-dot { width: 6px; height: 6px; }

    /* --- Tree panel: hidden by default, overlay when toggled --- */
    .sec-tree-panel {
        position: fixed;
        top: 48px;
        left: 0;
        width: 85vw;
        max-width: 320px;
        height: calc(100vh - 48px);
        z-index: 150;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: var(--tc-shadow-2xl);
        min-width: 0;
    }

    .sec-tree-panel.collapsed {
        transform: translateX(-100%);
    }

    .sec-tree-panel:not(.collapsed) {
        transform: translateX(0);
    }

    /* --- Body: full-width main --- */
    .sec-body { flex-direction: column; }

    .sec-main { width: 100%; }

    /* --- Nav tabs: compact wrapping grid --- */
    .sec-nav {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 3px;
        padding: 6px 8px;
        border-bottom: none;
    }
    .sec-nav-tab {
        padding: 8px 4px;
        font-size: 0.68rem;
        white-space: nowrap;
        text-align: center;
        border-bottom: 2px solid transparent;
        border-radius: var(--tc-radius-sm);
    }
    .sec-nav-tab.active {
        border-bottom: 2px solid #7c3aed;
        background: rgba(124, 58, 237, 0.15);
    }
    .sec-nav-badge { min-width: 14px; height: 14px; font-size: 8px; padding: 0 3px; }

    /* --- Content area --- */
    .sec-content { padding: 10px; }

    /* --- KPI cards: 2-column grid --- */
    .sec-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-bottom: 12px;
    }
    .sec-kpi { padding: 10px 12px; }
    .sec-kpi-value { font-size: 22px; }
    .sec-kpi-label { font-size: 9px; }

    /* --- Grids collapse to single column --- */
    .sec-grid-2,
    .sec-grid-3 { grid-template-columns: 1fr; gap: 10px; margin-bottom: 12px; }

    /* --- Panels --- */
    .sec-panel-header { padding: 8px 12px; }
    .sec-panel-title { font-size: 11px; }
    .sec-panel-body { padding: 10px 12px; }

    /* --- Timeline bars --- */
    .sec-timeline-bars { height: 80px; }

    /* --- Top-N rows --- */
    .sec-topn-bar-wrap { width: 50px; }
    .sec-topn-count { width: 40px; font-size: 10px; }
    .sec-topn-label { font-size: 11px; }

    /* --- Data tables: horizontal scroll --- */
    .sec-panel { overflow: visible; }
    .sec-table { font-size: 11px; }
    .sec-table th, .sec-table td { padding: 6px 8px; max-width: 160px; }
    .sec-panel-body-flush { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* --- Badges --- */
    .sec-badge { font-size: 9px; padding: 2px 6px; }

    /* --- Filters bar --- */
    .sec-filters { gap: 6px; }
    .sec-filter-input { min-width: 100px; font-size: 12px; }
    .sec-filter-select { font-size: 12px; }

    /* --- Entity pane: full-width overlay --- */
    .sec-entity-pane { width: 100%; }
    .sec-entity-header { padding: 12px 14px; }
    .sec-entity-body { padding: 12px 14px; }
    .sec-entity-stat-value { font-size: 18px; }

    /* --- AD detail panel: full-width overlay --- */
    .sec-dashboard > .dir-detail-panel { width: 100%; }

    /* --- Rule form: single column --- */
    .sec-rule-form { grid-template-columns: 1fr; }

    /* --- Buttons --- */
    .sec-btn-sm { padding: 4px 8px; font-size: 10px; }

    /* --- Loading / empty states --- */
    .sec-loading, .sec-empty { padding: 30px 12px; }
    .sec-empty-icon { font-size: 36px; }

    /* --- Section titles --- */
    .sec-section-title { font-size: 10px; margin-bottom: 8px; }

    /* --- Severity distribution cards (overview) --- */
    .sec-kpi-grid + .sec-grid-2 .sec-panel { margin-bottom: 0; }
}

/* Extra-small phones (under 380px) */
@media (max-width: 380px) {
    .sec-kpi-grid { grid-template-columns: 1fr; }
    .sec-kpi-value { font-size: 20px; }
    .sec-topbar-right .sec-btn:not(:first-child):not(:last-child) { display: none; }
    .sec-nav-tab { font-size: 0.6rem; padding: 6px 2px; }
}

/* Touch optimization */
@media (hover: none) and (pointer: coarse) {
    .sec-btn, .sec-nav-tab { min-height: 40px; }
    .sec-filter-input, .sec-filter-select { font-size: 16px; min-height: 40px; }
    .sec-table th, .sec-table td { padding: 8px 10px; }
}

/* Safe area insets */
@supports (padding: max(0px)) {
    .sec-topbar {
        padding-top: max(0px, env(safe-area-inset-top));
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
    }
    .sec-content {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
}
