    * { margin:0; padding:0; box-sizing:border-box; }
    body { font-family:'Inter',sans-serif; background:#0f1117; color:#e2e8f0; min-height:100vh; }

    /* Layout */
    .layout { display:flex; min-height:100vh; }
    .sidebar { width:240px; background:#161822; border-right:1px solid rgba(255,255,255,0.06); display:flex; flex-direction:column; position:fixed; height:100vh; z-index:10; transition:width 0.2s ease; }
    .sidebar.collapsed { width:60px; }
    .sidebar.collapsed .sidebar-header h2, .sidebar.collapsed .biz-name, .sidebar.collapsed .nav-item span, .sidebar.collapsed .section-label, .sidebar.collapsed .sidebar-footer span { display:none; }
    .sidebar.collapsed .nav-item { justify-content:center; padding:12px; }
    .sidebar.collapsed .sidebar-header { padding:12px 8px; }
    .main { margin-left:240px; flex:1; width:calc(100% - 240px); transition:margin-left 0.2s ease, width 0.2s ease; }
    .sidebar.collapsed + .main { margin-left:60px; width:calc(100% - 60px); }

    /* Sidebar */
    .sidebar-header { padding:20px 16px 12px; border-bottom:1px solid rgba(255,255,255,0.06); display:flex; align-items:center; gap:8px; }
    .sidebar-header h2 { font-size:16px; font-weight:700; color:#fff; flex:1; }
    .sidebar-header h2 em { color:#6366f1; font-style:normal; }
    .biz-name { font-size:12px; color:#94a3b8; padding:4px 16px 0; }
    .sidebar.collapsed .biz-name { display:none; }
    .sidebar-nav { flex:1; padding:12px 8px; overflow-y:auto; }
    .nav-item { display:flex; align-items:center; gap:10px; width:100%; padding:10px 12px; border:none; background:none; color:#94a3b8; font-size:13px; font-weight:500; cursor:pointer; border-radius:8px; text-align:left; transition:all 0.15s; }
    .nav-item:hover { background:rgba(255,255,255,0.05); color:#e2e8f0; }
    .nav-item.active { background:rgba(99,102,241,0.12); color:#818cf8; }
    .nav-item svg { width:18px; height:18px; flex-shrink:0; }
    .section-label { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:1px; color:#475569; padding:16px 12px 6px; }
    .sidebar-footer { padding:12px 16px; border-top:1px solid rgba(255,255,255,0.06); }
    .sidebar-footer a { color:#64748b; font-size:12px; text-decoration:none; }
    .sidebar-footer a:hover { color:#818cf8; }
    .sidebar-legal { padding:12px 16px; font-size:11px; color:#9595b0; text-align:center; border-top:1px solid #2a2a3a; margin-top:auto; }
    .sidebar-legal a { color:#9595b0; text-decoration:none; transition:color .2s; }
    .sidebar-legal a:hover { color:#e63946; }
    .toggle-btn { background:none; border:none; color:#64748b; cursor:pointer; padding:4px; border-radius:6px; flex-shrink:0; }
    .toggle-btn:hover { color:#e2e8f0; background:rgba(255,255,255,0.05); }

    /* Cards */
    .stats-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:16px; margin-bottom:24px; }
    .stat-card { background:#1e2030; border:1px solid rgba(255,255,255,0.06); border-radius:12px; padding:20px; }
    .stat-card .label { font-size:12px; color:#64748b; font-weight:500; text-transform:uppercase; letter-spacing:0.5px; }
    .stat-card .value { font-size:28px; font-weight:700; color:#fff; margin-top:4px; }

    /* Section header */
    .section-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:24px; padding:24px 32px 0; }
    .section-header h1 { font-size:22px; font-weight:700; color:#fff; }

    /* Table */
    .table-wrap { background:#1e2030; border:1px solid rgba(255,255,255,0.06); border-radius:12px; overflow:hidden; margin:0 32px; }
    table { width:100%; border-collapse:collapse; }
    th { text-align:left; padding:12px 16px; font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:0.5px; color:#64748b; border-bottom:1px solid rgba(255,255,255,0.06); background:#161822; }
    td { padding:12px 16px; font-size:13px; border-bottom:1px solid rgba(255,255,255,0.04); }
    tr:hover td { background:rgba(255,255,255,0.02); }
    .badge { display:inline-block; padding:2px 8px; border-radius:10px; font-size:11px; font-weight:600; }
    .badge-green { background:rgba(34,197,94,0.15); color:#4ade80; }
    .badge-blue { background:rgba(99,102,241,0.15); color:#818cf8; }
    .badge-yellow { background:rgba(245,158,11,0.15); color:#fbbf24; }
    .badge-gray { background:rgba(100,116,139,0.2); color:#94a3b8; }

    /* Buttons */
    .btn { padding:8px 16px; border:none; border-radius:8px; font-size:13px; font-weight:600; cursor:pointer; transition:all 0.15s; }
    .btn-primary { background:#6366f1; color:#fff; }
    .btn-primary:hover { background:#4f46e5; }
    .btn-ghost { background:none; border:1px solid rgba(255,255,255,0.1); color:#94a3b8; }
    .btn-ghost:hover { background:rgba(255,255,255,0.05); color:#e2e8f0; }
    .btn-danger { background:rgba(239,68,68,0.15); color:#f87171; border:1px solid rgba(239,68,68,0.2); }
    .btn-danger:hover { background:rgba(239,68,68,0.25); }
    .btn-warning { background:rgba(245,158,11,0.15); color:#fbbf24; border:1px solid rgba(245,158,11,0.2); }
    .btn-warning:hover { background:rgba(245,158,11,0.25); }
    .btn-success { background:rgba(34,197,94,0.15); color:#4ade80; border:1px solid rgba(34,197,94,0.2); }
    .btn-success:hover { background:rgba(34,197,94,0.25); }
    .btn-sm { padding:5px 10px; font-size:12px; }

    /* Forms */
    .form-group { margin-bottom:16px; }
    .form-group label { display:block; font-size:12px; font-weight:600; color:#94a3b8; margin-bottom:6px; text-transform:uppercase; letter-spacing:0.5px; }
    .form-group input, .form-group select, .form-group textarea {
      width:100%; padding:10px 12px; background:#161822; border:1px solid rgba(255,255,255,0.1);
      border-radius:8px; color:#e2e8f0; font-size:13px; font-family:inherit;
    }
    .form-group textarea { min-height:120px; resize:vertical; }
    .form-group input:focus, .form-group select:focus, .form-group textarea:focus {
      outline:none; border-color:#6366f1;
    }

    /* Sections */
    .section { display:none; }
    .section.active { display:block; }
    .section.active.flex-section { display:flex; }

    /* ── CHAT (WhatsApp-style) ─────────────────── */
    .chat-layout { display:flex; height:100vh; }
    .chat-list-panel { width:340px; min-width:280px; background:#161822; border-right:1px solid rgba(255,255,255,0.06); display:flex; flex-direction:column; height:100vh; }
    .chat-list-header { padding:16px; border-bottom:1px solid rgba(255,255,255,0.06); }
    .chat-list-header h2 { font-size:16px; font-weight:700; color:#fff; }
    .chat-list-search { padding:8px 16px; }
    .chat-list-search input { width:100%; padding:8px 12px; background:#0f1117; border:1px solid rgba(255,255,255,0.08); border-radius:8px; color:#e2e8f0; font-size:13px; }
    .chat-list-search input:focus { outline:none; border-color:#6366f1; }
    .chat-list-items { flex:1; overflow-y:auto; }
    .chat-item { display:flex; align-items:center; gap:12px; padding:12px 16px; cursor:pointer; transition:background 0.1s; border-bottom:1px solid rgba(255,255,255,0.03); }
    .chat-item:hover { background:rgba(255,255,255,0.03); }
    .chat-item.active { background:rgba(99,102,241,0.1); }
    .chat-item-avatar { width:42px; height:42px; border-radius:50%; background:#2d3148; display:flex; align-items:center; justify-content:center; font-size:16px; font-weight:700; color:#818cf8; flex-shrink:0; }
    .chat-item-info { flex:1; min-width:0; }
    .chat-item-top { display:flex; justify-content:space-between; align-items:center; }
    .chat-item-name { font-size:13px; font-weight:600; color:#e2e8f0; }
    .chat-item-time { font-size:10px; color:#64748b; flex-shrink:0; }
    .chat-item-preview { font-size:12px; color:#64748b; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:2px; }
    .chat-item-badge { background:#6366f1; color:#fff; font-size:10px; font-weight:700; min-width:18px; height:18px; border-radius:9px; display:flex; align-items:center; justify-content:center; padding:0 5px; }
    .chat-item-channel { font-size:10px; padding:1px 5px; border-radius:4px; margin-left:6px; }

    /* Chat panel */
    .chat-panel { flex:1; display:flex; flex-direction:column; height:100vh; background:#0f1117; }
    .chat-panel-empty { flex:1; display:flex; align-items:center; justify-content:center; color:#475569; font-size:15px; }
    .chat-header { padding:12px 20px; background:#161822; border-bottom:1px solid rgba(255,255,255,0.06); display:flex; align-items:center; gap:12px; }
    .chat-header-avatar { width:36px; height:36px; border-radius:50%; background:#2d3148; display:flex; align-items:center; justify-content:center; font-size:14px; font-weight:700; color:#818cf8; }
    .chat-header-info { flex:1; }
    .chat-header-name { font-size:14px; font-weight:600; color:#fff; }
    .chat-header-status { font-size:11px; color:#64748b; }
    .chat-header-actions { display:flex; gap:8px; }
    .chat-messages { flex:1; overflow-y:auto; padding:20px; display:flex; flex-direction:column; gap:6px; }
    .chat-msg { max-width:75%; padding:10px 14px; border-radius:12px; font-size:13px; line-height:1.5; word-wrap:break-word; }
    .chat-msg-user { background:#1a3a5c; align-self:flex-start; border-bottom-left-radius:4px; }
    .chat-msg-assistant { background:#1e2030; align-self:flex-end; border-bottom-right-radius:4px; border:1px solid rgba(255,255,255,0.06); }
    .chat-msg-operator { background:rgba(99,102,241,0.2); align-self:flex-end; border-bottom-right-radius:4px; border:1px solid rgba(99,102,241,0.3); }
    .chat-msg-time { font-size:10px; color:#64748b; margin-top:4px; }
    .chat-msg-label { font-size:9px; font-weight:600; text-transform:uppercase; letter-spacing:0.5px; margin-bottom:2px; }
    .chat-msg-label.bot { color:#818cf8; }
    .chat-msg-label.human { color:#fbbf24; }
    .chat-input-area { padding:12px 20px; background:#161822; border-top:1px solid rgba(255,255,255,0.06); display:flex; gap:10px; align-items:flex-end; }
    .chat-input-area textarea { flex:1; padding:10px 14px; background:#0f1117; border:1px solid rgba(255,255,255,0.1); border-radius:12px; color:#e2e8f0; font-size:13px; font-family:inherit; resize:none; max-height:120px; min-height:42px; }
    .chat-input-area textarea:focus { outline:none; border-color:#6366f1; }
    .chat-input-area textarea:disabled { opacity:0.5; }
    .chat-send-btn { width:42px; height:42px; border-radius:50%; background:#6366f1; border:none; color:#fff; cursor:pointer; display:flex; align-items:center; justify-content:center; flex-shrink:0; transition:background 0.15s; }
    .chat-send-btn:hover { background:#4f46e5; }
    .chat-send-btn:disabled { background:#2d3148; cursor:not-allowed; }
    .takeover-banner { padding:8px 20px; font-size:12px; font-weight:600; text-align:center; }
    .takeover-banner.active { background:rgba(245,158,11,0.15); color:#fbbf24; }
    .takeover-banner.bot { background:rgba(34,197,94,0.1); color:#4ade80; }

    /* Empty state */
    .empty { text-align:center; padding:48px 16px; color:#475569; }
    .empty h3 { font-size:16px; margin-bottom:8px; color:#64748b; }

    /* Loading */
    .loading { text-align:center; padding:32px; color:#64748b; }

    /* Modal */
    .modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.6); z-index:100; align-items:center; justify-content:center; }
    .modal-overlay.active { display:flex; }
    .modal { background:#1e2030; border:1px solid rgba(255,255,255,0.1); border-radius:16px; padding:24px; max-width:600px; width:90%; max-height:80vh; overflow-y:auto; }
    .modal h2 { font-size:18px; font-weight:700; color:#fff; margin-bottom:16px; }

    /* Toast */
    .toast { position:fixed; bottom:24px; right:24px; background:#1e2030; border:1px solid rgba(99,102,241,0.3); color:#e2e8f0; padding:12px 20px; border-radius:10px; font-size:13px; z-index:200; opacity:0; transition:opacity 0.3s; pointer-events:none; }
    .toast.show { opacity:1; }

    /* Hamburger button (hidden on desktop) */
    .mobile-menu-btn { display:none; position:fixed; top:12px; left:12px; z-index:25; width:40px; height:40px; border-radius:10px; background:#1e2030; border:1px solid rgba(255,255,255,0.1); color:#e2e8f0; cursor:pointer; align-items:center; justify-content:center; font-size:20px; }
    .mobile-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.5); z-index:14; }
    .chat-back-btn { display:none; background:none; border:none; color:#94a3b8; cursor:pointer; font-size:20px; padding:4px 8px; }

    /* ── Tablet (≤1024px) ─────────────────── */
    @media (max-width:1024px) {
      .sidebar { width:200px; }
      .main { margin-left:200px; width:calc(100% - 200px); }
      .section-header { padding:20px 20px 0; }
      .table-wrap { margin:0 20px; }
      .stats-grid { grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:12px; }
      .chat-list-panel { width:280px; min-width:240px; }
    }

    /* ── Mobile (≤768px) ─────────────────── */
    @media (max-width:768px) {
      /* Sidebar as overlay */
      .sidebar { position:fixed; left:-260px; width:260px; z-index:20; transition:left 0.25s ease; box-shadow:none; }
      .sidebar.mobile-open { left:0; box-shadow:4px 0 20px rgba(0,0,0,0.5); }
      .mobile-menu-btn { display:flex; }
      .mobile-overlay.active { display:block; }
      .main { margin-left:0; width:100%; padding-top:56px; }

      /* Header & content padding */
      .section-header { padding:16px 16px 0; flex-wrap:wrap; gap:12px; }
      .section-header h1 { font-size:18px; }
      .table-wrap { margin:0 16px; overflow-x:auto; -webkit-overflow-scrolling:touch; }
      .table-wrap table { min-width:560px; }
      .stats-grid { grid-template-columns:1fr 1fr; gap:10px; padding:0; }
      .stat-card { padding:14px; }
      .stat-card .value { font-size:22px; }

      /* Forms */
      .form-group input, .form-group select, .form-group textarea { font-size:16px; /* prevents iOS zoom */ }

      /* Buttons — touch-friendly */
      .btn { padding:10px 16px; font-size:14px; min-height:44px; }

      /* Chat — full screen panels */
      .chat-layout { height:calc(100vh - 56px); }
      .chat-list-panel { width:100%; min-width:unset; }
      .chat-panel { display:none; }
      .chat-layout.chat-open .chat-list-panel { display:none; }
      .chat-layout.chat-open .chat-panel { display:flex; }
      .chat-layout.chat-open .chat-back-btn { display:block; }
      .chat-header { padding:10px 12px; }
      .chat-messages { padding:12px; }
      .chat-input-area { padding:8px 12px; }
      .chat-msg { max-width:85%; }

      /* Modals */
      .modal-overlay { padding:16px; }
      .modal { max-width:100%; width:100%; padding:20px 16px; border-radius:12px; max-height:85vh; }

      /* Toast */
      .toast { left:16px; right:16px; bottom:16px; text-align:center; }

      /* Empty states */
      .empty { padding:32px 16px; }
    }

    /* ── Small Mobile (≤480px) ─────────────────── */
    @media (max-width:480px) {
      .stats-grid { grid-template-columns:1fr; }
      .stat-card .value { font-size:20px; }
      .section-header { padding:12px 12px 0; }
      .section-header h1 { font-size:16px; }
      .table-wrap { margin:0 12px; }
      .chat-item { padding:10px 12px; }
      .chat-item-avatar { width:36px; height:36px; font-size:14px; }
      th, td { padding:10px 10px; font-size:12px; }
    }

    /* Legal links in billing */
    .legal-section { margin-top:32px; padding-top:24px; border-top:1px solid #2a2a3a; }
    .legal-section h3 { font-size:14px; color:#9595b0; margin:0 0 12px; font-weight:600; }
    .legal-links { display:flex; flex-direction:column; gap:8px; }
    .legal-link { display:flex; justify-content:space-between; align-items:center; padding:10px 14px; background:#141420; border:1px solid #2a2a3a; border-radius:8px; color:#e2e2ef; text-decoration:none; font-size:13px; transition:all .2s; }
    .legal-link:hover { border-color:#e63946; background:#1a1a28; }
    .legal-arrow { color:#9595b0; font-size:12px; }
