/* ═══════════════════════════════════════════════════════════════════
   ARMx — Professional Medical Prosthetic Dashboard v3.0
   Deep Navy + Glassmorphism + Premium Medical UI
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Google Fonts ─────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

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

:root {
    /* ── Color System (Clean Forest Sage Light Theme) ── */
    --navy-900: #E6F1ED; /* Light green-gray background */
    --navy-800: #EEF5F2; /* Lighter background */
    --navy-700: #F3F8F6; /* Card details/active elements */
    --navy-600: #FFFFFF;
    --navy-500: #E5EDE9;
    --navy-400: #2D7B60; /* Deep forest green */

    /* Card/surface background */
    --glass-bg:       #FFFFFF;
    --glass-bg-light: #F4F8F6;
    --glass-bg-hover: #E3EDE8;
    --glass-border:   #D2E0DA;
    --glass-border-bright: #2D7B60;
    --glass-blur:     0px;

    /* Accent Colors */
    --cyan:        #2D7B60; /* Deep Forest Green */
    --cyan-dark:   #1E5441;
    --cyan-dim:    #E4F0EC;
    --cyan-glow:   rgba(45, 123, 96, 0.12);

    --emerald:     #22C55E;
    --emerald-dark:#16A34A;
    --emerald-dim: rgba(34, 197, 94, 0.08);
    --emerald-glow:rgba(34, 197, 94, 0.2);

    --amber:       #F59E0B;
    --amber-dark:  #D97706;
    --amber-dim:   rgba(245, 158, 11, 0.08);
    --amber-glow:  rgba(245, 158, 11, 0.2);

    --rose:        #EF4444;
    --rose-dark:   #DC2626;
    --rose-dim:    rgba(239, 68, 68, 0.08);
    --rose-glow:   rgba(239, 68, 68, 0.2);

    --violet:      #8B5CF6;
    --violet-dim:  rgba(139, 92, 246, 0.08);
    --violet-glow: rgba(139, 92, 246, 0.2);

    /* Text */
    --text-primary:   #233831; /* Charcoal Forest Dark */
    --text-secondary: #516A60; /* Sage Medium */
    --text-muted:     #7C988E; /* Sage Muted */
    --text-on-dark:   #FFFFFF; /* White */

    /* Chart channel colors */
    --ch0: #2D7B60; --ch1: #8B5CF6; --ch2: #F59E0B;
    --ch3: #10B981; --ch4: #EF4444; --ch5: #06B6D4;
    --ch6: #FBBF24; --ch7: #A78BFA;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Spacing */
    --sidebar-w: 240px;
    --topbar-h:  64px;

    /* Radius */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius:    12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-pill: 999px;

    /* Shadows */
    --shadow-sm: 0 2px 10px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.08);
    --shadow-glow-cyan:    0 0 20px rgba(45,123,96,0.15);
    --shadow-glow-emerald: 0 0 20px rgba(34,197,94,0.15);

    /* Transitions */
    --t-fast:   0.15s cubic-bezier(0.4,0,0.2,1);
    --t-normal: 0.25s cubic-bezier(0.4,0,0.2,1);
    --t-slow:   0.40s cubic-bezier(0.4,0,0.2,1);
}

html { font-size: 14px; scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background: var(--navy-800);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* Animated background */
body::before {
    content: '';
    position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background:
        radial-gradient(ellipse 60% 50% at 15% 40%, rgba(45, 123, 96, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 50% 60% at 85% 15%, rgba(139, 92, 246, 0.04) 0%, transparent 65%),
        radial-gradient(ellipse 40% 30% at 50% 90%, rgba(34, 197, 94, 0.04) 0%, transparent 60%),
        linear-gradient(165deg, #EEF5F2 0%, #D4ECE2 100%);
}

/* Subtle dot grid */
body::after {
    content: '';
    position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background-image: radial-gradient(circle, rgba(45, 123, 96, 0.07) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 40%, transparent 100%);
}

/* ─── Scrollbar ────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── App Shell ────────────────────────────────────────────────── */
.app-shell {
    position: relative; z-index: 1;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ─── Top Bar ──────────────────────────────────────────────────── */
#topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 200;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem;
    background: #FFFFFF;
    border-bottom: 1px solid #E0EAE5;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.topbar-left {
    display: flex; align-items: center; gap: 1rem;
    min-width: var(--sidebar-w);
}

.topbar-center {
    flex: 1;
    display: flex; align-items: center; gap: 1rem;
}

.topbar-right {
    display: flex; align-items: center; gap: 0.75rem;
    margin-left: auto;
}

/* Logo */
.logo {
    display: flex; align-items: center; gap: 0.6rem;
    text-decoration: none;
    flex-shrink: 0;
}
.logo-icon {
    width: 34px; height: 34px;
    background: #246950;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(36, 105, 80, 0.20);
}
.logo-text {
    font-size: 1.25rem; font-weight: 800; letter-spacing: -0.5px;
    color: #233831;
}
.logo-accent {
    color: #246950;
}
.logo-tagline {
    font-size: 0.72rem; color: var(--text-muted);
    font-weight: 500; letter-spacing: 0.3px;
}
.version-tag {
    font-size: 0.75rem; font-weight: 600; color: #2D7B60;
    background: #E4F0EC;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-xs);
    font-family: var(--font-mono);
    border: 1px solid rgba(45, 123, 96, 0.2);
}

/* Connection Status */
.status-indicator {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.35rem 0.9rem;
    background: #F4F8F6;
    border: 1px solid #DCE6E1;
    border-radius: var(--radius-pill);
    cursor: default;
}
.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-muted);
    transition: var(--t-normal);
    flex-shrink: 0;
}
.status-dot.sim {
    background: var(--amber);
    box-shadow: 0 0 8px var(--amber-glow);
    animation: statusPulse 2.5s ease-in-out infinite;
}
.status-dot.connected {
    background: var(--emerald);
    box-shadow: 0 0 8px var(--emerald-glow);
}
.status-dot.error {
    background: var(--rose);
    box-shadow: 0 0 8px var(--rose-glow);
    animation: statusPulse 1s ease-in-out infinite;
}
.status-text { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }

/* Signal Quality Meter in Topbar */
.topbar-signal-quality {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.3rem 0.75rem;
    background: #F4F8F6;
    border: 1px solid #DCE6E1;
    border-radius: var(--radius-pill);
}
.sq-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.sq-bars {
    display: flex; align-items: flex-end; gap: 2px; height: 14px;
}
.sq-bar {
    width: 4px; border-radius: 1px;
    background: var(--glass-border);
    transition: var(--t-normal);
}
.sq-bar:nth-child(1) { height: 5px; }
.sq-bar:nth-child(2) { height: 8px; }
.sq-bar:nth-child(3) { height: 11px; }
.sq-bar:nth-child(4) { height: 14px; }
.sq-bars.good .sq-bar { background: var(--emerald); }
.sq-bars.fair .sq-bar:nth-child(-n+3) { background: var(--amber); }
.sq-bars.poor .sq-bar:nth-child(1) { background: var(--rose); }

/* Port selector */
.port-selector { display: flex; align-items: center; gap: 0.4rem; }
.port-selector select, select.select-sm {
    background: #F4F8F6;
    border: 1px solid #DCE6E1;
    color: var(--text-primary);
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    outline: none;
    transition: var(--t-fast);
    cursor: pointer;
}
.port-selector select:focus, select.select-sm:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 2px var(--cyan-dim);
}

/* User/Settings icons */
.topbar-icon-btn {
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    background: #F4F8F6;
    border: 1px solid #DCE6E1;
    color: #516A60;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 1rem;
    transition: var(--t-normal);
    flex-shrink: 0;
}
.topbar-icon-btn:hover {
    background: #E3EDE8;
    border-color: #2D7B60;
    color: #2D7B60;
    box-shadow: 0 0 12px rgba(45, 123, 96, 0.15);
}

/* ─── Sidebar ──────────────────────────────────────────────────── */
#sidebar {
    position: fixed;
    top: var(--topbar-h); left: 0; bottom: 0;
    width: var(--sidebar-w);
    z-index: 150;
    background: #246950;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex; flex-direction: column;
    overflow: hidden;
    transition: transform var(--t-slow), width var(--t-slow);
}

#sidebar.collapsed {
    width: 64px;
}

.sidebar-nav {
    padding: 1rem 0.75rem;
    flex: 1;
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 0.25rem;
}

.sidebar-section-label {
    font-size: 0.75rem; font-weight: 700; letter-spacing: 1.2px;
    text-transform: uppercase; color: rgba(255, 255, 255, 0.45);
    padding: 0.75rem 0.6rem 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    opacity: 1;
    transition: opacity var(--t-slow);
}
#sidebar.collapsed .sidebar-section-label { opacity: 0; }

.nav-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    font-size: 0.95rem; font-weight: 600;
    transition: var(--t-normal);
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    border: 1px solid transparent;
    text-decoration: none;
}
.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #FFFFFF;
    border-color: transparent;
}
.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: #FFFFFF;
    border-color: rgba(255, 255, 255, 0.2);
    font-weight: 700;
}
.nav-item.active::before {
    content: '';
    position: absolute; left: 0; top: 20%; bottom: 20%;
    width: 3px;
    background: #FFFFFF;
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}
.nav-icon {
    font-size: 1.1rem; flex-shrink: 0; width: 20px; text-align: center;
}
.nav-label {
    transition: opacity var(--t-slow), transform var(--t-slow);
    white-space: nowrap;
}
#sidebar.collapsed .nav-label { opacity: 0; transform: translateX(-10px); pointer-events: none; }
#sidebar.collapsed .nav-item { justify-content: center; padding: 0.65rem; }
#sidebar.collapsed .nav-item.active::before { display: none; }

