:root {
  /* Colors */
  --primary-50: #f0f9ff;
  --primary-100: #e0f2fe;
  --primary-500: #0ea5e9;
  --primary-600: #0284c7;
  --primary-700: #0369a1;
  --secondary-50: #f0fdf4;
  --secondary-100: #dcfce7;
  --secondary-500: #22c55e;
  --secondary-600: #16a34a;
  --secondary-700: #15803d;
  --neutral-0: #ffffff;
  --neutral-50: #fafafa;
  --neutral-100: #f5f5f5;
  --neutral-200: #e5e5e5;
  --neutral-300: #d4d4d4;
  --neutral-400: #a3a3a3;
  --neutral-500: #737373;
  --neutral-600: #525252;
  --neutral-700: #404040;
  --neutral-800: #262626;
  --neutral-900: #171717;
  --error-50: #fef2f2;
  --error-500: #ef4444;
  --error-600: #dc2626;
  --warning-50: #fffbeb;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  --success-50: #f0fdf4;
  --success-500: #22c55e;
  --success-600: #16a34a;

  /* Typography */
  --font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1),
    0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1),
    0 4px 6px -4px rgb(0 0 0 / 0.1);

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-normal: 250ms ease-in-out;

  /* ===================================================================
          * PHẦN 2: CẤU TRÚC LAYOUT MỚI (Theo yêu cầu)
          * =================================================================== */

  /* Kích thước mới */
  --header-height: 50px;
  --footer-height: 30px;
  --main-sidebar-width: 60px; /* Cột 1 (Icon) */
  --side-panel-width: 320px; /* Dùng cho cả Sub-sidebar và Docs-sidebar */
  --content-padding: 30px;

  /* Màu sắc mới */
  --color-bg-page: #f4f7fa;
  --color-bg-white: #ffffff;
  --color-border: #e0e0e0;
  --color-upgrade: #f59e0b;
}

/* Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: var(--font-family);
  background-color: var(--color-bg-page);
  color: var(--neutral-700);
  font-size: var(--font-size-sm);
  line-height: 1.5;
  overflow: hidden; /* Chống cuộn toàn trang */
}

/* Cấu trúc GRID 3 HÀNG (Header, Body, Footer) */
.app-container {
  display: grid;
  grid-template-rows: var(--header-height) 1fr var(--footer-height);
  height: 100vh;
}
.app-body {
  display: flex;
  overflow: hidden;
}

/* 1. HEADER (Thanh trên cùng) */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--content-padding);
  background-color: var(--color-bg-white);
  border-bottom: 1px solid var(--color-border);
  z-index: 10;
}
.header-logo {
  font-weight: 700;
  font-size: 18px;
  color: var(--primary-600);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}
.btn-upgrade {
  background-color: var(--color-upgrade);
  color: white;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 13px;
  border: none;
  cursor: pointer;
}
.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.user-menu i {
  font-size: 18px;
  color: #555;
}

/* 2. LEFT SIDEBAR (Gồm 2 thanh) */

/* 2A. MAIN SIDEBAR (Cột 1: Icon) */
.main-sidebar {
  width: var(--main-sidebar-width);
  flex-shrink: 0;
  background-color: var(--color-bg-white);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 0;
  z-index: 5;
}
.main-sidebar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.icon-button {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--neutral-500);
  cursor: pointer;
  transition: all 0.2s ease;
}
.icon-button:hover {
  background-color: var(--color-bg-page);
}
.icon-button.active {
  background-color: var(--primary-50);
  color: var(--primary-600);
}

/* 2B. SUB SIDEBAR (Cột 2: Danh sách & Cấu hình) */
/* Đây là nơi chứa #main-content-wrapper cũ */
.sub-sidebar {
  width: var(--side-panel-width);
  flex-shrink: 0;
  background-color: var(--color-bg-white);
  border-right: 1px solid var(--color-border);
  height: 100%;
  overflow-y: auto;
  position: relative;
}
/* Cần ghi đè padding cho card-body bên trong sub-sidebar */
.sub-sidebar .card-body {
  padding: var(--space-4);
}
.sub-sidebar .card {
  margin-bottom: var(--space-4);
  /* Bỏ shadow để trông gọn gàng hơn trong sidebar */
  box-shadow: none !important;
  border: 1px solid var(--color-border);
}

