:root {
  --blue: #3076e2;
  --blue-dark: #205db6;
  --blue-soft: #edf4ff;
  --ink: #172033;
  --muted: #647084;
  --subtle: #8a94a6;
  --line: #dfe4ec;
  --line-strong: #cbd3df;
  --surface: #ffffff;
  --surface-alt: #f6f8fb;
  --surface-blue: #f7faff;
  --success: #198754;
  --success-soft: #eaf7f0;
  --warning: #9a6500;
  --warning-soft: #fff5dc;
  --danger: #b42318;
  --danger-soft: #fff0ef;
  --radius-sm: 7px;
  --radius-md: 11px;
  --radius-lg: 16px;
  --content: 1540px;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--surface-alt);
  color: var(--ink);
}

body.gate-locked {
  overflow: hidden;
}

body.gate-locked > :not(.lead-list-gate):not(script) {
  visibility: hidden;
}

.lead-list-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: 32px 20px;
  background:
    radial-gradient(circle at 10% 10%, rgb(48 118 226 / 20%), transparent 34%),
    radial-gradient(circle at 90% 90%, rgb(45 179 157 / 16%), transparent 36%),
    #f6f8fb;
}

.lead-list-gate[hidden] {
  display: none;
}

.gate-card {
  width: min(100%, 620px);
  padding: clamp(28px, 5vw, 52px);
  border: 1px solid rgb(255 255 255 / 80%);
  border-radius: 24px;
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 32px 90px rgb(23 32 51 / 16%);
}

.gate-logo {
  width: 148px;
  height: auto;
  margin-bottom: 34px;
}

.gate-card h1 {
  max-width: 540px;
  margin: 8px 0 14px;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.gate-card > p {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.gate-card > small {
  display: block;
  margin-top: 16px;
  color: var(--subtle);
  line-height: 1.5;
}

.gate-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.gate-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 650;
}

.gate-form label:nth-child(3) {
  grid-column: 1 / -1;
}

.gate-form input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}

.gate-form .button {
  grid-column: 1 / -1;
  min-height: 48px;
}

.gate-honeypot {
  position: absolute;
  left: -10000px;
}

.gate-error {
  grid-column: 1 / -1;
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 0.9rem;
}

@media (max-width: 620px) {
  .lead-list-gate {
    align-items: start;
    padding: 16px;
  }

  .gate-card {
    padding: 28px 22px;
    border-radius: 18px;
  }

  .gate-logo {
    margin-bottom: 24px;
  }

  .gate-form {
    grid-template-columns: 1fr;
  }

  .gate-form label:nth-child(3) {
    grid-column: auto;
  }
}

.content-page {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 88px 0 64px;
}

.content-hero {
  max-width: 880px;
  padding: 64px 0 70px;
}

.content-hero h1 {
  margin: 12px 0 22px;
  font-size: clamp(2.8rem, 7vw, 5.7rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.content-hero p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  line-height: 1.65;
}

.content-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--line);
}

.content-stat-grid article {
  display: grid;
  gap: 10px;
  padding: 34px;
  background: var(--surface);
}

.content-stat-grid strong {
  color: var(--blue);
  font-size: clamp(2.3rem, 5vw, 4rem);
  letter-spacing: -0.05em;
}

.content-stat-grid span {
  color: var(--muted);
  line-height: 1.5;
}

.content-section {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) 1.3fr;
  gap: 70px;
  padding: 110px 0;
}

