/* ============================================================
   GETFLY CRM DESKTOP APP — Additional Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ---- BODY & APP ---- */
html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #0f172a;
  color: #f1f5f9;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
  overflow-x: hidden !important;
  max-width: 100vw !important;
  width: 100% !important;
}

body.gf-theme-light {
  background: #f1f5f9;
  color: #1e293b;
}

#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0f172a;
  transition: background 0.3s;
}

#app.gf-theme-light {
  background: #ffffff;
}

/* ---- HEADER ---- */
.header {
  padding: 16px 24px 12px;
  border-bottom: 1px solid #1e293b;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-app-region: drag;
}

.gf-theme-light .header {
  border-bottom-color: #e2e8f0;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.header-brand-wrapper {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.header-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #3b82f6;
  -webkit-app-region: drag;
}

.gf-theme-light .header-title {
  color: #3b82f6;
}

.header-right-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  justify-content: flex-end;
  -webkit-app-region: no-drag;
}

.header-status-scroll {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  transition: max-height 0.35s ease, opacity 0.3s ease, margin 0.35s ease, padding 0.35s ease;
  max-height: 100px;
}

.header-status-scroll.hidden-status {
  max-height: 0 !important;
  opacity: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
}

.gf-theme-btn {
  width: 38px !important;
  height: 38px !important;
  border-radius: 50% !important;
  padding: 0 !important;
  flex-shrink: 0 !important;
}

/* ---- BUTTONS ---- */
.gf-header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 13px;
  font-weight: 600;
  gap: 6px;
  flex-shrink: 0;
  background: #313244;
  color: #cdd6f4;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.gf-theme-light .gf-header-btn {
  background: #f1f5f9;
  color: #1e293b;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.gf-header-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  filter: brightness(1.1);
}

.gf-header-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.gf-btn-login {
  background: #10b981 !important;
  color: #ffffff !important;
}

.gf-btn-fetch {
  background: #3b82f6 !important;
  color: #ffffff !important;
}

.gf-btn-ai-header {
  background: #8b5cf6 !important;
  color: #ffffff !important;
}

.gf-btn-clear-cache {
  background: #ee9612 !important;
  color: #11111b !important;
}

/* ---- CONTROLS & COMPACT SCROLLED HEADER ---- */
.header {
  transition: gap 0.25s ease, padding 0.25s ease;
}

.header.scrolled-header {
  gap: 4px !important;
  padding-bottom: 6px !important;
}

.header.scrolled-header .header-top {
  gap: 0 !important;
}

.header.scrolled-header .header-status-scroll,
.header.scrolled-header .date-filter-group {
  display: none !important;
}

.header.scrolled-header .header-right-group {
  margin: 0 !important;
  padding: 0 !important;
  height: 0 !important;
  min-height: 0 !important;
}

.header.scrolled-header .controls {
  gap: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.header.scrolled-header .gf-quick-filters {
  margin-top: 2px !important;
}

.controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  -webkit-app-region: no-drag;
}

.date-filter-group {
  display: flex;
  gap: 12px;
  align-items: center;
}

.date-input-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-input-wrapper label {
  font-size: 12px;
  font-weight: 600;
  color: #a6adc8;
  white-space: nowrap;
}

.gf-theme-light .date-input-wrapper label {
  color: #64748b;
}

.controls .gf-input {
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13px;
  width: 100px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

/* ---- SWITCH TOGGLE ---- */
.gf-switch-container {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.gf-switch-container input {
  opacity: 0;
  width: 0;
  height: 0;
}

.gf-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #313244;
  transition: .3s;
  border-radius: 20px;
  border: 1px solid #45475a;
}

.gf-switch-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: #a6adc8;
  transition: .3s;
  border-radius: 50%;
}

input:checked+.gf-switch-slider {
  background-color: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
}

