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

:root{
  /* Brand */
  --color-primary: #1c4966;
  --color-primary-dark: #15364b;
  --color-primary-light: #4a6d84;

  --color-accent: #436b5c;
  --color-accent-dark: #304d42;
  --color-accent-light: #6b8b7f;

  /* Background / surface */
  --color-bg: #eef3f6;
  --color-surface: #ffffff;
  --color-surface-2: #f5f8fa;

  /* Borders */
  --color-border: #d1dbe2;
  --color-border-strong: #b8c7d0;

  /* Text */
  --color-text-primary: #1b2f3c;
  --color-text-secondary: #566a77;
  --color-text-muted: #80919d;

  /* Semantic */
  --color-success: #2f8f6b;
  --color-warning: #c78720;
  --color-error: #c2534c;

  /* Tints (dùng thống nhất cho hover/selected/range) */
  --color-primary-heavy-light: #e5edf2;
  --color-primary-medium-light: #c9d7e0;

  --color-accent-heavy-light: #e9f0ed;
  --color-accent-medium-light: #cfddd7;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(21, 37, 48, 0.08);
  --shadow-md: 0 8px 18px rgba(21, 37, 48, 0.08);
  --shadow-lg: 0 16px 34px rgba(21, 37, 48, 0.12);
}


* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body {
  height: 100%;
}
body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--color-bg);
    color: var(--color-text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

.row-duplicate-warning {
  background: #fff1f2 !important;
}

.row-duplicate-warning td {
  background: transparent !important;
  color: #8a1c2c;
}

.row-duplicate-warning .row-selector-cell {
  background: #ffe4e6 !important;
  color: #9f1239;
  font-weight: 700;
}


.bf-landing {
  position: fixed;
  inset: 0;
  min-height: 100vh;
  overflow: hidden;
  padding: 0 28px 40px;
  isolation: isolate;
  z-index: 4000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(20px) scale(0.99);
  filter: blur(8px);
  transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              filter 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              visibility 0s linear 0.5s;
}

body.landing-active {
  background:
    radial-gradient(circle at 10% 10%, rgba(59, 130, 246, 0.16), transparent 22%),
    radial-gradient(circle at 88% 18%, rgba(34, 197, 94, 0.12), transparent 20%),
    linear-gradient(180deg, #06111b 0%, #08131f 52%, #091522 100%);
  color: #edf4ff;
}

body.landing-active .bf-landing {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  filter: blur(0);
  transition-delay: 0s;
}

.page-container {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
  transition: opacity 0.48s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.48s cubic-bezier(0.22, 1, 0.36, 1),
              filter 0.48s cubic-bezier(0.22, 1, 0.36, 1);
}

body.landing-active .page-container {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.99);
  filter: blur(6px);
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.5s;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

.bf-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.45), transparent 88%);
  pointer-events: none;
  z-index: 0;
}

.bf-bg-glow {
  position: absolute;
  border-radius: 999px;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

.bf-bg-glow-1 {
  width: 420px;
  height: 420px;
  top: -100px;
  left: -80px;
  background: rgba(59, 130, 246, 0.16);
}

.bf-bg-glow-2 {
  width: 360px;
  height: 360px;
  right: -80px;
  top: 140px;
  background: rgba(34, 197, 94, 0.12);
}

.bf-header,
.bf-main {
  position: relative;
  z-index: 2;
}

.bf-header {
  padding-top: 2px;
}

.bf-header-inner {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 0;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
}

.bf-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}

.bf-brand-logo {
  width: 84px;
  height: 84px;
  object-fit: contain;
}

.bf-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bf-brand-copy strong {
  color: #fff;
  font-size: 1rem;
  line-height: 1;
}

.bf-brand-copy span {
  color: rgba(237, 244, 255, 0.74);
  font-size: 0.9rem;
}

.bf-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 26px;
  min-width: 0;
}

.bf-nav a {
  color: rgba(237, 244, 255, 0.74);
  text-decoration: none;
  font-size: 0.96rem;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.bf-nav a:hover {
  color: #fff;
}

.bf-header-actions,
.bf-hero-actions,
.bf-cta-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}

.bf-btn:hover {
  transform: translateY(-1px);
}

.bf-btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  box-shadow: 0 16px 34px rgba(59, 130, 246, 0.28);
}

.bf-btn-ghost,
.bf-btn-secondary {
  color: #fff;
  background: rgba(255,255,255,0.08);
}

.bf-btn-lg {
  height: 54px;
  padding: 0 22px;
  font-size: 1rem;
}

.bf-main {
  width: 100%;
  padding-top: 6px;
}

.bf-hero {
  display: grid;
  grid-template-columns: minmax(460px, 1.02fr) minmax(580px, 0.98fr);
  gap: 0;
  align-items: stretch;
  padding: 0 0 18px;
}

.bf-hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 4px 0 8px 0;
}

.bf-pill {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: #dbeafe;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 22px;
}

.bf-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.14);
}

.bf-title {
  margin: 0;
  max-width: 92%;
  font-size: clamp(2.2rem, 3.7vw, 4.2rem);
  line-height: 1.28;
  letter-spacing: -0.05em;
  color: #fff;
}

.bf-title span {
  display: block;
  color: rgba(255,255,255,0.74);
  margin-top: 14px;
  line-height: 1.24;
}

.bf-desc {
  margin: 18px 0 0;
  max-width: 100%;
  font-size: 1.16rem;
  line-height: 1.72;
  color: rgba(237, 244, 255, 0.74);
}

.bf-desc a {
  color: #8fd3ff;
  font-weight: 600;
  text-decoration: none;
}

.bf-desc a:hover {
  color: #c7ebff;
  text-decoration: underline;
}

.bf-hero-actions {
  margin-top: 22px;
}

.bf-quick-points {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 30px;
  width: 100%;
}

.bf-quick-card {
  min-height: 128px;
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.03));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.bf-quick-card strong {
  display: block;
  margin-bottom: 10px;
  color: #fff;
  font-size: 1rem;
}

.bf-quick-card span {
  display: block;
  color: rgba(237, 244, 255, 0.74);
  line-height: 1.7;
  font-size: 0.93rem;
}

.bf-hero-visual {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 680px;
  padding: 0;
  position: relative;
  overflow: visible;
}

.bf-dashboard-shell {
  width: min(880px, 100%);
  max-width: none;
  min-height: 610px;
  padding: 14px 14px 8px;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.14);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.18) 0%, rgba(151, 202, 255, 0.09) 42%, rgba(9, 19, 31, 0.28) 100%);
  box-shadow:
    0 32px 96px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255,255,255,0.08);
  backdrop-filter: blur(18px);
  margin-right: 0;
}

.bf-dashboard-topbar {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 6px 16px;
}

.bf-window-dots {
  display: flex;
  gap: 8px;
}

.bf-window-dots span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.38);
}

.bf-dashboard-chip,
.bf-meta-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
}

.bf-dashboard-chip {
  background: rgba(34, 197, 94, 0.14);
  color: #bbf7d0;
}

.bf-dashboard-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 8px 14px;
}

.bf-kicker {
  margin: 0 0 6px;
  color: #93c5fd;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
}

.bf-dashboard-meta h3 {
  margin: 0;
  font-size: 1.16rem;
  color: #fff;
}

.bf-meta-badge {
  background: rgba(59,130,246,0.14);
  color: #dbeafe;
}

.bf-dashboard-image {
  overflow: hidden;
  border-radius: 0;
  background: linear-gradient(180deg, rgba(10, 24, 39, 0.16), rgba(7, 17, 29, 0.06));
  min-height: 540px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.bf-dashboard-image img {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  object-fit: contain;
  object-position: center top;
  transform: none;
}

.bf-float {
  position: absolute;
  max-width: 240px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(7, 18, 30, 0.82);
  box-shadow:
    0 20px 36px rgba(0,0,0,0.24),
    inset 0 1px 0 rgba(255,255,255,0.05);
  backdrop-filter: blur(14px);
}

.bf-float span {
  display: block;
  margin-bottom: 6px;
  color: #93c5fd;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.bf-float strong {
  color: #fff;
  line-height: 1.45;
  font-size: 0.96rem;
}

.bf-float-a {
  top: 56px;
  right: 8px;
}

.bf-float-b {
  left: -6px;
  bottom: 248px;
}

.bf-float-c {
  right: 24px;
  bottom: 100px;
}

.bf-strip {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding: 8px 0 12px;
}

.bf-strip-card {
  padding: 22px;
  border-radius: 22px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}

.bf-strip-card span {
  display: block;
  color: #93c5fd;
  font-size: 0.84rem;
  margin-bottom: 8px;
}

.bf-strip-card strong {
  color: #fff;
  font-size: 1rem;
  line-height: 1.55;
}

.bf-section {
  width: 100%;
  padding: 46px 0 8px;
}

.bf-section-head {
  max-width: 980px;
  margin-bottom: 24px;
}

.bf-section-label {
  display: inline-block;
  margin-bottom: 10px;
  color: #93c5fd;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  font-weight: 700;
}

.bf-section-head h2 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 3vw, 3.2rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: #fff;
}

