/* ============================================================
   APFCO Dashboard 2026 – Main Stylesheet
   Brand Identity: Green #2DB348 + Red #E8192C
   "Vươn tầm sắn Việt"
   ============================================================ */

:root {
  /* ── APFCO Brand Colors ── */
  --apfco-green:       #2DB348;   /* logo oval green */
  --apfco-green-dark:  #1E8A34;   /* darker shade for hover/depth */
  --apfco-green-light: #E8F8ED;   /* light tint for backgrounds */
  --apfco-green-mid:   #4DC46A;   /* medium tint */
  --apfco-red:         #E8192C;   /* APFCO logo red */
  --apfco-red-dark:    #B8121F;
  --apfco-red-light:   #FDE8EA;

  /* ── Primary = Brand Green ── */
  --primary:       var(--apfco-green);
  --primary-dark:  var(--apfco-green-dark);
  --primary-light: var(--apfco-green-light);

  /* ── UI Semantic Colors ── */
  --secondary:  #1a3a2c;   /* deep forest green for nav */
  --accent:     #F5A623;   /* amber */
  --danger:     var(--apfco-red);
  --warning:    #D97706;
  --info:       #2563EB;
  --success:    var(--apfco-green);

  /* ── Neutral Palette ── */
  --bg:        #F2F7F4;   /* very light green-tinted bg */
  --card-bg:   #FFFFFF;
  --border:    #D8EDDF;   /* light green-tinted border */
  --text:      #1A2E20;   /* deep green-black text */
  --text-muted:#5A7A63;
  --text-light:#94A89B;

  /* ── Shadows & Geometry ── */
  --shadow:    0 1px 4px rgba(45,179,72,.08), 0 4px 16px rgba(0,0,0,.04);
  --shadow-lg: 0 4px 24px rgba(45,179,72,.12);
  --radius:    10px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: 'Segoe UI', 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ══════════════════════════════════════════════════════════
   HEADER — APFCO Branded
   ══════════════════════════════════════════════════════════ */
.header {
  background: linear-gradient(135deg, #0F2417 0%, #1A3D24 55%, #1E4A2A 100%);
  color: #fff;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,.25);
  border-bottom: 3px solid var(--apfco-green);
}

/* Logo container */
.header-logo-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}
.header-logo {
  height: 48px;
  width: auto;
  border-radius: 6px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.3));
  flex-shrink: 0;
}
.header-divider {
  width: 1px;
  height: 36px;
  background: rgba(45,179,72,.4);
}

/* Title block */
.header-text { display: flex; flex-direction: column; gap: 1px; }
.header-company {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--apfco-green-mid);
  letter-spacing: .8px;
  text-transform: uppercase;
}
.header-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -.2px;
  line-height: 1.2;
}
.header-tagline {
  font-size: 0.65rem;
  color: rgba(255,255,255,.5);
  font-style: italic;
  margin-top: 1px;
}

/* Right side badges */
.header-right { display: flex; align-items: center; gap: 14px; }
.badge-period {
  background: rgba(45,179,72,.2);
  border: 1px solid rgba(45,179,72,.45);
  color: #7EEAA0;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: .3px;
}
.badge-updated {
  font-size: 0.68rem;
  color: rgba(255,255,255,.4);
  display: flex;
  align-items: center;
  gap: 4px;
}
.hub-link {
  text-decoration: none;
  transition: background .2s, border-color .2s, color .2s;
}
.hub-link:hover {
  background: rgba(45,179,72,.28);
  border-color: rgba(45,179,72,.55);
  color: #ffffff;
}

/* ══════════════════════════════════════════════════════════
   TABS — APFCO Green accent
   ══════════════════════════════════════════════════════════ */
.tabs-wrapper {
  background: #112A19;
  padding: 0 24px;
  display: flex;
  gap: 2px;
  border-bottom: 1px solid rgba(45,179,72,.15);
  overflow-x: auto;
}
.tabs-wrapper::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 10px 18px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.5);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  transition: all .2s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-btn:hover { color: rgba(255,255,255,.8); }
.tab-btn.active {
  color: #7EEAA0;
  border-bottom-color: var(--apfco-green);
  background: rgba(45,179,72,.06);
}
.tab-icon { font-size: 0.9rem; }

/* ══════════════════════════════════════════════════════════
   FILTERS BAR
   ══════════════════════════════════════════════════════════ */
.filters-bar {
  background: var(--card-bg);
  padding: 10px 24px;
  display: flex;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.filter-group { display: flex; align-items: center; gap: 7px; }
.filter-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
}
.filter-select {
  padding: 5px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text);
  background: #F7FBF8;
  cursor: pointer;
  outline: none;
  transition: border-color .15s;
}
.filter-select:focus { border-color: var(--apfco-green); }
.filter-divider { width: 1px; height: 22px; background: var(--border); }
.note-badge {
  font-size: 0.68rem;
  background: #FFFBEB;
  color: #92400E;
  border: 1px solid #FDE68A;
  padding: 3px 9px;
  border-radius: 4px;
}