.content-section h2,
.content-callout h2 {
  margin: 10px 0 16px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.content-steps {
  display: grid;
  gap: 0;
}

.content-steps article {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 20px;
  padding: 26px 0;
  border-top: 1px solid var(--line);
}

.content-steps article:last-child {
  border-bottom: 1px solid var(--line);
}

.content-steps > article > span {
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 700;
}

.content-steps h3 {
  margin: 0 0 9px;
  font-size: 1.18rem;
}

.content-steps p,
.content-callout p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.content-callout {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 50px;
  align-items: center;
  padding: clamp(32px, 6vw, 64px);
  border-radius: 24px;
  background: var(--ink);
  color: white;
}

.content-callout p {
  color: rgb(255 255 255 / 68%);
}

.content-actions {
  display: grid;
  gap: 12px;
}

.content-callout .button-secondary {
  border-color: rgb(255 255 255 / 28%);
  background: transparent;
  color: white;
}

.content-footnote {
  max-width: 820px;
  margin: 28px 0 0;
  color: var(--subtle);
  font-size: 0.82rem;
  line-height: 1.55;
}

@media (max-width: 760px) {
  .content-page {
    padding-top: 50px;
  }

  .content-stat-grid,
  .content-section,
  .content-callout {
    grid-template-columns: 1fr;
  }

  .content-section {
    gap: 36px;
    padding: 76px 0;
  }
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="checkbox"] {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
tr[data-lead-id]:focus-visible {
  outline: 3px solid rgb(48 118 226 / 24%);
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 max(24px, calc((100vw - var(--content)) / 2));
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 94%);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand img {
  display: block;
  width: 146px;
  height: 28px;
}

.topbar-actions,
.toolbar-controls,
.pagination > div,
.selection-bar > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

main {
  width: min(calc(100% - 48px), var(--content));
  margin: 0 auto;
  padding-bottom: 64px;
}

.conversion-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 22px;
  padding: 13px 16px 13px 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(
    110deg,
    var(--ink) 0%,
    #1d477f 34%,
    var(--blue-dark) 58%,
    var(--ink) 100%
  );
  background-size: 220% 100%;
  color: white;
  animation: banner-shimmer 12s ease-in-out infinite;
}

.conversion-banner div {
  min-width: 0;
}

.conversion-banner strong,
.conversion-banner span {
  display: inline;
  font-size: 12px;
}

.conversion-banner span {
  margin-left: 7px;
  color: rgb(255 255 255 / 72%);
}

.banner-link {
  flex: 0 0 auto;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  background: white;
  color: var(--blue-dark);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.banner-link:hover {
  background: var(--blue-soft);
}

@keyframes banner-shimmer {
  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .conversion-banner {
    animation: none;
  }
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 58px 0 34px;
}

.hero h1 {
  max-width: 720px;
  margin: 7px 0 12px;
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 640;
  letter-spacing: -0.045em;
  line-height: 1.04;
}

.hero p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.eyebrow {
  color: var(--blue);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.metric {
  min-width: 0;
  padding: 22px 24px;
}

.metric + .metric {
  border-left: 1px solid var(--line);
}

.metric-label,
.metric small {
  display: block;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 620;
}

.metric strong {
  display: block;
  margin: 8px 0 5px;
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -0.04em;
}

.metric small {
  color: var(--subtle);
  font-size: 11px;
}

.preset-section {
  padding: 18px 20px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.section-heading,
.filter-panel-header,
.results-toolbar,
.selection-bar,
.pagination,
.drawer-header,
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

h2,
h3 {
  letter-spacing: -0.025em;
}

.section-heading h2,
.filter-panel-header h2,
.dialog-header h2 {
  margin: 4px 0 0;
}

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

.preset-card {
  position: relative;
  min-height: 126px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: inherit;
  text-align: left;
  transition:
    border-color 120ms ease,
    background 120ms ease,
    transform 120ms ease;
}

.preset-card:hover {
  border-color: var(--blue);
  background: var(--surface-blue);
  transform: translateY(-1px);
}

.preset-card.active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.preset-card strong,
.preset-card span,
.preset-card small {
  display: block;
}

.preset-card > span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.preset-card strong {
  margin: 7px 0 5px;
  font-size: 14px;
  line-height: 1.3;
}

.preset-card small {
  color: var(--muted);
  line-height: 1.45;
}

.preset-count {
  position: absolute;
  right: 13px;
  bottom: 11px;
  color: var(--ink) !important;
  font-size: 13px !important;
  font-weight: 720 !important;
}

.workspace {
  display: block;
  margin-top: 32px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.filter-panel {
  position: static;
  max-height: none;
  overflow: visible;
  border-right: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface-alt);
}

.filter-panel-header {
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.filter-panel-header h2 {
  font-size: 19px;
}

.filter-count {
  color: var(--muted);
  font-size: 11px;
}

.filter-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-toggle {
  min-width: 102px;
}

.filter-content[hidden] {
  display: none;
}

.filter-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--surface);
}

.field {
  display: grid;
  gap: 7px;
}

.field > span,
.compact-field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.field input,
.field select,
.compact-field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  padding: 0 11px;
}

.field input:focus,
.field select:focus,
.compact-field select:focus {
  border-color: var(--blue);
  outline: 3px solid rgb(48 118 226 / 12%);
}

.field-search {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.field-search input {
  width: 260px;
  min-height: 34px;
  padding: 8px 10px;
}

.filter-group {
  display: grid;
  align-content: start;
  gap: 13px;
  padding: 18px 20px;
  border-right: 1px solid var(--line);
  border-bottom: 0;
  background: var(--surface);
}

.filter-group:last-child {
  border-right: 0;
}

.filter-group h3 {
  margin: 0 0 2px;
  font-size: 12px;
}

.check-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: start;
  gap: 9px;
  cursor: pointer;
}

.check-row input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--blue);
}

