:root {
  --bg: #f4f7f9;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d9dee7;
  --accent: #0f8b8d;
  --accent-dark: #0a696b;
  --red: #b42318;
  --amber: #b54708;
  --green: #067647;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, #eef5f5 0, var(--bg) 190px, var(--bg) 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  border: 0;
  border-radius: 6px;
  min-height: 40px;
  padding: 8px 14px;
  color: #fff;
  background: var(--accent);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.btn {
  letter-spacing: 0;
  text-transform: none;
}

button,
input,
select {
  max-width: 100%;
}

.input:focus,
.select:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 18%, transparent);
  outline-offset: 1px;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

button:hover:not(:disabled) {
  background: var(--accent-dark);
}

input,
select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

select {
  min-height: 40px;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 17px,
    calc(100% - 12px) 17px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.controls {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.controls input {
  width: 112px;
}

.mode-switch {
  display: flex;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 76%, #dfe9ea);
  padding: 3px;
}

.mode-switch button {
  border-radius: 5px;
  padding: 8px 12px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.mode-switch button.active {
  color: #fff;
  background: var(--accent);
}

.mode-switch.tabs-box {
  height: auto;
  box-shadow: inset 0 0 0 1px rgba(15, 139, 141, 0.04);
}

.button-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 46px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(28px, 4vw, 44px);
}

.topbar p,
.section-head p,
.opportunity p,
.venue p,
.signal p,
small {
  color: var(--muted);
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

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

.config-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
  margin-bottom: 18px;
}

.config-panel,
.section,
.opportunity-panel {
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.025);
}

.config-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr 120px auto;
  gap: 10px;
  align-items: end;
}

.stock-config-summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #eef1f5;
  border-radius: 7px;
  background: #fbfcfe;
  padding: 12px 14px;
}

.stock-config-summary span,
.advanced-stock-config summary {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.stock-config-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
}

.stock-config-summary p {
  margin: 0;
  max-width: 620px;
  color: var(--muted);
  text-align: right;
}

.advanced-stock-config {
  margin-top: 10px;
}

.advanced-stock-config summary {
  cursor: pointer;
  user-select: none;
}

.advanced-stock-config .config-grid {
  margin-top: 10px;
}

.notification-panel {
  margin-bottom: 18px;
}

.trading-panel {
  margin-bottom: 18px;
}

.notification-panel button,
.trading-panel button {
  min-height: 42px;
  border-radius: 6px;
  padding: 9px 16px;
  font-size: 14px;
  line-height: 1.2;
}

.notification-block,
.notification-target-form,
.notification-rule-grid,
.two-field-grid {
  display: grid;
  gap: 12px;
  align-items: end;
  min-width: 0;
}

.notification-block {
  grid-template-columns: 160px minmax(360px, 1fr) 110px 110px 110px;
  align-items: end;
}