.bf-section-head p {
  margin: 0;
  color: rgba(237, 244, 255, 0.74);
  line-height: 1.85;
  font-size: 1.02rem;
}

.bf-feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.bf-feature-card,
.bf-workflow-card {
  padding: 24px;
  border-radius: 22px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}

.bf-feature-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(59,130,246,0.14);
  color: #dbeafe;
  font-size: 1.15rem;
  margin-bottom: 16px;
}

.bf-feature-card h3,
.bf-workflow-card h3 {
  margin: 0 0 10px;
  color: #fff;
  font-size: 1.08rem;
}

.bf-feature-card p,
.bf-workflow-card p {
  margin: 0;
  color: rgba(237, 244, 255, 0.74);
  line-height: 1.75;
}

.bf-workflow-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.bf-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  margin-bottom: 16px;
  border-radius: 16px;
  background: rgba(34,197,94,0.14);
  color: #bbf7d0;
  font-size: 1rem;
  font-weight: 800;
}

.bf-cta-panel {
  margin-top: 42px;
  display: grid;
  grid-template-columns: 1.2fr auto;
  gap: 22px;
  align-items: center;
  padding: 28px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 18px 42px rgba(0,0,0,0.18);
}

.bf-cta-copy h2 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.1;
  color: #fff;
  letter-spacing: -0.03em;
}

.bf-cta-copy p {
  margin: 0;
  max-width: 760px;
  color: rgba(237, 244, 255, 0.74);
  line-height: 1.8;
}

.page-container {
  max-width: 100%;
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.app-header {
  margin-bottom: 0;
  padding: 10px 12px 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-brand {
  min-width: 0;
}

.app-header-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
/* =========================
   HEADER LOGO & TITLE
   ========================= */
.app-title {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  background: none;
  -webkit-text-fill-color: unset;
  background-clip: unset;
}

.app-home-trigger {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: transparent;
  cursor: pointer;
  line-height: 0;
}

.app-logo {
  height: 34px; /* Chiều cao logo */
  width: auto;
  object-fit: contain;
  display: block;
}

.app-title-text {
  display: inline-flex;
  align-items: center;
  margin: 0;
  min-height: 34px;
  font-size: 20px; /* Kích thước chữ tiêu đề */
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--color-primary-dark);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1;
  transform: none;
  white-space: nowrap;
}


.icon-main { width: 24px; height: 24px; margin-right: 10px; color: var(--color-primary); }
.icon-main.green { color: var(--color-accent); }

.main-layout { width: 100%; display: flex; flex-direction: column; flex: 1; min-height: 0; }
.main-content { width: 100%; max-width: 100%; display: flex; flex-direction: column; gap: 4px; flex: 1; min-height: 0; }

.tabs-container { display: flex; flex-direction: column; margin-bottom: 5px; gap: 6px; padding: 0 12px 0; }
.workspace-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 2px 0 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.workspace-switchers {
  display: flex;
  align-items: flex-start;
  min-width: 0;
  flex: 1;
}

.workspace-nav-stack {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.workspace-nav-inline {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  width: 100%;
}

.workspace-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  justify-content: flex-end;
}

.primary-tab-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 4px;
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 5px;
  gap: 0;
}

.primary-tab-indicator {
  position: absolute;
  top: 4px;
  left: 4px;
  height: calc(100% - 8px);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(21, 37, 48, 0.10), 0 1px 4px rgba(21, 37, 48, 0.06);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 0;
}

.primary-tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 15px;
  border: none;
  background: transparent;
  border-radius: 5px;
  cursor: pointer;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: color 0.2s ease;
  white-space: nowrap;
  user-select: none;
  font-family: inherit;
}

.primary-tab-icon {
  display: inline-flex;
  align-items: center;
}

.primary-tab-icon svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
  transition: stroke 0.2s ease;
}

.primary-tab.active {
  color: var(--color-text-primary);
}

.primary-tab.active .primary-tab-icon svg {
  stroke: var(--color-primary);
}

.primary-tab:not(.active):hover {
  color: #334754;
}

/* ========== REDESIGN ACTION BUTTONS - COMPACT VERSION ========== */

/* Nút Sort & Filter - compact style */
.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--shell-border, var(--color-border));
    background: #ffffff;
    color: var(--nav-ink, var(--color-text-secondary));
    font-size: 14px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    box-shadow: none;
}

.action-btn svg,
.action-btn i {
    width: 18px;
    height: 18px;
}

.action-btn:hover {
    background: var(--shell-bg-soft, var(--color-primary-heavy-light));
    border-color: var(--shell-border-strong, var(--color-border-strong, var(--color-border)));
    color: var(--color-primary);
    box-shadow: none;
}

/* Nút Export - compact */
.btn-export {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.btn-export i {
    width: 18px;
    height: 18px;
}

.btn-export:hover {
    background: var(--color-accent-dark);
}

/* Nút history (refresh) - compact */
.btn-meta-simple {
    width: 36px;
    height: 36px;
    border: 1px solid var(--shell-border, var(--color-border));
    background: #ffffff;
    color: var(--nav-ink, var(--color-primary));
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
    box-shadow: none;
}

.btn-meta-simple i {
    width: 18px;
    height: 18px;
}

.btn-meta-simple:hover {
    background: var(--shell-bg-soft, var(--color-primary-heavy-light));
    border-color: var(--shell-border-strong, var(--color-border-strong, var(--color-border)));
    color: var(--color-primary);
}

.workspace-actions .action-btn,
.workspace-actions .btn-meta-simple {
    width: auto;
    min-width: 50px;
    height: 40px;
    padding: 0 12px;
    gap: 8px;
    justify-content: center;
}

.workspace-actions .btn-meta-simple {
    min-width: 108px;
    padding-left: 5px;
    padding-right: 8px;
}

.workspace-actions .btn-meta-simple i {
    width: 5px;
    height: 5px;
}

.workspace-actions .btn-meta-simple svg {
    width: 18px !important;
    height: 18px !important;
}

.action-btn-label {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.1;
    color: inherit;
    white-space: nowrap;
}

.action-btn-label-stacked {
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.02;
    white-space: normal;
}

body:not(.landing-active) .app-header,
body:not(.landing-active) .app-auth-btn,
body:not(.landing-active) .app-auth-shell,
body:not(.landing-active) .primary-tab-switcher,
body:not(.landing-active) .primary-tab-indicator,
body:not(.landing-active) .primary-tab,
body:not(.landing-active) .data-scope-options,
body:not(.landing-active) .data-scope-slider,
body:not(.landing-active) .scope-btn,
body:not(.landing-active) .scope-count,
body:not(.landing-active) .action-btn,
body:not(.landing-active) .btn-meta-simple,
body:not(.landing-active) .btn-export,
body:not(.landing-active) .result-warning,
body:not(.landing-active) .data-card,
body:not(.landing-active) .data-card-header,
body:not(.landing-active) .cell-display-bar,
body:not(.landing-active) .side-panel,
body:not(.landing-active) .history-content,
body:not(.landing-active) .readme-content,
body:not(.landing-active) .panel-footer button,
body:not(.landing-active) .table-tool-btn,
body:not(.landing-active) .table-columns-popover,
body:not(.landing-active) .column-menu-popover,
body:not(.landing-active) .column-menu-input-wrap,
body:not(.landing-active) .contact-item {
    border-radius: 8px !important;
}

/* Base tooltip style - áp dụng chung */
.action-btn::after,
.btn-export::after,
.btn-meta-simple::after {
    content: attr(data-title);
    position: absolute;
    bottom: -34px;
    left: 50%;
    background: rgba(24, 49, 61, 0.96);
    color: white;
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 10000;
    transform: translateX(-50%) !important; /* Luôn giữ nguyên không xoay */
}

/* Hover state - chỉ hiện tooltip */
.action-btn:hover::after,
.btn-export:hover::after,
.btn-meta-simple:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) !important; /* Giữ nguyên không xoay */
}

/* ========== TAB CONTENT - CRITICAL FIX ========== */
.tab-content { display: none; }
.tab-content.active {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    height: calc(100vh - 170px) !important; /* Giảm từ 220px */
    min-height: 600px !important;
    overflow: hidden !important;
}

