/* Facebook Ads dashboard */

.fb-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0.25rem 0 3rem;
  min-height: calc(100dvh - 2rem);
}

.fb-panel.filters-open .fb-main {
  padding-right: 332px;
}

.fb-head-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.fb-panel.filters-collapsed .fb-head-actions .deep-rail-toggle svg {
  transform: rotate(180deg);
}

.fb-main {
  flex: 1 1 auto;
  transition: padding-right 0.22s ease;
}

.fb-panel.filters-collapsed .fb-main {
  padding-right: 0;
}

.fb-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
  transition: padding-right 0.22s ease;
}

.fb-panel.filters-open .fb-head {
  padding-right: 332px;
}

.fb-panel.filters-collapsed .fb-head {
  padding-right: 0;
}

@media (min-width: 769px) {
  .fb-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.65rem 0.75rem;
  }

  .fb-head-left {
    margin-bottom: 0;
  }

  .fb-kpis.fb-kpis-head,
  #fb-kpis.fb-kpis-head {
    min-width: 0;
    max-width: 100%;
    justify-self: stretch;
  }

  .fb-head-actions {
    justify-self: end;
    align-self: center;
  }
}

.fb-head-left {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-start;
  min-width: 0;
  margin-bottom: 0.35rem;
}

.fb-title-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.fb-title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.fb-track-select,
.fb-head-left .app-select-wrap {
  min-width: 14rem;
}

.fb-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.5rem 0.4rem;
  align-items: start;
  justify-items: center;
}

.fb-kpis-head {
  flex: 1;
  margin: 0 0.5rem;
  min-width: 0;
}

.fb-kpis-head .fb-kpi {
  max-width: 96px;
}

.fb-kpis-head .fb-kpi-label {
  font-size: 0.68rem;
  min-height: 1.45rem;
  margin-bottom: 0;
}

.fb-kpis-head .fb-kpi-delta {
  font-size: 0.57rem;
  margin-top: 0;
  min-height: 0.85rem;
}

.fb-panel.filters-open .fb-head .fb-head-actions .deep-rail-toggle {
  display: none;
}

.fb-kpi {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
  min-width: 0;
  width: 100%;
  max-width: 96px;
}

.fb-kpi-label {
  font-size: 0.68rem;
  font-weight: 500;
  color: #94a3b8;
  text-align: center;
  line-height: 1.2;
  min-height: 1.45rem;
  margin: 0;
  width: 100%;
}

