:root {
    --font-primary: 'Outfit', sans-serif;
    
    /* Professional Dark Monitoring Palette */
    --bg-app: #0f1117;
    --bg-sidebar: #141620;
    --bg-card: #1a1d2e;
    --bg-card-hover: #22253a;
    --bg-input: #141724;
    --border-card: #2a2d3e;
    --border-focus: #22d3ee;
    
    --text-primary: #e8eaed;
    --text-secondary: #9aa0b0;
    --text-muted: #5f6577;
    
    --bg-chat-bot: #1e2133;
    --bg-topology: #12141f;
    --bg-thead: #12141f;
    
    /* Single accent — teal */
    --accent: #22d3ee;
    --accent-dim: rgba(34, 211, 238, 0.12);
    --accent-text: #22d3ee;
    
    /* Status colors */
    --green: #34d399;
    --green-dim: rgba(52, 211, 153, 0.12);
    --red: #f87171;
    --red-dim: rgba(248, 113, 113, 0.12);
    --amber: #fbbf24;
    --amber-dim: rgba(251, 191, 36, 0.12);
    --blue: #60a5fa;
    --blue-dim: rgba(96, 165, 250, 0.12);
    --purple: #a78bfa;
    --purple-dim: rgba(167, 139, 250, 0.12);
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --transition: all 0.2s ease;
    
    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-sm: 4px;
}

body.light-theme {
    --bg-app: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-input: #f1f5f9;
    --border-card: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --bg-chat-bot: #f1f5f9;
    --bg-topology: #f1f5f9;
    --bg-thead: #f1f5f9;
    --accent: #0284c7;
    --accent-dim: rgba(2, 132, 199, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: #2a2d3e transparent;
}

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-primary);
    overflow-x: hidden;
    height: 100vh;
    font-size: 14px;
}

/* ============================================
   LAYOUT
   ============================================ */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-card);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    overflow-y: auto;
    z-index: 100;
}

.close-sidebar-btn {
    display: none;
    position: absolute;
    top: 12px; right: 12px;
    background: none; border: none;
    color: var(--text-muted); font-size: 18px; cursor: pointer;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-card);
}
.logo-icon {
    font-size: 24px;
    color: var(--accent);
}
.logo-text h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.logo-text h1 span {
    color: var(--accent);
}
.logo-text p {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.sidebar-section {
    margin-bottom: 24px;
}
.sidebar-section h2 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar-section h2 i {
    font-size: 12px;
    color: var(--text-muted);
}

.section-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}

/* API Status */
.api-key-box {
    padding: 8px 0;
}
.key-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
}
.status-configured {
    color: var(--green);
    background: var(--green-dim);
}
.status-unconfigured {
    color: var(--amber);
    background: var(--amber-dim);
}

/* Demo Cards */
.demo-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.demo-card {
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}
.demo-card:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}
.demo-card h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.demo-card p {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}
.demo-card.skeleton {
    height: 64px;
    background: var(--bg-card);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-card);
}
.sidebar-footer p {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Top Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.hamburger-btn {
    display: none;
    background: none; border: none;
    color: var(--text-secondary); font-size: 20px; cursor: pointer;
}
.header-welcome h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}
.header-welcome p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}
.header-actions {
    display: flex;
    align-items: center;
}

.active-file-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
}
.active-file-indicator .pulse {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--green);
    display: inline-block;
}

/* ============================================
   UPLOAD AREA
   ============================================ */
.upload-section {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 20px;
}
.upload-card {
    text-align: center;
    padding: 48px;
    border: 2px dashed var(--border-card);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    max-width: 520px;
    width: 100%;
    transition: var(--transition);
}
.upload-card:hover, .upload-section.dragover .upload-card {
    border-color: var(--accent);
    background: var(--accent-dim);
}
.upload-icon {
    font-size: 36px;
    color: var(--accent);
    margin-bottom: 16px;
}
.upload-card h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.upload-card p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}
.upload-card code {
    padding: 2px 6px;
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: 3px;
    font-size: 12px;
}
.upload-note {
    font-size: 11px !important;
    color: var(--text-muted) !important;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--accent);
    color: #0f1117;
    font-weight: 600;
    font-size: 13px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-primary);
}
.btn-primary:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: var(--transition);
    font-family: var(--font-primary);
}
.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.btn-small {
    padding: 5px 10px;
    font-size: 11px;
}

