/* ===================================
   IMS Design System
   =================================== */

/* CSS Custom Properties */
:root {
    /* Colors - Dark Theme (default) */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a24;
    --bg-glass: rgba(26, 26, 36, 0.8);

    /* Liquid Glass */
    --glass-blur: 24px;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-bg-hover: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-hover: rgba(255, 255, 255, 0.15);
    --glass-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    --glass-inset: inset 0 1px 0 rgba(255, 255, 255, 0.05);

    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    --border-color: rgba(255, 255, 255, 0.1);
    --border-focus: rgba(99, 102, 241, 0.5);

    /* Status Colors (User-facing: 3 statuses) */
    --status-triggered: #ef4444;
    --status-triggered-glow: rgba(239, 68, 68, 0.3);
    --status-acknowledged: #eab308;
    --status-acknowledged-glow: rgba(234, 179, 8, 0.3);
    --status-resolved: #22c55e;
    --status-resolved-glow: rgba(34, 197, 94, 0.3);

    /* Severity Colors */
    --severity-critical: #dc2626;
    --severity-warning: #d97706;
    --severity-info: #3b82f6;

    /* Accent */
    --accent-primary: #6366f1;
    --accent-hover: #818cf8;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;

    /* Layout */
    --sidebar-width: 240px;
    --header-height: 64px;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #e8eaed;
    --bg-secondary: #f0f2f5;
    --bg-tertiary: #d8dce3;
    --bg-glass: rgba(255, 255, 255, 0.6);

    --glass-bg: rgba(255, 255, 255, 0.4);
    --glass-bg-hover: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-border-hover: rgba(255, 255, 255, 0.7);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --glass-inset: inset 0 1px 0 rgba(255, 255, 255, 0.9);

    --text-primary: #1a1a2e;
    --text-secondary: #4a4a68;
    --text-muted: #7a7a8e;

    --border-color: rgba(0, 0, 0, 0.08);
    --border-focus: rgba(120, 100, 160, 0.4);

    /* Softer accent for light theme - more glass-like */
    --accent-primary: #8b7db8;
    --accent-hover: #a091c8;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.12);

    /* More saturated status colors for light theme */
    --status-triggered: #dc2626;
    --status-triggered-glow: rgba(220, 38, 38, 0.25);
    --status-acknowledged: #ca8a04;
    --status-acknowledged-glow: rgba(202, 138, 4, 0.25);
    --status-resolved: #16a34a;
    --status-resolved-glow: rgba(22, 163, 74, 0.25);
}

/* Theme Toggle Icons */
.theme-icon-light {
    display: none;
}

.theme-icon-dark {
    display: block;
}

[data-theme="light"] .theme-icon-light {
    display: block;
}

[data-theme="light"] .theme-icon-dark {
    display: none;
}

