/* ========================================================
   CHAT SOCIAL AI - MODERN SAAS DASHBOARD STYLESHEET
   Nền tảng quản lý seeding và đăng bài tự động cho Zalo & Telegram
   Thiết kế chuẩn Web App hiện đại, Responsive đa màn hình
   ======================================================== */

:root {
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Bảng màu chuẩn SaaS Mockup */
  --bg-app: #f4f6fb;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f8fafc;
  --bg-surface-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;

  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --text-white: #ffffff;

  /* Thương hiệu & Nhận diện */
  --color-primary: #2563eb;
  --color-primary-light: #eff6ff;
  --color-primary-hover: #1d4ed8;

  --color-zalo: #0084ff;
  --color-zalo-bg: #e0f2fe;
  --color-tele: #0284c7;
  --color-tele-bg: #e0f7fe;
  --color-purple: #7c3aed;
  --color-purple-bg: #f3e8ff;
  --color-pink: #ec4899;
  --color-pink-bg: #fce7f3;

  --color-success: #10b981;
  --color-success-bg: #ecfdf5;
  --color-warning: #f59e0b;
  --color-warning-bg: #fffbeb;
  --color-danger: #ef4444;
  --color-danger-bg: #fef2f2;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --shadow-card: 0 2px 10px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.02);

  --header-height: 64px;
  --sidebar-width: 250px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-body);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ========================================================
   TOPBAR HEADER CHUẨN DESKTOP & MOBILE
   ======================================================== */
.app-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1000;
  box-shadow: var(--shadow-xs);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sidebar-toggle-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
}
.sidebar-toggle-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  user-select: none;
}

.brand-robot-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-logo-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-title .accent-ai {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Global Search Bar */
.header-center {
  flex: 1;
  max-width: 520px;
  margin: 0 24px;
}

.global-search-wrap {
  position: relative;
  width: 100%;
}

.global-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  font-size: 0.95rem;
  pointer-events: none;
}

.global-search-input {
  width: 100%;
  padding: 9px 16px 9px 40px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
}

.global-search-input:focus {
  background: var(--bg-surface);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.global-search-input::placeholder {
  color: var(--text-subtle);
}

/* Header Right Actions */
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-action-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.header-action-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
  border-color: #cbd5e1;
}

.notification-badge-dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--color-danger);
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
}

.btn-header-sync {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-body);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-header-sync:hover {
  background: var(--bg-surface-hover);
  border-color: #cbd5e1;
}

.user-profile-capsule {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  cursor: pointer;
  transition: all 0.2s;
}

.user-profile-capsule:hover {
  background: var(--bg-surface-hover);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
}

.user-info {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.user-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.user-role {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ========================================================
   APP BODY LAYOUT: SIDEBAR + MAIN WORKSPACE
   ======================================================== */
.app-container {
  display: flex;
  min-height: calc(100vh - var(--header-height));
  width: 100%;
}

/* SIDEBAR NAVIGATION */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 14px;
  flex-shrink: 0;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
}

.sidebar-nav-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  list-style: none;
}

.sidebar-nav-item {
  width: 100%;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-body);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  user-select: none;
  width: 100%;
  text-align: left;
  background: none;
}

.sidebar-nav-link .nav-icon {
  font-size: 1.15rem;
  width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s;
}

.sidebar-nav-link:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
}

.sidebar-nav-link:hover .nav-icon {
  color: var(--color-primary);
}

.sidebar-nav-link.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: rgba(37, 99, 235, 0.15);
  font-weight: 700;
}

.sidebar-nav-link.active .nav-icon {
  color: var(--color-primary);
}

/* Sidebar Footer Info Card */
.sidebar-footer-card {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(124, 58, 237, 0.05));
  border: 1px solid rgba(37, 99, 235, 0.15);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: 20px;
}

