﻿/* ============================================
   EXELON APP - Premium Turquoise Theme
   ============================================ */

:root {
    /* Primary - Turquoise */
    --primary:          #00BCD4;
    --primary-dark:     #0097A7;
    --primary-darker:   #00838F;
    --primary-light:    #4DD0E1;
    --primary-lighter:  #B2EBF2;
    --primary-bg:       #E0F7FA;

    /* Accent */
    --accent:           #FF6D00;
    --accent-light:     #FF9E40;

    /* Glass / Subtle borders (notifications, tickets) */
    --glass-bg:         rgba(255,255,255,0.6);
    --border-subtle:    rgba(0,0,0,0.06);
    --exelon-primary:   #00BCD4;

    /* Neutrals */
    --bg:               #F5F7FA;
    --bg-card:          #FFFFFF;
    --bg-dark:          #0A1628;
    --bg-input:         #F0F2F5;
    --border:           #E2E8F0;
    --border-light:     #F1F5F9;

    /* Text */
    --text:             #1E293B;
    --text-secondary:   #64748B;
    --text-muted:       #94A3B8;
    --text-white:       #FFFFFF;
    --text-on-primary:  #FFFFFF;

    /* Status */
    --success:          #10B981;
    --success-bg:       #ECFDF5;
    --warning:          #F59E0B;
    --warning-bg:       #FFFBEB;
    --danger:           #EF4444;
    --danger-bg:        #FEF2F2;
    --info:             #3B82F6;
    --info-bg:          #EFF6FF;

    /* Shadows */
    --shadow-sm:    0 1px 2px rgba(0,0,0,0.05);
    --shadow:       0 2px 8px rgba(0,0,0,0.08);
    --shadow-md:    0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg:    0 8px 24px rgba(0,0,0,0.12);
    --shadow-xl:    0 12px 40px rgba(0,0,0,0.15);
    --shadow-primary: 0 4px 14px rgba(0,188,212,0.3);

    /* Sizing */
    --header-h:     56px;
    --bottom-nav-h: 64px;
    --sidebar-w:    260px;
    --offline-banner-h: 36px;
    --radius-sm:    8px;
    --radius:       12px;
    --radius-lg:    16px;
    --radius-xl:    24px;
    --radius-full:  9999px;

    /* Transitions */
    --transition:   all 0.2s ease;
    --transition-slow: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══════════ DARK MODE ═══════════ */
[data-theme="dark"] {
    --primary:          #22D3EE;
    --primary-dark:     #06B6D4;
    --primary-darker:   #0891B2;
    --primary-light:    #67E8F9;
    --primary-lighter:  #164E63;
    --primary-bg:       #164E63;

    --bg:               #0F172A;
    --bg-card:          #1E293B;
    --bg-dark:          #020617;
    --bg-input:         #334155;
    --border:           #334155;
    --border-light:     #1E293B;

    --text:             #F1F5F9;
    --text-secondary:   #94A3B8;
    --text-muted:       #64748B;
    --text-white:       #FFFFFF;
    --text-on-primary:  #0F172A;

    --success:          #34D399;
    --success-bg:       #064E3B;
    --warning:          #FBBF24;
    --warning-bg:       #451A03;
    --danger:           #F87171;
    --danger-bg:        #450A0A;
    --info:             #60A5FA;
    --info-bg:          #1E3A5F;

    --shadow-sm:    0 1px 2px rgba(0,0,0,0.3);
    --shadow:       0 2px 8px rgba(0,0,0,0.4);
    --shadow-md:    0 4px 12px rgba(0,0,0,0.5);
    --shadow-lg:    0 8px 24px rgba(0,0,0,0.5);
    --shadow-xl:    0 12px 40px rgba(0,0,0,0.6);
    --shadow-primary: 0 4px 14px rgba(34,211,238,0.2);

    --glass-bg:         rgba(30,41,59,0.6);
    --border-subtle:    rgba(255,255,255,0.08);
    --exelon-primary:   #22D3EE;

    color-scheme: dark;
}
[data-theme="dark"] .app-loader {
    background: linear-gradient(135deg, #020617 0%, #0F172A 100%);
}
[data-theme="dark"] .app-header {
    background: rgba(30, 41, 59, 0.95);
}
[data-theme="dark"] .app-header .logo-img {
    filter: brightness(0) invert(1);
}
[data-theme="dark"] .bottom-nav {
    background: rgba(30, 41, 59, 0.95);
}
[data-theme="dark"] .app-sidebar {
    background: var(--bg-card);
    border-color: var(--border);
}
[data-theme="dark"] .stat-card,
[data-theme="dark"] .card,
[data-theme="dark"] .list-card {
    background: var(--bg-card);
    border-color: var(--border);
}
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: var(--bg-input);
    color: var(--text);
    border-color: var(--border);
}
[data-theme="dark"] .dash-welcome {
    background: linear-gradient(135deg, #0891B2 0%, #0E7490 50%, #155E75 100%);
}

/* ─── Offline Banner ─── */
.offline-banner {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--offline-banner-h, 36px);
    z-index: 10000;
    background: var(--danger);
    color: white;
    padding: 0.5rem 1rem;
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    font-size: 0.85rem; font-weight: 600;
    animation: slideDown 0.3s ease;
}
.offline-queue-count {
    background: rgba(255,255,255,0.25);
    color: white;
    font-size: 0.7rem; font-weight: 700;
    min-width: 20px; height: 20px;
    padding: 0 6px;
    border-radius: var(--radius-full);
    display: inline-flex; align-items: center; justify-content: center;
}
/* ── PWA Install Banner ── */
#pwa-install-banner {
    position: fixed; bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
    left: 0; right: 0; z-index: 200;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 0.65rem 1rem;
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.12);
    animation: slideUp 0.3s ease;
}
.pwa-install-content { display: flex; align-items: center; gap: 0.75rem; flex: 1; min-width: 0; }
.pwa-install-icon { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; }
.pwa-install-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.pwa-install-text strong { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.pwa-install-text span { font-size: 0.75rem; color: var(--text-muted); }
.pwa-install-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.btn-pwa-install {
    padding: 0.45rem 1.1rem;
    background: var(--primary); color: white;
    border: none; border-radius: var(--radius);
    font-size: 0.82rem; font-weight: 700;
    cursor: pointer; transition: var(--transition);
}
.btn-pwa-install:hover { background: var(--primary-dark); }
.btn-pwa-dismiss {
    width: 32px; height: 32px; border-radius: var(--radius-full);
    background: var(--bg-input); border: none;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 1.1rem;
    cursor: pointer; transition: var(--transition);
}
.btn-pwa-dismiss:hover { background: var(--border); color: var(--text); }
@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* When offline, shift header and content down */
body.is-offline {
    --offline-shift: var(--offline-banner-h, 36px);
}
body.is-offline .app-header {
    top: calc(var(--offline-shift) + env(safe-area-inset-top, 0px));
}
body.is-offline .app-content {
    padding-top: calc(var(--header-h) + var(--offline-shift) + env(safe-area-inset-top, 0px) + 1rem);
}

/* ─── Theme Toggle ─── */
.theme-toggle {
    width: 40px; height: 40px;
    border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary); font-size: 1.25rem;
    transition: var(--transition);
    cursor: pointer;
}
.theme-toggle:hover {
    background: var(--bg-input); color: var(--primary);
}
[data-theme="dark"] .theme-toggle .ri-moon-line { display: none; }
[data-theme="dark"] .theme-toggle .ri-sun-line { display: inline; }
.theme-toggle .ri-sun-line { display: none; }
.theme-toggle .ri-moon-line { display: inline; }

/* ============ RESET ============ */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
}
html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    min-height: 100dvh;
    overscroll-behavior-y: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }
img { max-width: 100%; display: block; }

/* ============ LOADER ============ */
.app-loader {
    position: fixed; inset: 0; z-index: 9999;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #0D2137 100%);
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.4s ease;
}
.app-loader.hide { opacity: 0; pointer-events: none; }
.loader-content { text-align: center; }
.loader-logo { display: flex; align-items: center; justify-content: center; margin-bottom: 2rem; }
.loader-logo .logo-img { height: 44px; width: auto; }
.loader-spinner {
    width: 40px; height: 40px; margin: 0 auto 1rem;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.loader-text { color: var(--text-muted); font-size: 0.875rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ HEADER ============ */
.app-header {
    position: fixed; top: 0; left: 0; right: 0;
    height: calc(var(--header-h) + env(safe-area-inset-top, 0px)); z-index: 100;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: env(safe-area-inset-top, 0px) max(1rem, env(safe-area-inset-right, 0px)) 0 max(1rem, env(safe-area-inset-left, 0px));
    backdrop-filter: blur(10px);
}
.header-left, .header-right { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.header-btn {
    width: 44px; height: 44px; border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary); font-size: 1.25rem;
    transition: var(--transition);
    position: relative;
}
.header-btn:hover { background: var(--bg-input); color: var(--primary); }
.header-avatar {
    background: var(--primary-bg); color: var(--primary);
}
.header-logo { display: flex; align-items: center; }
.header-logo .logo-img { height: 26px; width: auto; }
.header-title {
    font-size: 1rem; font-weight: 600; color: var(--text);
    flex: 1; text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    min-width: 0; padding: 0 0.25rem;
}
.badge {
    position: absolute; top: 4px; right: 4px;
    min-width: 16px; height: 16px; padding: 0 4px;
    background: var(--danger); color: white;
    font-size: 0.625rem; font-weight: 700;
    border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
}
/* Inline badge variants override absolute positioning */
.badge-primary, .badge-success, .badge-warning, .badge-danger, .badge-info {
    position: static;
}

/* ============ MAIN CONTENT ============ */
.app-content {
    padding-top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 1rem);
    padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 1rem);
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
    min-height: 100vh;
    min-height: 100dvh;
}
.page { padding: 1rem; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ============ DASHBOARD ============ */

/* Welcome Hero */
.dash-welcome {
    position: relative; overflow: hidden;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 50%, var(--primary-darker) 100%);
    border-radius: var(--radius-xl);
    padding: 2rem 1.5rem;
    margin-bottom: 1.25rem;
    color: white;
    animation: dashSlideIn 0.5s ease-out;
}
.dash-welcome-bg {
    position: absolute; inset: 0; pointer-events: none;
}
.dash-welcome-bg::before {
    content: ''; position: absolute;
    top: -30%; right: -10%;
    width: 160px; height: 160px;
    border-radius: 50%;
    background: rgba(255,255,255,0.07);
    animation: floatBubble 8s ease-in-out infinite;
}
.dash-welcome-bg::after {
    content: ''; position: absolute;
    bottom: -40%; left: -8%;
    width: 120px; height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    animation: floatBubble 10s ease-in-out infinite reverse;
}
.dash-welcome-content {
    position: relative; z-index: 1;
    display: flex; align-items: center;
    justify-content: space-between; gap: 1rem;
}
.dash-welcome-sub {
    font-size: 0.72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 1.5px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 0.35rem;
    animation: dashFadeUp 0.6s ease-out 0.1s both;
}
.dash-welcome-title {
    font-size: 1.4rem; font-weight: 800;
    letter-spacing: -0.02em; line-height: 1.3;
    animation: dashFadeUp 0.6s ease-out 0.2s both;
}
.dash-welcome-desc {
    font-size: 0.8rem; color: rgba(255,255,255,0.7);
    margin-top: 0.5rem; line-height: 1.5;
    max-width: 320px;
    animation: dashFadeUp 0.6s ease-out 0.3s both;
}
.dash-welcome-avatar {
    width: 52px; height: 52px; min-width: 52px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    border: 2px solid rgba(255,255,255,0.3);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; font-weight: 700;
    cursor: pointer; transition: var(--transition);
    animation: dashFadeUp 0.6s ease-out 0.2s both;
}
.dash-welcome-avatar:hover {
    transform: scale(1.08);
    background: rgba(255,255,255,0.25);
}

@keyframes dashSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes dashFadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dashboard sections */
.dash-section {
    margin-bottom: 1.25rem;
    animation: dashFadeUp 0.5s ease-out both;
}

/* Stat Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.stat-card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 1.25rem; display: flex; flex-direction: column;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border-light);
    transition: var(--transition); cursor: pointer;
    position: relative; overflow: hidden;
    animation: statCardIn 0.4s ease-out calc(var(--i, 0) * 0.08s + 0.2s) both;
}
.stat-card::after {
    content: ''; position: absolute;
    top: 0; right: 0; width: 60px; height: 60px;
    border-radius: 0 0 0 60px;
    opacity: 0.04; pointer-events: none;
}
.stat-card:nth-child(1)::after { background: var(--primary); }
.stat-card:nth-child(2)::after { background: var(--success); }
.stat-card:nth-child(3)::after { background: var(--warning); }
.stat-card:nth-child(4)::after { background: var(--info); }
.stat-card:hover {
    box-shadow: var(--shadow-md); transform: translateY(-3px);
}
.stat-card:active { transform: translateY(-1px) scale(0.99); }
@keyframes statCardIn {
    from { opacity: 0; transform: translateY(16px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.stat-number {
    font-size: 1.85rem; font-weight: 800; color: var(--text);
    line-height: 1; font-variant-numeric: tabular-nums;
}
.stat-card .stat-label {
    font-size: 0.78rem; color: var(--text-muted); margin-top: 0.3rem;
    font-weight: 500;
}

/* ============ QUICK ACTIONS ============ */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}
.quick-action {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 1.15rem 0.5rem; text-align: center;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border-light);
    cursor: pointer; transition: var(--transition);
    display: flex; flex-direction: column;
    align-items: center; gap: 0.6rem;
    animation: statCardIn 0.4s ease-out calc(var(--i, 0) * 0.06s + 0.4s) both;
}
.qa-icon {
    width: 44px; height: 44px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; transition: var(--transition);
}
.qa-icon.primary { background: var(--primary-bg); color: var(--primary); }
.qa-icon.success { background: var(--success-bg); color: var(--success); }
.qa-icon.warning { background: var(--warning-bg); color: var(--warning); }
.qa-icon.info    { background: var(--info-bg);    color: var(--info);    }
.qa-label {
    font-size: 0.72rem; font-weight: 600; color: var(--text-secondary);
}
.quick-action:hover {
    box-shadow: var(--shadow-md); transform: translateY(-3px);
}
.quick-action:hover .qa-icon {
    transform: scale(1.1);
}
.quick-action:active { transform: scale(0.96); }