.result-warning{
  padding: 6px 10px;
  margin-bottom: 4px;
  border: 1px solid #edd7ae;
  border-left: 4px solid var(--color-warning);
  border-radius: 8px;
  background: #fff8eb;
  color: #7a5817;
  font-size: 12px;
  line-height: 1.5;
}

.result-warning-duplicate{
  border: 1px solid #fecdd3;
  border-left: 4px solid #e11d48;
  background: #fff1f2;
  color: #9f1239;
}

.data-scope-switcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding-left: 14px;
  border-left: 1px solid var(--color-border);
  flex-shrink: 0;
}

.data-scope-label {
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-scope-options {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.scope-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 32px;
  width: 124px;
  padding: 0 10px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  color: var(--color-text-secondary);
  font: inherit;
  transition: all 0.18s ease;
}

.scope-btn:hover {
  background: var(--color-surface-2);
  color: var(--color-text-primary);
}

.scope-btn.active {
  background: #e8eef3;
  border-color: #d6e0e7;
  color: var(--color-text-primary);
}

.scope-btn.has-results:not(.active) {
  border-color: transparent;
  box-shadow: none;
}

.scope-btn[data-view="df1-panel"].has-results {
  color: var(--color-primary);
}

.scope-btn[data-view="df2-panel"].has-results {
  color: var(--color-accent);
}

.scope-text {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.scope-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 1px 6px;
  border-radius: 8px;
  background: #dbe3e9;
  color: #5d6f7d;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
}

.scope-btn[data-view="df1-panel"].active .scope-count {
  background: #dbe7f3;
  color: #244f70;
}

.scope-btn[data-view="df2-panel"].active .scope-count {
  background: #dfe9e4;
  color: #36594d;
}

.result-panel{
  display: none !important;
  opacity: 0;
  transform: translateY(6px);
}

.result-panel.active{
  display: flex !important;
  opacity: 1;
  transform: translateY(0);
}

/* =========================
   DATA TAB LAYOUT
   ========================= */
.data-section-vertical{
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  gap: 10px; /* compact, hợp layout hiện tại */
}

.data-section-vertical.result-panel{
  display: none !important;
}

.data-section-vertical.result-panel.active{
  display: flex !important;
}

.data-section-vertical .table-wrapper{
  flex: 1 !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

.data-section-vertical .table-scroll{
  flex: 1 !important;
  height: 100% !important;
  overflow: auto !important;
}

/* =========================
   CARD THEME CORE
   - Không dùng rgba tùy tiện
   - Token hóa theo :root
   ========================= */
.data-card{
  /* default (fallback = DF1) */
  --t-main: var(--color-primary);
  --t-main-dark: var(--color-primary-dark);
  --t-main-light: var(--color-primary-light);

  --t-head-bg: var(--color-primary-heavy-light);
  --t-range-bg: var(--color-primary-medium-light);

  --t-border: var(--color-border-strong, var(--color-border));
  --t-border-accent: var(--color-primary); /* dùng làm “hint” màu */
  --t-scroll-thumb: var(--color-primary);
  --t-scroll-thumb-hover: var(--color-primary-dark);

  border: 1px solid var(--t-border);
  border-radius: 12px;
  background: var(--color-surface);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  margin-bottom: 5px;
}

.data-card-header{
  padding: 8px 12px;
  border-bottom: 1px solid var(--t-border);
  background: var(--color-surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.data-card-heading{
  min-width: 0;
}

/* DF1 theme */
.data-card.df1{
  --t-main: var(--color-primary);
  --t-main-dark: var(--color-primary-dark);
  --t-main-light: var(--color-primary-light);
  --t-head-bg: var(--color-primary-medium-light);
  --t-range-bg: var(--color-primary-medium-light);
  --t-border-accent: var(--color-primary);
  --t-scroll-thumb: var(--color-primary);
  --t-scroll-thumb-hover: var(--color-primary-dark);
}

/* DF2 theme */
.data-card.df2{
  --t-main: var(--color-accent);
  --t-main-dark: var(--color-accent-dark);
  --t-main-light: var(--color-accent-light);
  --t-head-bg: var(--color-accent-medium-light);
  --t-range-bg: var(--color-accent-medium-light);
  --t-border-accent: var(--color-accent);
  --t-scroll-thumb: var(--color-accent);
  --t-scroll-thumb-hover: var(--color-accent-dark);
}

/* (optional) nhấn nhẹ màu theme trên card bằng inset line, không “pha” màu */
.data-card{
  box-shadow: 0 0 0 1px var(--t-border);
}

/* =========================
   TITLE + ICON + BADGE
   ========================= */
.data-card-title-df1,
.data-card-title-df2{
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  color: var(--t-main-dark);
}

/* icon theo theme, không cần .blue/.purple nữa (vẫn giữ tương thích nếu có) */
.data-card-icon{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  margin-right: 8px;
  color: #fff;
  background: var(--t-main);
}

/* badge theo theme */
.data-badge{
  min-width: 36px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--t-main);
  box-shadow: none;
  text-align: center;
}

/* =========================
   SCROLLBAR (theo theme)
   ========================= */
.data-card .table-scroll::-webkit-scrollbar{ width: 8px; height: 8px; }
.data-card .table-scroll::-webkit-scrollbar-track{
  background: color-mix(in srgb, var(--color-border) 45%, transparent);
  border-radius: 10px;
}
.data-card .table-scroll::-webkit-scrollbar-thumb{
  background: var(--t-scroll-thumb);
  border-radius: 10px;
}
.data-card .table-scroll::-webkit-scrollbar-thumb:hover{
  background: var(--t-scroll-thumb-hover);
}

/* =========================
   TABLE CORE
   ========================= */
.data-table{
  border-collapse: separate;
  border-spacing: 0;
  width: auto;
  min-width: 100%;
  font-size: 12px;
  table-layout: fixed;
}

.data-table thead{
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--tbl-head-bg, var(--color-surface-2, var(--color-surface)));
}
.data-table thead th{ z-index: 20; }

.data-table th,
.data-table td{
  border-bottom: 1px solid var(--color-border);
  padding: 6px 9px;
  text-align: left;
  white-space: nowrap;
  max-width: none;
  min-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table th{
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  user-select: none;
  position: relative;
  overflow: visible;
  padding-left: 0;
  padding-right: 0;
  padding-top: 5px;
  padding-bottom: 5px;
  color: var(--tbl-head-text, var(--color-text-secondary));
}

.data-table tbody tr{ transition: background 0.15s; }
#standard-table tbody tr:hover,
#extended-table tbody tr:hover{
  background: var(--tbl-row-hover-bg) !important;
}

.data-table tbody tr:nth-child(even){ background-color: var(--color-surface-2, #fbfcff); }

/* hover row: dùng surface token (neutral), tránh gradient pha màu */
.data-table tbody tr:hover{
  background: color-mix(in srgb, var(--color-surface) 60%, var(--color-border) 40%);
}

/* =========================
   TABLE THEME: theo ID (đúng logic hiện tại)
   - chỉ dùng token từ :root
   ========================= */
#standard-table{
  --tbl-head-bg: var(--color-primary-heavy-light);
  --tbl-head-text: var(--color-primary);
  --tbl-head-hover-bg: var(--color-primary-medium-light);
  --tbl-drag-border: var(--color-primary);
  --tbl-row-hover-bg: var(--color-primary-heavy-light);
}

#extended-table{
  --tbl-head-bg: var(--color-accent-heavy-light);
  --tbl-head-text: var(--color-accent);
  --tbl-head-hover-bg: var(--color-accent-medium-light);
  --tbl-drag-border: var(--color-accent);
  --tbl-row-hover-bg: var(--color-accent-heavy-light);
}

.data-table th:hover{ background-color: var(--tbl-head-hover-bg); }
.data-table th.drag-over{
  background-color: var(--tbl-head-hover-bg);
}
.data-table th.drag-over-before{
  box-shadow: inset 3px 0 0 var(--tbl-drag-border);
}
.data-table th.drag-over-after{
  box-shadow: inset -3px 0 0 var(--tbl-drag-border);
}

/* resizer */
.data-table th .col-resizer{
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  cursor: url("/assets/resize_v1.png") 20 20, e-resize;
  user-select: none;
  touch-action: none;
  z-index: 9999;
}

/* hover resizer: không pha rgba, dùng token hover bg */
#standard-table th .col-resizer:hover{ background: var(--color-primary-medium-light); }
#extended-table th .col-resizer:hover{ background: var(--color-accent-medium-light); }

/* drag indicator */
.drag-indicator{
  display: none;
}

/* =========================
   CELL SELECT / RANGE
   - dùng token đã có, không rgba
   ========================= */
.data-table td{ user-select: text; }
.data-table td.cell-selected{ user-select: none; }

#standard-table td.cell-selected{
  background: var(--color-primary-medium-light);
  box-shadow: inset 0 0 0 9999px color-mix(in srgb, var(--color-primary-medium-light) 70%, transparent);
}

#extended-table td.cell-selected{
  background: var(--color-accent-medium-light);
  box-shadow: inset 0 0 0 9999px color-mix(in srgb, var(--color-accent-medium-light) 70%, transparent);
}