/* Light theme background blobs - more vibrant */
[data-theme="light"] body::before {
    background:
        radial-gradient(ellipse 600px 400px at 20% 30%, rgba(99, 102, 241, 0.25) 0%, transparent 60%),
        radial-gradient(ellipse 500px 350px at 80% 20%, rgba(236, 72, 153, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse 400px 300px at 70% 70%, rgba(34, 197, 94, 0.18) 0%, transparent 50%),
        radial-gradient(ellipse 450px 350px at 30% 80%, rgba(234, 179, 8, 0.15) 0%, transparent 50%);
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    position: relative;
}

/* Liquid Glass Background - Color blobs */
/* NOTE: Animation disabled for performance. Static gradient is GPU-friendly. */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 600px 400px at 20% 30%, rgba(99, 102, 241, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse 500px 350px at 80% 20%, rgba(236, 72, 153, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse 400px 300px at 70% 70%, rgba(34, 197, 94, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse 450px 350px at 30% 80%, rgba(234, 179, 8, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
    will-change: transform;
    /* Hint to browser to promote to layer */
}

/* Uncomment to enable subtle animation (uses more GPU):
@keyframes blobMove {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-20px, 10px) scale(1.02); }
    100% { transform: translate(10px, -15px) scale(0.98); }
}
*/

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
    body::before {
        animation: none !important;
    }

    .alert-group-card,
    .stat-card,
    .user-card,
    .btn,
    .modal {
        transition: none !important;
    }
}

/* ===================================
   Layout
   =================================== */

.app {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.logo-icon {
    width: 24px;
    height: 24px;
    color: var(--status-triggered);
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.icon {
    width: 18px;
    height: 18px;
}

.empty-icon {
    width: 64px;
    height: 64px;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-md);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    margin-bottom: var(--space-xs);
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-primary);
    color: var(--text-primary);
}

.sidebar-footer {
    padding: var(--space-md);
    border-top: 1px solid var(--border-color);
}

.refresh-status {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.refresh-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-resolved);
    animation: pulse 2s infinite;
    will-change: opacity;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: var(--space-xl);
    min-height: 100vh;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
}

.header-actions {
    display: flex;
    gap: var(--space-sm);
}

/* ===================================
   Buttons
   =================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn:hover:not(:disabled) {
    background: var(--bg-glass);
    border-color: var(--border-focus);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-secondary {
    background: transparent;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
}

.btn-danger {
    background: var(--status-new);
    border-color: var(--status-new);
}

.btn-success {
    background: var(--status-resolved);
    border-color: var(--status-resolved);
}

/* ===================================
   Filters
   =================================== */

.filters-bar {
    margin-bottom: var(--space-lg);
}

.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.filter-tab {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-tab:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.filter-tab.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.status-triggered {
    background: var(--status-triggered);
}

.status-dot.status-acknowledged {
    background: var(--status-acknowledged);
}

.status-dot.status-resolved {
    background: var(--status-resolved);
}

/* ===================================
   Stats Cards
   =================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--glass-bg);
    /* backdrop-filter disabled for GPU performance */
    /* backdrop-filter: blur(var(--glass-blur)) saturate(180%); */
    /* -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%); */
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
    transition: all var(--transition-base);
    cursor: pointer;
    box-shadow: var(--glass-shadow), var(--glass-inset);
}

.stat-card:hover {
    transform: translateY(-2px);
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), var(--glass-inset);
}

.stat-card.stat-triggered {
    border-left: 3px solid var(--status-triggered);
}

.stat-card.stat-acknowledged {
    border-left: 3px solid var(--status-acknowledged);
}

.stat-card.stat-resolved {
    border-left: 3px solid var(--status-resolved);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.stat-triggered .stat-value {
    color: var(--status-triggered);
}

.stat-acknowledged .stat-value {
    color: var(--status-acknowledged);
}

.stat-resolved .stat-value {
    color: var(--status-resolved);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Stat Card - All */
.stat-card.stat-all {
    border-left: 3px solid var(--accent-primary);
}

.stat-all .stat-value {
    color: var(--accent-primary);
}

/* Stat Card - Active State */
.stat-card.active {
    background: var(--bg-tertiary);
    border-color: var(--border-focus);
    box-shadow: var(--shadow-md);
}

/* ===================================
   Alert Groups Grid
   =================================== */

.alert-groups-container {
    position: relative;
    min-height: 200px;
}

.alert-groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: var(--space-md);
}

/* Alert Group Card */
.alert-group-card {
    background: var(--glass-bg);
    /* backdrop-filter disabled for GPU performance */
    /* backdrop-filter: blur(var(--glass-blur)) saturate(180%); */
    /* -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%); */
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    box-shadow: var(--glass-shadow), var(--glass-inset);
}

.alert-group-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.alert-group-card.status-triggered::before {
    background: var(--status-triggered);
}

.alert-group-card.status-acknowledged::before {
    background: var(--status-acknowledged);
}

.alert-group-card.status-resolved::before {
    background: var(--status-resolved);
}

.alert-group-card:hover {
    /* Simplified hover - no transform for GPU performance */
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
}

.alert-group-card.status-triggered:hover {
    border-color: var(--status-triggered);
}

.alert-group-card.status-acknowledged:hover {
    border-color: var(--status-acknowledged);
}

.alert-group-card-header {
    margin-bottom: var(--space-sm);
}

.alert-group-title {
    font-size: 1rem;
    font-weight: 600;
    word-break: break-word;
    line-height: 1.4;
}

.alert-group-badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
    justify-content: flex-end;
}

.alert-group-status-badge,
.alert-group-severity-badge {
    display: inline-flex;
    gap: var(--space-xs);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-status {
    background: var(--bg-tertiary);
}

.badge-status.status-triggered {
    background: var(--status-triggered-glow);
    color: var(--status-triggered);
}

.badge-status.status-acknowledged {
    background: var(--status-acknowledged-glow);
    color: var(--status-acknowledged);
}

.badge-status.status-resolved {
    background: var(--status-resolved-glow);
    color: var(--status-resolved);
}

.badge-status.status-firing {
    background: var(--status-triggered-glow);
    color: var(--status-triggered);
}

.badge-severity {
    border: 1px solid;
}

.badge-severity.severity-critical {
    border-color: var(--severity-critical);
    color: var(--severity-critical);
}

.badge-severity.severity-warning {
    border-color: var(--severity-warning);
    color: var(--severity-warning);
}

.badge-severity.severity-info {
    border-color: var(--severity-info);
    color: var(--severity-info);
}

.alert-group-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.alert-group-meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.alert-group-meta-label {
    color: var(--text-muted);
}

.alert-group-alerts-count {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* ===================================
   View Toggle
   =================================== */

.view-toggle {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
}

.view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.view-btn:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.view-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

/* ===================================
   List View Header
   =================================== */

.list-header {
    display: none;
    /* Hidden by default (grid view) */
    grid-template-columns: 1fr 100px 80px 100px 180px 100px 100px;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-lg);
    padding-left: calc(var(--space-lg) + 4px);
    /* Account for left border */
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.list-header-col:nth-child(7) {
    text-align: right;
}

/* Show header when list view is active */
.alert-groups-grid.view-list~.list-header,
.alert-groups-container:has(.alert-groups-grid.view-list) .list-header {
    display: grid;
}

/* ===================================
   List View Mode
   =================================== */

.alert-groups-grid.view-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.alert-groups-grid.view-list .alert-group-card {
    display: grid;
    grid-template-columns: 1fr 100px 80px 100px 180px 100px 100px;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-lg);
}

.list-header-col[data-sort] {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 18px;
    /* space for arrow */
}

.list-header-col[data-sort]:hover {
    color: var(--text-primary);
}

.list-header-col[data-sort]::after {
    content: '';
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    opacity: 0.3;
}

.list-header-col[data-sort].asc::after {
    border-bottom: 5px solid currentColor;
    opacity: 1;
}

.list-header-col[data-sort].desc::after {
    border-top: 5px solid currentColor;
    opacity: 1;
}

.alert-groups-grid.view-list .alert-group-card::before {
    height: 100%;
    width: 4px;
    position: absolute;
    left: 0;
    top: 0;
}

.alert-groups-grid.view-list .alert-group-card-header {
    display: contents;
}

.alert-groups-grid.view-list .alert-group-title {
    margin-right: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.alert-groups-grid.view-list .alert-group-badges {
    display: contents;
}

.alert-groups-grid.view-list .alert-group-status-badge,
.alert-groups-grid.view-list .alert-group-severity-badge {
    display: flex;
    gap: var(--space-xs);
    justify-content: flex-start;
    margin-bottom: 0;
}

.alert-groups-grid.view-list .alert-group-meta {
    display: contents;
}

.alert-groups-grid.view-list .alert-group-meta-item {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.alert-groups-grid.view-list .alert-group-meta-label {
    display: none;
}

.alert-groups-grid.view-list .alert-group-alerts-count {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    white-space: nowrap;
    text-align: right;
}

/* ===================================
   Loading & Empty States
   =================================== */

.loading-state,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: var(--space-md);
}

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

.empty-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

/* ===================================
   Pagination
   =================================== */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-color);
}

.page-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ===================================
   Modal
   =================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    /* backdrop-filter: blur(4px); - disabled for GPU performance */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(20px);
    transition: all var(--transition-base);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-lg);
    border-top: 1px solid var(--border-color);
}

