:root {
  --sf-blue: #0848db;
  --sf-blue-700: #0639b1;
  --sf-ink: #080d2f;
  --sf-muted: #4c5672;
  --sf-line: #dbe2ee;
  --sf-line-strong: #c4ccdc;
  --sf-soft: #f8fbff;
  --sf-green: #16a05d;
  --sf-gold: #e0a11b;
  --sf-purple: #8b28d9;
  --sf-shadow: 0 8px 26px rgba(8, 13, 47, 0.08);
  --sf-radius: 8px;
}

body.screener-page {
  min-width: 320px !important;
  margin: 0 !important;
  background: #fff !important;
  color: var(--sf-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}

body.screener-page * {
  box-sizing: border-box;
}

body.screener-page .hidden {
  display: none !important;
}

body.screener-page nav {
  position: sticky;
  top: 0;
  z-index: 101;
  width: 100%;
  border-bottom: 1px solid var(--sf-line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 3px 14px rgba(8, 13, 47, 0.06);
  backdrop-filter: blur(14px);
}

body.screener-page nav .nav-content {
  max-width: none;
  min-height: 72px;
  padding: 11px 30px;
  background: transparent;
}

body.screener-page nav .nav-content .nav-brand {
  height: 42px;
  width: auto;
}

body.screener-page nav .nav-content .nav-links {
  margin-left: 34px;
  gap: 18px;
}

body.screener-page nav .nav-content .nav-links .nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 50px;
  margin-left: 18px;
  color: #0f1538;
  font-size: 15px;
  font-weight: 500;
}

body.screener-page nav .nav-content .nav-links .nav-link:hover,
body.screener-page nav .nav-content .nav-links .active {
  color: var(--sf-blue);
}

body.screener-page nav .nav-content .nav-links .active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -12px;
  height: 3px;
  background: var(--sf-blue);
}

body.screener-page #search-input-wrapper {
  display: none !important;
}

body.screener-page .nav-auth-button.btn {
  min-height: 40px;
  padding: 0 18px !important;
  border: 1px solid var(--sf-line-strong);
  border-radius: 6px;
  background: #fff !important;
  color: #080d2f !important;
  font-size: 14px;
  font-weight: 700;
  box-shadow: none;
}

body.screener-page #nav-signup-button {
  min-width: 148px;
  border-color: var(--sf-blue) !important;
  background: var(--sf-blue) !important;
  color: #fff !important;
  box-shadow: 0 9px 18px rgba(8, 72, 219, 0.18);
}

body.screener-page #nav-logout-button {
  display: none;
}

.screener-shell {
  width: calc(100% - 68px);
  max-width: none;
  margin: 0 auto;
  padding: 28px 0 22px;
}

.screener-hero {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) auto;
  align-items: end;
  gap: 36px;
  margin-bottom: 28px;
}

.screener-hero h1 {
  margin: 0 0 8px;
  color: var(--sf-ink);
  font-size: 40px;
  line-height: 1.05;
  font-weight: 850;
  letter-spacing: 0;
}

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

.screener-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 16px;
}

.period-control {
  display: grid;
  gap: 7px;
  min-width: 220px;
}

.period-control > span {
  color: #29314f;
  font-size: 14px;
  font-weight: 700;
}

.period-buttons {
  display: flex;
  gap: 4px;
}

.period-button,
.screener-button,
.utility-button,
.clear-all,
.category-tab,
.condition-remove,
.pagination-button,
.results-table th button {
  font: inherit;
  cursor: pointer;
}

.period-button {
  min-width: 98px;
  min-height: 42px;
  border: 1px solid var(--sf-line);
  border-radius: 6px;
  background: #fff;
  color: #202846;
  font-size: 15px;
  font-weight: 700;
}

.period-button.active {
  border-color: #9db7ff;
  background: #eef4ff;
  color: var(--sf-blue);
  box-shadow: inset 0 0 0 1px #c8d6ff;
}

.screener-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 55px;
  padding: 0 29px;
  border-radius: 5px;
  font-size: 16px;
  font-weight: 750;
  white-space: nowrap;
}

.screener-button.secondary {
  min-width: 194px;
  border: 1px solid #9eb5ee;
  background: #fff;
  color: var(--sf-blue);
}

.screener-button.primary {
  min-width: 188px;
  border: 1px solid var(--sf-blue);
  background: var(--sf-blue);
  color: #fff;
  box-shadow: 0 12px 22px rgba(8, 72, 219, 0.18);
}

.screener-button span {
  font-size: 23px;
  line-height: 1;
}

.filter-card,
.metric-card,
.results-card {
  border: 1px solid var(--sf-line);
  border-radius: var(--sf-radius);
  background: #fff;
  box-shadow: var(--sf-shadow);
}

.filter-card {
  overflow: hidden;
  margin-bottom: 14px;
}