/* 3. MAIN CONTAINER (Phần chính) */
.main-container-wrapper {
  flex-grow: 1; /* Chiếm hết phần còn lại */
  display: flex;
  height: 100%;
  overflow: hidden;
}

/* 3A. KHUNG LỚN (Linh hoạt) */
/* Đây là nơi chứa #module-content-wrapper (data-table) cũ */
.main-content-area {
  flex-grow: 1;
  height: 100%;
  overflow-y: auto;
  padding: var(--content-padding);
  background-color: var(--color-bg-page);
}
/* Cần style cho bảng dữ liệu bên trong */
.main-content-area #data-table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--color-bg-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.main-content-area #data-table th,
.main-content-area #data-table td {
  border: 1px solid var(--color-border);
  padding: 12px;
  text-align: left;
}
.main-content-area #data-table thead {
  background-color: var(--neutral-50);
  color: var(--neutral-800);
}
.main-content-area #data-table tbody tr:hover {
  background-color: var(--neutral-50);
}

/* 3B. KHUNG PHẢI (Cố định - Docs) */
.main-docs-sidebar {
  flex-shrink: 0;
  width: var(--side-panel-width);
  height: 100%;
  overflow-y: auto;
  background-color: var(--color-bg-white);
  border-left: 1px solid var(--color-border);
  padding: var(--content-padding);
  transition: width 0.3s ease, padding 0.3s ease;
  position: relative;
}
.main-docs-sidebar.collapsed {
  width: 10px;
  padding: 10px;
  overflow: hidden;
  border-left: none;
}
.main-docs-sidebar.collapsed > *:not(.docs-toggle-button) {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.1s ease;
}
.docs-toggle-button {
  position: absolute;
  top: 20px;
  left: -15px; /* Nằm đè lên viền */
  width: 30px;
  height: 30px;
  background-color: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-right-color: var(--primary-600);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 15;
  box-shadow: -2px 0px 5px rgba(0, 0, 0, 0.05);
  color: var(--primary-600);
}
.docs-toggle-button:hover {
  background-color: var(--primary-50);
}

/* 4. FOOTER (Thanh dưới cùng) */
.app-footer {
  height: var(--footer-height);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-bg-white);
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--neutral-500);
  z-index: 10;
}

/* ===================================================================
        * PHẦN 3: CSS COMPONENTS (Lấy 100% từ file index.html gốc)
        * (Loại bỏ các CSS về layout cũ như .app-layout, #sidebar-left...)
        * =================================================================== */

/* ----- CSS CHO CHATBOT (Giữ nguyên) ----- */
#chatbot-bubble {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 35px;
  height: 35px;
  background-image: url("https://dbconnector.vn/wp-content/uploads/2025/08/dbconnector-ai-agent-1.png");
  background-size: 100% 100%;
  background-position: center;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transition: transform 0.2s ease;
}
#chatbot-bubble:hover {
  transform: scale(1.1);
}
#chatbot-window {
  position: fixed;
  bottom: 14px;
  right: 20px;
  width: 281px;
  height: 541px;
  background-color: var(--neutral-50);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  z-index: 999;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: translateY(10px);
  opacity: 0;
  border: 1px solid var(--neutral-200);
}
#chatbot-window:not(.hidden) {
  transform: translateY(0);
  opacity: 1;
}
#chatbot-header {
  background-color: var(--primary-600);
  color: white;
  padding: var(--space-2) var(--space-3);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}
/* ... (Các CSS khác của Chatbot giữ nguyên) ... */
#chatbot-send-btn:hover {
  color: var(--primary-500);
}

