/* =========================================================
   TPDCli - 100% Pixel-Perfect ChatGPT Dark/Light Design System
   ========================================================= */

:root {
  --bg-main: #212121;
  --bg-sidebar: #171717;
  --bg-card: #2f2f2f;
  --bg-input: #2f2f2f;
  --bg-hover: #262626;
  --bg-hover-subtle: rgba(255, 255, 255, 0.05);
  --border-color: #383838;
  --border-light: rgba(255, 255, 255, 0.1);
  --text-primary: #ececec;
  --text-secondary: #b4b4b4;
  --text-muted: #8e8e8e;
  --brand-green: #10a37f;
  --brand-green-hover: #1a7f64;
  --btn-send: #ffffff;
  --btn-send-icon: #000000;
  --canvas-width: clamp(750px, 58vw, 1100px);
  --code-bg: #0d0d0d;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  height: 100vh;
  display: flex;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ================= APP LAYOUT ================= */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ================= SIDEBAR (ChatGPT Style) ================= */
.sidebar {
  width: 390px; /* Mở rộng 50% theo yêu cầu của Anh Tùng */
  background-color: var(--bg-sidebar);
  height: 100%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), width 0.3s ease;
  z-index: 50;
  flex-shrink: 0;
}

.sidebar.collapsed,
.sidebar.closed {
  transform: translateX(-100%);
  width: 0;
  border-right: none;
  visibility: hidden;
  overflow: hidden;
}

.sidebar-header {
  padding: 14px 12px 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  text-decoration: none;
}

.brand-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #10a37f, #0d8265);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(16, 163, 127, 0.3);
}

.btn-new-chat {
  margin: 4px 12px 12px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-new-chat:hover {
  background-color: var(--bg-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
}

.history-group-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 14px 10px 6px 10px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
  position: relative;
}

.history-item:hover, .history-item.active {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.history-item-title {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.history-delete-btn {
  opacity: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 13px;
  border-radius: 4px;
}

.history-item:hover .history-delete-btn {
  opacity: 1;
}

.history-delete-btn:hover {
  color: #ff6b6b;
  background-color: rgba(255, 107, 107, 0.1);
}

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

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
}

/* ================= MAIN CONTENT ================= */
.main-wrapper {
  flex: 1;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  background-color: var(--bg-main);
  overflow: hidden;
}

/* Header */
.top-header {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-main);
  z-index: 20;
}

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

.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

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

.model-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  background-color: var(--bg-card);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}

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

.workspace-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
  background-color: var(--bg-hover);
  border: 1px solid var(--border-color);
  padding: 5px 10px;
  border-radius: 6px;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.workspace-badge:hover {
  border-color: var(--brand-green);
  color: var(--text-primary);
}

/* Toggle Approval Switch */
.approval-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  background-color: var(--bg-card);
  padding: 4px 8px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  cursor: pointer;
}

.approval-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #22c55e;
}

.approval-dot.interactive {
  background-color: #f59e0b;
}

/* Active Subagent Indicator */
.subagent-hud {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  background-color: rgba(16, 163, 127, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 163, 127, 0.3);
  padding: 4px 10px;
  border-radius: 12px;
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(16, 163, 127, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(16, 163, 127, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 163, 127, 0); }
}

/* ================= CHAT CONTAINER ================= */
.chat-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 24px 0 140px 0;
  scroll-behavior: smooth;
}

.chat-inner {
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Hero Screen (Empty State) */
.hero-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  text-align: center;
}

.hero-logo {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #10a37f, #059669);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(16, 163, 127, 0.25);
}

.hero-title {
  font-size: 26px;
  font-weight: 600;
  margin-bottom: 28px;
  color: var(--text-primary);
}

.hero-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 600px;
  width: 100%;
}

.hero-card {
  background-color: var(--bg-hover);
  border: 1px solid var(--border-color);
  padding: 14px 16px;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.hero-card:hover {
  background-color: var(--bg-card);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.hero-card-title {
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.hero-card-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* Message Rows */
.message-row {
  display: flex;
  gap: 16px;
  width: 100%;
}

.message-row.user {
  justify-content: flex-end;
}

.message-bubble.user-bubble {
  background-color: var(--bg-card);
  padding: 10px 16px;
  border-radius: 18px;
  max-width: 80%;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text-primary);
}

.message-row.assistant {
  justify-content: flex-start;
}

.avatar-ai {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #10a37f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  margin-top: 2px;
}

.assistant-body {
  flex: 1;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text-primary);
  overflow-x: auto;
}

/* Tool execution callout */
.tool-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #1a1a1a;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: #38bdf8;
  margin: 8px 0;
}

