body[data-page="services"] #servicesHeading,
body[data-page="services"] #servicesTrendHeading,
body[data-page="services"] #servicesRevenueHeading,
body[data-page="services"] #servicesMatrixHeading,
body[data-page="services"] #servicesChangesHeading {
  scroll-margin-top: calc(var(--hero-height, 0px) + var(--summaries-jump-nav-height, 52px) + 20px);
}

.services-page {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.services-page > * {
  min-width: 0;
}

.services-jump-nav {
  position: sticky;
  top: var(--summaries-jump-sticky-top, 56px);
  z-index: 6;
}

.services-controls {
  display: grid;
  gap: 8px;
  margin: 8px 0 14px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--filter-border);
  border-radius: 8px;
  background: var(--filter-bg);
}

.services-controls__top-row {
  display: grid;
  grid-template-areas: "title metric reset";
  grid-template-columns: auto minmax(280px, 420px) auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.services-controls__title {
  grid-area: title;
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 600;
}

.services-controls__reset {
  grid-area: reset;
  justify-self: end;
  white-space: nowrap;
}

.services-metric-control {
  grid-area: metric;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.services-metric-control__label {
  flex: 0 0 auto;
  color: var(--color-text);
  font-size: var(--filter-font-size);
  font-weight: 700;
}

.services-metric-control__segmented {
  min-width: min(100%, 300px);
}

.services-filter-strip {
  display: grid;
  grid-template-columns: minmax(150px, 0.78fr) minmax(220px, 1.2fr) minmax(210px, 1fr);
  gap: 8px;
  min-width: 0;
}

.services-filter-panels {
  min-width: 0;
}

.services-filter-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--filter-border);
  border-radius: 8px;
  background: var(--filter-bg);
}

.services-filter-panel[data-expanded="true"] {
  border-color: color-mix(in srgb, var(--color-accent) 34%, var(--filter-border));
}

.services-filter-panel__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
}

.services-filter-panel__toggle,
.services-filter-panel__action {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--color-text);
  font: inherit;
}

.services-filter-panel__toggle {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 16px;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
}

.services-filter-panel__toggle:focus-visible,
.services-filter-panel__action:focus-visible,
.services-filter-field select:focus-visible {
  outline: none;
  box-shadow: var(--filter-focus-ring);
}

.services-filter-panel__label {
  font-size: var(--filter-font-size);
  font-weight: 700;
}

.services-filter-panel__summary {
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.services-filter-panel__label-short {
  display: none;
}

.services-filter-panel__chevron {
  width: 9px;
  height: 9px;
  justify-self: center;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.16s ease;
}

.services-filter-panel__toggle[aria-expanded="true"] .services-filter-panel__chevron {
  transform: rotate(225deg) translateY(-1px);
}

.services-filter-panel__action {
  padding: 0 10px;
  border-left: 1px solid var(--filter-border);
  color: var(--color-accent);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.services-filter-panel__action:hover,
.services-filter-panel__toggle:hover {
  background: var(--color-surface-alt);
}

.services-filter-panel__action:disabled {
  color: var(--color-text-muted);
  cursor: default;
  opacity: 0.7;
}

.services-filter-panel__body {
  padding: 8px;
  border: 1px solid var(--filter-border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--color-surface) 76%, transparent);
}

.services-year-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
}

.services-filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  color: var(--color-text-muted);
  font-size: var(--filter-label-size);
  font-weight: 600;
}

.services-filter-field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--filter-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  padding: 9px 12px;
  font: inherit;
  font-size: var(--filter-font-size);
}

.services-filter-list {
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
}

.services-filter-list--chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  overflow: visible;
}

.services-filter-list--scroll {
  max-height: 200px;
  padding-right: 4px;
}

.services-filter-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px;
  align-items: start;
  padding: 5px 7px;
  border-radius: 6px;
  color: var(--color-text);
  font-size: var(--filter-font-size);
  line-height: 1.25;
}

.services-filter-list--chips .services-filter-option {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid var(--filter-border);
  background: var(--color-surface);
  cursor: pointer;
}

.services-filter-list--chips .services-filter-option:has(input:checked) {
  border-color: color-mix(in srgb, var(--color-accent) 58%, var(--filter-border));
  background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface));
  color: var(--color-accent);
}

.services-filter-option:hover {
  background: var(--color-surface-alt);
}

.services-filter-option input {
  margin: 0.15em 0 0;
}

.services-status,
.services-empty-state {
  margin: 0 0 12px;
  color: var(--color-text-muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.services-status[data-state="error"],
.services-empty-state {
  color: var(--color-danger);
  font-weight: 700;
}

.services-status[data-state="success"] {
  color: var(--color-success);
}

.services-chart-frame {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  height: clamp(380px, 52vh, 540px);
  min-height: 380px;
  max-height: 540px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
}

.services-chart-frame canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.services-chart-frame[data-loading="true"] {
  background:
    linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-highlight) 37%, var(--skeleton-base) 63%),
    var(--color-surface);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.6s ease-in-out infinite;
}