/* ----- CSS COMPONENTS GỐC (Giữ nguyên) ----- */
.usage-progress-bar-bg {
  background-color: var(--neutral-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: var(--space-2);
}
.usage-progress-bar-fg {
  width: 0%;
  height: 8px;
  background-color: var(--success-500);
  transition: width 0.5s ease;
}
.user-message,
.bot-message {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-lg);
  max-width: 95%;
  line-height: 1.5;
  word-wrap: break-word;
}
.user-message {
  background-color: var(--primary-500);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: var(--radius-sm);
}
.bot-message {
  background-color: var(--neutral-0);
  color: var(--neutral-800);
  align-self: flex-start;
  border: 1px solid var(--neutral-200);
  border-bottom-left-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
}
.bot-message.thinking {
  font-style: italic;
  color: var(--neutral-500);
}
.bot-message table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-3) 0;
  font-size: var(--font-size-xs);
}
.bot-message th,
.bot-message td {
  border: 1px solid var(--neutral-300);
  padding: var(--space-2);
  text-align: left;
}
.bot-message th {
  background-color: var(--neutral-100);
  font-weight: 600;
}

.tooltip-container {
  height: 60px;
}
.tooltip-text {
  height: 44px;
  visibility: hidden;
  background-color: #555;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.3s;
}
.tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #555 transparent transparent transparent;
}
.tooltip-container:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4) !important;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 12px !important;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background-color: var(--primary-500);
  color: var(--neutral-0);
  border-color: var(--primary-500);
}
.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-600);
  border-color: var(--primary-600);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-secondary {
  background-color: var(--secondary-500);
  color: var(--neutral-0);
  border-color: var(--secondary-500);
}
.btn-secondary:hover:not(:disabled) {
  background-color: var(--secondary-600);
  border-color: var(--secondary-600);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-outline {
  background-color: var(--neutral-0);
  color: var(--neutral-700);
  border-color: var(--neutral-300);
}
.btn-outline:hover:not(:disabled) {
  background-color: var(--neutral-50);
  border-color: var(--neutral-400);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.btn-ghost {
  background-color: transparent;
  color: var(--neutral-600);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background-color: var(--neutral-100);
  color: var(--neutral-700);
}
.btn-full {
  width: 100%;
}
.action-group {
  display: flex;
  gap: var(--space-2);
}

.card {
  background-color: var(--neutral-0);
  /* Ghi đè: Bỏ radius và shadow mặc định trong sub-sidebar */
  /* border-radius: 0px; box-shadow: 0px 0px 4px #dbd6d6 !important; */
  overflow: hidden;
}
.card-header {
  padding: var(--space-3) var(--space-4);
  background-color: var(--neutral-50);
  border-bottom: 1px solid var(--neutral-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--neutral-800);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.card-body {
  padding: var(--space-4);
}
.card-footer {
  padding: var(--space-3) var(--space-4);
  background-color: var(--neutral-50);
  border-top: 1px solid var(--neutral-200);
}

.form-group {
  margin-bottom: var(--space-4);
}
.form-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--neutral-700);
}
.form-input,
.form-select {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  background-color: var(--neutral-0);
  transition: all var(--transition-fast);
}
.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgb(14 165 233 / 0.1);
}
.form-select[multiple] {
  min-height: 120px;
  padding: var(--space-2);
}

.status-message {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid;
  font-size: var(--font-size-sm);
  margin-top: var(--space-3);
  display: none;
}
.status-message.success {
  background-color: var(--success-50);
  border-color: var(--success-500);
  color: var(--success-600);
  display: block;
}
.status-message.error {
  background-color: var(--error-50);
  border-color: var(--error-500);
  color: var(--error-600);
  display: block;
  margin: 15px;
}
.status-message.loading,
.status-message.info {
  background-color: var(--primary-50);
  border-color: var(--primary-500);
  color: var(--primary-600);
  display: block;
}

