.search-performance-page,
.search-performance-page * {
  box-sizing: border-box;
  min-width: 0;
  letter-spacing: 0;
}

.search-performance-page [hidden] { display: none !important; }

.search-performance-toolbar,
.search-connection-band,
.search-range-row,
.search-table-header,
.search-chart-header,
.search-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.search-performance-toolbar {
  position: relative;
  padding: 22px 24px;
  border: 1px solid color-mix(in srgb, var(--bs-border-color) 82%, transparent);
  border-radius: 8px;
  background: var(--bostic-surface, #fff);
  box-shadow: 0 8px 24px rgba(31, 41, 55, 0.06);
}

.search-ranking-workspace-nav {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0.5rem;
}

body[data-pc-theme="light"] .search-ranking-workspace-nav {
  background: #fff;
}

.search-ranking-workspace-nav a {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--bs-secondary-color);
  display: flex;
  gap: 0.75rem;
  min-height: 4.25rem;
  padding: 0.75rem;
  text-decoration: none;
}

.search-ranking-workspace-nav a:hover,
.search-ranking-workspace-nav a:focus-visible {
  background: var(--bs-tertiary-bg);
  border-color: var(--bs-border-color);
}

.search-ranking-workspace-nav a:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
}

.search-ranking-workspace-nav a.is-active {
  background: color-mix(in srgb, var(--bs-success) 10%, var(--bs-body-bg));
  border-color: color-mix(in srgb, var(--bs-success) 34%, var(--bs-border-color));
  color: var(--bs-emphasis-color);
}

.search-ranking-workspace-nav i {
  color: var(--bs-success);
  flex: 0 0 auto;
  font-size: 1.45rem;
}

.search-ranking-workspace-nav span,
.search-ranking-workspace-nav strong,
.search-ranking-workspace-nav small { display: block; }

.search-ranking-workspace-nav small {
  color: var(--bs-secondary-color);
  margin-top: 0.15rem;
}

.search-performance-toolbar > .min-w-0 > span.text-muted,
.search-card-eyebrow,
.search-range-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: #c96f0b !important;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.3;
  text-transform: uppercase;
}

.search-performance-toolbar h2 { color: var(--bs-emphasis-color); line-height: 1.2; }
.search-performance-toolbar p { max-width: 680px; }

.search-performance-actions,
.search-connection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.search-performance-actions .btn,
.search-connection-actions .btn,
.search-setup-submit,
.search-pagination .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.search-connection-band {
  padding: 18px 20px;
  border: 1px solid #dbe1e8;
  border-left: 4px solid #7c8798;
  border-radius: 7px;
  background: #f4f6f8;
}