#standard-table td.cell-range{ background: var(--color-primary-medium-light); }
#extended-table td.cell-range{ background: var(--color-accent-medium-light); }

#standard-table td,
#extended-table td{
  cursor: cell;
  transition: box-shadow 0.15s ease, background 0.15s ease;
}


/* ========== CHARTS ========== */
.charts-section {
    background: var(--color-surface);
    border-radius: 12px;
    box-shadow: 0 0 0 1px var(--color-border);
    padding: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.charts-header { margin-bottom: 8px; }
.charts-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    color: var(--color-primary-dark);
}
.charts-subtitle { margin: 6px 0 0; font-size: 12px; color: var(--color-text-secondary); }

.charts-grid-4 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    flex: 1;
    min-height: 600px;
    height: calc(100vh - 280px);
    overflow-y: auto;
}

.chart-block {
    background: var(--color-surface);
    border-radius: 12px;
    padding: 12px;
    box-shadow: none;
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    min-height: 240px;
    max-height: 360px;
    position: relative;
    overflow: hidden;
}
.chart-block:hover { border-color: var(--color-primary-light); }
.chart-block h3 { margin: 0 0 16px; font-size: 13px; font-weight: 600; color: var(--color-text-primary); position: relative; z-index: 1; }
.chart-block canvas { flex: 1; height: 100% !important; width: 100% !important; }
.chart-block .no-data-msg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
    font-size: 13px;
    width: 80%;
}
.chart-block .no-data-msg.visible { display: block !important; }

/* ========================================
   FILTER & SORT PANELS - CENTER MODAL STYLE
   ======================================== */
.side-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 1000px; /* ✅ Rộng hơn để chứa grid ngang */
    max-height: 85vh;
    background: white;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(17, 44, 56, 0.18);
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.side-panel.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 2px solid #e2e8f0;
    background: linear-gradient(to right, #f8fafc, white);
}
.panel-header h3 { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 600; color: #1e293b; margin: 0; }
.panel-header svg { width: 20px; height: 20px; }
.btn-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #94a3b8;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.2s;
    line-height: 1;
}
.btn-close:hover { background: #fee2e2; color: #dc2626; }
.panel-body { flex: 1; overflow-y: auto; padding: 24px; }
.panel-footer { display: flex; gap: 12px; padding: 20px 24px; border-top: 2px solid #e2e8f0; background: #f8fafc; }
.panel-footer button { flex: 1; padding: 12px; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; border: none; transition: all 0.2s; }
.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover { background: var(--color-primary-dark); box-shadow: 0 4px 12px rgba(15, 92, 122, 0.20); }
.btn-secondary { background: #e2e8f0; color: #475569; }
.btn-secondary:hover { background: #cbd5e1; }

.panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    backdrop-filter: blur(2px);
}
.panel-overlay.show { opacity: 1; visibility: visible; }

/* ========== SORT PANEL ========== */
.sort-hint { background: #eff6ff; border-left: 4px solid #3b82f6; padding: 14px 16px; margin-bottom: 20px; border-radius: 10px; font-size: 14px; color: #1e40af; }
.sort-rules-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; min-height: 100px; }
.sort-rules-empty { text-align: center; padding: 40px 20px; color: #94a3b8; }
.sort-rule-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    transition: all 0.2s;
}
.sort-rule-item:hover { background: #f3f4f6; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06); }
.drag-handle { cursor: grab; font-size: 20px; color: #9ca3af; user-select: none; }
.drag-handle:active { cursor: grabbing; }
.sort-rule-number {
    width: 32px;
    height: 32px;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}
.sort-rule-column { flex: 1; min-width: 0; }
.sort-rule-column select, .sort-rule-order select {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}
.sort-rule-column select:focus, .sort-rule-order select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(15, 92, 122, 0.12);
}
.sort-rule-order { min-width: 130px; }
.btn-remove-rule {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.btn-remove-rule:hover { background: #fecaca; transform: scale(1.1); }
.btn-add-sort {
    width: 100%;
    padding: 12px;
    background: #f0fdf4;
    color: #16a34a;
    border: 2px dashed #86efac;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-add-sort:hover { background: #dcfce7; border-color: #4ade80; }

/* ========== MODALS ========== */
.history-modal, .readme-modal { display: none; position: fixed; inset: 0; z-index: 10000; font-family: 'Inter', sans-serif; }
.history-modal.show, .readme-modal.show { display: block; }
.history-overlay, .readme-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); }
.history-content, .readme-content {
    position: relative;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    margin: 10vh auto;
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.readme-content { max-width: 900px; }
.history-header, .readme-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--color-border);
    background: linear-gradient(135deg, rgba(15, 92, 122, 0.05) 0%, rgba(47, 111, 95, 0.03) 100%);
}
.history-header h3, .readme-header h1 { margin: 0; font-size: 18px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.readme-header { text-align: center; padding: 48px 40px 32px; }
.readme-header h1 {
    font-size: 26px;
    color: var(--color-primary-dark);
}
.readme-subtitle { margin: 12px 0 0; font-size: 15px; color: var(--color-text-secondary); }
.history-body, .readme-body { flex: 1; overflow-y: auto; padding: 24px 28px; }
.readme-body { padding: 32px 40px; }
.history-list { flex: 1; overflow-y: auto; padding: 20px 28px; }
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-radius: 10px;
    background: rgba(15, 92, 122, 0.03);
    border: 1px solid rgba(15, 92, 122, 0.10);
    margin-bottom: 12px;
    transition: all 0.2s;
}
.history-item:hover { background: rgba(15, 92, 122, 0.06); border-color: rgba(15, 92, 122, 0.18); }
.history-datetime { font-weight: 600; color: var(--color-text-primary); font-size: 14px; }
.history-boxes {
    background: var(--color-primary);
    color: white;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    min-width: 60px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(15, 92, 122, 0.22);
}
.history-empty { text-align: center; padding: 60px 20px; color: var(--color-text-muted); }

.readme-section { margin-bottom: 32px; }
.readme-section h2 { margin: 0 0 16px; font-size: 18px; font-weight: 600; }
.readme-section p { margin: 0 0 12px; font-size: 14px; line-height: 1.7; color: #495057; }
.readme-section a { color: var(--color-primary); font-weight: 500; text-decoration: none; }
.readme-section a:hover { text-decoration: underline; }
.readme-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 16px; }
.readme-info-card {
    padding: 20px;
    background: linear-gradient(135deg, rgba(15, 92, 122, 0.03) 0%, rgba(47, 111, 95, 0.02) 100%);
    border-radius: 10px;
    border: 1px solid rgba(15, 92, 122, 0.10);
    transition: all 0.2s;
}
.readme-info-card:hover { box-shadow: 0 4px 12px rgba(15, 92, 122, 0.10); border-color: rgba(15, 92, 122, 0.18); }
.info-icon { font-size: 28px; margin-bottom: 12px; }
.readme-info-card h3 { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.readme-info-card p { margin: 0; font-size: 13px; line-height: 1.6; }
.readme-footer {
    padding: 20px 40px;
    background: #f8f9fb;
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.readme-checkbox { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; font-weight: 500; }
.readme-checkbox input[type="checkbox"] { width: 20px; height: 20px; cursor: pointer; accent-color: var(--color-primary); }
.btn-readme-primary {
    padding: 12px 28px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(15, 92, 122, 0.22);
}
.btn-readme-primary:hover { background: var(--color-primary-dark); box-shadow: 0 6px 20px rgba(15, 92, 122, 0.26); }

.readme-icon, .contact-icon { position: static; z-index: auto; }
.readme-icon button, .contact-icon button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 36px;
    padding: 0 12px;
    background: var(--color-surface-2);
    color: var(--color-primary);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.readme-icon button:hover, .contact-icon button:hover {
    color: var(--color-primary-dark);
    background: var(--color-primary-heavy-light);
    border-color: var(--color-primary-medium-light);
}

.team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-top: 16px; }
.team-card {
    padding: 24px;
    background: linear-gradient(135deg, rgba(15, 92, 122, 0.03) 0%, rgba(47, 111, 95, 0.02) 100%);
    border-radius: 10px;
    border: 1px solid rgba(15, 92, 122, 0.10);
    text-align: center;
    transition: all 0.2s;
}
.team-card:hover { box-shadow: 0 8px 20px rgba(15, 92, 122, 0.14); }
.team-avatar { font-size: 48px; margin-bottom: 12px; }
.team-card h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.team-role { margin: 0 0 12px; font-size: 13px; color: var(--color-primary); font-weight: 600; }
.contact-info { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.contact-item { display: flex; align-items: flex-start; gap: 12px; padding: 16px; background: #f8f9fb; border-radius: 10px; }
.contact-icon { font-size: 24px; }

.app-footer {
    margin-top: 12px;
    padding: 10px 2px 0;
    border-top: 1px solid var(--color-border);
    font-size: 11px;
    color: var(--color-text-secondary);
    text-align: left;
    line-height: 1.4;
    flex-shrink: 0;
}

/* ========================================
   FILTER & SORT PANELS - CENTER MODAL
   ======================================== */
.side-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 1000px;
    max-height: 85vh;
    background: white;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(17, 44, 56, 0.18);
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.side-panel.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* ===============================
   FILTER PANEL: WIDER + TALLER
   =============================== */
#filter-panel.side-panel{
  left: 50%;
  top: 50%;
  right: auto;
  transform: translate(-50%, -50%);

  width: min(96vw, 1020px);
  max-height: min(90vh, 750px);   /* dùng max-height thay vì height */
  height: auto;                  /* cho phép co theo nội dung */
  border-radius: 10px;
}

/* Cho body tự scroll khi thiếu chỗ */
#filter-panel .panel-body{
  overflow: auto;     /* quan trọng: không dùng hidden */
  padding: 18px;
  min-height: 0;      /* quan trọng trong flex layout để scroll hoạt động đúng */
}


/* nếu vẫn thiếu (màn hình thấp), mới cho scroll dọc */
@media (max-height: 780px){
  #filter-panel .panel-body{
    overflow-y: auto;
  }
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 2px solid #e2e8f0;
    background: linear-gradient(to right, #f7fbfc, white);
}

.panel-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.panel-footer {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-top: 2px solid #e2e8f0;
    background: #f8fafc;
}

/* FILTER PANEL - GRID 3 COLUMNS */
#filter-panel custom-search-form {
    display: block; /* Trả về block chuẩn */
    width: 100%;
    height: 100%;
}


#filter-panel .filter-field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
}


#filter-panel .filter-field input:focus,
#filter-panel .filter-field select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(15, 92, 122, 0.12);
}

/* Date range - 2 columns */
#filter-panel .date-range-group {
    grid-column: span 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Buttons full width */
#filter-panel .filter-buttons {
    grid-column: 1 / -1;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

#filter-panel .filter-buttons button {
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

/* SORT PANEL - Keep vertical layout */
.sort-hint {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    padding: 14px 16px;
    margin-bottom: 20px;
    border-radius: 10px;
    font-size: 14px;
    color: #1e40af;
}

.sort-rules-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    min-height: 100px;
}

.sort-rule-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    transition: all 0.2s;
}

