:root {
  --bg-page: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-blue-tint: #eff6ff;
  --bg-blue-hover: #dbeafe;
  --primary: #0068ff;
  --primary-hover: #0052cc;
  --primary-dark: #1d4ed8;
  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --success: #10b981;
  --success-text: #047857;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-text: #b45309;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-text: #b91c1c;
  --danger-bg: #fef2f2;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-xs: 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 12px 32px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ================= LOGIN SCREEN ================= */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0068ff 0%, #1e40af 100%);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 410px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
  padding: 36px 32px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 104, 255, 0.3);
}

.login-brand-text h1 {
  font-size: 17.5px;
  font-weight: 700;
  color: var(--text-main);
}

.login-brand-text p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.login-desc {
  background: var(--bg-blue-tint);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12.5px;
  color: #1e3a8a;
  margin-bottom: 18px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 104, 255, 0.14);
}

.login-error {
  color: var(--danger-text);
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  margin-bottom: 14px;
  display: none;
}

/* ================= BUTTONS & BADGES ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 12.5px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-outline {
  background: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.btn-outline:hover:not(:disabled) {
  background: var(--bg-subtle);
  border-color: #94a3b8;
}

.btn-blue-soft {
  background: var(--bg-blue-tint);
  color: var(--primary);
  border-color: #bfdbfe;
}

.btn-blue-soft:hover:not(:disabled) {
  background: var(--bg-blue-hover);
}

.btn-danger-soft {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: #fecaca;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 11.5px;
  border-radius: 5px;
}

.btn-block {
  width: 100%;
  padding: 11px 16px;
  font-size: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-blue {
  background: var(--bg-blue-tint);
  color: var(--primary);
}

.badge-success {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.badge-neutral {
  background: #f1f5f9;
  color: var(--text-secondary);
}

/* ================= APP SHELL ================= */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 248px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-title h2 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
}

.sidebar-title p {
  font-size: 11px;
  color: var(--text-muted);
}

.zalo-sidebar-card {
  margin: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
  border: 1px solid #bfdbfe;
}

.zalo-sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: #94a3b8;
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22);
}

.status-dot.waiting {
  background: var(--warning);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.22);
}

.nav-menu {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px;
}

.nav-section-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  padding: 10px 10px 4px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  margin-bottom: 2px;
  transition: all 0.12s;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke-width: 2;
}

.nav-item:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.nav-item.active {
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 104, 255, 0.22);
}

.nav-item.active .badge {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11.5px;
}

/* ================= MAIN CONTENT AREA ================= */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.topbar {
  height: 58px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-main);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
}

/* ================= KPI STAT CARDS ================= */
.kpi-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.stat-card-info .stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-card-info .stat-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-card-info .stat-meta {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg-blue-tint);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

/* ================= CHARTS & CARDS ================= */
.dashboard-charts-row {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  margin-bottom: 16px;
  overflow: hidden;
}

.card-header {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-surface);
}

.card-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.card-body {
  padding: 16px;
}

.chart-box {
  position: relative;
  height: 250px;
  width: 100%;
}

/* ================= CLEAN TABLES ================= */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.clean-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.8px;
}

.clean-table th {
  text-align: left;
  padding: 10px 14px;
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.clean-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-main);
}

.clean-table tbody tr:last-child td {
  border-bottom: none;
}

.clean-table tbody tr:hover td {
  background: #f8fafc;
}