/* Modal Content */
.detail-section {
    margin-bottom: var(--space-lg);
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: var(--space-sm);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.detail-item {
    background: var(--bg-tertiary);
    padding: var(--space-md);
    border-radius: var(--radius-md);
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.detail-value {
    font-size: 0.9375rem;
    word-break: break-word;
}

/* Alerts List */
.alerts-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.alert-item {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    border-left: 3px solid var(--status-new);
}

.alert-item.status-resolved {
    border-left-color: var(--status-resolved);
}

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.alert-name {
    font-weight: 600;
}

.alert-labels {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
}

.label-tag {
    display: inline-flex;
    padding: 2px 6px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-family: monospace;
    color: var(--text-secondary);
}

.alert-annotation {
    margin-top: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* ===================================
   Toast Notifications
   =================================== */

.toast-container {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: slideIn var(--transition-base) ease;
}

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

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 3px solid var(--status-resolved);
}

.toast.error {
    border-left: 3px solid var(--status-new);
}

.toast.info {
    border-left: 3px solid var(--severity-info);
}

/* ===================================
   Responsive
   =================================== */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-base);
    }

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

    .main-content {
        margin-left: 0;
        padding: var(--space-md);
    }

    .alert-groups-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

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

/* ===================================
   Teams Navigation
   =================================== */