.category-tabs {
  display: grid;
  grid-template-columns: 1.02fr 1.14fr 1.18fr 1fr 1.15fr 1.28fr 1.3fr;
  min-height: 52px;
  border-bottom: 1px solid var(--sf-line);
  background: linear-gradient(180deg, #fff, #fbfdff);
}

.category-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--sf-line);
  background: transparent;
  color: #333b58;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

.category-tab:last-child {
  border-right: 0;
}

.category-tab.active {
  color: var(--sf-blue);
}

.category-tab.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 3px;
  background: var(--sf-blue);
}

.category-tab i,
.category-tab span {
  font-size: 21px;
  line-height: 1;
}

.condition-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 20px;
  padding: 20px;
}

.condition-card {
  min-height: 101px;
  padding: 14px 13px 12px;
  border: 1px solid var(--sf-line);
  border-radius: 5px;
  background: #fff;
}

.condition-card.add {
  display: grid;
  place-items: center;
  min-height: 101px;
  border: 1px dashed #aeb8ca;
  background: #fff;
  color: var(--sf-blue);
  font-weight: 750;
}

.condition-card.add span {
  display: block;
  margin-bottom: 6px;
  font-size: 30px;
  line-height: 1;
}

.condition-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  align-items: start;
  gap: 8px;
  margin-bottom: 9px;
}

.condition-key,
.condition-op,
.condition-value {
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--sf-ink);
}

.condition-key {
  width: 100%;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: linear-gradient(90deg, #cfe0ff, #e7efff);
  color: var(--sf-blue);
  font-size: 12px;
  font-weight: 800;
}

.condition-remove {
  width: 20px;
  height: 20px;
  border: 0;
  background: transparent;
  color: #47536f;
  font-size: 20px;
  line-height: 1;
}

.condition-op {
  width: 100%;
  margin-bottom: 5px;
  color: #29314f;
  font-size: 14px;
}

.condition-value {
  width: 100%;
  color: var(--sf-ink);
  font-size: 16px;
  font-weight: 500;
}

.condition-value:focus,
.condition-key:focus,
.condition-op:focus {
  outline: 2px solid rgba(8, 72, 219, 0.18);
  outline-offset: 2px;
}

.filter-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 0 20px 16px;
}

.condition-mode {
  justify-self: center;
  color: #333b58;
  font-size: 15px;
  font-weight: 700;
}

.clear-all {
  border: 0;
  background: transparent;
  color: #35405f;
  font-size: 14px;
}

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

.metric-card {
  position: relative;
  min-height: 108px;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) 108px;
  align-items: center;
  gap: 15px;
  padding: 16px;
  overflow: hidden;
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #eef4ff;
  color: var(--sf-blue);
  border: 1px solid #9db7ff;
  font-size: 32px;
}

.metric-icon.pe {
  color: var(--sf-gold);
  background: #fff8e7;
  border-color: #f0c66c;
}

.metric-icon.growth {
  color: var(--sf-green);
  background: #ebfbf2;
  border-color: #95d8b4;
}

.metric-icon.sector {
  color: var(--sf-purple);
  background: #fbf0ff;
  border-color: #cf8bef;
}

.metric-card p {
  margin: 0 0 3px;
  color: #29314f;
  font-size: 14px;
  font-weight: 600;
}

.metric-card strong {
  display: block;
  min-height: 30px;
  color: var(--sf-ink);
  font-size: 25px;
  line-height: 1.1;
  font-weight: 850;
}

.metric-card span:not(.info-dot) {
  display: block;
  margin-top: 4px;
  color: var(--sf-muted);
  font-size: 12px;
}

.info-dot {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border: 1px solid #8f9bb1;
  border-radius: 50%;
  color: #69748a;
  font-size: 10px;
  font-weight: 800;
}

.metric-spark {
  width: 100%;
  height: 44px;
  fill: none;
  stroke: var(--sf-blue);
  stroke-width: 2;
}

.metric-spark.gold {
  stroke: var(--sf-gold);
}

.metric-spark.green {
  stroke: var(--sf-green);
}