.fb-kpi-ring {
  width: clamp(48px, 4.5vw, 64px);
  height: clamp(48px, 4.5vw, 64px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 20%, rgba(56, 189, 248, 0.22), rgba(8, 20, 32, 0.95));
  border: 1px solid rgba(56, 189, 248, 0.25);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.fb-kpi-ring.limit {
  background: radial-gradient(circle at 30% 20%, rgba(56, 189, 248, 0.35), rgba(8, 20, 32, 0.95));
  border-color: rgba(56, 189, 248, 0.45);
}

.fb-kpi-value {
  font-size: clamp(0.56rem, 0.68vw, 0.72rem);
  font-weight: 600;
  color: #e2e8f0;
  text-align: center;
  line-height: 1.1;
}

.fb-kpi-delta {
  font-size: 0.57rem;
  font-weight: 500;
  color: #94a3b8;
  min-height: 0.85rem;
}

.fb-kpi-delta.up { color: #4ade80; }
.fb-kpi-delta.down { color: #f87171; }

.fb-table-card {
  background: linear-gradient(145deg, rgba(11, 28, 40, 0.95), rgba(6, 14, 22, 0.98));
  border: 1px solid rgba(56, 189, 248, 0.12);
  border-radius: 14px;
  padding: 0.85rem 0.85rem 1.15rem;
}

.fb-table-wrap {
  overflow: auto;
  padding: 0.45rem 0 1.25rem;
  -webkit-overflow-scrolling: touch;
  position: relative;
  container-type: inline-size;
  container-name: fb-table;
}

.fb-name-tip {
  position: absolute;
  pointer-events: none;
  z-index: 6;
  transform: translate(-50%, -100%);
  max-width: min(92vw, 320px);
  background: rgba(8, 20, 30, 0.96);
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 10px;
  padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
  color: #e2e8f0;
  line-height: 1.35;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  white-space: normal;
  word-break: break-word;
}

.fb-data-table {
  width: 100%;
  min-width: 1180px;
  table-layout: fixed;
}

.fb-table-desktop .fb-col-name { width: 24%; min-width: 200px; }
.fb-table-desktop .fb-col-status { width: 6%; }
.fb-table-desktop .fb-col-budget { width: 8%; }
.fb-table-desktop .fb-col-spent { width: 7%; }
.fb-table-desktop .fb-col-results { width: 9%; }
.fb-table-desktop .fb-col-costPerResult { width: 7%; }
.fb-table-desktop .fb-col-pages { width: 7%; }
.fb-table-desktop .fb-col-costPerPage { width: 7%; }
.fb-table-desktop .fb-col-smartLinkClicks { width: 8%; }
.fb-table-desktop .fb-col-costPerSmartLinkClick { width: 8%; }

/* FF = blue, Elwo = yellow (source of Smart Link clicks) */
.fb-sl-metric--ff { color: #38bdf8; }
.fb-sl-metric--elwo { color: #facc15; }
.fb-sl-metric--both { color: #e2e8f0; }

.fb-table-desktop .fb-tree-label {
  overflow: visible;
  white-space: normal;
  text-overflow: unset;
  word-break: break-word;
}

.fb-data-table th,
.fb-data-table td {
  padding: 0.42rem 0.45rem;
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fb-data-table th {
  color: #94a3b8;
  font-weight: 500;
  text-align: left;
  vertical-align: middle;
  padding: 0.45rem 0.45rem 0.55rem;
  white-space: normal;
  line-height: 1.25;
  font-size: 0.66rem;
  overflow: visible;
  text-overflow: unset;
}

.fb-data-table th.num,
.fb-data-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.fb-data-table tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.02);
}

.fb-data-table tbody tr {
  cursor: pointer;
}

.fb-data-table tbody tr.fb-row-selected {
  background: rgba(56, 189, 248, 0.11) !important;
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.28);
}

.fb-tree-name {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.fb-tree-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fb-tree-label a {
  color: inherit;
  text-decoration: none;
}

.fb-tree-label a:hover {
  color: #38bdf8;
  text-decoration: underline;
}

.fb-data-table th.fb-sort-th {
  padding: 0.4rem 0.25rem 0.55rem;
  vertical-align: middle;
}

.fb-sort-btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.25rem;
  width: 100%;
  min-height: 2.35em;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1.25;
  padding: 0;
  cursor: pointer;
  text-align: inherit;
}

.fb-sort-text {
  min-width: 0;
}

.fb-data-table th.num .fb-sort-btn {
  justify-content: flex-end;
  text-align: right;
}

.fb-data-table th.num .fb-sort-text {
  text-align: right;
}

.fb-data-table th:not(.num) .fb-sort-btn {
  justify-content: flex-start;
}

.fb-sort-btn:hover {
  color: #e2e8f0;
}

.fb-sort-btn.active {
  color: #fff;
}

.fb-sort-icon {
  flex-shrink: 0;
  font-size: 0.62rem;
  line-height: 1;
  color: #38bdf8;
}

.fb-sort-btn.active .fb-sort-icon {
  color: #38bdf8;
}

.fb-tree-toggle {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: inherit;
}

.fb-tree-toggle.placeholder {
  visibility: hidden;
  pointer-events: none;
}

.fb-tree-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fb-data-table tr[data-depth="0"] .fb-tree-label {
  overflow: visible;
  text-overflow: unset;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
}

.fb-tree-label a {
  color: #38bdf8;
  text-decoration: none;
}

.fb-tree-label a:hover {
  text-decoration: underline;
}

.fb-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.fb-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.fb-status-dot.active { background: #4ade80; }
.fb-status-dot.paused { background: #facc15; }
.fb-status-dot.check { background: #60a5fa; }
.fb-status-dot.archived { background: #64748b; }

.fb-issues-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-left: 6px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.8);
  cursor: help;
}

.fb-budget-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.fb-filters-drawer {
  position: fixed;
  top: 1rem;
  right: 0;
  bottom: 0;
  width: 320px;
  z-index: 40;
  transform: translateX(0);
  transition: transform 0.22s ease;
}

.fb-panel.filters-collapsed .fb-filters-drawer,
.fb-filters-drawer.collapsed {
  transform: translateX(100%);
}

.fb-filters-panel {
  height: 100%;
  overflow-y: auto;
  overflow-x: visible;
  padding: 0.6rem 0.85rem 2.5rem;
  background: #060d16;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.fb-filter-block {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0;
  position: relative;
}

.fb-filters-panel .deep-dropdown {
  position: relative;
}

.fb-filters-panel .deep-dropdown:has(.deep-dropdown-panel:not(.hidden)) {
  z-index: 80;
}

.fb-calendar-block .range-picker-popover {
  position: static;
  width: 100%;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 0.75rem 0.7rem 0.6rem;
}

.fb-filters-drawer .filter-drawer-periods .period-btn,
.fb-filters-drawer .filter-drawer-periods .period-btn.active {
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0.25rem 0;
  color: #64748b;
  font-size: 0.74rem;
  font-weight: 500;
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
}

.fb-filters-drawer .filter-drawer-periods .period-btn.active {
  color: #fff;
}

.fb-periods-block {
  width: 100%;
}

.fb-filters-drawer .filter-drawer-periods {
  width: 100%;
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  justify-content: stretch;
  margin-bottom: 0.15rem;
}

.fb-filters-panel .deep-dropdown-panel {
  z-index: 90;
}

.fb-filter-label {
  display: block;
  font-size: 0.72rem;
  color: #94a3b8;
  margin-bottom: 0.35rem;
}

.fb-filters-panel .deep-dropdown-panel.fb-lead-dropdown {
  top: auto;
  bottom: calc(100% + 0.45rem);
  max-height: min(70vh, 420px);
  overflow-y: auto;
}

.fb-lead-sub {
  margin: 0.15rem 0 0.35rem 0.85rem;
  padding: 0.35rem 0 0.15rem;
  border-left: 2px solid rgba(56, 189, 248, 0.25);
}

.fb-lead-sub-row {
  font-size: 0.72rem;
  color: #94a3b8;
  line-height: 1.35;
}

.fb-lead-sub.hidden {
  display: none;
}

.fb-min-spent-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
  border: 2px solid rgba(56, 189, 248, 0.35);
  background: rgba(255, 255, 255, 0.03);
  color: #e2e8f0;
  font-size: 0.82rem;
}

.fb-min-spent-input::placeholder {
  color: #64748b;
}

.fb-min-spent-input:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.65);
}

.fb-lead-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.08rem 0.4rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.28);
  vertical-align: middle;
  white-space: nowrap;
}

.fb-status-with-select {
  gap: 0.4rem;
  max-width: 100%;
}

.fb-status-select {
  min-width: 6.5rem;
  max-width: 8.5rem;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: rgba(6, 13, 22, 0.85)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E")
    no-repeat right 0.45rem center / 10px;
  color: #e2e8f0;
  font: inherit;
  font-size: 0.72rem;
  line-height: 1.2;
  padding: 0.22rem 1.35rem 0.22rem 0.45rem;
  cursor: pointer;
}

.fb-status-select:hover,
.fb-status-select:focus {
  border-color: rgba(56, 189, 248, 0.45);
  outline: none;
}

.fb-status-select:disabled {
  opacity: 0.55;
  cursor: wait;
}

.fb-budget-cell.updating {
  opacity: 0.55;
}

.fb-budget-cell.updating .fb-budget-edit {
  visibility: hidden;
}

.fb-budget-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: fb-budget-spin 0.7s linear infinite;
  vertical-align: middle;
}

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