.notification-card {
  border: 1px solid #eef1f5;
  border-radius: 7px;
  background: #fbfcfe;
  padding: 14px;
  margin-top: 14px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.notification-card.compact {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.notification-card-head {
  margin-bottom: 10px;
}

.notification-target-form {
  grid-template-columns: minmax(0, 1fr) 180px 160px;
  align-items: end;
  justify-content: stretch;
  min-width: 0;
}

.notification-rule-grid {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.stock-target-form {
  grid-template-columns: minmax(0, 1fr) 180px 160px;
}

.funding-target-form {
  grid-template-columns: minmax(0, 1fr) 160px 160px 170px;
}

.price-target-form {
  grid-template-columns: 130px minmax(220px, 1fr) minmax(260px, 1.1fr) 140px 150px;
}

.price-target-form button {
  justify-self: start;
}

.alpha-spread-target-form {
  grid-template-columns: minmax(0, 1fr) 180px 160px;
}

.alpha-index-target-form {
  grid-template-columns: 160px minmax(0, 1fr) 150px;
}

.two-field-grid {
  grid-template-columns: 1fr 1fr;
}

.notification-block label,
.notification-card label,
.notification-target-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  min-width: 0;
}

.notification-target-form button {
  align-self: end;
  width: auto;
  min-width: 120px;
  white-space: nowrap;
}

.notification-target-form input,
.notification-target-form select,
.trading-form input,
.trading-form select,
.trading-card input,
.trading-card select {
  height: 42px;
  width: 100%;
  min-width: 0;
}

.check-field {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 8px !important;
  min-height: 40px;
  color: var(--ink) !important;
}

.check-field input {
  width: 16px;
  height: 16px;
}

.trading-warning {
  border: 1px solid #f3d7a6;
  border-radius: 7px;
  background: #fff8ea;
  color: #8a4b08;
  padding: 10px 12px;
  font-weight: 750;
}

.trading-form,
.trading-strategy-grid,
.trading-toggles {
  display: grid;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

.trading-form {
  grid-template-columns: 180px 180px;
}

.trading-card {
  border: 1px solid #eef1f5;
  border-radius: 7px;
  background: #fbfcfe;
  padding: 14px;
  margin-top: 14px;
}

.trading-card-head {
  margin-bottom: 12px;
}

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

.trading-strategy-grid.risk-grid {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}

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

.trading-form label,
.trading-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.trading-result,
.trading-orders,
.trade-leg-list {
  display: grid;
  gap: 10px;
}

.trading-live-section {
  margin-bottom: 18px;
  padding-top: 14px;
}

.trading-live-section .section-head {
  margin-bottom: 10px;
}

.trading-live-section .section-head h2 {
  font-size: 19px;
}

.trading-live-section .section-head p {
  font-size: 13px;
  line-height: 1.35;
}

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

.trading-live-card {
  border: 1px solid #dce3ec;
  border-radius: 7px;
  background: #fff;
  padding: 9px 11px;
  min-height: 112px;
  display: grid;
  align-content: start;
  gap: 5px;
}

.trading-live-card > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.trading-live-card h3 {
  margin: 0;
  font-size: clamp(22px, 2.1vw, 30px);
  line-height: 1.05;
}

.trading-live-card small {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.25;
  font-size: 12px;
}

.price-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid #eef1f5;
  padding-top: 4px;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.price-line strong {
  color: var(--ink);
  font-size: 16px;
}

.spread-card.ready {
  background: #f8fbfd;
}

.spread-card.triggered {
  border-color: rgba(194, 65, 12, 0.3);
  background: #fff4ed;
}

.spread-card.triggered h3,
.spread-card.triggered .price-line strong {
  color: #9a3412;
}

.spread-card.waiting {
  background: #fbfcfe;
}

.trading-live-log {
  border: 1px solid #e8edf3;
  border-radius: 7px;
  background: #0f1720;
  color: #c8d2df;
  padding: 10px 12px;
  margin-top: 10px;
  display: grid;
  gap: 2px;
  min-height: 420px;
  max-height: 560px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.28;
}

.trading-live-log p {
  margin: 0;
  white-space: nowrap;
}

.trading-action-row {
  justify-content: flex-end;
  margin-top: 12px;
}

.trade-leg-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 10px;
}

.trade-leg,
.trading-order {
  border: 1px solid #eef1f5;
  border-radius: 7px;
  background: #fff;
  padding: 10px 12px;
}

.trade-leg span,
.trading-order small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.trade-leg strong {
  display: block;
  margin: 4px 0;
  font-size: 17px;
}

.trading-order p {
  margin: 8px 0 0;
}

.notification-target-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  min-width: 0;
}

.notification-target {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 96px;
  gap: 12px;
  align-items: center;
  border: 1px solid #e6ebf2;
  border-radius: 7px;
  background: #fff;
  padding: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.notification-target.single-threshold-target,
.notification-target.threshold-target {
  grid-template-columns: minmax(0, 1fr) auto 96px;
}

.notification-target.index-target {
  grid-template-columns: minmax(0, 1fr) 96px;
}

.notification-target strong {
  display: block;
}

.notification-target small {
  display: block;
}

.notification-target input {
  height: 42px;
  width: 100%;
  min-width: 0;
}

.notification-target-fields {
  display: flex;
  gap: 10px;
  align-items: end;
}

.notification-target-fields label {
  width: 150px;
  min-width: 0;
}

.notification-target button {
  align-self: end;
  justify-self: end;
  width: 96px;
  min-width: 0;
  min-height: 42px;
  padding: 9px 12px;
  background: #7a271a;
}

.notification-target button:hover:not(:disabled) {
  background: #55160c;
}

@media (max-width: 1180px) {
  .notification-block,
  .notification-target-form,
  .funding-target-form,
  .price-target-form,
  .alpha-spread-target-form,
  .alpha-index-target-form,
  .notification-target,
  .notification-target.single-threshold-target,
  .notification-target.index-target,
  .notification-target.threshold-target {
    grid-template-columns: 1fr;
  }

  .notification-panel button,
  .notification-target-form button,
  .notification-target button {
    width: 100%;
    justify-self: stretch;
  }

  .notification-target-fields {
    width: 100%;
  }
}

.contract-row {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 140px auto minmax(180px, auto);
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.contract-row label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.contract-row select {
  width: 100%;
  font-weight: 750;
}

.compact-field {
  min-width: 132px;
}

.config-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.hint {
  color: var(--muted);
}

.summary article,
.alpha-summary article,
.opportunity-panel,
.opportunity,
.venue,
.signal,
.section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.opportunity-panel {
  padding: 18px;
  margin-bottom: 18px;
}

.opportunity-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 170px)) minmax(220px, 1fr);
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.opportunity-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.opportunity-controls input {
  width: 100%;
  min-height: 42px;
}

.opportunity-controls .hint {
  align-self: center;
  margin: 0;
}

.opportunity-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

.opportunity {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border-left: 5px solid var(--line);
  padding: 13px 14px;
}

.opportunity.high {
  border-left-color: var(--red);
}

.opportunity.medium {
  border-left-color: var(--amber);
}

.opportunity.low,
.opportunity.empty {
  border-left-color: var(--green);
}

.opportunity span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.opportunity h3 {
  margin: 3px 0 5px;
  font-size: 17px;
}

.opportunity p {
  margin-bottom: 4px;
  font-weight: 750;
}

.opportunity-side {
  display: grid;
  justify-items: end;
  gap: 4px;
  min-width: 112px;
}

.opportunity-side strong {
  font-size: 18px;
}

.summary article {
  display: grid;
  gap: 7px;
  padding: 18px;
}

.alpha-summary article {
  display: grid;
  gap: 7px;
  padding: 16px;
}

.summary span,
.alpha-summary span {
  color: var(--muted);
  font-size: 13px;
}

.summary strong,
.alpha-summary strong {
  font-size: 28px;
}

.section {
  padding: 18px;
  margin-top: 16px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.section-head p {
  max-width: 520px;
  margin-bottom: 0;
  text-align: right;
}

.section-tools {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
}

.section-tools label {
  display: grid;
  gap: 6px;
  min-width: 118px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.section-tools input {
  width: 112px;
}

.alpha-head {
  align-items: center;
}

.alpha-head > div:first-child {
  min-width: 0;
}

.alpha-head p {
  max-width: none;
  margin-top: 6px;
  text-align: left;
  overflow-wrap: anywhere;
}

.alpha-head .button-row {
  flex-shrink: 0;
}

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

.venue {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  padding: 16px;
}

.venue.unavailable {
  border-color: #f2b8b5;
  background: #fff7f6;
}

.venue-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 24px;
  margin-bottom: 12px;
}

.venue-title h3 {
  margin-bottom: 0;
  font-size: 18px;
}

.venue-title span {
  color: var(--muted);
  font-size: 13px;
}

.venue strong {
  display: block;
  min-height: 34px;
  margin-bottom: 6px;
  font-size: 26px;
  line-height: 1.25;
}

.venue-source {
  min-height: 36px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid #eef1f5;
  padding-top: 8px;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  font-weight: 700;
}

.hot {
  color: var(--amber);
}

.funding-positive-hot {
  color: #a61111;
  background: #fff0f0;
  border-radius: 5px;
  font-weight: 900;
}

.funding-negative-hot {
  color: #075f46;
  background: #ecfdf3;
  border-radius: 5px;
  font-weight: 850;
}

.spread-hot {
  color: #7a271a;
  background: #fff1e8;
  border-radius: 5px;
  font-weight: 900;
}

.spread-watch {
  color: #93370d;
  background: #fff7ed;
  border-radius: 5px;
  font-weight: 850;
}

.signal-list {
  display: grid;
  gap: 10px;
}

.signal {
  padding: 15px;
  border-left: 5px solid var(--line);
}

.signal.medium {
  border-left-color: var(--amber);
}

.signal.watch {
  border-left-color: var(--accent);
}

.signal.high {
  border-left-color: var(--red);
}

.signal.low {
  border-left-color: var(--green);
}

.signal span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.signal h3 {
  margin: 4px 0 8px;
  font-size: 18px;
}

.signal .action {
  color: var(--ink);
  font-weight: 800;
}

.signal p:last-child {
  margin-bottom: 0;
}

.alpha-filters {
  display: flex;
  align-items: end;
  gap: 10px;
}

.alpha-filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.alpha-table-wrap {
  width: 100%;
  overflow: auto;
}

.alpha-table {
  width: 100%;
  min-width: 1510px;
  border-collapse: collapse;
}

.alpha-table th,
.alpha-table td {
  border-bottom: 1px solid #eef1f5;
  padding: 11px 10px;
  text-align: right;
  white-space: nowrap;
}

.alpha-table th:first-child,
.alpha-table td:first-child,
.alpha-table th:last-child,
.alpha-table td:last-child {
  text-align: left;
}

.alpha-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.alpha-table td:first-child {
  display: grid;
  gap: 3px;
}

.alpha-table td:first-child small {
  font-size: 12px;
}

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

.negative {
  color: var(--red);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 190px;
}

.tag {
  border: 1px solid #c9d3df;
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--accent-dark);
  background: #edf7f7;
  font-size: 12px;
  font-weight: 750;
}

.chip-query-panel {
  max-width: 820px;
}

.chip-query-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 10px;
  align-items: end;
}