.btn-add-sort {
    width: 100%;
    padding: 12px;
    background: #f0fdf4;
    color: #16a34a;
    border: 2px dashed #86efac;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    #filter-panel custom-search-form {
        grid-template-columns: repeat(2, 1fr);
    }
    #filter-panel .date-range-group {
        grid-column: span 1;
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .side-panel {
        width: 95%;
        max-width: 95%;
    }
    #filter-panel custom-search-form {
        grid-template-columns: 1fr;
    }
    .data-scope-switcher {
        width: 100%;
        padding-left: 0;
        border-left: 0;
        justify-content: space-between;
    }
    .data-scope-options {
        flex: 1;
    }
    .scope-btn {
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 1200px) {
    .workspace-toolbar { flex-wrap: wrap; }
    .workspace-actions { width: 100%; justify-content: flex-end; }
    .charts-grid-4 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .page-container { padding: 10px; }
    .app-header { flex-direction: column; align-items: flex-start; padding: 10px 10px 6px; }
    .app-header-links { width: 100%; justify-content: flex-end; }
    .workspace-toolbar { flex-direction: column; align-items: stretch; }
    .workspace-switchers { flex-direction: column; align-items: stretch; }
    .workspace-nav-stack { align-items: stretch; }
    .workspace-nav-inline { flex-direction: column; align-items: stretch; }
    .workspace-actions { width: 100%; justify-content: flex-end; }
    .primary-tab-switcher { width: 100%; }
    .primary-tab { flex: 1; justify-content: center; }
    .data-scope-switcher { width: 100%; }
    .tab-content.active { height: calc(100vh - 176px) !important; min-height: 320px; }
    .readme-content { width: 95%; margin: 2.5vh auto; }
    .readme-body { padding: 24px; }
}

/* Filter panel: title + help icon */
#filter-panel .panel-title-group{
  display: inline-flex;
  align-items: center;
  gap: 10px; /* khoảng cách giữa tiêu đề và nút i */
}

/* Nút i giống style cũ */
#filter-panel #filter-help-btn.help-icon{
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: rgba(15, 92, 122, 0.12);
  color: var(--color-primary);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  cursor: help;
  transition: all 0.2s ease;
  top: -0px; /* chỉnh nhẹ cho khớp baseline với chữ */
  border: none;           /* vì bạn dùng <button> */
  padding: 0;             /* reset button default */
  line-height: 1;
}

#filter-panel #filter-help-btn.help-icon:hover{
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 92, 122, 0.24);
}

#filter-panel .panel-title-group{
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* Disabled state consistent for filter footer buttons */
#filter-panel .panel-footer button:disabled{
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

/* ===== Make FILTER footer buttons match SORT footer buttons ===== */
#filter-panel .panel-footer{
  justify-content: flex-end;
}

#filter-panel .panel-footer button{
  flex: 0 0 auto;
  min-width: 120px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
}

/* Same theme as sort */
#filter-panel .panel-footer .btn-primary{
  background: var(--color-primary);
  box-shadow: 0 6px 16px rgba(15, 92, 122, 0.18);
}
#filter-panel .panel-footer .btn-primary:hover{
  background: var(--color-primary-dark);
}

#filter-panel .panel-footer .btn-secondary{
  background: rgba(15, 92, 122, 0.08);
  color: var(--color-primary);
}
#filter-panel .panel-footer .btn-secondary:hover{
  background: rgba(15, 92, 122, 0.14);
}

html, body {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}




/* =========================
   TABLE WRAPPER + FORMULA BAR
   ========================= */

/* wrapper là khối chứa bar + table */
.table-wrapper{
  background: var(--color-surface);
  border-radius: 0px;
  overflow: hidden;

}

/* bar: luôn có chiều cao dù rỗng */
.cell-display-bar{
  min-height: 36px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-surface-2, var(--color-surface));
  border-bottom: 1px solid var(--color-border);
}

.table-wrapper .cell-display-bar{
  /* background: var(--bar-bg, var(--color-surface-2, var(--color-surface))); */
  /* border-bottom: 1px solid var(--color-border); */
  position: relative;
  border-bottom: 0;
  box-shadow:
    inset 0 -1px 0 var(--color-border-strong),
    inset 0 -1px 0 color-mix(in srgb, var(--bar-accent, var(--color-border-strong)) 25%, transparent);
}

/* accent strip bên trái */
.table-wrapper .cell-display-bar::before{
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--bar-accent, var(--color-border-strong, var(--color-border)));
}

/* DF1 bar tone */
.data-card.df1 .cell-display-bar{
  --bar-bg: var(--color-primary-heavy-light);
  --bar-accent: var(--color-primary);
}

/* DF2 bar tone */
.data-card.df2 .cell-display-bar{
  --bar-bg: var(--color-accent-heavy-light);
  --bar-accent: var(--color-accent);
}

/* bỏ đường ngăn nếu muốn liền tuyệt đối */
.table-wrapper.no-divider .cell-display-bar{ border-bottom: 0; }