.sidebar-footer-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.live-pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--color-success);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.sidebar-footer-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* MAIN WORKSPACE */
.app-main {
  flex: 1;
  padding: 24px 32px 48px 32px;
  overflow-y: auto;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

/* VIEWS CONTAINER & ANIMATION */
.view-section {
  display: none;
  animation: fadeInView 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-section.active {
  display: block;
}

@keyframes fadeInView {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* VIEW HEADERS (CHUẨN MOCKUP) */
.view-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.view-header-titles {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.view-header-title {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.4px;
}

.view-header-subtitle {
  font-size: 0.86rem;
  color: var(--text-muted);
}

.view-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Date Range Picker Pill */
.date-range-picker-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  user-select: none;
  transition: all 0.2s;
}

.date-range-picker-pill:hover {
  border-color: #cbd5e1;
  background: var(--bg-surface-hover);
}

/* ========================================================
   1. DASHBOARD TỔNG QUAN (SCREEN 1 MOCKUP)
   ======================================================== */

/* 4 STAT CARDS ROW */
.top-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.stat-metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  min-width: 0;
}

.stat-metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.stat-card-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-card-icon-box {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.icon-box-blue { background: #dbeafe; color: #2563eb; }
.icon-box-cyan { background: #cffafe; color: #0891b2; }
.icon-box-purple { background: #ede9fe; color: #7c3aed; }
.icon-box-green { background: #d1fae5; color: #059669; }

.stat-card-bottom {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.stat-card-value {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
}

.stat-trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

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

/* 2 PLATFORM OVERVIEW CARDS */
.platforms-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.platform-overview-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
}

.platform-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.platform-card-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.platform-badge-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
}

.badge-zalo {
  background: var(--color-zalo);
  color: #ffffff;
}

.badge-tele {
  background: var(--color-tele);
  color: #ffffff;
}

.platform-header-text h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.platform-header-text span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-indicator-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 700;
}

.status-badge-good {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.platform-metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.platform-metric-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.platform-metric-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.platform-metric-num {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Progress bar inside platform card */
.platform-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: #f1f5f9;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease-in-out;
}

.progress-fill-zalo {
  background: linear-gradient(90deg, #0084ff, #38bdf8);
}

.progress-fill-tele {
  background: linear-gradient(90deg, #0284c7, #38bdf8);
}

.platform-card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-platform-action-outline {
  flex: 1;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-platform-action-outline:hover {
  background: var(--color-primary-light);
  border-color: rgba(37, 99, 235, 0.3);
}

.btn-platform-action-solid {
  flex: 1;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--color-primary);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.25);
}

.btn-platform-action-solid:hover {
  background: var(--color-primary-hover);
}

/* 2 CHARTS ROW (LINE CHART & DONUT CHART) */
.dashboard-charts-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
}

.chart-card-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.chart-card-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.chart-legend-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-dot-zalo { background: #0084ff; }
.legend-dot-tele { background: #8b5cf6; }

.chart-select-filter {
  padding: 5px 12px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
}

/* SVG Chart Container */
.svg-chart-wrapper {
  width: 100%;
  height: 220px;
  position: relative;
}

.svg-chart-wrapper svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Donut Chart Inner Layout */
.donut-chart-container {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 220px;
  gap: 16px;
}

.donut-svg-wrap {
  width: 160px;
  height: 160px;
  position: relative;
  flex-shrink: 0;
}

.donut-center-info {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.donut-center-number {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.donut-center-label {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.donut-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
  flex: 1;
}

.donut-breakdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
}

.donut-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-body);
}

.donut-item-pct {
  font-weight: 700;
  color: var(--text-main);
}

/* ========================================================
   2. QUẢN LÝ TÀI KHOẢN & PROXY (SCREEN 2 & 3 MOCKUP)
   ======================================================== */
.filter-tabs-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.platform-segmented-filter {
  display: inline-flex;
  padding: 4px;
  background: #e2e8f0;
  border-radius: var(--radius-md);
  gap: 4px;
}

.segmented-tab-btn {
  padding: 7px 18px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.segmented-tab-btn.active {
  background: var(--bg-surface);
  color: var(--text-main);
  box-shadow: var(--shadow-xs);
  font-weight: 700;
}

.btn-primary-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--color-primary);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.25);
}

.btn-primary-add:hover {
  background: var(--color-primary-hover);
}

/* Table Style Card */
.saas-card-table {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: 20px;
}

.table-responsive-container {
  width: 100%;
  overflow-x: auto;
}

.saas-data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.saas-data-table th {
  background: var(--bg-surface-subtle);
  padding: 12px 18px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.saas-data-table td {
  padding: 14px 18px;
  font-size: 0.88rem;
  color: var(--text-body);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.saas-data-table tr:last-child td {
  border-bottom: none;
}

.saas-data-table tr:hover td {
  background: var(--bg-surface-hover);
}

/* Account cell inside table */
.table-account-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-table-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0084ff, #60a5fa);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
  user-select: none;
}

.account-table-avatar.tele-table-avatar {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
}

.account-table-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.account-avatar-fallback-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 1.1rem;
}

.account-platform-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  border: 1.5px solid var(--bg-surface, #ffffff);
  z-index: 2;
}

.account-platform-badge.tele-badge {
  background: #0284c7;
  color: #fff;
}

.account-platform-badge.zalo-badge {
  background: #0084ff;
  color: #fff;
}

.account-table-info {
  display: flex;
  flex-direction: column;
}

.account-table-name {
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.account-table-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* Proxy Badge */
.table-proxy-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.proxy-ip-text {
  font-family: monospace;
  font-size: 0.82rem;
  color: var(--text-main);
  font-weight: 600;
}

.proxy-proto-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* Status Pill */
.table-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 700;
}

.status-pill-active {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.status-pill-paused {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.status-dot-mini {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Action Button */
.btn-table-action-menu {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-table-action-menu:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
  border-color: #cbd5e1;
}

/* Table Action Menu Dropdown */
.table-action-dropdown-menu {
  position: fixed;
  z-index: 100000;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  min-width: 220px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: fadeInPop 0.15s ease-out;
}

[data-theme="dark"] .table-action-dropdown-menu {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.action-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 500;
  color: #334155;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

[data-theme="dark"] .action-dropdown-item {
  color: #e2e8f0;
}

.action-dropdown-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

[data-theme="dark"] .action-dropdown-item:hover {
  background: #334155;
  color: #ffffff;
}

.action-dropdown-item.text-danger {
  color: #ef4444;
}

.action-dropdown-item.text-danger:hover {
  background: #fef2f2;
  color: #dc2626;
}

[data-theme="dark"] .action-dropdown-item.text-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.action-dropdown-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 4px 0;
}

[data-theme="dark"] .action-dropdown-divider {
  background: #334155;
}

@keyframes fadeInPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}


/* Feature Callout Note Banner (Chuẩn Mockup Box 3 & 4) */
.feature-note-banner {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.feature-note-icon {
  font-size: 1.25rem;
  color: var(--color-primary);
}

/* ========================================================
   3. QUẢN LÝ NHÓM (SCREEN 4 MOCKUP)
   ======================================================== */
.group-table-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
  flex-shrink: 0;
}

/* ========================================================
   4. LỊCH ĐĂNG BÀI TỰ ĐỘNG (SCREEN 5 MOCKUP)
   ======================================================== */
.calendar-view-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.calendar-nav-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-cal-today {
  padding: 7px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cal-today:hover {
  background: var(--bg-surface-hover);
}

.cal-arrows-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-cal-arrow {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-body);
  font-size: 0.8rem;
  transition: all 0.2s;
}

.btn-cal-arrow:hover {
  background: var(--bg-surface-hover);
}

.calendar-current-month-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-left: 6px;
}

.calendar-mode-segmented {
  display: inline-flex;
  padding: 3px;
  background: #e2e8f0;
  border-radius: var(--radius-md);
  gap: 3px;
}

.calendar-mode-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.calendar-mode-btn.active {
  background: var(--bg-surface);
  color: var(--text-main);
  box-shadow: var(--shadow-xs);
  font-weight: 700;
}

/* Calendar Matrix Grid */
.calendar-matrix-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: 24px;
}

.calendar-days-header-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--bg-surface-subtle);
  border-bottom: 1px solid var(--border-color);
}

.calendar-day-header-cell {
  padding: 12px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
}

.calendar-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  min-height: 260px;
}

.calendar-date-cell {
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-surface);
  min-height: 120px;
}

.calendar-date-cell:last-child {
  border-right: none;
}

.calendar-date-number {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.cal-event-pill {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform 0.15s;
}

.cal-event-pill:hover {
  transform: scale(1.02);
}

.cal-event-zalo { background: #dbeafe; color: #1d4ed8; }
.cal-event-tele { background: #e0f2fe; color: #0369a1; }
.cal-event-seeding { background: #fee2e2; color: #b91c1c; }
.cal-event-group { background: #f3e8ff; color: #6d28d9; }

/* Subview Soạn Đăng Bài & Chiến Dịch AI */
.composer-card-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

.composer-textarea {
  width: 100%;
  min-height: 110px;
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-main);
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
  background: var(--bg-surface-subtle);
}

.composer-textarea:focus {
  background: var(--bg-surface);
  border-color: var(--color-primary);
}

.composer-media-chips-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.media-chip-btn {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-body);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.media-chip-btn:hover {
  background: var(--bg-surface-hover);
  border-color: #cbd5e1;
}

/* ========================================================
   5. AI SEEDING THÔNG MINH (SCREEN 6 MOCKUP)
   ======================================================== */
.ai-seeding-subnav-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.ai-seeding-subtab-btn {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.ai-seeding-subtab-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
}

.ai-seeding-subtab-btn.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: rgba(37, 99, 235, 0.2);
  font-weight: 700;
}

.ai-generator-panel-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.ai-form-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-form-label {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-prompt-textarea {
  width: 100%;
  min-height: 90px;
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text-main);
  outline: none;
  background: var(--bg-surface-subtle);
  transition: border-color 0.2s;
}

.ai-prompt-textarea:focus {
  background: var(--bg-surface);
  border-color: var(--color-primary);
}

.topic-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.topic-chip-tag {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-body);
  cursor: pointer;
  transition: all 0.15s;
}

.topic-chip-tag:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: rgba(37, 99, 235, 0.3);
}

.btn-generate-ai {
  padding: 11px 20px;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-generate-ai:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

/* AI Suggestions Output Box */
.ai-results-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.ai-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.ai-results-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.ai-suggestion-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
}

.ai-suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-body);
  transition: all 0.2s;
  gap: 10px;
}