/* ============================================
   LOADING OVERLAY
   ============================================ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,17,23,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
}
.loader-box {
    text-align: center;
    padding: 40px;
}
.loader-icon {
    font-size: 32px;
    color: var(--accent);
    margin-bottom: 16px;
}
.loader-box h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.loader-box p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ============================================
   DASHBOARD GRID
   ============================================ */
.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Metrics Row */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.metric-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
}
.metric-icon {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 16px;
}
.metric-icon.bg-blue { background: var(--blue-dim); color: var(--blue); }
.metric-icon.bg-purple { background: var(--purple-dim); color: var(--purple); }
.metric-icon.bg-green { background: var(--green-dim); color: var(--green); }
.metric-icon.bg-gray { background: var(--green-dim); color: var(--green); }
.metric-icon.bg-red { background: var(--red-dim); color: var(--red); }
.metric-details {
    display: flex;
    flex-direction: column;
}
.metric-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.metric-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Middle Layout */
.middle-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Glass Cards → Clean Cards */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 20px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.card-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-header h3 i {
    color: var(--accent);
    font-size: 14px;
}

/* AI Insight Card */
.ai-insight-card .insight-content {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary);
    max-height: 380px;
    overflow-y: auto;
    padding-right: 8px;
}
.insight-content h1, .insight-content h2, .insight-content h3 {
    color: var(--text-primary);
    margin: 12px 0 6px;
    font-weight: 600;
}
.insight-content h3 { font-size: 14px; }
.insight-content strong { color: var(--text-primary); }
.insight-content code {
    padding: 1px 5px;
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: 3px;
    font-size: 12px;
}
.insight-content ul, .insight-content ol {
    padding-left: 20px;
    margin: 6px 0;
}
.insight-content li {
    margin: 4px 0;
}
.insight-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 8px 12px;
    margin: 8px 0;
    background: var(--accent-dim);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
    font-size: 12px;
}
.insight-content hr {
    border: none;
    border-top: 1px solid var(--border-card);
    margin: 12px 0;
}

/* Visual / Charts Card */
.visual-card h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}
.visual-card h3 i {
    color: var(--accent);
}
.chart-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.topology-box {
    width: 100%;
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-topology);
}
.topology-box canvas {
    width: 100%;
    display: block;
}

.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.chart-box h4 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

/* Bar Charts */
.protocol-bar-chart, .app-bar-chart {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}
.bar-label {
    width: 65px;
    text-align: right;
    color: var(--text-secondary);
    font-size: 11px;
    flex-shrink: 0;
}
.bar-track {
    flex: 1;
    height: 6px;
    background: var(--bg-card-hover);
    border-radius: 3px;
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}
.bar-fill.proto-tcp { background: var(--blue); }
.bar-fill.proto-udp { background: var(--purple); }
.bar-fill.proto-other { background: var(--text-muted); }
.bar-fill.app-fill { background: var(--accent); }
.bar-value {
    width: 30px;
    text-align: left;
    color: var(--text-muted);
    font-size: 11px;
    flex-shrink: 0;
}

/* ============================================
   FLOW TABLE
   ============================================ */
.table-card {
    padding: 0;
    overflow: hidden;
}
.card-header-table {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-card);
    flex-wrap: wrap;
    gap: 10px;
}
.card-header-table h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-header-table h3 i {
    color: var(--accent);
}
.table-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.table-search {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
}
.table-search i {
    color: var(--text-muted);
    font-size: 12px;
}
.table-search input {
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 12px;
    outline: none;
    width: 180px;
}
.table-search input::placeholder {
    color: var(--text-muted);
}

/* Filter Pills */
.table-filters {
    display: flex;
    gap: 6px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-card);
    overflow-x: auto;
}
.filter-pill {
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid var(--border-card);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
    font-family: var(--font-primary);
}
.filter-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.filter-pill.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.table-responsive {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
thead {
    background: var(--bg-thead);
}
th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-card);
    white-space: nowrap;
}
td {
    padding: 9px 14px;
    border-bottom: 1px solid #1a1d2a;
    color: var(--text-secondary);
    white-space: nowrap;
}
tr:hover td {
    background: var(--bg-card-hover);
}
tr {
    cursor: pointer;
}