.tool-pill .spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(56, 189, 248, 0.3);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Code Blocks */
pre.code-block {
  background-color: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  margin: 12px 0;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #1c1c1c;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-copy {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

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

pre.code-block code {
  display: block;
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  overflow-x: auto;
  line-height: 1.5;
  color: #e2e8f0;
}

/* ================= FLOATING INPUT (Exact ChatGPT) ================= */
.input-floating-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, rgba(33, 33, 33, 0) 0%, rgba(33, 33, 33, 0.95) 30%, #212121 100%);
  padding: 16px 20px 18px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.input-pill {
  max-width: 780px;
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 10px 14px 10px 18px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: border-color 0.15s ease;
}

.input-pill:focus-within {
  border-color: rgba(255, 255, 255, 0.3);
}

.input-textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  outline: none;
  max-height: 180px;
  min-height: 24px;
}

.input-textarea::placeholder {
  color: var(--text-muted);
}

.btn-send {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: var(--btn-send);
  color: var(--btn-send-icon);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}

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

.disclaimer-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ================= SLIDE-OUT CANVAS PANEL ================= */
.canvas-panel {
  width: var(--canvas-width);
  max-width: calc(100vw - 260px);
  background-color: #171717;
  border-left: 1px solid var(--border-color);
  height: 100%;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), width 0.3s ease;
  z-index: 40;
  flex-shrink: 0;
}

.canvas-panel.closed {
  transform: translateX(100%);
  width: 0;
  border-left: none;
}

.canvas-panel.canvas-expanded {
  width: min(1350px, 85vw);
  max-width: calc(100vw - 60px);
}

.canvas-header {
  height: 52px;
  border-bottom: 1px solid var(--border-color);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.canvas-title {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.canvas-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background-color: #1c1c1c;
}

.canvas-tab {
  flex: 1;
  text-align: center;
  padding: 9px 0;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.canvas-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--brand-green);
  background-color: var(--bg-hover-subtle);
}

.canvas-content {
  flex: 1;
  overflow: auto;
  position: relative;
}

/* Diff Viewer */
.diff-container {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
  padding: 12px;
}

.diff-line {
  display: flex;
  padding: 2px 4px;
  white-space: pre-wrap;
  word-break: break-all;
}

.diff-line.added {
  background-color: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.diff-line.deleted {
  background-color: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* Terminal View */
.terminal-box {
  background-color: #000000;
  color: #a3e635;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  padding: 12px;
  height: 100%;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* Approval Action Bar in Canvas */
.approval-action-bar {
  padding: 12px 16px;
  background-color: #1e1e1e;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
}

.btn-approve {
  flex: 1;
  background-color: #10a37f;
  color: #fff;
  border: none;
  padding: 9px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-approve:hover {
  background-color: #0d8265;
}

.btn-reject {
  flex: 1;
  background-color: #dc2626;
  color: #fff;
  border: none;
  padding: 9px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-reject:hover {
  background-color: #b91c1c;
}

/* ================= THINKING ACCORDION (ChatGPT Thinking 100%) ================= */
.thinking-accordion {
  margin-bottom: 14px;
  border-radius: 10px;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 100%;
}

.thinking-accordion:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.14);
}

.thinking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--text-secondary);
  transition: background-color 0.15s ease;
}

.thinking-header:hover {
  color: var(--text-primary);
}

.thinking-left {
  display: flex;
  align-items: center;
  gap: 9px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  flex: 1;
}

.thinking-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(16, 163, 127, 0.25);
  border-top-color: #10a37f;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.thinking-icon-done {
  color: #10a37f;
  font-size: 14px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thinking-title {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 13px;
  flex-shrink: 0;
}

.thinking-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 360px;
}

.thinking-right {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  flex-shrink: 0;
  margin-left: 12px;
}

.thinking-timer {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
}

.thinking-arrow {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.thinking-accordion.expanded .thinking-arrow {
  transform: rotate(180deg);
}

.thinking-body {
  display: none;
  padding: 0 14px 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background-color: rgba(0, 0, 0, 0.2);
}

.thinking-accordion.expanded .thinking-body {
  display: block;
  animation: fadeInDown 0.2s ease;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.thinking-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
}

.thinking-step-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12.5px;
  color: #d1d5db;
  line-height: 1.45;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background-color 0.15s ease;
}

.thinking-step-item:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.thinking-step-bullet {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  margin-top: 1px;
}

.thinking-step-text {
  flex: 1;
  word-break: break-word;
}

.thinking-step-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.08);
  color: #38bdf8;
  margin-right: 6px;
}