.nav-badge {
    margin-left: auto; flex-shrink: 0;
    font-size: 0.62rem; font-weight: 700;
    padding: 0.1rem 0.4rem; border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.2); color: #FFFFFF;
    font-family: var(--font-mono);
}
#sidebar.collapsed .nav-badge { display: none; }

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-footer-info {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.6rem;
    background: rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
}
.sfi-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--cyan), var(--violet));
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; flex-shrink: 0;
}
.sfi-name { font-size: 0.9rem; font-weight: 600; color: #FFFFFF; white-space: nowrap; }
.sfi-role { font-size: 0.75rem; color: rgba(255, 255, 255, 0.5); }
#sidebar.collapsed .sfi-text { display: none; }
#sidebar.collapsed .sidebar-footer-info { justify-content: center; }

/* Sidebar toggle */
#sidebarToggle {
    width: 28px; height: 28px;
    background: #F4F8F6;
    border: 1px solid #DCE6E1;
    border-radius: var(--radius-sm);
    color: #516A60;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 0.9rem;
    transition: var(--t-normal);
    flex-shrink: 0;
}
#sidebarToggle:hover { background: #E3EDE8; color: #2D7B60; border-color: #2D7B60; }

/* ─── Main Content Area ────────────────────────────────────────── */
#main-content {
    position: relative; z-index: 1;
    margin-top: var(--topbar-h);
    margin-left: var(--sidebar-w);
    flex: 1;
    height: calc(100vh - var(--topbar-h));
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.25rem;
    transition: margin-left var(--t-slow);
}

#main-content.sidebar-collapsed {
    margin-left: 64px;
}

/* ─── Page Sections (tab content) ─────────────────────────────── */
.page-section {
    display: none;
}
.page-section.active {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.1rem;
    animation: fadeInUp 0.35s ease;
}
.page-section.wide-grid.active {
    grid-template-columns: 1fr 1fr 1fr;
}

/* ─── Dashboard Grid ───────────────────────────────────────────── */
#dashboard {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1.1rem;
}

/* ─── Cards / Panels ───────────────────────────────────────────── */
.panel {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--t-normal);
    animation: fadeInUp 0.4s ease backwards;
    box-shadow: var(--shadow-sm);
    position: relative;
}
.panel::before {
    content: '';
    position: absolute; inset: 0; border-radius: var(--radius);
    background: linear-gradient(135deg, hsla(210,40%,100%,0.025) 0%, transparent 60%);
    pointer-events: none;
}
.panel:hover {
    border-color: var(--glass-border-bright);
    box-shadow: var(--shadow-md), 0 0 0 1px var(--glass-border-bright);
    transform: translateY(-2px);
}

.panel-wide { grid-column: 1 / -1; }
.panel-half { grid-column: span 1; }
.col-span-2 { grid-column: span 2; }

/* Staggered animations */
.panel:nth-child(1)  { animation-delay: 0.04s; }
.panel:nth-child(2)  { animation-delay: 0.08s; }
.panel:nth-child(3)  { animation-delay: 0.12s; }
.panel:nth-child(4)  { animation-delay: 0.16s; }
.panel:nth-child(5)  { animation-delay: 0.20s; }
.panel:nth-child(6)  { animation-delay: 0.24s; }
.panel:nth-child(7)  { animation-delay: 0.28s; }
.panel:nth-child(8)  { animation-delay: 0.32s; }
.panel:nth-child(9)  { animation-delay: 0.36s; }
.panel:nth-child(10) { animation-delay: 0.40s; }
.panel:nth-child(11) { animation-delay: 0.44s; }
.panel:nth-child(12) { animation-delay: 0.48s; }

.panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--glass-border);
    gap: 0.75rem;
}
.panel-title {
    display: flex; align-items: center; gap: 0.55rem;
    flex: 1;
}
.panel-icon {
    font-size: 1.05rem;
    width: 28px; height: 28px;
    background: var(--cyan-dim);
    border-radius: var(--radius-xs);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.panel-header h2 {
    font-size: 1.05rem; font-weight: 700;
    color: var(--text-primary); line-height: 1.2;
}
.panel-controls { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

.panel-body { padding: 1rem 1.1rem; }

/* ─── Badges ───────────────────────────────────────────────────── */
.badge {
    font-size: 0.8rem; font-weight: 700;
    padding: 0.25rem 0.65rem; border-radius: var(--radius-pill);
    font-family: var(--font-mono);
    letter-spacing: 0.3px;
    display: inline-flex; align-items: center; gap: 0.25rem;
    white-space: nowrap;
}
.badge-cyan    { background: var(--cyan-dim);    color: var(--cyan);    border: 1px solid hsla(193,100%,50%,0.2); }
.badge-emerald { background: var(--emerald-dim); color: var(--emerald); border: 1px solid hsla(160,84%,39%,0.2); }
.badge-amber   { background: var(--amber-dim);   color: var(--amber);   border: 1px solid hsla(38,92%,50%,0.2); }
.badge-rose    { background: var(--rose-dim);    color: var(--rose);    border: 1px solid hsla(0,84%,60%,0.2); }
.badge-violet  { background: var(--violet-dim);  color: var(--violet);  border: 1px solid hsla(258,90%,66%,0.2); }
.badge-dim     { background: hsla(215,30%,10%,0.6); color: var(--text-muted); border: 1px solid var(--glass-border); }
/* Legacy aliases */
.badge-green { background: var(--emerald-dim); color: var(--emerald); }
.badge-red   { background: var(--rose-dim);    color: var(--rose);    }

/* ─── Buttons ──────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 0.45rem;
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: var(--glass-bg);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem; font-weight: 600;
    cursor: pointer; white-space: nowrap;
    transition: var(--t-normal);
    outline: none;
    position: relative; overflow: hidden;
    text-decoration: none;
}
.btn:hover {
    background: var(--glass-bg-hover);
    border-color: var(--text-muted);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.btn:active { transform: translateY(0); }
.btn:focus-visible { box-shadow: 0 0 0 3px var(--cyan-dim), 0 0 0 1px var(--cyan); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; pointer-events: none; }

/* Button sizes */
.btn-xs  { padding: 0.3rem 0.65rem; font-size: 0.82rem; font-weight: 600; border-radius: var(--radius-xs); }
.btn-sm  { padding: 0.45rem 1rem; font-size: 0.88rem; font-weight: 600; }
.btn-lg  { padding: 0.8rem 1.6rem; font-size: 1.05rem; font-weight: 700; }
.btn-xl  { padding: 1rem 2.2rem; font-size: 1.15rem; font-weight: 700; border-radius: var(--radius); }

/* Button variants */
.btn-primary {
    background: linear-gradient(135deg, var(--cyan) 0%, var(--cyan-dark) 100%);
    border-color: var(--cyan);
    color: #001a26;
    font-weight: 600;
}
.btn-primary:hover {
    background: linear-gradient(135deg, #1ADEFF 0%, var(--cyan) 100%);
    box-shadow: 0 4px 20px var(--cyan-glow);
    border-color: #1ADEFF;
}

.btn-emerald {
    background: linear-gradient(135deg, var(--emerald) 0%, var(--emerald-dark) 100%);
    border-color: var(--emerald);
    color: #FFFFFF;
    font-weight: 600;
}
.btn-emerald:hover { box-shadow: 0 4px 20px var(--emerald-glow); }

.btn-accent {
    background: var(--cyan-dim);
    border-color: var(--cyan);
    color: var(--cyan);
}
.btn-accent:hover { background: hsla(193,100%,50%,0.22); box-shadow: var(--shadow-glow-cyan); }
.btn-accent.active { background: var(--cyan); color: var(--text-on-dark); font-weight: 600; }

.btn-ghost {
    background: transparent;
    border-color: var(--glass-border);
}
.btn-ghost:hover { background: var(--glass-bg-light); }

.btn-outline {
    background: transparent;
    border-color: var(--glass-border);
    color: var(--text-secondary);
}
.btn-outline:hover {
    background: var(--glass-bg-light);
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.btn-danger {
    background: transparent;
    border-color: hsla(0,84%,60%,0.4);
    color: var(--rose);
}
.btn-danger:hover { background: var(--rose-dim); border-color: var(--rose); box-shadow: 0 4px 16px var(--rose-glow); }

.btn-pill { border-radius: var(--radius-pill); }

.btn-icon { padding: 0.4rem; gap: 0; border-radius: var(--radius-sm); }
.btn-icon.btn-sm { padding: 0.3rem; }

/* Loading spinner inside button */
.btn.loading { pointer-events: none; }
.btn.loading::after {
    content: '';
    position: absolute; right: 0.75rem; top: 50%;
    width: 14px; height: 14px;
    margin-top: -7px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.btn.loading > * { opacity: 0.6; }

/* Full-width utility */
.full-width { width: 100%; justify-content: center; }

/* ─── Inputs & Selects ─────────────────────────────────────────── */
.input-sm, input.input-sm, input[type="text"].input-sm {
    padding: 0.35rem 0.7rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans); font-size: 0.8rem;
    outline: none; transition: var(--t-fast);
}
.input-sm:focus, input.input-sm:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 2px var(--cyan-dim);
}
.input-sm::placeholder { color: var(--text-muted); }

/* Number input with +/- */
.input-number-wrap {
    display: flex; align-items: center; gap: 0;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.input-number-wrap input[type="number"] {
    flex: 1; padding: 0.35rem 0.5rem;
    background: transparent; border: none;
    color: var(--text-primary); font-family: var(--font-mono);
    font-size: 0.82rem; text-align: center; outline: none;
}
.input-number-btn {
    width: 28px; height: 100%;
    background: hsla(210,30%,100%,0.05);
    border: none; color: var(--text-secondary);
    cursor: pointer; font-size: 1rem;
    transition: var(--t-fast);
    display: flex; align-items: center; justify-content: center;
}
.input-number-btn:hover { background: var(--cyan-dim); color: var(--cyan); }

/* ─── Range Sliders ────────────────────────────────────────────── */
input[type="range"] {
    -webkit-appearance: none; appearance: none;
    height: 5px; border-radius: var(--radius-pill);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    outline: none; cursor: pointer; transition: var(--t-fast);
    flex: 1;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 0 3px var(--cyan-dim), 0 2px 6px rgba(0,0,0,0.3);
    cursor: grab; transition: var(--t-fast);
    border: 2px solid var(--navy-700);
}
input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.25); box-shadow: 0 0 0 5px var(--cyan-dim), 0 0 12px var(--cyan-glow);
}
input[type="range"]::-webkit-slider-thumb:active { cursor: grabbing; }
input[type="range"]::-moz-range-thumb {
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--cyan); border: 2px solid var(--navy-700);
    box-shadow: 0 0 0 3px var(--cyan-dim);
    cursor: grab;
}

.slider-row {
    display: flex; align-items: center; gap: 0.6rem;
}
.slider-row label {
    font-size: 0.72rem; font-weight: 600;
    color: var(--text-secondary); width: 2.2rem;
    font-family: var(--font-mono);
}
.slider-row span {
    font-size: 0.72rem; font-family: var(--font-mono);
    color: var(--cyan); width: 2.8rem; text-align: right;
    font-weight: 600;
}

/* ─── EMG Canvas ───────────────────────────────────────────────── */
#emgPanel .panel-body { padding: 0.6rem; }
#emgCanvas {
    width: 100%; height: 260px; display: block;
    border-radius: var(--radius-sm);
    background: hsla(216,50%,6%,0.8);
}