.check-row strong,
.check-row small {
  display: block;
}

.check-row strong {
  font-size: 12px;
  font-weight: 620;
}

.check-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.results-panel {
  min-width: 0;
}

.results-toolbar {
  min-height: 80px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.results-count {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.results-count strong {
  font-size: 21px;
}

.results-count span {
  color: var(--muted);
  font-size: 12px;
}

.toolbar-controls {
  flex: 0 0 auto;
}

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

.compact-field select {
  min-width: 166px;
}

.active-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border: 0;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 10px;
}

.chip::after {
  content: "×";
}

.selection-bar {
  min-height: 54px;
  padding: 9px 20px;
  border-bottom: 1px solid #cde9dc;
  background: var(--success-soft);
  font-size: 12px;
}

.table-shell {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 1450px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 10px;
  font-weight: 720;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  font-size: 12px;
}

tbody tr {
  transition: background 100ms ease;
}

tbody tr:hover {
  background: var(--surface-blue);
}

tbody tr[data-lead-id] {
  cursor: pointer;
}

.select-column {
  width: 42px;
  padding-left: 16px;
  text-align: center;
}

.select-column input {
  accent-color: var(--blue);
}

.action-column {
  width: 38px;
  text-align: center;
}

.column-company {
  width: 245px;
}

.column-sector {
  width: 170px;
}

.column-location {
  width: 150px;
}

.column-pu1 {
  width: 105px;
}

.column-energy {
  width: 125px;
}

.column-opportunity {
  width: 115px;
}

.column-unimplemented {
  width: 110px;
}

.column-group,
.column-score {
  width: 65px;
}

.column-signals {
  width: 220px;
}

.company-cell {
  width: 245px;
}

.company-cell strong,
.company-cell small,
.sector-cell strong,
.sector-cell small,
.location-cell strong,
.location-cell small,
.score-cell strong,
.score-cell small {
  display: block;
}

.company-cell strong,
.sector-cell strong,
.location-cell strong,
.location-cell small {
  overflow: hidden;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-cell small,
.sector-cell small,
.location-cell small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.sector-cell strong {
  font-size: 11px;
}

.location-cell strong {
  font-size: 12px;
}

.numeric {
  text-align: right;
  white-space: nowrap;
}

.score-cell {
  color: var(--blue-dark);
  font-weight: 750;
}

.score-cell strong {
  font-size: 14px;
}

.score-cell small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.pill-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.pill-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.pill-success {
  background: var(--success-soft);
  color: var(--success);
}

.signal-list {
  display: flex;
  min-width: 0;
  max-width: 100%;
  flex-wrap: nowrap;
  gap: 4px;
  white-space: nowrap;
}

.signal-list .pill {
  flex: 0 0 auto;
}

.pill-more {
  position: relative;
}

.pill-more:hover::after,
.pill-more:focus-visible::after {
  position: absolute;
  z-index: 20;
  right: 0;
  bottom: calc(100% + 7px);
  width: max-content;
  max-width: 280px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: white;
  content: attr(data-tooltip);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.45;
  white-space: normal;
}

.open-arrow {
  color: var(--subtle);
  font-size: 18px;
}

.empty-row td {
  padding: 60px 20px;
  color: var(--muted);
  text-align: center;
}

.pagination {
  padding: 14px 20px;
  color: var(--muted);
  font-size: 11px;
}

.button,
.text-button,
.icon-button {
  border: 0;
  background: none;
  color: inherit;
}

.button {
  display: inline-flex;
  min-height: 37px;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 650;
}

.button-primary {
  background: var(--blue);
  color: white;
}

.button-primary:hover {
  background: var(--blue-dark);
}

.button-count {
  display: inline-grid;
  min-width: 19px;
  height: 19px;
  margin-left: 7px;
  place-items: center;
  border-radius: 999px;
  background: rgb(255 255 255 / 20%);
  font-size: 10px;
}

.button-secondary {
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

.button-secondary:hover,
.button-quiet:hover {
  background: var(--surface-alt);
}

.button-quiet {
  color: var(--muted);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.text-button {
  padding: 4px;
  color: var(--blue-dark);
  font-size: 11px;
  font-weight: 650;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  font-size: 24px;
}

.icon-button:hover {
  background: var(--surface-alt);
}

.drawer {
  position: fixed;
  z-index: 80;
  inset: 0;
  pointer-events: none;
  visibility: hidden;
}

.drawer.open {
  pointer-events: auto;
  visibility: visible;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(23 32 51 / 35%);
  opacity: 0;
  transition: opacity 160ms ease;
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(620px, 92vw);
  height: 100%;
  overflow: auto;
  background: var(--surface);
  transform: translateX(100%);
  transition: transform 180ms ease;
}

.drawer.open .drawer-backdrop {
  opacity: 1;
}

.drawer.open .drawer-panel {
  transform: translateX(0);
}

.drawer-header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 19px 22px;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 95%);
  backdrop-filter: blur(10px);
}

.drawer-header h2 {
  margin: 5px 0 0;
  font-size: 20px;
}

.drawer-header-actions,
.dialog-header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.drawer-content {
  padding: 22px;
}

.detail-hero {
  padding: 20px;
  border-radius: var(--radius-md);
  background: var(--surface-alt);
}

.detail-hero h3 {
  margin: 0 0 9px;
  font-size: 23px;
  line-height: 1.25;
}

.detail-hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.detail-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
}

.detail-score strong {
  color: var(--blue);
  font-size: 28px;
}

.detail-section {
  padding: 23px 0;
  border-bottom: 1px solid var(--line);
}

.detail-section:last-child {
  border-bottom: 0;
}

.detail-section h3 {
  margin: 0 0 14px;
  font-size: 14px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.score-breakdown {
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.detail-item span,
.detail-item strong,
.detail-item small {
  display: block;
}

.detail-item span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 620;
  text-transform: uppercase;
}

.detail-item strong {
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.45;
}

.detail-item small {
  margin-top: 4px;
  color: var(--subtle);
  font-size: 10px;
}

.confidence-note {
  margin-top: 14px;
  padding: 12px;
  border-left: 3px solid var(--blue);
  background: var(--blue-soft);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 50px));
  overflow: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
}