input:checked+.gf-switch-slider:before {
  transform: translateX(16px);
  background-color: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.gf-theme-light .gf-switch-slider {
  background-color: #e2e8f0;
  border-color: #cbd5e1;
}

.gf-theme-light .gf-switch-slider:before {
  background-color: #64748b;
}

.gf-theme-light input:checked+.gf-switch-slider {
  background-color: rgba(16, 185, 129, 0.1);
  border-color: #10b981;
}

.gf-theme-light input:checked+.gf-switch-slider:before {
  background-color: #10b981;
}

/* ---- QUICK FILTERS ---- */
.gf-quick-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.gf-quick-btn {
  background: #313244;
  border: 1px solid #45475a;
  color: #cdd6f4;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  white-space: nowrap;
}

.gf-quick-btn:hover {
  background: #45475a;
  border-color: #89b4fa;
  color: #fff;
}

.gf-quick-btn.active {
  background: rgba(137, 180, 250, 0.2);
  border-color: #89b4fa;
  color: #89b4fa;
}

.gf-theme-light .gf-quick-btn {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #64748b;
}

.gf-theme-light .gf-quick-btn:hover {
  background: #e2e8f0;
  border-color: #3b82f6;
  color: #1e293b;
}

.gf-theme-light .gf-quick-btn.active {
  background: rgba(59, 130, 246, 0.1);
  border-color: #3b82f6;
  color: #3b82f6;
}

.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.auth-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.auth-badge.connected {
  background: rgba(166, 227, 161, 0.15);
  color: #a6e3a1;
}

.auth-badge.disconnected {
  background: rgba(243, 139, 168, 0.15);
  color: #f38ba8;
}

.gf-theme-light .auth-badge.connected {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
}

.gf-theme-light .auth-badge.disconnected {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.auth-badge.sync-badge.success {
  background: rgba(137, 180, 250, 0.15);
  color: #89b4fa;
}

.auth-badge.sync-badge.error {
  background: rgba(243, 139, 168, 0.15);
  color: #f38ba8;
}

.auth-badge.sync-badge.idle {
  background: rgba(166, 173, 200, 0.1);
  color: #a6adc8;
}

.gf-theme-light .auth-badge.sync-badge.success {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.gf-theme-light .auth-badge.sync-badge.idle {
  background: rgba(100, 116, 139, 0.1);
  color: #64748b;
}

.auth-badge.license-badge {
  background: rgba(137, 180, 250, 0.15);
  color: #89b4fa;
}

.gf-theme-light .auth-badge.license-badge {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

/* ---- LOGIN DIALOG ---- */
.login-dialog {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-dialog-content {
  background: #1e1e2e;
  border: 1px solid #45475a;
  border-radius: 20px;
  width: 500px;
  max-width: 90%;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.gf-theme-light .login-dialog-content {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
}

.login-dialog-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #313244;
}

.gf-theme-light .login-dialog-header {
  border-bottom-color: #e2e8f0;
}

.login-dialog-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #89b4fa;
}

.gf-theme-light .login-dialog-header h3 {
  color: #3b82f6;
}

.login-dialog-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-instruction {
  font-size: 13px;
  color: #a6adc8;
  margin: 0;
  line-height: 1.5;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field label {
  font-size: 12px;
  font-weight: 600;
  color: #a6adc8;
}

.gf-theme-light .login-field label {
  color: #64748b;
}

.login-field .gf-input {
  width: 100% !important;
  box-sizing: border-box !important;
}

.login-field .gf-textarea {
  resize: vertical;
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  min-height: 80px;
}

.login-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

/* ---- FETCH PROGRESS ---- */
.fetch-progress {
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.progress-bar-container {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #313244;
  overflow: hidden;
}

.gf-theme-light .progress-bar-container {
  background: #e2e8f0;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #89b4fa, #a6e3a1);
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 12px;
  font-weight: 600;
  color: #89b4fa;
  white-space: nowrap;
  min-width: 140px;
  text-align: right;
}

/* ---- LOADING ---- */
#loading {
  text-align: center;
  padding: 60px;
  font-size: 16px;
  color: #89b4fa;
  font-weight: bold;
  flex: 1;
}

/* ---- CONTENT ---- */
#dashboard-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#dashboard-content .gf-summary-bar {
  background: transparent;
  margin-bottom: 0;
  box-shadow: none;
  border-bottom: none;
}

#dashboard-content .gf-modal-content {
  overflow-y: auto !important;
  padding: 20px 24px !important;
  flex: 1;
}

#dashboard-content .gf-modal-footer {
  padding: 8px 24px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #a6adc8;
  border-top: 1px solid #313244;
  flex-shrink: 0;
}

.gf-theme-light #dashboard-content .gf-modal-footer {
  border-top-color: #e2e8f0;
  color: #64748b;
}

/* ---- EMPTY STATE ---- */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  gap: 16px;
}