/* ─── IMU Visualization ────────────────────────────────────────── */
.imu-body { display: flex; align-items: center; gap: 1.25rem; }
.imu-3d {
    width: 160px; height: 160px;
    perspective: 800px;
    display: flex; align-items: center; justify-content: center;
    position: relative; flex-shrink: 0;
    background: #E6EDE9; /* Solid soft forest-sage grey circular backing */
    border: 1px solid #C4D6CE; /* Crisp thin border for detail */
    border-radius: 50%;
    overflow: hidden; /* Guarantee clean circular boundary crop */
    box-shadow: inset 0 3px 8px rgba(36, 105, 80, 0.06); /* Premium recessed well effect */
}
.imu-ring {
    position: absolute; width: 140px; height: 140px;
    border-radius: 50%; transform-style: preserve-3d; pointer-events: none;
}
.x-ring { transform: rotateX(90deg); border: 1px solid hsla(0,84%,60%,0.4); }
.y-ring { transform: rotateY(90deg); border: 1px solid hsla(160,84%,39%,0.4); }
.z-ring { border: 2px solid var(--glass-border-bright); }

.hand-model.hologram {
    position: relative; width: 50px; height: 70px;
    transform-style: preserve-3d; transition: transform 0.1s linear;
    filter: drop-shadow(0 0 12px var(--cyan));
}
.palm-3d {
    position: absolute; width: 50px; height: 45px; bottom: 0;
    background: var(--cyan-dim);
    border: 1.5px solid var(--cyan);
    border-radius: 6px 6px 10px 10px;
    box-shadow: inset 0 0 15px var(--cyan-dim), 0 0 12px var(--cyan-glow);
    transform: translateZ(5px);
}
.finger {
    position: absolute; width: 8px;
    background: var(--cyan-dim);
    border: 1.5px solid var(--cyan);
    border-radius: 4px;
    transition: height 0.3s cubic-bezier(0.4,0,0.2,1);
    transform-origin: bottom center;
    box-shadow: inset 0 0 8px var(--cyan-dim);
}
.finger.f1 { height: 26px; bottom: 44px; left: 4px; }
.finger.f2 { height: 32px; bottom: 44px; left: 15px; }
.finger.f3 { height: 30px; bottom: 44px; left: 26px; }
.finger.f4 { height: 24px; bottom: 44px; left: 37px; }
.thumb {
    position: absolute; width: 8px; height: 20px;
    bottom: 25px; left: -8px;
    background: var(--violet-dim);
    border: 1.5px solid var(--violet);
    border-radius: 4px;
    transform: rotate(-25deg);
    transition: height 0.3s cubic-bezier(0.4,0,0.2,1);
}
.imu-values { flex: 1; display: flex; flex-direction: column; gap: 0.85rem; }
.imu-axis { display: flex; align-items: center; gap: 0.5rem; }
.imu-label { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); width: 38px; letter-spacing: 0.5px; }
.imu-bar-wrap {
    flex: 1; height: 6px;
    background: hsla(216,40%,8%,0.8);
    border-radius: 3px; position: relative; overflow: hidden;
}
.imu-bar {
    position: absolute; top: 0; bottom: 0;
    width: 50%; left: 50%; transform-origin: left center;
    transition: transform 0.1s linear, background 0.2s;
    border-radius: 3px;
}
.x-axis .imu-label { color: var(--rose); }
.y-axis .imu-label { color: var(--emerald); }
.z-axis .imu-label { color: var(--cyan); }
.x-axis .imu-bar { background: var(--rose); }
.y-axis .imu-bar { background: var(--emerald); }
.z-axis .imu-bar { background: var(--cyan); }
.imu-val {
    font-family: var(--font-mono); font-size: 0.8rem;
    color: var(--text-primary); width: 46px; text-align: right; font-weight: 500;
}

/* ─── Muscle Heatmap ───────────────────────────────────────────── */
.heatmap-container { display: flex; flex-direction: column; gap: 0.55rem; }
.heatbar {
    display: flex; align-items: center; gap: 0.5rem;
    position: relative; height: 26px;
}
.heatbar-fill {
    position: absolute; left: 3.2rem; height: 100%; width: 0%;
    border-radius: var(--radius-xs);
    background: linear-gradient(90deg, var(--cyan-dim), var(--cyan));
    transition: width 0.12s ease-out, background 0.3s;
    max-width: calc(100% - 6.8rem);
}
.heatbar[data-ch="0"] .heatbar-fill { background: linear-gradient(90deg, hsla(193,100%,50%,0.08), var(--ch0)); }
.heatbar[data-ch="1"] .heatbar-fill { background: linear-gradient(90deg, hsla(258,90%,66%,0.08), var(--ch1)); }
.heatbar[data-ch="2"] .heatbar-fill { background: linear-gradient(90deg, hsla(38,92%,50%,0.08), var(--ch2)); }
.heatbar[data-ch="3"] .heatbar-fill { background: linear-gradient(90deg, hsla(160,84%,39%,0.08), var(--ch3)); }
.heatbar[data-ch="4"] .heatbar-fill { background: linear-gradient(90deg, hsla(0,84%,60%,0.08), var(--ch4)); }
.heatbar[data-ch="5"] .heatbar-fill { background: linear-gradient(90deg, hsla(195,97%,43%,0.08), var(--ch5)); }
.heatbar[data-ch="6"] .heatbar-fill { background: linear-gradient(90deg, hsla(43,96%,56%,0.08), var(--ch6)); }
.heatbar[data-ch="7"] .heatbar-fill { background: linear-gradient(90deg, hsla(257,90%,76%,0.08), var(--ch7)); }

.heatbar-label {
    font-size: 0.7rem; font-weight: 600; color: var(--text-secondary);
    width: 2.8rem; font-family: var(--font-mono); z-index: 1;
}
.sqi-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--text-muted); z-index: 1;
    transition: background 0.3s, box-shadow 0.3s; flex-shrink: 0;
}
.sqi-dot.good  { background: var(--emerald); box-shadow: 0 0 6px var(--emerald-glow); }
.sqi-dot.fair  { background: var(--amber);   box-shadow: 0 0 6px var(--amber-glow); }
.sqi-dot.poor  { background: var(--rose);    box-shadow: 0 0 6px var(--rose-glow); }
.heatbar-value {
    position: absolute; right: 0;
    font-size: 0.7rem; font-family: var(--font-mono);
    color: var(--text-muted); width: 3.2rem; text-align: right;
}

/* ─── Gesture Prediction Panel ─────────────────────────────────── */
.prediction-body {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.1rem !important;
}

/* Active HUD Header Card */
.gesture-hud {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1rem 1.2rem;
    background: var(--glass-bg-light);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.gesture-hud::after {
    content: '';
    position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: linear-gradient(180deg, var(--cyan), var(--violet));
    border-radius: var(--radius-xs) 0 0 var(--radius-xs);
}

.hud-circle {
    width: 68px; height: 68px;
    border-radius: 50%;
    background: #E6EDE9;
    border: 2px solid #C4D6CE;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 3px 8px rgba(36, 105, 80, 0.08);
    flex-shrink: 0;
}

.gesture-icon {
    font-size: 2.1rem;
    line-height: 1;
    z-index: 2;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.15));
}
.gesture-icon.gesture-active {
    animation: gestureActivePulse 1.5s infinite;
}

/* Sci-fi scanner beam overlay */
.hud-scanner {
    position: absolute;
    left: 0; right: 0;
    height: 3px;
    background: rgba(45, 123, 96, 0.5);
    box-shadow: 0 0 8px rgba(45, 123, 96, 0.8);
    z-index: 3;
    pointer-events: none;
    animation: hudScan 2.5s ease-in-out infinite;
}

.hud-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.gesture-name {
    font-size: 1.45rem;
    font-weight: 900;
    color: var(--cyan);
    letter-spacing: 0.5px;
    line-height: 1.1;
    text-shadow: 0 0 16px var(--cyan-glow);
}

.gesture-confidence {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.2rem;
}

.conf-bar {
    flex: 1;
    max-width: 140px;
    height: 6px;
    background: var(--navy-500);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.conf-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--cyan), var(--emerald));
    border-radius: var(--radius-pill);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px var(--cyan-glow);
}

.conf-val {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 700;
}