/* ============ DEVICE CARD ============ */
.device-card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 1rem 1.25rem; margin-bottom: 0.75rem;
    box-shadow: var(--shadow); border: 1px solid var(--border-light);
    display: flex; align-items: center; gap: 1rem;
    cursor: pointer; transition: var(--transition);
}
.device-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.device-card:active { transform: scale(0.98); }
.device-info { flex: 1; min-width: 0; }
.device-name {
    font-size: 0.9rem; font-weight: 700; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.device-meta {
    font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.badge-success {
    display: inline-block; padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem; font-weight: 600;
    background: var(--success-bg); color: var(--success);
}
.badge-warning {
    display: inline-block; padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem; font-weight: 600;
    background: var(--warning-bg); color: var(--warning);
}

/* ============ FAB (Floating Action Button) ============ */
.fab {
    position: fixed; bottom: calc(var(--bottom-nav-h) + 1.25rem);
    right: 1.25rem; z-index: 50;
    width: 56px; height: 56px; border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white; font-size: 1.5rem;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-primary);
    cursor: pointer; transition: var(--transition);
}
.fab:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(0,188,212,0.4); }
.fab:active { transform: scale(0.95); }

/* ============ LOADING SHIMMER ============ */
.loading-shimmer {
    background: linear-gradient(90deg, var(--bg-input) 25%, #E8ECF0 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}

/* ============ BOTTOM NAV ============ */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px)); z-index: 100;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-evenly;
    padding: 0 max(0.5rem, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(0.5rem, env(safe-area-inset-left, 0px));
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    overflow: visible;
}
.nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 8px 0; border-radius: var(--radius);
    color: var(--text-muted); font-size: 0.7rem; font-weight: 500;
    transition: var(--transition);
    position: relative;
    min-height: 44px; min-width: 44px;
    flex: 1; max-width: 72px;
}
.nav-item i { font-size: 1.35rem; }
.nav-item.active { color: var(--primary); }
.nav-item.active::after {
    content: ''; position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
    width: 20px; height: 3px; background: var(--primary);
    border-radius: 0 0 4px 4px;
}
.nav-ai {
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
    justify-content: flex-start;
    /* Make room for the icon that pops above the bar */
    overflow: visible;
}
.nav-ai > span {
    /* Hide the label — floating FAB-style buttons don't have labels */
    display: none;
}
.nav-ai-icon {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 56px; height: 56px; border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 16px rgba(16, 155, 164, 0.45);
    transition: var(--transition);
}
.nav-ai-icon i { font-size: 1.5rem; color: white; }
.nav-ai.active .nav-ai-icon {
    transform: translateX(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(16, 155, 164, 0.55);
}

/* ============ CARDS ============ */
.card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 1.25rem; margin-bottom: 1rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1rem;
}
.card-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.card-subtitle { font-size: 0.8rem; color: var(--text-secondary); }
.card-icon {
    width: 44px; height: 44px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
}
.card-icon.primary { background: var(--primary-bg); color: var(--primary); }
.card-icon.success { background: var(--success-bg); color: var(--success); }
.card-icon.warning { background: var(--warning-bg); color: var(--warning); }
.card-icon.danger  { background: var(--danger-bg);  color: var(--danger);  }
.card-icon.info    { background: var(--info-bg);     color: var(--info);    }

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.75rem 1.5rem; border-radius: var(--radius);
    font-weight: 600; font-size: 0.9rem;
    transition: var(--transition); border: none;
    cursor: pointer; white-space: nowrap;
}
.btn-block { width: 100%; }
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white; box-shadow: var(--shadow-primary);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,188,212,0.35); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-outline {
    background: transparent; color: var(--primary);
    border: 2px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-bg); }
.btn-secondary {
    background: var(--bg-input); color: var(--text);
}
.btn-secondary:hover { background: var(--border); }
.btn-danger {
    background: var(--danger); color: white;
}
.btn-danger:hover { background: #DC2626; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.8rem; }
.btn-lg { padding: 1rem 2rem; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: var(--radius-full); }

/* Loading state */
.btn.loading, .btn.btn-loading { pointer-events: none; position: relative; color: transparent; }
.btn.loading::after, .btn.btn-loading::after {
    content: ''; position: absolute;
    width: 20px; height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ============ FORMS ============ */
.form-group { margin-bottom: 1.25rem; }
.form-label {
    display: block; font-size: 0.8rem; font-weight: 600;
    color: var(--text-secondary); margin-bottom: 0.5rem;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.form-input {
    width: 100%; padding: 0.75rem 1rem;
    background: var(--bg-input); border: 2px solid transparent;
    border-radius: var(--radius); font-size: 1rem;
    color: var(--text); transition: var(--transition);
    outline: none;
}
.form-input:focus {
    border-color: var(--primary); background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(0,188,212,0.15);
}
.form-input.error { border-color: var(--danger); }
.form-input::placeholder { color: var(--text-muted); }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 0.25rem; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Select */
.form-select {
    width: 100%; padding: 0.75rem 2.5rem 0.75rem 1rem;
    background: var(--bg-input); border: 2px solid transparent;
    border-radius: var(--radius); font-size: 1rem;
    color: var(--text); transition: var(--transition);
    outline: none; cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748B' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
}
.form-select:focus {
    border-color: var(--primary); background-color: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(0,188,212,0.15);
}

/* Textarea */
.form-textarea {
    width: 100%; padding: 0.75rem 1rem;
    background: var(--bg-input); border: 2px solid transparent;
    border-radius: var(--radius); font-size: 1rem;
    color: var(--text); transition: var(--transition);
    outline: none; resize: vertical; min-height: 80px;
    font-family: inherit; line-height: 1.5;
}
.form-textarea:focus {
    border-color: var(--primary); background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(0,188,212,0.15);
}
.form-textarea::placeholder { color: var(--text-muted); }

/* Submit button (full-width form) */
.btn-form-submit {
    width: 100%; padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white; border: none; border-radius: var(--radius);
    font-size: 0.95rem; font-weight: 600;
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    cursor: pointer; transition: var(--transition);
    box-shadow: var(--shadow-primary);
}
.btn-form-submit:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,188,212,0.35); }
.btn-form-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.form-input-icon {
    position: relative;
}
.form-input-icon .form-input { padding-left: 2.75rem; }
.form-input-icon i {
    position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); font-size: 1.1rem;
}
.form-input-icon .form-input:focus ~ i,
.form-input-icon .form-input:focus + i { color: var(--primary); }

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748B' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* Toggle */
.toggle-group { display: flex; align-items: center; gap: 0.75rem; }
.toggle {
    width: 48px; height: 26px; border-radius: 13px;
    background: var(--border); position: relative;
    cursor: pointer; transition: var(--transition);
}
.toggle.active { background: var(--primary); }
.toggle::after {
    content: ''; position: absolute;
    width: 22px; height: 22px; border-radius: 50%;
    background: white; top: 2px; left: 2px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.toggle.active::after { transform: translateX(22px); }

/* ============ STEPPER (Registration) ============ */
.stepper {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 2rem; padding: 0 0.5rem;
}
.step {
    display: flex; flex-direction: column; align-items: center;
    position: relative; flex: 1;
}
.step-circle {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; font-weight: 700;
    background: var(--bg-input); color: var(--text-muted);
    border: 2px solid var(--border);
    transition: var(--transition);
    z-index: 1;
}
.step.active .step-circle {
    background: var(--primary); color: white;
    border-color: var(--primary);
    box-shadow: var(--shadow-primary);
}
.step.completed .step-circle {
    background: var(--success); color: white;
    border-color: var(--success);
}
.step-label {
    font-size: 0.6rem; font-weight: 500; color: var(--text-muted);
    margin-top: 0.4rem; text-align: center;
    max-width: 60px; line-height: 1.2;
}
.step.active .step-label { color: var(--primary); font-weight: 600; }
.step.completed .step-label { color: var(--success); }
.step-line {
    position: absolute; top: 18px; left: calc(50% + 20px);
    width: calc(100% - 40px); height: 2px;
    background: var(--border);
}
.step.completed .step-line { background: var(--success); }

/* ============ OTP INPUT ============ */
.otp-container {
    display: flex; gap: 0.75rem; justify-content: center;
    margin: 1.5rem 0;
}
.otp-input {
    width: 48px; height: 56px; text-align: center;
    font-size: 1.5rem; font-weight: 700;
    border: 2px solid var(--border); border-radius: var(--radius);
    background: var(--bg-input); color: var(--text);
    transition: var(--transition); outline: none;
}
.otp-input:focus {
    border-color: var(--primary); background: white;
    box-shadow: 0 0 0 3px rgba(0,188,212,0.15);
}
.otp-input.filled { border-color: var(--primary); background: var(--primary-bg); }

/* ============ LIST ITEMS ============ */
.list-item {
    display: flex; align-items: center; gap: 1rem;
    padding: 1rem; border-radius: var(--radius);
    transition: var(--transition); cursor: pointer;
}
.list-item:hover { background: var(--bg-input); }
.list-item + .list-item { border-top: 1px solid var(--border-light); }
.list-item-icon {
    width: 44px; height: 44px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; flex-shrink: 0;
}
.list-item-content { flex: 1; min-width: 0; }
.list-item-title { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.list-item-subtitle {
    font-size: 0.8rem; color: var(--text-secondary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.list-item-arrow { color: var(--text-muted); font-size: 1.1rem; }

/* ============ CHAT / AI ============ */
.chat-container {
    display: flex; flex-direction: column;
    height: calc(100dvh - var(--header-h) - var(--bottom-nav-h));
}
body.is-offline .chat-container {
    height: calc(100dvh - var(--header-h) - var(--bottom-nav-h) - var(--offline-shift, 0px));
}
.chat-messages {
    flex: 1; overflow-y: auto; padding: 1rem;
    display: flex; flex-direction: column; gap: 1rem;
}
.chat-bubble {
    max-width: 85%; padding: 0.875rem 1rem;
    border-radius: var(--radius-lg); line-height: 1.5;
    font-size: 0.9rem; word-wrap: break-word;
    animation: fadeIn 0.2s ease;
}
.chat-bubble.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white; border-bottom-right-radius: 4px;
}
.chat-bubble.assistant {
    align-self: flex-start;
    background: var(--bg-card); color: var(--text);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}
.chat-bubble .bubble-time {
    font-size: 0.65rem; opacity: 0.7; margin-top: 0.5rem;
    text-align: right;
}
.chat-bubble.assistant .bubble-actions {
    display: flex; gap: 0.5rem; margin-top: 0.75rem;
    padding-top: 0.5rem; border-top: 1px solid var(--border-light);
}
.bubble-action-btn {
    padding: 6px 10px; border-radius: 6px; font-size: 0.75rem;
    color: var(--text-muted); transition: var(--transition);
    display: flex; align-items: center; gap: 4px;
    min-height: 36px;
}
.bubble-action-btn:hover { background: var(--bg-input); color: var(--primary); }
.bubble-action-btn.liked { color: var(--success); }
.bubble-action-btn.disliked { color: var(--danger); }

.chat-input-area {
    padding: 0.5rem 0.5rem 0.5rem 0.75rem;
    margin: 0 0.75rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    display: flex; gap: 0.5rem; align-items: center;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
}
.chat-input {
    flex: 1; padding: 0.625rem 0.75rem;
    border: none; border-radius: var(--radius-full);
    background: transparent; font-size: 1rem;
    resize: none; max-height: 120px; min-height: 40px;
    outline: none; transition: var(--transition);
    font-family: inherit; color: var(--text);
}
.chat-input::placeholder { color: var(--text-muted); }
.chat-input:focus { background: transparent; }
.chat-send-btn {
    width: 44px; height: 44px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white; display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; flex-shrink: 0;
    transition: var(--transition);
    box-shadow: var(--shadow-primary);
}
.chat-send-btn:hover { transform: scale(1.05); }
.chat-send-btn:disabled { opacity: 0.5; transform: none; }

.chat-typing {
    display: flex; gap: 4px; padding: 0.5rem 1rem;
    align-self: flex-start;
}
.chat-typing span {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-muted);
    animation: typing 1.4s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* AI confidence badge */
.confidence-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: var(--radius-full);
    font-size: 0.65rem; font-weight: 600; margin-top: 6px;
}
.confidence-badge.high { background: var(--success-bg); color: var(--success); }
.confidence-badge.medium { background: var(--warning-bg); color: var(--warning); }
.confidence-badge.low { background: var(--danger-bg); color: var(--danger); }

/* ============ DEVICE EXTRAS ============ */
.device-icon {
    width: 52px; height: 52px; border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary-bg), var(--primary-lighter));
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; color: var(--primary);
}
.device-model { font-size: 0.8rem; color: var(--text-secondary); }
.device-serial { font-size: 0.7rem; color: var(--text-muted); font-family: monospace; }
.warranty-badge {
    padding: 4px 10px; border-radius: var(--radius-full);
    font-size: 0.7rem; font-weight: 600;
}
.warranty-badge.active { background: var(--success-bg); color: var(--success); }
.warranty-badge.expired { background: var(--danger-bg); color: var(--danger); }

