.market-page {
  --ink: #17231b;
  --green: #173b2a;
  display: grid;
  gap: 22px;
  color: var(--ink);
}

.market-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  padding: 8px 0 2px;
}

.market-header > div > span {
  color: #4f785e;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.market-header h1 {
  margin: 4px 0 5px;
  font-size: clamp(36px, 5vw, 58px);
  line-height: .98;
  letter-spacing: -.055em;
}

.market-header p { max-width: 760px; margin: 0; color: #68726b; }
.market-freshness { display: block; margin-top: 7px; color: #4f785e; font-weight: 800; }

.market-secondary,
.market-show-more {
  min-height: 44px;
  border: 1px solid #d3d9d4;
  border-radius: 10px;
  background: #fff;
  padding: 9px 15px;
  color: #334139;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.market-command-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto auto;
  gap: 10px;
  align-items: center;
}
.market-command-search input { box-sizing: border-box; width: 100%; min-height: 44px; border: 1px solid #d8ded9; border-radius: 999px; background: #fff; padding: 9px 17px; color: #243029; font: inherit; }
.market-filter-toggle { min-height: 44px; border: 1px solid #cfd8d1; border-radius: 999px; background: #fff; padding: 8px 17px; color: #315b42; font: inherit; font-weight: 850; cursor: pointer; }
.market-filter-toggle.has-filters { border-color: #2e6343; background: #e9f2ec; }
.market-sort-pill { display: flex; align-items: center; gap: 7px; min-height: 44px; border: 1px solid #d8ded9; border-radius: 999px; background: #fff; padding: 4px 6px 4px 13px; }
.market-sort-pill > span { color: #708078; font-size: 10px; font-weight: 900; text-transform: uppercase; }
.market-sort-pill select { border: 0; border-radius: 999px; background: #f2f5f2; padding: 7px 9px; color: #27362d; font: inherit; font-size: 11px; font-weight: 800; }
.market-applied-filters { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 7px; }
.market-applied-pill { min-height: 30px; border: 1px solid #d4ded6; border-radius: 999px; background: #f4f7f4; padding: 4px 9px; color: #365542; font: inherit; font-size: 10px; font-weight: 800; cursor: pointer; }
.market-applied-pill span { margin-right: 5px; color: #7a887f; font-size: 9px; text-transform: uppercase; }
.market-controls {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(6, minmax(124px, 1fr));
  gap: 10px;
  align-items: end;
  border: 1px solid #dde2df;
  border-radius: 15px;
  background: #fff;
  padding: 13px;
  box-shadow: 0 14px 36px rgba(26, 38, 29, .07);
}

.market-controls[hidden] { display: none; }

.market-controls label {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.market-controls label > span {
  padding: 0 2px;
  color: #6f7b73;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .03em;
}

.market-controls input,
.market-controls select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid #d5dbd6;
  border-radius: 9px;
  background: #f7f8f6;
  padding: 8px 10px;
  color: #243029;
  font: inherit;
  font-size: 12px;
}

.market-controls input:focus,
.market-controls select:focus {
  outline: 2px solid rgba(23, 59, 42, .2);
  border-color: var(--green);
}

.market-control-summary {
  display: flex;
  align-items: center;
  gap: 1px 7px;
  min-height: 42px;
  border-radius: 999px;
  background: transparent;
  padding: 5px 8px;
}

.market-control-summary b { color: var(--green); font-size: 14px; }
.market-control-summary span { color: #69766d; font-size: 10px; }
.market-control-summary button { border: 0; background: transparent; padding: 0 0 0 5px; color: #315b42; font: inherit; font-size: 10px; font-weight: 850; text-align: left; cursor: pointer; }
.market-coverage { display: flex; align-items: center; gap: 10px; border: 1px solid #dce4de; border-radius: 12px; background: #f7faf7; padding: 10px 13px; color: #65736a; font-size: 11px; }
.market-coverage b { color: #244d34; font-size: 13px; white-space: nowrap; }

.market-advanced { grid-column: 1 / -1; border-top: 1px solid #e1e6e2; padding-top: 4px; }
.market-advanced summary { min-height: 42px; display: flex; align-items: center; color: #315b42; font-size: 11px; font-weight: 900; cursor: pointer; }
.market-advanced-grid { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 10px; padding: 4px 0 2px; }

.market-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.market-card { min-width: 0; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) 176px; border: 1px solid #dce1dd; border-radius: 15px; background: #fff; box-shadow: 0 9px 28px rgba(26, 38, 29, .05); }
.market-media { position: relative; align-self: stretch; aspect-ratio: 9 / 16; overflow: hidden; background: #000; }
.market-media img,
.market-media video,
.market-placeholder { width: 100%; height: 100%; display: grid; place-items: center; object-fit: contain; color: #8fa397; font-size: 34px; }
.market-media > span { position: absolute; right: 9px; bottom: 9px; border-radius: 999px; background: rgba(20, 31, 24, .86); padding: 5px 8px; color: #fff; font-size: 10px; font-weight: 850; pointer-events: none; }

.market-retention {
  position: absolute;
  left: 9px;
  top: 9px;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .02em;
  pointer-events: none;
}
.market-retention.is-retained { background: #e4f1e8; color: #245c38; }
.market-retention.is-missing { background: #fff0d8; color: #8b5712; }

.market-card-body { display: grid; align-content: start; gap: 14px; padding: 17px; }
.market-card-topline { display: grid; gap: 12px; }
.market-brand { display: flex; justify-content: space-between; gap: 8px; color: #69756d; font-size: 10px; }
.market-brand b { overflow: hidden; color: #3e4a42; text-overflow: ellipsis; white-space: nowrap; }
.market-brand span { color: #4f7a5d; font-weight: 850; }
.market-card h2 { display: -webkit-box; min-height: 54px; margin: 0; overflow: hidden; color: #1d2a22; font-size: 17px; line-height: 1.35; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.market-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.market-metrics span { display: grid; gap: 3px; border: 1px solid #e3e9e4; border-radius: 10px; background: #f7f9f7; padding: 9px; color: #778179; font-size: 9px; }
.market-metrics b { color: #213e2b; font-size: 14px; }
.market-card dl { display: grid; gap: 6px; margin: 0; }
.market-card dl > div { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 8px; }
.market-card dt { color: #899189; font-size: 9px; font-weight: 900; text-transform: uppercase; }
.market-card dd { margin: 0; overflow: hidden; color: #536057; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.market-actions { display: grid; grid-template-columns: auto 1fr; gap: 7px; }
.market-actions a,
.market-actions button { min-height: 40px; border: 1px solid #d5dbd7; border-radius: 8px; background: #fff; padding: 8px 11px; color: #445249; font: inherit; font-size: 11px; font-weight: 800; text-align: center; text-decoration: none; cursor: pointer; }
.market-actions button { border-color: var(--green); background: var(--green); color: #fff; }
.market-actions button:disabled { border-color: #d9dedb; background: #eef1ee; color: #89918b; cursor: not-allowed; }
.market-alert { border: 1px solid #e5bdb7; border-radius: 10px; background: #fff4f2; padding: 10px 13px; color: #963d31; font-size: 13px; }
.market-alert button { border: 0; background: transparent; color: inherit; font-weight: 800; text-decoration: underline; cursor: pointer; }
.market-empty { min-height: 360px; display: grid; place-content: center; justify-items: center; color: #79837c; text-align: center; }
.market-empty h2 { margin: 0; color: #1e2b23; }
.market-show-more { justify-self: center; min-width: 260px; }

@media(max-width:1180px) {
  .market-command-bar { grid-template-columns: minmax(240px, 1fr) auto auto; }
  .market-control-summary { grid-column: 1 / -1; }
  .market-controls { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
  .market-advanced-grid { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
  .market-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media(max-width:680px) {
  .market-header { display: grid; }
  .market-secondary { width: 100%; }
  .market-command-bar { grid-template-columns: 1fr auto; }
  .market-command-search { grid-column: 1 / -1; }
  .market-sort-pill { grid-column: 1 / -1; justify-content: flex-end; }
  .market-sort-pill > span { display: none; }
  .market-sort-pill select:first-of-type { flex: 1; }
  .market-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px; }
  .market-advanced-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .market-control-summary { grid-column: 1 / -1; }
  .market-grid { grid-template-columns: 1fr; }
  .market-card { grid-template-columns: 1fr; }
  .market-media { width: min(180px, 100%); justify-self: center; border-radius: 12px 12px 0 0; }
  .market-card h2 { min-height: auto; }
  .market-show-more { width: 100%; min-width: 0; }
}