.fb-meta-note {
  margin: 0.5rem 0 0;
  font-size: 0.72rem;
  color: #fbbf24;
}

.fb-meta-note.fb-sync-info {
  color: #94a3b8;
}

.fb-ff-warnings {
  margin-top: auto;
  padding: 0.75rem 0 0;
  font-size: 0.62rem;
  line-height: 1.4;
  color: rgba(148, 163, 184, 0.28);
  flex-shrink: 0;
}

.fb-panel.filters-open .fb-ff-warnings {
  padding-right: 332px;
}

.fb-update-substatus {
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.55);
}

.fb-breakdowns-card {
  margin-top: 1rem;
}

.fb-breakdowns-body {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(200px, 1fr);
  gap: 1rem;
  align-items: start;
}

.fb-breakdowns-countries {
  min-width: 0;
}

.fb-breakdowns-platforms {
  min-width: 0;
  padding: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  padding-left: 0.85rem;
}

.fb-country-map-wrap {
  margin: 0.35rem 0 0;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.12);
  padding: 0.65rem 0.75rem;
  overflow: hidden;
  max-width: 100%;
}

.fb-country-map-wrap canvas {
  display: block;
  width: 100% !important;
  max-width: 100%;
}

.fb-platform-pie-wrap {
  margin-top: 0.35rem;
}

