/* core layout */
:root{
    --accent: #00d4ff;
    --accent-alt: #00a8ff;
    --text-primary: #e8eefb;
    --text-secondary: #8793a8;
    --bg-primary: #060b18;
    --bg-secondary: #0a1226;
    --bg-tertiary: #111c33;
    --border: #1f2d46;
    --muted: rgba(255,255,255,0.08);
    --glass: rgba(255,255,255,0.03);
    --radius: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-2xl: 36px;
    --radius-3xl: 44px;
    --glass-bg: rgba(8, 16, 30, 0.78);
    --glass-border: rgba(120, 200, 255, 0.18);
    --glass-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
    --gradient-primary: linear-gradient(135deg, #00d4ff 0%, #0088ff 100%);
    --gradient-secondary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-dark: linear-gradient(180deg, rgba(0, 212, 255, 0.15) 0%, rgba(0, 0, 0, 0) 100%);
  }
  
  /* ============================================
     SIDEBAR FORCE VISIBLE FIX
     ============================================ */
.sidebar {
    display: flex !important;
    position: relative !important;
    left: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex: 0 0 280px;
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(140, 200, 255, 0.22);
    background:
      radial-gradient(circle at top left, rgba(60, 150, 255, 0.12), transparent 55%),
      rgba(7, 14, 28, 0.9);
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(18px);
    align-self: stretch;
    overflow: hidden;
}

  /* ============================================
     ANIMATIONS
     ============================================ */
  @keyframes fadeInUp {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  @keyframes slideInRight {
    from {
      opacity: 0;
      transform: translateX(-20px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }
  
  @keyframes glow {
    0%, 100% {
      box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
    }
    50% {
      box-shadow: 0 0 30px rgba(0, 212, 255, 0.8);
    }
  }
  
  @keyframes pulse {
    0%, 100% {
      opacity: 1;
    }
    50% {
      opacity: 0.8;
    }
  }
  
  .card-item {
    animation: fadeInUp 0.4s ease-out;
  }
  
  .chat-item {
    animation: slideInRight 0.3s ease-out;
  }
  
  *{box-sizing:border-box}
  html,body{height:100%;margin:0;padding:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif}
  :root{
    --scrollbar-track: rgba(6, 12, 28, 0.6);
    --scrollbar-thumb: rgba(90, 110, 140, 0.7);
    --scrollbar-thumb-hover: rgba(120, 145, 185, 0.9);
  }
body{display:flex;flex-direction:column;min-height:100vh;background:radial-gradient(circle at 15% 10%, rgba(40, 120, 255, 0.08), transparent 45%),radial-gradient(circle at 85% 20%, rgba(90, 70, 190, 0.08), transparent 48%),linear-gradient(135deg, #04070f 0%, #070e1a 45%, #050810 100%);color:var(--text-primary);transition:background .5s,color .3s;overflow-x:hidden}

html[data-ui-mode="mobile"],
html[data-ui-mode="mobile"] body,
html[data-ui-mode="tablet"],
html[data-ui-mode="tablet"] body {
  min-height: calc(var(--app-vh, 1vh) * 100);
}

html[data-ui-mode="mobile"] .container,
html[data-ui-mode="tablet"] .container {
  min-height: calc(var(--app-vh, 1vh) * 100);
}

html[data-ui-mode="mobile"] .panel,
html[data-ui-mode="tablet"] .panel {
  min-height: 0;
}

html[data-ui-mode="mobile"] .bar,
html[data-ui-mode="tablet"] .bar {
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
}

html[data-ui-mode="mobile"] .chat-box,
html[data-ui-mode="tablet"] .chat-box {
  overscroll-behavior: contain;
}
  
.container{display:flex;flex:1 1 auto;min-height:0;height:auto;align-items:stretch;gap:18px;padding:18px;width:100%;max-width:none}
  
  /* ============================================
     SIDEBAR - ChatGPT Style (FIXED)
     ============================================ */
  .sidebar {
    width: 260px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border-right: 1px solid rgba(0, 212, 255, 0.1);
    position: relative;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 212, 255, 0.3) transparent;
    box-shadow: inset -1px 0 rgba(0, 212, 255, 0.05);
  }

  /* Scrollable content wrapper */
.sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--text-secondary) transparent;
    min-height: 0;
}

  .sidebar::-webkit-scrollbar {
    width: 6px;
  }

  .sidebar::-webkit-scrollbar-track {
    background: transparent;
  }

  .sidebar::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 10px;
  }

  .sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
  }

  .sidebar-content::-webkit-scrollbar {
    width: 6px;
  }

  .sidebar-content::-webkit-scrollbar-track {
    background: transparent;
  }

  .sidebar-content::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 10px;
  }

  .sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
  }

  /* Sidebar Header - Fixed at top */
.sidebar-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin: 14px 14px 10px;
    padding: 16px;
    border: 1px solid rgba(0, 212, 255, 0.14);
    border-radius: var(--radius-2xl);
    flex-shrink: 0;
    position: sticky;
    top: 12px;
    background:
      radial-gradient(circle at top left, rgba(0, 212, 255, 0.08), transparent 42%),
      linear-gradient(180deg, rgba(8, 16, 34, 0.98), rgba(5, 11, 24, 0.96));
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.24);
    z-index: 3;
    backdrop-filter: blur(16px);
}

  .sidebar-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
  }

.new-chat-btn {
    min-height: 42px;
    padding: 0 16px;
    background: var(--gradient-primary);
    border: none;
    border-radius: 999px;
    color: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.25);
    position: relative;
    overflow: hidden;
    width: auto;
    margin: 0;
    flex: 1;
  }
  
  .new-chat-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: left 0.3s ease;
  }
  
  .new-chat-btn:hover::before {
    left: 100%;
  }

  .new-chat-btn:hover {
    box-shadow: 0 12px 32px rgba(0, 212, 255, 0.4);
    transform: translateY(-2px);
  }

  .sidebar-collapse-btn {
    width: 36px;
    height: 36px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
  }

  #desktopCollapseBtn {
    width: 42px !important;
    height: 42px !important;
    margin-left: 0 !important;
    border-radius: 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)) !important;
    border: 1px solid rgba(0, 212, 255, 0.16) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 8px 18px rgba(0, 0, 0, 0.18) !important;
  }

  /* Search Section */
  .sidebar-search {
    padding: 10px 16px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
  }

.search-input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid rgba(0, 212, 255, 0.15);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    backdrop-filter: blur(12px);
}

  .search-input:focus {
    background: rgba(0, 212, 255, 0.05);
    border-color: rgba(0, 212, 255, 0.4);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
  }

  .search-input::placeholder {
    color: var(--text-secondary);
  }

  /* Navigation Sections */
  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    flex-shrink: 0;
  }

  .nav-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .section-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 8px 0 4px;
    font-weight: 700;
    margin: 0;
  }

.nav-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(0, 191, 255, 0.04);
    border: 1.5px solid rgba(0, 191, 255, 0.12);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    width: 100%;
    text-align: left;
    min-height: 44px;
    white-space: normal;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(12px);
}

  .nav-item:hover {
    background: rgba(0, 191, 255, 0.12);
    border-color: rgba(0, 191, 255, 0.3);
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(0, 191, 255, 0.2);
  }

  .nav-item.active {
    background: linear-gradient(135deg, rgba(0, 191, 255, 0.15) 0%, rgba(0, 136, 255, 0.08) 100%);
    color: #00d4ff;
    border-color: rgba(0, 191, 255, 0.4);
    box-shadow: 0 0 20px rgba(0, 191, 255, 0.2), inset 0 0 20px rgba(0, 191, 255, 0.08);
  }

  .nav-item .nav-icon {
    font-size: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(0, 191, 255, 0.1);
    border-radius: 12px;
    transition: all 0.3s ease;
  }

  .nav-item:hover .nav-icon {
    background: rgba(0, 191, 255, 0.2);
    transform: scale(1.1);
  }

  .nav-item.active .nav-icon {
    background: rgba(0, 191, 255, 0.3);
    box-shadow: 0 0 12px rgba(0, 191, 255, 0.4);
  }

  .nav-item .nav-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    white-space: nowrap;
  }

  .nav-badge {
    font-size: 10px;
    background: linear-gradient(90deg, #ff7b2c, #ff9e64);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    flex-shrink: 0;
  }

  /* Chats Section */
  .chats-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid rgba(0, 191, 255, 0.15);
    /* flex: 1 and min-height: 0 are no longer needed as the parent scrolls */
    background: linear-gradient(180deg, rgba(0, 191, 255, 0.02) 0%, rgba(0, 0, 0, 0) 100%);
  }

  .chats-section .section-label {
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    background: linear-gradient(90deg, #00bfff, #0077ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  .chats-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* overflow-y: auto; */ /* Removed to prevent nested scrolling */
    -webkit-overflow-scrolling: touch;
    max-height: none;
    width: 100%;
  }

  .chat-item {
    padding: 8px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-height: 36px;
    display: flex;
    align-items: center;
  }

  .chat-item:hover {
    background: rgba(255, 255, 255, 0.06);
  }

  /* Sidebar Bottom - Fixed at bottom */
  .sidebar-bottom {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(6, 12, 26, 0.7);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(16px);
    margin: 0 14px 14px;
    overflow: hidden;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 2;
  }

  /* Settings Button */
  .settings-btn {
    width: 100%;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .settings-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
  }

  /* Profile Menu */
  .profile-menu-wrapper {
    position: relative;
    width: 100%;
  }

.profile-menu-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 26px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    min-height: 48px;
    backdrop-filter: blur(12px);
}

.account-card,
.guest-access-card,
.guest-banner {
  border-radius: 26px;
}

  .profile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
  }

  .profile-avatar {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
  }

  .avatar-image {
    background-size: cover !important;
    background-position: center !important;
    color: transparent !important;
  }

  .profile-name {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
  }

  /* Profile Dropdown */
  .profile-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    margin-bottom: 8px;
    z-index: 1000;
    max-height: 500px;
    overflow-y: auto;
  }

  .profile-dropdown.active {
    display: flex;
  }

  .profile-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
  }

  .profile-info {
    display: flex;
    gap: 12px;
    align-items: center;
  }

  .profile-avatar-large {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    flex-shrink: 0;
  }

  .profile-details {
    flex: 1;
  }

  .profile-username {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
  }

  .profile-handle {
    font-size: 12px;
    color: var(--text-secondary);
  }

  .dropdown-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
  }

  .dropdown-section:last-of-type {
    border-bottom: none;
  }

  .dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    min-height: 44px;
  }

  .dropdown-item:hover {
    background: var(--bg-tertiary);
  }

  .item-icon {
    font-size: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
  }

  .item-label {
    flex: 1;
  }

  .item-arrow {
    font-size: 16px;
    color: var(--text-secondary);
  }

  /* Profile Menu */
  .profile-menu-wrapper {
    position: relative;
    width: 100%;
    z-index: 1001;
  }

  .profile-menu-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    transition: all .2s;
  }

  .profile-menu-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
  }

  .profile-avatar {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
  }

  .profile-name {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Profile Dropdown */
  .profile-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 5px 5px 20px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    margin-bottom: 8px;
    z-index: 1000;
    max-height: 500px;
    overflow-y: auto;
  }

  .profile-dropdown.active {
    display: flex;
  }

  .profile-header {
    padding: 12px;
    border-bottom: 1px solid var(--border);
  }

  .profile-info {
    display: flex;
    gap: 12px;
    align-items: center;
  }

  .profile-avatar-large {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    flex-shrink: 0;
  }

  .profile-details {
    flex: 1;
  }

  .profile-username {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
  }

  .profile-handle {
    font-size: 12px;
    color: var(--text-secondary);
  }

  .dropdown-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
  }

  .dropdown-section:last-of-type {
    border-bottom: none;
  }

  .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all .2s;
    text-align: left;
  }

  .dropdown-item:hover {
    background: var(--bg-tertiary);
  }

  .item-icon {
    font-size: 16px;
    flex-shrink: 0;
  }

  .item-label {
    flex: 1;
  }

  .item-arrow {
    font-size: 16px;
    color: var(--text-secondary);
  }

  .account-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .account-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
  }

  .account-avatar {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    flex-shrink: 0;
  }

  .account-details {
    flex: 1;
  }

  .account-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
  }

  .account-tier {
    font-size: 11px;
    color: var(--text-secondary);
  }

  /* Voice Button */
  .voice-btn {
    width: 100%;
    padding: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    transition: all .2s;
  }

  .voice-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
  }

  /* ============================================
     SETTINGS PAGE LAYOUT
     ============================================ */

  .settings-container {
    display: flex;
    gap: 20px;
    position: relative;
    width: 100%;
    height: 100%;
    padding: 0;
  }

  .settings-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    z-index: 100;
    pointer-events: auto;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background-color 0.2s ease;
  }

  .settings-close:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
  }

  /* Mobile styles for settings close button */
  @media (max-width: 768px) {
    .settings-close {
      top: 8px;
      right: 8px;
      width: 40px;
      height: 40px;
      font-size: 18px;
    }
  }

  /* Settings Sidebar */
  .settings-sidebar {
    width: 200px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding-top: 16px;
  }

  .settings-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 8px;
  }

  .settings-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all .2s;
    text-align: left;
    white-space: nowrap;
  }

  .settings-nav-item:hover {
    background: var(--bg-tertiary);
  }

  .settings-nav-item.active {
    background: var(--bg-tertiary);
    color: var(--accent);
  }

  .settings-nav-item .icon {
    font-size: 16px;
    flex-shrink: 0;
  }

  /* Settings Content */
  .settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 40px;
    max-width: 800px;
  }

  .settings-content h1 {
    font-size: 24px;
    margin: 0 0 16px 0;
    color: var(--text-primary);
  }

  .divider {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 16px 0 24px 0;
  }

  .settings-tab-content {
    display: none;
  }

  .settings-tab-content.active {
    display: block;
    animation: fadeIn .3s ease;
  }

  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  .settings-group {
    display: flex;
    flex-direction: column;
    gap: 24px;
  }

  .setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .setting-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
  }

  .setting-select {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all .2s;
  }

  .setting-select:hover,
  .setting-select:focus {
    border-color: var(--accent);
    outline: none;
  }

  .setting-description {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 4px 0 0 0;
  }

  .voice-control {
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .play-btn {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all .2s;
  }

  .play-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
  }

  .voice-select {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
  }

  .voice-select:hover,
  .voice-select:focus {
    border-color: var(--accent);
    outline: none;
  }

  .toggle-item {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }

  .toggle-content {
    flex: 1;
  }

  .toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    cursor: pointer;
    flex-shrink: 0;
  }

  .toggle-switch input {
    display: none;
  }

  .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #4a4a4a;
    transition: .3s;
    border-radius: 12px;
  }

  .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
  }

  input:checked + .slider {
    background-color: var(--accent);
  }

  input:checked + .slider:before {
    transform: translateX(20px);
  }
  
  /* ============================================
     MAIN PANEL
     ============================================ */