.icon-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--neutral-0);
  font-size: var(--font-size-base);
  flex-shrink: 0;
}
.icon-facebook {
  background: linear-gradient(135deg, #1877f2, #42a5f5);
}
.icon-google {
  background: linear-gradient(135deg, #4285f4, #34a853);
}
.icon-tiktok {
  background: linear-gradient(47deg, #ff0050, #6e7777, #000000);
}
.icon-billing {
  background: linear-gradient(135deg, #34a853, #7cb342);
}

.list {
  list-style: none;
}
.list-item {
  display: flex;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--neutral-200);
  cursor: pointer;
  transition: all var(--transition-fast);
  gap: var(--space-3);
}
.list-item:first-child {
  border-top: none;
}
.list-item:hover {
  background-color: var(--neutral-100);
} /* Sửa lại màu hover */
.list-item-content {
  flex: 1;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--neutral-700);
}
.list-item-action {
  color: var(--neutral-400);
}

.hidden {
  display: none !important;
}

.date-range-container {
  display: flex;
  gap: 5px !important;
}
.date-input-group {
  flex: 1;
}
.fields-container-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}
.check-all-btn {
  font-size: var(--font-size-xs);
  color: var(--primary-500);
  text-decoration: none;
  cursor: pointer;
}
.fields-container {
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background-color: var(--neutral-0);
  min-height: 150px;
  max-height: 250px;
  overflow-y: auto;
}
.field-category-title {
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--neutral-800);
  margin-top: var(--space-3);
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-1);
  border-bottom: 1px solid var(--neutral-200);
}
.field-category-title:first-child {
  margin-top: 0;
}
.field-checkbox-item {
  display: flex;
  align-items: center;
  margin-bottom: var(--space-2);
  font-size: var(--font-size-sm);
}
.field-checkbox-item input {
  margin-right: var(--space-2);
}
.field-checkbox-item label {
  margin-bottom: 0;
  font-weight: 400;
}

.credential-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--neutral-100);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  color: var(--neutral-800);
  border: 1px solid var(--neutral-300);
  margin-top: 10px;
}
.credential-display span {
  font-family: monospace;
}
.clear-cred-btn {
  cursor: pointer;
  font-weight: bold;
  color: var(--neutral-500);
  padding: 0 5px;
}
.token-status-line {
  font-size: var(--font-size-xs);
  color: var(--neutral-800);
  margin: 0 0 var(--space-3) 0;
  padding: var(--space-2);
  background-color: var(--success-50);
  border-radius: var(--radius-md);
  text-align: center;
}
.token-status-line .active {
  font-weight: bold;
  color: var(--success-700);
}
.text-muted {
  color: var(--neutral-500);
}
.font-medium {
  font-weight: 500;
}
.mt-2 {
  margin-top: var(--space-2);
}
.mb-2 {
  margin-bottom: var(--space-2);
}
.date-input-group .form-input {
  min-width: 0px;
  font-size: 12px !important;
  padding: 8px 5px 8px 5px !important;
}
.form-select[multiple] option {
  padding: 2px 0px 4px 0px !important;
  border-bottom: 1px solid var(--neutral-200);
  font-size: 13px !important;
}
.form-select[multiple] option:last-child {
  border-bottom: none;
}

.collapsible-header {
  cursor: pointer;
  user-select: none;
}
.collapsible-toggle {
  font-size: var(--font-size-sm);
  transition: transform var(--transition-fast);
}
.collapsible-content {
  max-height: 0;
  overflow: hidden;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-top: none !important;
  transition: max-height 0.3s ease-in-out;
}
.collapsible-content.open {
  max-height: 2000px;
  border-top: 1px solid var(--neutral-200) !important;
}
.view {
  display: none;
}
.view.active {
  display: block;
}

/* Task Manager Panel (Giữ nguyên) */
#task-manager-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  /* Sửa: Cho nó nằm trên footer */
  bottom: var(--footer-height);
  background-color: var(--neutral-800);
  color: var(--neutral-0);
  padding: var(--space-2) var(--space-4);
  display: block !important;
  gap: var(--space-4);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
  z-index: 100;
  transform: translateY(100%);
  transition: transform 0.3s ease-in-out;
}
#task-manager-panel:not(.hidden) {
  transform: translateY(0);
}
#task-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--font-size-xs);
}
#task-status-text {
  font-weight: 500;
}
#task-timer {
  font-family: monospace;
  background-color: var(--neutral-700);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}
#task-controls {
  display: flex;
  gap: var(--space-2);
}
.task-control-btn {
  background: transparent;
  border: 1px solid var(--neutral-500);
  color: var(--neutral-200);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0 !important;
}
.task-control-btn:hover {
  background-color: var(--neutral-700);
}
.task-progress-bar-bg {
  background-color: var(--neutral-600);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.task-progress-bar-fg {
  width: 0%;
  height: 8px;
  background-color: var(--primary-500);
  transition: width 0.3s ease;
}
#task-detail-message {
  font-size: var(--font-size-xs);
  margin: var(--space-1) 0 0 0;
  text-align: center;
  color: var(--neutral-300);
}