.fb-platform-pie-wrap canvas {
  cursor: pointer;
}

.fb-budget-cbo {
  color: #94a3b8;
  font-size: 0.68rem;
  font-weight: 500;
  white-space: nowrap;
}

.fb-budget-edit {
  border: none;
  background: transparent;
  color: inherit;
  opacity: 0.45;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
}

.fb-budget-edit:hover {
  opacity: 1;
}

.fb-chart-card {
  margin-top: 1rem;
  padding: 1rem 1.1rem 1.1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
}

.fb-track-rollup {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.35rem;
}

.fb-track-rollup-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.fb-track-rollup-label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 0.75rem;
}

.fb-track-rollup-name {
  font-weight: 650;
  color: #e2e8f0;
  font-size: 0.92rem;
}

.fb-track-rollup-meta {
  color: #94a3b8;
  font-size: 0.82rem;
}

.fb-track-rollup-bar-wrap {
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  overflow: hidden;
}

.fb-track-rollup-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
}

.fb-chart-toolbar {
  margin-bottom: 0.65rem;
}

.fb-chart-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: start;
}

.fb-chart-body.fb-chart-body--with-ring {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 1rem;
}

.fb-chart-primary {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.fb-chart-scope-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin: 0.5rem 0 0.35rem;
}

.fb-chart-metrics,
.fb-chart-scope {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.fb-chart-scope-label {
  font-size: 0.72rem;
  color: #64748b;
  margin-right: 0.15rem;
}

.fb-chart-metric-btn,
.fb-chart-scope-btn {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent;
  color: #94a3b8;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.fb-chart-metric-btn.active,
.fb-chart-scope-btn.active {
  color: #e2e8f0;
  background: rgba(56, 189, 248, 0.18);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.35);
  border-color: transparent;
}

.fb-chart-metric-btn:hover:not(.active),
.fb-chart-scope-btn:hover:not(.active):not(:disabled) {
  color: #cbd5e1;
}

.fb-chart-scope-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.fb-chart-context {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
}

.fb-chart-wrap {
  min-height: 220px;
}

.fb-chart-wrap canvas {
  width: 100%;
  height: 220px;
  cursor: crosshair;
}

.fb-chart-primary > .fb-chart-legend {
  margin-top: 0.35rem;
}

.fb-chart-legend .deep-legend-item {
  max-width: 100%;
}

.fb-chart-ring-panel {
  min-width: 0;
  padding: 0.15rem 0 0 0.85rem;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.fb-chart-ring-panel.hidden {
  display: none;
}

.fb-ff-services-card.hidden {
  display: none;
}

.fb-ff-services-card {
  margin-top: 1rem;
}

.fb-ff-chart-title {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: #e2e8f0;
}

.fb-ff-pie-wrap {
  min-height: 220px;
}

.fb-ff-pie-wrap canvas {
  cursor: pointer;
}

.fb-ff-pie-legend {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.fb-ff-pie-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #cbd5e1;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.fb-ff-pie-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.fb-ff-pie-item.active {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.08);
}

.fb-ff-pie-item-left {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.fb-ff-pie-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.fb-ff-pie-meta {
  color: #94a3b8;
  font-size: 0.82rem;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .fb-ff-charts-row {
    grid-template-columns: 1fr;
  }

  .fb-chart-body.fb-chart-body--with-ring {
    grid-template-columns: 1fr;
  }

  .fb-breakdowns-body {
    grid-template-columns: 1fr;
  }

  .fb-breakdowns-platforms {
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.85rem 0 0;
    margin-top: 0.65rem;
  }

  .fb-chart-ring-panel {
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.85rem 0 0;
    margin-top: 0.65rem;
  }
}

@media (max-width: 1280px) {
  .fb-head {
    flex-wrap: wrap;
  }

  .fb-kpis-head {
    order: 3;
    flex-basis: 100%;
    margin: 0.4rem 0 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

@media (max-width: 768px) {
  .fb-panel {
    padding-top: 0.35rem;
  }

  .fb-panel.filters-open .fb-ff-warnings {
    padding-right: 0;
  }

  .fb-head {
    position: relative;
    flex-wrap: wrap;
    gap: 0.55rem;
  }

  .fb-title {
    display: none;
  }

  /* No in-page title row on mobile (title is in topbar) */
  .fb-title-row {
    display: none;
  }

  .fb-head-left {
    width: 100%;
    flex: 1 1 100%;
    order: 1;
    align-items: stretch;
    margin-bottom: 0.35rem;
  }

  .fb-head-left .app-select-wrap,
  .fb-track-select {
    width: 100%;
    min-width: 0;
    display: block;
  }

  .fb-kpis-head {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    flex: 1 1 100%;
    order: 2;
    margin: 0.5rem 0 0;
    padding-bottom: 0.35rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }

  .fb-kpis-head::-webkit-scrollbar {
    display: none;
  }

  .fb-kpis-head .fb-kpi {
    flex: 0 0 25%;
    max-width: none;
    scroll-snap-align: start;
  }

  .fb-kpi-ring {
    width: min(20vw, 74px);
    height: min(20vw, 74px);
  }

  .fb-kpi-value {
    font-size: 0.67rem;
  }

  .fb-kpi-label {
    font-size: 0.57rem;
    min-height: 1.1rem;
  }

  .fb-kpi-delta {
    font-size: 0.57rem;
  }

  .fb-filters-drawer {
    width: min(100%, 340px);
  }

  .fb-panel.filters-open .fb-main,
  .fb-panel.filters-open .fb-head {
    padding-right: 0;
  }

  .fb-panel.filters-open .fb-head .fb-head-actions {
    display: none;
  }

  .fb-chart-card {
    gap: 0;
  }

  .fb-chart-toolbar {
    margin-bottom: 0.45rem;
  }

  .fb-chart-scope {
    width: 100%;
    gap: 0.3rem 0.35rem;
  }

  .fb-chart-scope-label {
    display: none;
  }

  #fb-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    z-index: 39;
    display: none;
  }

  body.fb-filters-open #fb-drawer-backdrop {
    display: block;
  }

  .fb-filters-drawer {
    transform: translateX(110%);
    top: 1rem;
    height: calc(100dvh - 1rem);
    border-radius: 18px 18px 0 0;
    width: 100%;
  }

  body.fb-filters-open .fb-filters-drawer:not(.collapsed) {
    transform: translateX(0);
  }

  .fb-data-table {
    min-width: calc(50cqw + 480px);
    font-size: 0.78rem;
  }

  .fb-data-table th,
  .fb-data-table td {
    padding: 0.38rem 0.4rem;
  }

  .fb-table-mobile thead th {
    position: relative;
    z-index: 1;
    background: transparent;
    color: #94a3b8;
  }

  .fb-table-mobile .fb-col-name {
    position: sticky;
    left: 0;
    z-index: 2;
    width: 50cqw;
    min-width: 50cqw;
    max-width: 50cqw;
    background: linear-gradient(145deg, rgba(11, 28, 40, 0.98), rgba(6, 14, 22, 0.99));
    box-shadow: 1px 0 0 rgba(255, 255, 255, 0.06);
  }

  .fb-table-mobile thead .fb-col-name {
    z-index: 5;
    background: linear-gradient(145deg, rgba(11, 28, 40, 0.99), rgba(6, 14, 22, 1));
    color: #94a3b8;
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.35);
  }

  .fb-table-mobile tbody tr:nth-child(odd) .fb-col-name {
    background: linear-gradient(145deg, rgba(13, 32, 46, 0.98), rgba(8, 18, 28, 0.99));
  }

  .fb-table-mobile tbody tr.fb-row-selected .fb-col-name {
    background: rgba(14, 36, 52, 0.98);
  }

  .fb-table-mobile .fb-tree-name {
    min-width: 0;
    overflow: hidden;
  }

  .fb-table-mobile .fb-tree-label {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .fb-table-mobile .fb-tree-label a {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .fb-table-mobile .fb-col-costPerResult,
  .fb-table-mobile .fb-col-spent,
  .fb-table-mobile .fb-col-budget,
  .fb-table-mobile .fb-col-pages,
  .fb-table-mobile .fb-col-costPerPage {
    width: 72px;
  }

  .fb-table-mobile .fb-col-smartLinkClicks,
  .fb-table-mobile .fb-col-costPerSmartLinkClick {
    width: 72px;
  }

  .fb-table-mobile .fb-col-results {
    width: 56px;
  }

  .fb-table-mobile .fb-col-status {
    width: 64px;
    white-space: nowrap;
  }

  .fb-tree-toggle {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
  }
}