/* Classifier Channels Grid */
.prob-channels {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.prob-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem 0.65rem;
}

.prob-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    transition: var(--t-normal);
}
.prob-row:hover {
    border-color: var(--glass-border-bright);
    background: var(--glass-bg-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.prob-row.active {
    background: var(--cyan-dim);
    border-color: var(--cyan);
    box-shadow: 0 2px 8px var(--cyan-glow);
}
.prob-row.active .prob-name {
    color: var(--cyan);
    font-weight: 700;
}
.prob-row.active .prob-val {
    color: var(--cyan);
    font-weight: 800;
}

.prob-icon {
    font-size: 0.9rem;
    width: 1.1rem;
    text-align: center;
    flex-shrink: 0;
}

.prob-name {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
    width: 2.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.prob-bar-wrap {
    flex: 1;
    height: 5px;
    background: var(--navy-500);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.prob-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--cyan), var(--violet));
    border-radius: var(--radius-pill);
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.prob-row.active .prob-bar-fill {
    background: linear-gradient(90deg, var(--cyan), var(--emerald));
    box-shadow: 0 0 6px var(--cyan-glow);
}

.prob-val {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    width: 2.2rem;
    text-align: right;
    flex-shrink: 0;
}

/* Animations */
@keyframes hudScan {
    0% { top: 0%; }
    50% { top: 100%; }
    100% { top: 0%; }
}
@keyframes gestureActivePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}
.prob-item:hover { border-color: var(--glass-border-bright); color: var(--text-secondary); }

/* ─── Calibration Panel ────────────────────────────────────────── */
.cal-steps-visual {
    display: flex; gap: 0.5rem; margin-bottom: 1rem;
    align-items: center;
}
.cal-step-item {
    display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
    flex: 1; cursor: pointer;
}
.cal-step-circle {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.82rem; font-weight: 700; color: var(--text-muted);
    transition: var(--t-normal);
    position: relative;
}
.cal-step-item.pending .cal-step-circle { border-color: var(--glass-border); color: var(--text-muted); }
.cal-step-item.in-progress .cal-step-circle {
    border-color: var(--amber); color: var(--amber);
    box-shadow: 0 0 12px var(--amber-glow);
    animation: statusPulse 1.5s ease-in-out infinite;
}
.cal-step-item.completed .cal-step-circle {
    background: var(--emerald-dim); border-color: var(--emerald); color: var(--emerald);
    box-shadow: 0 0 12px var(--emerald-glow);
}
.cal-step-label { font-size: 0.65rem; color: var(--text-muted); text-align: center; font-weight: 500; }
.cal-step-connector {
    flex: 0.3; height: 2px; background: var(--glass-border); border-radius: 1px;
    align-self: center; margin-bottom: 1.4rem;
}

.cal-steps { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.cal-progress { margin-bottom: 0.75rem; }
.progress-bar { width: 100%; height: 6px; background: var(--glass-bg); border-radius: var(--radius-pill); overflow: hidden; margin-bottom: 0.4rem; }
.progress-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--cyan), var(--violet));
    border-radius: var(--radius-pill);
    transition: width 0.3s ease;
    box-shadow: 0 0 8px var(--cyan-glow);
}
#calProgressText { font-size: 0.72rem; color: var(--text-secondary); }
.sensitivity-sliders { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.75rem; }

/* ─── Training Panel ───────────────────────────────────────────── */
.gesture-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin-bottom: 0.85rem; }
.gesture-btn {
    padding: 1.2rem 0.8rem; flex-direction: column;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer; transition: var(--t-normal);
    font-family: var(--font-sans);
    display: flex; align-items: center; justify-content: center; gap: 0.4rem;
    text-align: center;
}
.gesture-btn .gesture-btn-name { font-size: 1rem; font-weight: 700; color: var(--text-primary); text-transform: uppercase; letter-spacing: 0.5px; }
.gesture-btn:hover {
    background: var(--cyan-dim); border-color: var(--cyan);
    transform: translateY(-4px);
    box-shadow: 0 4px 15px var(--cyan-glow);
    color: var(--cyan);
}
.gesture-btn:hover .gesture-btn-name { color: var(--cyan); }
.gesture-btn.recording {
    background: var(--rose-dim); border-color: var(--rose);
    animation: recordPulse 1s infinite;
    color: var(--rose);
}
.gesture-btn .gesture-sample-count {
    font-size: 0.82rem; font-family: var(--font-mono);
    color: var(--emerald); margin-top: 0.2rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity var(--t-fast);
}
.gesture-btn.has-data .gesture-sample-count { opacity: 1; }
.gesture-btn.has-data { border-color: hsla(160,84%,39%,0.3); }

/* Recording indicator */
.recording-indicator {
    display: flex; align-items: center; gap: 0.65rem;
    padding: 0.6rem 0.9rem;
    background: var(--rose-dim);
    border: 1px solid var(--rose);
    border-radius: var(--radius-sm); margin-bottom: 0.75rem;
    animation: fadeInUp 0.25s ease;
}
.rec-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--rose); flex-shrink: 0;
    animation: statusPulse 1s ease-in-out infinite;
    box-shadow: 0 0 8px var(--rose-glow);
}
#recGesture { font-size: 0.82rem; font-weight: 600; color: var(--rose); flex: 1; }

/* Training actions */
.training-actions { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.5rem; }
.file-actions { display: flex; flex-direction: column; gap: 0.5rem; }
.action-group { display: flex; gap: 0.5rem; align-items: center; }
.action-group input, .action-group select {
    flex: 1; padding: 0.35rem 0.7rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans); font-size: 0.78rem;
    outline: none; transition: var(--t-fast);
}
.action-group input:focus, .action-group select:focus {
    border-color: var(--cyan); box-shadow: 0 0 0 2px var(--cyan-dim);
}
.action-group.full-width { display: grid; grid-template-columns: 1fr 1fr; }

.dataset-stats {
    font-size: 0.72rem; font-family: var(--font-mono);
    color: var(--text-muted);
}
.stat-row {
    display: flex; justify-content: space-between;
    padding: 0.2rem 0;
    border-bottom: 1px solid var(--glass-border);
}
.stat-row:last-child { border-bottom: none; }

/* ─── ML Panel ─────────────────────────────────────────────────── */
.ml-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-bottom: 0.75rem; }
.ml-file-actions { display: flex; flex-direction: column; gap: 0.5rem; }
.ml-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; margin-top: 0.75rem; }
.metric-card {
    display: flex; flex-direction: column; align-items: center; gap: 0.2rem;
    padding: 0.7rem; text-align: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    transition: var(--t-normal);
}
.metric-card:hover { border-color: var(--glass-border-bright); }
.metric-label { font-size: 0.62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.7px; font-weight: 700; }
.metric-value { font-size: 1.15rem; font-weight: 800; color: var(--cyan); font-family: var(--font-mono); }
.confusion-container { margin-top: 1rem; text-align: center; }
.confusion-container canvas { max-width: 100%; border-radius: var(--radius-sm); }
.sub-heading {
    font-size: 0.72rem; color: var(--cyan); margin-bottom: 0.5rem;
    font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; opacity: 0.8;
}
#featureCanvas { width: 100%; border-radius: var(--radius-sm); }

/* ─── Control Panel ────────────────────────────────────────────── */
.control-body { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem; }
.control-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem; }
.ctrl-btn {
    padding: 0.65rem; flex-direction: column;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.78rem; font-weight: 500;
    cursor: pointer; transition: var(--t-normal);
    font-family: var(--font-sans);
    display: flex; align-items: center; justify-content: center; gap: 0.25rem;
    text-align: center;
}
.ctrl-btn:hover {
    background: var(--violet-dim); border-color: var(--violet);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--violet-glow);
}
.ctrl-btn.active {
    background: var(--cyan-dim); border-color: var(--cyan);
    color: var(--cyan);
    box-shadow: 0 0 16px var(--cyan-glow);
}

.manual-controls h3, .control-sliders h3, .servo-status h3 {
    font-size: 0.72rem; font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.65rem;
    text-transform: uppercase; letter-spacing: 0.8px;
}
.active-gesture {
    font-size: 1.8rem; font-weight: 900;
    text-align: center; color: var(--cyan);
    margin-bottom: 0.75rem; letter-spacing: 2px;
    text-shadow: 0 0 20px var(--cyan-glow);
}
.finger-indicators { display: flex; flex-direction: column; gap: 0.45rem; }
.finger-ind { display: flex; align-items: center; gap: 0.5rem; }
.finger-ind span { font-size: 0.68rem; font-family: var(--font-mono); color: var(--text-muted); width: 2.8rem; }
.finger-bar { flex: 1; height: 6px; background: var(--glass-bg); border-radius: var(--radius-pill); overflow: hidden; }
.finger-fill { height: 100%; width: 50%; background: linear-gradient(90deg, var(--cyan), var(--violet)); border-radius: var(--radius-pill); transition: width 0.3s ease; }

/* ─── Finger Control Panel ─────────────────────────────────────── */
.finger-desc { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.75rem; line-height: 1.5; }
.finger-sliders { display: flex; flex-direction: column; gap: 0.65rem; }
.finger-slider-row {
    display: flex; align-items: center; gap: 0.6rem;
}
.finger-slider-label { font-size: 0.75rem; color: var(--text-secondary); width: 5rem; font-weight: 500; white-space: nowrap; }
.finger-range { flex: 1; }
.finger-angle { font-size: 0.72rem; font-family: var(--font-mono); color: var(--cyan); width: 2.8rem; text-align: right; font-weight: 600; }
.finger-quick { display: flex; gap: 0.25rem; }
.fq-btn {
    width: 28px; height: 28px; padding: 0;
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    border-radius: var(--radius-xs); cursor: pointer;
    font-size: 0.85rem; display: flex; align-items: center; justify-content: center;
    transition: var(--t-fast); color: var(--text-secondary);
}
.fq-btn:hover { background: var(--cyan-dim); border-color: var(--cyan); color: var(--cyan); }
.finger-presets { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; }