/* ============ DETAIL CARD ============ */
.detail-card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 1.5rem; box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
}
.detail-header {
    display: flex; align-items: center; gap: 1rem;
    margin-bottom: 1.25rem; padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-light);
}
.detail-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.35rem; }
.detail-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
    margin-bottom: 1.25rem;
}
.detail-item { display: flex; flex-direction: column; gap: 0.15rem; }
.detail-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }
.detail-value { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.detail-actions {
    display: flex; flex-direction: column; gap: 0.75rem;
    padding-top: 1.25rem;
}
.detail-card .detail-actions {
    border-top: 1px solid var(--border-light);
}
.action-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem;
}
.action-row .btn {
    width: 100%; font-size: 0.85rem; padding: 0.65rem 1rem;
}
.card-icon.lg {
    width: 56px; height: 56px; border-radius: var(--radius-lg);
    font-size: 1.5rem;
}

/* ============ CHAT ITEM ============ */
.chat-item {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 0; margin-bottom: 0.75rem;
    box-shadow: var(--shadow); border: 1px solid var(--border-light);
    display: flex; align-items: center;
    transition: var(--transition); overflow: hidden;
}
.chat-item:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.chat-item-main {
    flex: 1; min-width: 0; display: flex; align-items: center; gap: 1rem;
    padding: 1rem 1.25rem; cursor: pointer;
}
.chat-item-actions {
    display: flex; gap: 0.25rem; padding: 0 0.75rem;
    flex-shrink: 0;
}
.chat-item-actions .btn-icon {
    width: 34px; height: 34px; border-radius: var(--radius);
    border: none; background: transparent; color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: var(--transition); font-size: 1rem;
}
.chat-item-actions .btn-icon:hover {
    background: var(--primary-bg); color: var(--primary);
}
.chat-item-actions .btn-icon.danger:hover {
    background: rgba(239,68,68,.1); color: #ef4444;
}
.chat-info { flex: 1; min-width: 0; }
.chat-title {
    font-size: 0.9rem; font-weight: 700; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-preview {
    font-size: 0.75rem; color: var(--text-secondary);
    margin-top: 2px; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}

/* ============ ACTIVITY LIST ============ */
.activity-list-card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    overflow: hidden; box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
}
.activity-item {
    display: flex; align-items: center; gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--bg-input); }
.activity-icon {
    width: 40px; height: 40px; border-radius: var(--radius);
    background: var(--primary-bg); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}
.activity-icon.success { background: var(--success-bg); color: var(--success); }
.activity-icon.warning { background: var(--warning-bg); color: var(--warning); }
.activity-icon.danger { background: var(--danger-bg); color: var(--danger); }
.activity-icon.info { background: var(--info-bg); color: var(--info); }
.activity-icon.primary { background: var(--primary-bg); color: var(--primary); }
.activity-info { flex: 1; min-width: 0; }
.activity-action {
    display: block; font-size: 0.9rem; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.activity-time {
    display: block; font-size: 0.75rem; color: var(--text-muted);
    margin-top: 3px;
}
/* ============ PROFILE ============ */
.profile-layout {
    display: flex; flex-direction: column;
}
.profile-header {
    text-align: center; padding: 2.5rem 1.5rem 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 50%, var(--primary-darker) 100%);
    border-radius: var(--radius-xl);
    color: white; margin-bottom: 1rem;
    position: relative; overflow: hidden;
    animation: profileFadeIn 0.6s ease-out;
}
.profile-header-bg {
    position: absolute; inset: 0; pointer-events: none;
}
.profile-header-bg::before {
    content: ''; position: absolute;
    top: -60%; right: -30%; width: 280px; height: 280px;
    border-radius: 50%; background: rgba(255,255,255,0.06);
    animation: floatBubble 8s ease-in-out infinite;
}
.profile-header-bg::after {
    content: ''; position: absolute;
    bottom: -40%; left: -20%; width: 200px; height: 200px;
    border-radius: 50%; background: rgba(255,255,255,0.04);
    animation: floatBubble 10s ease-in-out infinite reverse;
}
@keyframes floatBubble {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(15px, -20px) scale(1.08); }
}
@keyframes profileFadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes avatarPulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.15); opacity: 0; }
}
.profile-avatar-wrapper {
    position: relative; width: 88px; height: 88px;
    margin: 0 auto 1rem;
}
.profile-avatar-ring {
    position: absolute; inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    animation: avatarPulse 3s ease-in-out infinite;
}
.profile-avatar {
    width: 88px; height: 88px; border-radius: 50%;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; font-weight: 700;
    border: 3px solid rgba(255,255,255,0.35);
    letter-spacing: 1px;
    animation: profileFadeIn 0.8s ease-out 0.1s both;
}
.profile-name {
    font-size: 1.35rem; font-weight: 800;
    letter-spacing: -0.02em;
    animation: profileFadeIn 0.8s ease-out 0.2s both;
}
.profile-email {
    font-size: 0.82rem; color: rgba(255,255,255,0.8);
    margin-top: 0.25rem;
    animation: profileFadeIn 0.8s ease-out 0.3s both;
}
.profile-meta {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem;
    margin-top: 0.75rem;
    animation: profileFadeIn 0.8s ease-out 0.4s both;
}
.profile-meta-item {
    font-size: 0.75rem; color: rgba(255,255,255,0.7);
    display: inline-flex; align-items: center; gap: 0.3rem;
}
.profile-meta-item i { font-size: 0.85rem; opacity: 0.85; }
.profile-stats {
    display: flex; justify-content: center; gap: 2rem;
    margin-top: 1.25rem; padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.12);
}
.profile-stat { text-align: center; }
.profile-stat-value { font-size: 1.25rem; font-weight: 800; }
.profile-stat-label { font-size: 0.7rem; color: rgba(255,255,255,0.6); }

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center; padding: 3rem 2rem;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}
.empty-state .empty-icon {
    width: 72px; height: 72px; border-radius: 50%;
    background: var(--primary-bg);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 1rem;
}
.empty-state .empty-icon i {
    font-size: 1.75rem; color: var(--primary); opacity: 0.7;
}
.empty-state h3 {
    font-size: 1.05rem; font-weight: 700; margin-bottom: 0.35rem;
    color: var(--text);
}
.empty-state p {
    font-size: 0.85rem; color: var(--text-secondary);
    margin-bottom: 1.25rem; max-width: 280px;
    line-height: 1.5;
}
.empty-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.55rem 1.25rem;
    font-size: 0.8rem; font-weight: 600;
    color: var(--primary); background: transparent;
    border: 1.5px solid var(--primary);
    border-radius: var(--radius-full);
    cursor: pointer; transition: var(--transition);
    font-family: inherit;
}
.empty-btn i { font-size: 1rem; }
.empty-btn:hover {
    background: var(--primary); color: white;
}

/* ============ SECTION HEADER ============ */
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1rem;
}
.section-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.75rem; }
.section-link {
    font-size: 0.8rem; color: var(--primary); font-weight: 600;
    display: flex; align-items: center; gap: 4px;
}

/* ============ TABS ============ */
.tabs {
    display: flex; gap: 0; margin-bottom: 1rem;
    background: var(--bg-input); border-radius: var(--radius);
    padding: 4px;
}
.tab {
    flex: 1; padding: 0.6rem; text-align: center;
    font-size: 0.8rem; font-weight: 600;
    border-radius: calc(var(--radius) - 2px);
    color: var(--text-secondary);
    transition: var(--transition);
}
.tab.active {
    background: var(--bg-card); color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* ============ TOAST ============ */
.toast-container {
    position: fixed; top: calc(var(--header-h) + 0.5rem);
    right: 1rem;
    z-index: 9000; display: flex; flex-direction: column; gap: 0.5rem;
    width: calc(100% - 2rem); max-width: 400px;
}
.toast {
    padding: 0.875rem 1rem; border-radius: var(--radius);
    display: flex; align-items: center; gap: 0.75rem;
    font-size: 0.85rem; font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.3s ease;
}
.toast.success { background: var(--success); color: white; }
.toast.error   { background: var(--danger);  color: white; }
.toast.warning { background: var(--warning); color: var(--text); }
.toast.info    { background: var(--info);    color: white; }
.toast i { font-size: 1.2rem; }
.toast-close { margin-left: auto; opacity: 0.7; cursor: pointer; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ============ AUTH PAGES ============ */
.auth-container {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #0D2137 50%, var(--primary-darker) 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
}
.auth-card {
    width: 100%; max-width: 440px;
    background: var(--bg-card); border-radius: var(--radius-xl);
    padding: 2rem 1.5rem; box-shadow: var(--shadow-xl);
}
.auth-logo {
    text-align: center; display: flex; align-items: center; justify-content: center;
    margin-bottom: 0.5rem;
}
.auth-logo .logo-img { height: 38px; width: auto; }
.auth-subtitle {
    text-align: center; font-size: 0.85rem;
    color: var(--text-secondary); margin-bottom: 2rem;
}
.auth-divider {
    display: flex; align-items: center; gap: 1rem;
    margin: 1.5rem 0; color: var(--text-muted); font-size: 0.8rem;
}
.auth-divider::before, .auth-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}
.auth-link {
    text-align: center; font-size: 0.85rem;
    color: var(--text-secondary); margin-top: 1.5rem;
}
.auth-link a { color: var(--primary); font-weight: 600; }

/* ============ MISC ============ */
.tag {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: var(--radius-full);
    font-size: 0.7rem; font-weight: 600;
}
.tag.primary { background: var(--primary-bg); color: var(--primary-dark); }
.tag.success { background: var(--success-bg); color: var(--success); }
.tag.warning { background: var(--warning-bg); color: var(--warning); }
.tag.danger  { background: var(--danger-bg); color: var(--danger); }

.divider { height: 1px; background: var(--border); margin: 1rem 0; }

.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.7rem; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: 0.5rem; }
.d-flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }

/* Remember me checkbox */
.remember-me {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.85rem; color: var(--text-secondary); cursor: pointer;
    user-select: none;
}
.remember-me input[type="checkbox"] { display: none; }
.remember-me .remember-check {
    width: 18px; height: 18px; border-radius: 5px;
    border: 1.5px solid var(--border); background: var(--bg-secondary);
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; flex-shrink: 0;
}
.remember-me input:checked + .remember-check {
    background: var(--primary); border-color: transparent;
}
.remember-me input:checked + .remember-check::after {
    content: ''; width: 5px; height: 9px;
    border: solid #fff; border-width: 0 2px 2px 0;
    transform: rotate(45deg); margin-top: -2px;
}

.whatsapp-btn {
    background: #25D366; color: white;
    padding: 0.75rem 1.5rem; border-radius: var(--radius);
    font-weight: 600; display: inline-flex; align-items: center; gap: 0.5rem;
}
.whatsapp-btn:hover { background: #20BD5C; }

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 25%, #E8ECF0 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 20px; width: 60%; margin-bottom: 12px; }
.skeleton-circle { border-radius: 50%; }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* ============================================================
   PRODUCTS PAGE
   ============================================================ */

/* ── Sticky header bar ── */
.pl-top {
    position: sticky; top: 0; z-index: 30;
    background: var(--bg-app);
    padding-top: 0.5rem;
    margin-bottom: 1rem;
}

/* Search */
.pl-search-row { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.75rem; }
.pl-search-wrap {
    flex: 1; display: flex; align-items: center; gap: 0.5rem;
    background: var(--bg-card);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-full);
    padding: 0 0.85rem;
    transition: border-color .2s;
}
.pl-search-wrap:focus-within { border-color: var(--primary); }
.pl-search-icon { font-size: 0.95rem; color: var(--text-muted); flex-shrink: 0; }
.pl-search-input {
    flex: 1; padding: 0.65rem 0;
    border: none; outline: none; background: transparent;
    font-size: 0.875rem; color: var(--text); font-family: inherit;
}
.pl-search-input::placeholder { color: var(--text-muted); }
.pl-search-clear {
    width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 0.95rem; transition: color .2s;
}
.pl-search-clear:hover { color: var(--danger); }

/* View toggle */
.pl-view-toggle {
    display: flex; gap: 2px; flex-shrink: 0;
    background: var(--bg-card);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius); padding: 3px;
}
.pl-view-btn {
    width: 32px; height: 32px; border-radius: calc(var(--radius) - 2px);
    display: flex; align-items: center; justify-content: center;
    border: none; background: transparent; color: var(--text-muted);
    cursor: pointer; transition: .2s; font-size: 0.9rem;
}
.pl-view-btn.active { background: var(--primary); color: white; }