.panel{
    flex:1 1 0;
    display:flex;
    flex-direction:column;
    width:auto;
    background: linear-gradient(180deg, rgba(10, 18, 34, 0.96) 0%, rgba(6, 12, 24, 0.98) 100%);
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(140, 200, 255, 0.22);
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(18px);
    min-width: 0;
    overflow:hidden;
    align-self: stretch;
  }
  .title{font-size:18px;margin-bottom:12px}
  
  /* sections */
  .section{display:none;opacity:0;transform:translateY(6px);transition:all .24s}
  .section.active{display:flex;flex-direction:column;opacity:1;transform:none;flex:1;padding:20px;overflow-y:auto;background:transparent;min-height:0}

  .panel .section.active{
    max-height: 100%;
  }

  /* login form */
  .login-form{display:flex;flex-direction:column;gap:12px;max-width:300px;margin:0 auto;padding:20px}
  .login-form input{padding:12px;border-radius:8px;border:1px solid rgba(255,255,255,0.2);background:rgba(255,255,255,0.05);color:inherit;font-size:16px}
  .login-form button{padding:12px;border-radius:8px;border:none;background:var(--accent);color:#fff;font-weight:600;cursor:pointer}

  /* enhanced login container */
  .login-container{max-width:1000px;margin:60px auto;padding:40px;border-radius:16px;background:linear-gradient(135deg, rgba(16,163,127,0.08), rgba(16,163,127,0.04));border:1px solid rgba(16,163,127,0.15);text-align:center;overflow-y:scroll;max-height:90vh;-webkit-overflow-scrolling:touch;scrollbar-width:auto;scrollbar-color:#00bfff transparent;scrollbar-gutter:stable}

  .login-container::-webkit-scrollbar {
    width: 12px;
  }

  .login-container::-webkit-scrollbar-track {
    background: rgba(0, 191, 255, 0.05);
    border-radius: 10px;
  }

  .login-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #00d4ff, #00bfff);
    border-radius: 10px;
    border: 2px solid rgba(0, 191, 255, 0.1);
  }

  .login-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #00e5ff, #00d4ff);
    box-shadow: 0 0 10px rgba(0, 191, 255, 0.5);
  }

  .login-title{font-size:28px;font-weight:700;margin-bottom:12px;background:linear-gradient(90deg,#10a37f,#00a86b);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text}
  .login-subtitle{font-size:14px;color:rgba(255,255,255,0.6);margin-bottom:28px;line-height:1.6}
  .login-form{max-width:100%;margin:0;padding:0}
  .login-form input{width:100%;padding:12px 16px;border-radius:8px;border:1px solid rgba(16,163,127,0.2);background:rgba(0,0,0,0.3);color:#00d084;font-size:14px}
  .login-form input:focus{border-color:var(--accent);box-shadow:0 0 12px rgba(16,163,127,0.3)}
  
  .btn-large{width:100%;padding:14px;border-radius:8px;border:none;background:linear-gradient(90deg,#10a37f,#00a86b);color:#fff;font-weight:600;cursor:pointer;font-size:15px;transition:transform .18s, box-shadow .18s}
  .btn-large:hover{transform:translateY(-2px);box-shadow:0 8px 24px rgba(16,163,127,0.3)}

  .login-divider{display:flex;align-items:center;gap:12px;margin:20px 0;color:rgba(255,255,255,0.4);font-size:13px}
  .login-divider::before, .login-divider::after{content:'';flex:1;height:1px;background:rgba(0,191,255,0.1)}

  .social-login{display:flex;flex-direction:column;gap:10px}
  .btn-social{width:100%;padding:12px;border-radius:8px;border:1px solid rgba(0,191,255,0.2);background:rgba(0,191,255,0.05);color:#00bfff;cursor:pointer;font-size:14px;transition:all .18s}
  .btn-social:hover{background:rgba(0,191,255,0.15);box-shadow:0 6px 18px rgba(0,191,255,0.2)}
  .btn-guest{border-color:rgba(100,200,255,0.3);color:#64c8ff}

  .login-features{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin-top:32px;padding-top:28px;border-top:1px solid rgba(0,191,255,0.1);position:static}
  .feature{padding:12px;border-radius:10px;background:rgba(0,191,255,0.04);border:1px solid rgba(0,191,255,0.08);text-align:center;position:static;box-shadow:none;transition:none}
  .feature-icon{font-size:24px;display:block;margin-bottom:8px}
  .feature p{font-size:12px;color:rgba(255,255,255,0.7);margin:0;line-height:1.5}

  /* Memory toggle button */

  /* ============================================
     CHAT MESSAGES - ChatGPT Style (FIXED)
     ============================================ */

  /* Chat container */
  .chat-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding: 20px;
    overflow-y: auto;
    background: rgba(5, 11, 24, 0.9);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-2xl);
    min-height: 0;
    backdrop-filter: blur(16px);
  }

  #chat.section {
    position: relative;
  }

  .chat-box.drag-over {
    border-color: rgba(0, 212, 255, 0.6);
    box-shadow: 0 0 24px rgba(0, 212, 255, 0.2);
  }

  .chat-drop-overlay {
    position: absolute;
    inset: 110px 20px 120px 20px;
    border-radius: 18px;
    border: 2px dashed rgba(0, 212, 255, 0.35);
    background: rgba(0, 18, 40, 0.75);
    color: rgba(200, 245, 255, 0.9);
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 5;
  }

  .chat-drop-overlay.visible {
    opacity: 1;
  }

  .attachment-card {
    margin-top: 10px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(0, 191, 255, 0.18);
    background: rgba(6, 14, 30, 0.9);
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 220px;
  }

  .attachment-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
  }

  .attachment-name {
    font-weight: 700;
    color: #e8f7ff;
    font-size: 13px;
  }

  .attachment-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }

  .attachment-badge {
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid rgba(0, 191, 255, 0.35);
    background: rgba(0, 191, 255, 0.12);
    font-size: 11px;
    color: #c9f4ff;
  }

  .attachment-preview {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.25);
  }

  .attachment-preview img {
    display: block;
    width: 100%;
    max-height: 220px;
    object-fit: cover;
  }

  .attachment-text-preview {
    font-size: 12px;
    color: rgba(230, 243, 255, 0.78);
    line-height: 1.5;
    white-space: pre-wrap;
    max-height: 160px;
    overflow: auto;
    padding: 8px;
  }

  /* Individual message bubbles */
  .chat-item {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    max-width: 70%;
    width: fit-content;
    word-wrap: break-word;
    overflow-wrap: break-word;
    animation: messageSlideIn 0.3s ease-out;
    position: relative;
    gap: 4px;
  }

  /* User messages (right-aligned) */
  .chat-item.you {
    align-self: flex-end;
    align-items: flex-end;
  }

  .chat-item.you .message-bubble {
    background: linear-gradient(135deg, #00bfff, #0077ff);
    color: white;
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 2px 8px rgba(0, 191, 255, 0.2);
  }

  .chat-item.you .message-header {
    justify-content: flex-end;
    color: rgba(255, 255, 255, 0.7);
  }

  /* Bot messages (left-aligned) */
  .chat-item.bot {
    align-self: flex-start;
    align-items: flex-start;
  }

  .chat-item.bot .message-bubble {
    background: rgba(0, 191, 255, 0.08);
    border: 1px solid rgba(0, 191, 255, 0.15);
    color: #00e5ff;
    border-radius: 18px 18px 18px 4px;
    box-shadow: none;
  }

  .chat-item.bot .message-header {
    justify-content: flex-start;
    color: rgba(255, 255, 255, 0.6);
  }

  /* Message bubble container */
  .message-bubble {
    padding: 12px 16px;
    position: relative;
    backdrop-filter: blur(10px);
    border: 1px solid transparent;
    transition: all 0.2s ease;
    display: block;
    width: fit-content;
    max-width: 100%;
    height: auto;
    border-radius: 16px;
  }

  .message-bubble:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  }

  /* Message header (sender name and timestamp) */
  .message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 500;
    opacity: 0.8;
    height: auto;
  }

  .message-sender {
    font-weight: 600;
  }

  .message-time {
    font-size: 11px;
    opacity: 0.6;
  }

  /* Message content */
  .msg-content {
    line-height: 1.6;
    font-size: 16px !important;
    white-space: pre-wrap;
    word-break: break-word;
    min-width: 0;
    width: 100%;
    color: inherit;
    overflow-wrap: break-word;
    opacity: 1;
  }

  /* Message actions (copy, edit) */
  .msg-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
    flex-wrap: wrap;
  }

  .chat-item:hover .msg-actions {
    opacity: 1;
  }

  /* Auto Adjust Text & Bubble Styles */
  .msg-content {
    transition: font-size 0.2s ease;
  }

  /* Auto-adjust bubble animation */
  .message-bubble {
    animation: bubbleAdapt 0.3s ease-out;
  }

  @keyframes bubbleAdapt {
    0% {
      opacity: 0.8;
      transform: scale(0.95);
    }
    100% {
      opacity: 1;
      transform: scale(1);
    }
  }

  /* Responsive text sizing */
  @media (max-width: 768px) {
    .msg-content {
      font-size: 14px !important;
    }
  }

  .copy-btn, .edit-btn {
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
  }

  .copy-btn:hover, .edit-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
  }

  /* Typing indicator */
  .typing-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px 18px 18px 4px;
    align-self: flex-start;
    max-width: 70%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-style: italic;
    color: #00bfff;
  }


  .thinking-icon {
    display: flex;
    align-items: flex-end;
    height: 20px;
    gap: 4px;
  }

  .thinking-icon div {
    width: 4px;
    background: #00bfff;
 
    border-radius: 2px;
    animation: thinking-wave 1.2s infinite ease-in-out;
  }

  .thinking-icon .bar1 { height: 6px; animation-delay: -0.24s; }
  .thinking-icon .bar2 { height: 12px; animation-delay: -0.12s; }
  .thinking-icon .bar3 { height: 18px; animation-delay: 0s; }


  @keyframes thinking-wave {
    0%, 40%, 100% {
      transform: scaleY(0.4);
    }
    20% {
      transform: scaleY(1.0);
    }
  }

  @keyframes messageSlideIn {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Edit message interface */
  .edit-box {
    margin-top: 8px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
  }

  .edit-textarea {
    width: 100%;
    min-height: 60px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    outline: none;
  }

  .edit-textarea:focus {
    border-color: #00bfff;
    box-shadow: 0 0 8px rgba(0, 191, 255, 0.2);
  }

  .edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    justify-content: flex-end;
  }

  .edit-actions .btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .edit-actions .btn:not(.cancel-btn) {
    background: #00bfff;
    color: white;
  }

  .edit-actions .btn:not(.cancel-btn):hover {
    background: #0077ff;
  }

  .edit-actions .cancel-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
  }

  .edit-actions .cancel-btn:hover {
    background: rgba(255, 255, 255, 0.15);
  }

  /* typing indicator override (keep animation enabled) */
  .typing-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #00bfff;
    font-style: italic;
  }

  /* input row */
  .bar{display:flex;gap:8px;margin-top:12px;position:static;box-shadow:0 16px 40px rgba(0,0,0,0.35);flex-wrap:wrap;border-radius:var(--radius-2xl);border:1px solid var(--glass-border);background:rgba(6,12,26,0.85);backdrop-filter:blur(16px);padding:12px}
  .bar .input-group{display:flex;gap:8px;flex:1}
  .bar textarea{flex:1;padding:12px 14px;border-radius:var(--radius-xl);border:1px solid rgba(111,246,255,0.2);background:rgba(6,12,26,0.85);color:#e9f4ff;outline:none;font-size:15px;resize:none}
  .bar .action-buttons{display:flex;gap:8px;flex-wrap:wrap}
  .primary{background:linear-gradient(90deg,#00bfff,#0066ff);color:#001020;padding:10px 16px;border-radius:999px;box-shadow:0 10px 24px rgba(0,191,255,0.25)}
  .muted{background:rgba(255,255,255,0.04);border:1px solid rgba(255,255,255,0.08);padding:10px 14px;border-radius:999px;color:#e3edf7;box-shadow:none}
  
  /* history */
  .history-list{height:420px;overflow:auto;background:rgba(255,255,255,0.02);padding:10px;border-radius:12px}
  .history-actions{display:flex;gap:8px;margin-top:8px}
  
  /* settings */
  .themes-grid{display:flex;gap:10px;flex-wrap:wrap}
  .theme-thumb{width:56px;height:56px;border-radius:10px;border:2px solid rgba(255,255,255,0.06);background:rgb(221, 213, 213);cursor:pointer;font-size:18px;display:flex;align-items:center;justify-content:center;transition:transform .18s,box-shadow .18s}
  .theme-thumb:hover{transform:scale(1.08);box-shadow:0 10px 30px rgba(0,191,255,0.08)}
  .clock-wrap{display:flex;flex-direction:column;align-items:center;gap:6px}

  /* account settings */
  .setting-row h3{margin-top:20px;margin-bottom:12px;font-size:15px;color:#00bfff;text-transform:uppercase;letter-spacing:1px}
.account-card{display:flex;justify-content:space-between;align-items:center;padding:16px;border-radius:26px;background:rgba(0,191,255,0.06);border:1px solid rgba(0,191,255,0.15);gap:16px;overflow:hidden;background-clip:padding-box}
  .account-info{display:flex;gap:12px;align-items:center}
  .account-avatar{font-size:32px;width:50px;height:50px;display:flex;align-items:center;justify-content:center;background:rgba(0,191,255,0.1);border-radius:8px}
  .account-details{text-align:left}
  .account-name{font-weight:600;font-size:14px;color:#fff}
  .account-email{font-size:12px;color:rgba(255,255,255,0.6)}
  .account-phone{font-size:12px;color:rgba(255,255,255,0.6)}
  .account-type{font-size:11px;color:#00bfff;margin-top:4px;text-transform:uppercase;letter-spacing:0.5px}
  .btn-logout{background:linear-gradient(90deg,#ff6b6b,#ff5252);color:#fff;padding:10px 16px;border-radius:8px;border:none;cursor:pointer;font-weight:600;transition:all .18s}
  .btn-logout:hover{transform:translateY(-2px);box-shadow:0 6px 16px rgba(255,107,107,0.3)}

  /* preferences */
  .preferences{display:flex;flex-direction:column;gap:12px}
  .pref-item{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:8px;background:rgba(255,255,255,0.02);cursor:pointer;transition:background .18s}
  .pref-item:hover{background:rgba(0,191,255,0.08)}
  .pref-item input[type="checkbox"]{width:18px;height:18px;cursor:pointer;accent-color:var(--accent)}
  .pref-item span{font-size:14px;user-select:none}

  /* about section */
  .about-info{padding:12px;border-radius:8px;background:rgba(0,191,255,0.04);border-left:3px solid var(--accent)}
  .about-info p{margin:6px 0;font-size:13px;color:rgba(255,255,255,0.8)}

  /* compact mode */
  body.compact-mode .chat-item{padding:6px;margin:4px 0;max-width:85%}
  body.compact-mode .chat-item .msg-content{font-size:13px}
  body.compact-mode .bar textarea{font-size:13px;padding:8px}
  body.compact-mode .title{font-size:16px}

  /* Highlight helper for live-data toggle */
  #allowLiveData.highlight-live-toggle {
    outline: 3px solid rgba(255,160,0,0.9);
    box-shadow: 0 6px 20px rgba(255,160,0,0.15);
    transition: outline 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
  }
  
  /* games */
  .game-actions{display:flex;gap:8px;flex-wrap:wrap}
  .game-area{margin-top:10px;background:rgba(255,255,255,0.02);border-radius:10px;padding:10px;min-height:160px}

  /* devices */
  #connectedDevices{margin:10px 0}
  #connectedDevices div{margin:5px 0;padding:5px;background:rgba(255,255,255,0.05);border-radius:10px}

  /* controls */
  .control-group{margin-bottom:15px}
  .control-group h3{margin-bottom:5px}
  #controls button{margin:5px}
  #controlOutput{margin-top:10px;padding:10px;background:rgba(255,255,255,0.05);border-radius:10px}
  
  /* clock widget */
  #clockWidget{
    position:fixed;left:18px;top:90px;z-index:1200;width:160px;padding:10px;border-radius:10px;background:rgba(255,255,255,0.95);color:#111;box-shadow:0 14px 36px rgba(0,0,0,.28);cursor:grab;display:flex;flex-direction:column;align-items:center;gap:6px;
  }
  #clockWidget:active{cursor:grabbing}
  
  /* mini digital */
  .mini-digital{font-family:monospace;font-weight:700}
  
  /* THEMES (active class on body) */
  body.theme-dark{background:#040814}
  body.theme-light{
    background:#fdfeff;
    color:#1a1a1a;
  }
  body.theme-light .sidebar {
    background: linear-gradient(180deg, rgba(255, 254, 254, 0.95), rgba(255, 253, 253, 0.9)) !important;
    border-right-color: rgba(0,0,0,0.1) !important;
  }
  body.theme-light .sidebar-header {
    background: linear-gradient(135deg, rgba(0, 191, 255, 0.08), rgba(0, 191, 255, 0.05));
    border-bottom-color: rgba(0, 191, 255, 0.1) !important;
  }
  body.theme-light .new-chat-btn {
    background: linear-gradient(135deg, #00bfff, #0077ff) !important;
    color: white !important;
    box-shadow: none !important;
  }
  body.theme-light .new-chat-btn:hover {
    box-shadow: 0 2px 8px rgba(0, 191, 255, 0.15) !important;
  }
  body.theme-light .nav-btn {
    color: #333;
  }
  body.theme-light .nav-btn:hover {
    background: rgba(0,191,255,0.15);
    box-shadow: 0 8px 28px rgba(0,191,255,0.15);
  }
  body.theme-light .nav-btn.active {
    color: #00bfff;
  }
  body.theme-light .panel {
    background: #fcfdff;
  }
  body.theme-light .section {
    background: transparent;
  }
  body.theme-light .chat-box {
    background: #fafbfc;
    border: 1px solid rgba(0,191,255,0.1);
    border-radius: 16px;
  }
  body.theme-light .chat-item {
    background: transparent;
    color: #1a1a1a;
  }
  body.theme-light .chat-item.bot .message-bubble {
    background: rgba(0,191,255,0.08);
    border: 1px solid rgba(0,191,255,0.15);
    color: #0066cc;
  }
  body.theme-light .chat-item.you .message-bubble {
    background: linear-gradient(135deg, #00bfff, #0077ff);
    color: white;
  }
  body.theme-light input,
  body.theme-light textarea,
  body.theme-light select {
    background: rgba(255, 255, 255, 0.9) !important;
    color: #1a1a1a !important;
    border-color: rgba(0,191,255,0.4) !important;
  }
  body.theme-light input:focus,
  body.theme-light textarea:focus,
  body.theme-light select:focus {
    border-color: #00bfff !important;
    box-shadow: 0 0 8px rgba(0,191,255,0.3) !important;
  }
  body.theme-light .setting-group {
    background: rgba(0,0,0,0.03);
    border-left-color: #00bfff;
  }
  body.theme-light .settings-tab {
    color: rgba(0,0,0,0.6);
  }
  body.theme-light .settings-tab:hover {
    background: rgba(0,191,255,0.1);
    color: #00bfff;
  }
  body.theme-light .settings-tab.active {
    color: #00bfff;
    border-bottom-color: #212323;
  }
  body.theme-light .title {
    background: linear-gradient(135deg, #0066cc 0%, #00bfff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  body.theme-light .chat-title {
    color: #0066cc;
  }
  body.theme-light button {
    color: #1a1a1a;
    background: rgba(255,255,255,0.8);
    border: 1px solid rgba(0,0,0,0.1);
  }
  body.theme-light .primary {
    background: #00bfff !important;
    color: white !important;
    border: none !important;
  }
  body.theme-light .primary:hover {
    background: #0099cc !important;
    color: white !important;
  }
  
  /* Mobile Menu Button */
.mobile-menu-btn {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1400;
    width: 48px;
    height: 48px;
    padding: 0;
    background: rgba(0, 191, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 191, 255, 0.3);
    border-radius: 12px;
    color: #00bfff;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 191, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    overflow: visible;
}

/* Ensure hamburger lines are visible */
.mobile-menu-btn::before,
.mobile-menu-btn::after,
.mobile-menu-btn > span {
  content: "";
  position: absolute;
  width: 20px;
  height: 2px;
  background: #ffffff;
  left: 50%;
  transform: translateX(-50%);
  transition: all 0.3s ease;
}

.mobile-menu-btn::before { top: 14px; }
.mobile-menu-btn > span { top: 23px; display: block; }
.mobile-menu-btn::after { top: 32px; }

/* Hide the mobile menu button on desktop/tablet layouts */
@media (min-width: 601px) {
  .mobile-menu-btn {
    display: none !important;
  }
}
  
  .mobile-menu-btn:hover {
    background: rgba(0, 191, 255, 0.25);
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 191, 255, 0.2);
  }
  
  .mobile-menu-btn:active {
    transform: scale(0.95);
    background: rgba(0, 191, 255, 0.1);
  }
  
  /* Sidebar Overlay for Mobile */
  #sidebarOverlay {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1290;
    display: none;
    opacity: 0;
    transition: opacity .3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  #sidebarOverlay.active {
    display: block;
    opacity: 1;
  }
  
  /* Responsive */
  @media (max-width:900px){
    .sidebar{width:100px}
    .nav-btn .nav-label{display:none}
    .panel{margin:12px}
    #clockWidget{left:10px;top:80px;width:140px}
  }
@media (max-width:600px){
    body {
      flex-direction: column;
      background: var(--bg-primary);
      height: 100%;
      width: 100%;
      overflow: auto;
      padding: 0;
      margin: 0;
    }

    .sidebar {
      position: fixed;
      left: -280px;
      top: 0;
      width: 280px;
      height: 100vh;
      z-index: 1300;
      transition: left .4s cubic-bezier(0.4, 0, 0.2, 1);
      padding: 0;
      background: var(--bg-primary);
      border-right: 1px solid var(--border);
      box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
    }

    .sidebar.mobile-active {
      left: 0;
      box-shadow: 4px 0 30px rgba(0, 0, 0, 0.15);
    }

    .sidebar-overlay {
      position: fixed;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.6);
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
      z-index: 1290;
      display: none;
      opacity: 0;
      transition: opacity .3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar-overlay.active {
      display: block;
      opacity: 1;
    }

    /* Mobile sidebar header */
    .sidebar-header {
      margin: 0;
      padding: 20px 16px 16px;
      border-bottom: 1px solid rgba(255,255,255,0.1);
      border-radius: 0;
      border-left: none;
      border-right: none;
      border-top: none;
      background: linear-gradient(135deg, #00bfff, #0077ff);
      box-shadow: none;
      top: 0;
      gap: 12px;
    }

    .sidebar-header-actions {
      width: 100%;
    }

    .new-chat-btn {
      width: 100%;
      min-height: 46px;
      background: rgba(255, 255, 255, 0.2);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      border: 1px solid rgba(255, 255, 255, 0.3);
      color: white;
      font-weight: 600;
      box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    }

    .new-chat-btn:hover {
      background: rgba(255, 255, 255, 0.3);
      transform: translateY(-2px);
      box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    }

    /* Mobile sidebar search */
    .sidebar-search {
      padding: 16px;
      border-bottom: 1px solid rgba(255,255,255,0.1);
      background: var(--bg-primary);
    }

    .search-input {
      width: 100%;
      padding: 12px 16px;
      background: rgba(255,255,255,0.08);
      border: 1px solid rgba(255,255,255,0.1);
      border-radius: 12px;
      color: var(--text-primary);
      font-size: 16px;
      transition: all .3s ease;
    }

    .search-input:focus {
      background: rgba(255,255,255,0.12);
      border-color: rgba(0,191,255,0.3);
      box-shadow: 0 0 0 3px rgba(0,191,255,0.1);
      outline: none;
    }

    /* Mobile navigation */
    .sidebar-nav {
      padding: 8px 0;
      background: var(--bg-primary);
    }

    .nav-section {
      margin-bottom: 8px;
    }

    .section-label {
      padding: 8px 16px 4px;
      font-size: 12px;
      font-weight: 600;
      color: rgba(255,255,255,0.6);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      background: rgba(255,255,255,0.05);
    }

    .nav-item {
      padding: 12px 16px;
      margin: 2px 8px;
      border-radius: 12px;
      color: var(--text-primary);
      font-weight: 500;
      transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
      border: 1px solid transparent;
    }

    .nav-item:hover {
      background: rgba(255,255,255,0.08);
      border-color: rgba(255,255,255,0.1);
    }

    .nav-item.active {
      background: rgba(0,191,255,0.15);
      border-color: rgba(0,191,255,0.3);
      color: #00bfff;
      font-weight: 600;
    }

    .nav-item .nav-icon {
      margin-right: 12px;
      font-size: 18px;
    }

    /* Mobile chats section */
    .chats-section {
      border-top: 1px solid rgba(255,255,255,0.1);
      background: var(--bg-primary);
    }

    .chats-section .section-label {
      background: rgba(255,255,255,0.05);
      border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .chat-item {
      padding: 12px 16px;
      margin: 2px 8px;
      border-radius: 12px;
      color: var(--text-secondary);
      font-size: 14px;
      transition: all .2s ease;
      border: 1px solid transparent;
    }

    .chat-item:hover {
      background: rgba(255,255,255,0.08);
      border-color: rgba(255,255,255,0.1);
    }

    /* Mobile sidebar bottom */
    .sidebar-bottom {
      border-top: 1px solid rgba(255,255,255,0.1);
      background: var(--bg-primary);
      padding: 16px;
    }

    .profile-menu-btn {
      background: rgba(255,255,255,0.08);
      border: 1px solid rgba(255,255,255,0.1);
      border-radius: 12px;
      color: var(--text-primary);
      transition: all .2s ease;
    }

    .profile-menu-btn:hover {
      background: rgba(255,255,255,0.12);
      border-color: rgba(255,255,255,0.2);
    }

    .voice-btn {
      background: rgba(255,255,255,0.08);
      border: 1px solid rgba(255,255,255,0.1);
      border-radius: 12px;
      color: #374151;
      transition: all .2s ease;
    }

    .voice-btn:hover {
      background: rgba(255,255,255,0.12);
      border-color: rgba(255,255,255,0.2);
    }

    /* Mobile panel */
    .panel {
      margin-top: 0;
      width: 100%;
      max-width: none;
      padding: 12px;
      background: var(--bg-primary);
      border-radius: var(--radius);
      box-shadow: none;
      display: flex;
      flex-direction: column;
      min-height: 100vh;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }

    .section.active {
      padding: 0;
      background: transparent;
      display: flex;
      flex-direction: column;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      margin-bottom: 0;
    }

    /* Mobile chat messages */
    .chat-box {
      height: auto;
      min-height: 200px;
      flex: 1;
      background: var(--bg-primary);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 16px;
      margin-bottom: 16px;
      box-shadow: none;
    }

    .chat-box .chat-item {
      padding: 12px 16px;
      border-radius: 16px;
      margin: 8px 0;
      max-width: 85%;
      font-size: 16px;
      line-height: 1.4;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .chat-box .chat-item.you {
      background: linear-gradient(135deg, #00bfff, #0077ff);
      color: white;
      margin-left: auto;
      margin-right: 0;
      border-bottom-right-radius: 4px;
    }

    .chat-box .chat-item.bot {
      background: rgba(0, 191, 255, 0.1);
      color: #00e5ff;
      margin-right: auto;
      margin-left: 0;
      border-bottom-left-radius: 4px;
      border: 1px solid rgba(0, 191, 255, 0.2);
    }

    /* Mobile input area */
    .bar {
      gap: 12px;
      margin-top: 16px;
      background: rgba(255,255,255,0.05);
      border: 1px solid rgba(255,255,255,0.1);
      border-radius: 16px;
      padding: 12px 16px;
    }

    .bar textarea {
      flex: 1;
      padding: 8px 0;
      border: none;
      background: transparent;
      color: var(--text-primary);
      font-size: 16px;
      resize: none;
      outline: none;
    }

    .bar .primary {
      background: linear-gradient(135deg, #00bfff, #0077ff);
      border: none;
      border-radius: 12px;
      color: white;
      padding: 10px 16px;
      font-weight: 600;
      transition: all .2s ease;
      box-shadow: none;
      transform: none;
    }

    .bar .primary:hover {
      transform: none;
      box-shadow: none;
    }

    /* Mobile title */
    .title {
      font-size: 24px;
      font-weight: 700;
      color: #1f2937;
      margin-bottom: 16px;
      text-align: center;
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }

    /* Hide desktop elements on mobile */
    #clockWidget {
      display: none;
    }

    .brand {
      display: none;
    }

    /* Mobile login scrolling */
    .login-container {
      max-width: 100%;
      margin: 20px auto;
      padding: 24px 16px;
      border-radius: 16px;
      overflow-y: scroll;
      max-height: 90vh;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: thick;
      scrollbar-color: #00d4ff rgba(0, 191, 255, 0.2);
      scrollbar-gutter: stable;
    }

    .login-container::-webkit-scrollbar {
      width: 16px;
    }

    .login-container::-webkit-scrollbar-track {
      background: rgba(0, 191, 255, 0.15);
      border-radius: 10px;
      margin: 10px 0;
    }

    .login-container::-webkit-scrollbar-thumb {
      background: linear-gradient(180deg, #00d4ff, #00bfff);
      border-radius: 10px;
      border: 2px solid rgba(0, 191, 255, 0.3);
      min-height: 40px;
    }

    .login-container::-webkit-scrollbar-thumb:hover {
      background: linear-gradient(180deg, #00e5ff, #00d4ff);
      box-shadow: 0 0 15px rgba(0, 191, 255, 0.8);
      border-color: rgba(0, 191, 255, 0.6);
    }

    .login-title {
      font-size: 24px;
      margin-bottom: 12px;
    }

    .login-subtitle {
      font-size: 13px;
      margin-bottom: 20px;
    }

    .login-form input {
      padding: 12px 14px;
      font-size: 15px;
      margin-bottom: 10px;
    }

    .btn-large {
      padding: 12px;
      font-size: 14px;
      border-radius: 12px;
      margin-bottom: 12px;
    }

    .login-features {
      grid-template-columns: 1fr;
      gap: 12px;
      margin-top: 20px;
      padding-top: 20px;
    }

    /* Show mobile menu button */
    .mobile-menu-btn {
      display: flex;
    }

    /* Make room for hamburger so the chat title isn't covered */
    #chat .chat-topbar {
      padding-left: 64px;
    }
  }
  
  /* small utilities */
  .hidden{display:none}
  /* FOOTER */
footer {
  text-align: center;
  background: #091018;
  padding: 14px;
  font-size: 14px;
  border-top: 1px solid #1c2d3d;
  margin-top: auto;
}

.app-footer {
  text-align: center;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  letter-spacing: 0.02em;
  margin-top: auto;
  padding: 12px 0 10px;
  background: transparent;
  border: 0;
  width: 100%;
}

/* ============================================
   GUEST WORKSPACE UPGRADE
   ============================================ */
body[data-access-mode="guest"] {
  font-family: "Bahnschrift", "Segoe UI Variable Text", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(79, 168, 255, 0.18), transparent 36%),
    radial-gradient(circle at 88% 12%, rgba(0, 255, 209, 0.12), transparent 28%),
    radial-gradient(circle at 50% 90%, rgba(98, 0, 255, 0.12), transparent 35%),
    linear-gradient(135deg, #030712 0%, #071022 48%, #050914 100%);
  color: #e9f4ff;
}

body[data-access-mode="guest"]::before,
body[data-access-mode="guest"]::after {
  content: "";
  position: fixed;
  inset: -20% -10% auto auto;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 212, 255, 0.18), transparent 70%);
  filter: blur(20px);
  opacity: 0.7;
  pointer-events: none;
  z-index: 0;
}

body[data-access-mode="guest"]::after {
  inset: auto auto -25% -10%;
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.18), transparent 70%);
}

body[data-access-mode="guest"] .container {
  gap: 18px;
  padding: 18px;
  position: relative;
  z-index: 1;
}

body[data-access-mode="guest"] .sidebar {
  border-radius: 28px;
  border: 1px solid rgba(111, 246, 255, 0.16);
  background:
    radial-gradient(circle at top left, rgba(0, 191, 255, 0.12), transparent 60%),
    rgba(7, 14, 28, 0.92);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
}

body[data-access-mode="guest"] .panel {
  margin: 0;
  border-radius: 30px;
  border: 1px solid rgba(111, 246, 255, 0.14);
  background:
    radial-gradient(circle at 15% 10%, rgba(0, 191, 255, 0.12), transparent 60%),
    linear-gradient(180deg, rgba(6, 13, 28, 0.95), rgba(5, 10, 22, 0.98));
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(18px);
}

body[data-access-mode="guest"] #chat.section {
  padding: 26px;
  background: transparent;
}

body[data-access-mode="guest"] #chat .chat-topbar {
  padding: 0;
  margin-bottom: 14px;
  background: transparent;
  border: 0;
}

body[data-access-mode="guest"] #chat .title.chat-title-pill {
  background: linear-gradient(135deg, rgba(0, 191, 255, 0.22), rgba(0, 119, 255, 0.16));
  border: 1px solid rgba(111, 246, 255, 0.3);
  box-shadow: 0 12px 30px rgba(0, 191, 255, 0.18);
  color: #e8f9ff;
  letter-spacing: 0.02em;
}

body[data-access-mode="guest"] .guest-banner {
  margin: 6px 0 18px;
  border-radius: 26px;
  border: 1px solid rgba(111, 246, 255, 0.2);
  background:
    radial-gradient(circle at left center, rgba(0, 191, 255, 0.16), transparent 45%),
    linear-gradient(180deg, rgba(10, 28, 56, 0.92), rgba(7, 18, 36, 0.95));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
}

body[data-access-mode="guest"] .chat-box {
  background:
    radial-gradient(circle at 20% 10%, rgba(0, 191, 255, 0.08), transparent 45%),
    rgba(5, 11, 24, 0.95);
  border: 1px solid rgba(111, 246, 255, 0.16);
  border-radius: 26px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(18px);
}

body[data-access-mode="guest"] .bar {
  margin-top: 16px;
  border-radius: 26px;
  border: 1px solid rgba(111, 246, 255, 0.16);
  background:
    radial-gradient(circle at top left, rgba(0, 191, 255, 0.12), transparent 60%),
    rgba(6, 12, 26, 0.92);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px);
}

body[data-access-mode="guest"] #chatInput {
  background: rgba(6, 12, 24, 0.9);
  border: 1px solid rgba(111, 246, 255, 0.22);
  color: #e9f4ff;
}

body[data-access-mode="guest"] #chatInput::placeholder {
  color: rgba(180, 210, 235, 0.6);
}

body[data-access-mode="guest"] #sendBtn {
  box-shadow: 0 10px 24px rgba(0, 191, 255, 0.25);
}

body[data-access-mode="guest"] .new-chat-btn {
  border-radius: 999px;
  box-shadow: 0 12px 26px rgba(0, 191, 255, 0.22);
}

body[data-access-mode="guest"] .search-input {
  border-radius: 18px;
  border: 1px solid rgba(111, 246, 255, 0.16);
  background: rgba(4, 10, 22, 0.8);
  backdrop-filter: blur(12px);
}

body[data-access-mode="guest"] .nav-item {
  border-radius: 22px;
  border: 1px solid rgba(111, 246, 255, 0.14);
  background: rgba(7, 16, 32, 0.78);
  backdrop-filter: blur(12px);
}

body[data-access-mode="guest"] .nav-item.active {
  background: linear-gradient(135deg, rgba(0, 191, 255, 0.2), rgba(0, 119, 255, 0.16));
  border-color: rgba(111, 246, 255, 0.35);
}

body[data-access-mode="guest"] .guest-access-card {
  border-radius: 26px;
  border: 1px solid rgba(111, 246, 255, 0.2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(18px);
}

body[data-access-mode="guest"] .guest-upgrade-btn {
  box-shadow: 0 14px 28px rgba(0, 119, 255, 0.28);
}

body[data-access-mode="guest"] .profile-menu-btn {
  border-radius: 22px;
  border: 1px solid rgba(111, 246, 255, 0.14);
  background: rgba(6, 14, 30, 0.75);
  backdrop-filter: blur(14px);
}

body[data-access-mode="guest"] .sidebar-header,
body[data-access-mode="guest"] .sidebar-bottom {
  border-radius: 22px;
  background: rgba(6, 13, 28, 0.75);
  backdrop-filter: blur(14px);
}

body[data-access-mode="guest"] .app-footer {
  align-self: stretch;
}

body[data-access-mode="guest"] {
  overflow-y: auto;
}

body[data-access-mode="guest"] .panel {
  max-height: calc(var(--app-vh, 1vh) * 100 - 36px);
}

/* Match guest chat bubble colors with main chat */
body[data-access-mode="guest"] #chat .message-bubble {
  padding: 16px 20px;
  border-radius: 26px;
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.14);
}

body[data-access-mode="guest"] #chat .chat-item.bot .message-bubble {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(0, 191, 255, 0.08));
  border: 1px solid rgba(125, 223, 255, 0.18);
  color: #ebf7ff;
  border-radius: 26px 26px 26px 10px;
}

body[data-access-mode="guest"] #chat .chat-item.you .message-bubble {
  background: linear-gradient(135deg, rgba(0, 191, 255, 0.96), rgba(53, 127, 255, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-radius: 26px 26px 10px 26px;
  box-shadow: 0 14px 28px rgba(0, 119, 255, 0.24);
}

/* Global liquid-glass rounding overrides */
body .panel,
body .sidebar,
body .chat-box,
body .bar,
body .guest-banner,
body .guest-access-card,
body .sidebar-header,
body .sidebar-bottom,
body .profile-menu-btn,
body .search-input,
body .nav-item,
body .chat-title-pill,
body .message-bubble {
  border-radius: var(--radius-3xl);
  backdrop-filter: blur(16px);
}

body .panel {
  border-radius: var(--radius-3xl) !important;
  overflow: hidden;
  background-clip: padding-box;
}

body .chat-title-pill {
  border-radius: 999px;
}

body .guest-chip,
body .muted,
body .primary {
  border-radius: 999px;
}

body .profile-menu-btn {
  border-radius: var(--radius-2xl);
}

/* Scrollbar UI for scrollable panels */
:where(
  body,
  .section,
  .panel,
  .chat-box,
  .sidebar,
  .sidebar-content,
  .chats-list,
  .usage-card,
  .settings-content,
  .settings-content-wrapper,
  .settings-sidebar,
  #appsList,
  #gamesList,
  #projectsList,
  #imageGallery,
  .image-gallery
) {
  scrollbar-width: auto;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

:where(
  body,
  .section,
  .panel,
  .chat-box,
  .sidebar,
  .sidebar-content,
  .chats-list,
  .usage-card,
  .settings-content,
  .settings-content-wrapper,
  .settings-sidebar,
  #appsList,
  #gamesList,
  #projectsList,
  #imageGallery,
  .image-gallery
)::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

:where(
  body,
  .section,
  .panel,
  .chat-box,
  .sidebar,
  .sidebar-content,
  .chats-list,
  .usage-card,
  .settings-content,
  .settings-content-wrapper,
  .settings-sidebar,
  #appsList,
  #gamesList,
  #projectsList,
  #imageGallery,
  .image-gallery
)::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 999px;
}

:where(
  body,
  .section,
  .panel,
  .chat-box,
  .sidebar,
  .sidebar-content,
  .chats-list,
  .usage-card,
  .settings-content,
  .settings-content-wrapper,
  .settings-sidebar,
  #appsList,
  #gamesList,
  #projectsList,
  #imageGallery,
  .image-gallery
)::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 3px solid rgba(6, 12, 28, 0.6);
}

:where(
  body,
  .section,
  .panel,
  .chat-box,
  .sidebar,
  .sidebar-content,
  .chats-list,
  .usage-card,
  .settings-content,
  .settings-content-wrapper,
  .settings-sidebar,
  #appsList,
  #gamesList,
  #projectsList,
  #imageGallery,
  .image-gallery
)::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

:where(
  body,
  .section,
  .panel,
  .chat-box,
  .sidebar,
  .sidebar-content,
  .chats-list,
  .usage-card,
  .settings-content,
  .settings-content-wrapper,
  .settings-sidebar,
  #appsList,
  #gamesList,
  #projectsList,
  #imageGallery,
  .image-gallery
)::-webkit-scrollbar-button {
  width: 0;
  height: 0;
  display: none;
}

:where(
  body,
  .section,
  .panel,
  .chat-box,
  .sidebar,
  .sidebar-content,
  .chats-list,
  .usage-card,
  .settings-content,
  .settings-content-wrapper,
  .settings-sidebar,
  #appsList,
  #gamesList,
  #projectsList,
  #imageGallery,
  .image-gallery
)::-webkit-scrollbar-corner {
  background: transparent;
}

/* Buttons */
.btn{background:linear-gradient(90deg,#00bfff,#0066ff);color:#021420;padding:8px 10px;border-radius:8px;border:none;cursor:pointer;margin:4px}
.btn.small{padding:6px 8px;font-size:13px}

/* Devices grid/cards */
.devices-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:10px;margin-top:10px}
.device-card{display:flex;justify-content:space-between;align-items:center;padding:10px;border-radius:10px;background:rgba(255,255,255,0.02);border:1px solid rgba(255,255,255,0.03)}
.device-info{display:flex;flex-direction:column}
.device-name{font-weight:700;max-width:160px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.device-meta{font-size:12px;color:var(--muted)}
.device-meta.unsupported{color:#ffb4b4}
.device-actions{display:flex;gap:6px;flex-shrink:0}
.device-card{overflow:hidden}

/* Controls layout helpers */
.control-row{display:flex;gap:18px;flex-wrap:wrap}
.controls-inline{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.devices-controls{display:flex;gap:8px;align-items:center;margin-bottom:8px}
.command-row{display:flex;gap:8px;margin-top:8px}
.command-row input{flex:1;padding:8px;border-radius:8px;border:1px solid rgba(255,255,255,0.04);background:rgba(255,255,255,0.02);color:inherit}

/* small responsive tweaks */
@media (max-width:700px){
  .devices-grid{grid-template-columns:repeat(1,1fr)}
  .control-row{flex-direction:column}
}

/* Message actions and edit */
.msg-actions{display:flex;gap:6px;margin-top:6px}
.copy-btn, .edit-btn{background:rgba(0,191,255,0.2);border:1px solid rgba(0,191,255,0.4);color:#00bfff;padding:4px 8px;border-radius:10px;font-size:11px;cursor:pointer;transition:all .2s}
.copy-btn:hover, .edit-btn:hover{background:rgba(0,191,255,0.4);box-shadow:0 4px 12px rgba(0,191,255,0.2)}
.edit-box{margin-top:8px;padding:8px;background:rgba(255,255,255,0.04);border-radius:8px;border:1px solid rgba(0,191,255,0.2)}
.edit-textarea{width:100%;padding:8px;border-radius:6px;border:1px solid rgba(0,191,255,0.3);background:rgba(0,0,0,0.3);color:#00e5ff;font-family:inherit;font-size:14px;resize:vertical;min-height:60px;outline:none}
.edit-textarea:focus{border-color:var(--accent);box-shadow:0 0 8px rgba(0,191,255,0.3)}
.edit-actions{display:flex;gap:6px;margin-top:6px}
.cancel-btn{background:rgba(255,100,100,0.2);border-color:rgba(255,100,100,0.4);color:#ffb4b4}
.cancel-btn:hover{background:rgba(255,100,100,0.3);box-shadow:0 4px 12px rgba(255,100,100,0.2)}

/* ============ ADVANCED SETTINGS PANEL ============ */
.settings-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  height: 100%;
  overflow-y: auto;
}

.settings-tabs {
  display: flex;
  gap: 10px;
  border-bottom: 2px solid rgba(0,191,255,0.2);
  overflow-x: auto;
  padding-bottom: 10px;
}

.settings-tab {
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  font-weight: 500;
  transition: all .3s;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.settings-tab:hover {
  color: var(--accent);
  background: rgba(0,191,255,0.08);
}

.settings-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: var(--bg-primary);
}

.settings-header {
  padding: 15px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.settings-tabs {
  display: flex;
  gap: 10px;
  padding: 0 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  overflow-x: auto;
  flex-shrink: 0;
}

.settings-tab {
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.settings-tab:hover {
  color: rgba(255,255,255,0.9);
}

.settings-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.settings-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 40px;
  background: var(--bg-primary);
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

.settings-panel {
  display: none !important;
  animation: fadeIn .3s ease;
  width: 100%;
  min-height: auto;
  position: relative;
  z-index: 1;
  padding: 0;
  margin: 0;
}

.settings-panel.active {
  display: block !important;
  opacity: 1 !important;
  animation: fadeIn .3s ease;
  z-index: 100;
}

.settings-panel h3 {
  color: var(--accent);
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 18px;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 100% !important;
}

.setting-group {
  margin-bottom: 20px;
  padding: 15px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.05);
  width: 100%;
  display: block !important;
  visibility: visible !important;
}

.setting-group label {
  display: block;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-weight: 500;
  width: 100%;
}

.setting-group input[type="text"],
.setting-group input[type="number"],
.setting-group input[type="password"],
.setting-group select,
.setting-group textarea {
  width: 100%;
  padding: 10px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(0,191,255,0.3);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  transition: all .3s;
  display: block;
  box-sizing: border-box;
}

.setting-group input[type="text"]:focus,
.setting-group input[type="number"]:focus,
.setting-group input[type="password"]:focus,
.setting-group select:focus,
.setting-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(0,191,255,0.2);
  outline: none;
}

.setting-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 10px;
  cursor: pointer;
  accent-color: var(--accent);
}

.setting-group input[type="checkbox"] + span {
  cursor: pointer;
  user-select: none;
}

.setting-group textarea {
  resize: vertical;
  min-height: 80px;
  font-size: 13px;
}

.account-info-display {
  padding: 15px;
  background: rgba(0,191,255,0.05);
  border-radius: 10px;
  border: 1px solid rgba(0,191,255,0.2);
}

.account-info-display p {
  margin: 10px 0;
  line-height: 1.6;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============================================
   ACCOUNT SECTION STYLES
   ============================================ */

.account-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.account-subsection {
  padding: 16px;
  background: rgba(0, 191, 255, 0.04);
  border: 1px solid rgba(0, 191, 255, 0.15);
  border-radius: 10px;
  margin: 12px 0;
}

.account-subsection h4 {
  margin: 0 0 8px 0;
  font-size: 15px;
  color: #00bfff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-desc {
  margin: 4px 0 12px 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
}

.account-usage {
  margin: 8px 0;
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  line-height: 1.5;
}

.account-note {
  margin: 8px 0;
  padding: 8px 12px;
  background: rgba(255, 193, 7, 0.08);
  border-left: 3px solid #ffc107;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

.account-field {
  margin: 12px 0;
}

.account-field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
}

.email-display {
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 191, 255, 0.2);
  border-radius: 6px;
  color: #00bfff;
  font-family: 'Courier New', monospace;
  font-size: 13px;
}

.subscription-card {
  padding: 14px;
  background: rgba(76, 175, 80, 0.08);
  border: 1px solid rgba(76, 175, 80, 0.2);
  border-radius: 8px;
  margin: 12px 0;
}

.sub-tier {
  font-size: 16px;
  font-weight: 600;
  color: #4caf50;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sub-features {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.sub-features p {
  margin: 4px 0;
  font-weight: 500;
}

.sub-features ul {
  margin: 8px 0 0 16px;
  padding: 0;
  list-style: none;
}

.sub-features li {
  margin: 4px 0;
}

.upgrade-section {
  background: linear-gradient(135deg, rgba(255, 152, 0, 0.08), rgba(255, 193, 7, 0.04));
  border-color: rgba(255, 152, 0, 0.2);
}

.upgrade-btn {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: linear-gradient(90deg, #ff9800, #ffc107);
  border: none;
  border-radius: 8px;
  color: #000;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  margin: 12px 0;
  transition: all .3s ease;
}

.upgrade-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 152, 0, 0.3);
}

.upgrade-benefits {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.upgrade-benefits p {
  margin: 4px 0;
  font-weight: 500;
}

.upgrade-benefits ul {
  margin: 8px 0 0 16px;
  padding: 0;
  list-style: none;
}

.upgrade-benefits li {
  margin: 4px 0;
}

.restore-btn {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: rgba(0, 191, 255, 0.15);
  border: 1px solid rgba(0, 191, 255, 0.3);
  border-radius: 8px;
  color: #00bfff;
  font-weight: 500;
  cursor: pointer;
  transition: all .3s ease;
  font-size: 13px;
}

.restore-btn:hover {
  background: rgba(0, 191, 255, 0.25);
  box-shadow: 0 4px 12px rgba(0, 191, 255, 0.2);
}

/* ============================================
   PERSONALIZATION SECTION STYLES
   ============================================ */

.personalization-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.setting-desc {
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  margin: 4px 0 12px 0;
}

.personalization-card {
  padding: 16px;
  background: rgba(156, 39, 176, 0.06);
  border: 1px solid rgba(156, 39, 176, 0.15);
  border-radius: 10px;
  margin: 10px 0;
}

.personalization-card h4 {
  margin: 0 0 8px 0;
  font-size: 15px;
  color: #ba68c8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.personality-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
}

@media (max-width: 600px) {
  .personality-options {
    grid-template-columns: 1fr;
  }
}

.personality-option {
  display: flex;
  gap: 10px;
  cursor: pointer;
  padding: 10px;
  border-radius: 8px;
  background: rgba(156, 39, 176, 0.08);
  border: 1px solid rgba(156, 39, 176, 0.1);
  transition: all .3s ease;
}

.personality-option:hover {
  background: rgba(156, 39, 176, 0.15);
  border-color: rgba(156, 39, 176, 0.3);
}

.personality-radio {
  width: 18px;
  height: 18px;
  accent-color: #ba68c8;
  cursor: pointer;
  flex-shrink: 0;
}

.personality-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.personality-title {
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
}

.personality-desc {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
}

.custom-instructions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}

.instruction-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: all .2s;
}

.instruction-item:hover {
  background: rgba(156, 39, 176, 0.1);
}

.custom-pref {
  width: 18px;
  height: 18px;
  accent-color: #ba68c8;
  cursor: pointer;
}

.language-settings {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0;
}

.language-settings label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.setting-select {
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 191, 255, 0.2);
  border-radius: 6px;
  color: #00bfff;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s;
}

.setting-select:hover,
.setting-select:focus {
  border-color: #ba68c8;
  box-shadow: 0 0 8px rgba(186, 104, 200, 0.2);
  outline: none;
}

.save-personalization-btn {
  padding: 12px 16px;
  background: linear-gradient(90deg, #ba68c8, #ab47bc);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  transition: all .3s;
}

.save-personalization-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(186, 104, 200, 0.3);
}

/* ============================================
   COMMUNICATION & NOTIFICATIONS SECTION
   ============================================ */

.communication-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.notification-card {
  padding: 16px;
  background: rgba(33, 150, 243, 0.06);
  border: 1px solid rgba(33, 150, 243, 0.15);
  border-radius: 10px;
  margin: 10px 0;
}

.notification-card h4 {
  margin: 0 0 8px 0;
  font-size: 15px;
  color: #42a5f5;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notification-settings {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: 6px;
  transition: all .2s;
  cursor: pointer;
}

.notification-item:hover {
  background: rgba(33, 150, 243, 0.1);
}

.notification-toggle {
  width: 18px;
  height: 18px;
  accent-color: #42a5f5;
  cursor: pointer;
  margin-top: 3px;
  flex-shrink: 0;
}

.notification-item span {
  display: block;
  font-size: 13px;
}

.notification-item span:first-of-type {
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

.notification-info {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  margin-top: 2px;
}

.notification-schedule {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(33, 150, 243, 0.1);
}

.notification-schedule h5 {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
}

.time-inputs {
  display: flex;
  gap: 12px;
  margin: 10px 0;
}

.time-inputs label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.time-inputs input {
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(33, 150, 243, 0.2);
  border-radius: 10px;
  color: #42a5f5;
  font-family: monospace;
  cursor: pointer;
}

.quiet-hours-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  cursor: pointer;
  font-size: 13px;
}

/* ============================================
   EXTENSIONS & INTEGRATION SECTION
   ============================================ */

.extensions-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.apps-card {
  padding: 16px;
  background: rgba(0, 150, 136, 0.06);
  border: 1px solid rgba(0, 150, 136, 0.15);
  border-radius: 10px;
}

.apps-card h4 {
  margin: 0 0 8px 0;
  font-size: 15px;
  color: #26a69a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.connected-apps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}

.app-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(0, 150, 136, 0.2);
  border-radius: 8px;
  gap: 12px;
}

.app-name {
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  flex: 1;
}

.app-status {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 10px;
}

.app-status.connected {
  background: rgba(76, 175, 80, 0.2);
  color: #4caf50;
}

.app-status.pending {
  background: rgba(255, 193, 7, 0.2);
  color: #ffc107;
}

.disconnect-btn,
.connect-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all .2s;
}

.disconnect-btn {
  background: rgba(244, 67, 54, 0.2);
  color: #f44336;
}

.disconnect-btn:hover {
  background: rgba(244, 67, 54, 0.3);
}

.connect-btn {
  background: rgba(33, 150, 243, 0.2);
  color: #2196f3;
}

.connect-btn:hover {
  background: rgba(33, 150, 243, 0.3);
}

.add-integration-btn {
  width: 100%;
  padding: 12px;
  margin-top: 12px;
  background: rgba(0, 191, 255, 0.15);
  border: 1px dashed rgba(0, 191, 255, 0.3);
  border-radius: 8px;
  color: #00bfff;
  cursor: pointer;
  font-weight: 500;
  transition: all .3s;
}

.add-integration-btn:hover {
  background: rgba(0, 191, 255, 0.25);
  border-color: rgba(0, 191, 255, 0.5);
}

/* ============================================
   SAFETY & CONTROL SECTION
   ============================================ */

.safety-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.safety-card {
  padding: 16px;
  background: rgba(244, 67, 54, 0.06);
  border: 1px solid rgba(244, 67, 54, 0.15);
  border-radius: 10px;
}

.safety-card h4 {
  margin: 0 0 8px 0;
  font-size: 15px;
  color: #f44336;
  display: flex;
  align-items: center;
  gap: 8px;
}

.safety-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  cursor: pointer;
  font-size: 13px;
}

.safety-checkbox {
  width: 18px;
  height: 18px;
  accent-color: #f44336;
  cursor: pointer;
}

.content-filter {
  margin-top: 12px;
  padding: 12px;
  background: rgba(244, 67, 54, 0.08);
  border-radius: 6px;
}

.content-filter label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  cursor: pointer;
  font-size: 13px;
}