/* label/value */
.cell-display-label{
  font-size: 12px;
  font-weight: 800;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.cell-display-value{
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-empty-state{
  text-align: left;
  padding: 28px 32px !important;
  font-size: 13px;
  color: var(--color-text-muted);
}

/* table scroll chỉ làm nhiệm vụ scroll */
.table-wrapper .table-scroll{
  overflow: auto;
}

/* (tuỳ chọn) trạng thái rỗng: ẩn chữ nhưng không xẹp */
.cell-display-bar.is-empty .cell-display-label,
.cell-display-bar.is-empty .cell-display-value{
  visibility: hidden;
}

/* ============================================================
   REDESIGN 2026
   Bright, connected, compact, professional
   ============================================================ */

:root {
  --color-primary: #127495;
  --color-primary-dark: #0f5b77;
  --color-primary-light: #5caac3;
  --color-accent: #1b866e;
  --color-accent-dark: #146653;
  --color-accent-light: #6bb9a2;
  --color-bg: #f2f7f9;
  --color-surface: #ffffff;
  --color-surface-2: #f7fbfc;
  --color-border: #d5e2e7;
  --color-border-strong: #b9cdd7;
  --color-text-primary: #183240;
  --color-text-secondary: #586f7b;
  --color-text-muted: #7e919b;
  --color-primary-heavy-light: #e5eff4;
  --color-primary-medium-light: #cadbe5;
  --color-accent-heavy-light: #e6f2ef;
  --color-accent-medium-light: #cee4dc;
  --shell-bg: #ffffff;
  --shell-bg-soft: #f4fafb;
  --shell-bg-tint: #e1edf2;
  --shell-border: #d3e0e6;
  --shell-border-strong: #b5c8d2;
  --shell-shadow: 0 18px 40px rgba(16, 34, 48, 0.08);
  --shell-shadow-soft: 0 8px 18px rgba(16, 34, 48, 0.06);
  --nav-ink: #1f3448;
  --nav-strong: #2b475f;
  --nav-tint: #e9eff4;
  --primary-ink: #0f6683;
  --primary-tint: #deeff5;
  --primary-strong: #1386aa;
  --accent-ink: #166b59;
  --accent-tint: #e1f2ed;
  --accent-strong: #1d9178;
}

body {
  background:
    radial-gradient(circle at top left, rgba(18, 116, 149, 0.14), transparent 22%),
    linear-gradient(180deg, #f8fbfc 0%, #edf4f6 100%);
}

.page-container {
  max-width: 1680px;
  height: 100vh;
  margin: 0 auto;
  padding: 10px 10px;
  gap: 6px;
}

.app-header {
  min-height: 60px;
  padding: 10px 14px 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.app-title {
  gap: 12px;
}

.app-logo {
  height: 36px;
  width: auto;
  display: block;
  object-fit: contain;
}

.app-title-text {
  display: inline-flex;
  align-items: center;
  margin: 0;
  min-height: 36px;
  color: var(--nav-ink);
  font-size: 21px;
  letter-spacing: -0.03em;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 700;
  line-height: 1;
  transform: none;
  white-space: nowrap;
}

.readme-icon button,
.contact-icon button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--shell-border);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: none;
  color: var(--nav-ink);
}

.main-content {
  gap: 2px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}

.tabs-container {
  position: relative;
  gap: 0;
  margin-bottom: 0;
  border-bottom: 0;
  background: transparent;
  padding: 0 10px 0;
}

.workspace-toolbar {
  align-items: center;
  gap: 14px;
  padding: 0 0 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.workspace-switchers {
  flex: 1;
}

.workspace-nav-stack {
  width: 100%;
  gap: 0;
}

.workspace-nav-inline {
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.workspace-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 0;
  border-left: 0;
}

.primary-tab-switcher {
  min-height: 46px;
  padding: 3px;
  background: #ffffff;
  border: 1px solid #d6e1e8;
  border-radius: 10px;
}

.primary-tab-indicator {
  top: 3px;
  left: 3px;
  height: calc(100% - 6px);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--nav-strong) 0%, var(--nav-ink) 100%);
  box-shadow: 0 6px 18px rgba(31, 52, 72, 0.18);
}

.primary-tab {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  color: #5f7484;
  font-size: 13.5px;
  font-weight: 700;
}

.primary-tab.active {
  color: #ffffff;
}

.primary-tab.active .primary-tab-icon svg {
  stroke: #ffffff;
}

.primary-tab:not(.active):hover {
  color: var(--nav-ink);
}

.data-scope-switcher {
  min-height: 44px;
  gap: 0;
  padding-left: 0;
  border-left: 0;
}

.data-scope-options {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid #d8e4e8;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  overflow: hidden;
}

.data-scope-slider {
  position: absolute;
  top: 3px;
  left: 3px;
  height: calc(100% - 6px);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--primary-strong) 0%, var(--primary-ink) 100%);
  box-shadow: 0 6px 14px rgba(15, 102, 131, 0.18);
  transition:
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.18s ease,
    box-shadow 0.18s ease;
  z-index: 0;
  pointer-events: none;
}

.data-scope-options[data-active-view="df2-panel"] .data-scope-slider {
  background: linear-gradient(180deg, var(--accent-strong) 0%, var(--accent-ink) 100%);
  box-shadow: 0 6px 14px rgba(22, 107, 89, 0.16);
}

.scope-btn {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  width: 124px;
  justify-content: center;
  box-sizing: border-box;
  padding: 0 34px 0 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  gap: 0;
  color: #506675;
  font-size: 12.5px;
  font-weight: 700;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.scope-btn:not(.active):hover {
  background: #f1f7f9;
  color: var(--nav-ink);
}

.scope-btn.active {
  color: #ffffff;
  box-shadow: none;
}

.scope-text {
  font-size: 12.5px;
  font-weight: 700;
  display: block;
  width: 100%;
  text-align: center;
}

.scope-count {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 28px;
  padding: 2px 6px;
  background: #e2eaee;
  color: #627887;
  font-size: 10px;
  font-weight: 800;
  border-radius: 8px;
  margin-left: 0;
  transition: background 0.2s ease, color 0.2s ease;
}

.scope-btn[data-view="df1-panel"].active {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.scope-btn[data-view="df1-panel"].active .scope-count {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.scope-btn[data-view="df2-panel"].active {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.scope-btn[data-view="df2-panel"].active .scope-count {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.action-btn,
.btn-meta-simple,
.btn-export {
  width: 40px;
  height: 40px;
  border: 1px solid var(--shell-border);
  border-radius: 5px;
  background: #ffffff;
  box-shadow: none;
}

.btn-meta-simple {
  color: var(--nav-ink);
}

.btn-meta-simple:hover,
.action-btn:hover {
  background: var(--shell-bg-soft);
  border-color: var(--shell-border-strong);
}

.btn-export {
  background: linear-gradient(180deg, #2f7c64 0%, #25624f 100%);
  border-color: #245848;
}

.btn-export:hover {
  background: linear-gradient(180deg, #276b56 0%, #1f5443 100%);
}

.result-warning {
  position: absolute;
  top: 100%;
  right: 14px;
  transform: translateY(-8px);
  z-index: 30;
  max-width: 290px;
  margin: 0;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid #efd9ab;
  background: linear-gradient(180deg, #fff9ec 0%, #fff4dd 100%);
  font-size: 12px;
  box-shadow: 0 10px 24px rgba(135, 97, 20, 0.10);
}

.result-warning.result-warning-duplicate {
  border: 1px solid #fecdd3;
  border-left: 4px solid #e11d48;
  background: linear-gradient(180deg, #fff1f2 0%, #ffe4e6 100%);
  color: #9f1239;
  box-shadow: 0 10px 24px rgba(159, 18, 57, 0.14);
}

.tab-content.active {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  gap: 0 !important;
  padding: 4px 10px 6px !important;
  overflow: hidden !important;
}

.data-section-vertical {
  gap: 0 !important;
}

.data-card {
  margin-bottom: 0;
  border: 1px solid var(--shell-border);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: var(--shell-shadow-soft);
}

.data-card.df1,
.data-card.df2 {
  --t-border: var(--shell-border);
}

.data-card-header {
  min-height: 58px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #fbfdff 0%, #f5f9fc 100%);
  border-bottom: 1px solid var(--shell-border);
}

.data-card-title-df1,
.data-card-title-df2 {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #203847;
}

.data-card.df1 .data-card-icon {
  background: linear-gradient(180deg, #4d8eb2 0%, #246789 100%);
}

.data-card.df2 .data-card-icon {
  background: linear-gradient(180deg, #4f9c8e 0%, #23675f 100%);
}

.table-wrapper {
  background: #ffffff;
}

.cell-display-bar {
  min-height: 40px;
  padding: 9px 14px;
  background: #f8fbfd;
  border-bottom: 1px solid var(--shell-border);
}

.table-wrapper .cell-display-bar {
  box-shadow: inset 0 -1px 0 var(--shell-border);
}

.table-wrapper .cell-display-bar::before {
  width: 3px;
}

.cell-display-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cell-display-value {
  font-size: 13px;
}

.data-table {
  font-size: 12px;
}

.data-table thead {
  background: #eff5fa;
}

#standard-table {
  --tbl-head-bg: #eef5f9;
  --tbl-head-text: #245e7d;
  --tbl-head-hover-bg: #dce9f0;
  --tbl-row-hover-bg: #f3f8fa;
}

#extended-table {
  --tbl-head-bg: #eef7f4;
  --tbl-head-text: #245f55;
  --tbl-head-hover-bg: #dcece6;
  --tbl-row-hover-bg: #f3f9f6;
}

.data-table th,
.data-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #edf3f7;
}

.data-table th {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.data-table tbody tr:nth-child(even) {
  background-color: #fbfdff;
}

.data-table tbody tr:hover {
  background: #f5f9fc;
}

.table-empty-state {
  padding: 42px 36px !important;
  color: #7b8d99;
}

.charts-section {
  background: transparent;
  box-shadow: none;
  padding: 0;
  display: flex;
  min-height: 0;
}

.charts-card {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfe 100%);
}

.charts-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #203847;
}

.charts-card-header {
  position: relative;
  overflow: hidden;
}

.charts-card-header::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(31, 52, 72, 0.12) 0%, rgba(31, 52, 72, 0.02) 100%);
}

.charts-card .data-card-icon.charts {
  background: linear-gradient(180deg, var(--nav-strong) 0%, var(--nav-ink) 100%);
}

.charts-card-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px;
  background: linear-gradient(180deg, #fbfdfe 0%, #f7fafc 100%);
}

.charts-grid-4 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  height: 100%;
}

.chart-block {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--shell-border);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfe 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.chart-block::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(31, 52, 72, 0.22) 0%, rgba(31, 52, 72, 0.04) 100%);
}

.chart-block:hover {
  border-color: var(--shell-border-strong);
  box-shadow: 0 12px 24px rgba(16, 34, 48, 0.06);
  transform: translateY(-1px);
}

.chart-block h3 {
  margin: 0;
  padding: 12px 12px 11px;
  border-bottom: 1px solid var(--shell-border);
  background: linear-gradient(180deg, #f9fbfc 0%, #f2f7f9 100%);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #294457;
  line-height: 1.35;
}

.history-header .btn-close svg {
  width: 18px;
  height: 18px;
}

.btn-close svg,
.readme-close svg {
  width: 18px;
  height: 18px;
}

.readme-close {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 10;
}

.readme-close:hover {
  transform: none;
}

.chart-block-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(244, 249, 251, 0.58) 0%, rgba(255, 255, 255, 0) 28%),
    #ffffff;
}

.chart-block canvas {
  flex: 1;
  height: 100% !important;
  width: 100% !important;
}

.chart-block .no-data-msg {
  align-self: center;
  margin: auto 0;
  text-align: center;
  color: #748894;
  font-size: 12px;
}

.app-footer {
  margin-top: 4px;
  padding: 0 10px 2px;
  border-top: 0;
  font-size: 11px;
  color: #738592;
}

.side-panel,
.history-content,
.readme-content {
  border: 1px solid var(--shell-border);
  border-radius: 10px;
  box-shadow: 0 28px 60px rgba(16, 34, 48, 0.14);
}

#history-modal .history-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #fcfeff 0%, #f6fbfd 100%);
}