.empty-icon {
  font-size: 72px;
  margin-bottom: 8px;
  opacity: 0.6;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

.empty-state h3 {
  font-size: 20px;
  font-weight: 700;
  color: #89b4fa;
  margin: 0;
}

.gf-theme-light .empty-state h3 {
  color: #3b82f6;
}

.empty-state p {
  font-size: 14px;
  color: #a6adc8;
  margin: 0;
}

.empty-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.empty-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: #313244;
  border-radius: 12px;
  font-size: 13px;
  text-align: left;
  min-width: 350px;
}

.gf-theme-light .empty-step {
  background: #f1f5f9;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #89b4fa;
  color: #11111b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}

/* ---- SCROLLBAR (Dark) ---- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-thumb {
  background: #45475a;
  border-radius: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

.gf-theme-light ::-webkit-scrollbar-thumb {
  background: #d1d5db;
}

/* ---- LOGIN IFRAME OVERLAY (Mobile) ---- */
.login-iframe-overlay {
  position: fixed;
  inset: 0;
  z-index: 200000;
  background: #181825;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  /* Safe area cho notch/status bar Android & iOS */
  padding-top: env(safe-area-inset-top, 0px);
}

.login-iframe-overlay.active {
  opacity: 1;
  transform: translateY(0);
}

.gf-theme-light .login-iframe-overlay {
  background: #ffffff;
}

.login-iframe-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Padding top lớn hơn để tránh bị status bar đè */
  padding: 36px 16px 12px 16px;
  background: #1e1e2e;
  border-bottom: 1px solid #313244;
  flex-shrink: 0;
  min-height: 52px;
}

.gf-theme-light .login-iframe-header {
  background: #f8fafc;
  border-bottom-color: #e2e8f0;
}

.login-iframe-title {
  font-size: 15px;
  font-weight: 700;
  color: #89b4fa;
}

.gf-theme-light .login-iframe-title {
  color: #3b82f6;
}

.login-iframe-close-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  border: none;
  background: #f8a73e;
  color: #11111b;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  /* Touch target tối thiểu 48px cho mobile */
  -webkit-tap-highlight-color: transparent;
}

.login-iframe-close-btn:hover,
.login-iframe-close-btn:active {
  background: #eba0ac;
  transform: scale(1.1);
}

.login-iframe-status {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  color: #a6e3a1;
  background: rgba(166, 227, 161, 0.08);
  text-align: center;
  flex-shrink: 0;
}

.gf-theme-light .login-iframe-status {
  color: #16a34a;
  background: rgba(34, 197, 94, 0.06);
}