.td-title {
  font-weight: 600;
  color: var(--text-main);
  max-width: 310px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.td-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  max-width: 310px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.progress-track {
  flex: 1;
  height: 7px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}

/* ================= ZALO CONVERSATION CENTER (CLEAN ZALO WEB STYLE) ================= */
.zalo-workspace {
  display: grid;
  grid-template-columns: 300px 1fr 330px;
  gap: 14px;
  height: calc(100vh - 96px);
  min-height: 520px;
}

.zalo-col {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.zalo-search-bar {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pill-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.pill-tab {
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.pill-tab.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.thread-list {
  flex: 1;
  overflow-y: auto;
}

.thread-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.12s;
}

.thread-row:hover {
  background: var(--bg-subtle);
}

.thread-row.active {
  background: var(--bg-blue-tint);
  border-left: 3px solid var(--primary);
}

.thread-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #dbeafe;
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.thread-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thread-main {
  flex: 1;
  min-width: 0;
}

.thread-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.thread-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-time {
  font-size: 10.5px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.thread-preview {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.thread-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

/* Chat view */
.chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble-wrap {
  display: flex;
  flex-direction: column;
  max-width: 78%;
}

.bubble-wrap.in {
  align-self: flex-start;
}

.bubble-wrap.out {
  align-self: flex-end;
  align-items: flex-end;
}

.bubble-box {
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.bubble-wrap.in .bubble-box {
  background: #ffffff;
  color: var(--text-main);
  border-top-left-radius: 3px;
}

.bubble-wrap.out .bubble-box {
  background: var(--primary);
  color: #ffffff;
  border-top-right-radius: 3px;
}

.bubble-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.bubble-task-btn {
  border: none;
  background: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 11px;
  cursor: pointer;
}

.bubble-task-btn:hover {
  text-decoration: underline;
}

.chat-input-area {
  padding: 10px 12px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
}

/* Right side panel sub-tabs */
.subtab-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.subtab-btn {
  padding: 9px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.subtab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--bg-surface);
}

.quick-reply-card {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-bottom: 6px;
  cursor: pointer;
  background: var(--bg-surface);
  transition: all 0.12s;
}

.quick-reply-card:hover {
  border-color: var(--primary);
  background: var(--bg-blue-tint);
}

/* ================= MODALS ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  width: 100%;
  max-width: 500px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 15px;
  font-weight: 700;
}

.modal-body {
  padding: 18px;
  max-height: 78vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.qr-frame {
  width: 230px;
  height: 230px;
  margin: 12px auto;
  border: 2px dashed #93c5fd;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-blue-tint);
  padding: 10px;
}

.qr-frame img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
}

.toast-container {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #0f172a;
  color: #ffffff;
  padding: 10px 15px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  border-left: 4px solid var(--primary);
}

/* ================= MOBILE & RESPONSIVE CONTROLS ================= */
.mobile-menu-btn,
.mobile-close-btn {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-main);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.mobile-menu-btn svg,
.mobile-close-btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  z-index: 890;
  backdrop-filter: blur(2px);
}

.sidebar-backdrop.open {
  display: block;
}

.mobile-conv-tabs {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 5px;
  margin-bottom: 10px;
}

.mobile-conv-tab,
.mobile-conv-btn {
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
}

.mobile-conv-tab.active,
.mobile-conv-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 104, 255, 0.25);
}

/* Prevent CSS Grid blowout with charts and tables */
.stat-card,
.card,
.zalo-col,
.dashboard-charts-row > *,
.grid-2 > *,
.grid-3 > * {
  min-width: 0;
}

.table-wrap {
  -webkit-overflow-scrolling: touch;
}

/* ================= RESPONSIVE BREAKPOINTS ================= */
@media (max-width: 1240px) {
  .kpi-stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .zalo-workspace {
    grid-template-columns: 270px 1fr 290px;
  }
}

@media (max-width: 1080px) {
  .dashboard-charts-row,
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .zalo-workspace {
    grid-template-columns: 260px 1fr;
    height: auto;
    min-height: calc(100vh - 110px);
  }
  .zalo-workspace .zalo-col-list,
  .zalo-workspace .zalo-col-chat {
    height: 600px;
  }
  .zalo-workspace .zalo-col-assistant {
    grid-column: span 2;
    min-height: 360px;
  }
}

/* Tablet & Mobile Drawer Navigation (< 992px) */
@media (max-width: 992px) {
  .mobile-menu-btn,
  .mobile-close-btn {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 270px;
    z-index: 900;
    transform: translateX(-100%);
    transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-header {
    justify-content: space-between;
  }

  .topbar {
    padding: 0 14px;
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    padding-top: 8px;
    padding-bottom: 8px;
    gap: 10px;
  }

  .topbar-left {
    flex: 1;
    min-width: 180px;
  }

  .topbar-title {
    font-size: 14.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .content-scroll {
    padding: 14px;
  }
}

/* Mobile Layout (< 768px) */
@media (max-width: 768px) {
  .hide-xs {
    display: none !important;
  }

  .kpi-stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-card-info .stat-val {
    font-size: 18px;
  }

  .stat-icon {
    width: 34px;
    height: 34px;
  }

  .card-header {
    padding: 11px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .card-body {
    padding: 12px;
  }

  .chart-box {
    height: 220px;
  }

  /* Single-pane switchable Zalo Workspace on Mobile */
  .mobile-conv-tabs {
    display: grid;
  }

  .zalo-workspace {
    display: block;
    height: auto;
    min-height: 0;
  }

  .zalo-workspace .zalo-col {
    display: none;
    height: calc(100vh - 165px);
    min-height: 460px;
    width: 100%;
  }

  .zalo-workspace[data-mobile-pane="list"] .zalo-col-list,
  .zalo-workspace:not([data-mobile-pane]) .zalo-col-list {
    display: flex;
  }

  .zalo-workspace[data-mobile-pane="chat"] .zalo-col-chat {
    display: flex;
  }

  .zalo-workspace[data-mobile-pane="assistant"] .zalo-col-assistant {
    display: flex;
    height: auto;
    min-height: 440px;
  }

  .bubble-wrap {
    max-width: 88%;
  }

  .clean-table th,
  .clean-table td {
    padding: 9px 10px;
    font-size: 12px;
  }

  .td-title,
  .td-sub {
    max-width: 210px;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .modal-box {
    max-width: 100%;
  }

  .modal-body {
    padding: 14px;
    max-height: 82vh;
  }
}

/* Small Phones (< 480px) */
@media (max-width: 480px) {
  .login-screen {
    padding: 14px;
  }

  .login-card {
    padding: 24px 18px;
  }

  .kpi-stat-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .topbar-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 6px 8px;
    font-size: 11.5px;
  }

  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
}