.chip-query-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.chip-combobox {
  position: relative;
  min-width: 0;
}

.chip-combobox input {
  width: 100%;
}

.chip-search-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: grid;
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px;
}

.chip-search-menu[hidden] {
  display: none;
}

.chip-search-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-height: 50px;
  border-radius: 5px;
  padding: 7px 10px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.chip-search-option:hover,
.chip-search-option:focus-visible {
  color: var(--ink);
  background: #edf7f7;
}

.chip-search-option span {
  display: grid;
  gap: 1px;
}

.chip-search-option small,
.chip-search-option em {
  color: var(--muted);
  font-style: normal;
  font-weight: 600;
}

.chip-search-option em {
  flex: 0 0 auto;
  font-size: 12px;
}

.chip-search-empty {
  margin: 0;
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
}

.chip-result {
  display: grid;
  gap: 16px;
  overflow: hidden;
}

.chip-result-head {
  align-items: center;
  margin-bottom: 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.chip-result-head > div:first-child {
  min-width: 0;
}

.chip-result-head p {
  max-width: 760px;
  margin-top: 5px;
  text-align: left;
  overflow-wrap: anywhere;
}

.chip-risk-badge {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  background: #f6f7f9;
}

.chip-risk-badge strong {
  font-size: 26px;
  line-height: 1;
}

.chip-risk-badge span {
  font-weight: 800;
}

.chip-risk-badge.medium {
  border-color: #f4c790;
  color: var(--amber);
  background: #fff8ed;
}

.chip-risk-badge.high {
  border-color: #f3b5af;
  color: var(--red);
  background: #fff1f0;
}

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

.chip-summary article {
  display: grid;
  gap: 6px;
  min-height: 108px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 6px;
  padding: 12px 14px;
  background: #fbfcfe;
}

.chip-summary span,
.chip-summary small {
  color: var(--muted);
}

.chip-summary strong {
  font-size: 25px;
}

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

.chip-analysis-block {
  border: 1px solid var(--line);
  border-radius: 7px;
  min-height: 132px;
  padding: 14px 16px;
  background: #fbfcfe;
}

.chip-analysis-block h3,
.chip-table-section h3 {
  margin-bottom: 10px;
  font-size: 16px;
}

.chip-reason-list {
  display: grid;
  gap: 7px;
}

.chip-reason-list p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.chip-reason-list p::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.chip-reason-list p.risk {
  color: var(--red);
}

.chip-reason-list p.risk::before {
  background: var(--red);
}

.compact-head {
  align-items: end;
  margin-bottom: 8px;
}

.compact-head p {
  text-align: right;
}

.chip-table-section {
  min-width: 0;
}

.chip-holder-table {
  width: 100%;
  min-width: 760px;
}

.chip-holder-table th:first-child,
.chip-holder-table td:first-child {
  display: table-cell;
  width: 54px;
}

.chip-holder-table td:nth-child(2) {
  display: table-cell;
  min-width: 180px;
}

.chip-address-cell {
  display: grid;
  gap: 2px;
}

.chip-holder-table th:nth-child(4),
.chip-holder-table th:nth-child(5),
.chip-holder-table td:nth-child(4),
.chip-holder-table td:nth-child(5) {
  text-align: right;
}

.chip-holder-table a {
  color: var(--ink);
  font-weight: 750;
  text-decoration: none;
}

.chip-type {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  background: #eef1f5;
  font-size: 12px;
  font-weight: 800;
}

.chip-type.creator {
  color: var(--red);
  background: #fff1f0;
}

.chip-type.contract {
  color: var(--amber);
  background: #fff8ed;
}

.chip-type.dealerContract {
  color: var(--red);
  background: #fff1f0;
}

.chip-type.liquidity {
  color: var(--accent-dark);
  background: #e8f7f4;
}

.chip-type.burn {
  color: #fff;
  background: #667085;
}

.chip-dex-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.chip-dex-list article {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.chip-dex-list small,
.chip-dex-list span,
.chip-disclaimer {
  color: var(--muted);
}

.chip-result[hidden] {
  display: none;
}

.chip-disclaimer {
  margin: 0;
  font-size: 12px;
}

.muted-tag {
  color: var(--muted);
  background: #f6f7f9;
}

@media (max-width: 900px) {
  .summary,
  .alpha-summary,
  .chip-summary,
  .chip-analysis-grid,
  .chip-dex-list,
  .chip-query-form,
  .venue-grid,
  .config-grid,
  .stock-config-summary,
  .notification-block,
  .notification-target-form,
  .funding-target-form,
  .alpha-spread-target-form,
  .alpha-index-target-form,
  .trading-form,
  .trading-strategy-grid,
  .trading-strategy-grid.risk-grid,
  .trading-toggles,
  .trading-live-grid,
  .trade-leg-list,
  .notification-rule-grid,
  .two-field-grid,
  .notification-target,
  .notification-target.single-threshold-target,
  .notification-target.index-target,
  .contract-row,
  .opportunity-controls,
  .opportunity {
    grid-template-columns: 1fr;
  }

  .opportunity-side {
    justify-items: start;
  }

  .section-head,
  .topbar,
  .controls,
  .section-tools,
  .stock-config-summary {
    flex-direction: column;
  }

  .mode-switch,
  .button-row,
  .alpha-filters {
    width: 100%;
  }

  .mode-switch {
    flex-wrap: wrap;
  }

  .controls,
  .section-tools,
  .button-row,
  .alpha-filters {
    align-items: stretch;
  }

  .mode-switch button,
  .button-row button,
  .alpha-filters label {
    flex: 1;
  }

  .controls label,
  .controls button,
  .section-tools label,
  .section-tools input,
  .notification-block input,
  .notification-card input,
  .notification-card select,
  .trading-form input,
  .trading-form select,
  .trading-card input,
  .trading-card select,
  .notification-target-form button,
  .notification-target input,
  .notification-target button,
  .notification-target-fields,
  .notification-target-fields label,
  .contract-row button,
  .config-grid button,
  .contract-row select,
  .config-grid input,
  .config-grid select,
  .alpha-filters select {
    width: 100%;
  }

  .section-head p {
    text-align: left;
  }

  .opportunity-controls .hint {
    align-self: start;
  }

  .stock-config-summary p {
    max-width: none;
    text-align: left;
  }

  .notification-target-fields {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  body {
    background: #f7f9fc;
  }

  button {
    min-height: 44px;
  }

  input,
  select {
    min-height: 44px;
    font-size: 16px;
  }

  .shell {
    width: 100%;
    padding: 18px 10px 32px;
  }

  .topbar {
    gap: 14px;
    margin-bottom: 16px;
  }

  .eyebrow {
    font-size: 11px;
  }

  h1 {
    font-size: 30px;
    line-height: 1.08;
  }

  .topbar p {
    font-size: 14px;
    line-height: 1.45;
  }

  .controls {
    width: 100%;
    gap: 8px;
  }

  .mode-switch {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .chip-result-head {
    align-items: stretch;
  }

  .chip-risk-badge {
    justify-content: center;
  }

  .compact-head p {
    text-align: left;
  }

  .mode-switch button {
    padding: 9px 8px;
    font-size: 14px;
  }

  .opportunity-panel,
  .config-panel,
  .section {
    border-radius: 7px;
    padding: 12px;
    margin-bottom: 12px;
  }

  .section {
    margin-top: 12px;
  }

  .section-head {
    gap: 10px;
    margin-bottom: 12px;
  }

  .section-head h2 {
    font-size: 18px;
  }

  .section-head p,
  .hint {
    font-size: 13px;
    line-height: 1.45;
  }

  .summary,
  .alpha-summary {
    gap: 10px;
    margin-bottom: 12px;
  }

  .summary article,
  .alpha-summary article,
  .venue,
  .signal,
  .opportunity {
    border-radius: 7px;
    padding: 12px;
  }

  .summary strong,
  .alpha-summary strong {
    font-size: 25px;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }

  .venue strong {
    font-size: 24px;
    overflow-wrap: anywhere;
  }

  .venue-title {
    gap: 8px;
    min-height: 0;
  }

  .venue-title h3 {
    font-size: 17px;
  }

  .venue strong,
  .venue-source {
    min-height: 0;
  }

  dl div {
    align-items: baseline;
  }

  dd {
    text-align: right;
    overflow-wrap: anywhere;
  }

  .opportunity-list {
    max-height: none;
  }

  .opportunity h3,
  .signal h3 {
    font-size: 16px;
    line-height: 1.3;
  }

  .opportunity p,
  .signal p {
    font-size: 14px;
    line-height: 1.45;
  }

  .alpha-filters {
    display: grid;
    grid-template-columns: 1fr;
  }

  .alpha-table-wrap {
    overflow: visible;
  }

  .alpha-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 10px;
  }

  .alpha-table thead {
    display: none;
  }

  .alpha-table tbody,
  .alpha-table tr,
  .alpha-table td {
    display: block;
    width: 100%;
  }

  .alpha-table tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 8px 10px;
  }

  .alpha-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid #eef1f5;
    padding: 8px 0;
    text-align: right;
    white-space: normal;
  }

  .alpha-table td:last-child {
    border-bottom: 0;
  }

  .alpha-table td:first-child {
    display: flex;
    align-items: baseline;
  }

  .alpha-table td:first-child small::before {
    content: "/ ";
  }

  .alpha-table td::before {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-align: left;
  }

  .alpha-table td:nth-child(1)::before { content: "合约"; }
  .alpha-table td:nth-child(2)::before { content: "Alpha 盘口中价"; }
  .alpha-table td:nth-child(3)::before { content: "合约价"; }
  .alpha-table td:nth-child(4)::before { content: "合约-Alpha价差"; }
  .alpha-table td:nth-child(5)::before { content: "24h"; }
  .alpha-table td:nth-child(6)::before { content: "24h 成交额"; }
  .alpha-table td:nth-child(7)::before { content: "MC"; }
  .alpha-table td:nth-child(8)::before { content: "FDV"; }
  .alpha-table td:nth-child(9)::before { content: "OI 名义"; }
  .alpha-table td:nth-child(10)::before { content: "OI 1h"; }
  .alpha-table td:nth-child(11)::before { content: "当前年化"; }
  .alpha-table td:nth-child(12)::before { content: "7天年化"; }
  .alpha-table td:nth-child(13)::before { content: "标签"; }

  .alpha-table td[colspan] {
    display: block;
    text-align: left;
  }

  .alpha-table td[colspan]::before {
    content: "";
  }

  .funding-positive-hot,
  .funding-negative-hot,
  .spread-hot,
  .spread-watch {
    padding: 4px 7px;
  }

  .tag-row {
    justify-content: flex-end;
    min-width: 0;
  }
}

/* DaisyUI integration: final component layer */
html {
  font-size: 16px;
}

body {
  color: #18212f;
  font-family: "SF Pro Text", "SF Pro Display", "PingFang SC", "Microsoft YaHei", Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 450;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
strong,
button,
label,
th {
  letter-spacing: 0;
}

h1 {
  font-weight: 760;
  line-height: 1.08;
}

h2,
h3 {
  font-weight: 720;
}

.shell {
  width: min(1240px, calc(100% - 36px));
}

.topbar {
  align-items: center;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(207, 216, 226, 0.75);
  padding: 4px 0 22px;
}

.topbar > div:first-child {
  min-width: 300px;
}

.eyebrow {
  margin-bottom: 7px;
  color: #397376;
  font-size: 11px;
  font-weight: 800;
}

.topbar h1 {
  margin-bottom: 7px;
  font-size: clamp(30px, 3.5vw, 46px);
}

.topbar p:last-child {
  margin-bottom: 0;
  font-size: 15px;
}

.controls {
  align-items: center;
}

.mode-switch.tabs-box {
  gap: 2px;
  border: 1px solid #d5dee7;
  border-radius: 7px;
  padding: 3px;
  background: rgba(237, 242, 246, 0.92);
}

.mode-switch .tab {
  height: 38px;
  min-height: 38px;
  border: 0;
  border-radius: 5px;
  padding: 0 13px;
  color: #617083;
  background: transparent;
  box-shadow: none;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.mode-switch .tab:hover:not(:disabled) {
  color: #245f62;
  background: rgba(255, 255, 255, 0.8);
}

.mode-switch .tab.active {
  color: #fff;
  background: #118b8d;
  box-shadow: 0 2px 5px rgba(15, 107, 109, 0.2);
}

.btn {
  min-height: 40px;
  height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 80ms ease;
}

.btn.btn-primary {
  border-color: #0f8587;
  color: #fff;
  background: #118b8d;
}

.btn.btn-primary:hover:not(:disabled) {
  border-color: #0b7375;
  color: #fff;
  background: #0d7d7f;
  box-shadow: 0 3px 8px rgba(15, 107, 109, 0.18);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: none;
}

.btn:focus-visible,
.input:focus-visible,
.select:focus-visible,
.checkbox:focus-visible {
  outline: 3px solid rgba(17, 139, 141, 0.18);
  outline-offset: 2px;
}

.input,
.select {
  width: 100%;
  min-height: 42px;
  height: 42px;
  border: 1px solid #d2dbe5;
  border-radius: 6px;
  color: #202a37;
  background-color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 570;
  box-shadow: 0 1px 1px rgba(16, 24, 40, 0.025);
}

.input::placeholder {
  color: #98a2b3;
  font-weight: 500;
}

.select {
  padding-right: 34px;
}

.checkbox {
  width: 19px;
  height: 19px;
  border-radius: 4px;
}

.config-panel,
.opportunity-panel,
.section {
  border-color: #d9e1e9;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 26px rgba(16, 24, 40, 0.025);
}

.config-panel,
.opportunity-panel {
  padding: 18px;
}

.section {
  padding: 18px;
}

.section-head {
  align-items: center;
  margin-bottom: 16px;
}

.section-head h2 {
  color: #18212f;
  font-size: 20px;
}

.section-head p,
.hint {
  color: #69778a;
  font-weight: 500;
}

.button-row {
  flex-wrap: wrap;
  gap: 8px;
}

/* Stock monitor */
.opportunity-panel > .section-head {
  border-bottom: 1px solid #e6ebf1;
  padding-bottom: 13px;
}

.opportunity-controls {
  grid-template-columns: repeat(3, minmax(130px, 165px)) minmax(260px, 1fr);
  border: 1px solid #e2e9ef;
  border-radius: 7px;
  padding: 12px;
  background: #f8fafb;
}

.opportunity-controls label,
.contract-row label,
.config-grid label,
.compact-field,
.alpha-filters label {
  color: #5f6f82;
  font-size: 12px;
  font-weight: 700;
}

.opportunity {
  border-color: #dde5ec;
  border-left-width: 4px;
  border-radius: 7px;
  padding: 12px 14px;
  box-shadow: none;
}

.opportunity h3 {
  font-size: 16px;
}

.contract-row {
  grid-template-columns: minmax(300px, 1fr) 155px auto minmax(150px, auto);
  border-bottom: 1px solid #e6ebf1;
  padding-bottom: 15px;
}

.stock-config-summary {
  align-items: center;
  margin-top: 14px;
  border-color: #e0e7ee;
  background: #f8fafb;
}

.advanced-stock-config {
  border-top: 1px solid #e8edf2;
  padding-top: 12px;
}

.advanced-stock-config summary {
  width: fit-content;
  color: #3d6870;
  font-weight: 700;
}

.summary {
  gap: 12px;
}

.summary article,
.alpha-summary article {
  border-color: #dbe3ea;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
}

.summary strong,
.alpha-summary strong {
  color: #17212f;
  font-size: 27px;
  font-weight: 740;
}

.venue-grid {
  gap: 12px;
}

.venue {
  border-color: #dce4eb;
  border-radius: 8px;
  padding: 15px;
  box-shadow: none;
}

.venue-title {
  border-bottom: 1px solid #e9edf2;
  padding-bottom: 10px;
}

.venue > strong {
  margin: 10px 0 2px;
  font-size: 27px;
  font-weight: 740;
}

.venue dl div {
  min-height: 37px;
}

/* Notification rules */
.notification-panel {
  display: grid;
  gap: 14px;
}

.notification-panel > .section-head {
  margin-bottom: 0;
  border-bottom: 1px solid #e4eaf0;
  padding-bottom: 14px;
}

.notification-block {
  border: 1px solid #dfe7ee;
  border-radius: 7px;
  padding: 13px;
  background: #f8fafb;
}

.notification-card {
  margin-top: 0;
  border-color: #dde5ec;
  border-radius: 8px;
  padding: 15px;
  background: #fff;
}

.notification-card > .check-field,
.notification-card-head {
  min-height: 34px;
  margin-bottom: 10px;
  border-bottom: 1px solid #edf1f4;
  padding-bottom: 10px;
}

.check-field,
.notification-block > .check-field,
.notification-card .check-field,
.notification-card-head > .check-field {
  display: flex;
  align-items: center;
  align-self: center;
  gap: 9px;
  width: auto;
  min-width: 0;
  color: #253141;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.check-field > input[type="checkbox"] {
  flex: 0 0 auto;
  width: 20px;
  min-width: 20px;
  max-width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
}

.check-field > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.notification-target-form {
  gap: 10px;
}

.notification-target-form label,
.notification-block label:not(.check-field) {
  color: #5f6f82;
  font-size: 12px;
  font-weight: 700;
}

.notification-target-list {
  margin-top: 12px;
  border-top: 1px dashed #dce4eb;
  padding-top: 12px;
}

.notification-target {
  border-color: #dde5ec;
  border-radius: 7px;
  padding: 12px;
  background: #fafcfd;
}

.notification-target .btn {
  border-color: #9b2c21;
  color: #fff;
  background: #9b2c21;
  box-shadow: none;
}

/* Alpha radar */
.alpha-head {
  border-bottom: 1px solid #e6ebf1;
  padding-bottom: 13px;
}

.alpha-filters {
  gap: 9px;
}

.alpha-table-wrap {
  border: 1px solid #e1e7ed;
  border-radius: 7px;
  background: #fff;
}

.alpha-table {
  font-size: 13px;
}

.alpha-table th {
  height: 44px;
  color: #607084;
  background: #f6f8fa;
  font-size: 11px;
  font-weight: 760;
  text-transform: none;
}

.alpha-table td {
  height: 52px;
  border-color: #e9edf2;
}

.alpha-table.table-zebra tbody tr:nth-child(even) {
  background: #fbfcfd;
}

.tag,
.badge {
  min-height: 24px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
}

.tag.interval-tag {
  border-color: #c5d8e7;
  color: #315d7a;
  background: #eef6fb;
}

/* Trading */
.trading-panel > .section-head {
  border-bottom: 1px solid #e5ebf0;
  padding-bottom: 14px;
}

.trading-warning {
  border: 1px solid #f2d39f;
  border-left: 4px solid #d99026;
  border-radius: 7px;
  color: #7a4a10;
  background: #fff9ed;
}

.trading-card,
.trading-live-card,
.trade-leg,
.trading-order {
  border-color: #dce4eb;
  border-radius: 8px;
  background: #fff;
}

.trading-card-head {
  border-bottom: 1px solid #e8edf2;
  padding-bottom: 11px;
}

.trading-live-card h3 {
  font-weight: 760;
}

.trading-live-log {
  border: 1px solid #263442;
  border-radius: 7px;
  background: #111a24;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Chip analysis */
.chip-query-panel {
  max-width: none;
}

.chip-query-form {
  grid-template-columns: minmax(0, 720px) 130px;
}

.chip-search-menu {
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.14);
}

.chip-search-option {
  font-family: inherit;
  font-size: 13px;
}

.chip-search-option strong {
  font-weight: 740;
}

@media (max-width: 1100px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .controls {
    width: 100%;
    justify-content: space-between;
  }

  .mode-switch {
    flex: 1;
  }

  .mode-switch .tab {
    flex: 1;
  }

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

@media (max-width: 760px) {
  body {
    font-size: 14px;
  }

  .shell {
    width: 100%;
    padding: 16px 10px 30px;
  }

  .topbar {
    padding-bottom: 16px;
  }

  .topbar > div:first-child {
    min-width: 0;
  }

  .topbar h1 {
    font-size: 29px;
  }

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

  .mode-switch.tabs-box {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mode-switch .tab {
    width: 100%;
    padding: 0 7px;
    font-size: 13px;
  }

  .btn,
  .input,
  .select {
    min-height: 44px;
    height: 44px;
  }

  .config-panel,
  .opportunity-panel,
  .section {
    padding: 12px;
  }

  .section-head {
    align-items: stretch;
  }

  .section-head p {
    text-align: left;
  }

  .button-row .btn {
    flex: 1;
  }

  .notification-block > .check-field {
    align-self: start;
    min-height: 44px;
  }

  .contract-row,
  .opportunity-controls,
  .notification-block,
  .notification-target-form,
  .stock-target-form,
  .funding-target-form,
  .price-target-form,
  .alpha-spread-target-form,
  .alpha-index-target-form,
  .trading-form,
  .trading-strategy-grid,
  .trading-strategy-grid.risk-grid,
  .chip-query-form {
    grid-template-columns: 1fr;
  }

  .stock-config-summary {
    align-items: flex-start;
  }

  .summary,
  .alpha-summary,
  .chip-summary {
    grid-template-columns: 1fr 1fr;
  }

  .chip-holder-table td:nth-child(1)::before { content: "排名"; }
  .chip-holder-table td:nth-child(2)::before { content: "地址"; }
  .chip-holder-table td:nth-child(3)::before { content: "类型"; }
  .chip-holder-table td:nth-child(4)::before { content: "持仓数量"; }
  .chip-holder-table td:nth-child(5)::before { content: "供应量占比"; }

  .chip-holder-table td:nth-child(n+6)::before {
    content: "";
  }

  .chip-holder-table .chip-address-cell {
    justify-items: end;
  }
}

/* Stable header geometry across module switches */
@media (min-width: 1101px) {
  .topbar {
    min-height: 168px;
    align-items: start;
    box-sizing: border-box;
  }

  .topbar > div:first-child {
    min-width: 0;
  }

  .topbar h1 {
    min-height: 50px;
  }

  #subtitle {
    min-height: 44px;
    max-width: 720px;
  }

  .topbar .controls {
    align-self: start;
    padding-top: 27px;
  }
}

.alpha-summary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

#alphaTopPositiveFunding {
  color: #b42318;
}

#alphaTopNegativeFunding {
  color: #087a4b;
}

@media (max-width: 1100px) {
  .alpha-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

@media (max-width: 430px) {
  .alpha-summary {
    grid-template-columns: 1fr;
  }
}

/* Opportunity settings: summary first, editor on demand */
.opportunity-threshold-display {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 190px)) minmax(150px, 1fr);
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  border: 1px solid #dfe7ee;
  border-radius: 8px;
  padding: 11px 13px;
  background: #f8fafb;
}

.opportunity-threshold-display > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  border-right: 1px solid #e1e8ee;
  padding: 8px 13px 8px 2px;
}