.ai-suggestion-item:hover {
  background: var(--bg-surface-hover);
  border-color: #cbd5e1;
}

.suggestion-text-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex: 1;
}

.suggestion-idx {
  font-weight: 700;
  color: var(--color-primary);
  font-size: 0.82rem;
}

.btn-copy-suggestion {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.76rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-copy-suggestion:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: rgba(37, 99, 235, 0.3);
}

/* ========================================================
   6. BÁO CÁO HOẠT ĐỘNG (SCREEN 7 MOCKUP)
   ======================================================== */
.reports-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.bar-chart-card-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}

.bar-chart-svg-wrap {
  width: 100%;
  height: 260px;
}

/* ========================================================
   LIVE SEEDING SIMULATION ROOM (PHÒNG TRÒ CHUYỆN ĐỐI THOẠI)
   ======================================================== */
.live-seeding-room-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
  margin-top: 20px;
}

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

.live-seeding-room-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.live-seeding-badge-status {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  background: #f1f5f9;
  color: var(--text-muted);
}

.live-seeding-feed-container {
  min-height: 200px;
  max-height: 380px;
  overflow-y: auto;
  padding: 14px;
  background: var(--bg-surface-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.conv-bubble-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: fadeInBubble 0.25s ease-out;
}

@keyframes fadeInBubble {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.conv-bubble-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  font-weight: 700;
  flex-shrink: 0;
}

.conv-bubble-body {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 8px 14px;
  max-width: 82%;
  box-shadow: var(--shadow-xs);
}

.conv-bubble-sender {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--color-primary);
  margin-bottom: 2px;
}