.restricted-apps {
  margin-top: 12px;
}

.restricted-apps h5 {
  margin: 0 0 8px 0;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
}

.app-checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-checklist label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
}

/* Data Controls */
.data-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}

.data-control-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .2s;
}

.data-control-item:hover {
  background: rgba(244, 67, 54, 0.1);
}

.data-toggle {
  width: 18px;
  height: 18px;
  accent-color: #f44336;
  cursor: pointer;
  margin-top: 3px;
  flex-shrink: 0;
}

.data-control-item span {
  display: block;
  font-size: 13px;
}

.data-control-item span:first-of-type {
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

.data-info {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  margin-top: 2px;
}

.retention-settings {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(244, 67, 54, 0.1);
}

.retention-settings h5 {
  margin: 0 0 8px 0;
  font-size: 12px;
  font-weight: 600;
}

.retention-settings label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

/* ============================================
   STORAGE SECTION STYLES
   ============================================ */

.storage-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.storage-card {
  padding: 16px;
  background: rgba(255, 152, 0, 0.06);
  border: 1px solid rgba(255, 152, 0, 0.15);
  border-radius: 10px;
}

.storage-card h4 {
  margin: 0 0 8px 0;
  font-size: 15px;
  color: #ff9800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.archive-info {
  margin: 12px 0;
  padding: 12px;
  background: rgba(255, 152, 0, 0.08);
  border-radius: 6px;
}

.archive-info p {
  margin: 6px 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}

.archive-info span {
  color: #ff9800;
  font-weight: 600;
}

.storage-actions {
  display: flex;
  gap: 10px;
  margin: 12px 0;
  flex-wrap: wrap;
}

.archive-btn {
  flex: 1;
  min-width: 140px;
  padding: 10px 12px;
  background: rgba(255, 152, 0, 0.15);
  border: 1px solid rgba(255, 152, 0, 0.3);
  border-radius: 6px;
  color: #ff9800;
  cursor: pointer;
  font-weight: 500;
  transition: all .2s;
  font-size: 13px;
}

.archive-btn:hover {
  background: rgba(255, 152, 0, 0.25);
}

.archive-btn.danger {
  background: rgba(244, 67, 54, 0.15);
  border-color: rgba(244, 67, 54, 0.3);
  color: #f44336;
}

.archive-btn.danger:hover {
  background: rgba(244, 67, 54, 0.25);
}

/* ============================================
   SECURITY SECTION STYLES
   ============================================ */

.security-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.security-card {
  padding: 16px;
  background: rgba(76, 175, 80, 0.06);
  border: 1px solid rgba(76, 175, 80, 0.15);
  border-radius: 10px;
}

.security-card h4 {
  margin: 0 0 8px 0;
  font-size: 15px;
  color: #4caf50;
  display: flex;
  align-items: center;
  gap: 8px;
}

.security-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 12px 0;
}