/* Schedule & History Card (Giữ nguyên) */
.schedule-view .card-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.schedule-card,
.history-card {
  display: flex;
  align-items: flex-start;
  gap: 0px !important;
  padding: var(--space-3);
  background-color: var(--neutral-0);
  border-bottom: 1px solid var(--neutral-200);
  transition: all var(--transition-fast);
}
.schedule-card:hover {
  border-color: var(--primary-500);
  box-shadow: var(--shadow-sm);
}
.schedule-card-main {
  flex: 1;
  min-width: 0;
}
.schedule-card-title {
  font-weight: 600;
  color: var(--neutral-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.schedule-card-info {
  font-size: var(--font-size-xs);
  color: var(--neutral-500);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-1);
}
.schedule-card-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.history-card-icon {
  font-size: 14px;
  color: var(--neutral-400);
  width: 14px;
  text-align: center;
  margin-top: var(--space-1);
}
.history-card-main {
  flex: 1;
  min-width: 0;
}
.history-card-title {
  font-weight: 600;
  color: var(--neutral-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: var(--space-1);
}
.history-card-info {
  font-size: var(--font-size-xs);
  color: var(--neutral-500);
  font-family: monospace;
  display: flex;
  flex-direction: column;
}
.history-card-status {
  margin-left: auto;
}
.status-badge {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: var(--font-size-xs);
  color: var(--neutral-0);
  white-space: nowrap;
}
.status-badge.success {
  background-color: var(--success-500);
}
.status-badge.error {
  background-color: var(--error-600);
}

/* Modal (Giữ nguyên) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s 0.3s;
}
.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease;
}
.modal-content {
  background-color: var(--neutral-0);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 340px;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}
.modal-overlay.visible .modal-content {
  transform: scale(1);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}
.modal-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
}
.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--neutral-400);
  line-height: 1;
}
.modal-body .list {
  border-top: 1px solid var(--neutral-200);
}

/* Status Dot (Giữ nguyên) */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.success {
  background-color: var(--success-500);
}
.status-dot.error {
  background-color: var(--error-600);
}
.status-dot.warning {
  background-color: var(--warning-500);
}
.status-dot.neutral {
  background-color: var(--neutral-400);
}
.history-card {
  align-items: flex-start;
}

/* History Card Collapsible (Giữ nguyên) */
.history-card.collapsible {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-md);
  background-color: var(--neutral-0);
}
.history-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  cursor: pointer;
}
.history-card-toggle {
  color: var(--neutral-400);
  margin-left: auto;
}
.history-card-toggle i {
  transition: transform 0.3s ease;
}
.history-card-toggle i.rotated {
  transform: rotate(180deg);
}
.history-card-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-in-out;
  padding: 0 var(--space-3);
}
.history-card-details.expanded {
  max-height: 150px;
  padding: var(--space-3);
  border-top: 1px solid var(--neutral-200);
}
.history-card-result {
  font-weight: 500;
  color: var(--neutral-800);
}
/* ===== BẮT ĐẦU: CSS CHO CHATBOT (Bản cập nhật) ===== */

/* ----- Cấu trúc chung ----- */

.chatbot-body-container {
  padding: var(--space-3);
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto; /* Thêm thanh cuộn khi nội dung dài */
}

/* ----- Giao diện cài đặt (MỚI) ----- */

/* Kiểu chung cho các nút trên header */
.header-btn {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  font-size: 16px;
  padding: 5px;
  margin-left: 8px; /* Tạo khoảng cách giữa các nút */
}

.header-btn:hover {
  color: #000;
}
.input-with-button {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}
.input-with-button .form-input {
  flex-grow: 1;
}
.input-with-button .btn {
  flex-shrink: 0;
  padding: var(--space-2) var(--space-3) !important;
}
#chatbot-column-checkboxes .field-checkbox-item {
  display: flex;
  align-items: center;
  margin-bottom: var(--space-2);
  font-size: var(--font-size-sm);
}
#chatbot-column-checkboxes .field-checkbox-item input {
  margin-right: var(--space-2);
  width: 14px;
  height: 14px;
}
#chatbot-column-checkboxes .field-checkbox-item label {
  margin-bottom: 0;
  font-weight: 400;
  color: var(--neutral-700);
}