.thinking-step-btn {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  border-radius: 4px;
  font-size: 11px;
  padding: 2px 7px;
  cursor: pointer;
  margin-left: 6px;
  transition: all 0.15s ease;
}

.thinking-step-btn:hover {
  background: rgba(56, 189, 248, 0.25);
  color: #fff;
}

/* ================= PROJECT / BUSINESS ACCORDION TREE ================= */

.sidebar-search-box {
  padding: 0 12px 10px 12px;
  flex-shrink: 0;
}

.sidebar-search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 12.5px;
  padding: 7px 10px;
  outline: none;
  transition: all 0.15s ease;
}

.sidebar-search-input:focus {
  border-color: #10a37f;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-search-input::placeholder {
  color: var(--text-muted);
}

.project-tree-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 8px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Custom Scrollbar cho project-tree-container */
.project-tree-container::-webkit-scrollbar {
  width: 5px;
}
.project-tree-container::-webkit-scrollbar-track {
  background: transparent;
}
.project-tree-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
.project-tree-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.project-folder {
  flex-shrink: 0 !important;
  min-height: 44px;
  width: 100%;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  transition: all 0.15s ease;
}

.project-folder:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.12);
}

.project-folder.active-biz {
  border-color: rgba(16, 163, 127, 0.4);
  background: rgba(16, 163, 127, 0.06);
}

.project-folder-header {
  min-height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease;
}

.project-folder-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.project-folder-icon {
  font-size: 15px;
  opacity: 0.9;
  flex-shrink: 0;
}

.project-folder-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.project-folder-tax {
  font-size: 11px;
  font-family: var(--font-mono);
  color: #38bdf8;
  font-weight: 700;
  line-height: 1.2;
}

.project-folder-name {
  font-size: 12.5px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  line-height: 1.25;
}

.project-folder-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.project-btn-plus {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #ececec;
  font-size: 13px;
  cursor: pointer;
  opacity: 0.7;
  transition: all 0.15s ease;
}

.project-btn-plus:hover {
  opacity: 1;
  background: #10a37f;
  color: #fff;
  transform: scale(1.08);
}

.project-chevron {
  font-size: 9px;
  color: var(--text-muted);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  width: 14px;
  text-align: center;
}

.project-folder.open .project-chevron {
  transform: rotate(90deg);
}

.project-folder-sessions {
  display: none;
  padding: 4px 6px 8px 14px;
  flex-direction: column;
  gap: 3px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(0, 0, 0, 0.15);
}

.project-folder.open .project-folder-sessions {
  display: flex;
}

.project-session-item {
  min-height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.project-session-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.project-session-item.active {
  background: rgba(16, 163, 127, 0.18);
  color: #34d399;
  font-weight: 500;
  border-left: 2px solid #10a37f;
}

.project-session-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 6px;
}

.project-session-delete {
  opacity: 0;
  border: none;
  background: none;
  color: #f87171;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  transition: opacity 0.15s ease;
}

.project-session-item:hover .project-session-delete {
  opacity: 0.8;
}

.project-session-delete:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.15);
}

.project-empty-sessions {
  font-size: 11.5px;
  color: var(--text-muted);
  font-style: italic;
  padding: 6px 10px;
  text-align: center;
}

/* Sidebar Empty State */
.project-tree-empty {
  padding: 36px 14px 20px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  color: var(--text-muted);
}

.project-tree-empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 2px;
}

.project-tree-empty-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.project-tree-empty-desc {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-muted);
  max-width: 210px;
}

.btn-start-chat-quick {
  margin-top: 8px;
  background: rgba(16, 163, 127, 0.15);
  border: 1px solid rgba(16, 163, 127, 0.35);
  color: #34d399;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-start-chat-quick:hover {
  background: #10a37f;
  color: #fff;
  border-color: #10a37f;
  box-shadow: 0 2px 10px rgba(16, 163, 127, 0.25);
}

/* ================= HEADER BUSINESS BADGE ================= */

.business-selector-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #f3f4f6;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 380px;
  user-select: none;
}

.business-selector-badge:hover {
  background: rgba(16, 163, 127, 0.1);
  border-color: rgba(16, 163, 127, 0.45);
  box-shadow: 0 2px 12px rgba(16, 163, 127, 0.15);
}

.biz-badge-icon {
  font-size: 15px;
  flex-shrink: 0;
}