.security-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px;
  background: rgba(76, 175, 80, 0.08);
  border: 1px solid rgba(76, 175, 80, 0.2);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: all .3s;
  text-align: left;
}

.security-btn:hover {
  background: rgba(76, 175, 80, 0.15);
  border-color: rgba(76, 175, 80, 0.4);
  transform: translateX(4px);
}

.security-btn span:first-child {
  font-weight: 600;
  font-size: 13px;
  color: #4caf50;
}

.security-desc {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
}

  /* ============================================
     COLLAPSED SIDEBAR STATE
     ============================================ */
  body.sidebar-collapsed .sidebar {
    width: 84px;
    padding: 12px 10px;
  }

  body.sidebar-collapsed .sidebar-content {
    align-items: center;
  }

  body.sidebar-collapsed .sidebar-header {
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin: 10px auto 12px;
    padding: 8px 0 12px;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  body.sidebar-collapsed .sidebar .nav-label,
  body.sidebar-collapsed .sidebar .section-label,
  body.sidebar-collapsed .sidebar .search-input,
  body.sidebar-collapsed .sidebar .chat-title,
  body.sidebar-collapsed .sidebar .chat-sub,
  body.sidebar-collapsed .sidebar .chat-time,
  body.sidebar-collapsed .sidebar .chat-actions,
  body.sidebar-collapsed .sidebar .history-group-label,
  body.sidebar-collapsed .sidebar .profile-name,
  body.sidebar-collapsed .sidebar .profile-handle,
  body.sidebar-collapsed .sidebar .profile-subtext,
  body.sidebar-collapsed .sidebar .sidebar-search,
  body.sidebar-collapsed .sidebar .sidebar-account-hint,
  body.sidebar-collapsed .sidebar .nav-badge,
  body.sidebar-collapsed .sidebar .chats-section,
  body.sidebar-collapsed .sidebar .sidebar-brand,
  body.sidebar-collapsed .sidebar .new-chat-btn {
    display: none !important;
  }

  body.sidebar-collapsed .sidebar-nav,
  body.sidebar-collapsed .sidebar .nav-section,
  body.sidebar-collapsed .sidebar-bottom,
  body.sidebar-collapsed .sidebar .profile-menu-wrapper,
  body.sidebar-collapsed .sidebar .sidebar-header-actions {
    width: 100%;
    align-items: center;
  }

  body.sidebar-collapsed .sidebar-nav {
    padding: 10px 0 0;
    gap: 10px;
  }

  body.sidebar-collapsed .sidebar .nav-section {
    gap: 10px;
  }

  body.sidebar-collapsed .sidebar .nav-item,
  body.sidebar-collapsed .sidebar .chat-item,
  body.sidebar-collapsed .sidebar .profile-menu-btn {
    width: 52px;
    min-width: 52px;
    min-height: 52px;
    justify-content: center;
    padding: 0;
    margin: 0 auto;
    border-radius: 18px;
  }

  body.sidebar-collapsed .sidebar .nav-item {
    background: rgba(0, 191, 255, 0.06);
    border-color: rgba(0, 191, 255, 0.16);
    box-shadow: none;
  }

  body.sidebar-collapsed .sidebar .nav-item:hover {
    transform: none;
  }

  body.sidebar-collapsed .sidebar .nav-item.active {
    background: linear-gradient(180deg, rgba(0, 191, 255, 0.18), rgba(0, 119, 255, 0.1));
    border-color: rgba(0, 191, 255, 0.34);
    box-shadow: 0 0 0 1px rgba(0, 191, 255, 0.16), 0 10px 20px rgba(0, 119, 255, 0.16);
  }

  body.sidebar-collapsed .sidebar .nav-item .nav-icon {
    width: 38px;
    height: 38px;
    margin: 0;
  }

  body.sidebar-collapsed .sidebar .profile-menu-btn {
    gap: 0;
  }

  body.sidebar-collapsed .sidebar .profile-avatar {
    margin: 0;
  }

  body.sidebar-collapsed .sidebar-bottom {
    padding: 14px 0 8px;
  }

  body.sidebar-collapsed .sidebar .chat-icon {
    margin: 0;
    font-size: 18px;
  }

  body.sidebar-collapsed #desktopCollapseBtn {
    display: block;
    margin: 0 auto !important;
  }

