/* APC Prime markets interface — aligned with the approved visual references. */

/* Header mega menu */
.nav__item--markets-mega { position: relative; }
.nav__item--markets-mega > .nav__link.is-active {
  color: var(--green-700) !important;
  background: var(--green-50);
  border-radius: 7px;
  padding-inline: 12px;
}
.nav__item--markets-mega .market-mega {
  width: 620px;
  min-width: 620px;
  left: -125px;
  padding: 0;
  display: block;
  overflow: hidden;
  border-radius: 10px;
  background: #fff;
}
.market-mega__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  grid-auto-flow: column;
}
.market-mega__item {
  min-height: 78px;
  display: grid !important;
  grid-template-columns: 34px minmax(0, 1fr) 20px;
  align-items: start !important;
  gap: 11px !important;
  padding: 14px 18px !important;
  border-radius: 0 !important;
  border-bottom: 1px solid var(--line);
  color: var(--ink) !important;
}
.market-mega__item:nth-child(-n+4) { border-right: 1px solid var(--line); }
.market-mega__item:nth-child(4),
.market-mega__item:nth-child(8) { border-bottom: 0; }
.market-mega__item:hover { background: #fafcf7 !important; }
.market-mega__num {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 24px;
  color: var(--muted-2);
}
.market-mega__copy { min-width: 0; }
.market-mega__copy strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  line-height: 1.15;
  font-weight: 700;
  color: var(--ink);
}
.market-mega__copy small {
  display: block;
  max-width: 230px;
  font-size: 11px;
  line-height: 1.35;
  font-weight: 400;
  color: var(--muted);
}
.market-mega__arrow {
  align-self: center;
  font-size: 28px;
  line-height: 1;
  font-weight: 300;
  color: var(--ink-2);
}
.market-mega__utility {
  min-height: 58px;
  display: grid !important;
  grid-template-columns: 34px minmax(0, 1fr) 20px;
  align-items: center !important;
  gap: 14px !important;
  padding: 10px 18px !important;
  border-radius: 0 !important;
  color: var(--ink) !important;
  border-bottom: 1px solid var(--line);
}
.market-mega__utility:last-child { border-bottom: 0; }
.market-mega__utility--accent { background: linear-gradient(90deg, rgba(80,144,16,.10), rgba(80,144,16,.025)); }
.market-mega__utility:hover { background: var(--green-50) !important; }
.market-mega__utility-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--green);
}
.market-mega__utility-icon svg { width: 27px; height: 27px; }
.market-mega__utility .market-mega__copy strong { font-size: 14px; margin-bottom: 3px; }
.market-mega__utility .market-mega__copy small { max-width: none; }
html[dir="rtl"] .nav__item--markets-mega .market-mega { left: auto; right: -155px; }
html[dir="rtl"] .market-mega__item:nth-child(-n+4) { border-right: 0; border-left: 1px solid var(--line); }

/* Shared page frame */
body.page-market-design,
body.page-contract-design {
  padding-top: 76px !important;
  background: #fff;
}
body.page-market-design .header,
body.page-contract-design .header {
  top: 0 !important;
  background: #fff;
  border-bottom-color: var(--line);
  box-shadow: 0 2px 12px rgba(10,10,10,.06);
}
body.page-market-design .header__logo--light,
body.page-contract-design .header__logo--light { display: none !important; }
body.page-market-design .header__logo--dark,
body.page-contract-design .header__logo--dark { display: block !important; }
body.page-market-design .nav__link,
body.page-contract-design .nav__link { color: var(--ink-2); }
body.page-market-design .nav__link:hover,
body.page-contract-design .nav__link:hover { color: var(--green); }
body.page-market-design .header__cta .btn--ghost-light,
body.page-contract-design .header__cta .btn--ghost-light {
  color: var(--ink) !important;
  border-color: var(--line) !important;
}
body.page-market-design .nav__burger,
body.page-contract-design .nav__burger { border-color: var(--line); }
body.page-market-design .nav__burger span,
body.page-contract-design .nav__burger span { background: var(--ink); }
.market-ui {
  --market-green: #4f8e12;
  --market-green-dark: #3f750b;
  --market-line: #e4e7e1;
  --market-soft: #f7f9f5;
  color: var(--ink);
}
.market-ui__grid-bg {
  background-color: #fff;
}
.market-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #7b8491;
}
.market-breadcrumbs a { color: inherit; }
.market-breadcrumbs .current { color: var(--market-green); }
.market-eyebrow {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #68717d;
}
.market-eyebrow::before {
  content: "";
  width: 40px;
  height: 2px;
  background: var(--market-green);
}