.services-chart-expand-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.services-chart-expand-btn:disabled::after {
  display: none;
}

.services-specialist-control {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.services-specialist-control__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.services-specialist-control__summary {
  color: var(--color-text-muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.services-specialist-control__button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--color-border-strong);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
}

.services-specialist-control__button[aria-pressed="true"] {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: var(--color-on-accent);
}

.services-specialist-control__button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.services-specialist-control__link {
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-accent);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.services-specialist-control__link:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.services-specialist-control__link:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.services-specialist-control__list {
  max-height: 140px;
  overflow: auto;
}

.services-table-wrapper {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.services-table-wrapper table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.services-table-wrapper th,
.services-table-wrapper td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
  font-size: 0.88rem;
  line-height: 1.35;
}

.services-table-wrapper td {
  color: var(--color-text);
}

.services-table-wrapper td.services-table__numeric,
.services-table-wrapper th.services-table__numeric {
  text-align: right;
  white-space: nowrap;
}

.services-table__empty td {
  color: var(--color-text-muted);
  text-align: center;
}

.services-table__numeric[data-tone="up"],
.services-matrix__value[data-tone="up"] {
  color: var(--color-success);
}

.services-table__numeric[data-tone="down"],
.services-matrix__value[data-tone="down"] {
  color: var(--color-danger);
}

.services-matrix__label {
  min-width: 180px;
  font-weight: 700;
}

.services-matrix__value {
  min-width: 110px;
}

.services-matrix__value > span {
  display: block;
}

.services-matrix__change {
  margin-top: 3px;
  color: var(--color-text-muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.services-matrix__value[data-tone="up"] {
  background: color-mix(in srgb, var(--color-success) 12%, transparent);
}

.services-matrix__value[data-tone="down"] {
  background: color-mix(in srgb, var(--color-danger) 11%, transparent);
}

body[data-theme="dark"] .services-chart-frame {
  background: var(--color-surface-alt);
}

@media (max-width: 700px) {
  body[data-page="services"] {
    --summaries-jump-nav-height: 112px;
  }

  body[data-page="services"] #servicesHeading,
  body[data-page="services"] #servicesTrendHeading,
  body[data-page="services"] #servicesRevenueHeading,
  body[data-page="services"] #servicesMatrixHeading,
  body[data-page="services"] #servicesChangesHeading {
    scroll-margin-top: calc(
      var(--summaries-jump-sticky-top, 64px) +
      var(--summaries-jump-nav-height, 112px) +
      14px
    );
  }

  .services-jump-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0 -10px 12px;
    padding: 10px;
    overflow: visible;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--color-surface) 94%, transparent);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(14px);
  }

  .services-jump-nav__link {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 8px 10px;
    justify-content: center;
    border-radius: 8px;
    text-align: center;
    white-space: normal;
  }

  .services-controls {
    gap: 7px;
    padding: 8px;
  }

  .services-controls__top-row {
    grid-template-areas:
      "title reset"
      "metric metric";
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .services-controls__reset {
    min-height: 34px;
    padding: 6px 10px;
  }

  .services-metric-control {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
  }

  .services-metric-control__segmented {
    width: 100%;
  }

  .services-filter-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .services-filter-panel__header {
    position: relative;
    grid-template-columns: minmax(0, 1fr);
  }

  .services-filter-panel--groups .services-filter-panel__toggle,
  .services-filter-panel--roles .services-filter-panel__toggle {
    padding-bottom: 16px;
  }

  .services-filter-panel__action {
    position: absolute;
    right: 18px;
    bottom: 4px;
    min-height: auto;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 0.64rem;
    line-height: 1;
  }

  .services-filter-panel__toggle {
    grid-template-columns: minmax(0, 1fr) auto 12px;
    gap: 4px;
    padding: 7px 6px;
  }

  .services-filter-panel__label {
    font-size: 0.76rem;
  }

  .services-filter-panel__label-full {
    display: none;
  }

  .services-filter-panel__label-short {
    display: inline;
  }

  .services-filter-panel__summary {
    max-width: 44px;
    font-size: 0.74rem;
  }

  .services-filter-panel__body {
    padding: 8px;
  }

  .services-year-range {
    grid-template-columns: 1fr;
  }

  .services-filter-list--chips .services-filter-option {
    min-height: 30px;
    padding: 4px 6px;
    font-size: 0.78rem;
  }

  .services-chart-frame {
    height: 400px;
    min-height: 400px;
    max-height: 400px;
    padding: 8px;
  }

  .services-table-wrapper th,
  .services-table-wrapper td {
    padding: 9px 10px;
    font-size: 0.82rem;
  }
}