/* ============================================
   APPS, GAMES & PROJECTS GRID SYSTEM
   ============================================ */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
  padding: 10px 0 30px;
}

.card-item {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.08) 0%, rgba(0, 136, 255, 0.05) 100%);
  border: 1.5px solid rgba(0, 212, 255, 0.15);
  border-radius: 16px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  min-height: 160px;
  gap: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.card-item::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(0, 212, 255, 0.15) 0%, transparent 70%);
  transition: all 0.5s ease;
  pointer-events: none;
}

.card-item:hover {
  transform: translateY(-8px) scale(1.02);
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.15) 0%, rgba(0, 136, 255, 0.1) 100%);
  border-color: rgba(0, 212, 255, 0.4);
  box-shadow: 0 20px 50px -10px rgba(0, 212, 255, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.card-item:hover::before {
  top: -25%;
  right: -25%;
}

.card-item:active {
  transform: scale(0.97);
}

.card-icon {
  font-size: 32px;
  margin-bottom: 8px;
  filter: drop-shadow(0 6px 12px rgba(0, 212, 255, 0.15));
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.card-item:hover .card-icon {
  transform: scale(1.25) rotate(8deg) translateY(-2px);
  filter: drop-shadow(0 8px 20px rgba(0, 212, 255, 0.25));
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  color: rgba(240, 244, 255, 0.95);
  margin-bottom: 4px;
  width: 100%;
  white-space: wrap;
  word-break: break-word;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.4;
  letter-spacing: 0.3px;
}

.card-subtitle {
  font-size: 10px;
  font-weight: 600;
  color: rgba(156, 163, 175, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: 100%;
  white-space: wrap;
  word-break: break-word;
  overflow: visible;
  line-height: 1.2;
}

.create-new-card {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  background: transparent;
}

.create-new-card:hover {
  border-color: var(--accent);
  background: rgba(0, 191, 255, 0.05);
}

.category-header {
  grid-column: 1 / -1;
  font-size: 15px;
  font-weight: 800;
  background: linear-gradient(90deg, #00d4ff, #0088ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 24px 0 12px;
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(0, 212, 255, 0.2);
  display: flex;
  align-items: center;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.category-header:first-child {
  margin-top: 0;
}

/* ============================================
   NEW UI LAYOUT (FLEXBOX ARCHITECTURE)
   ============================================ */

/* --- RESET & CORE --- */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    overflow: hidden; /* Prevent body scroll */
}

/* --- LAYOUT WRAPPER --- */
.layout-wrapper {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 260px;
    background: #1e293b;
    border-right: 1px solid #334155;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
    flex-shrink: 0;
    height: 100vh; /* Ensure full height */
}

.sidebar.closed {
    margin-left: -260px;
}

/* --- MAIN APP AREA --- */
.app {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0f172a;
    height: 100%;
    min-width: 0; /* Prevents flex child overflow */
}

/* --- HEADER --- */
.header {
    padding: 16px 20px;
    font-size: 20px;
    font-weight: 600;
    border-bottom: 1px solid #1e293b;
    background: #0f172a;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0; /* Prevent header from shrinking */
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    border-radius: 10px;
    transition: color 0.2s;
}

.sidebar-toggle:hover {
    color: white;
    background: #1e293b;
}

/* --- CHAT CONTAINER --- */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 14px;
    justify-content: flex-start; 
}

/* --- MESSAGE STRUCTURE --- */
.message {
    display: flex;
    width: 100%;
    margin: 8px 0;
}

.message.user {
    justify-content: flex-end;
}

.message.ai {
    justify-content: flex-start;
}

/* Message Header */
.message-header {
    font-size: 12px;
    padding: 0 0 4px 0;
    display: flex;
    gap: 8px;
    align-items: center;
}

.message-sender {
    font-weight: 600;
    color: var(--text-secondary);
}

.message-time {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Message Bubble */
.message-bubble {
    display: flex;
    flex-direction: column;
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 14px;
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 212, 255, 0.1);
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: 1px solid #1e40af;
    color: white;
}

.message.ai .message-bubble {
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 212, 255, 0.15);
    color: var(--text-primary);
}

/* Message Content */
.msg-content {
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* Message Actions */
.msg-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.message:hover .msg-actions {
    opacity: 1;
}

.copy-btn, .edit-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover, .edit-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

/* --- INPUT AREA (FIXED BOTTOM) --- */
.input-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid rgba(0, 212, 255, 0.1);
    background: #0f172a;
    flex-shrink: 0;
}

/* Input Controls Row */
.input-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.upload-btn {
    padding: 10px 14px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.upload-btn:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: rgba(0, 212, 255, 0.5);
}

#chatInput {
    flex: 1;
    padding: 11px 16px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #1e293b;
    color: white;
    outline: none;
    font-size: 15px;
    transition: border-color 0.2s, background 0.2s;
}

#chatInput:focus {
    border-color: var(--accent);
    background: rgba(0, 212, 255, 0.05);
}