.donut {
  justify-self: end;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: conic-gradient(var(--sf-purple) 0 40%, #1044b8 40% 74%, #cbd5e1 74% 100%);
  -webkit-mask: radial-gradient(circle, transparent 0 36%, #000 37%);
  mask: radial-gradient(circle, transparent 0 36%, #000 37%);
}

.results-card {
  overflow: hidden;
}

.results-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 48px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--sf-line);
}

.results-toolbar h2 {
  margin: 0;
  color: var(--sf-ink);
  font-size: 18px;
  font-weight: 800;
}

.results-actions {
  display: flex;
  gap: 8px;
}

.utility-button {
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid var(--sf-line);
  border-radius: 5px;
  background: #fff;
  color: #111a3a;
  font-size: 13px;
  font-weight: 700;
}

.utility-button.icon-only {
  width: 34px;
  padding: 0;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.results-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  color: var(--sf-ink);
  font-size: 14px;
}

.results-table th,
.results-table td {
  padding: 10px 17px;
  border-right: 1px solid var(--sf-line);
  border-bottom: 1px solid var(--sf-line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.results-table th:last-child,
.results-table td:last-child {
  border-right: 0;
}

.results-table th {
  background: #fbfdff;
  color: #18213d;
  font-size: 13px;
  font-weight: 800;
}

.results-table th button {
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: inherit;
  text-align: left;
}

.results-table th small {
  display: block;
  color: #65708a;
  font-size: 11px;
  font-weight: 600;
}

.results-table tbody tr:hover {
  background: #fbfdff;
}

.ticker-link {
  color: var(--sf-blue);
  font-weight: 800;
}

.company-cell {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.positive {
  color: var(--sf-green);
}

.negative {
  color: #dc2626;
}

.mini-chart {
  display: inline-block;
  width: 82px;
  height: 24px;
  margin-left: 18px;
  vertical-align: middle;
}

.mini-chart path {
  fill: none;
  stroke: var(--sf-green);
  stroke-width: 1.8;
}

.score-pill {
  display: inline-grid;
  min-width: 48px;
  min-height: 26px;
  place-items: center;
  border: 1px solid #98d9b2;
  border-radius: 7px;
  background: #eaf9f0;
  color: #087a3d;
  font-weight: 850;
}

.empty-state {
  height: 140px;
  color: #64748b;
  text-align: center !important;
}

.empty-state .inline-login {
  margin-left: 12px;
  min-height: 34px;
  padding: 0 16px;
  border: 1px solid var(--sf-blue);
  border-radius: 6px;
  background: var(--sf-blue);
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

.results-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 58px;
  padding: 10px 14px;
}

.results-footer p {
  margin: 0;
  color: #34405e;
  font-size: 14px;
}

.screener-pagination {
  display: flex;
  align-items: center;
  gap: 9px;
}

.pagination-button {
  min-width: 33px;
  height: 31px;
  padding: 0 10px;
  border: 1px solid var(--sf-line);
  border-radius: 5px;
  background: #fff;
  color: #17203d;
  font-weight: 700;
}

.pagination-button.active {
  border-color: var(--sf-blue);
  background: var(--sf-blue);
  color: #fff;
}

.pagination-button[disabled] {
  cursor: default;
  opacity: 0.45;
}

.screener-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 70px;
  align-items: center;
  gap: 32px;
  min-height: 96px;
  padding: 18px 34px;
  border-top: 1px solid var(--sf-line);
  background: #fff;
}

.risk-copy {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #26314f;
}

.risk-icon {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  flex: 0 0 33px;
  border: 2px solid #6f7a93;
  border-radius: 50%;
  color: #6f7a93;
  font-size: 20px;
}

.risk-copy p,
.legal-copy p {
  margin: 0;
  color: #26314f;
  font-size: 12px;
  line-height: 1.45;
}

.legal-copy {
  text-align: right;
}

.legal-copy a {
  color: #26314f;
  text-decoration: none;
}

.legal-copy span {
  margin: 0 12px;
}

.footer-mark {
  width: 54px;
  height: auto;
}

.screener-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(3px);
}

.screener-overlay > div {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 22px 28px;
  border: 1px solid var(--sf-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--sf-shadow);
}

.screener-overlay p {
  margin: 0;
  color: #202846;
  font-weight: 700;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid #dbe6ff;
  border-top-color: var(--sf-blue);
  border-radius: 50%;
  animation: spin 0.9s infinite linear;
}

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

@media (max-width: 1280px) {
  body.screener-page nav .nav-content {
    padding: 11px 24px;
  }

  body.screener-page nav .nav-content .nav-links .nav-link {
    margin-left: 10px;
    font-size: 14px;
  }

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

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

@media (max-width: 980px) {
  body.screener-page nav {
    position: relative;
  }

  body.screener-page nav .nav-content {
    flex-wrap: wrap;
  }

  body.screener-page nav .nav-content .nav-links {
    order: 3;
    width: 100%;
    margin: 14px 0 0;
    overflow-x: auto;
  }

  body.screener-page nav .nav-content .nav-links .active::after {
    bottom: -6px;
  }

  .screener-shell {
    width: calc(100% - 32px);
  }

  .screener-hero {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .screener-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .category-tabs {
    overflow-x: auto;
    grid-template-columns: repeat(7, minmax(190px, 1fr));
  }

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

  .screener-footer {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .legal-copy {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .screener-shell {
    width: calc(100% - 24px);
    padding-top: 22px;
  }

  .screener-hero h1 {
    font-size: 34px;
  }

  .screener-actions,
  .period-buttons,
  .results-footer {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .screener-button,
  .period-button {
    width: 100%;
  }

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

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

  .condition-mode {
    justify-self: start;
  }

  .metric-card {
    grid-template-columns: 62px minmax(0, 1fr);
  }

  .metric-spark,
  .donut {
    display: none;
  }
}