/* ─── Recording Panel ──────────────────────────────────────────── */
.rec-controls { margin-bottom: 0.6rem; }
.active-rec-info {
    background: var(--rose-dim);
    border: 1px solid hsla(0,84%,60%,0.3);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.9rem; margin-bottom: 0.6rem;
}
.active-rec-info .stat-row { border-bottom-color: hsla(0,84%,60%,0.1); }
.recordings-list {
    max-height: 220px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 0.45rem;
    padding-right: 0.25rem;
}
.recordings-list-wrap { margin-top: 0.75rem; }
.empty-msg {
    font-size: 0.72rem; color: var(--text-muted); text-align: center;
    padding: 1.25rem; border: 1px dashed var(--glass-border); border-radius: var(--radius-sm);
}
.rec-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.55rem 0.75rem;
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm); transition: var(--t-normal);
}
.rec-item:hover { border-color: var(--glass-border-bright); background: var(--glass-bg-hover); }
.rec-info { display: flex; flex-direction: column; gap: 0.1rem; }
.rec-name { font-size: 0.78rem; font-weight: 600; color: var(--text-primary); }
.rec-meta { font-size: 0.65rem; color: var(--text-muted); font-family: var(--font-mono); }
.rec-actions { display: flex; gap: 0.3rem; }
.btn-delete { color: var(--rose); }
.btn-delete:hover { background: var(--rose-dim); border-color: var(--rose); }
.mt-2 { margin-top: 0.75rem; }

/* ─── Deploy Panel ─────────────────────────────────────────────── */
.deploy-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}
.deploy-banner {
    display: flex;
    gap: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    align-items: center;
}
.deploy-icon-container {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-sm);
    background: rgba(242, 122, 48, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #f27a30;
    border: 1px solid rgba(242, 122, 48, 0.2);
}
.svg-deploy-icon {
    width: 34px;
    height: 34px;
}
.deploy-text-block h3 {
    font-size: 1.35rem;
    font-weight: 750;
    margin-bottom: 0.45rem;
    color: var(--text-primary);
}
.deploy-text-block p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}
.deploy-columns {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 1.5rem;
}
.deploy-actions-panel, .deploy-instructions-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.deploy-fact-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}
.deploy-fact-card h4 {
    font-size: 1.15rem;
    font-weight: 750;
    margin-top: 0;
    margin-bottom: 1.15rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.65rem;
}
.deploy-facts {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
    padding: 0;
    margin: 0;
}
.deploy-facts li {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.55;
}
.svg-check {
    width: 20px;
    height: 20px;
    stroke: #10B981;
    stroke-width: 3;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    margin-top: 2px;
}
.deploy-action-buttons {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
}
.btn-deploy {
    width: 100%;
    text-align: center;
    font-size: 1.25rem !important;
    padding: 0.95rem 1.25rem !important;
    border-radius: 30px !important;
    font-weight: 750 !important;
    background: linear-gradient(135deg, #f27a30 0%, #ea580c 100%) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 4px 15px rgba(242, 122, 48, 0.15) !important;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-deploy:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(242, 122, 48, 0.25) !important;
}
.btn-laptop {
    width: 100%;
    text-align: center;
    font-size: 0.98rem !important;
    padding: 0.8rem 1.2rem !important;
    border-radius: 20px !important;
    font-weight: 650 !important;
    background: transparent !important;
    border: 1.5px solid var(--glass-border) !important;
    color: var(--text-secondary) !important;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-laptop:hover {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: var(--glass-border-bright) !important;
    color: var(--text-primary) !important;
}
.deploy-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    margin: 0;
}
.deploy-result, .deploy-path, .deploy-info {
    padding: 1.15rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--glass-border);
    font-size: 0.92rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    line-height: 1.5;
}
.deploy-steps {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}
.deploy-steps h4 {
    font-size: 1.15rem;
    font-weight: 750;
    margin-top: 0;
    margin-bottom: 1.15rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.65rem;
}
.deploy-steps-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
    padding: 0;
    margin: 0;
    counter-reset: step;
}
.deploy-steps-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    font-size: 0.92rem;
    color: var(--text-secondary);
    counter-increment: step;
    line-height: 1.55;
}
.deploy-steps-list li::before {
    content: counter(step);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(242, 122, 48, 0.1);
    border: 1.5px solid rgba(242, 122, 48, 0.2);
    color: #f27a30;
    font-weight: 750;
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}
.deploy-steps-list li strong {
    color: var(--text-primary);
}
.deploy-steps-list li code {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-xs);
    border: 1px solid var(--glass-border);
    color: var(--cyan);
}

/* ─── Laptop Mode Modal ────────────────────────────────────────── */
.lm-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: hsla(216,60%,4%,0.75);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.2s ease;
}
.lm-card {
    background: var(--navy-700);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    width: 540px; max-width: calc(100vw - 2rem);
    max-height: 90vh; overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.lm-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}
.lm-title-row { display: flex; align-items: center; gap: 0.75rem; }
.lm-icon { font-size: 1.8rem; }
.lm-header h2 { font-size: 1rem; font-weight: 700; }
.lm-subtitle { font-size: 0.75rem; color: var(--text-muted); }
.lm-close {
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    color: var(--text-muted); cursor: pointer; font-size: 0.9rem;
    display: flex; align-items: center; justify-content: center;
    transition: var(--t-fast);
}
.lm-close:hover { background: var(--rose-dim); border-color: var(--rose); color: var(--rose); }
.lm-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.lm-alert {
    display: flex; gap: 0.75rem; align-items: flex-start;
    padding: 0.85rem 1rem;
    background: var(--amber-dim); border: 1px solid var(--amber);
    border-radius: var(--radius-sm); font-size: 0.78rem;
    color: var(--text-secondary);
}
.lm-alert-icon { font-size: 1.1rem; flex-shrink: 0; }
.lm-alert strong { color: var(--text-primary); }
.lm-steps { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }
.lm-step { display: flex; gap: 0.75rem; align-items: flex-start; }
.lm-step-num {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    background: var(--cyan-dim); border: 1px solid var(--cyan);
    color: var(--cyan); font-weight: 700; font-size: 0.78rem;
    display: flex; align-items: center; justify-content: center;
}
.lm-step-body { display: flex; flex-direction: column; gap: 0.2rem; padding-top: 0.3rem; }
.lm-step-body strong { font-size: 0.82rem; color: var(--text-primary); }
.lm-step-body span { font-size: 0.75rem; color: var(--text-secondary); }
.lm-path {
    display: block; font-family: var(--font-mono); font-size: 0.7rem;
    background: var(--navy-800); padding: 0.4rem 0.6rem;
    border-radius: var(--radius-xs); color: var(--cyan); margin-top: 0.3rem;
    border: 1px solid var(--glass-border);
}
.lm-copy-btn {
    margin-top: 0.25rem; cursor: pointer; font-size: 0.72rem;
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    border-radius: var(--radius-xs); color: var(--text-secondary);
    padding: 0.2rem 0.5rem; transition: var(--t-fast);
}
.lm-copy-btn:hover { background: var(--cyan-dim); border-color: var(--cyan); color: var(--cyan); }
.lm-footer { display: flex; flex-direction: column; gap: 0.75rem; padding-top: 0.5rem; border-top: 1px solid var(--glass-border); }
.lm-tip {
    display: flex; gap: 0.5rem; align-items: flex-start;
    font-size: 0.75rem; color: var(--text-secondary);
}
.lm-tip-icon { font-size: 1rem; flex-shrink: 0; }
.lm-tip strong { color: var(--text-primary); }

/* ─── Toast Notifications ──────────────────────────────────────── */
#toastContainer {
    position: fixed; top: calc(var(--topbar-h) + 0.75rem); right: 1.25rem;
    z-index: 9999;
    display: flex; flex-direction: column; gap: 0.5rem;
    pointer-events: none;
}
.toast {
    display: flex; align-items: flex-start; gap: 0.65rem;
    padding: 0.85rem 1rem;
    background: var(--navy-700);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    min-width: 280px; max-width: 380px;
    box-shadow: var(--shadow-lg);
    pointer-events: all;
    animation: toastIn 0.35s cubic-bezier(0.34,1.56,0.64,1);
    cursor: pointer;
    transition: var(--t-normal);
}
.toast:hover { transform: translateX(-3px); }
.toast.toast-exit { animation: toastOut 0.25s ease forwards; }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 0.05rem; }
.toast-body { flex: 1; }
.toast-title { font-size: 0.82rem; font-weight: 700; color: var(--text-primary); line-height: 1.3; }
.toast-msg   { font-size: 0.72rem; color: var(--text-secondary); margin-top: 0.15rem; line-height: 1.4; }
.toast-bar   { height: 3px; border-radius: var(--radius-pill); margin-top: 0.5rem; animation: toastBar 4s linear forwards; }
.toast.success { border-color: hsla(160,84%,39%,0.4); }
.toast.success .toast-bar { background: var(--emerald); }
.toast.error   { border-color: hsla(0,84%,60%,0.4); }
.toast.error .toast-bar { background: var(--rose); }
.toast.info    { border-color: var(--glass-border-bright); }
.toast.info .toast-bar { background: var(--cyan); }
.toast.warning { border-color: hsla(38,92%,50%,0.4); }
.toast.warning .toast-bar { background: var(--amber); }