#chatInput::placeholder {
    color: var(--text-secondary);
}

.voice-btn {
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid rgba(0, 212, 255, 0.35);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.18), rgba(0, 120, 255, 0.08));
    color: #dff8ff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.2px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 8px 22px rgba(0, 120, 255, 0.22);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.25s ease, background 0.25s ease;
    flex-shrink: 0;
}

.voice-btn:hover {
    border-color: rgba(0, 212, 255, 0.65);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.26), rgba(0, 120, 255, 0.14));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 12px 28px rgba(0, 170, 255, 0.32);
    transform: translateY(-1px);
}

.voice-btn:active {
    transform: translateY(0);
}

.voice-btn:focus-visible {
    outline: 2px solid rgba(0, 212, 255, 0.85);
    outline-offset: 2px;
}

.voice-btn .voice-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.22);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

.voice-btn .voice-text {
    line-height: 1;
}

@keyframes voicePulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 68, 102, 0.55); }
    70% { box-shadow: 0 0 0 14px rgba(255, 68, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 68, 102, 0); }
}

@keyframes micGlow {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.08); filter: brightness(1.18); }
}

.voice-btn.active {
    border-color: rgba(255, 97, 127, 0.95);
    background: linear-gradient(135deg, rgba(255, 77, 109, 0.26), rgba(255, 30, 92, 0.16));
    color: #ffe9ef;
    box-shadow: 0 12px 28px rgba(255, 42, 99, 0.32), inset 0 1px 0 rgba(255,255,255,0.2);
}