/* ══════════════════════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════════════════════ */
.main { padding: 20px 24px; max-width: 1600px; margin: 0 auto; }
.section { margin-bottom: 24px; }

.executive-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr);
  gap: 16px;
  padding: 18px 20px;
  border-radius: calc(var(--radius) + 2px);
  background:
    radial-gradient(circle at top right, rgba(126,234,160,.26), transparent 34%),
    linear-gradient(135deg, #10261A 0%, #163A24 58%, #245134 100%);
  color: #fff;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.executive-hero::after {
  content: '';
  position: absolute;
  inset: auto -40px -46px auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.executive-hero-main,
.executive-hero-side {
  position: relative;
  z-index: 1;
}
.executive-kicker {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.82);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: .75px;
  text-transform: uppercase;
}
.executive-title {
  margin-top: 12px;
  font-size: 1.8rem;
  font-weight: 900;
  line-height: 1.1;
}
.executive-subtitle {
  margin-top: 8px;
  max-width: 820px;
  color: rgba(255,255,255,.72);
  font-size: 0.86rem;
  line-height: 1.6;
}
.executive-hero-side {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
}
.hero-metric {
  min-height: 94px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.10);
  backdrop-filter: blur(8px);
}
.hero-metric-label {
  color: rgba(255,255,255,.68);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: .55px;
  text-transform: uppercase;
}
.hero-metric-value {
  margin-top: 8px;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1.1;
}
.hero-metric-sub {
  margin-top: 6px;
  color: rgba(255,255,255,.72);
  font-size: 0.72rem;
  line-height: 1.45;
}
.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.status-pill {
  min-width: 190px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow);
}
.status-pill.status-good { border-color: rgba(1,145,71,.18); background: #F4FBF6; }
.status-pill.status-ok { border-color: rgba(107,114,128,.12); background: #F8FAFC; }
.status-pill.status-warning { border-color: rgba(245,197,24,.35); background: #FFF8E1; }
.status-pill.status-bad { border-color: rgba(234,33,39,.22); background: #FFF1F2; }
.status-pill.status-na { border-color: var(--border); background: #fff; }
.status-label {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .55px;
}
.status-value {
  margin-top: 6px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 800;
}
.status-meta {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
}
.executive-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.05fr) minmax(280px, 1fr);
  gap: 16px;
  align-items: start;
}
.executive-sidecards {
  display: grid;
  gap: 16px;
}
.heatmap-table th,
.heatmap-table td {
  vertical-align: middle;
}
.heatmap-table td.cell {
  line-height: 1.2;
}
.heatmap-main {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
}
.heatmap-sub {
  display: block;
  margin-top: 3px;
  font-size: 0.66rem;
  font-weight: 600;
  color: inherit;
  opacity: .82;
}
.watchlist-list {
  display: grid;
  gap: 10px;
}
.watchlist-item {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid #edf2f7;
}
.watchlist-item:first-child {
  border-top: none;
  padding-top: 0;
}
.watchlist-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #E8F8ED;
  color: var(--apfco-green-dark);
  font-size: 0.74rem;
  font-weight: 900;
}
.watchlist-name {
  color: var(--text);
  font-size: 0.83rem;
  font-weight: 800;
}
.watchlist-meta {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.5;
}
.executive-list {
  display: grid;
  gap: 8px;
}
.executive-list-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.77rem;
  line-height: 1.55;
}
.executive-list-item strong {
  color: var(--text);
}
.executive-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.executive-dot.good { background: var(--apfco-green); }
.executive-dot.warn { background: #F5C518; }
.executive-dot.bad { background: var(--apfco-red); }
.executive-dot.info { background: var(--info); }

@media (max-width: 1180px) {
  .executive-hero {
    grid-template-columns: 1fr;
  }
  .executive-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .executive-hero-side {
    grid-template-columns: 1fr;
  }
  .status-pill {
    min-width: 100%;
  }
}

.section-title {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--apfco-green-dark);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, var(--apfco-green-light), transparent);
  border-radius: 2px;
}

/* ══════════════════════════════════════════════════════════
   KPI CARDS — APFCO Branded
   ══════════════════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--apfco-green);
  position: relative;
  overflow: hidden;
}
/* Subtle brand pattern in corner */
.kpi-card::after {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 70px; height: 70px;
  border-radius: 50%;
  background: var(--apfco-green-light);
  opacity: .6;
  pointer-events: none;
}
.kpi-card.warning { border-left-color: var(--warning); }
.kpi-card.danger  { border-left-color: var(--apfco-red); }
.kpi-card.info    { border-left-color: var(--info); }
.kpi-card.accent  { border-left-color: var(--accent); }