.login-iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: #ffffff;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .header {
    padding: 10px 10px 8px 10px !important;
  }

  #dashboard-content .gf-modal-content {
    padding: 10px 10px !important;
  }

  #dashboard-content .gf-modal-footer {
    padding: 8px 10px !important;
  }

  .gf-summary-bar {
    padding: 10px 10px 8px 10px !important;
  }

  .gf-tabs {
    padding: 6px 10px !important;
  }

  /* Ẩn hoàn toàn scrollbar trên toàn bộ mobile */
  * {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
  *::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }

  .header-top {
    flex-direction: column !important;
    align-items: stretch !important;
    position: relative !important;
    padding-top: 2px !important;
    gap: 8px !important;
  }

  .header-brand-wrapper {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    height: 38px !important;
    min-height: 38px !important;
    padding-right: 44px !important; /* Chừa chỗ cho nút theme ở góc trên phải */
  }

  .header-title {
    font-size: 16px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .gf-theme-btn {
    position: absolute !important;
    top: 6px !important;
    right: 10px !important;
    width: 34px !important;
    height: 34px !important;
    margin: 0 !important;
    z-index: 10 !important;
  }

  /* 1. Thanh trạng thái Server và nút Đồng bộ trên mobile: cuộn vuốt ngang mượt mà, không bị co ép chữ */
  .header-status-scroll {
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    align-items: center !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    padding-bottom: 2px !important;
    gap: 8px !important;
  }

  .header-status-scroll::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }

  .header-status-scroll > * {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }

  .header-right-group {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    justify-content: flex-start !important;
  }

  /* Ẩn dòng thông tin khách hàng ở footer trên mobile */
  #gf-footer-info {
    display: none !important;
  }

  .gf-modal-footer,
  #dashboard-content .gf-modal-footer {
    padding: 8px 10px !important;
    justify-content: center !important;
    text-align: center !important;
  }

  .header-status-scroll::-webkit-scrollbar {
    display: none !important;
  }

  .gf-header-btn .btn-text {
    display: none;
  }

  .gf-header-btn {
    width: 36px;
    padding: 0;
    border-radius: 50%;
  }

  /* 2. SẮP XẾP BỘ LỌC NGÀY GỌN GÀNG TRÊN 1 HÀNG DUY NHẤT TRÊN MOBILE - CĂN ĐỀU SÁT MÉP PHẢI */
  .controls {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  .date-filter-group {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
    width: 100% !important;
  }

  .date-input-wrapper {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex: 1 1 0 !important;
    min-width: 0 !important;
  }

  .date-input-wrapper label {
    font-size: 11px !important;
    white-space: nowrap !important;
  }

  .controls .gf-input {
    width: 100% !important;
    height: 32px !important;
    font-size: 11.5px !important;
    padding: 0 4px !important;
    min-width: 0 !important;
  }

  .date-input-wrapper.gf-updated-toggle-wrapper {
    flex: 0 0 auto !important;
    margin-left: auto !important;
    padding-top: 0 !important;
  }

  /* 3. VUỐT NGANG CÁC NÚT HÔM NAY, HÔM QUA, HÔM KIA,... TRÊN MOBILE */
  .gf-quick-filters {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 6px !important;
    width: 100% !important;
    padding: 2px 0 6px 0 !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }

  .gf-quick-filters::-webkit-scrollbar {
    display: none !important;
  }

  .gf-quick-filters .gf-quick-btn,
  .gf-quick-filters .gf-quick-btn-wrapper {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }

  .gf-quick-btn {
    height: 32px !important;
    padding: 0 11px !important;
    font-size: 12px !important;
  }

  /* Thu gọn sát lề và khoảng cách header khi cuộn trên mobile - lùi menu xuống không đè nút sáng tối */
  .header.scrolled-header {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
    gap: 6px !important;
  }
  .header.scrolled-header .header-brand-wrapper {
    height: 38px !important;
    min-height: 38px !important;
  }
  .header.scrolled-header .header-top {
    padding-top: 0 !important;
    gap: 0 !important;
  }
  .header.scrolled-header .gf-quick-filters {
    padding-top: 0 !important;
    padding-bottom: 2px !important;
    margin-top: 6px !important;
  }
}

/* ---- DATE TAGS & BADGES ---- */
.gf-date-tags-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.gf-date-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.1);
  white-space: nowrap;
  transition: all 0.2s ease;
}

.gf-date-tag:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--gf-primary);
}

.gf-theme-light .gf-date-tag {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}

.gf-theme-light .gf-date-tag:hover {
  background: #e2e8f0;
  border-color: var(--gf-primary);
}

.gf-date-tag-day {
  color: var(--gf-primary);
  font-weight: 700;
}

.gf-date-tag-count {
  background: var(--gf-primary);
  color: #ffffff;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 10px;
  font-weight: 800;
  line-height: 1.2;
}

.gf-date-th {
  white-space: nowrap;
  font-size: 11.5px;
}