/* ─── Stat Cards ───────────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin-bottom: 0.75rem; }
.stat-card {
    padding: 0.75rem; text-align: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    transition: var(--t-normal);
}
.stat-card:hover { border-color: var(--glass-border-bright); }
.stat-card-value { font-size: 1.4rem; font-weight: 800; color: var(--cyan); font-family: var(--font-mono); display: block; }
.stat-card-label { font-size: 0.62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; font-weight: 600; }

/* ─── Utilities ────────────────────────────────────────────────── */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 0.75rem; }
.mt-3 { margin-top: 1.25rem; }
.mb-2 { margin-bottom: 0.75rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.text-muted { color: var(--text-muted); font-size: 0.75rem; }
.text-cyan { color: var(--cyan); }
.text-emerald { color: var(--emerald); }
code {
    font-family: var(--font-mono); font-size: 0.78em;
    background: var(--glass-bg); padding: 0.1rem 0.4rem;
    border-radius: var(--radius-xs); border: 1px solid var(--glass-border); color: var(--cyan);
}

/* ─── Animations ───────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes statusPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.6; transform: scale(0.9); }
}
@keyframes recordPulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--rose-dim); }
    50%       { box-shadow: 0 0 0 8px transparent; }
}
@keyframes gestureIn {
    from { transform: scale(0.7) rotate(-5deg); opacity: 0; }
    to   { transform: scale(1) rotate(0deg); opacity: 1; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(120%); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); max-height: 100px; }
    to   { opacity: 0; transform: translateX(120%); max-height: 0; padding: 0; }
}
@keyframes toastBar {
    from { width: 100%; }
    to   { width: 0%; }
}

/* ─── Responsive ───────────────────────────────────────────────── */
@media (max-width: 1400px) {
    :root { --sidebar-w: 220px; }
    #dashboard { grid-template-columns: 1.5fr 1fr 1fr; }
}

@media (max-width: 1200px) {
    #dashboard { grid-template-columns: 1fr 1fr; }
    .panel-wide { grid-column: 1 / -1; }
    .control-body { grid-template-columns: 1fr 1fr; }
    .deploy-layout { grid-template-columns: 1fr; gap: 1rem; }
}

@media (max-width: 900px) {
    :root { --sidebar-w: 200px; }
    #dashboard { grid-template-columns: 1fr; }
    .control-body { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    :root { --sidebar-w: 260px; }
    #sidebar {
        transform: translateX(-100%);
        transition: transform var(--t-slow);
    }
    #sidebar.mobile-open { transform: translateX(0); }
    #main-content { margin-left: 0 !important; }
    #dashboard { padding: 0.75rem; gap: 0.75rem; }
    .topbar-signal-quality { display: none; }
    #topbar { padding: 0 1rem; }
}

/* ══════════════════════════════════════════════════════════════
   SIDE PANELS — Notifications & Profile
══════════════════════════════════════════════════════════════ */

/* Overlay that dims the background */
.panel-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 12, 0.4);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1100;
    transition: opacity 0.25s ease;
}
.panel-overlay.active { display: block; }

/* The panel itself */
.side-panel {
    position: fixed;
    top: 0;
    right: -440px;
    width: 390px;
    max-width: 95vw;
    height: 100vh;
    background: linear-gradient(135deg, rgba(13, 27, 54, 0.75) 0%, rgba(6, 14, 28, 0.85) 100%);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-left: 2px solid rgba(0, 212, 255, 0.45);
    box-shadow: -8px 0 25px rgba(0, 212, 255, 0.18), -15px 0 45px rgba(0, 0, 0, 0.65);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}
.side-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, var(--cyan) 0%, var(--purple) 100%);
    opacity: 0.85;
    z-index: 10;
    pointer-events: none;
}
.side-panel.open { right: 0; }

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1.75rem 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}
.panel-title {
    font-size: 1.1rem;
    font-weight: 750;
    color: #fff;
    letter-spacing: -0.3px;
}
.panel-subtitle {
    font-size: 0.78rem;
    color: #4A6080;
    padding: 0.6rem 1.75rem 0.85rem;
    margin: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    flex-shrink: 0;
}
.panel-close {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #4A6080;
    font-size: 0.75rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.panel-close:hover {
    color: #fff;
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    transform: rotate(90deg);
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 212, 255, 0.2) transparent;
}

/* ── Notification Timeline ──────────────────────────────────── */
.notif-loading, .notif-empty {
    text-align: center;
    color: #4A6080;
    font-size: 0.85rem;
    margin-top: 2.5rem;
}

.notif-item {
    display: flex;
    gap: 1rem;
    padding: 1.1rem 1rem 1.1rem 1.5rem;
    margin: 0.5rem -0.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    background: rgba(255, 255, 255, 0.015);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}
.notif-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--cyan);
    opacity: 0.85;
}
.notif-feature::before { background: #10B981; }
.notif-security::before { background: #EF4444; }
.notif-deploy::before { background: #7C3AED; }

.notif-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(0, 212, 255, 0.35);
    transform: translateX(6px);
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.12);
}

.notif-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
    background: var(--cyan);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.6);
}
.notif-feature .notif-dot  { background: #10B981; box-shadow: 0 0 10px rgba(16, 185, 129, 0.6); }
.notif-security .notif-dot { background: #EF4444; box-shadow: 0 0 10px rgba(239, 68, 68, 0.6); }
.notif-deploy .notif-dot   { background: #7C3AED; box-shadow: 0 0 10px rgba(124, 58, 237, 0.6); }

.notif-body { flex: 1; }
.notif-title {
    font-size: 0.88rem;
    font-weight: 650;
    color: #E2E8F0;
    margin-bottom: 0.25rem;
}
.notif-msg {
    font-size: 0.78rem;
    color: #8A9CAE;
    line-height: 1.55;
    margin-bottom: 0.45rem;
}
.notif-date {
    font-size: 0.7rem;
    color: #4A6080;
    font-family: var(--font-mono);
}

/* ── Profile Panel ──────────────────────────────────────────── */
.profile-auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.profile-avatar-placeholder {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(0, 212, 255, 0.25);
    background: rgba(0, 212, 255, 0.05);
    box-shadow: inset 0 0 12px rgba(0, 212, 255, 0.1);
}
.profile-avatar-large {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.95rem;
    font-weight: 800;
    margin: 0 auto 0.85rem;
    border-width: 2px;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.15);
    animation: avatar-breath-pulse 3.5s infinite ease-in-out;
}
@keyframes avatar-breath-pulse {
    0%, 100% { box-shadow: 0 0 15px rgba(0, 212, 255, 0.15); }
    50% { box-shadow: 0 0 25px rgba(124, 58, 237, 0.35); }
}

.profile-name {
    font-size: 1.15rem;
    font-weight: 750;
    color: #fff;
    margin-bottom: 0.15rem;
    letter-spacing: -0.2px;
}
.profile-username {
    font-size: 0.78rem;
    color: #4A6080;
    font-family: var(--font-mono);
    margin-bottom: 0.75rem;
}
.profile-role-badge {
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.25);
    color: var(--cyan);
    font-size: 0.7rem;
    font-weight: 650;
    padding: 3px 14px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-bottom: 1.35rem;
}

.profile-stats-row {
    display: flex;
    gap: 0.5rem;
    width: 100%;
    margin-bottom: 1.35rem;
}
.profile-stat {
    flex: 1;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 0.8rem 0.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.profile-stat:hover {
    background: rgba(0, 212, 255, 0.05);
    border-color: rgba(0, 212, 255, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.1);
}

.stat-val {
    font-size: 0.82rem;
    font-weight: 700;
    color: #E2E8F0;
    font-family: var(--font-mono);
}
.stat-lbl {
    font-size: 0.62rem;
    color: #4A6080;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-section-label {
    width: 100%;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 650;
    color: #4A6080;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-bottom: 0.55rem;
    margin-top: 0.6rem;
}

/* Login / Register tabs */
.profile-tabs {
    display: flex;
    width: 100%;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 1.25rem;
}
.profile-tab {
    flex: 1;
    background: none;
    border: none;
    color: #4A6080;
    font-size: 0.82rem;
    font-weight: 650;
    padding: 0.6rem 0;
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.3s ease;
}
.profile-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.02);
}
.profile-tab.active {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.18), rgba(124, 58, 237, 0.18));
    border: 1px solid rgba(0, 212, 255, 0.3);
    color: var(--cyan);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.1);
}

/* Shared panel inputs */
.panel-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(4, 13, 26, 0.65);
    color: #E2E8F0;
    font-size: 0.875rem;
    box-sizing: border-box;
    margin-bottom: 0.85rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.panel-input:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
    background: rgba(4, 13, 26, 0.85);
}
.panel-error {
    width: 100%;
    text-align: left;
    font-size: 0.78rem;
    color: #EF4444;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    margin-bottom: 0.6rem;
}
.w-full { width: 100%; }

/* Topbar avatar initials bubble */
.topbar-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 800;
    color: #09152B;
}

/* ─── Profile Card Styles ───────────────────────────────────────── */
.profile-card {
    position: relative;
    overflow: hidden;
    padding: 0 !important;
    border-radius: var(--radius-lg);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
}

.profile-banner {
    position: relative;
    height: 120px;
    width: 100%;
    overflow: hidden;
    background: var(--navy-800);
}

.profile-banner-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--cyan-dark), var(--cyan));
    opacity: 0.85;
}

.profile-banner-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(rgba(255, 255, 255, 0.15) 1px, transparent 1px);
    background-size: 16px 16px;
    opacity: 0.4;
}

.profile-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 2rem 1.2rem 2rem;
    position: relative;
    margin-top: -50px;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.profile-left {
    display: flex;
    align-items: flex-end;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.profile-avatar-ring {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    padding: 4px;
    background: var(--glass-bg);
    box-shadow: var(--shadow-md);
}

.profile-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background: var(--navy-500);
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar-placeholder {
    width: 100%;
    height: 100%;
}

.profile-status-dot {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--emerald);
    border: 3px solid var(--glass-bg);
    box-shadow: 0 2px 8px var(--emerald-glow);
}