/* Overview state, matching the large market hero reference */
.market-overview-view { min-height: 620px; }
.market-overview-hero {
  position: relative;
  min-height: 620px;
  padding: 52px 0 0;
  overflow: hidden;
}
.market-overview-hero__content {
  width: min(580px, 48%);
  padding-top: 72px;
  padding-bottom: 88px;
}
.market-overview-hero h1 {
  max-width: 620px;
  margin: 0 0 24px;
  font-size: clamp(46px, 4.5vw, 68px);
  line-height: .98;
  letter-spacing: -.055em;
  font-weight: 800;
  color: #070907;
}
.market-overview-hero__lead {
  max-width: 560px;
  margin: 0;
  font-size: 20px;
  line-height: 1.45;
  color: #657080;
}
.market-overview-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 34px;
}
.market-overview-hero__actions .btn { min-width: 210px; min-height: 56px; }
.market-overview-hero__actions .btn--outline {
  color: var(--market-green-dark);
  background: #fff;
  border: 1px solid var(--market-green);
}
.market-overview-hero__tabs {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border-bottom: 1px solid var(--market-line);
}
.market-tabs {
  display: flex;
  align-items: flex-end;
  gap: 34px;
  min-height: 62px;
}
.market-tab {
  position: relative;
  height: 62px;
  display: inline-flex;
  align-items: center;
  border: 0;
  background: transparent;
  color: #66707e;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
.market-tab.is-active { color: var(--market-green-dark); font-weight: 700; }
.market-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  background: var(--market-green);
}
.market-overview-body { padding: 40px 0 48px; }
.market-overview-body__grid {
  display: grid;
  grid-template-columns: 1.1fr 1.5fr;
  gap: 64px;
  align-items: center;
}
.market-overview-body h2 {
  margin: 0 0 12px;
  font-size: 32px;
  letter-spacing: -.035em;
}
.market-overview-body p {
  margin: 0;
  max-width: 620px;
  color: #697483;
  font-size: 16px;
  line-height: 1.5;
}
.market-feature-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}
.market-feature {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 13px;
  min-height: 78px;
  padding: 0 24px;
  border-left: 1px solid var(--market-line);
}
.market-feature:first-child { border-left: 0; }
.market-feature__icon { width: 34px; height: 34px; color: #70b62c; }
.market-feature__icon svg { width: 34px; height: 34px; }
.market-feature strong { display: block; margin: 2px 0 4px; font-size: 15px; }
.market-feature small { display: block; color: #6f7885; font-size: 12px; line-height: 1.35; }

/* Compact market pages — title, tabs and specifications in one continuous frame. */
.market-product-page {
  min-height: 720px;
  padding: 34px 0 68px;
}
.market-product-header { margin-top: 24px; }
.market-product-header h1 {
  margin: 0;
  font-size: clamp(34px, 3vw, 44px);
  line-height: 1.02;
  letter-spacing: -.045em;
  color: #080a08;
}
.market-product-header p {
  max-width: 760px;
  margin: 8px 0 0;
  color: #626c79;
  font-size: 18px;
  line-height: 1.45;
}
.market-product-tabs {
  margin-top: 16px;
  border-bottom: 1px solid var(--market-line);
}
.market-product-tabs .market-tabs { min-height: 54px; }
.market-product-tabs .market-tab { height: 54px; }
.market-product-overview,
.market-product-specs { padding-top: 18px; }
.market-product-overview[hidden],
.market-product-specs[hidden] { display: none !important; }
.market-product-overview .market-overview-body__grid {
  padding: 24px;
  border: 1px solid var(--market-line);
  border-radius: 7px;
  background: rgba(255,255,255,.82);
}
.market-product-overview h2 { margin: 0 0 10px; font-size: 30px; letter-spacing: -.03em; }
.market-product-overview p { margin: 0; color: #697483; line-height: 1.55; }
.market-overview-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.market-overview-actions .btn--outline { color: var(--market-green-dark); background: #fff; border: 1px solid var(--market-green); }

/* Compact specifications state and standalone specifications page */
.market-spec-view,
.contract-page { padding: 44px 0 70px; min-height: 720px; }
.market-spec-view[hidden],
.market-overview-view[hidden] { display: none !important; }
.market-spec-header,
.contract-page__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-top: 32px;
}
.market-spec-header h1,
.contract-page__header h1 {
  margin: 0;
  font-size: clamp(42px, 4vw, 60px);
  line-height: 1;
  letter-spacing: -.055em;
}
.market-spec-header p,
.contract-page__header p {
  margin: 12px 0 0;
  color: #6d7683;
  font-size: 18px;
}
.contract-page__margin-link {
  min-width: 205px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--market-green);
  border-radius: 6px;
  color: var(--ink);
  font-weight: 600;
}
.market-spec-tabs {
  margin-top: 34px;
  border-bottom: 1px solid var(--market-line);
}
.market-spec-tabs .market-tabs { min-height: 54px; }
.market-spec-tabs .market-tab { height: 54px; }

.contract-market-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-top: 28px;
  border: 1px solid var(--market-line);
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
}
.contract-market-tab {
  min-height: 54px;
  padding: 8px 10px;
  border: 0;
  border-inline-end: 1px solid var(--market-line);
  background: #fff;
  color: #5c6571;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.contract-market-tab:last-child { border-inline-end: 0; }
.contract-market-tab.is-active {
  color: var(--market-green-dark);
  background: linear-gradient(135deg, #f0f7e9, #e8f3de);
  font-weight: 700;
}
.spec-toolbar {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) minmax(260px, 1.35fr) auto;
  gap: 18px;
  align-items: center;
  margin-top: 18px;
}
.spec-toolbar--contract { grid-template-columns: auto 1fr; }
.spec-account-control {
  display: flex;
  align-items: center;
  gap: 14px;
}
.spec-account-control > span { white-space: nowrap; color: #59616c; font-size: 14px; }
.segmented {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  border: 1px solid var(--market-line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}
.segmented button {
  min-height: 42px;
  padding: 8px 20px;
  border: 0;
  border-inline-end: 1px solid var(--market-line);
  background: #fff;
  color: #515a66;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.segmented button:last-child { border-inline-end: 0; }
.segmented button.is-active { color: #fff; background: linear-gradient(135deg, #6aae25, #44870d); font-weight: 700; }
.spec-select,
.spec-search {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--market-line);
  border-radius: 6px;
  background: #fff;
  color: #3f4751;
  font: inherit;
  font-size: 14px;
}
.spec-select { padding: 0 16px; }
.spec-search-wrap { position: relative; }
.spec-search-wrap svg {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 18px;
  height: 18px;
  color: #111;
  transform: translateY(-50%);
  pointer-events: none;
}
.spec-search { padding: 0 16px 0 46px; }
html[dir="rtl"] .spec-search-wrap svg { left: auto; right: 16px; }
html[dir="rtl"] .spec-search { padding: 0 46px 0 16px; }
.spec-all-markets {
  white-space: nowrap;
  color: var(--market-green-dark);
  font-size: 14px;
  font-weight: 700;
}
.spec-source-note {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  margin-top: 12px;
  padding: 7px 14px;
  border: 1px solid #efd99c;
  border-radius: 5px;
  background: #fff9e7;
  color: #815d11;
  font-size: 12px;
  font-weight: 600;
}
.spec-source-note__mark {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #e5a91c;
  color: #fff;
  font-size: 12px;
}

.spec-table-shell {
  margin-top: 12px;
  border: 1px solid var(--market-line);
  border-radius: 7px;
  overflow: hidden;
  background-color: #fff;
  background-image:
    linear-gradient(rgba(16,24,12,.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16,24,12,.028) 1px, transparent 1px);
  background-size: 64px 64px;
}
.spec-table-scroll { overflow-x: auto; }
.spec-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
}
.spec-table th {
  padding: 12px 18px;
  border-bottom: 1px solid var(--market-line);
  background: #fbfcfa;
  color: #5c6571;
  text-align: center;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
}
.spec-table td {
  height: 58px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--market-line);
  color: #20252a;
  font-size: 13px;
  vertical-align: middle;
  text-align: center;
}
.spec-table tr:last-child td { border-bottom: 0; }
.spec-table tbody tr.spec-row { cursor: pointer; transition: background .15s; }
.spec-table tbody tr.spec-row:hover,
.spec-table tbody tr.spec-row.is-open { background: linear-gradient(90deg, #f8fbf4, #eef7e8); }
.spec-instrument {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  text-align: start;
}
.spec-symbol-badge {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #eef0ed;
  color: #3d454c;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.spec-symbol-badge--gold { background: #f4de76; color: #705300; }
.spec-instrument strong { display: block; font-size: 13px; }
.spec-instrument small { display: block; margin-top: 2px; color: #7b8490; font-size: 11px; }
.spec-link-button {
  border: 0;
  background: transparent;
  color: var(--market-green-dark);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.spec-chevron {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: #1c2227;
  font-size: 22px;
  cursor: pointer;
  transition: transform .2s;
}
.spec-row.is-open .spec-chevron { transform: rotate(180deg); color: var(--market-green); }
.spec-detail-row td { padding: 0; background: linear-gradient(90deg, #f5faef, #fbfdf9); }
.spec-detail { padding: 18px 26px 20px; }
.spec-detail h3 { margin: 0 0 12px; font-size: 17px; }
.spec-compare {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255,255,255,.72);
}
.spec-compare th,
.spec-compare td {
  height: auto;
  padding: 8px 12px;
  border: 1px solid #dfe6da;
  text-align: center;
  font-size: 12px;
}
.spec-compare th:first-child,
.spec-compare td:first-child { text-align: center; font-weight: 600; }

[dir="rtl"] .spec-compare { direction: rtl; }
[dir="rtl"] .spec-compare th,
[dir="rtl"] .spec-compare td { text-align: center; }
.spec-detail-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 14px;
}
.spec-detail-action {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border: 1px solid #dfe6da;
  border-radius: 5px;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}
.spec-empty {
  padding: 54px 24px;
  text-align: center;
  color: #68727f;
}
.spec-empty strong { display: block; margin-bottom: 6px; color: #242a30; font-size: 17px; }
.spec-footer {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 14px;
  border-top: 1px solid var(--market-line);
  color: #6e7782;
  font-size: 12px;
}
.spec-pagination { display: flex; align-items: center; gap: 6px; }
.spec-pagination button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #66707d;
  cursor: pointer;
}
.spec-pagination button.is-active { background: #eef7e7; color: var(--market-green-dark); font-weight: 700; }
.spec-pagination button:disabled { opacity: .35; cursor: default; }

@media (max-width: 1180px) and (min-width: 1025px) {
  .nav { gap: 13px; }
  .nav__link { font-size: 13px; }
  .nav__item--markets-mega .market-mega { left: -105px; width: 650px; min-width: 650px; }
  html[dir="rtl"] .nav__item--markets-mega .market-mega { left: auto; right: -105px; }
}

@media (max-width: 1024px) {
  .market-overview-hero { min-height: 600px; }
  .market-overview-hero__content { width: min(680px, 88%); }
  .market-overview-body__grid { grid-template-columns: 1fr; gap: 30px; }
  .spec-toolbar { grid-template-columns: 1fr 1fr; }
  .spec-account-control { grid-column: 1 / -1; }
  .spec-all-markets { justify-self: end; }
  .contract-market-tabs { grid-template-columns: repeat(3, 1fr); }
  .contract-market-tab { border-bottom: 1px solid var(--market-line); }
}

@media (max-width: 720px) {
  body.page-market-design,
  body.page-contract-design { padding-top: 70px !important; }
  .market-overview-hero { min-height: 610px; padding-top: 30px; }
  .market-overview-hero__content { width: 100%; padding-top: 56px; padding-bottom: 98px; }
  .market-overview-hero h1 { font-size: 46px; }
  .market-overview-hero__lead { font-size: 17px; }
  .market-overview-hero__actions { display: grid; grid-template-columns: 1fr; }
  .market-overview-hero__actions .btn { width: 100%; }
  .market-tabs { gap: 22px; overflow-x: auto; }
  .market-tab { white-space: nowrap; }
  .market-overview-body { padding: 32px 0 44px; }
  .market-feature-row { grid-template-columns: 1fr; gap: 22px; }
  .market-feature { border-left: 0; padding: 0; }
  .market-product-page { padding-top: 28px; }
  .market-product-header h1 { font-size: 40px; }
  .market-product-header p { font-size: 16px; }
  .market-product-overview .market-overview-body__grid { padding: 18px; }
  .market-spec-view,
  .contract-page { padding-top: 30px; }
  .market-spec-header,
  .contract-page__header { display: block; }
  .market-spec-header h1,
  .contract-page__header h1 { font-size: 42px; }
  .contract-page__margin-link { margin-top: 22px; }
  .contract-market-tabs { grid-template-columns: repeat(2, 1fr); }
  .spec-toolbar,
  .spec-toolbar--contract { grid-template-columns: 1fr; }
  .spec-account-control { display: block; }
  .spec-account-control > span { display: block; margin-bottom: 8px; }
  .segmented { width: 100%; grid-template-columns: repeat(3, 1fr); }
  .segmented button { padding-inline: 10px; }
  .spec-all-markets { justify-self: start; }
  .spec-detail { padding: 16px; }
  .spec-detail-actions { grid-template-columns: 1fr; }
  .spec-footer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 420px) {
  .market-overview-hero h1 { font-size: 40px; }
  .market-spec-header h1,
  .contract-page__header h1 { font-size: 37px; }
  .contract-market-tabs { grid-template-columns: 1fr 1fr; }
  .market-product-header h1 { font-size: 36px; }
}