#history-modal .history-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 16px 22px 14px;
  background: linear-gradient(180deg, rgba(225, 242, 247, 0.72) 0%, rgba(246, 251, 253, 0.92) 100%);
  border-bottom: 1px solid rgba(191, 214, 223, 0.72);
}

#history-modal .summary-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 0 18px;
  background: transparent;
  border: 0;
  border-radius: 0;
}

#history-modal .summary-item:first-child {
  padding-left: 0;
}

#history-modal .summary-item:last-child {
  padding-right: 0;
}

#history-modal .summary-item + .summary-item {
  border-left: 1px solid rgba(191, 214, 223, 0.72);
}

#history-modal .summary-item label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6f8594;
}

#history-modal .summary-value {
  font-size: 15px;
  font-weight: 700;
  color: #18384b;
  line-height: 1.35;
}

#history-modal .history-list {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px 22px 22px;
  overflow-y: auto;
}

#history-modal .history-list::-webkit-scrollbar {
  width: 8px;
}

#history-modal .history-list::-webkit-scrollbar-track {
  background: #edf3f7;
  border-radius: 999px;
}

#history-modal .history-list::-webkit-scrollbar-thumb {
  background: #bfd0db;
  border-radius: 999px;
}

#history-modal .history-list::-webkit-scrollbar-thumb:hover {
  background: #9fb5c3;
}

#history-modal .history-header h3 svg {
    width: 18px;
    height: 18px;
}

.history-header,
.readme-header,
.panel-header {
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%);
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-header h3 {
  flex: 1 1 auto;
  min-width: 0;
}

.panel-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--shell-border);
}

.panel-header h3 {
  color: #173a4c;
  font-size: 16px;
}

.panel-header svg {
  color: var(--primary-ink);
}

.panel-body {
  padding: 18px;
  background: linear-gradient(180deg, #fcfeff 0%, #f6fbfd 100%);
}

.panel-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--shell-border);
  background: #f4fafc;
}

.panel-footer button {
  min-height: 40px;
  border-radius: 8px;
}

.btn-primary {
  background: linear-gradient(180deg, var(--primary-strong) 0%, var(--primary-ink) 100%);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #0e89ae 0%, #08566c 100%);
  box-shadow: 0 8px 18px rgba(10, 97, 123, 0.16);
}

.btn-secondary {
  border: 1px solid var(--shell-border);
  background: #ffffff;
  color: #496575;
}

.btn-secondary:hover {
  background: #eef6fa;
  border-color: var(--shell-border-strong);
}

.btn-close {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--shell-border);
  background: #ffffff;
  color: #647b8a;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-close:hover {
  background: #fef2f2;
  border-color: #f3b4b4;
  color: #c43d3d;
}

#filter-panel #filter-help-btn.help-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid #bfd8e5;
  background: var(--primary-tint);
  color: var(--primary-ink);
}

#filter-panel #filter-help-btn.help-icon:hover {
  background: linear-gradient(180deg, var(--primary-strong) 0%, var(--primary-ink) 100%);
  border-color: #0a637f;
  color: #ffffff;
}

.contact-item,
.readme-info-card {
  border: 1px solid var(--shell-border);
  border-radius: 10px;
  background: #f9fcfe;
}

.readme-footer {
  border-top: 1px solid var(--shell-border);
}

@media (max-width: 1280px) {
  .bf-hero {
    grid-template-columns: 1fr;
  }

  .bf-header-inner {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .bf-nav {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .bf-header-actions {
    justify-content: flex-start;
  }

  .bf-desc {
    max-width: 100%;
  }

  .bf-hero-visual {
    min-height: auto;
    justify-content: center;
    padding-top: 6px;
    display: grid;
    gap: 14px;
  }

  .bf-dashboard-shell {
    width: 100%;
    max-width: 100%;
    min-height: auto;
    margin-right: 0;
  }

  .bf-float {
    position: static;
    max-width: none;
  }

  .bf-strip,
  .bf-feature-grid,
  .bf-workflow-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bf-cta-panel {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .workspace-toolbar {
    flex-wrap: wrap;
  }

  .workspace-actions {
    padding-left: 0;
    border-left: 0;
    width: 100%;
    justify-content: flex-end;
  }

  .workspace-nav-inline {
    flex-wrap: wrap;
    row-gap: 8px;
  }
}

@media (max-width: 900px) {
  .bf-landing {
    padding: 0 16px 28px;
  }

  .bf-header {
    padding-top: 8px;
  }

  .bf-nav {
    display: none;
  }

  .bf-header-actions,
  .bf-hero-actions,
  .bf-cta-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .bf-btn,
  .bf-btn-lg {
    width: 100%;
  }

  .bf-title {
    max-width: 100%;
    font-size: clamp(2.4rem, 10vw, 4rem);
  }

  .bf-quick-points,
  .bf-strip,
  .bf-feature-grid,
  .bf-workflow-grid {
    grid-template-columns: 1fr;
  }

  .bf-dashboard-image,
  .bf-dashboard-image img {
    min-height: auto;
    height: auto;
  }

  .bf-brand-logo {
    width: 60px;
    height: 60px;
  }

  .bf-cta-panel {
    padding: 22px;
  }

  .page-container {
    padding: 12px;
  }

  .app-header {
    padding: 10px 10px 6px;
    border-radius: 0;
  }

  .workspace-nav-inline {
    flex-direction: column;
    align-items: stretch;
  }

  .primary-tab-switcher,
  .data-scope-options {
    width: 100%;
  }

  .primary-tab,
  .scope-btn {
    flex: 1;
    justify-content: center;
  }

  .data-scope-switcher {
    width: 100%;
    padding-left: 0;
    border-left: 0;
    justify-content: flex-start;
  }

  .tab-content.active {
    padding: 6px 10px 6px !important;
  }

  .result-warning {
    right: 12px;
    max-width: calc(100% - 24px);
  }
}


/* =========================
   TABLE UX ENHANCEMENTS
   ========================= */
#standard-table {
  --tbl-selection-bg: #dbe8f1;
  --tbl-selection-border: #6f96b4;
}

#extended-table {
  --tbl-selection-bg: #dbe9e3;
  --tbl-selection-border: #6e9a86;
}

.data-table thead th {
  color: var(--tbl-head-text) !important;
}

#standard-table thead th {
  background: var(--color-primary-heavy-light) !important;
  color: var(--color-primary) !important;
}