/* Category & Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
}
.badge-safe {
    background: var(--green-dim);
    color: var(--green);
}
.badge-warn {
    background: var(--red-dim);
    color: var(--red);
}
.badge-category {
    background: var(--accent-dim);
    color: var(--accent);
}
.badge-ml {
    background: var(--purple-dim);
    color: var(--purple);
    font-size: 10px;
    margin-left: 4px;
}
.ip-text {
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

/* ============================================
   DPI ENGINE CARD
   ============================================ */
.dpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 20px;
}
.dpi-card h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}
.dpi-card h3 i {
    color: var(--accent);
}
.dpi-rule-builder {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.dpi-rule-builder select,
.dpi-rule-builder input {
    padding: 7px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    font-family: var(--font-primary);
    outline: none;
}
.dpi-rule-builder select:focus,
.dpi-rule-builder input:focus {
    border-color: var(--accent);
}
.dpi-rules-list {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#dpiCollapseArea {
    transition: all 0.3s ease;
}

#dpiCollapseArea.collapsed {
    display: none;
}
.dpi-rule-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary);
}
.dpi-rule-item code {
    font-family: 'Courier New', monospace;
    color: var(--accent);
    font-size: 11px;
}
.dpi-rule-item button {
    background: none;
    border: none;
    color: var(--red);
    cursor: pointer;
    font-size: 12px;
}
.dpi-results {
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
    display: none;
}
.dpi-results .stat-line {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
}
.dpi-results .stat-value {
    font-weight: 600;
    color: var(--text-primary);
}
.dpi-results .stat-dropped {
    color: var(--red);
}
.dpi-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

/* ============================================
   CHAT WIDGET
   ============================================ */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    max-height: 520px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
    z-index: 200;
    overflow: hidden;
}
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-card);
    cursor: pointer;
}
.chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
}
.chat-title i {
    color: var(--accent);
    font-size: 16px;
}
.chat-title h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.chat-title span {
    font-size: 11px;
    color: var(--green);
}
.chat-actions button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
}

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 320px;
}
.chat-message {
    display: flex;
}
.chat-message.user {
    justify-content: flex-end;
}
.message-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}
.chat-message.bot .message-bubble {
    background: var(--bg-chat-bot);
    border: 1px solid var(--border-card);
    color: var(--text-primary);
}
.chat-message.user .message-bubble {
    background: var(--accent-dim);
    border: 1px solid rgba(34,211,238,0.2);
    color: var(--text-primary);
}
/* Markdown inside chat bubbles */
.message-bubble h3 { font-size: 13px; color: var(--text-primary); margin: 6px 0 4px; }
.message-bubble strong { color: var(--text-primary); }
.message-bubble code { 
    padding: 1px 4px; background: var(--accent-dim); 
    color: var(--accent); border-radius: 3px; font-size: 11px; 
}
.message-bubble ul, .message-bubble ol { padding-left: 16px; margin: 4px 0; }
.message-bubble li { margin: 2px 0; }
.message-bubble blockquote {
    border-left: 2px solid var(--accent);
    padding: 4px 8px;
    margin: 4px 0;
    background: var(--accent-dim);
    border-radius: 0 3px 3px 0;
    font-size: 12px;
}
.message-bubble hr {
    border: none; border-top: 1px solid var(--border-card); margin: 6px 0;
}

.chat-suggestions {
    display: flex;
    gap: 6px;
    padding: 8px 16px;
    overflow-x: auto;
    border-top: 1px solid var(--border-card);
}
.chip {
    padding: 4px 10px;
    font-size: 11px;
    border: 1px solid var(--border-card);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    font-family: var(--font-primary);
    transition: var(--transition);
}
.chip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-card);
}
.chat-input-area input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    outline: none;
    font-family: var(--font-primary);
}
.chat-input-area input:focus {
    border-color: var(--accent);
}
.chat-input-area button {
    padding: 8px 14px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: #0f1117;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}
.chat-input-area button:hover {
    opacity: 0.85;
}

/* Chat Trigger */
.chat-trigger {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    color: #0f1117;
    font-size: 18px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.chat-trigger:hover {
    transform: scale(1.05);
}
.chat-trigger .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--red);
    color: white;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* ============================================
   ONBOARDING MODAL
   ============================================ */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,17,23,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 600;
}
.onboarding-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 520px;
    width: 90%;
}
.onboarding-header {
    text-align: center;
    margin-bottom: 24px;
}
.onboarding-wizard-icon {
    font-size: 32px;
    color: var(--accent);
    margin-bottom: 12px;
}
.onboarding-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.onboarding-header p {
    font-size: 13px;
    color: var(--text-secondary);
}
.onboarding-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}
.onboarding-step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.step-num {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background: var(--accent-dim);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}
.step-detail h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}
.step-detail p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.onboarding-dismiss {
    width: 100%;
    text-align: center;
    justify-content: center;
}