.biz-badge-text-wrap {
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.biz-badge-tax {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #38bdf8;
  flex-shrink: 0;
}

.biz-badge-name {
  font-size: 12.5px;
  font-weight: 500;
  color: #ececec;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.biz-badge-arrow {
  font-size: 9px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  margin-left: 2px;
  flex-shrink: 0;
}

.business-selector-badge:hover .biz-badge-arrow {
  color: #34d399;
  transform: translateY(1px);
}

/* ================= MODAL DIALOG CHỌN DOANH NGHIỆP ================= */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-dialog {
  width: 90%;
  max-width: 580px;
  background: #1e1e1e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-title {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.modal-search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13.5px;
  color: #fff;
  outline: none;
  transition: border-color 0.15s ease;
}

.modal-search-input:focus {
  border-color: #10a37f;
  background: rgba(255, 255, 255, 0.09);
}

.modal-biz-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.modal-biz-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: all 0.15s ease;
}

.modal-biz-item:hover {
  background: rgba(16, 163, 127, 0.1);
  border-color: rgba(16, 163, 127, 0.4);
  transform: translateY(-1px);
}

.modal-biz-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.modal-biz-tax {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #38bdf8;
  font-weight: 600;
}

.modal-biz-name {
  font-size: 13.5px;
  font-weight: 500;
  color: #f3f4f6;
}

.modal-biz-badge {
  font-size: 11px;
  background: rgba(16, 163, 127, 0.2);
  color: #34d399;
  padding: 4px 8px;
  border-radius: 4px;
}

.modal-biz-item.active {
  border-color: rgba(16, 163, 127, 0.45);
  background: rgba(16, 163, 127, 0.08);
}

.modal-current-badge {
  font-size: 10.5px;
  background: rgba(16, 163, 127, 0.25);
  color: #34d399;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-family: var(--font-sans);
  font-weight: 600;
  display: inline-block;
}


/* =========================================================
   MARKDOWN ENHANCEMENTS - TABLES, HEADINGS & FORMATTING
   ========================================================= */

.assistant-body {
  flex: 1;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-primary);
  overflow-x: auto;
}

.assistant-body p {
  margin-bottom: 14px;
}

.assistant-body p:last-child {
  margin-bottom: 0;
}

/* Headings */
.assistant-body h1,
.assistant-body h2,
.assistant-body h3,
.assistant-body h4 {
  color: #ffffff;
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 12px;
  letter-spacing: -0.015em;
  line-height: 1.35;
}

.assistant-body h1 {
  font-size: 21px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 8px;
}

.assistant-body h2 {
  font-size: 18.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 6px;
}

.assistant-body h3 {
  font-size: 16.5px;
  color: #f3f4f6;
}

.assistant-body h4 {
  font-size: 15px;
  color: #d1d5db;
}

/* Lists */
.assistant-body ul,
.assistant-body ol {
  margin: 12px 0 16px 20px;
  padding-left: 10px;
}

.assistant-body li {
  margin-bottom: 8px;
  line-height: 1.65;
}

.assistant-body li:last-child {
  margin-bottom: 0;
}

/* Blockquote */
.assistant-body blockquote {
  border-left: 3px solid var(--brand-green);
  background: rgba(16, 163, 127, 0.06);
  padding: 10px 18px;
  margin: 16px 0;
  border-radius: 0 8px 8px 0;
  color: #e5e7eb;
  font-style: italic;
}

/* Horizontal Rule */
.assistant-body hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin: 26px 0;
}

/* Links */
.assistant-body a {
  color: #38bdf8;
  text-decoration: none;
  border-bottom: 1px dashed rgba(56, 189, 248, 0.4);
  transition: all 0.15s ease;
}

.assistant-body a:hover {
  color: #7dd3fc;
  border-bottom-style: solid;
}

/* ================= TABLES (Pixel-Perfect ChatGPT Dark Design) ================= */
.assistant-body .table-responsive {
  width: 100%;
  overflow-x: auto;
  margin: 18px 0 24px 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #181818;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.assistant-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
  letter-spacing: -0.01em;
}

.assistant-body th {
  background-color: #262626;
  color: #f9fafb;
  font-weight: 600;
  padding: 12px 18px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.15);
  white-space: nowrap;
}

.assistant-body td {
  padding: 12px 18px;
  color: #e5e7eb;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  line-height: 1.55;
}

.assistant-body tr:last-child td {
  border-bottom: none;
}

.assistant-body tr:nth-child(even) td {
  background-color: rgba(255, 255, 255, 0.02);
}

.assistant-body tr:hover td {
  background-color: rgba(255, 255, 255, 0.05);
}

.assistant-body th[align="center"],
.assistant-body td[align="center"] {
  text-align: center;
}

.assistant-body th[align="right"],
.assistant-body td[align="right"] {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Strong / Bold highlights */
.assistant-body strong,
.assistant-body b {
  color: #ffffff;
  font-weight: 600;
}