.conv-bubble-text {
  font-size: 0.86rem;
  color: var(--text-main);
  line-height: 1.4;
}

/* ========================================================
   MODALS, FORMS & TOAST NOTIFICATIONS
   ======================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.hidden, [hidden], .modal-overlay.hidden {
  display: none !important;
}

.modal-content {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  animation: modalScaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleUp {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
  margin-top: 20px;
}

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

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-body);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  background: #ffffff;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

.btn {
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.86rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

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

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

.btn-secondary {
  background: #f1f5f9;
  color: var(--text-body);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: #e2e8f0;
}

/* iOS Toggle Switch */
.ios-toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.ios-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ios-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: 0.3s;
  border-radius: 24px;
}

.ios-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .ios-slider {
  background-color: var(--color-success);
}

input:checked + .ios-slider:before {
  transform: translateX(20px);
}

/* Toast notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #0f172a;
  color: #ffffff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.86rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s ease-out;
  display: flex;
  align-items: center;
  gap: 8px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================================
   BOTTOM NAVIGATION BAR CHO THIẾT BỊ DI ĐỘNG (<= 768px)
   ======================================================== */
.bottom-nav-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  z-index: 1200;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  justify-content: space-around;
  align-items: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex: 1;
  max-width: 76px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  text-decoration: none;
}