dialog::backdrop {
  background: rgb(23 32 51 / 38%);
}

.post-export-dialog {
  width: min(580px, calc(100vw - 32px));
}

.post-export-content {
  position: relative;
  padding: 34px;
  text-align: center;
}

.post-export-close {
  position: absolute;
  top: 13px;
  right: 13px;
}

.post-export-content h2 {
  margin: 8px 0 10px;
  font-size: 25px;
}

.post-export-content p {
  max-width: 470px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.post-export-actions {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin-top: 22px;
}

.post-export-actions a {
  text-decoration: none;
}

.dialog-header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.dialog-header h2 {
  font-size: 21px;
}

#methodology-content,
#saved-views-content,
#shortlists-content,
.add-shortlist-content {
  padding: 22px;
}

.shortlists-dialog {
  width: min(820px, calc(100vw - 32px));
}

.shortlist-choices {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}

.shortlist-choice-heading {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.shortlist-choice {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.shortlist-choice:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.shortlist-choice strong,
.shortlist-choice small {
  display: block;
}

.shortlist-choice small {
  margin-top: 3px;
  color: var(--muted);
}

.create-shortlist-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.shortlist-card {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.shortlist-card:first-child {
  padding-top: 0;
}

.shortlist-card:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.shortlist-card-header,
.shortlist-lead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.shortlist-card h3,
.shortlist-card p {
  margin: 0;
}

.shortlist-card h3 {
  font-size: 16px;
}

.shortlist-card p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.shortlist-card-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.shortlist-preview {
  display: grid;
  gap: 7px;
  margin-top: 15px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.shortlist-lead {
  padding: 5px 0;
}

.shortlist-lead strong,
.shortlist-lead small {
  display: block;
}

.shortlist-lead strong {
  font-size: 12px;
}

.shortlist-lead small,
.shortlist-more {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.guide-intro {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.6;
}

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

.guide-summary-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.guide-summary-card h3 {
  margin: 12px 0 6px;
  font-size: 14px;
}

.guide-summary-card p,
.score-guide p,
.guide-source {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.score-guide {
  margin-top: 24px;
}

.score-guide-list {
  margin-top: 13px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.score-guide-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 16px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
}

.score-guide-row:last-child {
  border-bottom: 0;
}

.score-guide-row strong,
.score-guide-row span {
  font-size: 11px;
}

.score-guide-row span {
  color: var(--blue-dark);
  font-weight: 700;
}

.score-guide-row p {
  grid-column: 1 / -1;
}

.guide-thresholds {
  margin-top: 12px !important;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--blue-soft);
}

.guide-source {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.guide-group,
.saved-view {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.guide-group:last-child,
.saved-view:last-child {
  border-bottom: 0;
}

.guide-group-header,
.saved-view {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.guide-group h3,
.saved-view h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.guide-group p,
.saved-view p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.guide-fields {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.confidence-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 10px;
  font-weight: 700;
}

.confidence-badge.proxy {
  background: var(--warning-soft);
  color: var(--warning);
}

.confidence-badge.sparse {
  background: var(--danger-soft);
  color: var(--danger);
}

.saved-view-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
}

.empty-state {
  padding: 38px 10px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  max-width: 340px;
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: white;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 150ms ease,
    transform 150ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 1120px) {
  .preset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    display: block;
  }

  .filter-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-controls .filter-group {
    border-right: 1px solid var(--line);
  }

  .filter-controls .filter-group:nth-of-type(even) {
    border-right: 0;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .metric:nth-child(4) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .topbar {
    padding: 0 15px;
  }

  .button-quiet,
  #save-view-button {
    display: none;
  }

  main {
    width: min(calc(100% - 24px), var(--content));
  }

  .conversion-banner {
    align-items: flex-start;
    flex-direction: column;
    gap: 11px;
  }

  .conversion-banner strong,
  .conversion-banner span {
    display: block;
  }

  .conversion-banner span {
    margin: 4px 0 0;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 36px;
  }

  .hero h1 {
    font-size: 35px;
  }

  .metric-grid,
  .preset-grid {
    grid-template-columns: 1fr;
  }

  .filter-controls {
    grid-template-columns: 1fr;
  }

  .metric + .metric {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .filter-panel {
    position: static;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .filter-group {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .filter-controls .filter-group,
  .filter-controls .filter-group:nth-of-type(even) {
    border-right: 0;
  }

  .field-search {
    align-items: stretch;
    flex-direction: column;
  }

  .field-search input {
    width: 100%;
  }

  .results-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-controls {
    width: 100%;
  }

  .create-shortlist-form {
    grid-template-columns: 1fr;
  }

  .guide-summary-grid {
    grid-template-columns: 1fr;
  }

  .post-export-actions {
    flex-direction: column;
  }

  .shortlist-card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .shortlist-card-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .drawer-header-actions .button {
    padding: 0 10px;
  }

  .compact-field {
    width: 100%;
  }

  .compact-field select {
    flex: 1;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}