/* ---- TREND MULTI-LAYER CHART ---- */
.gf-trend-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  padding: 8px 12px;
  background: var(--gf-bg-alt);
  border: 1px solid var(--gf-border);
  border-radius: 10px;
}

.gf-trend-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--gf-border);
  background: var(--gf-bg);
  color: var(--gf-text-muted);
  transition: all 0.2s ease;
  user-select: none;
}

.gf-trend-pill-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.gf-trend-pill-btn.active {
  color: var(--gf-text);
  font-weight: 700;
  border-color: currentColor;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
}

.gf-theme-light .gf-trend-pill-btn.active {
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.gf-trend-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.gf-trend-quick-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
  align-items: center;
}

.gf-trend-action-btn {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--gf-border);
  color: var(--gf-text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.gf-trend-action-btn:hover {
  background: var(--gf-primary);
  color: #ffffff;
  border-color: var(--gf-primary);
}

/* Hover Column & Tooltip */
.gf-trend-col-hover {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 38px;
  transform: translateX(-50%);
  cursor: pointer;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gf-trend-col-hover:hover {
  background: rgba(255, 255, 255, 0.03);
}

.gf-theme-light .gf-trend-col-hover:hover {
  background: rgba(0, 0, 0, 0.02);
}

.gf-trend-vline {
  position: absolute;
  top: 30px;
  bottom: 35px;
  left: 50%;
  width: 1px;
  border-left: 1px dashed var(--gf-primary);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.gf-trend-col-hover:hover .gf-trend-vline {
  opacity: 0.8;
}

.gf-trend-tooltip {
  position: absolute;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e1e2e;
  color: #cdd6f4;
  border: 1px solid #45475a;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 11.5px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  z-index: 50;
  min-width: 210px;
  white-space: nowrap;
}

.gf-theme-light .gf-trend-tooltip {
  background: #ffffff;
  color: #1e293b;
  border-color: #cbd5e1;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
}

.gf-trend-col-hover:hover .gf-trend-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-5px);
}

/* Tooltip near edges */
.gf-trend-col-hover:first-child .gf-trend-tooltip,
.gf-trend-col-hover:nth-child(2) .gf-trend-tooltip {
  left: 0;
  transform: translateX(0);
}
.gf-trend-col-hover:first-child:hover .gf-trend-tooltip,
.gf-trend-col-hover:nth-child(2):hover .gf-trend-tooltip {
  transform: translateX(0) translateY(-5px);
}

.gf-trend-col-hover:last-child .gf-trend-tooltip,
.gf-trend-col-hover:nth-last-child(2) .gf-trend-tooltip {
  left: auto;
  right: 0;
  transform: translateX(0);
}
.gf-trend-col-hover:last-child:hover .gf-trend-tooltip,
.gf-trend-col-hover:nth-last-child(2):hover .gf-trend-tooltip {
  transform: translateX(0) translateY(-5px);
}

.gf-trend-tt-header {
  font-weight: 800;
  font-size: 12px;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gf-theme-light .gf-trend-tt-header {
  border-bottom-color: #e2e8f0;
}

.gf-trend-tt-grid {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.gf-trend-tt-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 11px;
}

.gf-trend-tt-row strong {
  font-size: 12px;
}

.gf-trend-tt-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 2px 0;
}

.gf-theme-light .gf-trend-tt-divider {
  background: #f1f5f9;
}

.gf-trend-tt-main {
  font-weight: 800;
  font-size: 12px;
  color: var(--gf-primary);
}

/* ---- SPARKLINE WAVE IN TABLE ---- */
.gf-sparkline-container {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 32px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  transition: background 0.2s;
}

.gf-sparkline-container:hover {
  background: rgba(255, 255, 255, 0.04);
}

.gf-theme-light .gf-sparkline-container:hover {
  background: rgba(0, 0, 0, 0.03);
}

.gf-sparkline-svg {
  overflow: visible;
  flex-shrink: 0;
}

.gf-sparkline-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
}

.gf-sparkline-days {
  color: var(--gf-text-muted);
  font-weight: 600;
  font-size: 10.5px;
}