.kpi-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-muted);
  margin-bottom: 7px;
  position: relative; z-index: 1;
}
.kpi-value {
  font-size: 1.65rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1.1;
  position: relative; z-index: 1;
}
.kpi-unit {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 3px;
  position: relative; z-index: 1;
}
.kpi-compare {
  font-size: 0.71rem;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative; z-index: 1;
}
.kpi-compare.up      { color: var(--apfco-green); font-weight: 600; }
.kpi-compare.down    { color: var(--apfco-red); font-weight: 600; }
.kpi-compare.neutral { color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════
   CHART CARDS
   ══════════════════════════════════════════════════════════ */
.charts-grid { display: grid; gap: 16px; }
.charts-grid.cols-2   { grid-template-columns: 1fr 1fr; }
.charts-grid.cols-3   { grid-template-columns: 1fr 1fr 1fr; }
.charts-grid.cols-1-2 { grid-template-columns: 1fr 2fr; }

.chart-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border-top: 3px solid transparent;
}
.chart-card:hover { border-top-color: var(--apfco-green); transition: border-top-color .2s; }

.chart-header {
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chart-title {
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--text);
}
.chart-subtitle {
  font-size: 0.69rem;
  color: var(--text-muted);
  margin-top: 3px;
}
.chart-body { padding: 16px; }
.echarts-container { width: 100%; }

.product-breakout-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -4px 0 14px;
}
.product-breakout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.product-breakout-grid.compact-single {
  grid-template-columns: minmax(280px, 420px);
}
.product-breakout-grid.compact-single .product-breakout-card {
  max-width: 420px;
}
.product-breakout-card {
  --product-tone: var(--apfco-green);
  --product-soft: rgba(45, 179, 72, .10);
  --product-soft-strong: rgba(45, 179, 72, .20);
  background: linear-gradient(180deg, var(--product-soft) 0%, #FFFFFF 76%);
  border: 1px solid var(--border);
  border-top: 3px solid var(--product-tone);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.product-breakout-card::after {
  content: '';
  position: absolute;
  right: -24px;
  top: -24px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: var(--product-soft-strong);
  pointer-events: none;
}
.product-breakout-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.product-breakout-card.is-active {
  box-shadow: 0 0 0 2px var(--product-tone), var(--shadow-lg);
}
.product-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  z-index: 1;
}
.product-card-label {
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-muted);
}
.product-card-name {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text);
  margin-top: 4px;
  line-height: 1.25;
}
.product-share-badge {
  background: rgba(255,255,255,.85);
  border: 1px solid var(--product-soft-strong);
  color: var(--product-tone);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}