/* Filter tabs */
.pl-filter-row {
    display: flex; align-items: center; gap: 0.4rem;
    overflow-x: auto; scrollbar-width: none; padding-bottom: 0.1rem;
}
.pl-filter-row::-webkit-scrollbar { display: none; }
.pl-ftab {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.38rem 0.9rem; border-radius: var(--radius-full);
    font-size: 0.775rem; font-weight: 600; white-space: nowrap; flex-shrink: 0;
    background: transparent; color: var(--text-muted);
    border: 1.5px solid var(--border-light);
    cursor: pointer; transition: .2s;
}
.pl-ftab i { font-size: 0.8rem; }
.pl-ftab:hover { color: var(--text); border-color: var(--text-muted); }
.pl-ftab.active { background: var(--primary); color: white; border-color: var(--primary); }
.pl-filter-divider { width: 1px; height: 18px; background: var(--border-light); flex-shrink: 0; }
.pl-cat-chips { display: flex; gap: 0.35rem; }
.pl-cat {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.32rem 0.75rem; border-radius: var(--radius-full);
    font-size: 0.72rem; font-weight: 600; white-space: nowrap; flex-shrink: 0;
    background: transparent; color: var(--text-muted);
    border: 1.5px solid var(--border-light);
    cursor: pointer; transition: .2s;
}
.pl-cat:hover { color: var(--text); border-color: var(--text-muted); }
.pl-cat.active { background: var(--success); color: white; border-color: var(--success); }
.pl-cat-n { font-size: 0.6rem; opacity: .7; }

/* Results count */
.pl-results-bar {
    font-size: 0.72rem; color: var(--text-muted);
    text-align: right; margin-bottom: 0.75rem; padding-right: 0.25rem;
}

/* ── Grid ── */
#product-list.pl-grid, #product-list:not(.pl-list) {
    display: grid; grid-template-columns: repeat(2,1fr); gap: 0.75rem;
}
#product-list.pl-list { display: flex; flex-direction: column; gap: 0.5rem; }

/* ── Grid card (pc) ── */
.pc {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden; cursor: pointer;
    display: flex; flex-direction: column;
    transition: transform .18s, box-shadow .18s;
    animation: pcIn .3s ease-out calc(var(--i,0)*.04s) both;
}
.pc:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.pc:active { transform: scale(.97); }

/* image area */
.pc-img-wrap {
    aspect-ratio: 4/3; width: 100%;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-input);
    overflow: hidden;
}
.pc-img { width: 100%; height: 100%; object-fit: contain; padding: 0.5rem; }
.pc-icon {
    font-size: 2.4rem;
    color: var(--text-muted);
    opacity: .5;
}

/* body */
.pc-body {
    padding: 0.75rem 0.875rem;
    display: flex; flex-direction: column; gap: 0.2rem; flex: 1;
}
.pc-type {
    font-size: 0.6rem; font-weight: 700; letter-spacing: 0.7px;
    text-transform: uppercase; margin-bottom: 0.15rem;
}
.pc-type.inv { color: var(--primary); }
.pc-type.bat { color: var(--success); }
.pc-brand {
    font-size: 0.9rem; font-weight: 700; color: var(--text); line-height: 1.2;
}
.pc-model {
    font-size: 0.75rem; color: var(--text-muted); font-weight: 400;
}
.pc-bottom {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: auto; padding-top: 0.6rem;
    gap: 0.4rem;
}
.pc-spec {
    display: inline-flex; align-items: center; gap: 0.22rem;
    font-size: 0.72rem; color: var(--text-secondary); font-weight: 500;
}
.pc-spec i { font-size: 0.7rem; color: var(--text-muted); }
.pc-price {
    font-size: 0.88rem; font-weight: 700; color: var(--text); white-space: nowrap;
}
.pc-price.has-dsc { color: var(--primary); }

/* ── List row (pl-row) ── */
.pl-row {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 0.8rem 0.875rem;
    display: flex; align-items: center; gap: 0.75rem;
    cursor: pointer;
    transition: transform .18s, box-shadow .18s;
    animation: pcIn .3s ease-out calc(var(--i,0)*.03s) both;
}
.pl-row:hover { transform: translateX(3px); box-shadow: var(--shadow-sm); }
.pl-row:active { transform: scale(.99); }

.pl-row-thumb {
    width: 48px; height: 48px; min-width: 48px;
    border-radius: var(--radius); overflow: hidden;
    background: var(--bg-input);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; color: var(--text-muted);
}
.pl-row-img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }

.pl-row-body { flex: 1; min-width: 0; }
.pl-row-brand {
    font-size: 0.875rem; font-weight: 700; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pl-row-brand span { font-weight: 400; color: var(--text-muted); margin-left: 0.3rem; }
.pl-row-desc {
    font-size: 0.73rem; color: var(--text-muted); margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pl-row-foot {
    display: flex; align-items: center; gap: 0.5rem; margin-top: 0.35rem;
}
.pl-row-type {
    font-size: 0.62rem; font-weight: 700; letter-spacing: 0.5px;
    text-transform: uppercase; padding: 1px 7px;
    border-radius: var(--radius-full);
}
.pl-row-type.inv { background: var(--primary-bg); color: var(--primary); }
.pl-row-type.bat { background: var(--success-bg); color: var(--success); }
.pl-row-spec {
    font-size: 0.72rem; color: var(--text-muted);
    display: inline-flex; align-items: center; gap: 0.2rem;
}
.pl-row-spec i { font-size: 0.7rem; }

.pl-row-price {
    font-size: 0.875rem; font-weight: 700; color: var(--text);
    white-space: nowrap; flex-shrink: 0;
}
.pl-row-arr { font-size: 1.1rem; color: var(--text-muted); flex-shrink: 0; }
.pl-row:hover .pl-row-arr { color: var(--primary); }

/* ── Skeleton ── */
.pl-skel {
    background: var(--bg-card); border: 1px solid var(--border-light);
    border-radius: var(--radius-lg); overflow: hidden;
    animation: pcIn .3s ease-out calc(var(--i,0)*.05s) both;
}
.pl-skel-vis { height: 110px; background: var(--bg-input); }
.pl-skel-body { padding: 0.75rem; }
.sk-box, .sk-line {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-hover,var(--bg-app)) 50%, var(--bg-input) 75%);
    background-size: 200% 100%; animation: shimmer 1.4s infinite;
    border-radius: var(--radius-sm);
}
.sk-line { display: block; }

@keyframes pcIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0);    }
}

/* ============================================================
   (end products)
   ============================================================ */

/* ============ INSTALLATION STEPS ============ */

.install-step {
    display: flex; gap: 1rem; padding: 1.25rem;
    background: var(--bg-card); border-radius: var(--radius-lg);
    margin-bottom: 0.75rem; box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    transition: var(--transition);
}
.install-step:hover { box-shadow: var(--shadow-md); }
.step-number {
    width: 36px; height: 36px; border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white; font-weight: 800; font-size: 0.9rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.step-content { flex: 1; }
.step-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.35rem; }
.step-desc { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; }
.step-warning {
    display: flex; align-items: flex-start; gap: 0.5rem;
    margin-top: 0.75rem; padding: 0.75rem;
    background: var(--warning-bg); color: var(--warning);
    border-radius: var(--radius-sm); font-size: 0.8rem;
    font-weight: 500;
}

/* ============ FAULT CODES ============ */
.fault-card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 1.25rem; margin-bottom: 0.75rem;
    box-shadow: var(--shadow); border: 1px solid var(--border-light);
    border-left: 4px solid var(--info);
    transition: var(--transition);
}
.fault-card:hover { box-shadow: var(--shadow-md); }
.fault-card.warning { border-left-color: var(--warning); }
.fault-card.critical { border-left-color: var(--danger); }
.fault-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.5rem;
}
.fault-code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-weight: 800; font-size: 0.95rem; color: var(--primary-dark);
}
.fault-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.35rem; }
.fault-desc { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; }
.fault-solution {
    margin-top: 0.75rem; padding: 0.75rem;
    background: var(--success-bg); border-radius: var(--radius-sm);
    font-size: 0.85rem; color: var(--success); line-height: 1.5;
}

/* ============ PROFILE MENU ============ */
.profile-menu {
    background: var(--bg-card); border-radius: var(--radius-lg);
    overflow: hidden; box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
}
.menu-item {
    display: flex; align-items: center; gap: 1rem;
    padding: 1rem 1.25rem; cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-light);
}
.menu-item:last-child { border-bottom: none; }
.menu-item:hover { background: var(--bg-input); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-bg); }
.menu-icon {
    width: 40px; height: 40px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem; flex-shrink: 0;
}
.menu-icon.primary { background: var(--primary-bg); color: var(--primary); }
.menu-icon.warning { background: var(--warning-bg); color: var(--warning); }
.menu-icon.info { background: var(--info-bg); color: var(--info); }
.menu-icon.success { background: var(--success-bg); color: var(--success); }
.menu-icon.danger { background: var(--danger-bg); color: var(--danger); }
.menu-label { flex: 1; font-weight: 600; font-size: 0.9rem; }
.menu-item > i:last-child { color: var(--text-muted); font-size: 1.1rem; }

/* ============ CHAT WELCOME ============ */
.chat-welcome {
    text-align: center; padding: 3rem 2rem;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    flex: 1;
}
.chat-welcome h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.5rem; }
.chat-welcome p { max-width: 280px; }

/* ============ AI AVATAR ============ */
.ai-avatar {
    width: 28px; height: 28px; border-radius: var(--radius-full);
    background: var(--primary-bg); color: var(--primary);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.85rem; margin-bottom: 0.35rem; flex-shrink: 0;
}

/* ============ BADGE VARIANTS ============ */
.badge-primary {
    display: inline-block; padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem; font-weight: 600;
    background: var(--primary-bg); color: var(--primary-dark);
}
.badge-danger {
    display: inline-block; padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem; font-weight: 600;
    background: var(--danger-bg); color: var(--danger);
}
.badge-info {
    display: inline-block; padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem; font-weight: 600;
    background: var(--info-bg); color: var(--info);
}

/* ============ FORM CARD ============ */
.form-card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 1.75rem 1.5rem; box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    max-width: 560px;
}
.form-card .form-title {
    font-size: 1.15rem; font-weight: 700; color: var(--text);
    margin-bottom: 0.25rem;
}
.form-card .form-subtitle {
    font-size: 0.8rem; color: var(--text-secondary);
    margin-bottom: 1.5rem;
}
.form-section {
    margin-bottom: 1.5rem;
}
.form-section-title {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.8rem; font-weight: 700; color: var(--primary-dark);
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 1rem; padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-bg);
}
.form-section-title i { font-size: 1rem; color: var(--primary); }
.form-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

/* Password toggle */
.password-wrapper {
    position: relative;
}
.password-wrapper .form-input { padding-right: 3rem; }
.password-toggle {
    position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%);
    width: 44px; height: 44px; border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 1.1rem;
    cursor: pointer; transition: var(--transition);
    background: none; border: none;
}
.password-toggle:hover { color: var(--primary); background: var(--primary-bg); }

/* Stat card with icon */
.stat-card .stat-icon {
    width: 40px; height: 40px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem; margin-bottom: 0.75rem;
}
.stat-card .stat-icon.primary { background: var(--primary-bg); color: var(--primary); }
.stat-card .stat-icon.success { background: var(--success-bg); color: var(--success); }
.stat-card .stat-icon.warning { background: var(--warning-bg); color: var(--warning); }
.stat-card .stat-icon.danger { background: var(--danger-bg); color: var(--danger); }
.stat-card .stat-icon.info { background: var(--info-bg); color: var(--info); }

/* ============ CUSTOM MODAL ============ */
.modal-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    padding: 1rem; animation: modalFadeIn 0.2s ease;
    backdrop-filter: blur(4px);
}
.modal-card {
    background: var(--bg-card); border-radius: var(--radius-xl);
    padding: 2rem 2rem 1.75rem; max-width: 380px; width: 100%;
    box-shadow: var(--shadow-xl);
    animation: modalScaleIn 0.25s ease;
    text-align: center;
}
.modal-icon {
    width: 56px; height: 56px; border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1rem; font-size: 1.5rem;
}
.modal-icon.warning { background: var(--warning-bg); color: var(--warning); }
.modal-icon.danger { background: var(--danger-bg); color: var(--danger); }
.modal-icon.info { background: var(--info-bg); color: var(--info); }
.modal-icon.success { background: var(--success-bg); color: var(--success); }
.modal-title {
    font-size: 1.1rem; font-weight: 700; color: var(--text);
    margin-bottom: 0.5rem;
}
.modal-message {
    font-size: 0.85rem; color: var(--text-secondary);
    line-height: 1.5; margin-bottom: 1.25rem;
}
.modal-actions {
    display: flex; gap: 0.75rem; margin-top: 1.5rem;
}
.modal-actions .btn { flex: 1; }
.modal-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(6,182,212,.15); }
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalScaleIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