.bottom-nav-item .bottom-nav-icon {
  font-size: 1.25rem;
  line-height: 1;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
  color: var(--color-primary);
}

.bottom-nav-item.active .bottom-nav-icon {
  transform: translateY(-2px) scale(1.18);
}

/* Sidebar Drawer Header (chỉ hiện khi sidebar thành drawer trên màn hình nhỏ) */
.sidebar-drawer-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-drawer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-drawer-close-btn {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.sidebar-drawer-close-btn:hover {
  background: #fee2e2;
  color: #ef4444;
  border-color: #fca5a5;
}

/* ========================================================
   HỆ THỐNG RESPONSIVE CHO TẤT CẢ THIẾT BỊ
   (DESKTOP, LAPTOP, TABLET, PHABLET & SMARTPHONE)
   ======================================================== */

/* 1. MÀN HÌNH LAPTOP VÀ MÁY TÍNH BẢNG LỚN (<= 1200px) */
@media (max-width: 1200px) {
  .top-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .platforms-overview-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-charts-grid {
    grid-template-columns: 1fr;
  }
  .ai-generator-panel-grid {
    grid-template-columns: 1fr;
  }
  .reports-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* 2. MÀN HÌNH TABLET & DI ĐỘNG (<= 860px) */
@media (max-width: 860px) {
  /* Header trên Tablet & Mobile */
  .app-header {
    height: 56px;
    padding: 0 16px;
  }

  .sidebar-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .header-center {
    display: none;
  }

  .user-info {
    display: none;
  }

  .user-profile-capsule {
    padding: 3px;
    border-radius: 50%;
  }

  .btn-header-sync span:last-child {
    display: none;
  }

  .btn-header-sync {
    padding: 7px 10px;
  }

  /* Sidebar chuyển thành Drawer trượt từ bên trái */
  .sidebar-drawer-header {
    display: flex;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    bottom: 0;
    width: 285px;
    height: auto;
    z-index: 2000;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
    transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--bg-surface);
    padding: 16px;
  }

  .app-sidebar.open {
    left: 0;
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 1999;
  }

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

  /* Không gian nội dung chính trên màn hình nhỏ */
  .app-main {
    padding: 16px 14px 84px 14px;
    width: 100%;
    min-width: 0;
  }

  /* Kích hoạt Bottom Navigation Bar */
  .bottom-nav-bar {
    display: flex;
  }

  /* Đảm bảo toàn bộ bảng dữ liệu có thể cuộn ngang mượt mà, không vỡ layout */
  .table-responsive-container,
  .saas-card-table,
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  .saas-data-table,
  .data-table,
  .saas-table {
    min-width: 620px;
  }

  /* Tối ưu hóa toàn bộ Modal trên thiết bị di động */
  .modal-overlay {
    padding: 10px;
    align-items: center;
  }

  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    border-radius: 16px !important;
    margin: 0 !important;
  }

  .modal-body {
    padding: 14px 16px !important;
  }

  /* Chuyển các lưới 2 cột trong Modal thành 1 cột */
  .modal-content [style*="grid-template-columns: 1fr 1fr"],
  .modal-content [style*="grid-template-columns:1fr 1fr"],
  #topic-accounts-wrapper,
  #topic-groups-wrapper {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .modal-footer {
    padding: 12px 16px !important;
    flex-wrap: wrap;
    gap: 8px !important;
  }

  .modal-footer > div {
    width: 100%;
    display: flex;
    gap: 8px;
  }

  .modal-footer .btn {
    flex: 1;
    justify-content: center;
  }

  /* Tiêu đề view trên Mobile */
  .view-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .view-header-row > div:last-child {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .view-header-row .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}