.profile-identity {
    margin-bottom: 0.5rem;
}

.profile-name {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.profile-role {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--cyan);
    margin-top: 0.2rem;
}

.profile-location {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

.profile-right {
    margin-bottom: 0.5rem;
}

.profile-quick-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--glass-bg-light);
    border: 1px solid var(--glass-border);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
}

.pqs-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pqs-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.pqs-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.1rem;
}

.pqs-divider {
    width: 1px;
    height: 24px;
    background: var(--glass-border);
}

.profile-body {
    padding: 2rem;
    border-top: 1px solid var(--glass-border);
    background: var(--glass-bg-light);
}

.profile-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .profile-info-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .profile-main {
        justify-content: center;
        text-align: center;
        margin-top: -60px;
    }
    .profile-left {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    .profile-right {
        width: 100%;
        display: flex;
        justify-content: center;
    }
}

.profile-info-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.profile-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.profile-bio {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.profile-contact-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.profile-contact-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pcr-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pcr-details {
    display: flex;
    flex-direction: column;
}

.pcr-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.pcr-value {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

a.pcr-value:hover {
    color: var(--cyan);
    text-decoration: underline;
}

.profile-tags-section {
    grid-column: span 2;
}

@media (max-width: 768px) {
    .profile-tags-section {
        grid-column: span 1;
    }
}

.profile-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.profile-tag {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-pill);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    transition: all var(--t-fast);
}

.profile-tag:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.profile-tag.tag-primary {
    background: var(--cyan-dim);
    color: var(--cyan);
    border-color: rgba(45, 123, 96, 0.2);
}

.profile-tag.tag-violet {
    background: var(--violet-dim);
    color: var(--violet);
    border-color: rgba(139, 92, 246, 0.2);
}

.profile-tag.tag-emerald {
    background: var(--emerald-dim);
    color: var(--emerald);
    border-color: rgba(34, 197, 94, 0.2);
}

.profile-tag.tag-amber {
    background: var(--amber-dim);
    color: var(--amber);
    border-color: rgba(245, 158, 11, 0.2);
}

/* ─── Admin Console CSS Styles ──────────────────────────────────────── */

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    font-size: 0.88rem;
}

.admin-table th,
.admin-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--glass-border);
    vertical-align: middle;
}

.admin-table th {
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--glass-bg-light);
}

.admin-table tr:hover td {
    background: var(--glass-bg-hover);
}

.admin-table .user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-table .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text-on-dark);
    font-size: 0.85rem;
}

.admin-table .username {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: block;
}

.admin-table .display-name {
    font-weight: 600;
    color: var(--text-primary);
}

.admin-table .actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Data inspector cards */
.admin-data-card {
    background: var(--glass-bg-light);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.admin-data-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.admin-data-card .file-section {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.admin-data-card .file-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.admin-data-card .file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--navy-600);
    border: 1px solid var(--glass-border);
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.admin-data-card .file-name {
    font-family: var(--font-sans);
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}

.admin-data-card .file-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Updates admin layout */
.admin-update-item {
    background: var(--glass-bg-light);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.admin-update-item .notif-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.admin-update-item .notif-msg {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.admin-update-item .notif-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.4rem;
    font-size: 0.75rem;
}

.admin-update-item .notif-date {
    color: var(--text-muted);
}


/* ═══════════════════════════════════════════════════════════════════
   ARMx PREMIUM LIGHT-MODE OVERRIDES
   Inspired by the minimalist white/orange "Red. Lets Start Learning" screen
   ═══════════════════════════════════════════════════════════════════ */

/* 1. Side Panel Visual Transformation */
.side-panel {
    background: #ffffff !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-left: 1px solid #e5e7eb !important;
    box-shadow: -10px 0 45px rgba(0, 0, 0, 0.05) !important;
}

/* Remove dark purple left neon glow indicator */
.side-panel::before {
    display: none !important;
}

.panel-header {
    border-bottom: 1px solid #f3f4f6 !important;
}

.panel-title {
    color: #111827 !important;
    font-weight: 850 !important;
    font-size: 1.15rem !important;
}

.panel-subtitle {
    color: #6b7280 !important;
    border-bottom: 1px solid #f3f4f6 !important;
}

.panel-close {
    background: #f3f4f6 !important;
    border: 1px solid #e5e7eb !important;
    color: #6b7280 !important;
}

.panel-close:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #ef4444 !important;
    border-color: rgba(239, 68, 68, 0.2) !important;
}

/* 2. Light Theme Tabs Styling */
.notif-tabs {
    background: #f3f4f6 !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 12px !important;
    padding: 4px !important;
}

.profile-tab {
    background: transparent !important;
    color: #4b5563 !important;
    font-weight: 700 !important;
    font-size: 0.82rem !important;
    border: none !important;
}

.profile-tab.active {
    background: #ffffff !important;
    color: #f27a30 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04) !important;
}

/* 3. Input Overrides */
.panel-input,
.panel-textarea,
.panel-input[type="text"],
.panel-input[type="password"] {
    background: #f9fafb !important;
    border: 1px solid #e5e7eb !important;
    color: #111827 !important;
    border-radius: 8px !important;
    font-size: 0.88rem !important;
    padding: 0.65rem 0.75rem !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.panel-input:focus,
.panel-textarea:focus {
    background: #ffffff !important;
    border-color: #f27a30 !important;
    box-shadow: 0 0 0 3px rgba(242, 122, 48, 0.15) !important;
    outline: none !important;
}

/* 4. Action Buttons (Orange Primary Gradient) */
.btn-primary,
button.btn-primary {
    background: linear-gradient(135deg, #f27a30 0%, #ea580c 100%) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    border-radius: 20px !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(242, 122, 48, 0.16) !important;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
    cursor: pointer !important;
}

.btn-primary:hover,
button.btn-primary:hover {
    background: linear-gradient(135deg, #ea580c 0%, #d97706 100%) !important;
    box-shadow: 0 6px 18px rgba(242, 122, 48, 0.25) !important;
    transform: translateY(-1px) !important;
}

.btn-primary:active,
button.btn-primary:active {
    transform: translateY(0px) !important;
}

/* 5. Notification Timeline Items */
.notif-item {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.01) !important;
    border-radius: 14px !important;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.notif-item:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.03) !important;
}

.notif-title {
    color: #111827 !important;
    font-weight: 800 !important;
}

.notif-msg {
    color: #4b5563 !important;
    font-size: 0.82rem !important;
}

.notif-date {
    color: #9ca3af !important;
}

/* Dot adjustments for timeline */
.notif-dot {
    background: #f27a30 !important;
    box-shadow: 0 0 0 3px rgba(242, 122, 48, 0.15) !important;
}

/* 6. Nested Communication Threads (Replies) */
.nested-reply-card {
    background: #fffcf9 !important;
    border: 1px solid #fed7aa !important;
    border-left: 3px solid #f27a30 !important;
    border-radius: 8px !important;
    padding: 0.75rem 0.85rem !important;
    margin-top: 0.65rem !important;
    box-shadow: 0 2px 8px rgba(242, 122, 48, 0.02) !important;
}

/* 7. Error & Success Notification Banners */
.panel-error {
    background: #fef2f2 !important;
    border: 1px solid #fecaca !important;
    color: #ef4444 !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    padding: 0.65rem !important;
}

/* Profile specific details */
.profile-name {
    color: #111827 !important;
    font-weight: 850 !important;
}

.profile-username {
    color: #6b7280 !important;
}

.profile-role-badge {
    background: rgba(242, 122, 48, 0.08) !important;
    border: 1px solid rgba(242, 122, 48, 0.2) !important;
    color: #ea580c !important;
    font-weight: 700 !important;
}

.profile-stats-row {
    background: #f9fafb !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 12px !important;
}

.profile-stat .stat-val {
    color: #111827 !important;
}

.profile-stat .stat-lbl {
    color: #6b7280 !important;
}

.profile-section-label {
    color: #4b5563 !important;
    font-weight: 750 !important;
}

.btn-outline {
    background: #ffffff !important;
    border: 1px solid #d1d5db !important;
    color: #374151 !important;
    border-radius: 20px !important;
    font-weight: 700 !important;
}

.btn-outline:hover {
    background: #f9fafb !important;
    border-color: #9ca3af !important;
}


/* ═══════════════════════════════════════════════════════════════════
   WhatsApp-Style Inquiry Layout
   Two-pane: contact sidebar (left) + chat window (right)
   ═══════════════════════════════════════════════════════════════════ */

.wa-wrapper {
    display: flex;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border-radius: 0;
}

/* ── Left Sidebar: Contact List ──────────────────────────────── */
.wa-sidebar {
    width: 240px;
    min-width: 240px;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    overflow: hidden;
}

.wa-sidebar-header {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid #f3f4f6;
    flex-shrink: 0;
}

.wa-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2rem;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    background: #f9fafb;
    font-size: 0.78rem;
    color: #111827;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: var(--font-sans);
}

.wa-search-input:focus {
    border-color: #f27a30;
    box-shadow: 0 0 0 3px rgba(242, 122, 48, 0.1);
}

.wa-search-wrap {
    position: relative;
}

.wa-search-wrap svg {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}

.wa-contact-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.08) transparent;
}

.wa-contact-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 0.85rem;
    cursor: pointer;
    border-bottom: 1px solid #f9fafb;
    transition: background 0.15s ease;
    position: relative;
}

.wa-contact-item:hover {
    background: #f9fafb;
}

.wa-contact-item.active {
    background: #fdf2e9;
    border-left: 3px solid #f27a30;
    padding-left: calc(0.85rem - 3px);
}

.wa-contact-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
}

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

.wa-contact-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wa-contact-preview {
    font-size: 0.7rem;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.15rem;
    line-height: 1.3;
}

.wa-contact-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
    flex-shrink: 0;
}