/* ============ PRODUCT DETAIL ============ */
.pd-hero {
    position: relative; overflow: hidden;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 50%, var(--primary-darker) 100%);
    border-radius: var(--radius-xl);
    padding: 2rem 1.5rem; color: white;
    margin-bottom: 1.25rem;
    animation: dashSlideIn 0.5s ease-out;
}
.pd-hero-bg {
    position: absolute; inset: 0; pointer-events: none;
}
.pd-hero-bg::before {
    content: ''; position: absolute;
    top: -50%; right: -20%;
    width: 280px; height: 280px; border-radius: 50%;
    background: rgba(255,255,255,0.06);
    animation: floatBubble 8s ease-in-out infinite;
}
.pd-hero-bg::after {
    content: ''; position: absolute;
    bottom: -60%; left: -15%;
    width: 200px; height: 200px; border-radius: 50%;
    background: rgba(255,255,255,0.04);
    animation: floatBubble 10s ease-in-out infinite reverse;
}
.pd-hero-content {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; align-items: center;
    text-align: center;
}
.pd-hero-visual {
    margin-bottom: 1.25rem;
    animation: dashFadeUp 0.6s ease-out 0.1s both;
}
.pd-hero-img {
    width: 120px; height: 120px; object-fit: contain;
    filter: drop-shadow(0 8px 24px rgba(0,0,0,0.2));
    border-radius: var(--radius-lg);
}
.pd-hero-icon {
    width: 80px; height: 80px; border-radius: var(--radius-xl);
    display: flex; align-items: center; justify-content: center;
    font-size: 2.25rem;
    border: 2px solid rgba(255,255,255,0.2);
}
.pd-hero-icon.primary { background: rgba(255,255,255,0.12); }
.pd-hero-icon.success { background: rgba(255,255,255,0.12); }
.pd-hero-info {
    animation: dashFadeUp 0.6s ease-out 0.2s both;
}
.pd-type-badge {
    display: inline-block; padding: 4px 14px;
    border-radius: var(--radius-full);
    font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(4px);
    margin-bottom: 0.5rem;
}
.pd-title {
    font-size: 1.5rem; font-weight: 800;
    letter-spacing: -0.02em; line-height: 1.2;
}
.pd-desc {
    font-size: 0.85rem; color: rgba(255,255,255,0.75);
    margin-top: 0.5rem; line-height: 1.5;
    max-width: 400px; margin-left: auto; margin-right: auto;
}

/* Product detail sections */
.pd-section {
    margin-bottom: 1.25rem;
    animation: dashFadeUp 0.5s ease-out var(--delay, 0s) both;
}
.pd-section-header {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.82rem; font-weight: 700; color: var(--primary-dark);
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 0.85rem; padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-bg);
}
.pd-section-header i { font-size: 1rem; color: var(--primary); }

/* Specs grid */
.specs-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem;
}
.spec-card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 1.15rem 1rem; text-align: center;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border-light);
    transition: var(--transition);
    animation: statCardIn 0.35s ease-out calc(var(--i, 0) * 0.06s + 0.2s) both;
}
.spec-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.spec-icon {
    width: 36px; height: 36px; border-radius: var(--radius);
    background: var(--primary-bg); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 0.6rem; font-size: 1rem;
}
.spec-card .spec-value {
    font-size: 1.15rem; font-weight: 800; color: var(--text);
}
.spec-card .spec-label {
    font-size: 0.68rem; color: var(--text-muted); margin-top: 0.2rem;
    text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
}