.gf-sparkline-peak {
  color: var(--gf-primary);
  font-weight: 700;
  font-size: 11px;
  white-space: nowrap;
}

.gf-dow-bar-container {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 24px;
}

.gf-dow-bar {
  width: 12px;
  background: var(--gf-primary);
  border-radius: 2px 2px 0 0;
  transition: height 0.3s;
}

/* ---- QUICK FILTER DROPDOWN MENUS ---- */
.header {
  position: relative;
  z-index: 200;
}

.controls {
  position: relative;
  z-index: 210;
}

.gf-quick-btn-wrapper {
  position: relative;
  display: inline-block;
}

.gf-quick-dropdown {
  position: fixed !important;
  z-index: 999999 !important;
  margin-top: 0;
  background: #1e1e2e;
  color: #cdd6f4;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 18px 40px -4px rgba(0, 0, 0, 0.7);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  white-space: nowrap;
}

/* Cầu nối vô hình bao phủ toàn bộ khoảng trống xung quanh */
.gf-quick-dropdown::before {
  content: '';
  position: absolute;
  top: -16px;
  left: -12px;
  right: -12px;
  height: 22px;
  background: transparent;
}

.gf-theme-light .gf-quick-dropdown {
  background: #ffffff;
  color: #1e293b;
  border-color: #cbd5e1;
  box-shadow: 0 18px 40px -4px rgba(0, 0, 0, 0.22);
}

.gf-quick-btn-wrapper:hover .gf-quick-dropdown,
.gf-quick-btn-wrapper.is-open .gf-quick-dropdown,
.gf-quick-dropdown:hover {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.gf-quick-dd-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--gf-text-muted);
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}

.gf-theme-light .gf-quick-dd-title {
  border-bottom-color: #e2e8f0;
}

/* Day grid */
.gf-quick-day-grid {
  display: grid;
  grid-template-columns: repeat(7, 28px);
  gap: 4px;
}

.gf-quick-day-item {
  width: 28px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  color: var(--gf-text);
  transition: all 0.15s;
}

.gf-theme-light .gf-quick-day-item {
  background: #f1f5f9;
}

.gf-quick-day-item:hover {
  background: var(--gf-primary);
  color: #ffffff;
  transform: scale(1.1);
}

.gf-quick-day-item.today {
  border-color: var(--gf-primary);
  color: var(--gf-primary);
  font-weight: 800;
  background: rgba(59, 130, 246, 0.15);
}

.gf-quick-day-item.weekend {
  color: #ef4444;
}

.gf-quick-day-item:hover.weekend {
  color: #ffffff;
}

/* Week list */
.gf-quick-week-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
}

.gf-quick-week-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  color: var(--gf-text);
  transition: all 0.15s;
}

.gf-theme-light .gf-quick-week-item {
  background: #f1f5f9;
}

.gf-quick-week-item:hover {
  background: var(--gf-primary);
  color: #ffffff;
  transform: translateX(2px);
}

.gf-quick-week-item.active {
  border: 1px solid var(--gf-primary);
  color: var(--gf-primary);
  font-weight: 700;
}

/* Month grid */
.gf-quick-month-grid {
  display: grid;
  grid-template-columns: repeat(4, 52px);
  gap: 5px;
}

.gf-quick-month-item {
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  color: var(--gf-text);
  transition: all 0.15s;
}

.gf-theme-light .gf-quick-month-item {
  background: #f1f5f9;
}

.gf-quick-month-item:hover {
  background: var(--gf-primary);
  color: #ffffff;
  transform: scale(1.06);
}

.gf-quick-month-item.current {
  border: 1px solid var(--gf-primary);
  color: var(--gf-primary);
  font-weight: 800;
  background: rgba(59, 130, 246, 0.15);
}

/* ---- SYNC BADGE & BUTTON (SERVER SYNC) ---- */
.sync-badge {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 600;
  transition: all 0.2s;
}

.sync-badge:hover {
  background: rgba(16, 185, 129, 0.25) !important;
}

.gf-btn-sync-header {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  border: none;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.gf-btn-sync-header:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
  transform: translateY(-1px);
}

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