/* ============================================
   INSPECTOR DRAWER
   ============================================ */
.inspector-drawer {
    position: fixed;
    top: 0;
    right: -500px;
    width: 460px;
    height: 100vh;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border-card);
    z-index: 300;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    box-shadow: -4px 0 16px rgba(0,0,0,0.4);
}
.inspector-drawer.open {
    right: 0;
}
.dpi-rule-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-input);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-card);
    font-size: 13px;
}
.dpi-rule-item code {
    color: var(--accent);
    margin-right: 8px;
    background: var(--accent-dim);
    padding: 2px 6px;
    border-radius: 4px;
}
.dpi-rule-item button {
    color: var(--text-muted);
}
.dpi-rule-item button:hover {
    color: var(--accent-red);
}
.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-card);
}
.drawer-title {
    display: flex;
    align-items: center;
    gap: 10px;
}
.drawer-title i {
    font-size: 16px;
    color: var(--accent);
}
.drawer-title h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.drawer-title span {
    font-size: 11px;
    color: var(--text-muted);
}
.close-drawer-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
}

.drawer-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-card);
}
.drawer-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-primary);
    transition: var(--transition);
}
.drawer-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
}
.drawer-tab-content {
    display: none;
    padding: 16px;
}
.drawer-tab-content.active {
    display: block;
}

.table-responsive-drawer {
    overflow-x: auto;
}
.drawer-packet-table {
    width: 100%;
    border-collapse: collapse;
}
.drawer-packet-table th {
    background: var(--bg-thead);
    padding: 8px 10px;
    font-size: 10px;
}
.drawer-packet-table td {
    padding: 7px 10px;
    font-size: 11px;
}
.drawer-packet-table tr:hover td {
    background: var(--bg-card-hover);
}
.drawer-packet-table tr.selected td {
    background: var(--accent-dim);
}

.section-desc-drawer {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Hex Viewer */
.hex-viewer {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    background: #0a0c14;
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    padding: 12px;
    overflow-x: auto;
    line-height: 1.6;
}
.hex-empty-state {
    color: var(--text-muted);
    font-family: var(--font-primary);
    font-size: 12px;
    text-align: center;
    padding: 24px;
}
.hex-line {
    display: flex;
    gap: 12px;
    white-space: pre;
}
.hex-offset {
    color: var(--text-muted);
    min-width: 45px;
}
.hex-bytes {
    color: var(--accent);
    min-width: 350px;
}
.hex-ascii {
    color: var(--green);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 700;
}
.toast {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    color: white;
    animation: toast-in 0.3s ease;
    max-width: 320px;
}
.toast.success {
    background: #166534;
    border: 1px solid #22c55e;
}
.toast.error {
    background: #7f1d1d;
    border: 1px solid #ef4444;
}
.toast.info {
    background: #1e3a5f;
    border: 1px solid #3b82f6;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        height: 100vh;
        transition: left 0.3s ease;
        box-shadow: var(--shadow-md);
    }
    .sidebar.open {
        left: 0;
    }
    .close-sidebar-btn {
        display: block;
    }
    .hamburger-btn {
        display: block;
    }
    .middle-layout {
        grid-template-columns: 1fr;
    }
    .metrics-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .chat-widget {
        width: calc(100vw - 32px);
        right: 16px;
    }
    .inspector-drawer {
        width: 100vw;
        right: -100vw;
    }
}

@media (max-width: 640px) {
    .main-content {
        padding: 16px;
    }
    .metrics-row {
        grid-template-columns: 1fr;
    }
    .header-welcome h2 {
        font-size: 16px;
    }
    .charts-row {
        grid-template-columns: 1fr;
    }
    .table-search input {
        width: 120px;
    }
}

/* MODALS */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-card);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-close:hover {
    color: var(--accent-red);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.packet-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.packet-table th, .packet-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-card);
}

.packet-table th {
    background: var(--bg-card);
    position: sticky;
    top: -20px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.85rem;
    z-index: 10;
}

.packet-table tr:hover {
    background: var(--bg-input);
}
