
  :root {
    --primary-dark: #0f172a;
    --panel-bg: #1e293b;
    --accent-green: #00ff9d;
    --accent-blue: #3b82f6;
    --accent-purple: #a855f7;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --danger-red: #ef4444;
    --warning-amber: #f59e0b;
    --radius-lg: 16px;
    --radius-md: 8px;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --primary-color: #00A884;
    --secondary-color: #F0F2F5;
    --background-color: #FFFFFF;
    --chat-bubble-outgoing: #D9FDD3;
    --chat-bubble-incoming: #FFFFFF;
    --border-color: #e0e0e0;
    --icon-color: #54656f;
    --sidebar-width: 280px;
    --sidebar-bg: #111827;
    --sidebar-item-active: rgba(59, 130, 246, 0.2);
    --transition-speed: 0.3s;
    --glass: rgba(255, 255, 255, 0.05);
    --compact-gap: 10px;
    --radius: 12px;
  }

  body.light-mode {
    --primary-dark: #e5e7eb;
    --panel-bg: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --secondary-color: #f9fafb;
    --background-color: #ffffff;
    --chat-bubble-outgoing: #D9FDD3;
    --chat-bubble-incoming: #f3f4f6;
    --border-color: #e5e7eb;
    --icon-color: #6b7280;
    --sidebar-bg: #f3f4f6;
    --sidebar-item-active: rgba(59, 130, 246, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.1);
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }
  html { scroll-behavior: smooth; }
  html, body { height: 100%; }
  body {
    background: var(--primary-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    display: flex;
  }

  /* Sidebar Navigation */
  .sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    padding: 1.5rem 1rem;
    overflow-y: auto;
    transition: transform var(--transition-speed), background-color var(--transition-speed);
    z-index: 1000;
    box-shadow: 2px 0 10px var(--shadow-color);
  }
  .sidebar-header {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  .sidebar-logo { display: flex; align-items: center; gap: 0.75rem; }
  .sidebar-logo-icon {
    width: 36px; height: 36px; background: var(--accent-blue); border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: white;
  }
  .sidebar-logo-text { font-size: 1.4rem; font-weight: 700; }
  .sidebar-logo-text span { color: var(--accent-green); }
  .theme-toggle {
    margin-left: auto; background: transparent; border: none; color: var(--text-primary);
    cursor: pointer; font-size: 1.2rem;
  }
  .sidebar-nav { display: flex; flex-direction: column; gap: 0.5rem; }
  .nav-item {
    display: flex; align-items: center; padding: 0.875rem 1rem; border-radius: var(--radius-md);
    color: var(--text-primary); text-decoration: none; transition: background-color 0.2s; gap: 0.75rem; cursor: pointer;
  }
  .nav-item:hover { background: rgba(255, 255, 255, 0.05); }
  .nav-item.active { background: var(--sidebar-item-active); color: var(--accent-blue); font-weight: 500; }
  .nav-item i { width: 20px; text-align: center; }
  .nav-section {
    margin-top: 1.5rem; margin-bottom: 0.5rem; padding-left: 1rem; font-size: 0.8rem;
    text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary);
  }

  /* Main content */
  .main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 1.5rem;
    transition: margin-left var(--transition-speed);
  }
  .container { max-width: 1400px; margin: 0 auto; }

  header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem; background: var(--panel-bg); border-radius: var(--radius-lg);
    margin-bottom: 2rem; box-shadow: 0 4px 20px var(--shadow-color);
    gap: 18px;
  }
  .logo { display: flex; align-items: center; gap: 1rem; }
  .logo-icon {
    width: 48px; height: 48px; background: var(--accent-blue); border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
  }
  .logo-text { font-size: 1.8rem; font-weight: 700; }
  .logo-text span { color: var(--accent-green); }

  .btn {
    padding: 0.75rem 1.5rem; border-radius: var(--radius-md); display: inline-flex;
    align-items: center; gap: 0.5rem; border: none; cursor: pointer;
    transition: all 0.2s ease-in-out; font-weight: 500; font-size: 1rem;
  }
  .btn:disabled { cursor: not-allowed; opacity: 0.5; }
  .btn:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 2px; }
  .btn-primary { background: var(--accent-green); color: var(--primary-dark); }
  .btn-primary:hover:not(:disabled) { background: #00e68a; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0, 255, 157, 0.2); }

  .dashboard-grid { display: grid; grid-template-columns: 1fr 350px; gap: 2rem; }
  .panel {
    background: var(--panel-bg); border-radius: var(--radius-lg); padding: 1.5rem;
    box-shadow: 0 4px 20px var(--shadow-color);
  }
  .panel-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  .panel-title { font-size: 1.5rem; font-weight: 600; }

  .agent-info {
    display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; padding: 1rem;
    background: rgba(255, 255, 255, 0.05); border-radius: var(--radius-md);
  }
  .agent-avatar {
    width: 64px; height: 64px; border-radius: 50%; background: var(--accent-green);
    display: flex; align-items: center; justify-content: center; font-weight: 700;
    font-size: 1.8rem; color: var(--primary-dark); flex-shrink: 0;
  }
  .agent-details { flex: 1; }
  .agent-name { font-size: 1.4rem; font-weight: 600; margin-bottom: 0.25rem; }

  .status-indicator { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem; border-radius: 2rem; font-size: 0.9rem; font-weight: 500; transition: all 0.3s ease; }
  .status-online { background: rgba(0, 255, 157, 0.15); color: var(--accent-green); }
  .status-offline { background: rgba(150, 150, 150, 0.15); color: var(--text-secondary); }
  .status-on-call { background: rgba(245, 158, 11, 0.15); color: var(--warning-amber); }
  .status-wrap-up { background: rgba(168, 85, 247, 0.15); color: var(--accent-purple); }
  .status-break { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
  .status-indicator .fa-circle { font-size: 0.7em; animation: pulse 2s infinite ease-in-out; }
  @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
  .status-offline .fa-circle, .status-break .fa-circle { animation: none; }

  .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
  .stat-card { background: rgba(255, 255, 255, 0.05); border-radius: var(--radius-md); padding: 1rem; text-align: center; }
  .stat-value { font-size: 2.2rem; font-weight: 700; margin: 0.5rem 0; color: var(--accent-green); }
  .stat-label { font-size: 0.9rem; color: var(--text-secondary); }

  .call-controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
  .call-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 1rem; background: rgba(255, 255, 255, 0.05); border-radius: var(--radius-md);
    cursor: pointer; transition: all 0.2s ease-in-out; border: 2px solid transparent;
  }
  .call-btn:hover:not(.disabled) { background: rgba(59, 130, 246, 0.2); transform: translateY(-3px); }
  .call-btn.disabled { opacity: 0.4; cursor: not-allowed; background: rgba(255,255,255,0.02); }
  .call-btn i { font-size: 2rem; margin-bottom: 0.5rem; color: var(--accent-blue); transition: color 0.2s ease; }
  .call-btn.active { border-color: var(--accent-green); background: rgba(0, 255, 157, 0.1); }
  .call-btn.active i { color: var(--accent-green); }
  .hangup-btn i { color: var(--danger-red); }

  .dialer-input input {
    width:100%; padding: 1rem; border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary); font-size: 1.1rem; transition: all 0.2s ease;
  }
  .dialer-input input:focus { border-color: var(--accent-blue); background: rgba(59, 130, 246, 0.1); box-shadow: 0 0 0 2px var(--accent-blue); }
  .dialer-numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1rem; }
  .num-btn {
    padding: 1rem; background: rgba(255, 255, 255, 0.05); border-radius: var(--radius-md);
    text-align: center; font-size: 1.5rem; font-weight: 500; cursor: pointer; transition: all 0.2s ease-in-out;
  }
  .num-btn:hover { background: rgba(59, 130, 246, 0.2); transform: scale(1.05); }
  .call-btn-large {
    grid-column: span 3; background: var(--accent-green); color: var(--primary-dark);
    font-weight: 600; padding: 1rem; display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    margin-top: 1rem; border: none; border-radius: var(--radius-md); cursor: pointer; transition: all 0.2s ease-in-out;
  }
  .call-btn-large:hover:not(:disabled) { background: #00e68a; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0, 255, 157, 0.2); }

  .call-history { max-height: 400px; overflow-y: auto; }
  .call-item { display: flex; justify-content: space-between; align-items: center; padding: 1rem; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
  .call-info { display: flex; flex-direction: column; }
  .call-number { font-weight: 500; font-size: 1.1rem; }
  .call-time { font-size: 0.9rem; color: var(--text-secondary); }
  .call-status { font-weight: 500; text-transform: capitalize; }
  .status-incoming { color: var(--accent-blue); }
  .status-outgoing { color: var(--accent-green); }

  body.popup-active .overlay { display: block; }
  .overlay {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(5px); z-index: 999; display: none;
  }
  .call-popup {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: var(--panel-bg); padding: 2rem; border-radius: var(--radius-lg);
    box-shadow: 0 4px 30px var(--shadow-color); z-index: 1000; width: 400px; max-width: 90%;
    text-align: center; display: none; animation: popIn 0.3s ease-out forwards;
  }
  @keyframes popIn { from { opacity: 0; transform: translate(-50%, -45%); } to { opacity: 1; transform: translate(-50%, -50%); } }

  .popup-header { font-size: 1.2rem; font-weight: 600; margin-bottom: 0.5rem; }
  .popup-subheader { font-size: 1.5rem; color: var(--accent-green); margin-bottom: 1.5rem; }
  .popup-actions { display: flex; justify-content: center; gap: 1rem; margin-top: 1rem; }
  .action-btn { width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; cursor: pointer; transition: all 0.2s ease-in-out; border: none; }
  .answer-btn { background: var(--accent-green); color: var(--primary-dark); }
  .answer-btn:hover { background: #00e68a; transform: scale(1.1); }
  .decline-btn { background: var(--danger-red); color: white; }
  .decline-btn:hover { background: #dc2626; transform: scale(1.1); }

  .disposition-form { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid rgba(255, 255, 255, 0.1); }
  .form-group { margin-bottom: 1rem; text-align: left; }
  .form-group label { display: block; margin-bottom: 0.5rem; font-size: 0.9rem; color: var(--text-secondary); }
  .form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 0.75rem; border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary); font-size: 1rem; transition: all 0.2s ease;
  }
  .form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    border-color: var(--accent-blue); background: rgba(59, 130, 246, 0.1); box-shadow: 0 0 0 2px var(--accent-blue); outline: none;
  }
  .form-group textarea { min-height: 100px; resize: vertical; }

  .toast {
    position: fixed; bottom: -100px; left: 50%; transform: translateX(-50%);
    background: var(--panel-bg); color: var(--text-primary); padding: 1rem 2rem;
    border-radius: var(--radius-md); box-shadow: 0 4px 20px var(--shadow-color);
    z-index: 1001; transition: bottom 0.5s ease-in-out;
  }
  .toast.show { bottom: 30px; }
  .toast.error { background: var(--danger-red); color: white; }
  .toast.success { background: var(--accent-green); color: var(--primary-dark); }

  .status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 8px; }
  .status-online .status-dot { background-color: var(--accent-green); }
  .status-offline .status-dot { background-color: var(--text-secondary); }
  .status-on-call .status-dot { background-color: var(--warning-amber); }
  .status-wrap-up .status-dot { background-color: var(--accent-purple); }
  .status-break .status-dot { background-color: var(--accent-blue); }

  .invalid-phone { border-color: var(--danger-red) !important; }
  .invalid-phone:focus { box-shadow: 0 0 0 2px var(--danger-red) !important; }

  /* Break */
  .break-buttons { display: flex; gap: 0.5rem; margin-top: 1rem; }
  .break-btn {
    flex: 1; padding: 0.5rem; background: rgba(59, 130, 246, 0.1); color: var(--accent-blue);
    border-radius: var(--radius-md); border: 1px solid rgba(59, 130, 246, 0.3); cursor: pointer; transition: all 0.2s ease;
  }
  .break-btn:hover:not(:disabled) { background: rgba(59, 130, 246, 0.2); }
  .break-btn:disabled { opacity: 0.5; cursor: not-allowed; }
  .break-timer {
    margin-top: 1rem; text-align: center; padding: 0.5rem; background: rgba(59, 130, 246, 0.15);
    border-radius: var(--radius-md); color: var(--accent-blue); display: none;
  }

  /* Caller/Active Call UI */
  .caller-info { text-align: center; margin-bottom: 1.5rem; }
  .caller-name { font-size: 1.2rem; font-weight: 600; margin-bottom: 0.5rem; }
  .caller-number { font-size: 1.5rem; color: var(--accent-green); margin-bottom: 1rem; }
  .call-timer { font-size: 1.8rem; font-weight: 700; color: var(--warning-amber); }
  .call-popup-actions { display: flex; justify-content: center; gap: 1rem; margin-bottom: 1.5rem; }
  .form-actions { display: flex; gap: 1rem; margin-top: 1.5rem; }
  .cancel-btn {
    flex: 1; background: var(--panel-bg); color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1); border-radius: var(--radius-md);
    padding: 0.75rem; cursor: pointer; transition: all 0.2s ease;
  }
  .cancel-btn:hover { background: rgba(255, 255, 255, 0.05); }
  .save-btn {
    flex: 1; background: var(--accent-green); color: var(--primary-dark);
    border: none; border-radius: var(--radius-md); padding: 0.75rem; font-weight: 500; cursor: pointer; transition: all 0.2s ease;
  }
  .save-btn:hover { background: #00e68a; }

  .active-call-header {
    display: flex; align-items: center; gap: 1rem; background: rgba(245, 158, 11, 0.15);
    padding: 0.5rem 1rem; border-radius: var(--radius-md); margin-left: auto;
    transition: all 0.3s ease; opacity: 0; transform: translateY(-10px); pointer-events: none;
  }
  .active-call-header.visible { opacity: 1; transform: translateY(0); pointer-events: all; }
  .active-call-label { font-size: 0.9rem; color: var(--text-secondary); }
  .active-call-number { font-weight: 600; margin-right: 1rem; }
  .header-end-call-btn {
    background: transparent; border: 1px solid var(--danger-red); color: var(--danger-red);
    border-radius: var(--radius-md); padding: 0.5rem 1rem; cursor: pointer; transition: all 0.2s ease; display: flex; align-items: center; gap: 0.5rem;
  }
  .header-end-call-btn:hover { background: rgba(239, 68, 68, 0.1); }

  /* WhatsApp Dashboard */
  #whatsapp-dashboard .container {
    width: 100%; max-width: 1100px; height: 90vh; background: var(--secondary-color);
    border-radius: 8px; display: flex; overflow: hidden; box-shadow: 0 10px 40px var(--shadow-color);
  }
  #whatsapp-dashboard .toggle-wrapper {
    position: absolute; top: 15px; right: 25px; display: flex; align-items: center; font-size: 0.8rem; color: #333; z-index: 10;
  }
  #whatsapp-dashboard .toggle-wrapper input { margin-left: 8px; }

  /* Customer Panel */
  #whatsapp-dashboard .customer-panel {
    width: 35%; max-width: 320px; background: #0f172a; border-right: 1px solid var(--border-color);
    display: flex; flex-direction: column;
  }
  #whatsapp-dashboard .panel-header { padding: 12px 16px; background: #0f172a; color: var(--text-primary); font-weight: 500; font-size: 1rem; border-bottom: 1px solid var(--border-color); }
  #whatsapp-dashboard .panel-header .fas { margin-right: 10px; }
  #whatsapp-dashboard .search-bar { padding: 8px 12px; background: #0f172a; border-bottom: 1px solid var(--border-color); }
  #whatsapp-dashboard .search-bar input {
    width: 100%; border: 1px solid transparent; background: var(--background-color);
    border-radius: 8px; padding: 8px 12px; font-size: 0.85rem; color: var(--text-primary);
  }
  #whatsapp-dashboard .search-bar input:focus { outline: none; border-color: var(--primary-color); }
  #whatsapp-dashboard .customer-list { flex: 1; overflow-y: auto; background-color: #0f172a; }
  #whatsapp-dashboard .customer-list::-webkit-scrollbar { width: 5px; }
  #whatsapp-dashboard .customer-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 5px; }
  body.light-mode #whatsapp-dashboard .customer-list::-webkit-scrollbar-thumb { background: #444; }

  #whatsapp-dashboard .customer-tab {
    cursor: pointer; display: flex; align-items: center; padding: 12px 15px; border-bottom: 1px solid var(--border-color); position: relative; background-color: #0f172a;
  }
  #whatsapp-dashboard .customer-tab:hover { background: var(--secondary-color); }
  #whatsapp-dashboard .customer-tab.active { background: var(--primary-color); }
  #whatsapp-dashboard .customer-tab.active .customer-name,
  #whatsapp-dashboard .customer-tab.active .customer-phone { color: #fff; }

  #whatsapp-dashboard .customer-avatar {
    width: 40px; height: 40px; border-radius: 50%; background: var(--primary-color); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 600; margin-right: 12px; font-size: 1rem; flex-shrink: 0;
  }
  #whatsapp-dashboard .customer-tab.active .customer-avatar { background: #fff; color: var(--primary-color); }

  #whatsapp-dashboard .customer-info { flex: 1; overflow: hidden; }
  #whatsapp-dashboard .customer-name {
    font-weight: 500; color: var(--text-primary); font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  #whatsapp-dashboard .customer-phone { font-size: 0.8rem; color: var(--text-secondary); }
  #whatsapp-dashboard .badge {
    position: absolute; top: 50%; transform: translateY(-50%); right: 15px; background: var(--primary-color);
    color: #fff; font-size: 0.7rem; padding: 2px 7px; border-radius: 12px; font-weight: 500;
  }
  #whatsapp-dashboard .customer-tab.active .badge { background: #fff; color: var(--primary-color); }

  /* Chat Panel */
  #whatsapp-dashboard .chat-panel {
    flex: 1; display: flex; flex-direction: column;
    background-image: url("/static/images/fre.avif");
    background-size: cover; background-position: center; background-blend-mode: overlay;
  }
  body.light-mode #whatsapp-dashboard .chat-panel { background-image: none; }
  #whatsapp-dashboard .chat-header {
    padding: 12px 16px; background: red; display: flex; align-items: center; border-bottom: 1px solid var(--border-color); flex-shrink: 0;
  }
  #whatsapp-dashboard .chat-avatar {
    width: 36px; height: 36px; border-radius: 50%; background: red; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; font-weight: 500; margin-right: 12px;
  }
  #whatsapp-dashboard .chat-name { font-weight: 500; font-size: 1rem; }
  #whatsapp-dashboard .chat-window {
    flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column;
  }
  #whatsapp-dashboard .chat-window::-webkit-scrollbar { width: 5px; }
  #whatsapp-dashboard .chat-window::-webkit-scrollbar-thumb { background: #ccc; border-radius: 5px; }
  body.light-mode #whatsapp-dashboard .chat-window::-webkit-scrollbar-thumb { background: #444; }

  #whatsapp-dashboard .message {
    max-width: 70%; margin-bottom: 10px; padding: 8px 12px; border-radius: 10px; box-shadow: 0 1px 1px var(--shadow-color);
    font-size: 0.85rem; line-height: 1.4; color: var(--text-primary);
  }
  #whatsapp-dashboard .message.in { background: red; align-self: flex-start; border-top-left-radius: 4px; }
  #whatsapp-dashboard .message.out { background: green; align-self: flex-end; border-top-right-radius: 4px; }
  body.light-mode #whatsapp-dashboard .message.out { color: var(--text-primary); }

  #whatsapp-dashboard .message-image, #whatsapp-dashboard .message-video {
    max-width: 250px; border-radius: 8px; margin-bottom: 5px;
  }

  #whatsapp-dashboard .download-btn {
    display: inline-block; margin-top: 5px; background: rgba(0,0,0,0.05); color: var(--text-secondary);
    font-size: 0.7rem; padding: 3px 6px; border-radius: 6px; text-decoration: none; font-weight: 500; transition: all 0.2s ease;
  }
  #whatsapp-dashboard .download-btn:hover { background: rgba(0,0,0,0.1); color: var(--text-primary); }

  #whatsapp-dashboard .input-area {
    display: flex; align-items: center; background: red; padding: 8px 15px; border-top: 1px solid var(--border-color);
  }
  #whatsapp-dashboard .input-area input[type=text] {
    flex: 1; padding: 10px 18px; border: none; border-radius: 20px; background: var(--background-color); color: black; font-size: 0.9rem;
  }
  #whatsapp-dashboard .input-area input[type=text]:focus { outline: none; }
  #whatsapp-dashboard .input-area button, #whatsapp-dashboard .file-input-label {
    background: transparent; border: none; color: var(--icon-color); font-size: 1.1rem; cursor: pointer; margin-left: 10px; padding: 8px; border-radius: 50%;
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  }
  #whatsapp-dashboard .input-area button:hover, #whatsapp-dashboard .file-input-label:hover { background: var(--background-color); }
  #whatsapp-dashboard #fileInput { position: absolute; opacity: 0; width: 0; height: 0; }
  #whatsapp-dashboard .loader {
    border: 3px solid var(--border-color); border-top: 3px solid var(--primary-color);
    border-radius: 50%; width: 18px; height: 18px; animation: spin 1s linear infinite; display: none; margin-left: 15px;
  }
  @keyframes spin { 100% { transform: rotate(360deg) } }
  #whatsapp-dashboard .upload-status { margin-left: 10px; font-size: 0.75rem; color: var(--primary-color); display: none; font-weight: 500; }
  #whatsapp-dashboard .upload-status.done { color: #10b981; }

  /* Tabs (generic) */
  .tabs-container { display: flex; margin-bottom: 1rem; background: var(--panel-bg); border-radius: var(--radius-md); overflow: hidden; }
  .tab-button { flex: 1; padding: 1rem; background: transparent; border: none; color: var(--text-secondary); font-weight: 500; cursor: pointer; transition: all 0.2s ease; }
  .tab-button.active { background: #00ff9d; color: white; }
  .tab-content { display: none; }
  .tab-content.active { display: block; }

  @media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    aside { order: -1; }
  }

  /* Transfer Popup */
  .transfer-popup {
    display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: var(--panel-bg); padding: 2rem; border-radius: var(--radius-lg);
    box-shadow: 0 4px 30px var(--shadow-color); z-index: 1000; width: 400px; max-width: 90%;
  }
  .transfer-input {
    width: 100%; padding: 1rem; border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1); color: var(--text-primary); font-size: 1.1rem; margin-bottom: 1.5rem;
  }
  .transfer-actions { display: flex; justify-content: center; gap: 1rem; }

  /* Mobile */
  @media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); width: 80%; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; width: 100%; }
    .menu-toggle {
      display: block; position: fixed; top: 1rem; left: 1rem; z-index: 1001; background: var(--panel-bg);
      border: none; border-radius: var(--radius-md); width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
      color: var(--text-primary); cursor: pointer; box-shadow: 0 2px 10px var(--shadow-color);
    }
  }

  /* Page shell + sections (from second block) */
  .page { max-width: 1200px; margin: 22px auto; padding: 18px; }
  header h1 { font-size: 20px; margin: 0; color: var(--text-primary); }
  header .meta { color: var(--text-secondary); font-size: 13px; }

  .tabs { display: flex; gap: 8px; margin-bottom: 14px; }
  .tab {
    padding: 9px 14px; border-radius: 10px; background: rgba(255, 255, 255, 0.08);
    cursor: pointer; font-weight: 600; color: #e2e8f0; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2); user-select: none; transition: all 0.3s ease;
  }
  .tab:hover { background: rgba(255, 255, 255, 0.12); }
  .tab.active { background: var(--accent-green); color: #0f172a; box-shadow: 0 6px 20px rgba(0, 255, 157, 0.3); }

  .grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
  @media (min-width: 1000px) { .grid { grid-template-columns: 1fr 520px; } }

  .left-col { display: flex; flex-direction: column; gap: 16px; }

  /* Unified .card (keep one definition) */
  .card {
    background: var(--panel-bg);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }
  .card h2 { margin: 0 0 14px 0; font-size: 16px; color: var(--text-primary); }

  .search-box { margin-bottom: 12px; }
  .search-box input {
    width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.12);
    outline: none; font-size: 14px; background: rgba(0, 0, 0, 0.2); color: var(--text-primary);
  }
  .search-box input:focus { border-color: var(--accent-green); box-shadow: 0 0 0 2px rgba(0, 255, 157, 0.2); }

  table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 10px; }
  thead th {
    text-align: left; padding: 12px; background: rgba(0, 255, 157, 0.15); color: var(--accent-green);
    font-weight: 700; font-size: 13px; border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  tbody td { padding: 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); vertical-align: top; color: #e2e8f0; }
  tbody tr:hover { background: var(--glass); }

  .small { font-size: 13px; color: var(--text-secondary); }
  .notes { white-space: pre-wrap; max-width: 360px; color: #cbd5e1; font-size: 13px; }
  .timestamp { font-size: 12px; color: var(--text-secondary); }

  .right-col { display: flex; flex-direction: column; gap: 12px; }

  /* Ticket form */
  #ticketForm { display: flex; flex-direction: column; gap: 10px; }
  #ticketForm input[type="text"], #ticketForm textarea {
    padding: 10px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 14px; background: rgba(0, 0, 0, 0.2); color: var(--text-primary);
  }
  #ticketForm textarea { min-height: 90px; resize: vertical; }
  #ticketForm .form-row { display: flex; gap: 8px; align-items: center; }
  #ticketForm button {
    background: var(--accent-green); color: #0f172a; padding: 10px 12px; border-radius: 10px; border: 0; font-weight: 700; cursor: pointer; transition: all 0.3s ease;
  }
  #ticketForm button:hover { background: #00e68a; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 255, 157, 0.3); }

  .file-link { color: #60a5fa; text-decoration: none; font-weight: 600; }
  .status-msg { font-size: 13px; margin-top: 6px; }
  .success { color: #00ff9d; }
  .error { color: #f87171; }

  .muted { color: var(--text-secondary); font-size: 13px; }
  .top-actions { display: flex; gap: 8px; align-items: center; }
  .count-badge {
    background: rgba(0, 255, 157, 0.15); color: var(--accent-green); padding: 6px 10px; border-radius: 999px; font-weight: 700;
  }

  /* Page sections */
  .page-section {
    display: none; padding: 20px; background: var(--panel-bg); border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px var(--shadow-color); margin-bottom: 2rem;
  }
  .page-section.active { display: block; }

  /* Analytics (from second block) */
  h1 { text-align: center; margin-bottom: 20px; }
  .filters { margin-bottom: 20px; display: flex; gap: 10px; justify-content: center; }
  .filters input, .filters button { padding: 8px; font-size: 14px; }
  .stats {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 30px;
  }
  .stats .card { text-align: center; }
  .stats .card h2 { margin: 5px 0; font-size: 22px; }
  .stats .card p { color: var(--text-secondary); margin: 0; }

  canvas { max-width: 100%; }

  /* Generic button fallback (won’t override .btn / #ticketForm button due to specificity) */
  button {
    padding: 12px 24px; font-size: 16px; border: none; border-radius: 8px;
    background: var(--accent-blue); color: white; cursor: pointer; transition: background-color 0.2s;
  }
  button:hover { background: #2563eb; }