/* 3. MÀN HÌNH ĐIỆN THOẠI NHỎ (SMARTPHONE <= 520px) */
@media (max-width: 520px) {
  body {
    font-size: 13.5px;
  }

  .app-header {
    height: 52px;
    padding: 0 10px;
  }

  .app-brand .brand-title {
    font-size: 1.05rem;
  }

  .brand-robot-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  /* Cỡ chữ ô input tối thiểu 16px trên iOS để ngăn tự động zoom phiền toái */
  input.form-input,
  select.form-input,
  textarea.form-input {
    font-size: 16px !important;
  }

  .top-stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .reports-stats-grid {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .view-header-title {
    font-size: 1.15rem;
  }

  .view-header-subtitle {
    font-size: 0.78rem;
  }

  .card, .saas-card-table {
    padding: 14px;
    border-radius: 10px;
  }

  /* Tinh chỉnh thanh filter danh mục và mức độ trong Báo cáo */
  #view-reports .view-header-row div {
    width: 100%;
  }

  #report-log-category-filter,
  #report-log-type-filter {
    flex: 1;
    min-width: 120px;
  }

  /* Quick chips chủ đề cho phép cuộn hoặc wrap đẹp */
  .topic-quick-chips {
    gap: 5px !important;
  }

  .topic-chip-tag {
    font-size: 0.75rem;
    padding: 4px 8px;
  }

  /* Lịch tuần trong Lịch Đăng */
  .calendar-week-grid {
    overflow-x: auto;
    padding-bottom: 8px;
  }
}

/* 4. HỖ TRỢ DARK MODE HOẶC MÀN HÌNH SIÊU NHỎ (<= 360px) */
@media (max-width: 360px) {
  .bottom-nav-item span:last-child {
    font-size: 0.62rem;
  }
  .bottom-nav-item .bottom-nav-icon {
    font-size: 1.15rem;
  }
  .app-main {
    padding: 12px 8px 84px 8px;
  }
}

/* ========================================================
   5. CRYPTO TRACKER & GEMINI AI ANALYSIS STYLES
   ======================================================== */
.crypto-coin-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-subtle, #f1f5f9);
  color: var(--text-main, #0f172a);
  border: 1px solid var(--border-color, #cbd5e1);
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  transition: all 0.2s ease;
}
.crypto-coin-chip:hover {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
}
.crypto-coin-chip button {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
}
.crypto-coin-chip button:hover {
  color: #ef4444;
}

.crypto-chat-checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-surface, #ffffff);
  cursor: pointer;
  transition: background 0.15s ease;
  font-size: 0.84rem;
}
.crypto-chat-checkbox-item:hover {
  background: var(--bg-surface-subtle, #f8fafc);
}
.crypto-chat-checkbox-item .chat-name {
  font-weight: 600;
  color: var(--text-main, #1e293b);
  flex: 1;
}
.crypto-chat-checkbox-item .chat-type-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e0f2fe;
  color: #0369a1;
  text-transform: uppercase;
  font-weight: 700;
}

/* ========================================================
   TƯƠNG TÁC CẢM XÚC TELEGRAM (EMOJI REACTIONS)
   ======================================================== */
.tele-react-acc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 290px;
  overflow-y: auto;
  padding-right: 4px;
}

.tele-react-acc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  transition: all 0.2s ease;
  user-select: none;
}

.tele-react-acc-item:hover {
  background: var(--bg-surface-hover);
  border-color: #cbd5e1;
}

.tele-react-acc-item.selected {
  background: #eff6ff;
  border-color: #3b82f6;
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.15);
}

.tele-react-acc-item.selected span[style*="color: #ffffff;"] {
  color: #1e293b !important;
}

.emoji-quick-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.emoji-pick-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  font-size: 1.35rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
  user-select: none;
}

.emoji-pick-btn:hover {
  transform: scale(1.18);
  border-color: #3b82f6;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.emoji-pick-btn.active {
  border-color: #ec4899;
  background: #fdf2f8;
  box-shadow: 0 0 0 2px rgba(236, 72, 153, 0.35);
  transform: scale(1.08);
}

