/* BBX ads — player overlay, banners (public) + ad console extras (admin / advertiser). Mobile first. */

/* ---------- player overlay */
.ad-overlay {
  position: absolute; inset: 0; z-index: 40; background: #000; color: #fff; overflow: hidden;
  font: 14px/1.4 var(--font, system-ui, sans-serif); -webkit-tap-highlight-color: transparent;
}
.ad-stage { position: absolute; inset: 0; cursor: pointer; }
.ad-video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.ad-ima { position: absolute; inset: 0; }
.ad-top {
  position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: max(10px, env(safe-area-inset-top)) 12px 18px; pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, .65), transparent);
}
.ad-badge {
  background: #F2B53A; color: #061A3B; font-weight: 800; font-size: 12px; padding: 3px 8px; border-radius: 4px;
  font-variant-numeric: tabular-nums;
}
.ad-adv { font-weight: 700; font-size: 13px; text-shadow: 0 1px 4px rgba(0, 0, 0, .7); }
.ad-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: flex-end; gap: 10px;
  padding: 24px 12px max(18px, env(safe-area-inset-bottom)); pointer-events: none;
  background: linear-gradient(0deg, rgba(0, 0, 0, .6), transparent);
}
.ad-btn {
  pointer-events: auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(5, 15, 36, .78); color: #fff; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer;
  text-decoration: none; backdrop-filter: blur(6px);
}
.ad-btn[hidden] { display: none; }
.ad-btn:hover { color: #fff; border-color: #fff; }
.ad-more { background: #fff; color: #061A3B; border-color: #fff; }
.ad-more:hover { color: #061A3B; }
.ad-skip { margin-left: auto; min-width: 120px; font-variant-numeric: tabular-nums; }
.ad-skip:disabled { opacity: .85; cursor: default; }
.ad-skip:not(:disabled) { background: #FF5900; border-color: #FF5900; }
.ad-sound, .ad-resume { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.ad-sound { top: auto; bottom: 76px; transform: translateX(-50%); }
.ad-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, .2); pointer-events: none; }
.ad-progress span { display: block; height: 100%; width: 0; background: #F2B53A; transition: width .25s linear; }
.ad-overlay.is-google .ad-top, .ad-overlay.is-google .ad-bottom { background: none; }
.ad-overlay.is-google .ad-progress { display: none; }
/* small (portrait phone) players: compact controls so the spot stays visible */
@media (max-width: 480px) {
  .ad-overlay .ad-btn { min-height: 40px; padding: 0 12px; font-size: 13px; }
  .ad-overlay .ad-skip { min-width: 104px; }
  .ad-top { padding-bottom: 10px; }
  .ad-bottom { padding-top: 12px; padding-bottom: 12px; }
}
@media (min-width: 769px) {
  .ad-top { padding: 16px 20px 24px; }
  .ad-bottom { padding: 30px 20px 22px; }
  .ad-badge { font-size: 13px; }
}

/* ---------- banners */
.ad-slot { margin: 6px auto; }
.ad-banner { position: relative; width: 100%; max-width: var(--ad-w, 728px); margin: 0 auto; }
.ad-banner img { width: 100%; height: auto; aspect-ratio: var(--ad-ar, auto); border-radius: 10px; background: var(--surface, #0A1A3A); }
.ad-banner .ad-label {
  position: absolute; top: 6px; right: 6px; z-index: 1; font-size: 10px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: #fff; background: rgba(0, 0, 0, .55); padding: 2px 6px; border-radius: 4px;
}
.ad-adsense { min-height: 100px; }

/* ================================================================ console (admin + advertiser) */
@media (max-width: 600px) { .hide-sm { display: none; } }
.ads-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; }
.ads-filters .seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.ads-filters .seg a { padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--text-muted); }
.ads-filters .seg a.active { background: var(--surface-3); color: #fff; }
.ads-filters input[type=date], .ads-filters select {
  height: 38px; padding: 0 10px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.kpi .sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.kpi .split { display: flex; gap: 12px; margin-top: 6px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.kpi .split i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.cards.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cards.kpis .box { padding: 14px; }
.cards.kpis .kpi .value { font-size: 22px; }
@media (min-width: 700px) { .cards.kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1500px) { .cards.kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; } .cards.kpis .box { padding: 18px; } .cards.kpis .kpi .value { font-size: 24px; white-space: nowrap; } }

.pace { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.pace .progress { position: relative; overflow: visible; }
.pace .progress .time { position: absolute; top: -3px; width: 2px; height: 12px; background: var(--sky); border-radius: 1px; }
.pace small { color: var(--text-dim); font-size: 11px; }
.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--border-soft); font-size: 13px; }
.alert-row .pill { flex-shrink: 0; }

/* responsive table: cards on phones, table from 760px */
@media (max-width: 759px) {
  .resp-table thead { display: none; }
  .resp-table, .resp-table tbody, .resp-table tr, .resp-table td { display: block; width: 100%; }
  .resp-table tr { border-bottom: 1px solid var(--border-soft); padding: 10px 0; }
  .resp-table td { border: 0; padding: 4px 14px; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .resp-table td::before { content: attr(data-label); color: var(--text-dim); font-size: 12px; font-weight: 600; text-align: left; flex-shrink: 0; }
  .resp-table td.main { display: block; text-align: left; padding-bottom: 6px; }
  .resp-table td.main::before { content: none; }
  .resp-table td.num { text-align: right; }
  .resp-table .row-actions { justify-content: flex-start; }
  .resp-table tfoot tr { background: var(--bg); }
}
.table.sticky-first th:first-child, .table.sticky-first td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.table.sticky-first thead th:first-child { background: var(--bg); }
.table tfoot td { font-weight: 800; background: var(--bg); border-top: 1px solid var(--border); }

/* chips (targeting) */
.chip-select { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-select label { position: relative; }
.chip-select input { position: absolute; opacity: 0; pointer-events: none; }
.chip-select span {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  background: var(--bg); border: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--text-muted);
}
.chip-select input:checked + span { background: var(--sky); border-color: var(--sky); color: var(--navy-ink); }
.chip-select input:focus-visible + span { outline: 2px solid var(--sky); outline-offset: 2px; }
.series-pick { max-height: 240px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; background: var(--bg); }
.series-pick label { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.series-pick label:hover { background: var(--surface); }
.series-pick input { width: 18px; height: 18px; accent-color: var(--brand); }

/* creatives */
.creatives { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .creatives { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } }
.creative { background: var(--bg); border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.creative .media { aspect-ratio: 16/9; background: #000; display: grid; place-items: center; }
.creative .media video, .creative .media img { width: 100%; height: 100%; object-fit: contain; }
.creative .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.creative .body .row-actions { justify-content: flex-start; flex-wrap: wrap; margin-top: 4px; }
.creative.off { opacity: .55; }

/* funnel */
.funnel .item .bar > span { background: var(--sky); }
.funnel .item:first-child .bar > span { background: var(--brand); }

/* details/summary forms */
details.box > summary { cursor: pointer; font-weight: 800; list-style: none; display: flex; align-items: center; justify-content: space-between; }
details.box > summary::-webkit-details-marker { display: none; }
details.box[open] > summary { margin-bottom: 14px; }

.settings-group + .settings-group { margin-top: 18px; }
.field.inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); margin: 0; }
.field.inline label { color: var(--text); font-size: 14px; }
.field.inline .hint { display: block; margin-top: 2px; }
.field.inline input[type=number] { width: 110px; min-height: 40px; }
.switch { position: relative; width: 48px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--sky); outline-offset: 2px; }
.vast-result { margin-top: 10px; font-size: 13px; }
code.k { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 12px; word-break: break-all; }

.secret-box { background: var(--bg); border: 1px dashed var(--brand); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; }
.secret-box code { font-size: 15px; color: #fff; }

/* ---------- printable statement (rendiconto) */
body.statement { background: #e9edf3; color: #0d1b33; font: 14px/1.5 var(--font, system-ui, sans-serif); padding: 16px 12px 40px; }
.statement .toolbar-print { max-width: 860px; margin: 0 auto 12px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.statement .toolbar-print .btn-outline { color: #0d1b33; border-color: #b8c3d6; }
.statement .toolbar-print input { height: 40px; padding: 0 10px; border-radius: 8px; border: 1px solid #b8c3d6; }
.statement .sheet { max-width: 860px; margin: 0 auto; background: #fff; border-radius: 12px; padding: 22px 18px; box-shadow: 0 8px 30px rgba(6, 26, 59, .12); }
.statement .head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px; border-bottom: 3px solid #FF5900; padding-bottom: 16px; margin-bottom: 18px; }
.statement .brand { display: flex; gap: 12px; align-items: center; }
.statement .brand img { width: 52px; height: 52px; }
.statement .brand b { font-family: var(--font-display, "Arial Black"); font-size: 26px; display: block; line-height: 1; color: #061A3B; }
.statement h1 { font-size: 20px; margin: 0 0 4px; color: #061A3B; }
.statement .muted { color: #5b6b85; }
.statement .parties { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 18px; }
@media (min-width: 640px) { .statement .parties { grid-template-columns: 1fr 1fr; } .statement .sheet { padding: 36px 40px; } }
.statement .party { background: #f4f6fa; border-radius: 8px; padding: 12px 14px; font-size: 13px; }
.statement .party h4 { margin: 0 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #5b6b85; }
.statement .tbl-wrap { overflow-x: auto; }
.statement table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
.statement th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #5b6b85; border-bottom: 1px solid #d5dce8; padding: 8px 6px; }
.statement td { padding: 9px 6px; border-bottom: 1px solid #edf0f5; vertical-align: top; }
.statement .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.statement .sum { margin-left: auto; margin-top: 16px; width: 100%; max-width: 320px; font-size: 14px; }
.statement .sum div { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #edf0f5; }
.statement .sum .tot { font-weight: 800; font-size: 17px; border-bottom: 0; color: #061A3B; }
.statement .foot { margin-top: 26px; font-size: 11px; color: #5b6b85; }
@media print {
  @page { size: A4; margin: 14mm; }
  body.statement { background: #fff; padding: 0; }
  .statement .toolbar-print { display: none; }
  .statement .sheet { box-shadow: none; border-radius: 0; padding: 0; max-width: none; }
  .statement table { min-width: 0; }
}

/* ---------- /pubblicita page */
.adv-hero { padding: calc(var(--header-h) + 28px) var(--gutter) 30px; margin-top: calc(-1 * var(--header-h));
  background: radial-gradient(circle at 80% 0%, rgba(255, 89, 0, .25), transparent 55%), radial-gradient(circle at 0% 100%, rgba(85, 183, 232, .18), transparent 50%); }
.adv-hero h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(30px, 7vw, 56px); letter-spacing: -.02em; max-width: 14ch; }
.adv-hero p { color: var(--text-muted); max-width: 56ch; font-size: 16px; }
.adv-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 24px 0 0; }
@media (min-width: 900px) { .adv-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }
.adv-stat { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 16px; }
.adv-stat b { display: block; font-family: var(--font-display); font-weight: 400; font-size: clamp(24px, 6vw, 36px); }
.adv-stat span { color: var(--text-muted); font-size: 13px; }
.adv-section { padding: 26px var(--gutter); }
.adv-section h2 { font-size: 22px; font-weight: 800; }
.formats { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 700px) { .formats { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .formats { grid-template-columns: repeat(4, 1fr); } }
.format { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 18px; }
.format h3 { font-size: 16px; margin: 8px 0 6px; }
.format p { color: var(--text-muted); font-size: 14px; margin: 0 0 10px; }
.format .price { font-weight: 800; color: var(--sky); font-size: 14px; }
.format .ico-wrap { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--brand); }
.format .ico-wrap svg { width: 22px; height: 22px; }
.aud-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 800px) { .aud-grid { grid-template-columns: 1fr 1fr; } }
.adv-cta { margin: 10px var(--gutter) 40px; padding: 26px 20px; border-radius: var(--radius); background: var(--grad-brand); text-align: center; }
.adv-cta h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(24px, 5vw, 34px); }
.adv-cta .btn { background: #fff; color: var(--navy-ink); }

/* compact report filters on phones: two columns */
@media (max-width: 860px) { .report-filters .form-grid { grid-template-columns: 1fr 1fr; gap: 0 10px; } .report-filters .field { margin-bottom: 10px; } .report-filters .field input, .report-filters .field select { min-height: 42px; padding: 8px 10px; font-size: 14px; } }

.field.inline .switch { display: inline-block; flex: 0 0 48px; width: 48px; height: 28px; min-height: 0; align-self: center; }
.field.inline .switch input { min-height: 0; width: 48px; height: 28px; padding: 0; }
.field.inline > label { flex: 1; min-width: 0; }