.voice-btn.active .voice-icon {
    background: rgba(255, 60, 100, 0.28);
    animation: voicePulse 1.2s ease-out infinite, micGlow 1.2s ease-in-out infinite;
}

/* Sidebar scrollbar gutter cleanup */
.sidebar,
  .sidebar-content {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.sidebar {
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar,
.sidebar-content::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

body.sidebar-collapsed .voice-btn {
    width: 44px;
    min-height: 44px;
    padding: 0;
    justify-content: center;
    margin: 0 auto;
    gap: 0;
}

body.sidebar-collapsed .voice-btn .voice-text {
    display: none;
}

@media (max-width: 768px) {
    .voice-btn {
        min-height: 46px;
        color: #dff8ff;
    }
}


.send-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    background: var(--gradient-primary);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

.send-btn:hover {
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
    transform: translateY(-2px);
}

.send-btn:active {
    transform: translateY(0);
}

/* Bottom Actions Buttons */
.bottom-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.action-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

.news-btn {
    background: rgba(255, 255, 255, 0.05);
}

.save-btn {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.25);
    color: #10b981;
}

.save-btn:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.4);
}

.clear-btn {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
    color: #ef4444;
}

.clear-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
}

/* ============================================
   SOFT CURVE CHAT UI
   ============================================ */
#chat.section.active {
    position: relative;
    padding: 18px 18px 22px;
    background:
      radial-gradient(circle at top left, rgba(0, 191, 255, 0.06), transparent 26%),
      linear-gradient(180deg, rgba(7, 15, 31, 0.98), rgba(5, 10, 24, 0.98));
}

#chat .chat-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 52px;
}

#chat .chat-topbar-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

#chat .title.chat-title-pill {
    margin: 0;
    padding: 12px 18px;
    border: 1px solid rgba(125, 223, 255, 0.28);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(0, 191, 255, 0.12), rgba(255, 255, 255, 0.03));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 12px 24px rgba(0, 0, 0, 0.18);
    color: #f5fbff;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.02em;
    max-width: calc(100vw - 360px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#chat .chat-box {
    padding: 28px;
    gap: 18px;
    background: linear-gradient(180deg, rgba(2, 8, 24, 0.96), rgba(4, 10, 28, 0.98));
    border: 1px solid rgba(0, 191, 255, 0.14);
    border-radius: 30px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 18px 40px rgba(0, 0, 0, 0.22);
}

#chat .chat-item {
    max-width: min(78%, 920px);
}

#chat .message-header {
    margin-bottom: 8px;
    padding: 0 6px;
}

#chat .message-bubble {
    padding: 16px 20px;
    border-radius: 26px;
    backdrop-filter: blur(14px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.14);
}

#chat .chat-item.bot .message-bubble {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(0, 191, 255, 0.08));
    border: 1px solid rgba(125, 223, 255, 0.18);
    color: #ebf7ff;
    border-radius: 26px 26px 26px 10px;
}

#chat .chat-item.you .message-bubble {
    background: linear-gradient(135deg, rgba(0, 191, 255, 0.96), rgba(53, 127, 255, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border-radius: 26px 26px 10px 26px;
    box-shadow: 0 14px 28px rgba(0, 119, 255, 0.24);
}

#chat .audio-message .msg-content {
    font-weight: 600;
    color: #e6f5ff;
}

#chat .audio-message-actions {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

#chat .audio-message-actions .audio-player {
    display: none;
}

#chat .audio-play-btn {
    min-width: 72px;
    height: 36px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid rgba(125, 223, 255, 0.3);
    background: rgba(0, 191, 255, 0.15);
    color: #dff7ff;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#chat .audio-play-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(0, 191, 255, 0.25);
}

#chat .audio-progress {
    flex: 1 1 220px;
    min-width: 160px;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    appearance: none;
    cursor: pointer;
}

#chat .audio-progress::-webkit-slider-thumb {
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #8ee9ff;
    box-shadow: 0 0 10px rgba(142, 233, 255, 0.8);
    border: 2px solid rgba(4, 12, 26, 0.9);
}

#chat .audio-progress::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #8ee9ff;
    border: 2px solid rgba(4, 12, 26, 0.9);
}

#chat .audio-time {
    font-size: 12px;
    color: rgba(230, 245, 255, 0.75);
    min-width: 74px;
    text-align: center;
}

#chat .audio-wave-wrap {
    flex: 1 1 100%;
    background: rgba(3, 10, 22, 0.65);
    border: 1px solid rgba(125, 223, 255, 0.18);
    border-radius: 14px;
    padding: 8px 10px;
}

#chat .audio-wave {
    width: 100%;
    height: 48px;
    display: block;
}

#chat .audio-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

#chat .audio-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: rgba(230, 245, 255, 0.75);
}

#chat .audio-volume {
    width: 110px;
    height: 6px;
    appearance: none;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
}

#chat .audio-volume::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #8ee9ff;
    box-shadow: 0 0 8px rgba(142, 233, 255, 0.8);
    border: 2px solid rgba(4, 12, 26, 0.9);
}

#chat .audio-volume::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #8ee9ff;
    border: 2px solid rgba(4, 12, 26, 0.9);
}

#chat .audio-speed {
    height: 30px;
    border-radius: 999px;
    padding: 0 10px;
    background: rgba(7, 14, 28, 0.9);
    border: 1px solid rgba(125, 223, 255, 0.25);
    color: #dff7ff;
    font-size: 12px;
}

#chat .audio-message-actions .audio-download {
    font-size: 12px;
    padding: 8px 14px;
    border-radius: 999px;
    white-space: nowrap;
}

#chat .typing-indicator {
    margin-top: 10px;
    padding: 14px 18px;
    border-radius: 24px 24px 24px 10px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(0, 191, 255, 0.08));
    border: 1px solid rgba(125, 223, 255, 0.16);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.14);
}

#chat .bar {
    gap: 14px;
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 28px;
    flex-wrap: wrap;
    align-items: center;
    background: linear-gradient(180deg, rgba(10, 18, 38, 0.96), rgba(5, 11, 24, 0.98));
    border: 1px solid rgba(125, 223, 255, 0.15);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Ensure chat footer is visible */
#chat.section {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#chat #chatBox {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

#chat .bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
}

#chat .bar .input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 520px;
    min-width: 240px;
    padding: 6px;
    border-radius: 22px;
    background: rgba(1, 8, 22, 0.72);
    border: 1px solid rgba(125, 223, 255, 0.08);
}

#chat .tool-menu-wrap {
    position: relative;
}

#chat .chat-plus-btn {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 1px solid rgba(125, 223, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: #c7f2ff;
    font-size: 22px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#chat .chat-plus-btn:hover {
    box-shadow: 0 10px 20px rgba(0, 191, 255, 0.2);
    transform: translateY(-1px);
}

#chat .tool-menu {
    position: absolute;
    left: 0;
    bottom: calc(100% + 12px);
    min-width: 220px;
    display: none;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    border-radius: 16px;
    background: rgba(7, 14, 28, 0.98);
    border: 1px solid rgba(125, 223, 255, 0.2);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    z-index: 10;
}