/* Product detail action cards */
.pd-actions {
    display: flex; flex-direction: column; gap: 0.5rem;
}
.pd-action-card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border-light);
    display: flex; align-items: center; gap: 1rem;
    cursor: pointer; transition: var(--transition);
}
.pd-action-card:hover { box-shadow: var(--shadow-md); transform: translateX(4px); }
.pd-action-card:active { transform: scale(0.99); }
.pd-action-icon {
    width: 44px; height: 44px; min-width: 44px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
}
.pd-action-icon.primary { background: var(--primary-bg); color: var(--primary); }
.pd-action-icon.warning { background: var(--warning-bg); color: var(--warning); }
.pd-action-info { flex: 1; }
.pd-action-info h4 { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.pd-action-info p { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.pd-action-card > i {
    color: var(--text-muted); font-size: 1.2rem;
    transition: var(--transition);
}
.pd-action-card:hover > i { color: var(--primary); transform: translateX(3px); }

/* ============ NOTIFICATION PAGE ============ */
.notification-item {
    display: flex; align-items: flex-start; gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}
.notification-item:last-child { border-bottom: none; }
.notification-item.unread { background: var(--primary-bg); }
.notification-icon {
    width: 40px; height: 40px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}
.notification-content { flex: 1; }
.notification-title { font-weight: 600; font-size: 0.9rem; color: var(--text); margin-bottom: 2px; }
.notification-body { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.4; }
.notification-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }

/* ============ FORM BUTTONS GROUP ============ */
.form-buttons {
    display: flex; gap: 0.75rem; margin-top: 0.5rem;
    justify-content: flex-end;
}
.form-buttons .btn { min-width: 140px; }

/* ============ SKELETON VARIANTS ============ */
.stat-skeleton { height: 80px; }
.card-skeleton { height: 72px; }

/* ============ CSS CLASS ALIASES (JS ↔ CSS compat) ============ */
.chat-bubble.ai {
    align-self: flex-start;
    background: var(--bg-card); color: var(--text);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}
.chat-textarea {
    flex: 1; padding: 0.625rem 0.25rem;
    border: none;
    background: transparent; font-size: 0.9rem;
    resize: none; max-height: 120px; min-height: 38px;
    outline: none; transition: var(--transition);
    color: var(--text);
}
.chat-textarea::placeholder { color: var(--text-muted); }
.chat-textarea:focus { background: transparent; }
.chat-send {
    width: 42px; height: 42px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white; display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; flex-shrink: 0;
    transition: var(--transition);
    box-shadow: var(--shadow-primary);
}
.chat-send:hover { transform: scale(1.05); }
.chat-send:disabled { opacity: 0.5; transform: none; }
.typing-indicator {
    display: flex; gap: 4px; padding: 0.875rem 1rem;
}
.typing-indicator span {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-muted);
    animation: typing 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
.bubble-content { line-height: 1.6; word-wrap: break-word; }
.bubble-feedback {
    display: flex; gap: 0.5rem; margin-top: 0.75rem;
    padding-top: 0.5rem; border-top: 1px solid var(--border-light);
}
.bubble-feedback button {
    padding: 4px 8px; border-radius: 6px; font-size: 0.85rem;
    color: var(--text-muted); transition: var(--transition);
    display: flex; align-items: center; gap: 4px;
}
.bubble-feedback button:hover { background: var(--bg-input); color: var(--primary); }
.bubble-feedback button.active { background: var(--primary); color: #fff; border-radius: 6px; }
.bubble-feedback button.active i { font-weight: 700; }

/* ── Quick Reply Chips ── */
.chat-quick-replies {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 0.5rem; margin-top: 1.25rem; padding: 0 0.5rem;
}
.chat-chip {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.5rem 1rem; border-radius: 20px;
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text); font-size: 0.8rem; font-weight: 500;
    cursor: pointer; transition: all .18s;
    white-space: nowrap;
}
.chat-chip:hover {
    background: var(--primary); color: #fff;
    border-color: var(--primary); transform: translateY(-1px);
}
.chat-chip i { font-size: 0.85rem; }

/* ── Photo Attach Button ── */
.chat-attach-btn {
    width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; color: var(--text-muted);
    background: var(--bg-input); border: 1px solid var(--border);
    transition: all .18s;
}
.chat-attach-btn:hover { color: var(--primary); border-color: var(--primary); background: rgba(0,188,212,.08); }
.chat-attach-btn.has-image { color: var(--primary); border-color: var(--primary); background: rgba(0,188,212,.12); }

/* ── Image Preview Bar ── */
.chat-img-preview-bar {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.5rem 1rem;
    background: var(--bg-input); border-top: 1px solid var(--border);
    animation: slideUp .2s ease;
}
.chat-preview-thumb {
    width: 44px; height: 44px; border-radius: 8px;
    object-fit: cover; border: 1px solid var(--border); flex-shrink: 0;
}
.chat-preview-name {
    flex: 1; font-size: 0.78rem; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-preview-clear {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; color: var(--text-muted); background: var(--bg-card);
    border: 1px solid var(--border); transition: all .15s;
}
.chat-preview-clear:hover { color: var(--danger); border-color: var(--danger); }

/* ── User Image in Bubble ── */
.chat-user-img {
    display: block; max-width: 240px; max-height: 200px;
    border-radius: 10px; margin-bottom: 0.5rem;
    object-fit: cover; border: 1px solid var(--border);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============ SIDEBAR (Desktop) ============ */
.app-sidebar {
    display: none;
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w); z-index: 200;
    background: linear-gradient(180deg, var(--bg-dark) 0%, #0D2137 100%);
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.06);
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    overflow-y: auto;
}
.app-sidebar.auth-hidden { display: none !important; }
.sidebar-logo {
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex; align-items: center;
}
.sidebar-logo .logo-img { height: 30px; width: auto; }
.sidebar-nav {
    flex: 1; padding: 1rem 0.75rem;
    display: flex; flex-direction: column; gap: 0.25rem;
}
.sidebar-item {
    position: relative;
    display: flex; align-items: center; gap: 0.875rem;
    padding: 0.75rem 1rem; border-radius: var(--radius);
    color: rgba(255,255,255,0.55); font-size: 0.9rem; font-weight: 500;
    transition: var(--transition); text-decoration: none;
}
.sidebar-item i { font-size: 1.25rem; width: 24px; text-align: center; }
.sidebar-item:hover {
    background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.85);
}
.sidebar-item.active {
    background: rgba(0,188,212,0.15); color: var(--primary-light);
    font-weight: 600;
}
.sidebar-item.active::before {
    content: ''; position: absolute; left: -0.75rem; top: 50%; transform: translateY(-50%);
    width: 3px; height: 60%; background: var(--primary);
    border-radius: 0 4px 4px 0;
}
.sidebar-divider {
    height: 1px; background: rgba(255,255,255,0.06);
    margin: 0.5rem 0.75rem;
}
.sidebar-section-label {
    padding: 0.5rem 1rem; font-size: 0.65rem; font-weight: 700;
    color: rgba(255,255,255,0.3); text-transform: uppercase;
    letter-spacing: 1px;
}
.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* Admin Panel Link */
.sidebar-admin-btn {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; margin-bottom: 12px; border-radius: 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(99, 102, 241, 0.25);
    cursor: pointer; transition: all 0.25s; text-decoration: none;
}
.sidebar-admin-btn:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.18));
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.2);
}
.sidebar-admin-icon {
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; color: #fff; flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.sidebar-admin-text { flex: 1; display: flex; flex-direction: column; }
.sidebar-admin-title {
    font-size: 0.82rem; font-weight: 700; color: rgba(255,255,255,0.9);
}
.sidebar-admin-desc {
    font-size: 0.68rem; color: rgba(255,255,255,0.4);
}
.sidebar-admin-arrow {
    font-size: 1rem; color: rgba(255,255,255,0.3);
    transition: all 0.2s;
}
.sidebar-admin-btn:hover .sidebar-admin-arrow {
    color: rgba(255,255,255,0.7);
    transform: translate(2px, -2px);
}

.sidebar-user {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem; border-radius: var(--radius);
    cursor: pointer; transition: var(--transition);
}
.sidebar-user:hover { background: rgba(255,255,255,0.06); }
.sidebar-avatar {
    width: 36px; height: 36px; border-radius: var(--radius-full);
    background: rgba(0,188,212,0.2); color: var(--primary-light);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.82rem; font-weight: 700; letter-spacing: 0.5px;
}
.sidebar-user-info { display: flex; flex-direction: column; }
.sidebar-username { font-size: 0.85rem; font-weight: 600; color: rgba(255,255,255,0.85); }
.sidebar-role { font-size: 0.7rem; color: rgba(255,255,255,0.4); }
.sidebar-role.role-admin {
    color: #a78bfa; font-weight: 600;
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* ── Mobile Header & Nav (≤480px) ── */
@media (max-width: 480px) {
    .app-header {
        padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
        padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
    }
    .header-left, .header-right { gap: 0.25rem; }
    .header-logo .logo-img { height: 22px; }
    .header-title { font-size: 0.875rem; }
    .header-btn { width: 38px; height: 38px; font-size: 1.15rem; }
}

/* ── Small Mobile (≤374px) ── */
@media (max-width: 374px) {
    .quick-actions { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .products-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .otp-container { gap: 0.5rem; }
    .otp-input { width: 40px; height: 48px; font-size: 1.25rem; }
    .filter-tabs { gap: 0.35rem; }
    .filter-tab { padding: 0.4rem 1rem; font-size: 0.75rem; }
    .action-row { grid-template-columns: 1fr; }
    .form-buttons { flex-direction: column; }
    .form-buttons .btn { width: 100%; min-width: auto; }

    /* Tighter bottom nav on very narrow screens */
    .nav-item { padding: 6px 6px; font-size: 0.6rem; min-width: 38px; }
    .nav-item i { font-size: 1.15rem; }
    .nav-ai-icon { width: 46px; height: 46px; top: -16px; }
    .nav-ai-icon i { font-size: 1.3rem; }
    .header-title { font-size: 0.8rem; }
    .header-btn { width: 36px; height: 36px; font-size: 1.1rem; }
}

/* ── Tablet (768px – 1023px) ── */
@media (min-width: 768px) {
    :root { --header-h: 64px; }

    .app-content {
        padding-left: 1.5rem; padding-right: 1.5rem;
    }

    .auth-card {
        padding: 2.5rem 2rem;
        max-width: 480px;
    }

    .dashboard-grid { grid-template-columns: repeat(4, 1fr); }
    .products-grid { grid-template-columns: repeat(3, 1fr); }
    .quick-actions { gap: 1rem; }
    .detail-grid { grid-template-columns: repeat(3, 1fr); }

    .stat-card { padding: 1.5rem; }
    .stat-number { font-size: 2.25rem; }
    .dash-welcome { padding: 2.5rem 2rem; }
    .dash-welcome-title { font-size: 1.65rem; }
    .dash-welcome-avatar { width: 60px; height: 60px; min-width: 60px; font-size: 1.5rem; }

    .device-card, .pcard, .plist-item, .chat-item, .install-step, .fault-card {
        padding: 1.25rem 1.5rem;
    }

    .profile-header { padding: 2.5rem 2rem; }
    .profile-avatar-wrapper { width: 100px; height: 100px; }
    .profile-avatar { width: 100px; height: 100px; font-size: 2.5rem; }

    .profile-layout { display: flex; flex-direction: row; gap: 1.5rem; align-items: flex-start; }
    .profile-layout .profile-header {
        flex: 0 0 300px; margin-bottom: 0;
        position: sticky; top: calc(var(--header-h) + 1.5rem);
    }
    .profile-layout .profile-menu { flex: 1; max-width: none; margin: 0; }
}

/* ── Desktop (≥1024px) ── */
@media (min-width: 1024px) {
    /* Sidebar visible, bottom nav hidden */
    .app-sidebar { display: flex; }
    .bottom-nav { display: none !important; }

    /* PWA install banner → compact bottom-right card on desktop */
    #pwa-install-banner {
        left: auto; right: 1.5rem; bottom: 1.5rem;
        width: 320px;
        border-top: none;
        border: 1px solid var(--border);
        border-radius: var(--radius-xl);
        box-shadow: var(--shadow-md);
    }

    .app-header {
        left: var(--sidebar-w);
    }

    #header-logo { display: none !important; }
    .header-title {
        position: static; transform: none;
    }

    .app-content {
        margin-left: var(--sidebar-w);
        max-width: none;
        padding: calc(var(--header-h) + 2rem) 2.5rem 2rem;
    }
    body.is-offline .app-content {
        padding-top: calc(var(--header-h) + var(--offline-shift, 0px) + 2rem);
    }

    /* FAB position adjustment */
    .fab {
        bottom: 2rem; right: 2rem;
    }

    /* Grids */
    .dashboard-grid { grid-template-columns: repeat(4, 1fr); gap: 1rem; }
    .quick-actions { grid-template-columns: repeat(4, 1fr); gap: 1rem; }
    .products-grid { grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }

    /* Enhanced hover effects */
    .stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
    .device-card:hover, .pcard:hover, .chat-item:hover {
        transform: translateY(-2px); box-shadow: var(--shadow-lg);
    }
    .quick-action:hover { transform: translateY(-4px); }

    /* Dashboard desktop enhancements */
    .dash-welcome { padding: 2.5rem; border-radius: var(--radius-xl); }
    .dash-welcome-title { font-size: 1.75rem; }
    .dash-welcome-desc { max-width: 420px; }
    .dash-welcome-avatar { width: 64px; height: 64px; min-width: 64px; font-size: 1.6rem; }
    .stat-card { padding: 1.75rem; }
    .stat-number { font-size: 2.5rem; }
    .qa-icon { width: 48px; height: 48px; font-size: 1.35rem; }
    .qa-label { font-size: 0.8rem; }

    /* Product detail desktop */
    .pd-hero { border-radius: var(--radius-xl); padding: 2.5rem 2rem; }
    .pd-hero-content { flex-direction: row; text-align: left; gap: 2rem; }
    .pd-hero-visual { margin-bottom: 0; }
    .pd-hero-img { width: 160px; height: 160px; }
    .pd-hero-icon { width: 100px; height: 100px; font-size: 2.75rem; }
    .pd-title { font-size: 1.75rem; }
    .pd-desc { margin-left: 0; }
    .specs-grid { grid-template-columns: repeat(4, 1fr); }
    .pd-actions { flex-direction: row; gap: 0.75rem; }
    .pd-action-card { flex: 1; }
    .pcard-visual { height: 140px; }
    .pcard-body { padding: 1rem 1.15rem; }

    /* Full-width content */
    .detail-card { max-width: none; }
    .detail-grid { grid-template-columns: repeat(3, 1fr); }

    /* Chat room - full width */
    .chat-container {
        max-width: none;
        height: calc(100dvh - var(--header-h) - 2rem);
    }
    .chat-bubble { max-width: 65%; }

    /* Profile - full width */
    .profile-menu { max-width: none; }
    .profile-header { max-width: none; margin: 0; }
    .profile-layout { max-width: none; }
    .profile-layout .profile-header { flex: 0 0 320px; }

    /* Forms - full width */
    .auth-card { max-width: 520px; margin: 0 auto; }
    .form-card { max-width: none; }
    .form-row { grid-template-columns: 1fr 1fr; }

    /* Installation & faults - full width */
    .install-step, .fault-card { max-width: none; }

    /* Activity - full width */
    .activity-list-card { max-width: none; }

    /* Product hero - full width */
    .pd-hero { max-width: none; }
    .specs-grid { max-width: none; }
}

/* ── Large Desktop (≥1440px) ── */
@media (min-width: 1440px) {
    .app-content { padding-left: 3rem; padding-right: 3rem; }
    .products-grid { grid-template-columns: repeat(4, 1fr); }
    .pcard-visual { height: 160px; }
    .dashboard-grid { gap: 1.25rem; }
    .quick-actions { grid-template-columns: repeat(6, 1fr); }
}

/* ── Print ── */
@media print {
    .app-header, .bottom-nav, .app-sidebar,
    .toast-container, .fab { display: none !important; }
    .app-content { padding: 0; margin: 0; }
}

/* ========================================================================
   NOTIFICATIONS
   ======================================================================== */

.btn-link {
    background: none; border: none; color: var(--exelon-primary);
    font-size: 0.82rem; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; gap: 4px;
    padding: 6px 10px; border-radius: 8px; transition: background 0.2s;
}
.btn-link:hover { background: rgba(6, 182, 212, 0.08); }

.btn-primary-sm {
    background: var(--exelon-primary); color: #fff; border: none;
    font-size: 0.82rem; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; gap: 4px;
    padding: 8px 14px; border-radius: 8px; transition: all 0.2s;
}
.btn-primary-sm:hover { background: #0891b2; }

.notif-filters {
    display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.notif-filters::-webkit-scrollbar { display: none; }

.filter-chip {
    background: var(--glass-bg); border: 1px solid var(--border-subtle);
    color: var(--text-secondary); font-size: 0.8rem; font-weight: 500;
    padding: 6px 14px; border-radius: 20px; cursor: pointer;
    white-space: nowrap; transition: all 0.2s;
}
.filter-chip.active, .filter-chip:hover {
    background: var(--exelon-primary); border-color: var(--exelon-primary);
    color: #fff;
}

.notif-list-card {
    display: flex; flex-direction: column; gap: 8px;
}

.notif-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 16px; border-radius: 14px;
    background: var(--glass-bg); border: 1px solid var(--border-subtle);
    cursor: pointer; transition: all 0.2s;
}
.notif-item.unread {
    background: rgba(6, 182, 212, 0.06);
    border-color: rgba(6, 182, 212, 0.2);
}
.notif-item:hover { border-color: var(--exelon-primary); }

.notif-icon-wrap {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}
.notif-icon-wrap.info    { background: rgba(6, 182, 212, 0.12); color: #06b6d4; }
.notif-icon-wrap.success { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.notif-icon-wrap.warning { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.notif-icon-wrap.danger  { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.notif-icon-wrap.system  { background: rgba(99, 102, 241, 0.12); color: #6366f1; }

.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 0.88rem; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.notif-text  { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.4; }
.notif-time  { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }

.notif-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--exelon-primary); flex-shrink: 0; margin-top: 6px;
}

/* ========================================================================
   SUPPORT TICKETS – Page Layout
   ======================================================================== */

/* Page Header */
.support-page-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; border-radius: 16px;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.08) 0%, rgba(14, 116, 144, 0.04) 100%);
    border: 1px solid rgba(6, 182, 212, 0.15);
    margin-bottom: 20px;
}
.support-page-header-left {
    display: flex; align-items: center; gap: 14px;
}
.support-page-icon {
    width: 48px; height: 48px; border-radius: 14px;
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; color: #fff; flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}
.support-page-title {
    font-size: 1.15rem; font-weight: 700; color: var(--text-primary);
    margin: 0 0 2px;
}
.support-page-subtitle {
    font-size: 0.8rem; color: var(--text-muted); margin: 0;
}
.btn-new-ticket {
    display: flex; align-items: center; gap: 6px;
    padding: 10px 20px; border-radius: 12px;
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: #fff; font-size: 0.85rem; font-weight: 600;
    border: none; cursor: pointer;
    box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
    transition: all 0.2s;
}
.btn-new-ticket:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.45);
}
.btn-new-ticket i { font-size: 1.1rem; }

/* Stats Row */
.ticket-stats {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
    margin-bottom: 20px;
}
.ticket-stat-card {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; border-radius: 14px;
    background: var(--glass-bg); border: 1px solid var(--border-subtle);
    transition: all 0.2s;
}
.ticket-stat-card:hover { border-color: var(--border); }
.ticket-stat-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}
.ticket-stat-icon.st-total   { background: rgba(6, 182, 212, 0.12); color: #06b6d4; }
.ticket-stat-icon.st-open    { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.ticket-stat-icon.st-answered { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.ticket-stat-icon.st-closed  { background: rgba(148, 163, 184, 0.12); color: #94a3b8; }
.ticket-stat-info { display: flex; flex-direction: column; }
.ticket-stat-num { font-size: 1.2rem; font-weight: 800; color: var(--text-primary); line-height: 1; }
.ticket-stat-label { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

/* Filter Bar */
.ticket-filter-bar {
    display: flex; gap: 8px; margin-bottom: 16px;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; padding-bottom: 4px;
}
.ticket-filter-bar::-webkit-scrollbar { display: none; }
.ticket-filter-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 10px;
    background: var(--glass-bg); border: 1px solid var(--border-subtle);
    color: var(--text-secondary); font-size: 0.8rem; font-weight: 500;
    cursor: pointer; white-space: nowrap; transition: all 0.2s;
}
.ticket-filter-btn i { font-size: 0.9rem; }
.ticket-filter-btn:hover { border-color: var(--exelon-primary); color: var(--exelon-primary); }
.ticket-filter-btn.active {
    background: var(--exelon-primary); border-color: var(--exelon-primary);
    color: #fff; font-weight: 600;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

/* Ticket List Container */
.ticket-list-wrap {
    display: flex; flex-direction: column; gap: 10px;
}

/* ========================================================================
   SUPPORT TICKETS – Card
   ======================================================================== */

.ticket-card {
    padding: 18px 20px; border-radius: 14px;
    background: var(--bg-card); 
    border: 1px solid var(--border);
    border-left: 4px solid var(--exelon-primary);
    cursor: pointer; transition: all 0.25s; position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.ticket-card:hover {
    border-color: var(--exelon-primary);
    border-left-color: var(--exelon-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
[data-theme="dark"] .ticket-card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
[data-theme="dark"] .ticket-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.ticket-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
}
.ticket-no {
    font-size: 0.76rem; font-weight: 700; color: var(--exelon-primary);
    font-family: 'SF Mono', 'Fira Code', monospace; letter-spacing: 0.5px;
}

/* Status Badges */
.ticket-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 12px; border-radius: 20px;
    font-size: 0.72rem; font-weight: 600;
}
.ticket-badge i { font-size: 0.8rem; }
.ticket-badge-open     { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.ticket-badge-progress { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }
.ticket-badge-answered { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.ticket-badge-waiting  { background: rgba(251, 146, 60, 0.12); color: #fb923c; }
.ticket-badge-closed   { background: rgba(148, 163, 184, 0.12); color: #94a3b8; }

.ticket-subject {
    font-size: 0.95rem; font-weight: 700; color: var(--text-primary);
    margin-bottom: 12px; line-height: 1.45;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}

.ticket-meta {
    display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
}
.ticket-meta span {
    font-size: 0.76rem; color: var(--text-muted);
    display: inline-flex; align-items: center; gap: 4px;
}
.ticket-meta span i { font-size: 0.85rem; }
.ticket-priority.priority-low    { color: #94a3b8; }
.ticket-priority.priority-medium { color: #06b6d4; }
.ticket-priority.priority-high   { color: #f59e0b; }
.ticket-priority.priority-urgent { color: #ef4444; font-weight: 700; }
.ticket-category { color: var(--text-secondary) !important; }
.ticket-time { color: var(--text-muted) !important; }

/* Pagination */
.ticket-pagination {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    margin-top: 20px; padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}
.pg-info {
    font-size: 0.76rem; color: var(--text-muted); font-weight: 500;
}
.pg-controls {
    display: flex; align-items: center; gap: 4px;
}
.pg-btn {
    min-width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px; border: 1px solid var(--border-subtle);
    background: var(--glass-bg); color: var(--text-secondary);
    font-size: 0.82rem; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
}
.pg-btn:hover:not(:disabled) {
    border-color: var(--exelon-primary); color: var(--exelon-primary);
    background: rgba(6, 182, 212, 0.06);
}
.pg-btn.pg-active {
    background: var(--exelon-primary); border-color: var(--exelon-primary);
    color: #fff; box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}
.pg-btn:disabled {
    opacity: 0.35; cursor: not-allowed;
}
.pg-btn i { font-size: 1.1rem; }
.pg-dots {
    width: 28px; text-align: center;
    color: var(--text-muted); font-size: 0.85rem; user-select: none;
}

/* Responsive: 2-column stats on mobile */
@media (max-width: 480px) {
    .ticket-stats { grid-template-columns: repeat(2, 1fr); }
    .support-page-header { flex-direction: column; gap: 14px; align-items: flex-start; }
    .btn-new-ticket { width: 100%; justify-content: center; }
    .pg-btn { min-width: 32px; height: 32px; font-size: 0.78rem; }
}

/* Badge variants */
.badge-primary   { background: rgba(6, 182, 212, 0.12); color: #06b6d4; }
.badge-info      { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }
.badge-secondary { background: rgba(148, 163, 184, 0.12); color: #94a3b8; }
.badge-muted     { background: rgba(100, 116, 139, 0.1); color: #64748b; }

/* ========================================================================
   TICKET DETAIL PAGE
   ======================================================================== */

/* Back Button */
.td-back-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 10px;
    background: var(--glass-bg); border: 1px solid var(--border-subtle);
    color: var(--text-secondary); font-size: 0.82rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s; margin-bottom: 16px;
}
.td-back-btn:hover { border-color: var(--exelon-primary); color: var(--exelon-primary); }
.td-back-btn i { font-size: 1rem; }

/* Header Card */
.td-header-card {
    padding: 24px; border-radius: 16px;
    background: var(--bg-card); border: 1px solid var(--border);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    margin-bottom: 20px;
}
[data-theme="dark"] .td-header-card {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}
.td-header-top {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}
.td-header-left {
    display: flex; align-items: center; gap: 10px;
}
.td-ticket-no {
    font-size: 0.8rem; font-weight: 700; color: var(--exelon-primary);
    font-family: 'SF Mono', 'Fira Code', monospace; letter-spacing: 0.5px;
    background: rgba(6, 182, 212, 0.08); padding: 4px 10px; border-radius: 6px;
}
.td-status-dot {
    width: 10px; height: 10px; border-radius: 50%;
}
.td-status-dot.open { background: #10b981; box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); animation: pulse-dot 2s infinite; }
.td-status-dot.closed { background: #94a3b8; }
@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 4px rgba(16, 185, 129, 0.4); }
    50% { box-shadow: 0 0 12px rgba(16, 185, 129, 0.7); }
}
.td-subject {
    font-size: 1.15rem; font-weight: 700; color: var(--text-primary);
    margin: 0 0 18px; line-height: 1.4;
}
.td-info-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px;
}
.td-info-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 14px; border-radius: 12px;
    background: var(--glass-bg);
}
.td-info-item > i {
    font-size: 1.1rem; color: var(--text-muted); margin-top: 2px; flex-shrink: 0;
}
.td-info-label {
    display: block; font-size: 0.7rem; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; margin-bottom: 2px;
}
.td-info-value {
    display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-primary);
}

/* Conversation Section */
.td-conversation {
    border-radius: 16px; overflow: hidden;
    background: var(--bg-card); border: 1px solid var(--border);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    margin-bottom: 20px;
}
[data-theme="dark"] .td-conversation {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}
.td-conv-header {
    display: flex; align-items: center; gap: 8px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.88rem; font-weight: 700; color: var(--text-primary);
}
.td-conv-header i { font-size: 1.1rem; color: var(--exelon-primary); }
.td-msg-count {
    background: var(--exelon-primary); color: #fff;
    font-size: 0.68rem; font-weight: 700;
    min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 10px; display: inline-flex;
    align-items: center; justify-content: center;
}
.td-messages {
    display: flex; flex-direction: column; gap: 16px;
    max-height: 55vh; overflow-y: auto; padding: 20px;
}
.td-messages::-webkit-scrollbar { width: 4px; }
.td-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.td-no-msg {
    text-align: center; padding: 40px 20px; color: var(--text-muted);
}
.td-no-msg i { font-size: 2rem; display: block; margin-bottom: 8px; opacity: 0.5; }
.td-no-msg p { font-size: 0.85rem; }

/* Message Row */
.td-msg {
    display: flex; gap: 12px; max-width: 90%;
}
.td-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.td-msg.staff { align-self: flex-start; }

.td-msg-avatar {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; flex-shrink: 0;
}
.td-msg-avatar.staff { background: rgba(6, 182, 212, 0.12); color: #06b6d4; }
.td-msg-avatar.user  { background: rgba(99, 102, 241, 0.12); color: #6366f1; }

.td-msg-bubble {
    padding: 14px 18px; border-radius: 16px; position: relative;
    min-width: 120px;
}
.td-msg-bubble.staff {
    background: var(--glass-bg); border: 1px solid var(--border-subtle);
    border-top-left-radius: 4px;
}
.td-msg-bubble.user {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: #fff; border-top-right-radius: 4px;
}

.td-msg-top {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 6px;
}
.td-msg-sender { font-size: 0.76rem; font-weight: 700; }
.td-msg-time   { font-size: 0.68rem; opacity: 0.6; white-space: nowrap; }

.td-msg-bubble.staff .td-msg-sender { color: var(--exelon-primary); }
.td-msg-bubble.staff .td-msg-time   { color: var(--text-muted); }
.td-msg-bubble.user  .td-msg-sender { color: rgba(255,255,255,.85); }
.td-msg-bubble.user  .td-msg-time   { color: rgba(255,255,255,.6); }

.td-msg-text {
    font-size: 0.86rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}
.td-msg-attach {
    display: inline-flex; align-items: center; gap: 4px;
    margin-top: 8px; padding: 4px 10px; border-radius: 6px;
    font-size: 0.76rem; font-weight: 600;
    background: rgba(255,255,255,0.15); color: inherit;
    text-decoration: none; transition: all 0.2s;
}
.td-msg-attach:hover { background: rgba(255,255,255,0.25); }
.td-msg-bubble.staff .td-msg-attach {
    background: rgba(6, 182, 212, 0.08); color: var(--exelon-primary);
}

/* Reply Box */
.td-reply-box {
    padding: 20px; border-radius: 16px;
    background: var(--bg-card); border: 1px solid var(--border);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}
[data-theme="dark"] .td-reply-box {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}
.td-reply-header {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.88rem; font-weight: 700; color: var(--text-primary);
    margin-bottom: 14px;
}
.td-reply-header i { font-size: 1.1rem; color: var(--exelon-primary); }
.td-reply-footer {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 14px;
}
.td-reply-hint {
    font-size: 0.74rem; color: var(--text-muted);
    display: flex; align-items: center; gap: 4px;
}
.td-reply-hint i { font-size: 0.85rem; }

/* Closed Banner */
.td-closed-banner {
    display: flex; align-items: center; gap: 16px;
    padding: 20px 24px; border-radius: 16px;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.2);
}
.td-closed-icon {
    width: 48px; height: 48px; border-radius: 12px;
    background: rgba(148, 163, 184, 0.12); color: #94a3b8;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; flex-shrink: 0;
}
.td-closed-banner strong {
    font-size: 0.9rem; color: var(--text-primary); display: block; margin-bottom: 4px;
}
.td-closed-banner p {
    font-size: 0.8rem; color: var(--text-muted); margin: 0;
}

/* Responsive */
@media (max-width: 480px) {
    .td-info-grid { grid-template-columns: 1fr; }
    .td-msg { max-width: 95%; }
    .td-header-card { padding: 18px; }
    .td-messages { padding: 14px; }
    .td-reply-footer { flex-direction: column; gap: 10px; }
    .td-reply-footer .btn-new-ticket { width: 100%; justify-content: center; }
}

/* ============ SEARCH OVERLAY ============ */
.search-overlay {
    position: fixed; inset: 0; z-index: 9000;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: 80px;
    animation: modalFadeIn 0.2s ease;
}
.search-modal {
    width: 100%; max-width: 560px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: slideDown 0.25s ease;
}
.search-input-wrap {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.search-input-wrap i { font-size: 1.25rem; color: var(--text-muted); }
.search-input-wrap input {
    flex: 1; border: none; outline: none;
    font-size: 1rem; background: transparent;
    color: var(--text);
}
.search-input-wrap input::placeholder { color: var(--text-muted); }
.search-close {
    width: 32px; height: 32px; border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 1.1rem;
    transition: var(--transition);
}
.search-close:hover { background: var(--bg-input); color: var(--text); }
.search-results {
    max-height: 400px; overflow-y: auto;
    padding: 0.5rem;
}
.search-results:empty::after {
    content: ''; display: block;
}
.search-group-label {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-muted);
}
.search-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius);
    cursor: pointer; transition: var(--transition);
}
.search-item:hover { background: var(--bg-input); }
.search-item-icon {
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    background: var(--primary-bg); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}
.search-item-content { flex: 1; min-width: 0; }
.search-item-title {
    font-size: 0.875rem; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-item-sub {
    font-size: 0.75rem; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-empty {
    text-align: center; padding: 2rem 1rem; color: var(--text-muted);
}
.search-empty i { font-size: 2rem; display: block; margin-bottom: 0.5rem; }

/* ═══════════════════════════════════════════════════
   CHAT RENDERER — Markdown & Rich Content Styles
   ═══════════════════════════════════════════════════ */

/* ── Markdown base ── */
.cr-markdown { font-size: 0.9rem; line-height: 1.7; }
.cr-markdown > *:first-child { margin-top: 0; }
.cr-markdown > *:last-child { margin-bottom: 0; }

/* Headers */
.cr-h1 { font-size: 1.35rem; font-weight: 700; margin: 1rem 0 0.5rem; color: var(--text); }
.cr-h2 { font-size: 1.15rem; font-weight: 700; margin: 0.85rem 0 0.4rem; color: var(--text); }
.cr-h3 { font-size: 1.05rem; font-weight: 600; margin: 0.75rem 0 0.35rem; color: var(--text); }
.cr-h4 { font-size: 0.95rem; font-weight: 600; margin: 0.6rem 0 0.3rem; color: var(--text); }
.cr-h5 { font-size: 0.9rem; font-weight: 600; margin: 0.5rem 0 0.25rem; color: var(--text-secondary); }
.cr-h6 { font-size: 0.85rem; font-weight: 600; margin: 0.5rem 0 0.25rem; color: var(--text-muted); }

/* Paragraph */
.cr-para { margin: 0.4rem 0; }
.cr-para + .cr-para { margin-top: 0.6rem; }

/* Inline */
.cr-inline-code {
    background: var(--bg-input); color: var(--primary-dark);
    padding: 1px 6px; border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.82em; border: 1px solid var(--border-light);
}
.cr-link { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.cr-link:hover { color: var(--primary-dark); }

/* Lists */
.cr-list { margin: 0.4rem 0; padding-left: 1.4rem; }
.cr-list li { margin-bottom: 0.2rem; }
.cr-list li::marker { color: var(--primary); }
.cr-list-ordered li::marker { color: var(--primary-dark); font-weight: 600; }

/* Blockquote */
.cr-blockquote {
    margin: 0.5rem 0; padding: 0.5rem 0.85rem;
    border-left: 3px solid var(--primary); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--primary-bg); color: var(--text-secondary);
    font-style: italic;
}

/* Horizontal Rule */
.cr-hr {
    border: none; border-top: 1px solid var(--border);
    margin: 0.75rem 0;
}

/* ── Code Block ── */
.cr-code-block {
    position: relative; margin: 0.6rem 0;
    border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--border-light);
}
.cr-code-lang {
    background: var(--bg-dark); color: var(--text-muted);
    padding: 4px 12px; font-size: 0.7rem; text-transform: uppercase;
    letter-spacing: 0.5px; font-weight: 600;
}
.cr-code-block pre {
    margin: 0; padding: 0.75rem 1rem;
    background: #0D1117; color: #E6EDF3;
    overflow-x: auto; font-size: 0.8rem; line-height: 1.5;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}
.cr-code-block code { font-family: inherit; }
.cr-code-copy {
    position: absolute; top: 6px; right: 6px;
    width: 28px; height: 28px; border-radius: 6px;
    background: rgba(255,255,255,0.1); color: #8B949E;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; opacity: 0; transition: opacity .2s;
    cursor: pointer;
}
.cr-code-block:hover .cr-code-copy { opacity: 1; }
@media (hover: none) { .cr-code-copy { opacity: 0.7; } }
.cr-code-copy.copied { color: var(--success); background: rgba(16,185,129,0.15); }

/* ── Table ── */
.cr-table-wrap {
    overflow-x: auto; margin: 0.5rem 0;
    border-radius: var(--radius); border: 1px solid var(--border);
}
.cr-table {
    width: 100%; border-collapse: collapse;
    font-size: 0.82rem;
}
.cr-table th {
    background: var(--bg-input); color: var(--text);
    padding: 8px 12px; text-align: left;
    font-weight: 600; white-space: nowrap;
    border-bottom: 2px solid var(--border);
}
.cr-table td {
    padding: 6px 12px; border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}
.cr-table tbody tr:last-child td { border-bottom: none; }
.cr-table tbody tr:hover { background: var(--primary-bg); }

/* ── Product Card (single embed) ── */
.cr-pcard {
    border-radius: var(--radius-lg); overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-card); cursor: pointer;
    transition: transform .2s, box-shadow .2s;
    margin: 0.5rem 0;
}
.cr-pcard:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.cr-pcard.inverter { border-top: 3px solid var(--primary); }
.cr-pcard.battery { border-top: 3px solid var(--success); }
.cr-pcard-visual {
    height: 100px; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary-bg), var(--bg));
}
.cr-pcard.battery .cr-pcard-visual {
    background: linear-gradient(135deg, var(--success-bg), var(--bg));
}
.cr-pcard-img { max-height: 80px; max-width: 80%; object-fit: contain; }
.cr-pcard-icon {
    width: 56px; height: 56px; border-radius: var(--radius);
    background: white; display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; color: var(--primary); box-shadow: var(--shadow-sm);
}
.cr-pcard.battery .cr-pcard-icon { color: var(--success); }
.cr-pcard-body { padding: 0.75rem 1rem; }
.cr-pcard-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: var(--radius-full);
    font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; margin-bottom: 0.35rem;
}
.cr-pcard-badge.inverter { background: var(--primary-bg); color: var(--primary-dark); }
.cr-pcard-badge.battery { background: var(--success-bg); color: var(--success); }
.cr-pcard-name { font-size: 0.92rem; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.cr-pcard-model { font-size: 0.75rem; color: var(--text-muted); font-family: monospace; margin-bottom: 0.25rem; }
.cr-pcard-power {
    font-size: 1rem; font-weight: 800; color: var(--primary);
    margin-bottom: 0.4rem;
}
.cr-pcard.battery .cr-pcard-power { color: var(--success); }
.cr-pcard-specs {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 4px; margin-bottom: 0.4rem;
}
.cr-pcard-spec {
    display: flex; flex-direction: column;
    padding: 4px 6px; border-radius: 6px;
    background: var(--bg-input); font-size: 0.7rem;
}
.cr-pcard-spec-key { color: var(--text-muted); font-weight: 500; }
.cr-pcard-spec-val { color: var(--text); font-weight: 600; }
.cr-pcard-desc { font-size: 0.78rem; color: var(--text-secondary); margin: 0.3rem 0; line-height: 1.4; }
.cr-pcard-action {
    display: flex; align-items: center; gap: 4px;
    color: var(--primary); font-size: 0.8rem; font-weight: 600;
    margin-top: 0.5rem;
}
.cr-pcard:hover .cr-pcard-action { text-decoration: underline; }

/* ── Product Grid (list embed) ── */
.cr-product-grid {
    display: grid; grid-template-columns: 1fr;
    gap: 0.5rem; margin: 0.5rem 0;
}
@media (min-width: 480px) {
    .cr-product-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Product loading & error states ── */
.cr-product-loading {
    padding: 1.5rem; text-align: center; color: var(--text-muted);
    font-size: 0.85rem; display: flex; align-items: center;
    justify-content: center; gap: 0.5rem;
}
.cr-product-not-found {
    padding: 1rem; text-align: center; color: var(--text-muted);
    font-size: 0.82rem; background: var(--bg-input);
    border-radius: var(--radius); display: flex;
    align-items: center; justify-content: center; gap: 0.5rem;
}

/* ── Action Embed Buttons (register-device, create-ticket) ── */
.cr-action-embed {
    margin: 0.75rem 0;
}
.cr-action-btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.65rem 1.25rem; border-radius: var(--radius);
    font-size: 0.88rem; font-weight: 600; cursor: pointer;
    border: none; transition: all 0.2s ease;
}
.cr-action-btn.device {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
}
.cr-action-btn.device:hover {
    transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,188,212,.35);
}
.cr-action-btn.ticket {
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: #fff;
}
.cr-action-btn.ticket:hover {
    transform: translateY(-1px); box-shadow: 0 4px 12px rgba(245,158,11,.35);
}
.cr-action-btn i { font-size: 1.1rem; }

/* ── Escalation Card [[escalate-to-human]] ── */
.cr-escalation-card {
    margin: 0.75rem 0; border-radius: var(--radius);
    border: 1px solid rgba(245,158,11,.35);
    background: linear-gradient(135deg, rgba(245,158,11,.08), rgba(234,88,12,.06));
    padding: 1rem 1.25rem;
}
.cr-escalation-header {
    display: flex; align-items: center; gap: 0.5rem;
    font-weight: 700; font-size: 0.95rem; color: #F59E0B;
    margin-bottom: 0.4rem;
}
.cr-escalation-header i { font-size: 1.1rem; }
.cr-escalation-desc {
    font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.75rem; margin-top: 0;
}
.cr-escalation-btns {
    display: flex; flex-wrap: wrap; gap: 0.5rem;
}
.cr-esc-btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.5rem 1rem; border-radius: var(--radius);
    font-size: 0.83rem; font-weight: 600; cursor: pointer;
    border: none; transition: all 0.2s ease;
}
.cr-esc-btn.whatsapp {
    background: #25D366; color: #fff;
}
.cr-esc-btn.whatsapp:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(37,211,102,.35); }
.cr-esc-btn.ticket {
    background: linear-gradient(135deg, #F59E0B, #D97706); color: #fff;
}
.cr-esc-btn.ticket:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(245,158,11,.35); }
.cr-esc-btn i { font-size: 1rem; }

/* ── Dark theme adjustments ── */
[data-theme="dark"] .cr-code-block pre { background: #161B22; color: #E6EDF3; }
[data-theme="dark"] .cr-inline-code { background: rgba(255,255,255,.08); color: var(--primary-light); border-color: rgba(255,255,255,.1); }
[data-theme="dark"] .cr-pcard { border-color: rgba(255,255,255,.1); }
[data-theme="dark"] .cr-pcard-visual { background: linear-gradient(135deg, rgba(0,188,212,.08), rgba(255,255,255,.03)); }
[data-theme="dark"] .cr-pcard.battery .cr-pcard-visual { background: linear-gradient(135deg, rgba(16,185,129,.08), rgba(255,255,255,.03)); }
[data-theme="dark"] .cr-pcard-icon { background: rgba(255,255,255,.08); }
[data-theme="dark"] .cr-table th { background: rgba(255,255,255,.05); }
[data-theme="dark"] .cr-table tbody tr:hover { background: rgba(0,188,212,.05); }
[data-theme="dark"] .cr-blockquote { background: rgba(0,188,212,.06); }

/* ══════════════════════════════════════════════════════════════
   FAULT PICKER EMBED  (.cr-fault-picker)
   Interactive arıza kodu seçici — AI chat içinde gösterilir
   ══════════════════════════════════════════════════════════════ */
.cr-fault-picker-embed { margin: 0.5rem 0; }
.cr-fp-loading, .cr-fp-error {
    padding: 1rem; text-align: center; color: var(--text-muted);
    font-size: 0.85rem; display: flex; align-items: center;
    justify-content: center; gap: 0.5rem;
}
.cr-fp-error { color: var(--danger); }

.cr-fault-picker {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 14px);
    overflow: hidden;
    font-size: 0.875rem;
}

/* Header */
.cr-fp-header {
    display: flex; align-items: flex-start; gap: 0.75rem;
    padding: 0.9rem 1rem;
    background: linear-gradient(135deg, rgba(239,68,68,.08), rgba(251,191,36,.06));
    border-bottom: 1px solid var(--border);
}
.cr-fp-header > i { font-size: 1.4rem; color: #ef4444; flex-shrink: 0; margin-top: 2px; }
.cr-fp-title { font-weight: 700; font-size: 0.92rem; color: var(--text); }
.cr-fp-subtitle { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* Search */
.cr-fp-search-wrap {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.6rem 1rem; border-bottom: 1px solid var(--border);
    background: var(--bg-input, rgba(255,255,255,.04));
}
.cr-fp-search-wrap > i { color: var(--text-muted); font-size: 0.9rem; flex-shrink: 0; }
.cr-fp-search-input {
    flex: 1; background: none; border: none; outline: none;
    color: var(--text); font-size: 0.83rem;
    caret-color: var(--primary);
}
.cr-fp-search-input::placeholder { color: var(--text-muted); }

/* Groups */
.cr-fp-groups { padding: 0.5rem 0; }
.cr-fp-group { margin-bottom: 0.25rem; }
.cr-fp-group-label {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.3rem 1rem; font-size: 0.72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em;
    opacity: .75;
}
.cr-fp-group.critical .cr-fp-group-label { color: #ef4444; }
.cr-fp-group.warning  .cr-fp-group-label { color: #f59e0b; }
.cr-fp-group.info     .cr-fp-group-label { color: #06b6d4; }

/* Individual fault item */
.cr-fp-item {
    border-bottom: 1px solid var(--border);
    transition: background .15s;
}
.cr-fp-item:last-child { border-bottom: none; }

.cr-fp-item-head {
    display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
    padding: 0.65rem 1rem; cursor: pointer;
    transition: background .15s;
}
.cr-fp-item-head:hover { background: var(--bg-hover, rgba(255,255,255,.04)); }

.cr-fp-code {
    font-family: monospace; font-weight: 800; font-size: 0.82rem;
    padding: 0.15rem 0.45rem; border-radius: 5px; flex-shrink: 0;
    letter-spacing: .03em;
}
.cr-fp-code.critical { background: rgba(239,68,68,.15); color: #ef4444; }
.cr-fp-code.warning  { background: rgba(245,158,11,.15); color: #f59e0b; }
.cr-fp-code.info     { background: rgba(6,182,212,.12);   color: #06b6d4; }

.cr-fp-desc {
    flex: 1; font-size: 0.83rem; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    min-width: 0;
}

.cr-fp-badges { display: flex; gap: 0.3rem; flex-shrink: 0; }
.cr-fp-tech-badge {
    display: inline-flex; align-items: center; gap: 0.25rem;
    font-size: 0.68rem; padding: 0.1rem 0.4rem;
    background: rgba(139,92,246,.15); color: #8b5cf6;
    border-radius: 4px; font-weight: 600;
}
.cr-fp-time {
    display: inline-flex; align-items: center; gap: 0.2rem;
    font-size: 0.68rem; color: var(--text-muted);
}

.cr-fp-chevron {
    font-size: 1rem; color: var(--text-muted); flex-shrink: 0;
    transition: transform .2s;
}
.cr-fp-item.cr-fp-open .cr-fp-chevron { transform: rotate(180deg); }

/* Expanded body */
.cr-fp-item-body {
    display: none; padding: 0.75rem 1rem 1rem;
    background: var(--bg-input, rgba(0,0,0,.05));
    border-top: 1px solid var(--border);
    font-size: 0.82rem; color: var(--text);
    line-height: 1.55;
}
.cr-fp-item.cr-fp-open .cr-fp-item-body { display: block; }

.cr-fp-causes, .cr-fp-sol {
    margin-bottom: 0.5rem; color: var(--text);
}
.cr-fp-causes strong, .cr-fp-sol strong { color: var(--text); }

.cr-fp-steps {
    margin: 0.5rem 0 0.5rem 1rem; padding: 0;
    color: var(--text-muted);
}
.cr-fp-steps li { margin-bottom: 0.25rem; }

.cr-fp-item-actions {
    display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem;
}
.cr-fp-video-btn {
    display: inline-flex; align-items: center; gap: 0.3rem;
    font-size: 0.78rem; color: #06b6d4; text-decoration: none;
    padding: 0.35rem 0.75rem; border-radius: 6px;
    border: 1px solid rgba(6,182,212,.3);
    transition: background .15s;
}
.cr-fp-video-btn:hover { background: rgba(6,182,212,.1); }

.cr-fp-select-btn {
    display: inline-flex; align-items: center; gap: 0.3rem;
    background: var(--primary); color: #fff;
    border: none; border-radius: 6px;
    padding: 0.4rem 0.85rem; font-size: 0.8rem; font-weight: 600;
    cursor: pointer; transition: opacity .15s;
}
.cr-fp-select-btn:hover { opacity: .85; }

/* Dark theme overrides */
[data-theme="dark"] .cr-fault-picker { background: var(--bg-card); }
[data-theme="dark"] .cr-fp-header { background: linear-gradient(135deg, rgba(239,68,68,.1), rgba(251,191,36,.07)); }
[data-theme="dark"] .cr-fp-item-body { background: rgba(255,255,255,.03); }
[data-theme="dark"] .cr-fp-item-head:hover { background: rgba(255,255,255,.04); }

/* ── Wider bubbles for rich content ── */
.chat-bubble.ai .cr-markdown { max-width: 100%; }
.chat-bubble.ai:has(.cr-product-embed),
.chat-bubble.ai:has(.cr-products-embed),
.chat-bubble.ai:has(.cr-fault-picker-embed),
.chat-bubble.ai:has(.cr-table-wrap),
.chat-bubble.ai:has(.cr-code-block) {
    max-width: 92%;
}
@media (min-width: 1024px) {
    .chat-bubble.ai:has(.cr-product-embed),
    .chat-bubble.ai:has(.cr-products-embed),
    .chat-bubble.ai:has(.cr-fault-picker-embed),
    .chat-bubble.ai:has(.cr-table-wrap),
    .chat-bubble.ai:has(.cr-code-block) {
        max-width: 78%;
    }
}

/* ============ ACCESSIBILITY: Reduced Motion ============ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============ MOBILE: Virtual Keyboard safe area ============ */
@supports (height: 1dvh) {
    .chat-container {
        height: calc(var(--app-viewport-h, 100dvh) - var(--header-h) - var(--bottom-nav-h));
    }
}
