.advanced-body {
  min-height: 100vh;
  align-items: start;
  overflow-y: auto;
}

.dashboard-topbar {
  min-height: 118px;
}

.dashboard-filters,
.dashboard-panel {
  border: 1px solid rgba(0, 83, 84, .12);
  border-radius: 18px;
  background: rgba(255, 255, 255, .7);
  box-shadow: 0 22px 54px rgba(0, 83, 84, .14);
  backdrop-filter: blur(16px);
}

.dashboard-filters {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  padding: 22px;
  overflow: auto;
}

.dashboard-kicker {
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-title {
  display: block;
  max-width: 100%;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: clamp(26px, 2.5vw, 38px);
  line-height: 1;
  text-transform: none;
}

.dashboard-filters h1 {
  margin: -6px 0 4px;
  font-size: clamp(34px, 3.5vw, 48px);
  line-height: 1;
}

.filter-primary {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 12px 22px rgba(241, 19, 85, .24);
}

.filter-secondary {
  color: var(--accent);
  background: rgba(241, 19, 85, .1);
}

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

.metric {
  min-height: 90px;
  padding: 16px;
  border-radius: 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 16px 34px rgba(0, 83, 84, .1);
}

.metric span {
  display: block;
  color: rgba(0, 83, 84, .72);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 8px;
  color: var(--accent);
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1;
}

.dashboard-panel {
  min-width: 0;
  min-height: 0;
  padding: 18px;
  overflow: hidden;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  font-weight: 900;
}

.panel-title span {
  font-size: 18px;
}

.panel-title strong {
  color: var(--accent);
  font-size: 24px;
}

.bar-chart {
  display: grid;
  gap: 10px;
  max-height: calc(100% - 40px);
  overflow: auto;
  padding-right: 4px;
}

.bar-row-dashboard {
  display: grid;
  grid-template-columns: minmax(92px, 168px) 1fr 48px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 900;
}

.bar-row-dashboard span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-row-dashboard .track {
  height: 13px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(0, 83, 84, .13);
}

.bar-row-dashboard i {
  display: block;
  width: var(--w);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #ff7e9d);
}

.bar-row-dashboard strong {
  text-align: right;
}

.year-chart {
  height: calc(100% - 40px);
  min-height: 150px;
  display: flex;
  align-items: end;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 2px 0;
}

.year-bar {
  min-width: 38px;
  height: 100%;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  gap: 7px;
  text-align: center;
  font-size: 11px;
  font-weight: 900;
}

.year-bar i {
  width: 100%;
  height: var(--h);
  min-height: 6px;
  display: block;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, #ff7e9d, var(--accent));
}

.table-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.report-table-wrap {
  min-height: 0;
  overflow: auto;
  border-radius: 12px;
  background: rgba(255, 255, 255, .52);
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-weight: 800;
}

.report-table th,
.report-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0, 83, 84, .08);
  text-align: left;
  vertical-align: top;
}

.report-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #fff;
  background: var(--ink);
  font-size: 12px;
  text-transform: uppercase;
}

.report-table td:nth-child(5) {
  min-width: 280px;
}

.empty-row {
  text-align: center;
  color: rgba(0, 83, 84, .68);
}

.advanced-shell {
  height: auto;
  min-height: calc(100vh - clamp(20px, 2.9vw, 48px));
  overflow: visible;
}

.advanced-page {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 350px) minmax(0, 1fr);
  gap: clamp(18px, 2.4vw, 34px);
}

.advanced-filters {
  gap: 16px;
}

.advanced-block {
  min-height: 0;
  display: grid;
  gap: 8px;
}

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 900;
}

.block-head button,
.small-action,
.rule-remove {
  border: 0;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(241, 19, 85, .1);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
}

.block-head button,
.small-action {
  min-height: 32px;
  padding: 0 12px;
}

.compact-search {
  width: 100%;
  min-height: 38px;
  border: 1.5px solid rgba(0, 83, 84, .18);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, .82);
  font: inherit;
  font-size: 13px;
  outline: 0;
}

.check-list {
  max-height: 140px;
  display: grid;
  gap: 6px;
  overflow: auto;
  padding-right: 4px;
}

.type-list {
  max-height: 220px;
}

.check-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: start;
  column-gap: 8px;
  padding: 8px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .55);
  font-size: 12px;
  line-height: 1.25;
  font-weight: 900;
}

.check-item input {
  width: 16px;
  height: 16px;
  margin: 0;
  transform: translateY(1px);
  accent-color: var(--accent);
}

.check-item span {
  display: block;
  min-width: 0;
}

.advanced-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.advanced-actions button {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  font-weight: 900;
}

.advanced-content {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(260px, auto) minmax(260px, auto) minmax(320px, auto);
  gap: 16px;
}

.rules-panel {
  display: grid;
  grid-template-rows: auto auto;
  overflow: visible;
}

.rules-list {
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow: visible;
  padding-right: 4px;
}

.rule-card {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) minmax(110px, .65fr) minmax(110px, .65fr) auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0, 83, 84, .07);
}

.rule-card label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 900;
}

.rule-card select {
  width: 100%;
  min-height: 40px;
  border: 1.5px solid rgba(0, 83, 84, .18);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, .84);
  font: inherit;
  font-size: 13px;
  outline: 0;
}

.rule-card select[multiple] {
  height: 72px;
  min-height: 72px;
  overflow: auto;
}

.rule-remove {
  width: 36px;
  height: 36px;
  margin-bottom: 2px;
}

.advanced-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.advanced-shell .chart-panel,
.advanced-shell .table-panel {
  min-height: 320px;
}

.advanced-shell .year-chart {
  height: 260px;
}

.advanced-shell .bar-chart {
  max-height: 320px;
}

.advanced-shell .report-table-wrap {
  max-height: 520px;
}

@media (max-width: 1100px) {
  .advanced-shell {
    overflow: visible;
  }

  .advanced-page,
  .advanced-grid,
  .rule-card,
  .advanced-actions {
    grid-template-columns: 1fr;
  }

  .advanced-content {
    grid-template-rows: none;
  }

  .rule-remove {
    width: 100%;
  }
}
