/* ===== ArmoPot Design System ===== */
:root {
    --bg-primary: #f4f6fb;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f0f2f7;
    --text-primary: #1e2a3a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --accent-light: rgba(124, 58, 237, 0.08);
    --accent-medium: rgba(124, 58, 237, 0.15);
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --success: #22c55e;
    --border: #e5e7eb;
    --sidebar-width: 210px;
    --sidebar-collapsed-width: 52px;
    --topbar-height: 44px;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
    --bg-primary: #0f1219;
    --bg-secondary: #181d27;
    --bg-card: #1e2433;
    --bg-input: #252d3d;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #a78bfa;
    --accent-hover: #8b5cf6;
    --accent-light: rgba(167, 139, 250, 0.08);
    --accent-medium: rgba(167, 139, 250, 0.15);
    --border: #2d3748;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.25);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    background: var(--bg-primary);
    color: var(--text-primary);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ===== Top Navbar ===== */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    z-index: 110;
    box-shadow: var(--shadow);
}

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

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
}

.topbar-brand-logo {
    width: 28px;
    height: 28px;
}

.topbar-brand-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.3px;
}

.topbar-separator {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 2px;
}

.btn-sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 15px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    line-height: 1;
}
.btn-sidebar-toggle:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.btn-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
}

.page-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.topbar-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.tier-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: fit-content;
}

.tier-free { background: rgba(148, 163, 184, 0.15); color: var(--text-secondary); }
.tier-bronze { background: rgba(205, 127, 50, 0.12); color: #b87333; }
.tier-silver { background: rgba(148, 163, 184, 0.15); color: #8093a8; }
.tier-gold { background: rgba(245, 158, 11, 0.12); color: #d97706; }

.btn-theme {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    transition: all 0.15s ease;
}
.btn-theme:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-logout {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s ease;
    line-height: 1;
}
.btn-logout:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(239, 68, 68, 0.05);
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--topbar-height));
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width 0.2s ease;
    overflow: hidden;
}

.sidebar-nav {
    list-style: none;
    flex: 1;
    padding: 6px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav li {
    margin: 1px 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
}

.nav-link:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.nav-link.active {
    background: var(--accent-medium);
    color: var(--accent);
    font-weight: 600;
}

.nav-icon {
    font-size: 13px;
    width: 20px;
    min-width: 20px;
    text-align: center;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-text {
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.2s ease;
}

/* ===== Sidebar Section Dividers ===== */
.nav-section {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 10px 10px 3px 10px;
    list-style: none;
    user-select: none;
    margin: 0 !important;
    white-space: nowrap;
    overflow: hidden;
}

.nav-section:first-child {
    padding-top: 4px;
}

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 14px !important;
    list-style: none;
}

/* ===== Sidebar Collapsed State ===== */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-section-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .nav-section {
    padding: 8px 0;
    text-align: center;
    font-size: 0;
    height: 4px;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 6px 0;
    gap: 0;
    position: relative;
}

.sidebar.collapsed .nav-icon {
    width: auto;
    min-width: auto;
    font-size: 14px;
}

.sidebar.collapsed .nav-link[title]:hover::after {
    content: attr(title);
    position: absolute;
    left: calc(var(--sidebar-collapsed-width) + 8px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    z-index: 200;
    box-shadow: var(--shadow-md);
}

/* ===== Sidebar Scrollbar ===== */
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--topbar-height);
    background: rgba(0, 0, 0, 0.3);
    z-index: 99;
}

/* ===== Main Content ===== */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    min-height: calc(100vh - var(--topbar-height));
    transition: margin-left 0.2s ease;
}

body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

.content-area {
    padding: 16px;
}

/* ===== Auth Layout ===== */
.auth-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header-actions {
    display: flex;
    gap: 6px;
}

/* ===== Stat Cards ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    margin-top: 2px;
    color: var(--text-primary);
}

.stat-change {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ===== Tables ===== */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-input);
}

tr:hover {
    background: var(--accent-light);
}

td {
    font-size: 12px;
}

td.mono {
    font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-size: 11px;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 12px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 6px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.15);
}

