/* ============================================
   eResonate — Ad Exchange console (Buy / Exchange / Campaigns)
   ============================================ */

.adx { padding-top: var(--nav-h); }

/* ---------- HERO ---------- */
.adx-hero { padding: 3.4rem 1.5rem 2rem; background:
    radial-gradient(1100px 460px at 78% -8%, rgba(168, 85, 247, 0.16), transparent 60%),
    radial-gradient(900px 420px at 8% 4%, rgba(217, 70, 239, 0.10), transparent 62%); }
.adx-hero-in { max-width: 1080px; margin: 0 auto; }
.adx-eyebrow { display: inline-flex; align-items: center; gap: 0.5rem; font-family: 'Outfit', sans-serif;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--money);
  background: rgba(62, 224, 140, 0.08); border: 1px solid rgba(62, 224, 140, 0.25); padding: 0.35rem 0.75rem; border-radius: 999px; }
.adx-live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 rgba(255, 68, 56, 0.6); animation: adxpulse 1.8s infinite; }
@keyframes adxpulse { 0% { box-shadow: 0 0 0 0 rgba(62, 224, 140, 0.5); } 70% { box-shadow: 0 0 0 8px rgba(62, 224, 140, 0); } 100% { box-shadow: 0 0 0 0 rgba(62, 224, 140, 0); } }
.adx-hero h1 { font-family: 'Outfit', sans-serif; font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; line-height: 1.04; margin: 1rem 0 0.9rem; }
.adx-hero h1 .grad { background: linear-gradient(100deg, var(--accent), var(--fuchsia, var(--accent-hover))); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.adx-lede { max-width: 760px; color: var(--text-muted); font-size: 1.05rem; line-height: 1.6; }
.adx-lede b { color: var(--text); font-weight: 600; }
.adx-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.75rem; margin: 1.6rem 0 1rem; }
.adx-kpi { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem 1rem; }
.adx-kpi-n { font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 1.5rem; letter-spacing: -0.01em; }
.adx-kpi-l { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }
.adx-backed { font-size: 0.85rem; color: var(--text-dim); margin-top: 0.4rem; }
.adx-status { color: var(--text-muted); font-weight: 600; }
.adx-status.ok { color: var(--money); }
.adx-status.bad { color: #ff8080; }

/* ---------- TABS ---------- */
.adx-tabbar { position: sticky; top: var(--nav-h); z-index: 20; background: rgba(7, 11, 24, 0.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.adx-tabbar-in { max-width: 1180px; margin: 0 auto; display: flex; gap: 0.4rem; padding: 0 1rem; overflow-x: auto; }
.adx-tab { flex: 0 0 auto; background: none; border: none; color: var(--text-muted); font-family: 'Outfit', sans-serif; font-weight: 600;
  font-size: 0.92rem; padding: 1rem 1.1rem; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.adx-tab:hover { color: var(--text); }
.adx-tab.active { color: var(--text); border-bottom-color: var(--accent-text); }

.adx-body { max-width: 1180px; margin: 0 auto; padding: 1.8rem 1rem 4rem; }
.adx-panel { display: none; }
.adx-panel.active { display: block; animation: adxfade 0.3s ease; }
@keyframes adxfade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- BUY ---------- */
.buy-grid { display: grid; grid-template-columns: 1fr 380px; gap: 1.8rem; align-items: start; }
.buy-form { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.6rem; }
.buy-h { font-family: 'Outfit', sans-serif; font-size: 0.82rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-text); margin: 1.4rem 0 0.8rem; }
.buy-h:first-child { margin-top: 0; }
.fld { margin-bottom: 0.9rem; }
.fld-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.fld-row .fld { margin-bottom: 0.9rem; }
.fld-row:has(#fBudget) { grid-template-columns: 1fr 1fr 1.2fr; }
.fld label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text); margin-bottom: 0.35rem; }
.fld label .hint { color: var(--text-dim); font-weight: 400; font-size: 0.72rem; }
.fld input[type=text], .fld input[type=url], .fld input[type=number], .fld select {
  width: 100%; background: var(--bg-dark); border: 1px solid var(--border); border-radius: 10px; color: var(--text);
  font-family: 'DM Sans', sans-serif; font-size: 0.92rem; padding: 0.6rem 0.75rem; }
.fld input:focus, .fld select:focus { outline: none; border-color: var(--border-accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.fld-emoji { flex: 0 0 74px; }
.fld-emoji input { text-align: center; font-size: 1.2rem; }
.fld-row:has(.fld-emoji) { grid-template-columns: 74px 1fr; }
.color-pair { display: flex; gap: 0.5rem; }
.color-pair input[type=color] { width: 100%; height: 40px; padding: 2px; background: var(--bg-dark); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }

.chipset { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chipset.small .chip { font-size: 0.78rem; }
.chip { display: inline-flex; align-items: center; gap: 0.35rem; background: var(--bg-dark); border: 1px solid var(--border); border-radius: 999px;
  padding: 0.4rem 0.7rem; font-size: 0.82rem; color: var(--text-muted); cursor: pointer; user-select: none; transition: all 0.15s; }
.chip input { accent-color: var(--accent); margin: 0; }
.chip:has(input:checked) { background: rgba(46, 92, 255, 0.14); border-color: var(--border-accent); color: var(--text); }

.buy-actions { display: flex; align-items: center; gap: 1rem; margin-top: 1.4rem; flex-wrap: wrap; }
.buy-note { font-size: 0.82rem; color: var(--money); }

/* preview column */
.buy-preview { position: relative; }
.bp-sticky { position: sticky; top: calc(var(--nav-h) + 70px); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.4rem; }
.bp-sub { font-size: 0.82rem; color: var(--text-muted); margin: 0 0 0.9rem; }
.bp-frame { background: var(--bg-dark); border: 1px dashed var(--border); border-radius: 14px; padding: 1rem; min-height: 120px; }
.bp-proj { margin-top: 1.2rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.bp-proj-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.86rem; color: var(--text-muted); padding: 0.3rem 0; }
.bp-proj-row b { color: var(--text); font-family: 'Outfit', sans-serif; }
.bp-proj-note { font-size: 0.75rem; color: var(--text-dim); margin-top: 0.5rem; line-height: 1.5; }
.bp-safe { margin-top: 1rem; font-size: 0.8rem; color: var(--money); background: rgba(62, 224, 140, 0.07); border: 1px solid rgba(62, 224, 140, 0.2); border-radius: 10px; padding: 0.6rem 0.75rem; }

/* ---------- EXCHANGE ---------- */
.ex-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.ex-kpis { display: grid; grid-template-columns: repeat(6, auto); gap: 0.6rem; }
.ex-kpi { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.7rem 0.95rem; min-width: 92px; }
.ex-kpi-n { font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 1.25rem; }
.ex-kpi-l { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.ex-controls { display: flex; align-items: center; gap: 0.8rem; }
.ex-hint { font-size: 0.78rem; color: var(--text-dim); max-width: 320px; }
.ex-grid { display: grid; grid-template-columns: 1fr 320px; gap: 1.4rem; align-items: start; }
.ex-h { font-family: 'Outfit', sans-serif; font-size: 1rem; font-weight: 700; margin: 0 0 0.9rem; }

.auction-feed { display: flex; flex-direction: column; gap: 0.8rem; }
.auc { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 0.9rem 1rem;
  opacity: 0; transform: translateY(-8px); transition: opacity 0.35s, transform 0.35s; }
.auc.show { opacity: 1; transform: none; }
.auc.unfilled { opacity: 0.6; }
.auc.unfilled.show { opacity: 0.72; }
.auc-head { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; margin-bottom: 0.7rem; }
.auc-surface { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 0.8rem; text-transform: capitalize; color: var(--text);
  background: rgba(46, 92, 255, 0.14); border: 1px solid var(--border-accent); padding: 0.15rem 0.55rem; border-radius: 6px; }
.seg { font-size: 0.72rem; color: var(--text-muted); background: var(--bg-dark); border: 1px solid var(--border); padding: 0.12rem 0.5rem; border-radius: 6px; }
.auc-floor, .auc-clear { margin-left: auto; font-size: 0.76rem; color: var(--text-dim); }
.auc-empty { font-size: 0.82rem; color: var(--text-muted); font-style: italic; }

.auc-bids { display: flex; flex-direction: column; gap: 0.3rem; }
.bidrow { display: grid; grid-template-columns: 1fr 90px 62px; align-items: center; gap: 0.6rem; }
.bidr-name { font-size: 0.82rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bidrow.win .bidr-name { color: var(--text); font-weight: 600; }
.bidr-dsp { color: var(--text-dim); font-size: 0.7rem; margin-left: 0.4rem; }
.bidr-track { height: 7px; background: var(--bg-dark); border-radius: 4px; overflow: hidden; }
.bidr-fill { display: block; height: 100%; width: 0; background: rgba(141, 145, 184, 0.4); border-radius: 4px; transition: width 0.5s ease; }
.bidr-fill.win { background: linear-gradient(90deg, var(--accent), var(--accent-hover)); }
.bidr-val { text-align: right; font-family: 'Outfit', sans-serif; font-size: 0.82rem; color: var(--text-muted); }
.bidrow.win .bidr-val { color: var(--text); font-weight: 700; }

.auc-result { display: flex; align-items: center; gap: 0.55rem; margin-top: 0.8rem; padding-top: 0.7rem; border-top: 1px solid var(--border); flex-wrap: wrap; }
.auc-winner { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 15px; }
.auc-won { font-size: 0.85rem; color: var(--text-muted); }
.auc-won b { color: var(--text); }
.auc-badge { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.15rem 0.5rem; border-radius: 5px; }
.auc-badge.second { color: #8FD6FF; background: rgba(40, 160, 220, 0.12); }
.auc-badge.direct { color: #FFC773; background: rgba(255, 180, 90, 0.12); }
.auc-result .auc-clear { margin-left: auto; font-family: 'Outfit', sans-serif; font-size: 1.05rem; font-weight: 800; color: var(--money); }
.auc-result .auc-clear small { font-size: 0.62rem; color: var(--text-dim); font-weight: 600; }

.ex-side { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.2rem; position: sticky; top: calc(var(--nav-h) + 70px); }
.leaderboard { display: flex; flex-direction: column; gap: 0.55rem; }
.lb-row { display: grid; grid-template-columns: 16px 22px 1fr 60px auto; align-items: center; gap: 0.5rem; }
.lb-rank { color: var(--text-dim); font-size: 0.78rem; font-weight: 700; }
.lb-emoji { font-size: 1rem; }
.lb-name { font-size: 0.82rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-imps { display: block; font-size: 0.68rem; color: var(--text-dim); }
.lb-bar { height: 6px; background: var(--bg-dark); border-radius: 3px; overflow: hidden; }
.lb-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-hover)); border-radius: 3px; transition: width 0.5s; }
.lb-spent { font-family: 'Outfit', sans-serif; font-size: 0.8rem; font-weight: 700; text-align: right; }
.lb-empty, .cm-empty { color: var(--text-muted); font-size: 0.85rem; padding: 0.5rem 0; }
.ex-legend { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.76rem; color: var(--text-muted); }
.ex-legend > div { display: flex; align-items: center; gap: 0.5rem; }
.lg-dot { width: 10px; height: 10px; border-radius: 3px; }
.lg-dot.win { background: linear-gradient(90deg, var(--accent), var(--accent-hover)); }
.lg-dot.direct { background: #FFC773; }
.lg-dot.floor { background: rgba(141, 145, 184, 0.5); }

/* ---------- CAMPAIGNS ---------- */
.cm-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.2rem; flex-wrap: wrap; gap: 0.6rem; }
.cm-filter { display: flex; gap: 0.35rem; }
.cm-f { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-muted); font-size: 0.8rem; font-weight: 600;
  padding: 0.4rem 0.85rem; border-radius: 999px; cursor: pointer; }
.cm-f.active { background: rgba(46, 92, 255, 0.14); border-color: var(--border-accent); color: var(--text); }
.campaign-list { display: flex; flex-direction: column; gap: 0.8rem; }
.camp { display: grid; grid-template-columns: 52px 1fr auto; gap: 1rem; align-items: center; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 14px; padding: 1rem 1.2rem; }
.camp.mine { border-color: rgba(46, 92, 255, 0.28); }
.camp.st-paused { opacity: 0.6; }
.camp-logo { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; font-size: 26px; }
.camp-top { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.2rem; }
.camp-top b { font-family: 'Outfit', sans-serif; font-size: 1rem; }
.camp-tag { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.12rem 0.45rem; border-radius: 5px; }
.camp-tag.open { color: #8FD6FF; background: rgba(40, 160, 220, 0.12); }
.camp-tag.guar { color: #FFC773; background: rgba(255, 180, 90, 0.12); }
.camp-tag.mine { color: var(--accent-text); background: rgba(46, 92, 255, 0.14); }
.camp-status { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.12rem 0.45rem; border-radius: 5px; margin-left: auto; }
.camp-status.s-active { color: var(--money); background: rgba(62, 224, 140, 0.1); }
.camp-status.s-paused { color: var(--text-muted); background: rgba(141, 145, 184, 0.12); }
.camp-status.s-archived { color: var(--text-dim); background: rgba(74, 79, 120, 0.15); }
.camp-head { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.camp-targ { font-size: 0.76rem; color: var(--text-dim); margin-bottom: 0.5rem; }
.camp-surf { color: var(--text-dim); }
.camp-bar { height: 6px; background: var(--bg-dark); border-radius: 3px; overflow: hidden; margin-bottom: 0.5rem; }
.camp-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-hover)); border-radius: 3px; }
.camp-nums { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; font-family: 'Outfit', sans-serif; font-size: 0.85rem; color: var(--text); }
.camp-nums i { font-style: normal; color: var(--text-dim); font-size: 0.72rem; font-family: 'DM Sans', sans-serif; }
.cm-toggle { background: var(--bg-dark); border: 1px solid var(--border); color: var(--text); font-weight: 600; font-size: 0.82rem;
  padding: 0.5rem 1rem; border-radius: 10px; cursor: pointer; }
.cm-toggle.pause:hover { border-color: #ff8080; color: #ff8080; }
.cm-toggle.resume:hover { border-color: var(--money); color: var(--money); }

/* ---------- toast ---------- */
.adx-toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: #12193a; border: 1px solid var(--border-accent);
  color: var(--text); font-size: 0.9rem; font-weight: 500; padding: 0.75rem 1.2rem; border-radius: 12px; z-index: 200;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); animation: adxtoast 0.3s ease; }
.adx-toast.bad { border-color: rgba(255, 128, 128, 0.5); }
@keyframes adxtoast { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%); } }

/* ============================================
   Ad creative unit (shared look with adtag.js — used by the Buy preview)
   ============================================ */
.eres-ad { position: relative; border-radius: 16px; overflow: hidden; font-family: 'DM Sans', system-ui, sans-serif;
  border: 1px solid rgba(255, 255, 255, .08); background: #0D1428; color: #EAF0FF; opacity: 0; transform: translateY(6px);
  transition: opacity .4s ease, transform .4s ease; text-decoration: none; display: block; }
.eres-ad.in { opacity: 1; transform: none; }
.eres-ad-glow { position: absolute; inset: 0; opacity: .14; pointer-events: none; }
.eres-ad-in { position: relative; padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; }
.eres-ad-badge { position: absolute; top: 10px; right: 12px; font-size: 9px; letter-spacing: .14em; text-transform: uppercase;
  color: #9FB0D0; font-weight: 700; font-family: 'Outfit', sans-serif; }
.eres-ad-logo { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 11px; display: grid; place-items: center; font-size: 22px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }
.eres-ad-body { min-width: 0; flex: 1; padding-right: 52px; }
.eres-ad-brand { font-size: 12px; color: #9FB0D0; font-weight: 600; margin: 1px 0 2px; }
.eres-ad-head { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 15px; line-height: 1.25; color: #fff; margin: 0 0 3px; }
.eres-ad-copy { font-size: 13px; color: #C6D2EA; line-height: 1.4; margin: 0 0 9px; }
.eres-ad-cta { display: inline-flex; align-items: center; gap: 5px; font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 12.5px;
  color: #fff; background: linear-gradient(90deg, var(--accent), var(--accent-hover)); padding: 7px 13px; border-radius: 9px; }
.eres-ad-cta.ghost { background: transparent; color: #D9B8FF; box-shadow: inset 0 0 0 1px rgba(46, 92, 255, .4); }
.eres-ad.fmt-banner .eres-ad-in { align-items: center; }
.eres-ad.fmt-banner .eres-ad-copy { display: none; }
.eres-ad.fmt-banner .eres-ad-body { padding-right: 8px; }
.eres-ad.fmt-sidebar .eres-ad-in { flex-direction: column; text-align: center; }
.eres-ad.fmt-sidebar .eres-ad-body { padding-right: 0; }
.eres-ad.fmt-sidebar .eres-ad-logo { width: 52px; height: 52px; flex-basis: 52px; font-size: 26px; margin: 0 auto; }
.eres-ad.fmt-search { background: transparent; border: 0; }
.eres-ad.fmt-search .eres-ad-in { padding: 10px 2px; }
.eres-ad.fmt-search .eres-ad-logo { width: 34px; height: 34px; flex-basis: 34px; font-size: 17px; border-radius: 8px; }
.eres-ad.fmt-search .eres-ad-head { color: #8FD6FF; }
.eres-ad.fmt-search .eres-ad-badge { position: static; color: #7BE3A6; background: rgba(62, 224, 140, .12); padding: 1px 6px; border-radius: 4px; margin-left: 6px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .buy-grid { grid-template-columns: 1fr; }
  .ex-grid { grid-template-columns: 1fr; }
  .bp-sticky, .ex-side { position: static; }
  .adx-kpis { grid-template-columns: repeat(2, 1fr); }
  .ex-kpis { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px) {
  .fld-row, .fld-row:has(#fBudget), .fld-row:has(.fld-emoji) { grid-template-columns: 1fr; }
  .camp { grid-template-columns: 44px 1fr; }
  .camp .cm-toggle { grid-column: 1 / -1; }
  .ex-kpis { grid-template-columns: repeat(2, 1fr); }
}