/* ----- Giao diện chat ----- */
#chatbot-confirmation-area {
  background-color: #f9f9f9;
  margin-top: 0px;
  text-align: center;
}

.confirmation-text {
  margin: 0 0 10px 0;
  font-size: 14px;
  color: #333;
  line-height: 1.5;
}

.confirmation-buttons {
  display: flex;
  gap: 10px; /* Tạo khoảng cách giữa 2 nút */
  justify-content: center;
}

/* Kiểu cho nút Hủy, bạn có thể tùy chỉnh */
.confirmation-buttons .btn-secondary {
  background-color: #6c757d;
  color: white;
}
.confirmation-buttons .btn-secondary:hover {
  background-color: #5a6268;
}
#chatbot-chat-view {
  display: flex;
  flex-direction: column;
  height: 100%;
}
#chatbot-header button {
  background: none;
  border: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}
#chatbot-messages {
  flex-grow: 1;
  padding: var(--space-3);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
#chatbot-input-container {
  display: flex;
  align-items: center;
  padding: var(--space-2);
  border-top: 1px solid var(--neutral-200);
  background-color: var(--neutral-0);
  flex-shrink: 0;
}
#chatbot-input {
  flex-grow: 1;
  border: 1px solid transparent;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  outline: none;
  font-size: var(--font-size-sm);
  background-color: var(--neutral-100);
  transition: all var(--transition-fast);
}
#chatbot-input:focus {
  background-color: var(--neutral-0);
  border-color: var(--primary-500);
}
#chatbot-send-btn {
  background: none;
  border: none;
  color: var(--neutral-400);
  font-size: var(--font-size-base);
  cursor: pointer;
  padding: var(--space-2);
  margin-left: var(--space-2);
  transition: color var(--transition-fast);
}
/* ===== KẾT THÚC: CSS CHO CHATBOT ===== */

/* [MỚI] Class chung cho nền của thanh tiến trình */

/* [MỚI] Class chung cho phần hiển thị của thanh tiến trình */

/* [SỬA LỖI 2] Làm đẹp tin nhắn của AI */

.bot-message strong {
  color: var(--primary-700);
}

.bot-message ul {
  padding-left: 20px;
  margin-top: 5px;
}

.bot-message li {
  margin-bottom: 4px;
}

/* [SỬA LỖI 2] Cải thiện khung nhập liệu */

/* === DESIGN SYSTEM === */

/* === RESET & BASE === */
html,
body {
  height: 100%;
  overflow: hidden;
}
#app-container {
  flex: 1;
  overflow-y: auto;
  padding: 0px !important; /* Thêm padding cho nội dung chính */
}
/* Container để định vị tooltip */

/* Định dạng thông báo (Tooltip) */

/* Mũi tên của thông báo */

/* Hiệu ứng khi di chuột vào container */
/* === [FIXED] MAIN HEADER STYLES === */
.main-header {
  /* width: 600px; */
  width: auto;
  justify-content: flex-start !important;
  background: linear-gradient(
    135deg,
    var(--primary-500),
    var(--primary-600)
  );
  color: var(--neutral-0);
  padding: var(--space-2) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-shrink: 0;
}

.header-title {
  flex: 0 0 500px !important; /* Không co, không giãn, kích thước 600px */
  min-width: 500px !important; /* Bắt buộc 600px */
  font-weight: 600;
  font-size: var(--font-size-base);
  white-space: nowrap;
  /* [FIX] Thêm các thuộc tính sau để tiêu đề tự co giãn */
  flex: 1; /* Cho phép co lại và giãn ra */
  min-width: 0; /* Cho phép co lại nhỏ hơn nội dung */
  overflow: hidden; /* Ẩn phần chữ thừa */
  text-overflow: ellipsis; /* Hiển thị dấu "..." */
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* === COMPONENT SYSTEM === */
.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
}

.footer img {
  width: 120px;
  height: auto;
  margin-right: 15px; /* Thêm khoảng trống bên phải ảnh */
}