#extended-table thead th {
  background: var(--color-accent-heavy-light) !important;
  color: var(--color-accent) !important;
}

.data-table th,
.data-table td {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  vertical-align: top;
  line-height: 1.45;
}

.data-table .column-wrap {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.data-table thead th.column-selected {
  background: var(--tbl-selection-bg) !important;
  color: var(--tbl-head-text) !important;
}

.data-table tbody td.column-selected {
  background: var(--tbl-selection-bg) !important;
  color: var(--color-text-primary) !important;
}

.row-selector-header,
.row-selector-cell {
  min-width: 40px !important;
  width: 40px !important;
  max-width: 40px !important;
  text-align: center !important;
  font-weight: 700;
  padding-left: 6px !important;
  padding-right: 6px !important;
}

.row-selector-header {
  cursor: default !important;
  vertical-align: middle !important;
  line-height: 1.2 !important;
  padding-top: 5px !important;
  padding-bottom: 5px !important;
}

.row-selector-cell {
  cursor: pointer !important;
  color: var(--color-text-secondary);
  background: #f4f7fa !important;
}

.data-table tbody tr:hover .row-selector-cell {
  background: var(--tbl-row-hover-bg) !important;
}

.data-table tbody tr.row-selected {
  outline: none !important;
}

#standard-table tbody tr.row-selected,
#standard-table tbody tr.row-selected td {
  background: #dbe8f1 !important;
}

#extended-table tbody tr.row-selected,
#extended-table tbody tr.row-selected td {
  background: #dbe9e3 !important;
}

.data-table .is-frozen-col {
  position: sticky;
  left: 0;
  background-clip: padding-box;
  opacity: 1 !important;
}

.data-table thead .is-frozen-col {
  z-index: 30;
  background: var(--tbl-head-bg) !important;
}

.data-table tbody .is-frozen-col {
  z-index: 6;
  background: var(--color-surface) !important;
}

.data-table tbody tr:nth-child(even) .is-frozen-col {
  background: #fbfdff !important;
}

#extended-table tbody tr:nth-child(even) .is-frozen-col {
  background: #f7fbf9 !important;
}

.data-table tbody tr:hover .is-frozen-col {
  background: var(--tbl-row-hover-bg) !important;
}

#standard-table tbody tr.row-selected .is-frozen-col {
  background: #dbe8f1 !important;
}

#extended-table tbody tr.row-selected .is-frozen-col {
  background: #dbe9e3 !important;
}

.data-table .is-last-frozen-col {
  box-shadow: 2px 0 0 #d8e1e8, 8px 0 14px rgba(23, 39, 52, 0.06);
}

.data-table tbody td.cell-range,
.data-table tbody td.cell-active,
.data-table tbody td.cell-selected {
  position: relative;
  z-index: 4;
}

#standard-table td.cell-selected,
#standard-table td.cell-active,
#standard-table td.cell-range {
  background: #c5d9e6 !important;
}

#extended-table td.cell-selected,
#extended-table td.cell-active,
#extended-table td.cell-range {
  background: #c8ddd1 !important;
}

.data-table tbody tr.row-selected td.cell-range,
.data-table tbody tr.row-selected td.cell-active,
.data-table tbody tr.row-selected td.cell-selected,
.data-table tbody td.column-selected.cell-range,
.data-table tbody td.column-selected.cell-active,
.data-table tbody td.column-selected.cell-selected {
  box-shadow: inset 0 0 0 9999px color-mix(in srgb, var(--tbl-selection-border) 28%, transparent);
}

/* =========================
   STREAMLIT-LIKE TABLE UX
   ========================= */
.table-wrapper {
  position: relative;
}

.table-hover-controls {
  position: absolute;
  top: 2px;
  right: 10px;
  z-index: 42;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.table-wrapper:hover .table-hover-controls,
.table-wrapper:focus-within .table-hover-controls,
.table-wrapper.table-tools-open .table-hover-controls,
.data-card:fullscreen .table-hover-controls {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.table-tool-btn {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--color-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  transition: color 0.16s ease, background 0.16s ease;
  cursor: pointer;
}

.table-tool-btn:hover,
.table-tool-btn.is-active {
  border-color: transparent;
  color: var(--color-primary);
  background: #edf4f7;
}

.table-tool-btn svg {
  width: 15px;
  height: 15px;
}

.table-columns-popover,
.column-menu-popover {
  position: absolute;
  min-width: 236px;
  max-width: min(280px, calc(100% - 20px));
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 28px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(16px);
}

.table-columns-popover {
  min-width: 228px;
  z-index: 60;
}

.column-menu-popover {
  z-index: 62;
}

.table-columns-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  color: var(--color-text-primary);
}

.table-columns-reset {
  border: 0;
  padding: 0;
  background: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.table-columns-list {
  max-height: 280px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.table-columns-option {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 0 -8px;
  padding: 6px 8px;
  border-radius: 0;
  color: var(--color-text-primary);
  cursor: pointer;
  transition: background 0.16s ease;
  font-size: 12px;
}

.table-columns-option:hover {
  background: #f2f6f8;
}

.table-columns-option.is-hidden {
  color: var(--color-text-muted);
}

.table-columns-option input {
  accent-color: var(--color-primary);
  margin: 0;
}

.column-header-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0;
  min-width: 0;
  padding-left: 2px;
  padding-right: 0;
}

.column-header-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.35;
  padding-top: 1px;
  padding-right: 1px;
}

.column-sort-indicator {
  min-width: 0;
  font-size: 11px;
  line-height: 1;
  color: var(--color-primary);
  text-align: center;
}

.column-sort-indicator:empty {
  display: none;
}

.column-menu-trigger {
  width: 16px;
  height: 16px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--color-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.column-menu-trigger:hover {
  background: rgba(255, 255, 255, 0.72);
  color: var(--color-text-secondary);
}

.column-menu-trigger.is-open,
.column-menu-trigger.is-active {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(148, 163, 184, 0.3);
  color: var(--color-primary);
}

.column-menu-trigger span {
  font-size: 10px;
  line-height: 1;
}

.data-table thead th.has-mini-filter .column-header-label,
.data-table thead th.is-wrapped-col .column-header-label,
.data-table thead th.is-pinned-col .column-header-label {
  color: var(--color-text-primary) !important;
}

.column-menu-title {
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--color-text-primary);
}

.column-menu-section {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.column-menu-field {
  margin-bottom: 4px;
}

.column-menu-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0 10px;
  background: #ffffff;
}

.column-menu-field input {
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--color-text-primary);
  font-size: 12px;
}

.column-menu-field input:focus {
  outline: none;
}

.column-menu-input-wrap:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(18, 116, 149, 0.12);
}

.column-menu-action {
  width: 100%;
  margin: 0 -8px;
  border: 0;
  border-radius: 0;
  padding: 7px 8px;
  background: transparent;
  color: var(--color-text-primary);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.column-menu-action:hover {
  background: #f2f6f8;
}

.column-menu-action.is-active {
  background: transparent;
  color: var(--color-primary-dark);
  font-weight: 700;
  box-shadow: inset 2px 0 0 var(--color-primary);
}

.column-menu-action.is-danger {
  color: var(--color-text-primary);
}

.column-menu-icon,
.table-columns-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  color: currentColor;
  stroke-width: 2;
}

.column-menu-divider {
  border: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  margin: 6px 0;
}

.data-card:fullscreen {
  width: 100%;
  height: 100%;
  max-width: none;
  padding: 18px;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  background: #f8fbfd;
}

.data-card:fullscreen .table-wrapper {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.data-card:fullscreen .table-scroll {
  flex: 1;
  min-height: 0;
  height: auto;
}