.btn-sm {
    padding: 3px 8px;
    font-size: 11px;
}

.btn-icon {
    padding: 4px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
}

.btn-group {
    display: flex;
    gap: 4px;
}

/* ===== Severity Badges ===== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-critical { background: rgba(239, 68, 68, 0.12); color: var(--danger); }
.badge-high { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.badge-medium { background: rgba(59, 130, 246, 0.12); color: var(--info); }
.badge-low { background: rgba(34, 197, 94, 0.12); color: var(--success); }
.badge-info { background: rgba(148, 163, 184, 0.12); color: var(--text-secondary); }

/* Protocol Badges */
.badge-protocol {
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
}

.badge-ssh { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.badge-telnet { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.badge-rdp { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.badge-http, .badge-https { background: rgba(34, 197, 94, 0.1); color: #22c55e; }
.badge-smb { background: rgba(168, 85, 247, 0.1); color: #a855f7; }
.badge-ftp { background: rgba(236, 72, 153, 0.1); color: #ec4899; }
.badge-mqtt { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.badge-modbus { background: rgba(239, 68, 68, 0.1); color: #dc2626; }
.badge-s7comm { background: rgba(124, 58, 237, 0.1); color: #7c3aed; }
.badge-dnp3 { background: rgba(236, 72, 153, 0.1); color: #ec4899; }
.badge-bacnet { background: rgba(99, 102, 241, 0.1); color: #6366f1; }
.badge-sip { background: rgba(168, 85, 247, 0.1); color: #a855f7; }
.badge-coap { background: rgba(6, 182, 212, 0.1); color: #06b6d4; }

/* ===== Status Indicators ===== */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-active, .status-dot.active { background: var(--success); }
.status-inactive, .status-dot.inactive { background: var(--text-muted); }
.status-pending, .status-dot.warning { background: var(--warning); }
.status-error, .status-dot.error { background: var(--danger); }

.status-text {
    display: inline-flex;
    align-items: center;
    font-size: 13px;
}

/* ===== Login Form ===== */
.login-card {
    width: 100%;
    max-width: 380px;
    padding: 32px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.login-title {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 4px;
    color: var(--accent);
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 14px;
}

/* ===== Validation & Alerts ===== */
.validation-message {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.alert-success {
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.alert-info {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: var(--info);
}

/* ===== Grid Layouts ===== */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* ===== Map ===== */
#attack-map {
    width: 100%;
    height: 400px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.map-filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.map-filter-bar .form-select,
.map-filter-bar .form-input {
    width: auto;
    min-width: 120px;
    padding: 6px 10px;
    font-size: 12px;
}

/* ===== Charts ===== */
.chart-container {
    position: relative;
    width: 100%;
}

.chart-canvas {
    width: 100%;
    display: block;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.chart-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.pagination-info {
    font-size: 11px;
    color: var(--text-secondary);
}

.pagination-controls {
    display: flex;
    gap: 4px;
}

.pagination-controls a,
.pagination-controls span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s ease;
}

.pagination-controls a:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.pagination-controls .active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    font-weight: 600;
}

.pagination-controls .disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ===== Filter Panel ===== */
.filter-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.filter-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-row .form-group {
    margin-bottom: 0;
    min-width: 140px;
}

.filter-row .form-group.flex-grow {
    flex: 1;
}

.filter-actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 36px;
    margin-bottom: 8px;
    opacity: 0.4;
}

.empty-state-text {
    font-size: 14px;
    margin-bottom: 4px;
}

.empty-state-hint {
    font-size: 12px;
}

/* ===== Detail Page ===== */
.detail-grid {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 4px 12px;
    font-size: 12px;
}

.detail-label {
    color: var(--text-muted);
    font-weight: 600;
}

.detail-value {
    color: var(--text-primary);
    word-break: break-all;
}

.detail-value.mono {
    font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
}

/* ===== Tabs ===== */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 12px;
    gap: 2px;
}

.tab {
    padding: 6px 14px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s ease;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tab:hover {
    color: var(--text-primary);
    background: var(--accent-light);
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

.tab-content {
    display: none;
}

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

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    top: calc(var(--topbar-height) + 12px);
    right: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    max-width: 380px;
    animation: slideIn 0.3s ease;
    pointer-events: auto;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.toast-critical { border-left: 3px solid var(--danger); }
.toast-high { border-left: 3px solid var(--warning); }
.toast-medium { border-left: 3px solid var(--info); }

.toast-body {
    flex: 1;
}

.toast-title {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 11px;
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    line-height: 1;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

.toast.removing {
    animation: slideOut 0.3s ease forwards;
}

/* ===== Progress Bar ===== */
.progress-bar {
    height: 6px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.3s ease;
}
.progress-bar-fill.danger { background: var(--danger); }
.progress-bar-fill.warning { background: var(--warning); }

/* ===== Config Editor ===== */
.config-editor {
    width: 100%;
    min-height: 200px;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-size: 13px;
    resize: vertical;
}

/* ===== Utility ===== */
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-success { color: var(--success); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-mono { font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', 'Consolas', monospace; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.d-flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }
.hidden { display: none; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .btn-sidebar-toggle {
        display: none;
    }

    .btn-hamburger {
        display: block;
    }

    .topbar-separator {
        display: none;
    }

    .topbar-user-info {
        display: none;
    }

    .sidebar {
        width: var(--sidebar-width) !important;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        width: var(--sidebar-width) !important;
    }

    .sidebar.open .nav-text,
    .sidebar.open .nav-section-text {
        opacity: 1 !important;
        width: auto !important;
    }

    .sidebar.open .nav-link {
        justify-content: flex-start !important;
        padding: 10px 14px !important;
        gap: 10px !important;
    }

    .sidebar.open .nav-section {
        font-size: 10px !important;
        height: auto !important;
        text-align: left !important;
        padding: 16px 14px 6px 14px !important;
    }

    .sidebar.open .sidebar-brand-collapsed {
        display: none !important;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .filter-row {
        flex-direction: column;
    }

    .filter-row .form-group {
        width: 100%;
    }

    .content-area {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .pagination {
        flex-direction: column;
        gap: 12px;
    }
}

/* Stats grid variants */
.stats-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}
@media (max-width: 768px) {
    .stats-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .stats-grid-4 { grid-template-columns: 1fr; }
}

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.page-header h2 { margin: 0; font-size: 1.2rem; }

/* Confidence bar */
.confidence-bar {
    position: relative;
    width: 80px;
    height: 20px;
    background: var(--bg-input);
    border-radius: 10px;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
}
.confidence-fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    border-radius: 10px;
    transition: width 0.3s;
}
.confidence-fill.confidence-high { background: rgba(34, 197, 94, 0.4); }
.confidence-fill.confidence-medium { background: rgba(245, 158, 11, 0.3); }
.confidence-fill.confidence-low { background: rgba(239, 68, 68, 0.3); }
.confidence-text {
    position: relative;
    z-index: 1;
    width: 100%;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    font-family: monospace;
}

/* IOC type badge */
.badge-ioc-type {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
    font-size: 0.7rem;
}

/* Row muted (whitelisted) */
.row-muted { opacity: 0.5; }
.row-muted:hover { opacity: 0.75; }

/* Alert status badges */
.badge-alert-new { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge-alert-acknowledged { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-alert-resolved { background: rgba(34, 197, 94, 0.1); color: var(--success); }

/* Active stat card (clicked filter) */
.stat-card-active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light); }

/* Report grid */
.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.report-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}
.report-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.report-card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}
.report-card-tier {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}
.report-card-actions {
    display: flex;
    gap: 8px;
}

/* ===== Modal Dialog ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(2px);
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.modal-header .modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}
.modal-header .modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 20px; }
.modal-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

/* ===== Chip / Tag ===== */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 11px;
    color: var(--text-secondary);
}
.chip-accent {
    background: var(--accent-light);
    border-color: rgba(124, 58, 237, 0.2);
    color: var(--accent);
}
.chip-danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}
.chip-warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

/* ===== Copy Button ===== */
.btn-copy {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 11px;
    transition: all 0.15s ease;
}
.btn-copy:hover { border-color: var(--accent); color: var(--accent); }
.btn-copy.copied { border-color: var(--success); color: var(--success); }

/* ===== Key Display ===== */
.key-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-size: 13px;
    word-break: break-all;
}

/* ===== Inline Form Card ===== */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.form-card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-group input,
.form-group select,
.form-group textarea {
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* ===== Confirm Dialog ===== */
.confirm-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* ===== Alert Banner ===== */
.alert-banner {
    padding: 14px 18px;
    border-radius: var(--radius);
    border: 1px solid;
    margin-bottom: 16px;
    font-size: 13px;
}
.alert-banner.alert-success {
    background: rgba(34, 197, 94, 0.06);
    border-color: rgba(34, 197, 94, 0.2);
    color: var(--success);
}
.alert-banner.alert-warning {
    background: rgba(245, 158, 11, 0.06);
    border-color: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}
.alert-banner.alert-danger {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}
.alert-banner.alert-info {
    background: rgba(59, 130, 246, 0.06);
    border-color: rgba(59, 130, 246, 0.2);
    color: var(--info);
}

/* ===== Role Badge ===== */
.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.role-badge.role-superadmin { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.role-badge.role-admin { background: rgba(124, 58, 237, 0.1); color: var(--accent); }
.role-badge.role-analyst { background: rgba(59, 130, 246, 0.1); color: var(--info); }
.role-badge.role-viewer { background: rgba(148, 163, 184, 0.1); color: var(--text-secondary); }

/* ===== Table Enhancements ===== */
.data-table tr:hover td {
    background: var(--accent-light);
}
.data-table .row-muted {
    opacity: 0.5;
}
.data-table .mono {
    font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-size: 12px;
}
.data-table .actions-cell {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

/* ===== Responsive Admin Tables ===== */
@media (max-width: 768px) {
    .modal {
        max-width: 95vw;
        max-height: 95vh;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .data-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ===== Deployment Progress Cards ===== */
#activeDeployments {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.deploy-progress-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 16px;
    animation: deploySlideIn 0.3s ease-out;
}

@keyframes deploySlideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.deploy-progress-card.deploy-completed {
    border-left-color: var(--severity-low, #22c55e);
}

.deploy-progress-card.deploy-failed {
    border-left-color: var(--severity-critical, #ef4444);
}

.deploy-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.deploy-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.deploy-type-badge {
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.deploy-target {
    font-size: 13px;
    color: var(--text-primary);
}

.deploy-card-status {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 10px;
}

.deploy-card-status.status-inprogress {
    background: rgba(139, 92, 246, 0.15);
    color: var(--primary);
}

.deploy-card-status.status-completed {
    background: rgba(34, 197, 94, 0.15);
    color: var(--severity-low, #22c55e);
}

.deploy-card-status.status-failed {
    background: rgba(239, 68, 68, 0.15);
    color: var(--severity-critical, #ef4444);
}

/* Step dots */
.deploy-steps {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.deploy-step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.2s, box-shadow 0.2s;
}

.deploy-step-dot.completed {
    background: var(--severity-low, #22c55e);
}

.deploy-step-dot.active {
    background: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.3);
    animation: deployPulse 1.5s ease-in-out infinite;
}

@keyframes deployPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.3); }
    50% { box-shadow: 0 0 0 6px rgba(139, 92, 246, 0.1); }
}

.deploy-step-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Progress bar */
.deploy-progress-bar-container {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.deploy-progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.deploy-completed .deploy-progress-bar {
    background: var(--severity-low, #22c55e);
}

.deploy-failed .deploy-progress-bar {
    background: var(--severity-critical, #ef4444);
}

.deploy-percent {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
    margin-bottom: 8px;
}

/* Log section */
.deploy-log-section {
    margin-top: 8px;
}

.deploy-log-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
}

.deploy-log-toggle:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.deploy-log {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 8px 10px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-secondary);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    white-space: pre-wrap;
    word-break: break-all;
}

.deploy-log.expanded {
    max-height: 400px;
    overflow-y: auto;
}

.deploy-failed .deploy-log {
    border-color: rgba(239, 68, 68, 0.3);
}