.search-connection-band[data-state="active"] { border-left-color: #16865a; }
.search-connection-band[data-state="attention"] { border-left-color: #f59e0b; }
.search-connection-band[data-state="error"] { border-left-color: #d94343; }
.search-connection-copy { display: flex; align-items: center; gap: 12px; }
.search-connection-copy strong,
.search-connection-copy small { display: block; }

.search-status-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 50%;
  background: #7c8798;
  box-shadow: 0 0 0 5px rgba(124, 135, 152, 0.14);
}

[data-state="active"] .search-status-dot { background: #16865a; box-shadow: 0 0 0 5px rgba(22, 134, 90, 0.15); }
[data-state="attention"] .search-status-dot { background: #f59e0b; box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.16); }

.search-setup-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
  gap: 18px;
}

.search-setup-grid .form-label { margin: 0; }
.search-setup-submit { min-height: 42px; }

.search-loading {
  padding: 24px;
  border: 1px solid #e3e7ec;
  border-radius: 7px;
  background: #fff;
}

.search-range-row {
  padding: 15px 18px;
  border: 1px solid #dde3ea;
  border-radius: 8px;
  background: #fff;
}

.search-range-row span,
.search-range-row strong { display: block; }
.search-range-row strong { color: #202734; font-size: 0.95rem; }

.search-segmented,
.search-dimension-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid #d8dee6;
  border-radius: 7px;
  background: #eef1f4;
}

.search-segmented button,
.search-dimension-tabs button {
  min-height: 34px;
  padding: 6px 12px;
  border: 0;
  border-radius: 5px;
  color: #52606f;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.search-segmented button[aria-pressed="true"],
.search-dimension-tabs button[aria-selected="true"] {
  color: #19202a;
  background: #fff;
  box-shadow: 0 1px 3px rgba(24, 31, 42, 0.14);
}

.search-segmented button:focus-visible,
.search-dimension-tabs button:focus-visible,
.search-table-search input:focus-visible { outline: 2px solid #f59e0b; outline-offset: 2px; }

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

.search-metric-card {
  position: relative;
  min-height: 168px;
  overflow: hidden;
  padding: 18px 18px 62px;
  border: 1px solid #dde3ea;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(31, 41, 55, 0.04);
}

.search-metric-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #5e6b79;
  font-size: 0.83rem;
  font-weight: 650;
}

.search-metric-icon {
  display: inline-flex;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  font-size: 1rem;
}

.search-metric-icon-clicks { color: #b85e00; background: #fff0dc; }
.search-metric-icon-impressions { color: #2563a9; background: #e8f2ff; }
.search-metric-icon-ctr { color: #147858; background: #def7ec; }
.search-metric-icon-position { color: #a54866; background: #fbe8ef; }

.search-metric-card > strong {
  display: block;
  margin: 13px 0 3px;
  color: #202734;
  font-size: 1.7rem;
  line-height: 1.1;
}

.search-metric-card > small { display: block; color: #6b7785; }
.search-metric-spark { position: absolute; right: 12px; bottom: 4px; left: 12px; height: 54px; }

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

.search-chart-card {
  margin: 0;
  border-color: #dde3ea;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(31, 41, 55, 0.045);
}

.search-chart-card .card-header {
  min-height: 72px;
  padding: 16px 18px;
  border-bottom-color: #e5e9ee;
  background: #fff;
}

.search-chart-card .card-body { padding: 12px 16px 16px; }
.search-chart-main { grid-column: span 8; }
.search-chart-efficiency { grid-column: span 4; }
.search-chart-devices { grid-column: span 4; }
.search-chart-queries { grid-column: span 8; }
.search-chart-header { flex-wrap: wrap; }
.search-chart-header h5 { color: #202734; font-size: 1rem; }

.search-chart-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #596777;
  font-size: 0.76rem;
  font-weight: 650;
}

.search-chart { width: 100%; }
.search-chart-large { height: 330px; }
.search-chart-radial,
.search-chart-donut { height: 270px; }
.search-chart-bars { height: 290px; }
.search-chart-centered { text-align: center; }

.search-chart-note {
  max-width: 260px;
  margin: -8px auto 5px;
  color: #687584;
  font-size: 0.82rem;
  line-height: 1.45;
}

.search-chart-empty {
  display: grid;
  min-height: 220px;
  margin: 0;
  place-items: center;
  color: #73808e;
  text-align: center;
}

.search-table-card { border-color: #dde3ea; border-radius: 8px; }
.search-table-card .card-header { padding: 18px; background: #fff; }
.search-table-header { flex-wrap: wrap; }
.search-table-search { width: min(360px, 100%); }
.search-table-wrap { margin-top: 18px; }
.search-table-wrap th:first-child,
.search-table-wrap td:first-child { width: 48%; overflow-wrap: anywhere; }
.search-pagination { flex-wrap: wrap; }

html[data-pc-theme="dark"] .search-performance-toolbar,
body[data-pc-theme="dark"] .search-performance-toolbar,
html[data-pc-theme="dark"] .search-range-row,
body[data-pc-theme="dark"] .search-range-row,
html[data-pc-theme="dark"] .search-metric-card,
body[data-pc-theme="dark"] .search-metric-card,
html[data-pc-theme="dark"] .search-chart-card,
body[data-pc-theme="dark"] .search-chart-card,
html[data-pc-theme="dark"] .search-chart-card .card-header,
body[data-pc-theme="dark"] .search-chart-card .card-header,
html[data-pc-theme="dark"] .search-table-card .card-header,
body[data-pc-theme="dark"] .search-table-card .card-header,
html[data-pc-theme="dark"] .search-loading,
body[data-pc-theme="dark"] .search-loading {
  border-color: #3b4655;
  background: #202731;
}

html[data-pc-theme="dark"] .search-performance-toolbar,
body[data-pc-theme="dark"] .search-performance-toolbar { box-shadow: 0 10px 28px rgba(3, 8, 15, 0.24); }

html[data-pc-theme="dark"] .search-connection-band,
body[data-pc-theme="dark"] .search-connection-band { border-color: #3c4655; background: #252d38; }

html[data-pc-theme="dark"] .search-connection-band[data-state="active"],
body[data-pc-theme="dark"] .search-connection-band[data-state="active"] { border-left-color: #16865a; }

html[data-pc-theme="dark"] .search-connection-band[data-state="attention"],
body[data-pc-theme="dark"] .search-connection-band[data-state="attention"] { border-left-color: #f59e0b; }

html[data-pc-theme="dark"] .search-connection-band[data-state="error"],
body[data-pc-theme="dark"] .search-connection-band[data-state="error"] { border-left-color: #d94343; }

html[data-pc-theme="dark"] .search-range-row strong,
body[data-pc-theme="dark"] .search-range-row strong,
html[data-pc-theme="dark"] .search-performance-toolbar h2,
body[data-pc-theme="dark"] .search-performance-toolbar h2,
html[data-pc-theme="dark"] .search-connection-copy strong,
body[data-pc-theme="dark"] .search-connection-copy strong,
html[data-pc-theme="dark"] .search-metric-card > strong,
body[data-pc-theme="dark"] .search-metric-card > strong,
html[data-pc-theme="dark"] .search-chart-header h5,
body[data-pc-theme="dark"] .search-chart-header h5 { color: #f3f6f9; }

html[data-pc-theme="dark"] .search-performance-toolbar p,
body[data-pc-theme="dark"] .search-performance-toolbar p,
html[data-pc-theme="dark"] .search-connection-copy small,
body[data-pc-theme="dark"] .search-connection-copy small,
html[data-pc-theme="dark"] .search-metric-heading,
body[data-pc-theme="dark"] .search-metric-heading,
html[data-pc-theme="dark"] .search-metric-card > small,
body[data-pc-theme="dark"] .search-metric-card > small { color: #aeb8c5 !important; }

html[data-pc-theme="dark"] .search-segmented,
html[data-pc-theme="dark"] .search-dimension-tabs,
body[data-pc-theme="dark"] .search-segmented,
body[data-pc-theme="dark"] .search-dimension-tabs { border-color: #455162; background: #1d242d; }

html[data-pc-theme="dark"] .search-segmented button[aria-pressed="true"],
html[data-pc-theme="dark"] .search-dimension-tabs button[aria-selected="true"],
body[data-pc-theme="dark"] .search-segmented button[aria-pressed="true"],
body[data-pc-theme="dark"] .search-dimension-tabs button[aria-selected="true"] { color: #fff; background: #36404d; }

html[data-pc-theme="dark"] .search-chart-badge,
body[data-pc-theme="dark"] .search-chart-badge,
html[data-pc-theme="dark"] .search-chart-note,
body[data-pc-theme="dark"] .search-chart-note { color: #aeb8c5; }

@media (max-width: 1199.98px) {
  .search-chart-main,
  .search-chart-queries { grid-column: span 7; }
  .search-chart-efficiency,
  .search-chart-devices { grid-column: span 5; }
}

@media (max-width: 991.98px) {
  .search-ranking-workspace-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-ranking-workspace-nav a { min-height: 44px; }
  .search-performance-toolbar,
  .search-connection-band,
  .search-range-row { align-items: stretch; flex-direction: column; }
  .search-performance-toolbar { padding: 18px; }
  .search-performance-actions,
  .search-connection-actions { width: 100%; }
  .search-performance-actions .btn,
  .search-connection-actions .btn { flex: 1 1 190px; min-height: 44px; }
  .search-setup-grid { grid-template-columns: 1fr; }
  .search-setup-submit { width: 100%; min-height: 44px; }
  .search-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-chart-main,
  .search-chart-efficiency,
  .search-chart-devices,
  .search-chart-queries { grid-column: 1 / -1; }
  .search-dimension-tabs { width: 100%; overflow-x: auto; }
  .search-dimension-tabs button { flex: 1 0 auto; min-height: 44px; }
}

@media (max-width: 575.98px) {
  .search-ranking-workspace-nav { grid-template-columns: minmax(0, 1fr); }
  .search-metrics { grid-template-columns: 1fr; }
  .search-segmented { width: 100%; }
  .search-segmented button { flex: 1 1 0; min-height: 44px; padding-inline: 6px; }
  .search-chart-card .card-header { align-items: flex-start; }
  .search-chart-card .card-body { padding-inline: 10px; }
  .search-chart-large { height: 290px; }
  .search-chart-radial,
  .search-chart-donut { height: 250px; }
  .search-chart-bars { height: 280px; }
  .search-pagination .btn { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .search-performance-page * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
