/* ============================================================
   Analytics Dashboard — KPIs  (Responsive)
   Proportional fluid layout of Figma node 36:77
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f9fafb;
  color: #111827;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.dashboard {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #f9fafb;
}

/* ============================================================
   TOP ADVERTISEMENT BAR
   ============================================================ */
.top-bar {
  position: relative;
  width: 100%;
  height: 98px;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  padding: 0 20px;
  flex-shrink: 0;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  height: 41px;
}

.logo-img {
  display: block;
  height: 100%;
  width: auto;
  object-fit: contain;
}

/* Advertisement text — centered */
.ad-space {
  flex: 1;
  text-align: center;
  font-size: 14px;
  color: #4B5563;
}

/* Notification button */
.notification-btn {
  position: relative;
  width: 30px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 9999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 18px;
  flex-shrink: 0;
}

.notification-dot {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 8px;
  background: #EF4444;
  border-radius: 9999px;
}

/* Avatar button */
.avatar-btn {
  position: relative;
  width: 48px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.avatar-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  background:
    radial-gradient(circle at 50% 38%, #E8B896 0%, #E8B896 14%, transparent 14%),
    radial-gradient(ellipse at 50% 85%, #374151 0%, #374151 40%, transparent 40%),
    linear-gradient(135deg, #94A3B8 0%, #64748B 100%);
}

.avatar-chevron {
  position: absolute;
  top: 10px;
  left: 36px;
}

/* ============================================================
   NAV HEADER
   ============================================================ */
.nav-header {
  position: relative;
  width: 100%;
  height: 67px;
  background: #f9fafb;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  padding: 0 20px 0 15px;
  flex-shrink: 0;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 34px;
  flex: 1;
  min-width: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-size: 16px;
  color: #374151;
  font-weight: 400;
  padding: 10px 0;
  line-height: 16px;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-item.active {
  background: #eff6ff;
  color: #2563EB;
  border-radius: 9999px;
  padding: 10px 20px;
  font-weight: 400;
}

.nav-item .msi {
  font-size: 20px;
}

.nav-item.ai-item {
  color: #8B5CF6;
  font-weight: 500;
}

/* Right-side nav actions */
.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.search-wrap {
  position: relative;
  width: 256px;
  height: 46px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 16px;
  transform: translateY(-50%);
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  padding: 0 40px 0 40px;
  font-size: 16px;
  color: #111827;
  font-family: inherit;
}

.search-input::placeholder {
  color: #ADAEBC;
  font-size: 16px;
}

.search-filter {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   APP BODY = SIDEBAR + CONTENT
   ============================================================ */
.app-body {
  display: flex;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: 91px;
  flex-shrink: 0;
  background: #eff6ff;
  border-right: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  padding: 44px 21px;
}

.sidebar-icons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* ---- Material Symbols (Rounded) helper class ---- */
.msi {
  font-family: 'Material Symbols Rounded';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none;
}

.msi-fill {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.side-btn {
  position: relative;
  width: 49px;
  height: 44px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 8px;
  padding: 0;
  flex-shrink: 0;
  color: #4b5563;
  transition: background 120ms ease, color 120ms ease;
}

.side-btn:hover { color: #1f2937; }

.side-btn-active {
  background: #dbeafe;
  color: #2563eb;
}

.side-btn-active:hover { color: #2563eb; }

.side-btn svg { display: block; }

.badge {
  position: absolute;
  top: -6px;
  right: -4px;
  min-width: 23px;
  height: 20px;
  padding: 0 6px;
  background: #f3f4f6;
  color: #4B5563;
  font-size: 12px;
  font-weight: 500;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.content {
  flex: 1;
  min-width: 0;
  background: #fff;
  padding: 31px 43px 60px 33px;
}

.content-inner {
  width: 100%;
}

/* Title */
.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.page-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  line-height: 1;
  letter-spacing: -0.4px;
}

.title-chevron {
  display: block;
}

/* Tabs */
.tabs-row {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 53px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 30px;
  padding: 0 10px;
}

.tab {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 13px;
  font-size: 18px;
  font-weight: 600;
  color: #3c424f;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  text-decoration: none;
}

.tab-active {
  color: #2563EB;
  border-bottom: 2px solid #2563EB;
  margin-bottom: -1px;
}

/* Filters row */
.filters-row {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 45px;
}

.ghost-filter {
  height: 36px;
  padding: 0 14px;
  background: #f3f4f6;
  border: 1px solid #ebebeb;
  border-radius: 6px;
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #3c3c3c;
  width: 141px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}

.dd-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.dd-label {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  line-height: 1;
}

.dd-select {
  height: 38px;
  padding: 7px 13px;
  background: transparent;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.dd-placeholder {
  font-size: 16px;
  color: #6B7280;
  line-height: 24px;
}

.dd-value {
  font-size: 16px;
  color: #1F2937;
  line-height: 24px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Date filter pushed right */
.date-filter {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.date-select {
  width: 237px;
  height: 38px;
  padding: 7px 13px;
  gap: 25px;
}

.date-text {
  font-size: 12px;
  color: #3c424f;
  white-space: nowrap;
}

.info-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}

/* ============================================================
   KPI SECTIONS
   ============================================================ */
.kpi-section {
  margin: 0 0 45px 0;
}

.kpi-section:last-of-type { margin-bottom: 0; }

.section-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.section-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.2;
}

.section-sub {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: #6e7788;
  line-height: 1.3;
}

/* Cards row — responsive proportional flex */
.cards-row {
  display: flex;
  align-items: stretch;
  gap: 24px;
  width: 100%;
}

/* Card proportions: small=257, wide=449.5 */
.card {
  position: relative;
  height: 253px;
  background: #fff;
  border-radius: 15px;
  box-shadow: 0 6px 17px -5px rgba(58, 77, 233, 0.15);
  padding: 20px 20px 16px 20px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.card-small {
  flex: 0 0 300px;
  min-width: 230px;
}

/* Wide card width = (row - small_card - 2*gap) / 2
   so rows 2 and 3 (2 wide + 1 small) fill flush. */
.card-wide {
  flex: 0 0 calc((100% - 348px) / 2);
  min-width: 340px;
}

/* Card head */
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
}

.card-head-col {
  position: relative;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
}

.card-head-col .head-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.card-label {
  font-size: 15px;
  color: #000;
  font-weight: 400;
  line-height: 1.2;
  white-space: nowrap;
}

.card-big {
  font-size: 30px;
  font-weight: 600;
  color: #000;
  line-height: 1.15;
  white-space: nowrap;
}

.card-big-muted { color: #a5a2a2; }

.card-big.na,
.na {
  font-size: 28px;
  font-weight: 600;
  color: #a5a2a2;
  line-height: 1.15;
  margin-top: 6px;
  white-space: nowrap;
}

/* When .chart-wrap directly follows the inline N/A label,
   tighten the spacing and shrink the chart to fit the 253px card. */
.card-big.na + .chart-wrap {
  margin-top: 2px;
  height: 110px;
}

/* Pill */
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}

.pill-green {
  background: #dcfce7;
  color: #166534;
}

.pill-tr {
  position: absolute;
  top: 0;
  right: 0;
}

/* Gauge — ApexCharts radialBar host */
.gauge {
  position: relative;
  margin: 0 auto;
  width: 100%;
  max-width: 280px;
  height: 168px;
  flex: 0 0 auto;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gauge .apexcharts-canvas {
  margin: 0 auto;
}

/* Chart wrap — ApexCharts sparkline host */
.chart-wrap {
  position: relative;
  margin-top: 12px;
  height: 150px;
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  border-radius: 4px;
}

.chart-offset { margin-top: 0; }

.chart-offset-low {
  height: 80px !important;
  margin-top: 40px;
}

/* Make sure the chart's SVG can never exceed the host width */
.chart-wrap .apexcharts-canvas,
.chart-wrap .apexcharts-canvas svg {
  max-width: 100% !important;
}

.chart-offset { margin-top: 0; }

.chart-offset-low {
  height: 80px;
  margin-top: 40px;
  flex: 0 0 auto;
}

/* Card foot */
.card-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: #000;
  padding-top: 8px;
}

.card-foot.single { justify-content: center; gap: 5px; }
.card-foot.single.right { justify-content: flex-end; gap: 5px; }

.card-foot.two {
  justify-content: space-between;
}

.card-foot.two.small-gap {
  justify-content: space-between;
}

.foot-pair {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.foot-label { opacity: 0.5; }
.foot-val { opacity: 1; }

/* ============================================================
   TRENDS TAB — labeled filters + chart cards
   ============================================================ */

/* Stack label above input on Trends */
.trends-filters .dd-group {
  flex-direction: column-reverse; /* label sits below in source so reversed */
  align-items: flex-start;
  gap: 8px;
}

.trends-filters .dd-label {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  line-height: 1;
}

.trends-filters .dd-placeholder {
  color: rgba(31, 41, 55, 0); /* placeholder hidden in Figma — kept invisible */
}

/* Chart card */
.trend-card {
  background: #fff;
  border: 1px solid #e6eaf0;
  border-radius: 14px;
  box-shadow: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  padding: 22px 24px 18px 24px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
}

.trend-card:hover {
  border-color: #d9dee6;
  box-shadow: 0 6px 20px -10px rgba(15, 23, 42, 0.10);
}

.trend-card:last-of-type { margin-bottom: 0; }

/* Header — title + values + legend */
.trend-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
}

.trend-titles {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.trend-title {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  line-height: 20px;
  letter-spacing: -0.01em;
}

.trend-values {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.trend-current {
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
  line-height: 36px;
  letter-spacing: -0.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.trend-last {
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.trend-last b { color: #64748b; font-weight: 600; }

.trend-last b {
  font-weight: 700;
}

.trend-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
  padding-top: 4px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #475569;
  font-weight: 500;
  white-space: nowrap;
}

.legend-line {
  display: none;
}

.legend-line-blue, .legend-line-green { background: transparent; }

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: currentColor;
  border: 0;
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 3px rgba(15, 23, 42, 0.04);
}

.legend-dot-blue { color: #2563eb; }
.legend-dot-green { color: #10b981; }

/* Trend chart host — ApexCharts area chart container */
.trend-chart-host {
  width: 100%;
  min-width: 0;
  margin-top: 4px;
}

/* ============================================================
   APEXCHARTS TOOLTIP OVERRIDES
   white background + drop shadow to match Figma .hover-stat
   ============================================================ */
.apexcharts-tooltip.apexcharts-theme-light {
  background: #ffffff !important;
  border: 1px solid #e6eaf0 !important;
  border-radius: 10px !important;
  box-shadow: 0 12px 24px -8px rgba(15, 23, 42, 0.14),
              0 2px 6px 0 rgba(15, 23, 42, 0.06) !important;
  font-family: 'Inter', sans-serif !important;
  overflow: hidden;
  color: #0f172a;
  padding: 0 !important;
}

.apexcharts-tooltip.apexcharts-theme-light .apexcharts-tooltip-title {
  background: #ffffff !important;
  border-bottom: 1px solid #f1f5f9 !important;
  color: #94a3b8 !important;
  font-size: 10.5px !important;
  font-weight: 600 !important;
  padding: 9px 14px 6px !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase;
  margin: 0 !important;
  font-family: 'Inter', sans-serif !important;
}

.apexcharts-tooltip-series-group {
  padding: 3px 14px !important;
  background: transparent !important;
}

.apexcharts-tooltip-series-group:first-of-type { padding-top: 6px !important; }
.apexcharts-tooltip-series-group:last-of-type  { padding-bottom: 8px !important; }

.apexcharts-tooltip-series-group.apexcharts-active {
  display: flex !important;
  align-items: center;
}

.apexcharts-tooltip-text {
  font-size: 12.5px !important;
  color: #0f172a !important;
  font-variant-numeric: tabular-nums;
}

.apexcharts-tooltip-text-y-label {
  font-weight: 500 !important;
  color: #475569 !important;
}

.apexcharts-tooltip-text-y-value,
.apexcharts-tooltip-text-goals-value,
.apexcharts-tooltip-text-z-value {
  font-weight: 600 !important;
  color: #0f172a !important;
}

.apexcharts-tooltip-marker {
  width: 8px !important;
  height: 8px !important;
  border-radius: 9999px !important;
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 3px rgba(15, 23, 42, 0.06);
}

/* xaxis crosshair vertical guide line */
.apexcharts-xcrosshairs {
  stroke: #94a3b8 !important;
  stroke-dasharray: 3 3 !important;
  opacity: 0.5 !important;
}

/* Axis tick + label refinements */
.apexcharts-xaxis-label,
.apexcharts-yaxis-label {
  fill: #94a3b8 !important;
  font-family: 'Inter', sans-serif !important;
}

/* Datalabels: tighter typography */
.apexcharts-datalabel {
  font-family: 'Inter', sans-serif !important;
}

/* Trends responsive tweaks */
@media (max-width: 1024px) {
  .trend-card { padding: 24px 20px 20px 20px; }
  .trend-current { font-size: 26px; line-height: 36px; }
}

@media (max-width: 768px) {
  .trend-head {
    flex-direction: column;
    gap: 12px;
  }
  .trend-legend { padding-top: 0; }
  .trend-current { font-size: 24px; line-height: 32px; }
  .trend-title { font-size: 16px; }
}

/* ============================================================
   MONTHLY FINANCIAL ACTIVITY (mfa.html)
   ============================================================ */

.mfa-card {
  background: #fff;
  border: 1px solid #e6eaf0;
  border-radius: 14px;
  box-shadow: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  margin-bottom: 24px;
  overflow: visible;
}

.mfa-card:hover {
  border-color: #d9dee6;
  box-shadow: 0 6px 20px -10px rgba(15, 23, 42, 0.10);
}

.mfa-card:last-of-type { margin-bottom: 0; }

.mfa-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 16px 22px;
  gap: 16px;
  flex-wrap: wrap;
}

.mfa-title {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  line-height: 20px;
  letter-spacing: -0.01em;
}

.mfa-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.10);
  color: #2563eb;
  flex-shrink: 0;
}

.mfa-title-icon svg { display: block; }

.mfa-title-icon.green  { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.mfa-title-icon.amber  { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.mfa-title-icon.orange { background: rgba(249, 115, 22, 0.12); color: #f97316; }
.mfa-title-icon.rose   { background: rgba(244, 63, 94, 0.12);  color: #f43f5e; }
.mfa-title-icon.sky    { background: rgba(14, 165, 233, 0.12); color: #0ea5e9; }
.mfa-title-icon.slate  { background: rgba(100, 116, 139, 0.12); color: #64748b; }

.mfa-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Year toggle pill group */
.year-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.year-btn {
  height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #374151;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms, color 120ms, border-color 120ms;
  white-space: nowrap;
}

.year-btn:hover { background: #f9fafb; }

.year-btn.year-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.year-btn.year-active:hover { background: #1d4ed8; }

/* View dropdown */
.view-dropdown {
  position: relative;
  display: inline-block;
}

.view-select {
  height: 36px;
  padding: 0 14px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #3c3c3c;
  cursor: pointer;
  min-width: 108px;
  white-space: nowrap;
}

.view-select-wide { min-width: 161px; }

.view-select:hover { background: #f9fafb; }

.view-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 100%;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 8px 24px -4px rgba(13, 10, 44, 0.16),
              0 2px 6px 0 rgba(13, 10, 44, 0.06);
  padding: 4px;
  display: none;
  z-index: 50;
}

.view-menu.open { display: block; }

.view-option {
  display: block;
  width: 100%;
  padding: 8px 14px;
  background: transparent;
  border: 0;
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.view-option:hover { background: #f3f4f6; color: #2563eb; }

/* View toggling: hide the inactive one */
.mfa-card[data-view="grid"] .view-chart,
.mfa-card[data-view="chart"] .view-grid {
  display: none;
}

/* Table */
.mfa-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-top: 1px solid #e5e7eb;
}

.mfa-table {
  width: 100%;
  min-width: 1100px;
  border-collapse: separate;
  border-spacing: 0;
}

.mfa-table thead {
  background: #f9fafb;
}

.mfa-table thead th {
  padding: 14px 16px;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  white-space: nowrap;
  border-bottom: 1px solid #e5e7eb;
}

.mfa-table thead th:first-child { padding-left: 24px; }
.mfa-table thead th:last-child { padding-right: 24px; }

.mfa-table tbody td {
  padding: 20px 16px;
  font-size: 14px;
  font-weight: 400;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.mfa-table tbody td:first-child { padding-left: 24px; }
.mfa-table tbody td:last-child { padding-right: 24px; }

.mfa-table tbody tr:last-child td { border-bottom: 0; }

.mfa-table tbody tr:hover { background: #fafbfc; }

.mfa-table-summary {
  min-width: 800px;
}

/* Chart view container */
.mfa-card .view-chart {
  padding: 8px 16px 24px 16px;
}

.mfa-card .chart-host {
  width: 100%;
  min-height: 360px;
}

/* Shared legend row under chart */
.mfa-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding-top: 12px;
}

.legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #475569;
  font-weight: 500;
  white-space: nowrap;
}

.ldot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  display: inline-block;
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 3px rgba(15, 23, 42, 0.05);
}

/* KPI dropdown — taller list, scrollable when needed */
.kpi-dropdown .view-select { min-width: 240px; }
.kpi-dropdown .kpi-menu {
  min-width: 260px;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
}

/* KPI chart card body */
.kpi-chart-wrap {
  padding: 12px 16px 24px 16px;
}

.kpi-chart-wrap .chart-host {
  width: 100%;
  min-height: 280px;
}

/* ============================================================
   SUBTABS — refined segment control (used inside a page)
   Tight, app-shell aesthetic with a faint container border for
   definition and a crisp white-on-shadow active pill.
   ============================================================ */
.subtabs {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 9px;
  border: 1px solid #e2e8f0;
  margin-bottom: 22px;
  gap: 2px;
  box-shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.03) inset;
}

.subtab {
  padding: 6px 14px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: -0.01em;
  transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.subtab:hover { color: #334155; }

.subtab-active {
  background: #ffffff;
  color: #2563eb;
  font-weight: 600;
  box-shadow:
    0 1px 2px 0 rgba(15, 23, 42, 0.08),
    0 0 0 1px rgba(15, 23, 42, 0.04);
}

.subtab-active:hover { color: #2563eb; }

/* ============================================================
   AR PAGE — chart pane (grid/chart toggle)
   ============================================================ */
.ar-chart-pane {
  padding: 16px 16px 24px 16px;
}

.ar-chart-pane .chart-host {
  width: 100%;
  min-height: 360px;
}

/* Compact MFA table for AR pages */
.mfa-table-compact { min-width: 720px; }
.mfa-table-compact thead th { padding: 12px 14px; font-size: 13px; }
.mfa-table-compact tbody td { padding: 14px 14px; font-size: 13px; }

/* Total row at the bottom of a table */
.mfa-table tbody tr.row-total td {
  background: #f9fafb;
  font-weight: 600;
  color: #111827;
  border-top: 1px solid #e5e7eb;
}

.mfa-table tbody tr.row-total:hover td { background: #f9fafb; }

/* Subtitle inside a card title */
.mfa-sub {
  font-size: 14px;
  font-weight: 400;
  color: #6b7280;
  margin-left: 6px;
}


/* AR responsive */
@media (max-width: 768px) {
  .subtabs { width: 100%; overflow-x: auto; }
  .subtab { padding: 8px 14px; font-size: 13px; }
}

/* MFA responsive */
@media (max-width: 1024px) {
  .mfa-head { flex-direction: column; align-items: flex-start; }
  .mfa-actions { width: 100%; justify-content: flex-start; }
}

@media (max-width: 768px) {
  .year-toggle { gap: 6px; }
  .year-btn { padding: 0 12px; font-size: 13px; }
  .view-select { min-width: 96px; font-size: 13px; }
  .mfa-table thead th, .mfa-table tbody td { padding: 12px; font-size: 13px; }
  .mfa-legend { gap: 16px; }
}

/* ============================================================
   FOOTER
   ============================================================ */
.foot {
  width: 100%;
  height: 53px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  display: flex;
  align-items: center;
  padding: 16px 96px;
  justify-content: space-between;
  font-size: 14px;
  color: #6b7280;
  flex-shrink: 0;
}

.foot-copy { flex: 0 0 auto; }

.foot-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

.foot-time { color: #6b7280; }

.foot-links {
  display: flex;
  gap: 18px;
}

.foot-links a {
  color: #6b7280;
  text-decoration: none;
}

.foot-links a:hover { color: #374151; }

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* Slightly smaller desktops */
@media (max-width: 1280px) {
  .main-nav { gap: 24px; }
  .content { padding: 28px 24px 48px 24px; }
  .foot { padding: 16px 40px; }
}

/* Tablets — reduce sidebar, stack cards */
@media (max-width: 1024px) {
  .nav-right { gap: 6px; }
  .search-wrap { width: 200px; }

  .cards-row {
    flex-wrap: wrap;
    gap: 20px;
  }
  .card-small, .card-wide {
    flex: 1 1 280px;
    min-width: 260px;
  }
  .foot { padding: 16px 24px; }
  .foot-links { gap: 12px; }
}

/* Small tablets and large phones */
@media (max-width: 768px) {
  .top-bar { padding: 0 12px; height: 80px; }
  .ad-space { font-size: 13px; }

  .nav-header { padding: 0 12px; }
  .main-nav { gap: 14px; }
  .nav-item { font-size: 14px; }
  .nav-item.active { padding: 8px 14px; }
  .search-wrap { display: none; }

  .sidebar { width: 64px; padding: 28px 8px; }
  .side-btn { width: 48px; height: 40px; }

  .content { padding: 20px 16px 40px 16px; }
  .page-title { font-size: 20px; }

  .tabs-row { gap: 16px; }
  .tab { font-size: 15px; padding: 8px 8px; }

  .filters-row {
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 32px;
  }
  .date-filter { margin-left: 0; }

  .cards-row {
    flex-direction: column;
    gap: 16px;
  }
  .card-small, .card-wide {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
  }

  .foot {
    flex-direction: column;
    height: auto;
    padding: 16px;
    gap: 8px;
    text-align: center;
  }
}
