:root {
  --bg: #F6F5FA; --card: #FFFFFF; --ink: #23203F; --muted: #67627F; --line: #E6E3EF;
  --good: #15803D; --good-soft: #E7F6EC; --bad: #B91C1C; --bad-soft: #FDECEC; --warn: #D97706; --warn-soft: #FEF3E2; --info-soft: #EEF2FF;
  --radius: 14px; --shadow: 0 1px 2px rgba(20,16,40,.06), 0 4px 16px rgba(20,16,40,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 Inter, 'IBM Plex Sans Arabic', system-ui, sans-serif; }
[dir=rtl] body { font-family: 'IBM Plex Sans Arabic', Inter, system-ui, sans-serif; }
a { color: var(--brand); text-decoration: none; }
button, input, select { font: inherit; }
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.danger { color: var(--bad); }
input, select { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 0 0 4px; font-weight: 500; }

/* Layout */
.topbar { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line); }
.topbar .in { max-width: 1280px; margin: 0 auto; padding: 10px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.topbar .brand { display: flex; align-items: center; gap: 12px; }
.topbar .brand img.gs { height: 22px; display: block; }
.topbar .sep { width: 1px; height: 26px; background: var(--line); }
.topbar .clogo { height: 30px; max-width: 120px; object-fit: contain; }
.topbar nav { display: flex; gap: 4px; margin-inline-start: 12px; }
.topbar nav a { padding: 7px 12px; border-radius: 9px; color: var(--muted); font-weight: 500; }
.topbar nav a.on, .topbar nav a:hover { background: var(--brand-soft); color: var(--brand-dark); }
.topbar .right { margin-inline-start: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }
.who { color: var(--muted); font-size: 13px; }
main { max-width: 1280px; margin: 0 auto; padding: 22px 20px 60px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.page-head .sub { color: var(--muted); font-size: 13px; }
.page-head .tools { margin-inline-start: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card h2 { margin: 0 0 12px; font-size: 15px; }
.grid { display: grid; gap: 14px; }
.two { grid-template-columns: 2fr 1fr; }
@media (max-width: 900px) { .two { grid-template-columns: 1fr; } .topbar nav { display: none; } }
@media (max-width: 600px) { .who { display: none; } main { padding-inline: 16px; } }

/* Segmented control */
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 500; }
.seg button.on { background: var(--brand); color: #fff; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--brand-dark); border-color: var(--brand); }
.tabs .count { background: var(--bad); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 11px; margin-inline-start: 6px; }

/* Tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 12px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #FAF9FD; font-size: 12px; color: var(--muted); font-weight: 600; cursor: pointer; user-select: none; position: sticky; top: 0; }
th.num, td.num { text-align: end; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #FBFAFE; }
td.name { max-width: 300px; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
td.url { max-width: 280px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
tr.good td:first-child { box-shadow: inset 3px 0 0 var(--good); } tr.bad td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
[dir=rtl] tr.good td:first-child { box-shadow: inset -3px 0 0 var(--good); } [dir=rtl] tr.bad td:first-child { box-shadow: inset -3px 0 0 var(--bad); }
.cell-good { color: var(--good); font-weight: 600; } .cell-bad { color: var(--bad); font-weight: 600; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; background: #F1F0F6; color: var(--muted); }
.chip.high { background: var(--bad-soft); color: var(--bad); } .chip.medium { background: var(--warn-soft); color: var(--warn); }
.chip.low { background: var(--brand-soft); color: var(--brand-dark); } .chip.good { background: var(--good-soft); color: var(--good); }
.chip.ACTIVE { background: var(--good-soft); color: var(--good); } .chip.FAIL { background: var(--warn-soft); color: var(--warn); }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.toolbar input { max-width: 260px; }

/* Alerts */
.alert { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); align-items: start; }
.alert:last-child { border-bottom: 0; }
.alert .obj { font-weight: 600; margin-bottom: 2px; }
.alert .msg { color: var(--ink); }
.alert .act { margin-top: 6px; background: #FAF9FD; border: 1px dashed var(--line); border-radius: 9px; padding: 7px 10px; font-size: 13px; color: var(--muted); word-break: break-word; }
.alert .act b { color: var(--ink); }
.alert .meta { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.alert .btns { display: flex; gap: 6px; }

.health { display: flex; align-items: center; gap: 16px; }
.ring { width: 86px; height: 86px; }
.narr { font-size: 14.5px; line-height: 1.75; color: var(--ink); }
.note { font-size: 12.5px; color: var(--muted); background: var(--warn-soft); border-radius: 10px; padding: 8px 12px; margin-top: 10px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--brand-soft), var(--bg)); }
.login .card { width: 100%; max-width: 380px; padding: 28px; }
.login img { height: 88px; display: block; margin: 0 auto 18px; }
.login h1 { font-size: 20px; margin: 0 0 18px; }
.field { margin-bottom: 12px; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; margin-bottom: 8px; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(20,16,40,.35); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; padding: 22px; }
.modal h3 { margin: 0 0 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.empty { color: var(--muted); padding: 30px; text-align: center; }
.toast { position: fixed; bottom: 20px; inset-inline-end: 20px; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 60; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 6px; }
.client-card { display: flex; align-items: center; gap: 14px; }
.client-card img { width: 44px; height: 44px; object-fit: contain; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.client-card .ph { width: 44px; height: 44px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; font-weight: 700; }
.print-only { display: none; }

/* Stat cards (client report + team overview) */
.sub { color: var(--muted); font-size: 13px; }
.card h2 + .sub { margin: -8px 0 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.stat .lbl { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat .val { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat.soon .val { font-size: 21px; color: var(--muted); }
.stat .foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.chg-chip { font-size: 12.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #F1EFF7; color: var(--muted); white-space: nowrap; }
.chg-chip.good { background: var(--good-soft); color: var(--good); } .chg-chip.bad { background: var(--bad-soft); color: var(--bad); }
.chg-chip.neutral { color: #4B4560; } .chg-chip.brand { background: var(--brand-soft); color: var(--brand-dark); }

/* Pills (chart metric, ads view) */
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer; }
.pills button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn-icon { display: inline-flex; align-items: center; gap: 8px; }
.sec-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.sec-head > div:first-child { flex: 1 1 240px; min-width: 0; }
.sec-head h2 { margin: 0; }

/* Daily chart */
.dchart { margin-bottom: 16px; min-width: 0; }
.dchart-body { display: flex; gap: 10px; }
.dchart .axis { display: flex; flex-direction: column; justify-content: space-between; height: 240px; min-width: 46px; text-align: right; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dchart .axis span:first-child { margin-top: -7px; } .dchart .axis span:last-child { margin-bottom: -7px; }
.plot-wrap { flex: 1; min-width: 0; }
.plot { position: relative; height: 240px; display: flex; align-items: flex-end; gap: 3px; border-bottom: 1px solid var(--line);
  background: linear-gradient(#F1EFF7, #F1EFF7) 0 0 / 100% 1px no-repeat, linear-gradient(#F1EFF7, #F1EFF7) 0 50% / 100% 1px no-repeat; }
.plot .col { flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: crosshair; }
.plot .col i { display: block; width: 100%; background: var(--brand-mid); border-radius: 4px 4px 0 0; transition: background .12s; }
.plot.hovering .col i { background: #D3D0E8; } .plot .col.on i { background: var(--accent); }
.plot .avg { position: absolute; left: 0; right: 0; border-top: 1.5px dashed rgba(35, 32, 63, .45); pointer-events: none; }
.plot .avg span { position: absolute; right: 0; bottom: 3px; background: #fff; padding: 0 6px; border-radius: 6px; font-size: 11.5px; font-weight: 600; color: var(--ink); }
.plot .tip { position: absolute; top: 8px; transform: translateX(-50%); background: var(--ink); color: #fff; border-radius: 12px; padding: 10px 12px; min-width: 180px; pointer-events: none; box-shadow: 0 8px 24px rgba(20, 16, 40, .25); font-size: 12.5px; z-index: 2; }
.plot .tip > b { display: block; margin-bottom: 4px; }
.plot .tip div { display: flex; justify-content: space-between; gap: 16px; } .plot .tip div span { color: #C9C3DD; }
.xlabels { display: flex; gap: 3px; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.xlabels span { flex: 1; text-align: center; white-space: nowrap; overflow: visible; min-width: 0; }

/* Shopping journey */
.journey { display: flex; flex-direction: column; gap: 14px; }
.journey .row { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; font-weight: 600; }
.journey .row b { margin-inline-start: auto; font-variant-numeric: tabular-nums; }
.journey .bar { height: 10px; background: #F1EFF7; border-radius: 999px; overflow: hidden; }
.journey .bar i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.journey .last .bar i { background: var(--accent); }
.journey .rate { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* Client report */
.report .rp-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.report .rp-head > div:first-child { flex: 1 1 320px; min-width: 0; }
.report .rp-head h1 { margin: 4px 0 2px; font-size: clamp(26px, 3.2vw, 36px); line-height: 1.15; letter-spacing: -.02em; }
.report .rp-head .tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.kicker { font-size: 12.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-dark); }
[dir=rtl] .kicker { letter-spacing: 0; }
.rp-band { background: #2E2A5C; color: #fff; border-radius: 20px; padding: clamp(20px, 3vw, 32px); display: flex; flex-wrap: wrap; gap: 20px; align-items: center; margin-bottom: 16px; }
.rp-band p { flex: 1 1 420px; margin: 0; font-size: clamp(20px, 2.4vw, 28px); line-height: 1.35; font-weight: 600; letter-spacing: -.01em; }
.band-note { flex: 0 1 340px; display: flex; gap: 12px; align-items: flex-start; background: rgba(255, 255, 255, .08); border-radius: 14px; padding: 14px 16px; color: #E6E4F2; font-size: 13.5px; }
.band-note svg { flex: none; margin-top: 2px; color: #F7A3B8; }
.rp-two { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.rp-two > .card { flex: 1 1 420px; min-width: 0; }
.rp-summary { display: flex; flex-direction: column; }
.rp-summary .narr { margin: 0 0 14px; font-size: 15px; line-height: 1.7; }
.facts { margin-top: auto; display: flex; flex-wrap: wrap; gap: 10px; }
.facts > div { flex: 1 1 150px; background: var(--bg); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; min-width: 0; }
.facts span { font-size: 12.5px; color: var(--muted); } .facts b { overflow-wrap: anywhere; }
.facts em { font-style: normal; font-size: 13px; color: var(--muted); } .facts em.good { color: var(--good); font-weight: 600; }
.report > section.card { margin-bottom: 16px; }
.rp-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.rp-foot .brandline { display: flex; align-items: center; gap: 10px; } .rp-foot img { height: 44px; }
.print-head { margin-bottom: 14px; } .print-head img { height: 48px; margin-inline-end: 16px; vertical-align: middle; }

/* Ad creatives */
.adgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.adcard { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; background: #fff; break-inside: avoid; }
.adcard .thumb { position: relative; display: block; width: 100%; aspect-ratio: 1 / 1; border: 0; padding: 0; cursor: zoom-in; background: var(--brand-soft); overflow: hidden; }
.adcard .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: #4B4560; font-size: 12.5px; font-weight: 600; }
.adcard .rank { position: absolute; top: 10px; inset-inline-start: 10px; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.adcard .fmt { position: absolute; top: 10px; inset-inline-end: 10px; height: 26px; padding: 0 10px; border-radius: 999px; background: rgba(255, 255, 255, .92); color: var(--ink); font-size: 12px; font-weight: 600; display: flex; align-items: center; }
.adcard .zoom { position: absolute; bottom: 10px; inset-inline-end: 10px; width: 32px; height: 32px; border-radius: 10px; background: rgba(255, 255, 255, .92); color: var(--ink); display: flex; align-items: center; justify-content: center; }
.adcard .info { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.adcard .nm { font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; } .adcard .cp { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.adcard .cpa { display: flex; align-items: baseline; gap: 6px; }
.adcard .cpa b { font-size: 24px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; } .adcard .cpa span { font-size: 13px; color: var(--muted); }
.cpa-good { color: var(--good); } .cpa-bad { color: var(--bad); }
.mini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; font-size: 12px; color: var(--muted); }
.mini b { display: block; color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; }
.thumb-sm { width: 48px; height: 48px; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: zoom-in; background: var(--brand-soft); display: block; }
.thumb-sm img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Creative lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(20, 16, 40, .6); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 70; }
.lb { background: #fff; border-radius: 20px; width: min(940px, 100%); max-height: calc(100vh - 32px); overflow: auto; display: flex; flex-wrap: wrap; }
.lb-media { flex: 1 1 360px; min-height: 320px; background: var(--bg); position: relative; display: flex; align-items: center; justify-content: center; }
.lb-media img { width: 100%; height: 100%; max-height: 80vh; object-fit: contain; display: block; }
.lb-info { flex: 1 1 300px; padding: 24px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.lb-top { display: flex; align-items: flex-start; gap: 12px; } .lb-top > div { flex: 1; min-width: 0; }
.lb-top h3 { margin: 2px 0 0; font-size: 20px; line-height: 1.25; overflow-wrap: anywhere; }
.icon-btn { flex: none; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; display: grid; place-items: center; color: var(--ink); }
.lb-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.lb-stats div { background: var(--bg); border-radius: 12px; padding: 12px; }
.lb-stats span { display: block; font-size: 12.5px; color: var(--muted); } .lb-stats b { font-size: 20px; font-variant-numeric: tabular-nums; }
.lb-copy { font-size: 13.5px; } .lb-copy span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.lb-copy p { margin: 2px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.lb-links { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13.5px; font-weight: 600; }
.lb-nav { display: flex; gap: 8px; margin-top: auto; } .lb-nav .btn { flex: 1; min-height: 44px; }

/* Admin: data connections + client data source */
.conn-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.conn { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.conn:last-child { border-bottom: 0; }
.conn .ci { flex: 1 1 320px; min-width: 0; }
.conn .cn { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.conn .btns { display: flex; gap: 6px; flex-wrap: wrap; }
.conn-err { color: var(--bad); font-size: 12.5px; margin-top: 4px; overflow-wrap: anywhere; }
.planned { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.help-box { background: var(--brand-soft); color: var(--brand-dark); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; line-height: 1.6; }
.form-grid .creds { margin: 0; }
.src-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #FBFAFE; }
.src-title { font-weight: 700; margin-bottom: 8px; }
.src-msg { font-size: 12.5px; margin-top: 8px; } .src-msg:empty { display: none; }
.src-msg.warn { color: #92400E; background: var(--warn-soft); border-radius: 8px; padding: 6px 10px; }
.src-msg.err { color: var(--bad); }
.modal:has(.src-box) { max-width: 640px; }

/* Client campaign table */
.ctable { min-width: 620px; }
.ctable th { padding: 0; cursor: default; }
.ctable th button { width: 100%; min-height: 44px; border: 0; background: transparent; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; text-align: inherit; padding: 0 12px; }
.ctable th[aria-sort] button { color: var(--ink); }
.ctable td { padding: 12px; } .ctable td.nm { font-weight: 600; white-space: normal; min-width: 200px; }
.spendbar { display: inline-flex; align-items: center; gap: 10px; }
.spendbar i { width: 80px; height: 6px; background: #F1EFF7; border-radius: 999px; overflow: hidden; display: block; }
.spendbar i b { display: block; height: 100%; background: var(--brand-mid); }
.ctable tr.extra { display: none; } .ctable.all tr.extra { display: table-row; }
.tbl-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.tbl-foot .key { display: flex; align-items: center; gap: 6px; } .tbl-foot .key i { width: 10px; height: 10px; border-radius: 3px; display: block; }
.tbl-foot .btn { margin-inline-start: auto; }

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  .topbar, .no-print, .tools, .toolbar, .lightbox, .plot .tip { display: none !important; }
  .print-only { display: block; }
  main { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  .two { grid-template-columns: 1fr; }
  th { position: static; }
  .report * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .report .rp-ads, .report > section.card:has(.ctable) { break-inside: auto; }
  .report .rp-foot img { display: none; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stat, .rp-band, .adcard { break-inside: avoid; }
  .adgrid { grid-template-columns: repeat(3, 1fr); }
  .adcard .zoom { display: none; }
  .ctable tr.extra { display: table-row; }
  .ctable { min-width: 0; } .tbl-wrap { overflow: visible; }
}

/* "Continue with Facebook" + app settings */
.btns-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-fb { background: #0866FF; border-color: #0866FF; color: #fff; font-weight: 600; min-height: 40px; }
.btn-fb:hover { background: #0753D1; border-color: #0753D1; }
.copy-row { display: flex; gap: 6px; } .copy-row input { font-size: 12.5px; background: var(--bg); }
.sep-dot { color: var(--line); }
.help-box.steps { margin: 0; padding-inline-start: 30px; } .help-box.steps li + li { margin-top: 4px; }

/* Video badge, links, carousel paging, live Meta preview */
.adcard .play { position: absolute; inset: 0; margin: auto; width: 56px; height: 56px; border-radius: 50%; background: rgba(35, 32, 63, .72); color: #fff; display: grid; place-items: center; pointer-events: none; }
.adcard .play svg { width: 24px; height: 24px; margin-inline-start: 3px; }
[dir=rtl] .adcard .play svg { transform: scaleX(-1); margin-inline-start: 0; margin-inline-end: 3px; }
.ad-links { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; font-weight: 600; }
.ad-links a { color: var(--brand); }
.lb-media { flex-direction: column; }
.lb-mode { position: absolute; top: 12px; inset-inline-start: 12px; z-index: 2; }
.lb-mode button, .live-fmt button { background: rgba(255, 255, 255, .95); }
.lb-mode button[aria-pressed="true"], .live-fmt button[aria-pressed="true"] { background: var(--ink); }
.lb-mode button svg { width: 12px; height: 12px; vertical-align: -1px; }
.carousel { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; }
.carousel img { width: 100%; flex: 1; min-height: 0; max-height: 72vh; object-fit: contain; display: block; }
.cnav { position: absolute; top: 45%; font-size: 26px; line-height: 1; background: rgba(255, 255, 255, .95); }
.cprev { inset-inline-start: 10px; } .cnext { inset-inline-end: 10px; }
.ccap { padding: 10px 14px; font-size: 13px; background: #fff; border-top: 1px solid var(--line); }
.live { width: 100%; height: 100%; display: flex; flex-direction: column; padding-top: 60px; }
.live-fmt { justify-content: center; margin-bottom: 10px; }
.live-frame { position: relative; flex: 1; min-height: 520px; display: flex; justify-content: center; }
.live-frame iframe { width: 100%; max-width: 500px; height: 640px; border: 0; background: #fff; }
.live-frame .ph small { font-weight: 400; color: var(--muted); max-width: 320px; text-align: center; }

/* Campaign drill-down (client report) */
.drill-btn { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; text-align: start; }
.drill-btn .who { font-weight: 500; font-size: 12px; }
.drill-btn .chev { display: inline-block; transition: transform .15s; color: var(--muted); font-size: 18px; line-height: 1; }
[dir=rtl] .drill-btn .chev { transform: scaleX(-1); }
.drill-btn[aria-expanded="true"] .chev { transform: rotate(90deg); }
.drill-btn:hover { color: var(--brand); }
.ctable tr.open td { background: #FBFAFE; }
.ctable tr.drill td { background: #FBFAFE; padding: 4px 12px 16px; white-space: normal; }
.adgrid.compact { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.adgrid.compact .adcard .cpa b { font-size: 19px; }
.adgrid.compact .adcard .info { padding: 10px 12px 12px; gap: 8px; }
@media print { .adcard .play { display: none; } .ctable tr.drill .adgrid.compact { grid-template-columns: repeat(4, 1fr); } }

/* Search + status filters */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 14px; }
.filters .search { flex: 1 1 260px; max-width: 420px; margin: 0; position: relative; }
.filters .search input { height: 40px; padding-inline-start: 36px; border-radius: 999px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2367627F' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 13px center; }
[dir=rtl] .filters .search input { background-position: calc(100% - 13px) center; }
.filters .pills button .n { font-weight: 500; opacity: .7; margin-inline-start: 2px; }
.filters .pills button .n:empty { display: none; }
.filters .res { margin-inline-start: auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
mark { background: #FDE68A; color: inherit; border-radius: 3px; padding: 0 1px; }
.nomatch { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }
.adgrid > .nomatch { grid-column: 1 / -1; }
.ctable.filtering tr.extra { display: table-row; }

/* Status chips (campaigns, ad sets, ads) */
.st { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px 1px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; vertical-align: 1px;
  background: #F1EFF7; color: var(--muted); }
.st::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-active { background: var(--good-soft); color: var(--good); }
.st-review { background: var(--warn-soft); color: #92400E; }
.st-rejected, .st-issues { background: var(--bad-soft); color: var(--bad); }
.adcard .info .st { margin-bottom: 4px; }
.ctable td.nm .st { margin-inline-start: 6px; }

/* History import status (team view) */
.hist-status { margin-bottom: 14px; }
.hist-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; background: var(--brand-soft); color: var(--brand-dark); border-radius: 12px; padding: 10px 14px; font-size: 13.5px; }
.hist-bar.warn { background: var(--warn-soft); color: #92400E; } .hist-bar.ok { background: var(--good-soft); color: var(--good); }
.hist-bar .who { margin-inline-start: auto; }
.hist-bar .bar { flex-basis: 100%; height: 6px; background: rgba(255, 255, 255, .7); border-radius: 999px; overflow: hidden; }
.hist-bar .bar i { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .4s; }