.opportunity-threshold-display span {
  color: #66758a;
  font-size: 12px;
  font-weight: 680;
}

.opportunity-threshold-display strong {
  color: #182434;
  font-size: 19px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.opportunity-threshold-display small {
  justify-self: end;
  color: #477277;
  font-size: 12px;
  font-weight: 650;
}

.opportunity-controls[hidden] {
  display: none !important;
}

.opportunity-controls:not([hidden]) {
  margin-bottom: 14px;
  animation: settings-reveal 140ms ease-out;
}

@keyframes settings-reveal {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn.secondary-action {
  border-color: #b8c7d2;
  color: #405468;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.btn.secondary-action:hover:not(:disabled),
.btn.secondary-action.settings-open {
  border-color: #6c999d;
  color: #185d61;
  background: #edf8f7;
}

/* Custom select surfaces */
button.contract-combobox-trigger:hover:not(:disabled),
button.contract-combobox-trigger[aria-expanded="true"] {
  color: #1e2938;
  background: #fff;
}

button.contract-option:hover:not(:disabled),
button.contract-option.selected {
  color: #174f52;
  background: #edf8f7;
}

.simple-combobox {
  position: relative;
  min-width: 0;
}

.simple-combobox-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  height: 44px;
  border: 1px solid #ccd7e1;
  border-radius: 7px;
  padding: 0 13px;
  color: #1e2938;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 680;
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

button.simple-combobox-trigger:hover:not(:disabled),
button.simple-combobox-trigger[aria-expanded="true"] {
  border-color: #168f91;
  color: #1e2938;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(17, 139, 141, 0.12);
}

.simple-combobox-trigger[aria-expanded="true"] .select-chevron {
  transform: rotate(225deg);
}

.simple-combobox-menu {
  position: absolute;
  z-index: 82;
  top: calc(100% + 7px);
  right: 0;
  left: 0;
  min-width: 170px;
  border: 1px solid #ccd7e1;
  border-radius: 8px;
  padding: 6px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(20, 35, 50, 0.16), 0 3px 9px rgba(20, 35, 50, 0.08);
}

.simple-combobox-menu[hidden] {
  display: none !important;
}

.simple-combobox-menu button {
  position: relative;
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 8px 12px 8px 34px;
  color: #263446;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 620;
  text-align: left;
  cursor: pointer;
}

.simple-combobox-menu button:hover:not(:disabled),
.simple-combobox-menu button.selected {
  color: #185d61;
  background: #edf8f7;
}

.simple-combobox-menu button.selected::before {
  position: absolute;
  left: 13px;
  top: 50%;
  width: 8px;
  height: 4px;
  border-bottom: 2px solid #118b8d;
  border-left: 2px solid #118b8d;
  content: "";
  transform: translateY(-65%) rotate(-45deg);
}

@media (max-width: 760px) {
  .opportunity-threshold-display {
    grid-template-columns: 1fr;
  }

  .opportunity-threshold-display > div {
    border-right: 0;
    border-bottom: 1px solid #e1e8ee;
    padding-right: 2px;
  }

  .opportunity-threshold-display small {
    justify-self: start;
  }
}

/* Alpha filter custom selects */
.alpha-filters label:nth-child(1),
.alpha-filters label:nth-child(2) {
  width: 132px;
}

.alpha-filters label:nth-child(3) {
  width: 224px;
}

.styled-select {
  position: relative;
  width: 100%;
  min-width: 0;
}

.styled-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  height: 42px;
  border: 1px solid #ccd7e1;
  border-radius: 7px;
  padding: 0 12px;
  color: #1e2938;
  background: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 680;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

button.styled-select-trigger:hover:not(:disabled),
button.styled-select-trigger[aria-expanded="true"] {
  border-color: #168f91;
  color: #1e2938;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(17, 139, 141, 0.12);
}

.styled-select-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.styled-select-trigger[aria-expanded="true"] .select-chevron {
  transform: rotate(225deg);
}

.styled-select-menu {
  position: absolute;
  z-index: 90;
  top: calc(100% + 7px);
  right: 0;
  min-width: 100%;
  width: max-content;
  max-width: min(310px, calc(100vw - 28px));
  border: 1px solid #ccd7e1;
  border-radius: 8px;
  padding: 6px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(20, 35, 50, 0.16), 0 3px 9px rgba(20, 35, 50, 0.08);
}

.styled-select-menu[hidden] {
  display: none !important;
}

.styled-select-menu button {
  position: relative;
  display: block;
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 8px 13px 8px 34px;
  color: #263446;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 620;
  line-height: 1.3;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.styled-select-menu button:hover:not(:disabled),
.styled-select-menu button.selected {
  color: #185d61;
  background: #edf8f7;
}

.styled-select-menu button.selected::before {
  position: absolute;
  left: 13px;
  top: 50%;
  width: 8px;
  height: 4px;
  border-bottom: 2px solid #118b8d;
  border-left: 2px solid #118b8d;
  content: "";
  transform: translateY(-65%) rotate(-45deg);
}

@media (max-width: 760px) {
  .alpha-filters label:nth-child(1),
  .alpha-filters label:nth-child(2),
  .alpha-filters label:nth-child(3) {
    width: 100%;
  }

  .styled-select-menu {
    right: auto;
    left: 0;
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 430px) {
  .summary,
  .alpha-summary,
  .chip-summary,
  .chip-analysis-grid,
  .chip-dex-list {
    grid-template-columns: 1fr;
  }

  .mode-switch.tabs-box {
    grid-template-columns: 1fr 1fr;
  }

  .notification-target,
  .notification-target.single-threshold-target,
  .notification-target.threshold-target,
  .notification-target.index-target {
    grid-template-columns: 1fr;
  }

  .notification-target-fields,
  .notification-target-fields label {
    width: 100%;
  }
}

/* Global control refinement */
.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.controls {
  flex-wrap: nowrap;
}

.mode-switch.tabs-box {
  display: inline-flex;
  flex-wrap: nowrap;
  width: max-content;
  max-width: none;
  border-radius: 9px;
  padding: 4px;
  background: #edf2f5;
  box-shadow: inset 0 0 0 1px rgba(35, 55, 72, 0.03);
}

.mode-switch .tab {
  position: relative;
  min-width: max-content;
  height: 40px;
  min-height: 40px;
  border-radius: 6px;
  padding-inline: 15px;
  font-size: 13px;
  font-weight: 720;
}

.mode-switch .tab.active {
  box-shadow: 0 1px 2px rgba(15, 80, 82, 0.18), 0 4px 12px rgba(15, 107, 109, 0.12);
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
  min-width: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 680;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

.input,
.select,
input:not([type="checkbox"]):not([type="radio"]),
select {
  border-color: #ccd7e1;
  border-radius: 7px;
  color: #1e2938;
  background-color: #fff;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.3;
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.input:hover,
.select:hover,
input:not([type="checkbox"]):not([type="radio"]):hover,
select:hover {
  border-color: #9fb1bf;
}

.input:focus,
.select:focus,
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus {
  border-color: #168f91;
  outline: none;
  box-shadow: 0 0 0 3px rgba(17, 139, 141, 0.13);
}

select,
.select {
  cursor: pointer;
  padding-right: 40px;
  background-image:
    linear-gradient(45deg, transparent 50%, #657487 50%),
    linear-gradient(135deg, #657487 50%, transparent 50%);
  background-position:
    calc(100% - 19px) 50%,
    calc(100% - 13px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  font-weight: 650;
}

select option,
select optgroup {
  color: #243142;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
}

select optgroup {
  color: #758294;
  font-weight: 700;
}

.native-select-proxy {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.contract-combobox {
  position: relative;
  min-width: 0;
}

.contract-combobox-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  height: 44px;
  border: 1px solid #ccd7e1;
  border-radius: 7px;
  padding: 0 13px;
  color: #1e2938;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 680;
  text-align: left;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.contract-combobox-trigger:hover,
.contract-combobox-trigger[aria-expanded="true"] {
  border-color: #168f91;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(17, 139, 141, 0.12);
}

.contract-combobox-trigger > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-chevron {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-right: 2px solid #637286;
  border-bottom: 2px solid #637286;
  transform: rotate(45deg);
  transition: transform 140ms ease;
}

.contract-combobox-trigger[aria-expanded="true"] .select-chevron {
  transform: rotate(225deg);
}

.contract-combobox-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 7px);
  left: 0;
  width: min(620px, calc(100vw - 36px));
  overflow: hidden;
  border: 1px solid #ccd7e1;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(20, 35, 50, 0.18), 0 4px 12px rgba(20, 35, 50, 0.08);
}

.contract-combobox-search {
  border-bottom: 1px solid #e5ebf0;
  padding: 10px;
  background: #f7f9fb;
}

.contract-combobox-search .input,
.contract-combobox-search input {
  width: 100%;
  height: 40px;
  min-height: 40px;
  background: #fff;
}

.contract-combobox-options {
  max-height: min(460px, 58vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  scrollbar-width: thin;
  scrollbar-color: #b8c5d0 transparent;
}

.contract-option-group {
  position: sticky;
  z-index: 1;
  top: -6px;
  padding: 9px 10px 6px;
  color: #758396;
  background: rgba(255, 255, 255, 0.96);
  font-size: 11px;
  font-weight: 760;
}

.contract-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  color: #1e2938;
  background: transparent;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.contract-option:hover,
.contract-option.selected {
  color: #174f52;
  background: #edf8f7;
}

.contract-option.selected {
  box-shadow: inset 3px 0 0 #118b8d;
}

.contract-option span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.contract-option strong {
  overflow: hidden;
  font-size: 14px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contract-option small {
  overflow: hidden;
  color: #738195;
  font-size: 12px;
  font-weight: 520;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contract-option .contract-option-meta {
  justify-items: end;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.contract-option-empty {
  margin: 0;
  padding: 28px 16px;
  color: #788699;
  text-align: center;
}

@media (max-width: 1100px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .mode-switch.tabs-box {
    width: 100%;
  }

  .mode-switch .tab {
    flex: 1 1 0;
  }
}

@media (max-width: 760px) {
  .mode-switch.tabs-box {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .mode-switch .tab {
    min-width: 0;
    padding-inline: 8px;
  }

  .contract-combobox-menu {
    position: fixed;
    top: auto;
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    max-height: 72vh;
  }

  .contract-combobox-options {
    max-height: calc(72vh - 62px);
  }
}