#chat .tool-menu.active {
    display: flex;
}

#chat .tool-toggle {
    text-align: left;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.86);
    font-size: 13px;
    cursor: pointer;
}

#chat .tool-toggle.active {
    background: rgba(0, 191, 255, 0.18);
    border-color: rgba(0, 191, 255, 0.4);
    color: #c7f2ff;
}

#chat .tool-divider {
    height: 1px;
    background: rgba(125, 223, 255, 0.16);
    margin: 6px 4px;
}

#chat .tool-action {
    text-align: left;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.82);
    font-size: 13px;
    cursor: pointer;
}

#chat .tool-action:hover {
    background: rgba(255, 255, 255, 0.08);
}

#chat .model-picker {
    position: relative;
}

#chat .model-select-btn {
    min-height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid rgba(125, 223, 255, 0.25);
    background: rgba(8, 14, 30, 0.7);
    color: #d8f6ff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 24px rgba(0, 0, 0, 0.25);
}

#chat .model-select-btn:focus {
    outline: none;
    border-color: rgba(125, 223, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.18);
}

#chat .model-caret {
    font-size: 12px;
    color: rgba(200, 245, 255, 0.8);
}

#chat .model-menu {
    position: absolute;
    left: 0;
    bottom: calc(100% + 10px);
    min-width: 200px;
    padding: 8px;
    margin: 0;
    list-style: none;
    display: none;
    flex-direction: column;
    gap: 6px;
    border-radius: 14px;
    background: rgba(7, 14, 28, 0.98);
    border: 1px solid rgba(125, 223, 255, 0.2);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    z-index: 12;
}

#chat .model-menu.active {
    display: flex;
}

#chat .model-option {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

#chat .tts-voice-picker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    min-height: 38px;
    border-radius: 999px;
    border: 1px solid rgba(125, 223, 255, 0.2);
    background: rgba(8, 14, 30, 0.65);
    color: rgba(220, 246, 255, 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 20px rgba(0, 0, 0, 0.2);
}

#chat .tts-voice-picker.hidden {
    display: none;
}

#chat .tts-voice-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(180, 230, 255, 0.75);
}

#chat .tts-voice-dropdown {
    position: relative;
}

#chat .tts-voice-btn {
    border: none;
    background: transparent;
    color: rgba(235, 249, 255, 0.95);
    font-size: 12px;
    font-weight: 700;
    outline: none;
    cursor: pointer;
    padding: 6px 28px 6px 12px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#chat .tts-voice-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.18);
}

#chat .tts-voice-caret {
    font-size: 12px;
    color: rgba(200, 245, 255, 0.8);
    pointer-events: none;
}

#chat .tts-voice-menu {
    position: absolute;
    left: 0;
    bottom: calc(100% + 10px);
    min-width: 180px;
    padding: 8px;
    margin: 0;
    list-style: none;
    display: none;
    flex-direction: column;
    gap: 6px;
    border-radius: 16px;
    background: rgba(7, 14, 28, 0.98);
    border: 1px solid rgba(125, 223, 255, 0.2);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    z-index: 12;
}

#chat .tts-voice-menu.active {
    display: flex;
}

#chat .tts-voice-option {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

#chat .tts-voice-option:hover,
#chat .tts-voice-option.active {
    background: rgba(125, 223, 255, 0.16);
}

#chat .model-option.active {
    background: rgba(0, 119, 255, 0.45);
    border-color: rgba(0, 119, 255, 0.65);
    color: #ffffff;
}

#chat .model-option:hover {
    background: rgba(0, 119, 255, 0.25);
}

#chat #chatInput {
    min-height: 54px;
    padding: 14px 18px;
    border: none;
    border-radius: 18px;
    background: transparent;
    color: #f2fbff;
    font-size: 16px;
    box-shadow: none;
    overflow: hidden;
    resize: none;
    min-width: 0;
}

#chat .chat-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 20px 10px;
}

#chat .chat-empty-inner {
    text-align: center;
    max-width: 520px;
}

#chat .chat-empty-inner h1 {
    margin: 0 0 8px;
    font-size: clamp(28px, 3vw, 40px);
    color: #f1fbff;
}

#chat .chat-empty-inner p {
    margin: 0;
    color: rgba(255, 255, 255, 0.62);
    font-size: 14px;
}

#chat #chatInput::-webkit-scrollbar {
    width: 0;
    height: 0;
}

#chat #chatInput:focus {
    border: none;
    background: rgba(255, 255, 255, 0.02);
    box-shadow: none;
}

#chat #sendBtn {
    width: 52px !important;
    min-width: 52px !important;
    height: 52px !important;
    padding: 0 !important;
    border-radius: 18px !important;
    background: linear-gradient(135deg, #18b8ff, #1b78ff) !important;
    box-shadow: 0 12px 22px rgba(0, 119, 255, 0.26) !important;
}

#chat .action-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1 1 100%;
    justify-content: flex-start;
}

#chat .action-chip-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#chat .action-chip-list > li {
    display: inline-flex;
    align-items: center;
}

#chat .action-buttons .chat-soft-btn {
    min-height: 38px;
    padding: 0 18px !important;
    border-radius: 999px !important;
    font-weight: 700 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 6px 18px rgba(0, 0, 0, 0.18);
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)) !important;
    color: rgba(255, 255, 255, 0.8) !important;
}

#chat .action-buttons .chat-soft-btn-memory {
    background: linear-gradient(180deg, rgba(0, 191, 255, 0.28), rgba(0, 191, 255, 0.12)) !important;
    border: 1px solid rgba(125, 223, 255, 0.45) !important;
    color: #88e6ff !important;
}

#chat .action-buttons .chat-soft-btn-save {
    background: linear-gradient(180deg, rgba(0, 191, 255, 0.18), rgba(0, 191, 255, 0.09)) !important;
    border: 1px solid rgba(125, 223, 255, 0.34) !important;
    color: #83e9ff !important;
}

#chat .action-buttons .chat-soft-btn-clear {
    background: linear-gradient(180deg, rgba(255, 92, 92, 0.14), rgba(255, 92, 92, 0.08)) !important;
    border: 1px solid rgba(255, 107, 107, 0.34) !important;
    color: #ff9a9a !important;
}

#chat .action-buttons .chat-soft-btn:hover {
    transform: translateY(-1px);
}

/* Image gallery action buttons (prevent overlap) */
#images .image-card-actions,
.image-gallery .image-card-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

#images .image-card-actions button,
.image-gallery .image-card-actions button {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.streak-badge {
    margin-left: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, #0c1118 0%, #101b2d 55%, #0e1624 100%);
    border: 1px solid rgba(125, 177, 255, 0.25);
    color: #e9f2ff;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 18px rgba(6, 12, 24, 0.35);
}

.streak-badge.hidden {
    display: none;
}

.streak-badge .streak-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f1622 0%, #16243b 100%);
    border: 1px solid rgba(125, 177, 255, 0.22);
    color: #ff9f43;
    font-size: 12px;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

.streak-badge .streak-count {
    min-width: 12px;
    text-align: center;
}

.greeting-banner {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: 14px;
    background: rgba(10, 12, 16, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(240, 245, 255, 0.95);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.35);
    margin-right: 12px;
}

.greeting-emoji {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 16px;
}

@media (max-width: 900px) {
    .greeting-banner {
        font-size: 14px;
        padding: 6px 10px;
        border-radius: 12px;
    }
    .greeting-emoji {
        width: 22px;
        height: 22px;
        font-size: 13px;
    }
}

.usage-modal {
    position: fixed;
    inset: 0;
    background: rgba(6, 10, 24, 0.72);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 8000;
    padding: 20px;
}

.usage-modal.active {
    display: flex;
}

.usage-card {
    width: min(720px, 92vw);
    background: linear-gradient(145deg, rgba(15, 22, 45, 0.95), rgba(8, 12, 26, 0.98));
    border: 1px solid rgba(0, 191, 255, 0.18);
    border-radius: 20px;
    padding: 24px;
    color: #e7f9ff;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
    max-height: min(80vh, 720px);
    overflow-y: hidden;
}

.dev-panel {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dev-panel.hidden {
    display: none;
}

.dev-label {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
}

.dev-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.dev-input {
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(0, 191, 255, 0.2);
    background: rgba(6, 14, 30, 0.9);
    color: #e6f3ff;
}

.dev-input:focus {
    outline: none;
    border-color: rgba(0, 191, 255, 0.5);
    box-shadow: 0 0 10px rgba(0, 191, 255, 0.2);
}

.dev-btn {
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid rgba(0, 191, 255, 0.35);
    background: rgba(0, 191, 255, 0.18);
    color: #c9f4ff;
    cursor: pointer;
    font-weight: 600;
}

.dev-error {
    color: #ff9a9a;
    font-size: 12px;
    min-height: 16px;
}

.dev-hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
}

.dev-section-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(125, 223, 255, 0.8);
    margin-top: 4px;
}

.dev-data-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dev-data-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 12px;
}

.dev-data-key {
    color: rgba(255, 255, 255, 0.65);
    font-weight: 600;
}

.dev-data-value {
    color: #e7f9ff;
    text-align: right;
    word-break: break-word;
}

.usage-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.usage-card-header h3 {
    margin: 0;
    font-size: 22px;
}

.usage-subtitle {
    margin: 6px 0 0;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
}

.usage-close {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    width: 34px;
    height: 34px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
}

.usage-stats {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
}

.usage-stat {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.usage-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.usage-stat strong {
    font-size: 20px;
}

.usage-log {
    margin-top: 18px;
}

.usage-log h4 {
    margin: 0 0 10px;
    font-size: 16px;
}

#usageLogList {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#usageLogList li {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
}

@media (max-width: 768px) {
    #chat.section.active {
        padding: 14px 14px 18px;
    }

    #chat .title.chat-title-pill {
        padding: 10px 16px;
        border-radius: 20px;
        font-size: 16px;
    }

    #chat .chat-box {
        padding: 20px;
        border-radius: 24px;
    }

    #chat .message-bubble,
    #chat .typing-indicator {
        border-radius: 22px;
    }

    #chat .bar {
        padding: 12px;
        border-radius: 24px;
    }

    #chat .bar .input-group {
        border-radius: 18px;
    }
}

/* ============================================
   SIDEBAR ACCOUNT CURVE + CHAT SCROLL CLEANUP
   ============================================ */
.sidebar-bottom {
    margin: 12px 14px 14px;
    padding: 14px;
    border: 1px solid rgba(125, 223, 255, 0.14);
    border-radius: 28px;
    background:
      radial-gradient(circle at top left, rgba(0, 191, 255, 0.08), transparent 38%),
      linear-gradient(180deg, rgba(8, 16, 34, 0.96), rgba(4, 10, 24, 0.98));
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.22);
    bottom: 14px;
    border-top: 1px solid rgba(125, 223, 255, 0.14);
}

.sidebar-bottom .sidebar-account-hint {
    margin-bottom: 8px;
    padding: 0 4px;
}

.sidebar-bottom .profile-menu-btn {
    min-height: 72px;
    padding: 14px 16px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 191, 255, 0.04));
    border: 1px solid rgba(125, 223, 255, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.sidebar-bottom .profile-menu-btn:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(0, 191, 255, 0.08));
    border-color: rgba(125, 223, 255, 0.28);
}

.sidebar-bottom .profile-avatar {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(0, 191, 255, 0.2), rgba(0, 119, 255, 0.12));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    font-size: 18px;
}

.sidebar-bottom .profile-meta {
    gap: 3px;
}

.sidebar-bottom .profile-name {
    font-size: 14px;
    font-weight: 700;
}

#chat.section.active {
    min-height: 0;
    overflow: auto;
}

#chat .chat-topbar,
#chat .bar,
#typingIndicator {
    flex-shrink: 0;
}

#chat .chat-box {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(55, 140, 190, 0.55) rgba(6, 12, 28, 0);
    scrollbar-gutter: stable both-edges;
    padding-right: 0;
}

#chat .chat-box::-webkit-scrollbar {
    width: 10px;
}

#chat .chat-box::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 999px;
    margin: 8px 2px;
}

#chat .chat-box::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(72, 160, 210, 0.75), rgba(35, 120, 190, 0.75));
    border-radius: 999px;
    border: 3px solid rgba(0, 0, 0, 0);
    background-clip: padding-box;
}

#chat .chat-box::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(96, 186, 228, 0.9), rgba(52, 146, 214, 0.9));
}

#chat .chat-box::-webkit-scrollbar-button {
    width: 0;
    height: 0;
    display: none;
}

#chat .chat-box::-webkit-scrollbar-button {
    width: 0;
    height: 0;
    display: none;
}

body.sidebar-collapsed .sidebar-bottom {
    margin: 12px auto 10px;
    padding: 10px 0;
    width: 100%;
    max-width: 60px;
    border-radius: 24px;
}

body.sidebar-collapsed .sidebar-bottom .profile-menu-btn {
    min-height: 52px;
    border-radius: 18px;
}