.tele-acc-avatar-badge {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
  position: relative;
}

.tele-acc-avatar-badge.online::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #10b981;
  border: 2px solid #ffffff;
  border-radius: 50%;
}

/* ========================================================
   MOBILE-FIRST FORM WIZARDS
   ======================================================== */
.mobile-wizard-progress,
.mobile-wizard-controls,
.mobile-wizard-error {
  display: none;
}

@media (max-width: 860px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-main {
    padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  }

  .mobile-wizard-active .modal-content {
    display: flex;
    flex-direction: column;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden;
    padding: 0;
  }

  .mobile-wizard-active .modal-header {
    flex-shrink: 0;
    margin: 0;
    padding: 16px 16px 12px;
  }

  .mobile-wizard-active .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 16px !important;
  }

  .mobile-wizard-progress {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 6px;
    padding: 0 16px 12px;
    margin: 0;
    list-style: none;
    border-bottom: 1px solid var(--border-color);
  }

  .mobile-wizard-progress li {
    display: grid;
    place-items: center;
    min-height: 28px;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    background: var(--bg-surface-subtle);
    font-size: 0.76rem;
    font-weight: 700;
  }

  .mobile-wizard-progress li[aria-current="step"] {
    color: #ffffff;
    background: var(--color-primary);
  }

  .mobile-wizard-step {
    display: block;
  }

  .mobile-wizard-step[hidden] {
    display: none !important;
  }

  .mobile-wizard-error {
    display: block;
    width: 100%;
    margin: 0 0 8px;
    color: #b91c1c;
    font-size: 0.84rem;
    font-weight: 600;
  }

  .mobile-wizard-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .mobile-wizard-controls .btn {
    min-height: 44px;
    justify-content: center;
  }

  .mobile-wizard-active .modal-footer {
    flex-shrink: 0;
    margin: 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)) !important;
    background: var(--bg-surface);
    box-shadow: 0 -8px 18px rgba(15, 23, 42, 0.06);
  }

  .mobile-wizard-active:not(.mobile-wizard-final-step) .modal-footer > :not(.mobile-wizard-controls):not(.mobile-wizard-error) {
    display: none !important;
  }

  .mobile-wizard-active.mobile-wizard-final-step .mobile-wizard-controls [data-mobile-wizard-next] {
    display: none;
  }

  .mobile-wizard-active.mobile-wizard-final-step .mobile-wizard-controls {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .app-main {
    padding-right: 10px;
    padding-left: 10px;
  }

  .mobile-wizard-active .modal-header h3 {
    font-size: 1rem;
  }

  .mobile-wizard-active .modal-close {
    min-width: 44px;
    min-height: 44px;
  }
}

@media (min-width: 1200px) {
  .mobile-wizard-step {
    display: block !important;
  }

  .mobile-wizard-progress,
  .mobile-wizard-controls,
  .mobile-wizard-error {
    display: none !important;
  }
}

/* Hộp lên lịch: ưu tiên thao tác một tay trên màn hình điện thoại. */
@media (max-width: 860px) {
  #modal-schedule {
    padding: 12px;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }

  #modal-schedule .modal-content {
    display: flex;
    flex-direction: column;
    width: 100% !important;
    max-width: 640px !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden;
    padding: 0;
    border-radius: 18px !important;
  }

  #modal-schedule .modal-header {
    flex-shrink: 0;
    gap: 10px;
    margin: 0;
    padding: 16px 16px 12px;
  }

  #modal-schedule .modal-header h3 {
    min-width: 0;
    font-size: 1rem;
    line-height: 1.3;
  }

  #modal-schedule .modal-close {
    display: inline-flex;
    flex: 0 0 44px;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: -10px -10px -10px 0;
    border-radius: 50%;
  }

  #modal-schedule .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 14px 16px !important;
  }

  #modal-schedule .modal-footer {
    flex-shrink: 0;
    margin: 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)) !important;
    background: #ffffff;
    box-shadow: 0 -8px 18px rgba(15, 23, 42, 0.06);
  }
}