.footer i {
  font-size: 12px; /* Kích thước icon */
  color: #000000; /* Màu icon */
  margin: 0 0px; /* Khoảng cách giữa các icon */
}
.foot-button {
  width: 20px;
  height: 20px;
  border: none;
  background-color: #f2f2f2;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  margin: 0 5px;
}
.foot-button:hover {
  transform: translateY(-2px);
}
.foot-button:active {
  transform: translateY(0);
}
.nav-button {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--neutral-0);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.nav-button:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}
/* Task Manager Panel Styles */
#task-progress-bar {
  flex: 1;
  height: 8px;
  background-color: var(--neutral-600);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
#task-progress-fill {
  width: 0%;
  height: 100%;
  background-color: var(--primary-500);
  transition: width 0.2s linear;
}

/* [FIX] Schedule & History Card View */

/* [FIX] Schedule & History Card View */

/* [NEW] Định dạng cho chấm tròn trạng thái */

/* Điều chỉnh lại thẻ history-card để chứa chấm tròn */

/* [NEW] Định dạng cho thẻ lịch sử có thể đóng/mở */

/* ===== BẮT ĐẦU: CSS CHO MENU DROPDOWN MỚI ===== */

/* Container để định vị cho menu */
.dropdown-menu-container {
  position: relative;
  display: inline-block;
}

/* Khung menu chính */
.dropdown-menu {
  display: none; /* Mặc định ẩn menu */
  position: absolute;
  right: 0; /* Căn lề phải với nút bấm */
  top: calc(
    100% + 8px
  ); /* Vị trí ngay dưới nút bấm, có một khoảng hở nhỏ */
  background-color: var(--neutral-0);
  min-width: 220px; /* Độ rộng tối thiểu của menu */
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  z-index: 1010;
  border: 1px solid var(--neutral-200);
  overflow: hidden; /* Đảm bảo các item bên trong cũng được bo góc */

  /* Hiệu ứng xuất hiện */
  opacity: 0;
  transform: translateY(-10px);
  visibility: hidden;
  transition: opacity var(--transition-fast),
    transform var(--transition-fast), visibility 0s;
}

/* Lớp 'active' để hiển thị menu, sẽ được thêm/xóa bằng JavaScript */
.dropdown-menu.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

/* Các mục trong menu (dạng bar như bạn mô tả) */
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  color: var(--neutral-700);
  font-size: var(--font-size-sm);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.dropdown-item i {
  color: var(--neutral-500);
  width: 16px; /* Giúp các icon căn lề thẳng hàng */
}

/* Hiệu ứng khi di chuột vào một mục */
.dropdown-item:hover {
  background-color: var(--neutral-100);
  color: var(--neutral-800);
}
.app-layout {
  display: flex;
  height: 100vh; /* 100% chiều cao màn hình */
  background-color: var(--neutral-100);
}
/* ===== KẾT THÚC: CSS CHO MENU DROPDOWN MỚI ===== */
/* 2. Sidebar trái (Menu chính) */
#sidebar-left {
  width: 300px; /* Độ rộng cố định, bạn có thể điều chỉnh */
  flex-shrink: 0; /* Ngăn co lại khi thu nhỏ */
  overflow-y: auto; /* Tự động cuộn khi nội dung dài */
  background-color: var(--neutral-50);
  border-right: 1px solid var(--neutral-200);
  /*padding: var(--space-3);*/
}

/* 3. Sidebar phải (Nội dung module) */
#sidebar-middle {
  width: 300px;
  flex-shrink: 0;
  /*flex-grow: 1; /* Chiếm toàn bộ không gian còn lại */
  overflow-y: auto; /* Tự động cuộn khi nội dung dài */
  /*padding: var(--space-3);*/
}

#sidebar-right {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3, 24px);
  background-color: #fff;
}

table {
  width: 100%;
  border-collapse: collapse; /* Gộp viền */
  margin-top: 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  background-color: #fff;
}

th,
td {
  border: 1px solid #ddd; /* Viền ô */
  padding: 12px;
  text-align: left;
}

thead {
  background-color: #007bff; /* Màu nền tiêu đề */
  color: white; /* Màu chữ tiêu đề */
}

/* Thêm hiệu ứng cho hàng khi hover */
tbody tr:hover {
  background-color: #f1f1f1;
}
/* ===== KẾT THÚC: CSS CHO MENU DROPDOWN MỚI ===== */