.nav-divider {
    height: 1px;
    background: var(--border-color);
    margin: var(--space-md) 0;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-xs);
}

/* Nav Section Header - with action button */
.nav-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-xs);
}

.nav-section-header .nav-section-title {
    padding: 0;
    margin-bottom: 0;
}

/* Subtle button - for sidebar actions */
.btn-subtle {
    opacity: 0.4;
    transition: opacity var(--transition-fast), background var(--transition-fast);
    background: transparent;
    border: none;
    width: 24px;
    height: 24px;
    padding: 0;
}

.btn-subtle:hover {
    opacity: 1;
    background: var(--bg-tertiary);
}

.icon-small {
    width: 14px;
    height: 14px;
}

/* Small modal */
.modal.modal-sm {
    max-width: 400px;
}

/* Form hints */
.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Optional label */
.optional {
    font-weight: 400;
    color: var(--text-muted);
}

/* Clickable section link */
.nav-section-link {
    text-decoration: none;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.nav-section-link:hover .nav-section-title {
    color: var(--text-primary);
}

.nav-team .nav-icon {
    font-size: 0.875rem;
}

/* ===================================
   Team Cards (Teams View)
   =================================== */

.team-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--glass-shadow), var(--glass-inset);
}

.team-card:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.team-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.team-avatar {
    width: 48px;
    height: 48px;
    background: var(--accent-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.team-avatar svg {
    width: 24px;
    height: 24px;
    color: var(--text-primary);
}

.team-info {
    flex: 1;
    min-width: 0;
}

.team-card-name {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 var(--space-xs) 0;
    color: var(--text-primary);
}

.team-id {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
}

.team-card-stats {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    border-top: 1px solid var(--border-color);
    margin-top: var(--space-sm);
}

.stat-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.stat-badge.badge-triggered {
    background: var(--status-triggered-glow);
    color: var(--status-triggered);
}

.stat-badge.badge-acknowledged {
    background: var(--status-acknowledged-glow);
    color: var(--status-acknowledged);
}

.stat-badge.badge-resolved {
    background: var(--status-resolved-glow);
    color: var(--status-resolved);
}

.stat-badge.badge-total {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.team-slack {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.team-slack svg {
    width: 14px;
    height: 14px;
}

.team-slack-empty {
    opacity: 0.5;
    font-style: italic;
}

.team-card-actions {
    display: flex;
    gap: var(--space-sm);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
    margin-top: var(--space-sm);
}

.team-card-actions .btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8125rem;
}

.team-card-actions .btn-sm svg {
    width: 14px;
    height: 14px;
}

/* Teams Section Header */
.teams-section {
    margin-bottom: var(--space-xl);
    padding: var(--space-lg);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.section-header {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.section-title .section-icon {
    width: 24px;
    height: 24px;
    color: var(--text-secondary);
}

.section-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.team-stats {
    margin-top: var(--space-md);
    display: flex;
    gap: var(--space-lg);
}

/* ===================================
   Timeline Component
   =================================== */

.timeline-section {
    margin-top: var(--space-lg);
}

.timeline-container {
    max-height: 400px;
    overflow-y: auto;
    padding-right: var(--space-sm);
}

.timeline-container::-webkit-scrollbar {
    width: 6px;
}

.timeline-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.timeline-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.timeline-empty {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-muted);
    font-style: italic;
}

.timeline {
    position: relative;
    padding-left: var(--space-xl);
}

.timeline::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-event {
    position: relative;
    display: flex;
    gap: var(--space-md);
    padding-bottom: var(--space-md);
    margin-bottom: var(--space-sm);
}

.timeline-event:last-child {
    padding-bottom: 0;
    margin-bottom: 0;
}

.timeline-icon {
    position: absolute;
    left: calc(-1 * var(--space-xl) + 2px);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 50%;
    font-size: 0.875rem;
    z-index: 1;
}

.timeline-content {
    flex: 1;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
}

.timeline-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.timeline-message {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.timeline-actor {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}

/* Timeline Event Type Variations */
.timeline-event.type-created .timeline-icon {
    background: var(--accent-primary);
}

.timeline-event.type-alert_added .timeline-icon {
    background: var(--status-triggered);
}

.timeline-event.type-alert_resolved .timeline-icon {
    background: var(--status-resolved);
}

.timeline-event.type-acknowledged .timeline-icon {
    background: var(--status-acknowledged);
}

.timeline-event.type-resolved .timeline-icon {
    background: var(--status-resolved);
}

.timeline-event.type-notification_sent .timeline-icon {
    background: var(--accent-primary);
}

.timeline-event.type-notification_failed .timeline-icon {
    background: var(--severity-critical);
}

.timeline-event.type-note .timeline-icon {
    background: var(--severity-info);
}

.loading-spinner {
    text-align: center;
    padding: var(--space-lg);
    color: var(--text-muted);
}

/* ===================================
   On-Call Badge
   =================================== */

.on-call-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    font-size: 0.875rem;
}

.on-call-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.on-call-icon {
    width: 16px;
    height: 16px;
    color: var(--status-resolved);
}

.on-call-label {
    color: var(--text-muted);
}

.on-call-name {
    font-weight: 600;
    color: var(--text-primary);
}

.manage-team-link {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--accent-primary);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: color var(--transition-fast);
}

.manage-team-link:hover {
    color: var(--accent-hover);
}

.manage-team-link svg {
    width: 14px;
    height: 14px;
}

/* ===================================
   Users Section
   =================================== */

.users-section {
    padding: 0;
}

.users-section .section-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.users-section .section-title {
    margin: 0;
}

.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-md);
}

.users-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

/* ===================================
   User Card
   =================================== */

.user-card {
    background: var(--bg-glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all var(--transition-base);
    /* backdrop-filter: blur(var(--glass-blur)); - disabled for GPU performance */
}

.user-card:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    box-shadow: var(--shadow-md);
}

.user-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.user-avatar {
    width: 48px;
    height: 48px;
    background: var(--accent-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-avatar svg {
    width: 24px;
    height: 24px;
    color: var(--text-primary);
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 var(--space-xs) 0;
    color: var(--text-primary);
}

.user-email {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    word-break: break-word;
}

.user-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.user-meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.user-meta-item svg {
    width: 14px;
    height: 14px;
}

.user-slack {
    color: var(--status-resolved);
}

.user-card-actions {
    display: flex;
    gap: var(--space-sm);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
}

.user-card-actions .btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8125rem;
}

.user-card-actions .btn-sm svg {
    width: 14px;
    height: 14px;
}

/* ===================================
   Team Management Modal
   =================================== */

.team-modal-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.team-modal-section {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.team-modal-section-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 var(--space-md) 0;
}

.team-modal-section-title svg {
    width: 16px;
    height: 16px;
}

.team-members-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.team-member-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.team-member-info {
    flex: 1;
    min-width: 0;
}

.team-member-name {
    font-weight: 600;
    display: block;
}

.team-member-email {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.team-member-role {
    flex-shrink: 0;
}

.role-select {
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8125rem;
    cursor: pointer;
}

.role-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.add-member-form {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.form-select {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.empty-hint {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-muted);
    font-size: 0.875rem;
    font-style: italic;
}

.empty-hint svg {
    width: 16px;
    height: 16px;
}

/* ===================================
   User Form Modal
   =================================== */

.user-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
    transition: border-color var(--transition-fast);
    width: 100%;
    box-sizing: border-box;
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input[readonly] {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
}

/* ===================================
   Responsive - Users
   =================================== */

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

    .add-member-form {
        flex-direction: column;
    }

    .add-member-form .form-select,
    .add-member-form .btn {
        width: 100%;
    }
}