.wa-contact-time {
    font-size: 0.62rem;
    color: #9ca3af;
    font-family: var(--font-mono);
    white-space: nowrap;
}

.wa-contact-badge {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f27a30;
    flex-shrink: 0;
}

/* ── Right Pane: Chat Window ─────────────────────────────────── */
.wa-chat-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #fafafa;
    overflow: hidden;
}

.wa-chat-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 1rem;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.wa-chat-header-info {
    flex: 1;
    min-width: 0;
}

.wa-chat-header-name {
    font-size: 0.88rem;
    font-weight: 750;
    color: #111827;
}

.wa-chat-header-sub {
    font-size: 0.68rem;
    color: #6b7280;
}

.wa-chat-header-actions {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.wa-header-btn {
    background: transparent;
    border: none;
    padding: 5px;
    color: #9ca3af;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.wa-header-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

/* ── Chat Body (Scrollable Bubbles) ──────────────────────────── */
.wa-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.08) transparent;
    background: #fafafa;
}

/* ── Date Divider ────────────────────────────────────────────── */
.wa-date-divider {
    text-align: center;
    margin: 0.6rem 0;
}

.wa-date-divider span {
    display: inline-block;
    background: #e5e7eb;
    color: #6b7280;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.25rem 0.85rem;
    border-radius: 12px;
    letter-spacing: 0.2px;
    text-transform: uppercase;
    font-family: var(--font-sans);
}

/* ── Chat Bubble Row ─────────────────────────────────────────── */
.wa-bubble-row {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    position: relative;
    width: -webkit-fit-content;
    width: -moz-fit-content;
    width: fit-content;
}

.wa-bubble-row.sent {
    align-self: flex-end;
    align-items: flex-end;
}

.wa-bubble-row.received {
    align-self: flex-start;
    align-items: flex-start;
}

/* ── Bubble ──────────────────────────────────────────────────── */
.wa-bubble {
    padding: 0.55rem 0.75rem;
    font-size: 0.8rem;
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-wrap;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    width: -webkit-fit-content;
    width: -moz-fit-content;
    width: fit-content;
    max-width: 100%;
}

.wa-bubble.sent {
    background: #fdf2e9;
    color: #431407;
    border: 1px solid #fed7aa;
    border-radius: 12px 12px 2px 12px;
    align-items: flex-end;
}

.wa-bubble.received {
    background: #ffffff;
    color: #111827;
    border: 1px solid #e5e7eb;
    border-radius: 12px 12px 12px 2px;
    align-items: flex-start;
}

.wa-bubble .wa-attachment {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.6rem;
    background: rgba(0,0,0,0.03);
    border-radius: 8px;
    margin-top: 0.35rem;
    font-size: 0.72rem;
    color: #4b5563;
    text-decoration: none;
    border: 1px solid rgba(0,0,0,0.06);
    cursor: pointer;
    transition: background 0.15s;
}

.wa-bubble .wa-attachment:hover {
    background: rgba(0,0,0,0.06);
}

.wa-bubble .wa-attachment-img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    margin-top: 0.35rem;
    object-fit: cover;
}

/* Bubble timestamp */
.wa-bubble-time {
    font-size: 0.58rem;
    color: #9ca3af;
    margin-top: 0.2rem;
    font-family: var(--font-mono);
    padding: 0 2px;
}

/* Per-message delete icon (shows on hover) */
.wa-bubble-delete {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #9ca3af;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    transition: all 0.2s ease;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    padding: 0;
}

.wa-bubble-row.sent .wa-bubble-delete {
    left: -32px;
}

.wa-bubble-row.received .wa-bubble-delete {
    right: -32px;
}

/* Transparent hover bridge to close the gap and prevent hover loss */
.wa-bubble-delete::before {
    content: '';
    position: absolute;
    top: -10px;
    bottom: -10px;
    left: -20px;
    right: -20px;
    background: transparent;
    z-index: -1;
}

.wa-bubble-row:hover .wa-bubble-delete {
    opacity: 0.8;
    pointer-events: auto;
}

.wa-bubble-delete:hover {
    opacity: 1 !important;
    color: #ef4444;
    border-color: #fecaca;
    background: #fef2f2;
    transform: translateY(-50%) scale(1.08);
}

/* ── Input Bar ───────────────────────────────────────────────── */
.wa-input-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 0.75rem;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.wa-attach-btn {
    background: transparent;
    border: none;
    padding: 5px;
    color: #6b7280;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.wa-attach-btn:hover {
    color: #f27a30;
    background: rgba(242, 122, 48, 0.06);
}

.wa-msg-input {
    flex: 1;
    padding: 0.5rem 0.85rem;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    background: #f3f4f6;
    font-size: 0.82rem;
    color: #111827;
    outline: none;
    min-height: 36px;
    height: 36px;
    box-sizing: border-box;
    font-family: var(--font-sans);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.wa-msg-input:focus {
    border-color: #f27a30;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(242, 122, 48, 0.1);
}

.wa-send-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    border: none;
    background: #f27a30;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s, background 0.2s;
}

.wa-send-btn:hover {
    transform: scale(1.06);
    background: #ea580c;
}

/* File preview strip */
.wa-file-preview {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.65rem;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.72rem;
    color: #4b5563;
    flex-shrink: 0;
}

.wa-file-preview-name {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wa-file-preview-cancel {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    padding: 0 2px;
    transition: color 0.15s;
}

.wa-file-preview-cancel:hover {
    color: #ef4444;
}

/* ── Empty State (no chat selected) ──────────────────────────── */
.wa-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    text-align: center;
    padding: 2rem;
    background: #fafafa;
}

.wa-empty-state svg {
    margin-bottom: 1rem;
    opacity: 0.4;
}

.wa-empty-state h4 {
    color: #6b7280;
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.35rem 0;
}

.wa-empty-state p {
    color: #9ca3af;
    font-size: 0.78rem;
    margin: 0;
    line-height: 1.5;
}

/* Override: stop notif-item hover lift for inquiry cards inside WA layout */
.wa-wrapper .notif-item {
    transform: none !important;
}

/* Sender label inside received bubbles */
.wa-bubble-sender {
    font-size: 0.62rem;
    font-weight: 800;
    color: #ea580c;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 0.35rem;
    background: rgba(234, 88, 12, 0.07);
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid rgba(234, 88, 12, 0.15);
    display: inline-block;
}

/* Dynamic widening for WhatsApp Inquiries UI in Side Panel */
.side-panel.wide-inquiries {
    width: 900px !important;
    right: -950px !important;
}
.side-panel.wide-inquiries.open {
    right: 0 !important;
}

.side-panel.medium-inquiries {
    width: 480px !important;
    right: -520px !important;
}
.side-panel.medium-inquiries.open {
    right: 0 !important;
}

.side-panel.wide-inquiries .panel-content,
.side-panel.medium-inquiries .panel-content {
    padding: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Ensure nice scrolling inside sidebar and chat body within dynamic width wrapper */
.side-panel.wide-inquiries .wa-wrapper {
    height: 100% !important;
    width: 100% !important;
    display: flex !important;
}

/* On mobile/narrow screens, restrict the panels to screen bounds */
@media (max-width: 950px) {
    .side-panel.wide-inquiries,
    .side-panel.medium-inquiries {
        width: 100vw !important;
        max-width: 100vw !important;
        right: -105vw !important;
    }
    .side-panel.wide-inquiries.open,
    .side-panel.medium-inquiries.open {
        right: 0 !important;
    }
    .wa-wrapper {
        flex-direction: column;
    }
    .wa-sidebar {
        width: 100% !important;
        min-width: 0 !important;
        height: 220px !important;
        border-right: none !important;
        border-bottom: 1px solid #e5e7eb !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   PREMIUM FILE VIEWER LIGHTBOX MODAL
   ═══════════════════════════════════════════════════════════════════ */
.file-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 25000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.file-viewer-modal.open {
    opacity: 1;
    pointer-events: auto;
}

.fv-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.fv-content-card {
    position: relative;
    width: 90%;
    max-width: 850px;
    height: 80%;
    max-height: 720px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1;
}

.file-viewer-modal.open .fv-content-card {
    transform: scale(1);
}

.fv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.95rem 1.45rem;
    border-bottom: 1px solid #f3f4f6;
    background: #ffffff;
    flex-shrink: 0;
}

.fv-title {
    font-size: 0.98rem;
    font-weight: 800;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
}

.fv-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.fv-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.85rem !important;
    font-size: 0.8rem !important;
    border-radius: 18px !important;
    background: linear-gradient(135deg, #f27a30 0%, #ea580c 100%) !important;
    box-shadow: 0 4px 10px rgba(242, 122, 48, 0.15) !important;
    border: none !important;
    color: #fff !important;
    text-decoration: none !important;
    font-weight: 700 !important;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fv-download-btn:hover {
    background: linear-gradient(135deg, #ea580c 0%, #d97706 100%) !important;
    box-shadow: 0 6px 14px rgba(242, 122, 48, 0.22) !important;
    transform: translateY(-1px);
}

.fv-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #e5e7eb;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fv-close-btn:hover {
    background: #fef2f2;
    color: #ef4444;
    border-color: #fecaca;
    transform: rotate(90deg);
}

.fv-body {
    flex: 1;
    overflow: auto;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
}

.fv-body-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.fv-body-iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    background: #ffffff;
}

.fv-body-text {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 1.2rem;
    background: #0f172a;
    color: #e2e8f0;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.5;
    border-radius: 12px;
    overflow: auto;
    white-space: pre-wrap;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.5);
    text-align: left;
}

.fv-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
    color: #6b7280;
}

.fv-fallback svg {
    color: #9ca3af;
}

.fv-fallback h4 {
    font-size: 1.05rem;
    font-weight: 750;
    color: #111827;
    margin: 0;
}

.fv-fallback p {
    font-size: 0.8rem;
    margin: 0;
}