.product-card-volume {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1.1;
  margin-top: 14px;
  position: relative;
  z-index: 1;
}
.product-card-volume span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}
.product-card-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 5px;
  position: relative;
  z-index: 1;
}
.product-breakout-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
  position: relative;
  z-index: 1;
}
.product-breakout-metric {
  background: rgba(255,255,255,.88);
  border: 1px solid #EDF6F0;
  border-radius: 8px;
  padding: 8px 9px;
}
.product-breakout-metric .metric-label {
  font-size: 0.63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .45px;
  color: var(--text-light);
}
.product-breakout-metric .metric-value {
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--text);
  margin-top: 3px;
}
.product-card-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  position: relative;
  z-index: 1;
}
.product-delta {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
}
.product-delta.good {
  background: #E8F8ED;
  color: #176533;
}
.product-delta.bad {
  background: #FDE8EA;
  color: #9B1625;
}
.product-breakout-empty {
  background: var(--card-bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ══════════════════════════════════════════════════════════
   DATA TABLES
   ══════════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.79rem;
}
table.data-table th {
  background: #F2F8F4;
  padding: 9px 12px;
  text-align: left;
  font-weight: 700;
  color: var(--apfco-green-dark);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 2px solid var(--apfco-green);
  white-space: nowrap;
}
table.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #EFF7F2;
  color: var(--text);
  white-space: nowrap;
}
table.data-table tr:hover td { background: #F7FBF8; }
table.data-table .num    { text-align: right; font-variant-numeric: tabular-nums; }
table.data-table .center { text-align: center; }

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 800;
}
.rank-1 { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.rank-2 { background: #F1F5F9; color: #475569; border: 1px solid #CBD5E1; }
.rank-3 { background: #FEF2E8; color: #9A3412; border: 1px solid #FED7AA; }
.rank-other { background: #F2F8F4; color: var(--text-muted); border: 1px solid var(--border); }

/* ══════════════════════════════════════════════════════════
   PERFORMANCE PILLS — using APFCO colors
   ══════════════════════════════════════════════════════════ */
.perf-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.69rem;
  font-weight: 700;
}
.perf-good    { background: #D8F5E2; color: #155E2C; }
.perf-ok      { background: #FEF9C3; color: #713F12; }
.perf-warning { background: #FEF3C7; color: #92400E; }
.perf-bad     { background: #FDE8EA; color: #9B1625; }
.perf-na      { background: #F2F8F4; color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════
   HEATMAP
   ══════════════════════════════════════════════════════════ */
.heatmap-table td.cell {
  min-width: 90px;
  text-align: center;
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: 3px;
  padding: 6px 8px;
}
.heat-1 { background: #C8F0D5; color: #10502A; }
.heat-2 { background: #D8F5E2; color: #155E2C; }
.heat-3 { background: #FEF9C3; color: #713F12; }
.heat-4 { background: #FDE68A; color: #92400E; }
.heat-5 { background: #FECDD3; color: #9B1625; }
.heat-na { background: #F2F8F4; color: var(--text-light); }

/* ══════════════════════════════════════════════════════════
   INSIGHT / ALERT CARDS
   ══════════════════════════════════════════════════════════ */
.insight-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.insight-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.insight-card.alert    { border-left: 4px solid var(--apfco-red); }
.insight-card.positive { border-left: 4px solid var(--apfco-green); }
.insight-card.action   { border-left: 4px solid var(--accent); }
.insight-card.info     { border-left: 4px solid var(--info); }

.insight-title {
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.insight-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.77rem;
  line-height: 1.55;
}
.insight-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.dot-red    { background: var(--apfco-red); }
.dot-green  { background: var(--apfco-green); }
.dot-yellow { background: var(--accent); }
.dot-blue   { background: var(--info); }

/* ══════════════════════════════════════════════════════════
   BONUS MODULE
   ══════════════════════════════════════════════════════════ */
.bonus-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.bonus-header {
  background: linear-gradient(135deg, #0F2417, #1A3D24);
  color: #fff;
  padding: 16px 20px;
  border-bottom: 2px solid var(--apfco-green);
}
.bonus-header h3 { font-size: 0.92rem; font-weight: 800; }
.bonus-header p  { font-size: 0.71rem; color: rgba(255,255,255,.55); margin-top: 3px; }
.bonus-body { padding: 18px; }

.formula-box {
  background: #F2F8F4;
  border: 1px solid var(--border);
  border-left: 3px solid var(--apfco-green);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  color: var(--text);
  line-height: 1.8;
}
.formula-box .highlight {
  color: var(--apfco-green-dark);
  font-weight: 700;
}

.kpi-score-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.kpi-score-card {
  background: #F7FBF8;
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  border: 1.5px solid var(--border);
}
.kpi-score-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.kpi-score-value { font-size: 1.4rem; font-weight: 900; color: var(--text); }
.kpi-score-sub   { font-size: 0.64rem; color: var(--text-muted); margin-top: 3px; }
.kpi-score-k     { font-size: 0.82rem; font-weight: 700; margin-top: 7px; }

/* ══════════════════════════════════════════════════════════
   VARIANCE
   ══════════════════════════════════════════════════════════ */
.variance-positive { color: var(--apfco-green-dark); font-weight: 700; }
.variance-negative { color: var(--apfco-red); font-weight: 700; }
.variance-neutral  { color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════
   TAB PANELS
   ══════════════════════════════════════════════════════════ */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ══════════════════════════════════════════════════════════
   DATA NOTE / FOOTER
   ══════════════════════════════════════════════════════════ */
.data-note {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.72rem;
  color: #78350F;
  margin-top: 20px;
  line-height: 1.7;
}
.data-note strong { color: #92400E; }

/* ══════════════════════════════════════════════════════════
   BRAND FOOTER STRIP
   ══════════════════════════════════════════════════════════ */
.brand-footer {
  background: linear-gradient(135deg, #0F2417, #1A3D24);
  border-top: 2px solid var(--apfco-green);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 32px;
}
.brand-footer-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-footer img { height: 28px; opacity: .9; }
.brand-footer-text {
  font-size: 0.68rem;
  color: rgba(255,255,255,.5);
  line-height: 1.5;
}
.brand-footer-text strong { color: rgba(255,255,255,.75); }
.brand-footer-right {
  font-size: 0.65rem;
  color: rgba(255,255,255,.35);
  text-align: right;
}

/* ══════════════════════════════════════════════════════════
   SCROLLBAR
   ══════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #B8DEC2; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--apfco-green); }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .charts-grid.cols-2 { grid-template-columns: 1fr; }
  .charts-grid.cols-3 { grid-template-columns: 1fr 1fr; }
  .insight-grid { grid-template-columns: 1fr; }
  .product-breakout-metrics { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 768px) {
  .header { padding: 0 12px; height: 60px; }
  .header-logo { height: 36px; }
  .header-title { font-size: 0.88rem; }
  .header-tagline { display: none; }
  .main { padding: 12px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid.cols-3 { grid-template-columns: 1fr; }
  .kpi-score-row { grid-template-columns: 1fr; }
  .insight-grid { grid-template-columns: 1fr; }
  .brand-footer { flex-direction: column; gap: 8px; text-align: center; }
  .product-breakout-metrics { grid-template-columns: 1fr 1fr; }
  .product-card-top { flex-direction: column; }
  .product-share-badge { align-self: flex-start; }
}

/* ══════════════════════════════════════════════════════════
   NEW v3.0 STYLES — Factory + Time Range Filters
   ══════════════════════════════════════════════════════════ */

/* Filter subtitle badge */
.filter-subtitle-badge {
  font-size: 0.78rem;
  color: var(--apfco-green);
  background: var(--apfco-green-light);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  white-space: nowrap;
  font-weight: 600;
}

/* Bonus controls row */
.bonus-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

/* KPI card v3 structure */
.kpi-card .kpi-plan {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.kpi-card .kpi-trend {
  font-size: 0.72rem;
  font-weight: 700;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  display: inline-block;
}
.trend-ok  { background: var(--apfco-green-light); color: var(--apfco-green-dark); }
.trend-bad { background: var(--apfco-red-light); color: var(--apfco-red-dark); }

/* Table cell colors */
.cell-ok  { color: var(--apfco-green-dark) !important; font-weight: 600; }
.cell-bad { color: var(--apfco-red-dark)   !important; font-weight: 600; }

/* Rank badge */
.rank-badge {
  display: inline-block;
  background: var(--apfco-green);
  color: #fff;
  font-weight: 700;
  font-size: 0.72rem;
  border-radius: 50%;
  width: 22px; height: 22px;
  line-height: 22px;
  text-align: center;
}

/* Note badge */
.note-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: #FFF9E6;
  border: 1px solid #F5C518;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  display: inline-block;
  margin-bottom: 8px;
}

/* Bonus cards */
.bonus-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 600px) { .bonus-grid { grid-template-columns: 1fr; } }
.bonus-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  border-left: 4px solid var(--border);
}
.bonus-ok   { border-left-color: var(--apfco-green); background: var(--apfco-green-light); }
.bonus-warn { border-left-color: var(--apfco-red);   background: var(--apfco-red-light); }
.bonus-proxy { border-left-color: #F5C518; background: #FFFBEB; }
.bonus-total { border-left-color: #3B82F6; background: #EFF6FF; grid-column: 1 / -1; }
.bonus-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; margin-bottom: 4px; }
.bonus-val   { font-size: 2rem; font-weight: 800; color: var(--text); }
.bonus-detail { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }
.bonus-summary { background: var(--bg); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 0.82rem; line-height: 1.6; }
.bonus-highlight { font-size: 1.2rem; font-weight: 800; color: var(--apfco-green-dark); }
.bonus-total-primary {
  background: linear-gradient(135deg, #eff6ff, #e0f2fe);
  border-left-color: #2563eb;
}
.bonus-total-primary .bonus-val {
  font-size: 2.2rem;
}
.bonus-total-primary .bonus-summary {
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.72);
}
.proxy-tag { font-size: 0.65rem; background: #FEF3C7; color: #92400E; border-radius: 4px; padding: 1px 6px; margin-left: 6px; }
.proxy-note { font-size: 0.68rem; color: var(--text-muted); display: block; margin-top: 6px; }
.bonus-spotlight {
  border: 1px solid rgba(1, 145, 71, 0.14);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,251,247,0.98));
  box-shadow: 0 16px 28px rgba(15, 36, 23, 0.08);
}
.bonus-spotlight-head {
  margin-bottom: 12px;
}
.bonus-spotlight .chart-card {
  background: rgba(255,255,255,0.94);
}
.bonus-spotlight .section-title::after {
  width: 88px;
}

/* Insights grid */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 768px) { .insights-grid { grid-template-columns: 1fr; } }
.insight-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.insight-card h3 { font-size: 0.92rem; color: var(--text); margin-bottom: 10px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.insight-card p  { font-size: 0.82rem; color: var(--text); margin-bottom: 6px; }

/* Alert items */
.alert-item { padding: 7px 12px; border-radius: var(--radius-sm); margin-bottom: 6px; font-size: 0.8rem; }
.alert-danger  { background: var(--apfco-red-light); border-left: 3px solid var(--apfco-red); }
.alert-warning { background: #FEF3C7; border-left: 3px solid #F5C518; }
.alert-ok      { background: var(--apfco-green-light); border-left: 3px solid var(--apfco-green); }

/* ══════════════════════════════════════════════════════════
   v4.0 — KPI CARD: So KH States (ok / bad / ref)
   ══════════════════════════════════════════════════════════ */

/* Main KPI cards: green when on-track, red when below */
.kpi-card.kpi-ok  { border-left-color: var(--apfco-green); }
.kpi-card.kpi-bad { border-left-color: var(--apfco-red); }

/* Reference card: neutral monitoring (giá thành) */
.kpi-card.kpi-ref {
  border-left-color: #94A3B8;
  background: #F8FAFC;
}
.kpi-card.kpi-ref .kpi-value { color: #475569; }

/* Trend labels */
.kpi-trend { font-size: 0.72rem; font-weight: 700; margin-top: 4px; padding: 2px 8px; border-radius: 10px; display: inline-block; }
.trend-ok  { background: var(--apfco-green-light); color: var(--apfco-green-dark); }
.trend-bad { background: var(--apfco-red-light); color: var(--apfco-red-dark); }
.trend-ref { background: #F1F5F9; color: #64748B; font-weight: 600; font-style: italic; }

/* Mini progress bar inside KPI card */
.kpi-bar-wrap {
  height: 4px;
  background: #E2E8F0;
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}
.kpi-bar {
  height: 100%;
  border-radius: 2px;
  width: 50%;
  background: var(--apfco-green);
  transition: width 0.5s ease, background 0.3s ease;
}

/* ══════════════════════════════════════════════════════════
   v4.0 — TABLE CELL HELPERS
   ══════════════════════════════════════════════════════════ */
.td-num    { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.td-center { text-align: center; }
.td-muted  { color: #94A3B8 !important; font-style: italic; }

/* Small "vs KH" annotation inside table cells */
.cell-vs {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
  font-style: normal;
}

/* ══════════════════════════════════════════════════════════
   v4.0 — INSIGHTS SUMMARY ROW (3 KPI + giá thành ref)
   ══════════════════════════════════════════════════════════ */
.summary-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 12px;
}
@media (max-width: 900px) { .summary-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .summary-row { grid-template-columns: 1fr; } }

.summary-item {
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  background: #fff;
}
.summary-item.sum-ok  { border-color: var(--apfco-green); background: var(--apfco-green-light); }
.summary-item.sum-bad { border-color: var(--apfco-red);   background: var(--apfco-red-light); }
.summary-item.sum-ref { border-color: #CBD5E1; background: #F8FAFC; }

.sum-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: 4px; }
.sum-val   { font-size: 1.5rem; font-weight: 900; color: var(--text); line-height: 1.15; }
.sum-vs    { font-size: 0.71rem; color: var(--text-muted); margin-top: 4px; }

/* ══════════════════════════════════════════════════════════
   v4.0 — BONUS KDC VALUE
   ══════════════════════════════════════════════════════════ */
.kdc-val   { font-size: 2.2rem; font-weight: 900; color: var(--apfco-green-dark); }
.kdc-label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-left: 8px; vertical-align: middle; }

/* ══════════════════════════════════════════════════════════
   v5.0 — SORTABLE TABLE HEADERS
   ══════════════════════════════════════════════════════════ */
th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  white-space: nowrap;
  transition: background .15s;
}
th.sortable:hover { background: #E8F8ED; }
.sort-icon { display: inline-block; width: 14px; opacity: .35; font-style: normal; }
th.sort-asc  .sort-icon::after { content: ' ▲'; opacity: 1; color: var(--apfco-green); }
th.sort-desc .sort-icon::after { content: ' ▼'; opacity: 1; color: var(--apfco-green); }
th.sort-asc, th.sort-desc { background: #EBF7EF; color: var(--apfco-green-dark); }

/* ══════════════════════════════════════════════════════════
   v5.0 — REVENUE / GP SUMMARY CARDS (insights)
   ══════════════════════════════════════════════════════════ */
.summary-row + .summary-row { margin-top: 10px; }
.sum-val small { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }

/* ============================================================
   Index Refresh - aligned to Cost Dashboard visual language
   ============================================================ */

:root {
  --apfco-green: #019147;
  --apfco-green-dark: #016d37;
  --apfco-green-light: #e6f4ec;
  --apfco-green-mid: #5bb784;
  --apfco-red: #ea2127;
  --apfco-red-dark: #b81a1e;
  --apfco-red-light: #fde9ea;
  --primary: var(--apfco-green);
  --primary-dark: var(--apfco-green-dark);
  --primary-light: var(--apfco-green-light);
  --secondary: #1a2e1a;
  --accent: #d4a017;
  --warning: #d87a05;
  --info: #2563eb;
  --success: var(--apfco-green);
  --bg: #f4f7f4;
  --card-bg: #ffffff;
  --border: #cde3d8;
  --text: #1a2e1a;
  --text-muted: #4a6a52;
  --text-light: #8aaa92;
  --shadow: 0 2px 12px rgba(1, 145, 71, 0.09);
  --shadow-lg: 0 6px 24px rgba(1, 145, 71, 0.12);
  --radius: 12px;
  --radius-sm: 7px;
}

body {
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(1, 145, 71, 0.08), transparent 22%),
    linear-gradient(180deg, #f8fbf8 0%, var(--bg) 160px);
  color: var(--text);
}

.header {
  background: linear-gradient(90deg, var(--apfco-green) 0%, var(--apfco-green-dark) 100%);
  height: 62px;
  padding: 0 20px;
  border-bottom: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.header-logo-wrap {
  gap: 12px;
  min-width: 0;
}

.header-logo {
  height: 38px;
  border-radius: 0;
  filter: none;
}

.header-divider {
  width: 1.5px;
  height: 32px;
  background: rgba(255, 255, 255, 0.28);
}

.header-text {
  min-width: 0;
}

.header-company {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.72);
  letter-spacing: 0.6px;
}

.header-title {
  font-size: 0.96rem;
  color: #ffffff;
  line-height: 1.2;
}

.header-tagline {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.72);
  font-style: normal;
}

.header-right {
  gap: 10px;
  flex-shrink: 0;
}

.badge-period,
.badge-updated {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 20px;
  padding: 4px 11px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
}

.badge-period {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.badge-updated {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.86);
}

.tabs-wrapper {
  max-width: 1600px;
  margin: 14px auto 0;
  padding: 0 20px;
  background: transparent;
  border-bottom: none;
  gap: 8px;
}

.tab-btn {
  min-height: 40px;
  padding: 9px 18px;
  margin-bottom: 0;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text-muted);
  box-shadow: var(--shadow);
}

.tab-btn:hover {
  color: var(--apfco-green);
  border-color: var(--apfco-green);
  background: #ffffff;
}

.tab-btn.active {
  color: #ffffff;
  border-bottom-color: var(--apfco-green);
  border-color: var(--apfco-green);
  background: var(--apfco-green);
}

.tab-icon {
  font-size: 0.85rem;
}

.filters-bar {
  max-width: 1600px;
  margin: 14px auto 0;
  padding: 12px 16px 14px;
  align-items: flex-end;
  gap: 12px;
  background: var(--card-bg);
  border-top: 3px solid var(--apfco-green);
  border-bottom: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.filter-group {
  align-items: flex-start;
  flex-direction: column;
  gap: 4px;
}

.filter-label {
  font-size: 0.68rem;
  color: var(--apfco-green);
  letter-spacing: 0.45px;
}

.filter-select {
  min-height: 40px;
  min-width: 170px;
  padding: 8px 30px 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  background: #ffffff;
}

.filter-select:focus {
  border-color: var(--apfco-green);
  box-shadow: 0 0 0 3px rgba(1, 145, 71, 0.08);
}

.filter-divider {
  display: none;
}

.filter-subtitle-badge {
  margin-left: auto;
  align-self: center;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--apfco-green-light);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
}

.main {
  padding: 14px 20px 56px;
}

.section {
  margin-bottom: 16px;
}

.section-title {
  font-size: 0.78rem;
  color: var(--apfco-green);
  margin-bottom: 12px;
}

.section-title::after {
  height: 1.5px;
  background: linear-gradient(90deg, var(--border), transparent);
}

.kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.kpi-card {
  padding: 15px 16px;
  border-left: none;
  border-top: 3px solid var(--apfco-green);
  box-shadow: var(--shadow);
}

.kpi-card::after {
  top: auto;
  right: -8px;
  bottom: -28px;
  width: 90px;
  height: 90px;
  background: radial-gradient(circle, rgba(1, 145, 71, 0.14) 0%, rgba(1, 145, 71, 0) 68%);
  opacity: 1;
}

.kpi-card.kpi-ok {
  border-top-color: var(--apfco-green);
}

.kpi-card.kpi-bad {
  border-top-color: var(--apfco-red);
}

.kpi-card.kpi-ref {
  border-top-color: #94a3b8;
  border-left-color: transparent;
  background: #f8fafc;
}

.kpi-card.kpi-ref.kpi-ref-warning {
  border-top-color: #F59E0B;
  background: linear-gradient(180deg, #FFF9EB 0%, #F8FAFC 100%);
}

.kpi-card.kpi-ref.kpi-ref-bad {
  border-top-color: var(--apfco-red);
  background: linear-gradient(180deg, #FFF4F5 0%, #F8FAFC 100%);
}

.kpi-card.kpi-ref.kpi-ref-good {
  border-top-color: var(--apfco-green);
  background: linear-gradient(180deg, #F4FBF6 0%, #F8FAFC 100%);
}

.kpi-card.kpi-ref.kpi-ref-bad::after {
  background: rgba(232, 25, 44, .08);
}

.kpi-card.kpi-ref.kpi-ref-warning::after {
  background: rgba(245, 166, 35, .10);
}

.kpi-card.kpi-ref.kpi-ref-good::after {
  background: rgba(45, 179, 72, .10);
}

.kpi-card.kpi-ref.kpi-ref-bad .kpi-value {
  color: var(--apfco-red-dark);
}

.kpi-card.kpi-ref.kpi-ref-warning .kpi-value {
  color: #B45309;
}

.kpi-label {
  color: var(--text-muted);
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 1.52rem;
}

.kpi-card .kpi-plan {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.kpi-card .kpi-note {
  display: none;
  font-size: 0.72rem;
  margin-top: 4px;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}

.kpi-note.note-up {
  color: var(--apfco-green-dark);
  font-weight: 700;
}

.kpi-note.note-down {
  color: var(--apfco-red-dark);
  font-weight: 700;
}

.kpi-note.note-neutral {
  color: var(--text-muted);
  font-weight: 600;
}

.kpi-card .kpi-trend {
  margin-top: 6px;
}

.trend-ok {
  background: var(--apfco-green-light);
  color: var(--apfco-green-dark);
}

.trend-bad {
  background: var(--apfco-red-light);
  color: var(--apfco-red-dark);
}

.trend-ref {
  background: #edf2f7;
  color: #64748b;
}

.trend-warn {
  background: #FEF3C7;
  color: #92400E;
}

.kpi-bar-wrap {
  margin-top: 10px;
  background: #dde7df;
}

.charts-grid {
  gap: 12px;
}

.chart-card {
  border-top: 3px solid transparent;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-top-color 0.18s ease, box-shadow 0.18s ease;
}

.chart-card:hover {
  border-top-color: var(--apfco-green);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.chart-header {
  padding: 14px 16px 10px;
  border-bottom: 1.5px solid var(--border);
}

.chart-title {
  font-size: 0.9rem;
}

.chart-body {
  padding: 14px 16px 16px;
}

.table-wrap {
  border-radius: var(--radius-sm);
}

table.data-table {
  font-size: 0.8rem;
}

table.data-table th {
  background: var(--apfco-green);
  color: #ffffff;
  border-bottom: none;
  padding: 10px 12px;
}

table.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e8f0eb;
}

table.data-table tr:hover td {
  background: #f0f8f3;
}

th.sortable:hover,
th.sort-asc,
th.sort-desc {
  background: var(--apfco-green-dark);
  color: #ffffff;
}

th.sort-asc .sort-icon::after,
th.sort-desc .sort-icon::after {
  color: #ffffff;
}

.note-badge {
  font-size: 0.75rem;
  color: #8c5b00;
  background: #fff7df;
  border: 1px solid #ebd49a;
  border-radius: 6px;
  padding: 5px 10px;
}

.bonus-card,
.insight-card,
.summary-item {
  box-shadow: var(--shadow);
}

.brand-footer {
  background: transparent;
  border-top: none;
  margin-top: 0;
  padding: 0 20px 28px;
}

.brand-footer-inner {
  max-width: 1600px;
  margin: 0 auto;
  background: #ffffff;
  border-top: 3px solid var(--apfco-green);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.brand-footer img.brand-footer-logo {
  height: 30px;
  width: auto;
  flex-shrink: 0;
  opacity: 1;
}

.brand-footer-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex: 1;
  line-height: 1.5;
}

.brand-footer-build {
  font-size: 0.72rem;
  color: var(--apfco-green-dark);
  background: var(--apfco-green-light);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
}

.tab-panel.active {
  animation: panel-fade 0.22s ease;
}

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

.detail-module-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -4px 0 14px;
}

.factory-focus-panel {
  margin-bottom: 24px;
}

.factory-focus-panel .charts-grid + .charts-grid {
  margin-top: 16px;
}

.factory-focus-panel .note-badge,
#overview-bonus-embed .note-badge {
  margin-bottom: 0;
}

.selected-factory-row td {
  background: linear-gradient(90deg, rgba(1, 145, 71, 0.10), rgba(1, 145, 71, 0.03));
  font-weight: 600;
}

.selected-factory-row:hover td {
  background: linear-gradient(90deg, rgba(1, 145, 71, 0.14), rgba(1, 145, 71, 0.05));
}

@media (max-width: 1100px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-subtitle-badge {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .header {
    height: 56px;
    padding: 0 14px;
  }

  .header-logo {
    height: 32px;
  }

  .header-company,
  .header-tagline,
  .badge-updated {
    display: none;
  }

  .tabs-wrapper,
  .main,
  .brand-footer {
    padding-left: 12px;
    padding-right: 12px;
  }

  .filters-bar {
    margin-top: 10px;
    padding: 12px;
  }

  .filter-group,
  .filter-select {
    width: 100%;
  }

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

  .brand-footer-inner {
    align-items: flex-start;
  }

  .brand-footer-build {
    width: 100%;
    text-align: center;
  }

  .detail-module-head {
    align-items: stretch;
  }
}

@media (max-width: 560px) {
  .header-divider,
  .header-text {
    display: none;
  }

  .tabs-wrapper {
    gap: 6px;
  }

  .tab-btn {
    padding: 8px 14px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .brand-footer img.brand-footer-logo {
    height: 26px;
  }
}
