/* HSO Cloud Monitoring - Part 2: Login, Portal, Pages */

/* Login Page */
.login-page { min-height: 100vh; background: #f1f3f5; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.login-container { display: flex; max-width: 1000px; width: 100%; background: #fff; border-radius: 16px; box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08); overflow: hidden; }
.login-card { flex: 1; padding: 3rem; max-width: 480px; }
.login-header { text-align: center; margin-bottom: 2rem; }
.login-header .logo { height: 40px; margin-bottom: 1.5rem; }
.login-header h1 { font-size: 1.5rem; font-weight: 700; color: #002d5c; margin: 0 0 0.5rem 0; }
.login-header p { color: #6c757d; margin: 0; font-size: 0.95rem; }
.login-form { display: flex; flex-direction: column; gap: 1.25rem; }
.error-alert { display: flex; align-items: center; gap: 0.75rem; padding: 1rem; background: #f8d7da; border: 1px solid #f5c2c7; border-radius: 8px; color: #842029; font-size: 0.9rem; }
.error-alert svg { width: 20px; height: 20px; flex-shrink: 0; }
.login-form .form-group label { font-size: 0.875rem; font-weight: 500; color: #495057; }
.input-wrapper { position: relative; display: flex; align-items: center; }
.input-wrapper > svg { position: absolute; left: 1rem; width: 18px; height: 18px; color: #adb5bd; pointer-events: none; }
.input-wrapper input { width: 100%; padding: 0.875rem 1rem 0.875rem 3rem; border: 1px solid #dee2e6; border-radius: 8px; font-size: 0.95rem; }
.input-wrapper input:focus { outline: none; border-color: #002d5c; box-shadow: 0 0 0 3px rgba(0, 45, 92, 0.1); }
.toggle-password { position: absolute; right: 0.75rem; background: none; border: none; padding: 0.25rem; color: #6c757d; display: flex; }
.toggle-password svg { position: static; width: 20px; height: 20px; }
.toggle-password:hover { color: #002d5c; }
.form-options { display: flex; justify-content: space-between; align-items: center; }
.checkbox-wrapper { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.875rem; color: #495057; }
.checkbox-wrapper input[type="checkbox"] { width: 18px; height: 18px; accent-color: #002d5c; }
.forgot-link { font-size: 0.875rem; color: #e85a24; }
.forgot-link:hover { text-decoration: underline; }
.btn-login { padding: 1rem; background: #e85a24; color: #fff; border: none; border-radius: 8px; font-size: 1rem; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.btn-login:hover:not(:disabled) { background: #d14d1a; box-shadow: 0 4px 12px rgba(232, 90, 36, 0.3); }
.btn-login:disabled { opacity: 0.7; cursor: not-allowed; }
.spinner { width: 20px; height: 20px; border: 2px solid rgba(255, 255, 255, 0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.divider { display: flex; align-items: center; gap: 1rem; color: #adb5bd; font-size: 0.85rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: #dee2e6; }
.btn-demo { padding: 0.875rem; background: #fff; color: #002d5c; border: 1px solid #dee2e6; border-radius: 8px; font-size: 0.95rem; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.btn-demo svg { width: 18px; height: 18px; }
.btn-demo:hover { background: #f8f9fa; border-color: #002d5c; }
.login-footer { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid #e9ecef; text-align: center; }
.login-footer p { font-size: 0.85rem; color: #6c757d; margin: 0 0 0.5rem 0; }
.login-footer code { display: inline-block; padding: 0.5rem 1rem; background: #f8f9fa; border: 1px solid #e9ecef; border-radius: 6px; font-size: 0.85rem; color: #495057; font-family: 'Consolas', monospace; }
.login-info { flex: 1; background: linear-gradient(135deg, #002d5c 0%, #001f40 100%); padding: 3rem; display: flex; align-items: center; justify-content: center; }
.info-content { max-width: 400px; color: #fff; }
.info-content h2 { font-size: 2rem; font-weight: 700; margin: 0 0 1rem 0; }
.info-content > p { font-size: 1.1rem; color: rgba(255, 255, 255, 0.8); line-height: 1.6; margin: 0 0 2.5rem 0; }
.features { display: flex; flex-direction: column; gap: 1.25rem; }
.feature { display: flex; align-items: center; gap: 1rem; padding: 1rem; background: rgba(255, 255, 255, 0.1); border-radius: 10px; transition: all 0.2s ease; }
.feature:hover { background: rgba(255, 255, 255, 0.15); transform: translateX(4px); }
.feature svg { width: 24px; height: 24px; color: #e85a24; flex-shrink: 0; }
.feature span { font-size: 0.95rem; font-weight: 500; }

/* Portal Page */
.portal-page { min-height: 100vh; background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%); position: relative; overflow: hidden; }
.bg-pattern { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.grid-lines { position: absolute; inset: 0; background-image: linear-gradient(rgba(0, 45, 92, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 45, 92, 0.03) 1px, transparent 1px); background-size: 50px 50px; }
.floating-shapes { position: absolute; inset: 0; }
.shape { position: absolute; border-radius: 50%; background: linear-gradient(135deg, rgba(232, 90, 36, 0.1), rgba(0, 45, 92, 0.05)); animation: float 20s infinite ease-in-out; }
.shape-1 { width: 400px; height: 400px; top: -100px; right: -100px; }
.shape-2 { width: 300px; height: 300px; bottom: -50px; left: -50px; animation-delay: -5s; }
.shape-3 { width: 200px; height: 200px; top: 50%; left: 10%; animation-delay: -10s; }
.shape-4 { width: 150px; height: 150px; bottom: 20%; right: 15%; animation-delay: -15s; }
@keyframes float { 0%, 100% { transform: translate(0, 0) rotate(0deg); } 25% { transform: translate(20px, -20px) rotate(5deg); } 50% { transform: translate(-10px, 10px) rotate(-5deg); } 75% { transform: translate(15px, 15px) rotate(3deg); } }
.portal-container { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; padding: 2rem; }
.portal-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 0; }
.portal-header .logo { display: flex; align-items: center; gap: 1rem; }
.portal-header .logo-icon { width: 48px; height: 48px; background: linear-gradient(135deg, #002d5c 0%, #001f40 100%); border-radius: 12px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0, 45, 92, 0.3); }
.portal-header .logo-icon svg { width: 28px; height: 28px; color: #fff; }
.portal-header .logo-text { display: flex; flex-direction: column; }
.portal-header .brand { font-size: 1.5rem; font-weight: 700; color: #002d5c; }
.portal-header .tagline { font-size: 0.85rem; color: #6c757d; }
.user-greeting { text-align: right; }
.greeting-text { display: block; font-size: 0.85rem; color: #6c757d; }
.user-name { font-size: 1.1rem; font-weight: 600; color: #fff; }
.portal-content { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 0; }
.portal-content h1 { font-size: 2.5rem; font-weight: 700; color: #002d5c; margin: 0 0 0.5rem 0; text-align: center; }
.portal-content .subtitle { font-size: 1.1rem; color: #6c757d; margin: 0 0 3rem 0; text-align: center; }
.portal-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem; max-width: 900px; width: 100%; }
.portal-cards.single { grid-template-columns: 1fr; max-width: 450px; }
.portal-card { position: relative; background: #fff; border-radius: 20px; padding: 2rem; cursor: pointer; transition: all 0.3s ease; overflow: hidden; border: 2px solid transparent; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); }
.portal-card:hover { transform: translateY(-8px); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15); }
.portal-card.monitoring:hover { border-color: #e85a24; }
.portal-card.admin:hover { border-color: #002d5c; }
.portal-card.selected { transform: scale(0.98); opacity: 0.8; }
.card-glow { position: absolute; top: 0; left: 0; right: 0; height: 4px; opacity: 0; transition: opacity 0.3s ease; }
.portal-card.monitoring .card-glow { background: linear-gradient(90deg, #e85a24, #ff7043); }
.portal-card.admin .card-glow { background: linear-gradient(90deg, #002d5c, #003d7a); }
.portal-card:hover .card-glow { opacity: 1; }
.card-content { position: relative; z-index: 1; }
.card-icon { width: 64px; height: 64px; border-radius: 16px; display: flex; align-items: center; justify-content: center; margin-bottom: 1.5rem; }
.portal-card.monitoring .card-icon { background: linear-gradient(135deg, rgba(232, 90, 36, 0.1), rgba(232, 90, 36, 0.05)); }
.portal-card.admin .card-icon { background: linear-gradient(135deg, rgba(0, 45, 92, 0.1), rgba(0, 45, 92, 0.05)); }
.card-icon svg { width: 32px; height: 32px; }
.portal-card.monitoring .card-icon svg { color: #e85a24; }
.portal-card.admin .card-icon svg { color: #002d5c; }
.portal-card h2 { font-size: 1.5rem; font-weight: 700; color: #002d5c; margin: 0 0 0.75rem 0; }
.portal-card > .card-content > p { color: #6c757d; line-height: 1.6; margin: 0 0 1.5rem 0; font-size: 0.95rem; }
.card-stats { display: flex; gap: 1.5rem; margin-bottom: 1.5rem; padding: 1rem; background: #f8f9fa; border-radius: 12px; }
.card-stats .stat { text-align: center; flex: 1; }
.card-stats .stat-value { display: block; font-size: 1.5rem; font-weight: 700; color: #002d5c; }
.card-stats .stat-label { font-size: 0.75rem; color: #6c757d; text-transform: uppercase; }
.card-features { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.5rem; }
.card-features .feature { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem; background: #f8f9fa; border-radius: 8px; font-size: 0.8rem; color: #495057; }
.card-features .feature svg { width: 16px; height: 16px; color: #002d5c; }
.card-action { display: flex; align-items: center; justify-content: space-between; padding-top: 1rem; border-top: 1px solid #e9ecef; font-weight: 600; }
.portal-card.monitoring .card-action { color: #e85a24; }
.portal-card.admin .card-action { color: #002d5c; }
.card-action svg { width: 20px; height: 20px; transition: transform 0.2s ease; }
.portal-card:hover .card-action svg { transform: translateX(4px); }
.card-decoration { position: absolute; right: -20px; bottom: -20px; width: 200px; height: 200px; opacity: 0.5; pointer-events: none; }
.portal-card.monitoring .card-decoration { color: #e85a24; }
.portal-card.admin .card-decoration { color: #002d5c; }
.portal-footer { display: flex; justify-content: space-between; align-items: center; padding: 1rem 0; }
.portal-footer .logout-btn { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1.25rem; background: transparent; border: 1px solid #dee2e6; border-radius: 8px; color: #6c757d; font-size: 0.9rem; font-weight: 500; }
.portal-footer .logout-btn svg { width: 18px; height: 18px; }
.portal-footer .logout-btn:hover { background: #fff; border-color: #dc3545; color: #dc3545; }
.copyright { font-size: 0.85rem; color: #adb5bd; }

/* Loading Overlay */
.loading-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; animation: fadeIn 0.3s ease; }
.loading-overlay.monitoring { background: linear-gradient(135deg, #e85a24 0%, #d14d1a 100%); }
.loading-overlay.admin { background: linear-gradient(135deg, #002d5c 0%, #001f40 100%); }
.loading-content { text-align: center; color: #fff; }
.loading-logo { width: 80px; height: 80px; margin: 0 auto 2rem; background: rgba(255, 255, 255, 0.1); border-radius: 20px; display: flex; align-items: center; justify-content: center; }
.loading-logo svg { width: 48px; height: 48px; }
.loading-spinner { position: relative; width: 60px; height: 60px; margin: 0 auto 1.5rem; }
.spinner-ring { position: absolute; inset: 0; border: 3px solid transparent; border-top-color: rgba(255, 255, 255, 0.8); border-radius: 50%; animation: spinRing 1.2s linear infinite; }
.spinner-ring:nth-child(2) { inset: 6px; animation-delay: -0.4s; border-top-color: rgba(255, 255, 255, 0.5); }
.spinner-ring:nth-child(3) { inset: 12px; animation-delay: -0.8s; border-top-color: rgba(255, 255, 255, 0.3); }
@keyframes spinRing { to { transform: rotate(360deg); } }
.loading-text { font-size: 1.5rem; font-weight: 600; margin: 0 0 0.5rem 0; }
.loading-dots { display: flex; justify-content: center; gap: 0.5rem; }
.loading-dots span { width: 8px; height: 8px; background: rgba(255, 255, 255, 0.5); border-radius: 50%; animation: loadingDot 1.4s infinite ease-in-out both; }
.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes loadingDot { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }


/* My Alerts Page */
.header-stats { display: flex; gap: 1rem; }
.stat-pill { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem; border-radius: 20px; font-size: 0.875rem; }
.stat-pill.critical { background: #f8d7da; color: #842029; }
.stat-pill.high { background: #ffe5d0; color: #984c0c; }
.stat-pill.open { background: #cff4fc; color: #055160; }
.stat-pill .stat-number { font-weight: 700; font-size: 1.1rem; }
.stat-pill .stat-label { font-weight: 500; }

.empty-state { text-align: center; padding: 4rem 2rem; background: #fff; border-radius: 16px; border: 1px solid #dee2e6; }
.empty-icon { width: 80px; height: 80px; margin: 0 auto 1.5rem; background: #d1e7dd; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.empty-icon svg { width: 40px; height: 40px; color: #198754; }
.empty-state h2 { font-size: 1.5rem; font-weight: 700; color: #002d5c; margin: 0 0 0.5rem 0; }
.empty-state p { color: #6c757d; margin: 0 0 1.5rem 0; }

.alerts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.5rem; }

.alert-card { background: #fff; border-radius: 12px; padding: 1.5rem; border: 1px solid #dee2e6; border-left: 4px solid; cursor: pointer; transition: all 0.2s ease; position: relative; }
.alert-card:hover { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); transform: translateY(-2px); }
.severity-border-critical { border-left-color: #dc3545; }
.severity-border-high { border-left-color: #fd7e14; }
.severity-border-medium { border-left-color: #ffc107; }
.severity-border-low { border-left-color: #28a745; }
.severity-border-info { border-left-color: #17a2b8; }

.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.card-title { font-size: 1rem; font-weight: 600; color: #002d5c; margin: 0 0 0.5rem 0; line-height: 1.4; }
.card-description { color: #6c757d; font-size: 0.875rem; line-height: 1.5; margin: 0 0 1rem 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; gap: 1rem; margin-bottom: 1rem; }
.card-meta .meta-item { display: flex; align-items: center; gap: 0.375rem; font-size: 0.8rem; color: #6c757d; }
.card-meta .meta-item svg { width: 14px; height: 14px; }
.card-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 1rem; border-top: 1px solid #e9ecef; }
.tags-preview { display: flex; gap: 0.375rem; flex-wrap: wrap; }
.tags-preview .tag { padding: 0.25rem 0.5rem; font-size: 0.7rem; }
.comments-count { display: flex; align-items: center; gap: 0.375rem; font-size: 0.8rem; color: #6c757d; }
.comments-count svg { width: 14px; height: 14px; }
.quick-actions { position: absolute; top: 1rem; right: 1rem; display: flex; gap: 0.375rem; opacity: 0; transition: opacity 0.2s ease; }
.alert-card:hover .quick-actions { opacity: 1; }

/* Custom Views Page */
.active-view-banner { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.5rem; background: linear-gradient(135deg, rgba(232, 90, 36, 0.1), rgba(232, 90, 36, 0.05)); border: 1px solid rgba(232, 90, 36, 0.2); border-radius: 12px; margin-bottom: 2rem; }
.banner-content { display: flex; align-items: center; gap: 0.75rem; color: #495057; }
.banner-content svg { width: 20px; height: 20px; color: #e85a24; }
.banner-content strong { color: #002d5c; }

.views-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.5rem; }

.view-card { background: #fff; border-radius: 12px; padding: 1.5rem; border: 1px solid #dee2e6; transition: all 0.2s ease; }
.view-card:hover { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); }
.view-card.active { border-color: #e85a24; box-shadow: 0 0 0 3px rgba(232, 90, 36, 0.1); }

.view-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; }
.view-icon { width: 40px; height: 40px; background: rgba(0, 45, 92, 0.08); border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.view-icon svg { width: 20px; height: 20px; color: #002d5c; }

.view-actions { display: flex; align-items: center; gap: 0.5rem; position: relative; }
.default-badge { padding: 0.25rem 0.5rem; background: #ffc107; color: #664d03; font-size: 0.7rem; font-weight: 600; border-radius: 4px; text-transform: uppercase; }
.view-actions .icon-btn { width: 32px; height: 32px; background: transparent; border: 1px solid #dee2e6; border-radius: 6px; color: #6c757d; }
.view-actions .icon-btn:hover { background: #f8f9fa; color: #002d5c; }
.view-actions .icon-btn svg { width: 16px; height: 16px; }
.view-actions .dropdown-menu { position: absolute; top: 100%; right: 0; min-width: 180px; margin-top: 4px; }
.view-actions .dropdown-menu button { width: 100%; display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; background: none; border: none; font-size: 0.875rem; color: #495057; cursor: pointer; border-radius: 6px; }
.view-actions .dropdown-menu button:hover { background: #f8f9fa; }
.view-actions .dropdown-menu button svg { width: 16px; height: 16px; }
.view-actions .dropdown-menu button.danger { color: #dc3545; }
.view-actions .dropdown-menu button.danger:hover { background: #f8d7da; }

.view-card .view-name { font-size: 1.1rem; font-weight: 600; color: #002d5c; margin: 0 0 1rem 0; }
.view-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }

.filter-chip { padding: 0.25rem 0.625rem; border-radius: 4px; font-size: 0.75rem; font-weight: 500; text-transform: capitalize; }
.filter-chip.severity.chip-critical { background: #f8d7da; color: #842029; }
.filter-chip.severity.chip-high { background: #ffe5d0; color: #984c0c; }
.filter-chip.severity.chip-medium { background: #fff3cd; color: #664d03; }
.filter-chip.severity.chip-low { background: #d1e7dd; color: #0f5132; }
.filter-chip.severity.chip-info { background: #cff4fc; color: #055160; }
.filter-chip.StatusName { background: #e2e3e5; color: #41464b; }
.filter-chip.category { background: #e9ecef; color: #495057; }
.filter-chip.customer { background: rgba(0, 45, 92, 0.1); color: #002d5c; }

.view-meta { display: flex; justify-content: space-between; font-size: 0.8rem; color: #6c757d; margin-bottom: 1rem; }

.view-footer { padding-top: 1rem; border-top: 1px solid #e9ecef; }

.btn-activate { width: 100%; display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.75rem; background: #fff; border: 1px solid #002d5c; border-radius: 8px; color: #002d5c; font-size: 0.875rem; font-weight: 500; }
.btn-activate svg { width: 16px; height: 16px; }
.btn-activate:hover { background: #002d5c; color: #fff; }
.btn-activate.active { background: #e85a24; border-color: #e85a24; color: #fff; }

/* Mobile Responsive */
@media (max-width: 768px) {
    .mobile-header { display: flex; }
    .mobile-bottom-nav { display: flex; }
    .sidebar-overlay { display: block; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
    .app-layout.sidebar-open .sidebar-overlay { opacity: 1; pointer-events: auto; }
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform 0.3s ease; }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-content { margin-left: 0; padding-top: 60px; padding-bottom: 80px; }
    .alert-view, .my-alerts, .custom-views-page { padding: 1rem; padding-bottom: 80px; }
    .page-header { flex-direction: column; gap: 1rem; }
    .header-content h1 { font-size: 1.35rem; }
    .header-actions { width: 100%; flex-wrap: wrap; }
    .header-actions .btn { flex: 1; min-width: 120px; justify-content: center; }
    .filter-summary { flex-wrap: wrap; gap: 0.5rem; }
    .login-info { display: none; }
    .login-container { flex-direction: column; }
    .login-card { max-width: 100%; }
    .portal-cards { grid-template-columns: 1fr; }
    .portal-content h1 { font-size: 1.75rem; }
    .alerts-grid { grid-template-columns: 1fr; }
    .views-grid { grid-template-columns: 1fr; }
    .detail-panel { width: 100%; border-radius: 16px 16px 0 0; }
}

@media (max-width: 480px) {
    .login-page { padding: 1rem; }
    .login-card { padding: 2rem 1.5rem; }
    .header-actions .btn { padding: 0.625rem 1rem; font-size: 0.8rem; }
} border-radius: 8px; color: #6c757d; font-size: 0.9rem; font-weight: 500; }
.portal-footer .logout-btn svg { width: 18px; height: 18px; }
.portal-footer .logout-btn:hover { background: #fff; border-color: #dc3545; color: #dc3545; }
.copyright { font-size: 0.85rem; color: #adb5bd; }

/* Loading Overlay */
.loading-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; animation: fadeIn 0.3s ease; }
.loading-overlay.monitoring { background: linear-gradient(135deg, #e85a24 0%, #d14d1a 100%); }
.loading-overlay.admin { background: linear-gradient(135deg, #002d5c 0%, #001f40 100%); }
.loading-content { text-align: center; color: #fff; }
.loading-logo { width: 80px; height: 80px; margin: 0 auto 2rem; background: rgba(255, 255, 255, 0.1); border-radius: 20px; display: flex; align-items: center; justify-content: center; }
.loading-logo svg { width: 48px; height: 48px; }
.loading-spinner { position: relative; width: 60px; height: 60px; margin: 0 auto 1.5rem; }
.spinner-ring { position: absolute; inset: 0; border: 3px solid transparent; border-top-color: rgba(255, 255, 255, 0.8); border-radius: 50%; animation: spinRing 1.2s linear infinite; }
.spinner-ring:nth-child(2) { inset: 6px; animation-delay: -0.4s; border-top-color: rgba(255, 255, 255, 0.5); }
.spinner-ring:nth-child(3) { inset: 12px; animation-delay: -0.8s; border-top-color: rgba(255, 255, 255, 0.3); }
@keyframes spinRing { to { transform: rotate(360deg); } }
.loading-text { font-size: 1.5rem; font-weight: 600; margin: 0 0 0.5rem 0; }
.loading-dots { display: flex; justify-content: center; gap: 0.5rem; }
.loading-dots span { width: 8px; height: 8px; background: rgba(255, 255, 255, 0.5); border-radius: 50%; animation: loadingDot 1.4s infinite ease-in-out both; }
.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes loadingDot { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

/* My Alerts Page */
.header-stats { display: flex; gap: 1rem; }
.stat-pill { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem; border-radius: 20px; font-size: 0.875rem; }
.stat-pill.critical { background: #f8d7da; color: #842029; }
.stat-pill.high { background: #ffe5d0; color: #984c0c; }
.stat-pill.open { background: #cff4fc; color: #055160; }
.stat-pill .stat-number { font-weight: 700; font-size: 1.1rem; }
.stat-pill .stat-label { font-weight: 500; }
.empty-state { text-align: center; padding: 4rem 2rem; background: #fff; border-radius: 16px; border: 1px solid #dee2e6; }
.empty-icon { width: 80px; height: 80px; margin: 0 auto 1.5rem; background: #d1e7dd; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.empty-icon svg { width: 40px; height: 40px; color: #198754; }
.empty-state h2 { font-size: 1.5rem; font-weight: 700; color: #002d5c; margin: 0 0 0.5rem 0; }
.empty-state p { color: #6c757d; margin: 0 0 1.5rem 0; }
.alerts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.5rem; }
.alert-card { background: #fff; border-radius: 12px; padding: 1.5rem; border: 1px solid #dee2e6; border-left: 4px solid; cursor: pointer; transition: all 0.2s ease; position: relative; }
.alert-card:hover { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); transform: translateY(-2px); }
.severity-border-critical { border-left-color: #dc3545; }
.severity-border-high { border-left-color: #fd7e14; }
.severity-border-medium { border-left-color: #ffc107; }
.severity-border-low { border-left-color: #28a745; }
.severity-border-info { border-left-color: #17a2b8; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.card-title { font-size: 1rem; font-weight: 600; color: #002d5c; margin: 0 0 0.5rem 0; line-height: 1.4; }
.card-description { color: #6c757d; font-size: 0.875rem; line-height: 1.5; margin: 0 0 1rem 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; gap: 1rem; margin-bottom: 1rem; }
.card-meta .meta-item { display: flex; align-items: center; gap: 0.375rem; font-size: 0.8rem; color: #6c757d; }
.card-meta .meta-item svg { width: 14px; height: 14px; }
.card-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 1rem; border-top: 1px solid #e9ecef; }
.tags-preview { display: flex; gap: 0.375rem; flex-wrap: wrap; }
.tags-preview .tag { padding: 0.25rem 0.5rem; font-size: 0.7rem; }
.comments-count { display: flex; align-items: center; gap: 0.375rem; font-size: 0.8rem; color: #6c757d; }
.comments-count svg { width: 14px; height: 14px; }
.quick-actions { position: absolute; top: 1rem; right: 1rem; display: flex; gap: 0.375rem; opacity: 0; transition: opacity 0.2s ease; }
.alert-card:hover .quick-actions { opacity: 1; }

/* Custom Views Page */
.active-view-banner { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.5rem; background: linear-gradient(135deg, rgba(232, 90, 36, 0.1), rgba(232, 90, 36, 0.05)); border: 1px solid rgba(232, 90, 36, 0.2); border-radius: 12px; margin-bottom: 2rem; }
.banner-content { display: flex; align-items: center; gap: 0.75rem; color: #495057; }
.banner-content svg { width: 20px; height: 20px; color: #e85a24; }
.banner-content strong { color: #002d5c; }
.views-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.5rem; }
.view-card { background: #fff; border-radius: 12px; padding: 1.5rem; border: 1px solid #dee2e6; transition: all 0.2s ease; }
.view-card:hover { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); }
.view-card.active { border-color: #e85a24; box-shadow: 0 0 0 3px rgba(232, 90, 36, 0.1); }
.view-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; }
.view-icon { width: 40px; height: 40px; background: rgba(0, 45, 92, 0.08); border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.view-icon svg { width: 20px; height: 20px; color: #002d5c; }
.view-actions { display: flex; align-items: center; gap: 0.5rem; position: relative; }
.default-badge { padding: 0.25rem 0.5rem; background: #ffc107; color: #664d03; font-size: 0.7rem; font-weight: 600; border-radius: 4px; text-transform: uppercase; }
.view-actions .icon-btn { width: 32px; height: 32px; background: transparent; border: 1px solid #dee2e6; border-radius: 6px; color: #6c757d; }
.view-actions .icon-btn:hover { background: #f8f9fa; color: #002d5c; }
.view-actions .icon-btn svg { width: 16px; height: 16px; }
.view-actions .dropdown-menu { position: absolute; top: 100%; right: 0; min-width: 180px; margin-top: 4px; }
.view-actions .dropdown-menu button { width: 100%; display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; background: none; border: none; font-size: 0.875rem; color: #495057; border-radius: 6px; }
.view-actions .dropdown-menu button:hover { background: #f8f9fa; }
.view-actions .dropdown-menu button svg { width: 16px; height: 16px; }
.view-actions .dropdown-menu button.danger { color: #dc3545; }
.view-actions .dropdown-menu button.danger:hover { background: #f8d7da; }
.view-card .view-name { font-size: 1.1rem; font-weight: 600; color: #002d5c; margin: 0 0 1rem 0; }
.view-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.filter-chip { padding: 0.25rem 0.625rem; border-radius: 4px; font-size: 0.75rem; font-weight: 500; text-transform: capitalize; }
.filter-chip.severity.chip-critical { background: #f8d7da; color: #842029; }
.filter-chip.severity.chip-high { background: #ffe5d0; color: #984c0c; }
.filter-chip.severity.chip-medium { background: #fff3cd; color: #664d03; }
.filter-chip.severity.chip-low { background: #d1e7dd; color: #0f5132; }
.filter-chip.severity.chip-info { background: #cff4fc; color: #055160; }
.filter-chip.StatusName { background: #e2e3e5; color: #41464b; }
.filter-chip.category { background: #e9ecef; color: #495057; }
.filter-chip.customer { background: rgba(0, 45, 92, 0.1); color: #002d5c; }
.view-meta { display: flex; justify-content: space-between; font-size: 0.8rem; color: #6c757d; margin-bottom: 1rem; }
.view-footer { padding-top: 1rem; border-top: 1px solid #e9ecef; }
.btn-activate { width: 100%; display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.75rem; background: #fff; border: 1px solid #002d5c; border-radius: 8px; color: #002d5c; font-size: 0.875rem; font-weight: 500; }
.btn-activate svg { width: 16px; height: 16px; }
.btn-activate:hover { background: #002d5c; color: #fff; }
.btn-activate.active { background: #e85a24; border-color: #e85a24; color: #fff; }

/* Mobile Responsive */
@media (max-width: 768px) {
    .mobile-header { display: flex; }
    .mobile-bottom-nav { display: flex; }
    .sidebar-overlay { display: block; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
    .app-layout.sidebar-open .sidebar-overlay { opacity: 1; pointer-events: auto; }
    .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-content { margin-left: 0; padding-top: 60px; padding-bottom: 80px; }
    .alert-view, .my-alerts, .custom-views-page { padding: 1rem; padding-bottom: 80px; }
    .page-header { flex-direction: column; gap: 1rem; }
    .header-content h1 { font-size: 1.35rem; }
    .header-actions { width: 100%; flex-wrap: wrap; }
    .header-actions .btn { flex: 1; min-width: 120px; justify-content: center; }
    .filter-summary { flex-wrap: wrap; gap: 0.5rem; }
    .login-info { display: none; }
    .login-container { flex-direction: column; }
    .login-card { max-width: 100%; }
    .portal-cards { grid-template-columns: 1fr; }
    .portal-content h1 { font-size: 1.75rem; }
    .alerts-grid { grid-template-columns: 1fr; }
    .views-grid { grid-template-columns: 1fr; }
    .detail-panel { width: 100%; border-radius: 16px 16px 0 0; }
}

@media (max-width: 480px) {
    .login-page { padding: 1rem; }
    .login-card { padding: 2rem 1.5rem; }
    .header-actions .btn { padding: 0.625rem 1rem; font-size: 0.8rem; }
}

/* Case Modal - Modern Design */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, rgba(0, 45, 92, 0.4) 0%, rgba(0, 0, 0, 0.6) 100%);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    animation: overlayFadeIn 0.3s ease;
}

@keyframes overlayFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.case-modal {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 20px;
    max-width: 960px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 0 1px rgba(0, 45, 92, 0.05), 0 25px 50px -12px rgba(0, 45, 92, 0.25), 0 0 100px rgba(232, 90, 36, 0.1);
    animation: modalEnter 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalEnter {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header with gradient accent */
.case-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.75rem;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    position: relative;
}

    .case-modal-header::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: linear-gradient(90deg, #002d5c 0%, #e85a24 50%, #002d5c 100%);
        background-size: 200% 100%;
        animation: gradientSlide 3s ease infinite;
    }

@keyframes gradientSlide {
    0%, 100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.case-modal-header .header-left {
    display: flex;
    gap: 0.75rem;
}

.case-modal-header .back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .case-modal-header .back-btn:hover {
        background: #fff;
        border-color: #002d5c;
        color: #002d5c;
        transform: translateX(-2px);
    }

    .case-modal-header .back-btn svg {
        width: 20px;
        height: 20px;
    }

.case-modal-header .save-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #002d5c 0%, #003d7a 100%);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

    .case-modal-header .save-btn::before {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg, #e85a24 0%, #ff7043 100%);
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .case-modal-header .save-btn:hover::before {
        opacity: 1;
    }

    .case-modal-header .save-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(232, 90, 36, 0.4);
    }

    .case-modal-header .save-btn span,
    .case-modal-header .save-btn svg {
        position: relative;
        z-index: 1;
    }

    .case-modal-header .save-btn svg {
        width: 18px;
        height: 18px;
    }

    .case-modal-header .save-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        transform: none;
    }

        .case-modal-header .save-btn:disabled:hover::before {
            opacity: 0;
        }

/* Header Info Cards */
.case-modal-header .header-info {
    display: flex;
    gap: 0.5rem;
}

.case-modal-header .info-item {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border: 1px solid #e9ecef;
    border-radius: 10px;
    min-width: 100px;
    transition: all 0.2s ease;
}

    .case-modal-header .info-item:hover {
        border-color: #dee2e6;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }

.case-modal-header .info-label {
    font-size: 0.6rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.75px;
    font-weight: 600;
}

.case-modal-header .info-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: #212529;
    margin-top: 0.125rem;
}

    .case-modal-header .info-value.priority-Critical {
        color: #dc3545;
        text-shadow: 0 0 20px rgba(220, 53, 69, 0.3);
    }

    .case-modal-header .info-value.priority-High {
        color: #fd7e14;
    }

    .case-modal-header .info-value.priority-Normal {
        color: #17a2b8;
    }

    .case-modal-header .info-value.priority-Low {
        color: #28a745;
    }

.case-modal-header .close-btn {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .case-modal-header .close-btn:hover {
        background: #fee2e2;
        border-color: #fca5a5;
        color: #dc2626;
        transform: rotate(90deg);
    }

    .case-modal-header .close-btn svg {
        width: 18px;
        height: 18px;
    }

/* Modal Body */
.case-modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
    background: #fff;
}

/* Error Banner */
.error-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fecaca;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    color: #991b1b;
    animation: shakeBanner 0.5s ease;
}

@keyframes shakeBanner {
    0%, 100% {
        transform: translateX(0);
    }

    20%, 60% {
        transform: translateX(-5px);
    }

    40%, 80% {
        transform: translateX(5px);
    }
}

.error-banner svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Form Grid with Visual Separator */
.case-modal-body .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    position: relative;
}

    .case-modal-body .form-grid::before {
        content: '';
        position: absolute;
        left: 50%;
        top: 0;
        bottom: 0;
        width: 1px;
        background: linear-gradient(180deg, transparent 0%, #e9ecef 10%, #e9ecef 90%, transparent 100%);
    }

.case-modal-body .form-column {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Form Groups with Modern Styling */
.case-modal-body .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

    .case-modal-body .form-group label {
        font-size: 0.8rem;
        font-weight: 600;
        color: #374151;
        display: flex;
        align-items: center;
        gap: 0.25rem;
    }

        .case-modal-body .form-group label .required {
            color: #e85a24;
            font-size: 1rem;
        }

    .case-modal-body .form-group input,
    .case-modal-body .form-group textarea,
    .case-modal-body .form-group select {
        padding: 0.875rem 1rem;
        border: 2px solid #e5e7eb;
        border-radius: 12px;
        font-size: 0.95rem;
        background: #fff;
        transition: all 0.2s ease;
        color: #1f2937;
    }

        .case-modal-body .form-group input::placeholder,
        .case-modal-body .form-group textarea::placeholder {
            color: #9ca3af;
        }

        .case-modal-body .form-group input:hover,
        .case-modal-body .form-group textarea:hover,
        .case-modal-body .form-group select:hover {
            border-color: #d1d5db;
        }

        .case-modal-body .form-group input:focus,
        .case-modal-body .form-group textarea:focus,
        .case-modal-body .form-group select:focus {
            outline: none;
            border-color: #002d5c;
            box-shadow: 0 0 0 4px rgba(0, 45, 92, 0.1);
        }

        .case-modal-body .form-group input.input-error,
        .case-modal-body .form-group select.input-error,
        .case-modal-body .form-group textarea.input-error {
            border-color: #ef4444;
            animation: inputShake 0.4s ease;
        }

@keyframes inputShake {
    0%, 100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    75% {
        transform: translateX(4px);
    }
}

.case-modal-body .form-group textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

/* Custom Select Styling */
.case-modal-body .form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
    padding-right: 3rem;
    cursor: pointer;
}

    .case-modal-body .form-group select:focus {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23002d5c' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    }

/* Input with Icon */
.input-with-icon {
    position: relative;
}

    .input-with-icon input {
        padding-left: 2.75rem;
    }

    .input-with-icon .input-icon {
        position: absolute;
        left: 1rem;
        top: 50%;
        transform: translateY(-50%);
        width: 18px;
        height: 18px;
        color: #9ca3af;
        pointer-events: none;
        transition: color 0.2s ease;
    }

    .input-with-icon input:focus + .input-icon {
        color: #002d5c;
    }

/* Alert Info Footer - Card Style */
.alert-info-footer {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 2rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-top: 1px solid #fcd34d;
    position: relative;
    overflow: hidden;
}

    .alert-info-footer::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 4px;
        background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
    }

    .alert-info-footer .alert-icon {
        width: 48px;
        height: 48px;
        background: linear-gradient(135deg, #fff 0%, #fef9c3 100%);
        border-radius: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
        animation: iconPulse 2s ease-in-out infinite;
    }

@keyframes iconPulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.alert-info-footer .alert-icon svg {
    width: 24px;
    height: 24px;
    color: #d97706;
}

.alert-info-footer .alert-details {
    flex: 1;
    min-width: 0;
}

.alert-info-footer .alert-label {
    font-size: 0.7rem;
    color: #92400e;
    text-transform: uppercase;
    letter-spacing: 0.75px;
    font-weight: 600;
}

.alert-info-footer .alert-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #78350f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.125rem;
}

.alert-info-footer .alert-severity {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

    .alert-info-footer .alert-severity.sev0,
    .alert-info-footer .alert-severity.sev1 {
        background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
        color: #fff;
        box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
    }

    .alert-info-footer .alert-severity.sev2 {
        background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
        color: #fff;
        box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
    }

    .alert-info-footer .alert-severity.sev3 {
        background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
        color: #fff;
        box-shadow: 0 4px 12px rgba(8, 145, 178, 0.3);
    }

/* Section Divider */
.section-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    grid-column: span 2;
}

    .section-divider::before,
    .section-divider::after {
        content: '';
        flex: 1;
        height: 1px;
        background: linear-gradient(90deg, transparent, #e5e7eb, transparent);
    }

    .section-divider span {
        font-size: 0.7rem;
        font-weight: 600;
        color: #9ca3af;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

/* Loading Spinner */
.save-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Success State */
.case-modal.success .case-modal-header::before {
    background: linear-gradient(90deg, #10b981 0%, #34d399 50%, #10b981 100%);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .case-modal {
        width: 100%;
        max-width: 100%;
        max-height: 95vh;
        border-radius: 24px 24px 0 0;
        animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }

    @keyframes modalSlideUp {
        from {
            opacity: 0;
            transform: translateY(100%);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .case-modal-header {
        padding: 1rem 1.25rem;
    }

        .case-modal-header .header-info {
            display: none;
        }

    .case-modal-body {
        padding: 1.25rem;
    }

        .case-modal-body .form-grid {
            grid-template-columns: 1fr;
            gap: 1rem;
        }

            .case-modal-body .form-grid::before {
                display: none;
            }

    .alert-info-footer {
        padding: 1rem 1.25rem;
        flex-wrap: wrap;
    }

        .alert-info-footer .alert-details {
            order: 3;
            width: 100%;
            margin-top: 0.5rem;
        }
}

/* Dark Mode Support */
[data-theme="dark"] .case-modal {
    background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
}

[data-theme="dark"] .case-modal-header {
    background: #1f2937;
    border-bottom-color: #374151;
}

    [data-theme="dark"] .case-modal-header .info-item {
        background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
        border-color: #4b5563;
    }

    [data-theme="dark"] .case-modal-header .info-label {
        color: #9ca3af;
    }

    [data-theme="dark"] .case-modal-header .info-value {
        color: #f3f4f6;
    }

    [data-theme="dark"] .case-modal-header .back-btn,
    [data-theme="dark"] .case-modal-header .close-btn {
        background: #374151;
        border-color: #4b5563;
        color: #d1d5db;
    }

[data-theme="dark"] .case-modal-body {
    background: #1f2937;
}

    [data-theme="dark"] .case-modal-body .form-group label {
        color: #e5e7eb;
    }

    [data-theme="dark"] .case-modal-body .form-group input,
    [data-theme="dark"] .case-modal-body .form-group textarea,
    [data-theme="dark"] .case-modal-body .form-group select {
        background: #374151;
        border-color: #4b5563;
        color: #f3f4f6;
    }

        [data-theme="dark"] .case-modal-body .form-group input::placeholder,
        [data-theme="dark"] .case-modal-body .form-group textarea::placeholder {
            color: #6b7280;
        }

    [data-theme="dark"] .case-modal-body .form-grid::before {
        background: linear-gradient(180deg, transparent 0%, #4b5563 10%, #4b5563 90%, transparent 100%);
    }

[data-theme="dark"] .alert-info-footer {
    background: linear-gradient(135deg, #78350f 0%, #92400e 100%);
    border-top-color: #b45309;
}

    [data-theme="dark"] .alert-info-footer .alert-icon {
        background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    }

    [data-theme="dark"] .alert-info-footer .alert-label {
        color: #fde68a;
    }

    [data-theme="dark"] .alert-info-footer .alert-name {
        color: #fef3c7;
    }

.alert-banner { display: flex; align-items: center; gap: 1rem; padding: 1rem; background: rgba(232, 90, 36, 0.08); border: 1px solid rgba(232, 90, 36, 0.2); border-radius: 8px; margin-bottom: 1.5rem; }
.alert-banner .banner-icon { width: 40px; height: 40px; background: rgba(232, 90, 36, 0.15); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #e85a24; }
.alert-banner .banner-icon svg { width: 20px; height: 20px; }
.alert-banner .banner-content { flex: 1; }
.alert-banner .banner-label { font-size: 0.75rem; color: #6c757d; display: block; }
.alert-banner .banner-title { font-size: 0.9rem; font-weight: 500; color: #212529; }

.type-priority-section { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; padding-top: 1rem; border-top: 1px solid #e9ecef; }
.type-priority-section .form-group label { margin-bottom: 0.5rem; display: block; }
.button-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.type-btn, .priority-btn { padding: 0.5rem 1rem; border: 1px solid #dee2e6; background: #fff; border-radius: 6px; font-size: 0.8rem; cursor: pointer; transition: all 0.2s ease; }
.type-btn:hover, .priority-btn:hover { background: #f8f9fa; }
.type-btn.active { background: #002d5c; border-color: #002d5c; color: #fff; }
.priority-btn.active.btn-Critical { background: #dc3545; border-color: #dc3545; color: #fff; }
.priority-btn.active.btn-High { background: #fd7e14; border-color: #fd7e14; color: #fff; }
.priority-btn.active.btn-Medium { background: #17a2b8; border-color: #17a2b8; color: #fff; }
.priority-btn.active.btn-Low { background: #28a745; border-color: #28a745; color: #fff; }

/* Assign Case Modal */
/* Assign Case Modal - Modern Design */
.assign-case-modal {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 20px;
    max-width: 560px;
    width: 95%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 0 1px rgba(0, 45, 92, 0.05), 0 25px 50px -12px rgba(0, 45, 92, 0.25), 0 0 80px rgba(232, 90, 36, 0.08);
    animation: modalEnter 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalEnter {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */
.assign-case-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    position: relative;
}

    .assign-case-modal .modal-header::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: linear-gradient(90deg, #002d5c 0%, #e85a24 50%, #002d5c 100%);
        background-size: 200% 100%;
        animation: gradientSlide 3s ease infinite;
    }

@keyframes gradientSlide {
    0%, 100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.assign-case-modal .header-title {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    font-size: 1.15rem;
    font-weight: 600;
    color: #002d5c;
}

    .assign-case-modal .header-title .icon-wrapper {
        width: 42px;
        height: 42px;
        background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 8px rgba(232, 90, 36, 0.15);
    }

    .assign-case-modal .header-title svg {
        width: 22px;
        height: 22px;
        color: #e85a24;
    }

.assign-case-modal .close-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.25s ease;
}

    .assign-case-modal .close-btn:hover {
        background: #fee2e2;
        border-color: #fca5a5;
        color: #dc2626;
        transform: rotate(90deg);
    }

    .assign-case-modal .close-btn svg {
        width: 18px;
        height: 18px;
    }

/* Body */
.assign-case-modal .modal-body {
    padding: 1.75rem;
    overflow-y: auto;
    flex: 1;
    background: #fff;
}

/* Alert Info Card */
.assign-case-modal .alert-info {
    padding: 1.25rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: 14px;
    margin-bottom: 1.75rem;
    position: relative;
    overflow: hidden;
}

    .assign-case-modal .alert-info::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 4px;
        background: linear-gradient(180deg, #0284c7 0%, #0ea5e9 100%);
    }

.assign-case-modal .alert-header {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin-bottom: 0.625rem;
}

    .assign-case-modal .alert-header .alert-icon {
        width: 36px;
        height: 36px;
        background: linear-gradient(135deg, #fff 0%, #f0f9ff 100%);
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        box-shadow: 0 2px 8px rgba(14, 165, 233, 0.15);
    }

        .assign-case-modal .alert-header .alert-icon svg {
            width: 18px;
            height: 18px;
            color: #0284c7;
        }

    .assign-case-modal .alert-header .severity-badge {
        padding: 0.25rem 0.75rem;
        border-radius: 20px;
        font-size: 0.7rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-left: auto;
    }

        .assign-case-modal .alert-header .severity-badge.sev0,
        .assign-case-modal .alert-header .severity-badge.sev1 {
            background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
            color: #fff;
        }

        .assign-case-modal .alert-header .severity-badge.sev2 {
            background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
            color: #fff;
        }

        .assign-case-modal .alert-header .severity-badge.sev3 {
            background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
            color: #fff;
        }

.assign-case-modal .alert-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #0c4a6e;
}

.assign-case-modal .alert-desc {
    font-size: 0.85rem;
    color: #0369a1;
    margin: 0;
    padding-left: 3rem;
    line-height: 1.5;
}

/* Form Section */
.assign-case-modal .form-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.assign-case-modal .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

    .assign-case-modal .form-group label {
        font-size: 0.8rem;
        font-weight: 600;
        color: #374151;
        display: flex;
        align-items: center;
        gap: 0.375rem;
    }

        .assign-case-modal .form-group label .required {
            color: #e85a24;
            font-size: 1rem;
        }

        .assign-case-modal .form-group label .label-icon {
            width: 16px;
            height: 16px;
            color: #9ca3af;
        }

/* Custom Select */
.assign-case-modal .select-wrapper {
    position: relative;
}

    .assign-case-modal .select-wrapper select {
        width: 100%;
        padding: 0.875rem 3rem 0.875rem 1rem;
        border: 2px solid #e5e7eb;
        border-radius: 12px;
        font-size: 0.95rem;
        background: #fff;
        color: #1f2937;
        appearance: none;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .assign-case-modal .select-wrapper::after {
        content: '';
        position: absolute;
        right: 1rem;
        top: 50%;
        transform: translateY(-50%);
        width: 20px;
        height: 20px;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: center;
        pointer-events: none;
        transition: transform 0.2s ease;
    }

    .assign-case-modal .select-wrapper select:hover {
        border-color: #d1d5db;
    }

    .assign-case-modal .select-wrapper select:focus {
        outline: none;
        border-color: #002d5c;
        box-shadow: 0 0 0 4px rgba(0, 45, 92, 0.1);
    }

        .assign-case-modal .select-wrapper select:focus + .select-icon {
            color: #002d5c;
        }

    .assign-case-modal .select-wrapper.disabled {
        opacity: 0.6;
    }

        .assign-case-modal .select-wrapper.disabled select {
            background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
            cursor: not-allowed;
            color: #9ca3af;
        }

        .assign-case-modal .select-wrapper.disabled::after {
            opacity: 0.5;
        }

    /* Loading State for Select */
    .assign-case-modal .select-wrapper.loading select {
        color: transparent;
    }

    .assign-case-modal .select-wrapper.loading::before {
        content: '';
        position: absolute;
        left: 1rem;
        top: 50%;
        transform: translateY(-50%);
        width: 18px;
        height: 18px;
        border: 2px solid #e5e7eb;
        border-top-color: #002d5c;
        border-radius: 50%;
        animation: spin 0.8s linear infinite;
    }

@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* No Cases Hint */
.assign-case-modal .no-cases-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.625rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    border: 1px solid #fde047;
    border-radius: 10px;
}

    .assign-case-modal .no-cases-hint svg {
        width: 16px;
        height: 16px;
        color: #ca8a04;
        flex-shrink: 0;
    }

    .assign-case-modal .no-cases-hint a {
        color: #e85a24;
        font-weight: 600;
        cursor: pointer;
        text-decoration: none;
        transition: all 0.2s ease;
    }

        .assign-case-modal .no-cases-hint a:hover {
            color: #c2410c;
            text-decoration: underline;
        }

/* Selected Case Preview */
.assign-case-modal .selected-case-preview {
    margin-top: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #86efac;
    border-radius: 12px;
    animation: fadeSlideIn 0.3s ease;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.assign-case-modal .selected-case-preview .preview-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

    .assign-case-modal .selected-case-preview .preview-header svg {
        width: 16px;
        height: 16px;
        color: #16a34a;
    }

    .assign-case-modal .selected-case-preview .preview-header span {
        font-size: 0.7rem;
        font-weight: 600;
        color: #15803d;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

.assign-case-modal .selected-case-preview .case-number {
    font-size: 0.85rem;
    font-weight: 700;
    color: #166534;
    font-family: 'Consolas', monospace;
}

.assign-case-modal .selected-case-preview .case-title {
    font-size: 0.9rem;
    color: #14532d;
    margin-top: 0.25rem;
}

/* Modal Footer */
.assign-case-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 1.75rem;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-top: 1px solid #e2e8f0;
}

    .assign-case-modal .modal-footer .btn {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.75rem 1.5rem;
        border-radius: 12px;
        font-size: 0.9rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.25s ease;
    }

        .assign-case-modal .modal-footer .btn svg {
            width: 18px;
            height: 18px;
        }

    .assign-case-modal .modal-footer .btn-secondary {
        background: #fff;
        border: 2px solid #e5e7eb;
        color: #4b5563;
    }

        .assign-case-modal .modal-footer .btn-secondary:hover {
            background: #f9fafb;
            border-color: #d1d5db;
            color: #1f2937;
        }

    .assign-case-modal .modal-footer .btn-primary {
        background: linear-gradient(135deg, #002d5c 0%, #003d7a 100%);
        border: none;
        color: #fff;
        position: relative;
        overflow: hidden;
    }

        .assign-case-modal .modal-footer .btn-primary::before {
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(135deg, #e85a24 0%, #ff7043 100%);
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .assign-case-modal .modal-footer .btn-primary:hover::before {
            opacity: 1;
        }

        .assign-case-modal .modal-footer .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(232, 90, 36, 0.4);
        }

        .assign-case-modal .modal-footer .btn-primary span,
        .assign-case-modal .modal-footer .btn-primary svg {
            position: relative;
            z-index: 1;
        }

        .assign-case-modal .modal-footer .btn-primary:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
        }

            .assign-case-modal .modal-footer .btn-primary:disabled:hover::before {
                opacity: 0;
            }

            .assign-case-modal .modal-footer .btn-primary:disabled:hover {
                box-shadow: none;
            }

/* Mobile Responsive */
@media (max-width: 640px) {
    .assign-case-modal {
        width: 100%;
        max-width: 100%;
        max-height: 95vh;
        border-radius: 24px 24px 0 0;
        animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }

    @keyframes modalSlideUp {
        from {
            opacity: 0;
            transform: translateY(100%);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .assign-case-modal .modal-header {
        padding: 1rem 1.25rem;
    }

    .assign-case-modal .modal-body {
        padding: 1.25rem;
    }

    .assign-case-modal .modal-footer {
        padding: 1rem 1.25rem;
    }

        .assign-case-modal .modal-footer .btn {
            flex: 1;
            justify-content: center;
        }
}

/* Dark Mode */
[data-theme="dark"] .assign-case-modal {
    background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
}

    [data-theme="dark"] .assign-case-modal .modal-header {
        background: #1f2937;
        border-bottom-color: #374151;
    }

    [data-theme="dark"] .assign-case-modal .header-title {
        color: #f3f4f6;
    }

        [data-theme="dark"] .assign-case-modal .header-title .icon-wrapper {
            background: linear-gradient(135deg, #7c2d12 0%, #9a3412 100%);
        }

    [data-theme="dark"] .assign-case-modal .close-btn {
        background: #374151;
        border-color: #4b5563;
        color: #d1d5db;
    }

    [data-theme="dark"] .assign-case-modal .modal-body {
        background: #1f2937;
    }

    [data-theme="dark"] .assign-case-modal .alert-info {
        background: linear-gradient(135deg, #1e3a5f 0%, #1e40af 100%);
        border-color: #3b82f6;
    }

        [data-theme="dark"] .assign-case-modal .alert-info::before {
            background: linear-gradient(180deg, #3b82f6 0%, #60a5fa 100%);
        }

    [data-theme="dark"] .assign-case-modal .alert-title {
        color: #dbeafe;
    }

    [data-theme="dark"] .assign-case-modal .alert-desc {
        color: #93c5fd;
    }

    [data-theme="dark"] .assign-case-modal .form-group label {
        color: #e5e7eb;
    }

    [data-theme="dark"] .assign-case-modal .select-wrapper select {
        background: #374151;
        border-color: #4b5563;
        color: #f3f4f6;
    }

    [data-theme="dark"] .assign-case-modal .modal-footer {
        background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
        border-top-color: #374151;
    }

        [data-theme="dark"] .assign-case-modal .modal-footer .btn-secondary {
            background: #374151;
            border-color: #4b5563;
            color: #d1d5db;
        }

.case-preview { padding: 1rem; background: #f8f9fa; border: 1px solid #e9ecef; border-radius: 8px; margin-top: 1rem; }
.case-preview .preview-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.case-preview .case-number { font-family: monospace; font-size: 0.85rem; padding: 0.25rem 0.5rem; background: #e9ecef; border-radius: 4px; }
.case-preview .case-StatusName { padding: 0.25rem 0.5rem; border-radius: 4px; font-size: 0.7rem; font-weight: 500; text-transform: uppercase; }
.case-preview .case-StatusName.StatusName-received { background: #cff4fc; color: #055160; }
.case-preview .case-StatusName.StatusName-inprogress { background: #fff3cd; color: #664d03; }
.case-preview .case-priority { padding: 0.25rem 0.5rem; border-radius: 4px; font-size: 0.7rem; font-weight: 500; }
.case-preview .case-priority.priority-critical { background: #f8d7da; color: #842029; }
.case-preview .case-priority.priority-high { background: #ffe5d0; color: #984c0c; }
.case-preview .case-priority.priority-normal { background: #cff4fc; color: #055160; }
.case-preview h4 { font-size: 0.95rem; font-weight: 600; color: #212529; margin: 0 0 0.5rem 0; }
.case-preview p { font-size: 0.85rem; color: #6c757d; margin: 0 0 0.75rem 0; }
.case-preview .preview-meta { display: flex; gap: 1.5rem; font-size: 0.75rem; color: #6c757d; }
.case-preview .preview-meta span { display: flex; align-items: center; gap: 0.375rem; }
.case-preview .preview-meta svg { width: 14px; height: 14px; }

.assign-case-modal .modal-footer { display: flex; justify-content: flex-end; gap: 0.75rem; padding: 1rem 1.5rem; border-top: 1px solid #e9ecef; }

/* Chat Agent Styles */
.chat-fab { position: fixed; bottom: 2rem; right: 2rem; width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, #e85a24, #d14d1a); border: none; color: #fff; box-shadow: 0 4px 20px rgba(232, 90, 36, 0.4); cursor: pointer; z-index: 1000; display: flex; align-items: center; justify-content: center; transition: all 0.3s ease; }
.chat-fab:hover { transform: scale(1.1); box-shadow: 0 6px 28px rgba(232, 90, 36, 0.5); }
.chat-fab.hidden { opacity: 0; pointer-events: none; transform: scale(0.8); }
.chat-fab svg { width: 28px; height: 28px; }
.fab-tooltip { position: absolute; right: 70px; background: #1a1f2e; color: #fff; padding: 0.5rem 0.75rem; border-radius: 6px; font-size: 0.8rem; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
.chat-fab:hover .fab-tooltip { opacity: 1; }
.fab-pulse { position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #e85a24; animation: fabPulse 2s infinite; }
@keyframes fabPulse { 0%, 100% { transform: scale(1); opacity: 0.5; } 50% { transform: scale(1.2); opacity: 0; } }
.minimized-indicator { display: flex; align-items: center; gap: 0.5rem; }
.minimized-indicator svg { width: 20px; height: 20px; }
.minimized-indicator span { font-size: 0.8rem; font-weight: 500; }

.chat-panel { position: fixed; bottom: 2rem; right: 2rem; width: 380px; height: 520px; background: #fff; border-radius: 16px; box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15); display: flex; flex-direction: column; z-index: 1001; overflow: hidden; animation: chatSlideUp 0.3s ease; }
@keyframes chatSlideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.chat-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem; background: linear-gradient(135deg, #1a1f2e, #0d1117); color: #fff; }
.chat-header .header-info { display: flex; align-items: center; gap: 0.75rem; }
.chat-header .agent-avatar { width: 40px; height: 40px; background: rgba(232, 90, 36, 0.2); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.chat-header .agent-avatar svg { width: 24px; height: 24px; color: #e85a24; }
.chat-header .header-text { display: flex; flex-direction: column; }
.chat-header .agent-name { font-weight: 600; font-size: 0.95rem; }
.chat-header .agent-StatusName { display: flex; align-items: center; gap: 0.375rem; font-size: 0.75rem; color: rgba(255, 255, 255, 0.7); }
.chat-header .StatusName-dot { width: 8px; height: 8px; background: #28a745; border-radius: 50%; }
.chat-header .header-actions { display: flex; gap: 0.25rem; }
.chat-header .header-btn { width: 32px; height: 32px; background: rgba(255, 255, 255, 0.1); border: none; border-radius: 6px; color: rgba(255, 255, 255, 0.7); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.chat-header .header-btn:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }
.chat-header .header-btn svg { width: 16px; height: 16px; }

.chat-messages { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 1rem; background: #f8f9fa; }
.message { display: flex; gap: 0.75rem; max-width: 85%; }
.message.user { margin-left: auto; flex-direction: row-reverse; }
.message-avatar { width: 32px; height: 32px; background: rgba(232, 90, 36, 0.15); border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.message-avatar svg { width: 18px; height: 18px; color: #e85a24; }
.message-content { background: #fff; padding: 0.75rem 1rem; border-radius: 12px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.message.user .message-content { background: #002d5c; color: #fff; }
.message-text { font-size: 0.9rem; line-height: 1.5; }
.message-text strong { font-weight: 600; }
.message-time { font-size: 0.65rem; color: #adb5bd; margin-top: 0.375rem; }
.message.user .message-time { color: rgba(255, 255, 255, 0.6); }

.typing-indicator { display: flex; gap: 0.25rem; padding: 0.25rem 0; }
.typing-indicator span { width: 8px; height: 8px; background: #adb5bd; border-radius: 50%; animation: typingBounce 1.4s infinite ease-in-out both; }
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes typingBounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

.chat-input { padding: 1rem; border-top: 1px solid #e9ecef; background: #fff; }
.input-wrapper { display: flex; gap: 0.5rem; }
.input-wrapper textarea { flex: 1; resize: none; border: 1px solid #dee2e6; border-radius: 20px; padding: 0.75rem 1rem; font-size: 0.9rem; font-family: inherit; }
.input-wrapper textarea:focus { outline: none; border-color: #002d5c; }
.send-btn { width: 40px; height: 40px; background: #e85a24; border: none; border-radius: 50%; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.send-btn:hover:not(:disabled) { background: #d14d1a; }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.send-btn svg { width: 18px; height: 18px; }
.input-hint { text-align: center; font-size: 0.7rem; color: #adb5bd; margin-top: 0.5rem; }

/* Fix form input stretching */
.case-modal-body .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

    .case-modal-body .form-group .select-wrapper {
        position: relative;
        min-height: 48px;
    }

        .case-modal-body .form-group .select-wrapper select {
            width: 100%;
            height: 48px;
            padding: 0 3rem 0 1rem;
            line-height: 44px;
            border: 2px solid #e5e7eb;
            border-radius: 12px;
            font-size: 0.95rem;
            background: #fff;
            transition: all 0.2s ease;
            color: #1f2937;
            appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 0.875rem center;
        }

    .case-modal-body .form-group input[type="text"],
    .case-modal-body .form-group input[type="email"] {
        height: 48px;
        padding: 0.875rem 1rem;
    }

    .case-modal-body .form-group textarea {
        min-height: 120px;
        resize: vertical;
    }

/* Autocomplete wrapper fixed height */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-input-wrapper {
    position: relative;
    height: 48px;
}

    .autocomplete-input-wrapper input {
        width: 100%;
        height: 100%;
        padding: 0.875rem 2.5rem 0.875rem 1rem;
        border: 2px solid #e5e7eb;
        border-radius: 12px;
        font-size: 0.95rem;
        transition: all 0.2s ease;
    }

/* Prevent layout shift with loading state */
.select-wrapper.loading,
.select-wrapper.disabled {
    min-height: 48px;
}

    .select-wrapper.loading select,
    .select-wrapper.disabled select {
        height: 48px;
    }

/* Selected badge should not affect layout */
.selected-badge {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #86efac;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #166534;
    z-index: 1;
}

/* Adjust form group to accommodate badge */
.case-modal-body .form-group:has(.selected-badge) {
    margin-bottom: 2.5rem;
}

/* Or if :has() not supported, add class manually */
.case-modal-body .form-group.has-badge {
    margin-bottom: 2.5rem;
}

/* Skeleton loading with fixed height */
.skeleton-select {
    height: 48px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Form grid consistent spacing */
.case-modal-body .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    position: relative;
    align-items: start; /* Prevent stretching */
}

.case-modal-body .form-column {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    align-self: start; /* Prevent stretching */
}

/* Loading overlay for form sections */
.form-section-loading {
    position: relative;
    min-height: 200px;
}

    .form-section-loading::after {
        content: '';
        position: absolute;
        inset: 0;
        background: rgba(255, 255, 255, 0.8);
        backdrop-filter: blur(2px);
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 5;
    }

/* Input spinner positioning */
.input-spinner {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid #e5e7eb;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Clear button positioning */
.clear-input-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    padding: 0;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

    .clear-input-btn:hover {
        background: #fee2e2;
        color: #dc2626;
    }

    .clear-input-btn svg {
        width: 14px;
        height: 14px;
    }

/* Dropdown positioning */
.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    z-index: 100;
    max-height: 280px;
    overflow: hidden;
}

/* Prevent body scroll when dropdown is open */
.autocomplete-wrapper.dropdown-open {
    z-index: 50;
}

/* ---- Alerts Agent case drafts (task 14) ---- */
.agent-draft-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px dashed #6f42c1;
    font-size: 0.75rem;
    font-weight: 600;
    background: #f3eefc;
    color: #5a32a3;
    cursor: pointer;
    white-space: nowrap;
}
.agent-draft-badge:hover { background: #e7dcfa; }
.agent-draft-panel { padding: 1rem; margin-bottom: 1.5rem; border: 1px solid rgba(111, 66, 193, 0.3); border-radius: 8px; background: rgba(111, 66, 193, 0.06); }
.agent-draft-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.agent-draft-title { font-weight: 600; color: #5a32a3; flex: 1; }
.agent-draft-confidence { font-size: 0.8rem; color: #6c757d; }
.agent-draft-discard { border: 1px solid #ced4da; background: transparent; border-radius: 4px; padding: 0.2rem 0.6rem; font-size: 0.8rem; cursor: pointer; color: #6c757d; }
.agent-draft-discard:hover { color: #b02a37; border-color: #b02a37; }
.agent-draft-summary { margin: 0 0 0.5rem; font-weight: 500; }
.agent-draft-line { margin: 0.25rem 0; font-size: 0.85rem; }
.agent-draft-evidence { margin: 0.25rem 0 0.5rem 1.1rem; padding: 0; font-size: 0.8rem; color: #495057; }
.agent-draft-note { margin: 0.5rem 0 0; font-size: 0.8rem; color: #6c757d; font-style: italic; }
.agent-draft-note.error { color: #b02a37; font-style: normal; }
[data-theme="dark"] .agent-draft-badge { background: rgba(111, 66, 193, 0.25); color: #d6c5f5; border-color: #9f7ae0; }
[data-theme="dark"] .agent-draft-panel { background: rgba(111, 66, 193, 0.12); border-color: rgba(159, 122, 224, 0.4); }
[data-theme="dark"] .agent-draft-title { color: #d6c5f5; }
[data-theme="dark"] .agent-draft-evidence, [data-theme="dark"] .agent-draft-confidence, [data-theme="dark"] .agent-draft-note { color: #adb5bd; }

/* ---- AI Agents page: agent nodes, Orchestrator and node panels ---- */
.agent-map {
    position: relative;
    height: 300px;
    margin: 0.5rem 0 2rem;
}
.agent-map-links {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}
.agent-map-link {
    fill: none;
    stroke: var(--text-muted);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}
.agent-map-link.live {
    stroke: var(--hso-accent);
    stroke-dasharray: 6 5;
    animation: agent-link-flow 1.2s linear infinite;
}
.agent-map-arrow { fill: var(--text-muted); }
.agent-map-arrow.live { fill: var(--hso-accent); }
@keyframes agent-link-flow { to { stroke-dashoffset: -22; } }

/* Positions match the SVG viewBox (1000 x 300): x as %, y as px. */
.agent-node {
    position: absolute;
    top: 20px;
    width: 28%;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0 1.5rem;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.agent-node-left { left: 3%; }
.agent-node-right { left: 69%; }
.agent-node:hover { border-color: var(--hso-primary-light); transform: translateY(-1px); }
.agent-node.selected { border-color: var(--hso-accent); box-shadow: 0 0 0 4px rgba(232, 90, 36, 0.15); }
.agent-node:focus-visible { outline: 2px solid var(--hso-primary); outline-offset: 3px; }
.agent-node-text { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; text-align: left; }
.agent-node-name { font-weight: 700; font-size: 0.95rem; }
.agent-node-sub { font-size: 0.75rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.agent-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-muted);
}
.agent-dot.on {
    background: #28a745;
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.6);
    animation: agent-dot-blink 1.4s ease-in-out infinite;
}
.agent-dot.on.warn { background: #f0ad4e; box-shadow: 0 0 0 0 rgba(240, 173, 78, 0.6); }
@keyframes agent-dot-blink {
    0%   { opacity: 1;    box-shadow: 0 0 0 0 currentColor; }
    50%  { opacity: 0.35; }
    70%  { box-shadow: 0 0 0 7px rgba(0, 0, 0, 0); }
    100% { opacity: 1;    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .agent-dot.on, .agent-map-link.live { animation: none; }
}

.agent-orchestrator {
    position: absolute;
    left: 36%;
    top: 190px;
    width: 28%;
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--hso-primary);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--hso-primary);
}
.agent-orchestrator-name { font-weight: 700; font-size: 1rem; letter-spacing: 0.02em; }
.agent-orchestrator-sub { font-size: 0.75rem; color: var(--text-secondary); }

.agent-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}
.agent-panel-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }
.agent-panel-header h2 { margin: 0 0 0.25rem; font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }
.agent-panel-header .subtitle { margin: 0; color: var(--text-secondary); font-size: 0.875rem; }
.agent-panel-header .header-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }
.agent-panel-hint {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    border: 1px dashed var(--border-color);
    border-radius: 12px;
}
.agent-panel-notice {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    border: 1px solid #f0ad4e;
    background: rgba(240, 173, 78, 0.1);
    font-size: 0.85rem;
}
.agent-panel-notice.error { border-color: #dc3545; background: rgba(220, 53, 69, 0.08); }
.agent-stats-row { grid-template-columns: repeat(4, 1fr); }
.agent-panel .ops-stat-card { background: var(--bg-tertiary); }

.agent-customer-toolbar { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.5rem; }
.agent-customer-toolbar .ops-input { max-width: 320px; }
.agent-customer-filter { display: flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; color: var(--text-secondary); margin: 0; white-space: nowrap; }
.agent-customer-count { margin-left: auto; font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }
.agent-customer-list { max-height: 480px; overflow-y: auto; padding-right: 0.25rem; }
.agent-customer-warn { color: #b26a00; }
.ops-toggle:disabled { opacity: 0.5; cursor: not-allowed; }

.agent-sev-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.35rem; }
.agent-sev-chip {
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
.agent-sev-chip.on { background: var(--hso-accent); border-color: var(--hso-accent); color: #fff; }
.agent-sev-chip:disabled { cursor: not-allowed; opacity: 0.6; }
.agent-updated { margin-top: 0.75rem; font-size: 0.75rem; color: var(--text-muted); }

[data-theme="dark"] .agent-node { box-shadow: none; }
[data-theme="dark"] .agent-node.selected { box-shadow: 0 0 0 4px rgba(255, 112, 67, 0.2); }
[data-theme="dark"] .agent-dot.on { background: #81c784; }
[data-theme="dark"] .agent-dot.on.warn { background: #ffb74d; }
[data-theme="dark"] .agent-customer-warn { color: #ffb74d; }
[data-theme="dark"] .agent-panel-notice { background: rgba(255, 183, 77, 0.08); }

/* Narrow screens: stack the nodes, drop the connectors. */
@media (max-width: 900px) {
    .agent-map { height: auto; display: flex; flex-direction: column; gap: 0.75rem; }
    .agent-map-links { display: none; }
    .agent-node, .agent-orchestrator { position: static; width: 100%; }
    .agent-node { border-radius: 40px; }
    .agent-stats-row { grid-template-columns: repeat(2, 1fr); }
    .agent-panel-header { flex-direction: column; }
}
