/* ads.css — the Google Ads / Meta Ads pages (EA v2, web/ads.js): only what is the
   page's own. Top bar, switch, hero frame, panels, split, folds, «Як рахуємо» and motion are the kit
   (web/ea-ui.css); the palette follows Cloudflare's.
   Colour, one meaning each: sales = blue, spend = light pink (lighter than the "bad" rose, never a
   status), ROAS = its 6-stop scale (set inline), changes = the kit's green / rose / grey pills
   (costs inverted), weekends = soft pink text, the platform's own colour only on its logo.
   Switching the period changes the hero in place: numbers tween 0.35 s, the strip under the day chart
   slides to the period's days (0.3 s; every column stays at full strength); nothing re-mounts,
   nothing changes height. */

.ads {
    --ads-rev: #60a5fa;
    --ads-rev-ink: #9cd3ff;
    --ads-cost: #f9a8d4;
    --ads-cost-ink: #ffb3cf;
    --ads-wkend: #f2b4d0;
}

/* nothing to show: the card only */
#ads-root.is-down .ea-sentinel,
#ads-root.is-down .ea-switch-wrap,
#ads-root.is-down .ads-camp,
#ads-root.is-down .ea-foot { display: none; }

/* ---------- top bar: back · logo · title · refresh ---------- */
.ads-mark { width: 26px; height: 24px; flex-shrink: 0; display: grid; place-items: center; }
.ads-mark svg { width: 24px; height: auto; display: block; }
.ads-mark--meta svg { width: 26px; }
.ads .ea-top { gap: 10px; }
.ads .ea-top__title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ads .ea-sentinel { margin-top: 2px; }
#ads-ago { margin-top: 2px; }
#ads-ago.is-failed { color: var(--ea-bad); }
/* ---------- hero: range · ROAS · sales / spend · the other figures ---------- */
.ads .ads-hero { margin-top: 8px; }
.ads-range { font-size: 13px; font-weight: 650; letter-spacing: 0.04em; color: var(--ea-ink-2); white-space: nowrap; }
.ads-vs { font-size: 12px; color: var(--ea-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ads-roas { margin-top: 12px; }
.ads-roas__line { display: flex; align-items: center; gap: 14px; margin-top: 6px; min-height: 59px; }
.ads .ads-roas__big { transition: color 0.35s ease; }
.ads .ads-roas__big .ads-num { font-family: inherit; }
.ads-roas .ea-big__sub { margin-top: 8px; font-size: 13px; color: var(--ea-ink-3); }
.ads-pill { display: inline-flex; min-height: 22px; align-items: center; }
.ads-chg--none { display: none; }

.ads-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--ea-line); }
.ads-pair__it { min-width: 0; padding: 0 10px; }
.ads-pair__it:first-child { padding-left: 0; }
.ads-pair__it + .ads-pair__it { border-left: 1px solid var(--ea-line); padding-left: 14px; }
.ads-pair__k { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ea-ink-3); }
.ads-pair__v { margin: 4px 0 6px; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; }
.ads-pair__v--rev { color: var(--ads-rev-ink); }
.ads-pair__v--cost { color: var(--ads-cost-ink); }
.ads-dot { width: 8px; height: 8px; border-radius: 3px; flex-shrink: 0; }
.ads-dot--rev { background: var(--ads-rev); box-shadow: 0 0 8px rgba(96, 165, 250, 0.5); }
.ads-dot--cost { background: var(--ads-cost); box-shadow: 0 0 8px rgba(249, 168, 212, 0.45); }

.ads-kvs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; margin-top: 14px; }
.ads-kv { min-width: 0; padding: 9px 0 8px; border-top: 1px solid var(--ea-line); }
.ads-kv__k { font-size: 12px; color: var(--ea-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ads-kv__line { display: flex; align-items: center; gap: 8px; margin-top: 3px; min-width: 0; }
.ads-kv__v { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.ads-hero__empty { display: none; margin-top: 10px; font-size: 13px; color: var(--ea-ink-3); }
.ads-hero.is-empty .ads-hero__empty { display: block; }
.ads-hero.is-empty .ads-roas, .ads-hero.is-empty .ads-pair, .ads-hero.is-empty .ads-kvs { opacity: 0.4; }
.ads-hero--sk .ea-sk--chart { height: 210px; }

/* hero entrance, once per open (a period switch never replays it) */
.ads .ads-hero.is-enter { animation: eaRise 0.45s var(--ea-ease) both; }
.ads .ads-hero.is-enter .ads-pair,
.ads .ads-hero.is-enter .ads-kvs { animation: eaFadeUp 0.3s ease 0.2s both; }

/* ---------- the campaigns entry (opens the existing campaign pages) ---------- */
.ads .ads-camp {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-top: 12px;
    padding: 12px 14px;
    min-height: 58px;
    border-radius: 18px;
    background: var(--ea-panel-bg);
    border: 1px solid var(--ea-line);
    text-align: left;
    transition: transform 0.2s var(--ea-ease), background 0.2s;
}
.ads .ads-camp:active { transform: scale(0.985); background: rgba(255, 255, 255, 0.06); }
.ads-camp__logo { width: 34px; height: 34px; flex-shrink: 0; border-radius: 11px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.06); }
.ads-camp__logo svg { width: 20px; height: auto; display: block; }
.ads-camp__txt { flex: 1; min-width: 0; }
.ads-camp__txt b { display: block; font-size: 15px; font-weight: 650; }
.ads-camp__txt small { display: block; margin-top: 2px; font-size: 12px; color: var(--ea-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ads-camp__go { color: var(--ea-ink-3); display: grid; }

/* ---------- «По днях»: 30-day totals, the chart, its caption, the ROAS scale, the rows ---------- */
.ads-tots { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr) minmax(0, 1fr); margin-top: 14px; }
.ads-tots--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 12px; }
.ads-tot { min-width: 0; padding: 0 10px; }
.ads-tot:first-child { padding-left: 0; }
.ads-tot + .ads-tot { border-left: 1px solid var(--ea-line); }
.ads-tots--4 .ads-tot:nth-child(3) { border-left: 0; padding-left: 0; }
.ads-tot__k { font-size: 12px; color: var(--ea-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ads-tot__v { margin-top: 3px; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; }
.ads-tot__v--rev { color: var(--ads-rev-ink); }
.ads-tot__v--cost { color: var(--ads-cost-ink); }

.ads-chart svg { overflow: visible; }
.ads-band-lbl { font-size: 11px; fill: var(--ea-ink-3); pointer-events: none; }
.ads-base { stroke: rgba(255, 255, 255, 0.08); stroke-width: 1; }
.ads-bar--rev { fill: var(--ads-rev); }
.ads-bar--cost { fill: var(--ads-cost); }
.ads-bar.is-part { fill-opacity: 0.35; stroke: rgba(255, 255, 255, 0.55); stroke-width: 0.8; stroke-dasharray: 2 2; }
.ads-span-track { fill: rgba(255, 255, 255, 0.07); }
/* the hero's period under the day chart: a full-width rect scaled to its days (syncRange) */
.ads-span { fill: rgba(236, 236, 248, 0.8); transform-box: view-box; transform-origin: 0 0; transition: transform 0.3s var(--ea-ease), opacity 0.2s; }
.ads-chart--months { margin-top: 14px; }
.ads .ads-note { margin-top: 8px; }

.ads-cap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-top: 12px; padding: 10px 12px; border-radius: var(--ea-r-inset); background: rgba(255, 255, 255, 0.04); min-height: 46px; }
.ads-cap__when { font-size: 13px; font-weight: 650; flex-basis: 100%; }
.ads-cap__when.is-wkend { color: var(--ads-wkend); }
.ads-cap__it { display: inline-flex; align-items: baseline; gap: 5px; font-size: 13px; white-space: nowrap; }
.ads-cap__it small { font-size: 12px; color: var(--ea-ink-3); }
.ads-cap__it b { font-weight: 700; }
.ads-c-rev { color: var(--ads-rev-ink); }
.ads-c-cost { color: var(--ads-cost-ink); }

/* the ROAS colour scale (kept from the old page's legend) */
.ads-scale { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 10px; margin-top: 12px; }
.ads-scale__k { grid-row: span 2; font-size: 12px; color: var(--ea-ink-3); white-space: nowrap; }
.ads-scale__bar { height: 6px; border-radius: 3px; background: linear-gradient(90deg, #DC2626 0%, #F43F5E 20%, #F97316 40%, #EAB308 60%, #22C55E 80%, #4ADE80 100%); }
.ads-scale__marks { display: flex; justify-content: space-between; margin-top: 3px; font-size: 11px; font-style: normal; color: var(--ea-ink-4); }
.ads-scale__marks i { font-style: normal; }

/* one row per day / month: label · ROAS, then sales and spend bars on one scale */
.ads-drows { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; margin-top: 10px; }
.ea-more__in > .ads-drows { margin-top: 0; padding-top: 4px; }
.ads-drow { min-width: 0; padding: 9px 0 10px; }
.ads-drow__top { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.ads-drow__lbl { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 7px; white-space: nowrap; font-size: 14px; }
.ads-drow__lbl b { font-weight: 650; }
.ads-wd { font-size: 12px; color: var(--ea-ink-3); }
.ads-drow.is-wkend .ads-drow__lbl b, .ads-drow.is-wkend .ads-wd { color: var(--ads-wkend); }
.ads-tag { align-self: center; padding: 1px 7px; border-radius: 7px; font-size: 11px; font-weight: 650; color: var(--ea-ink-2); border: 1px dashed rgba(255, 255, 255, 0.4); }
.ads-drow__roas { flex-shrink: 0; font-size: 12px; color: var(--ea-ink-3); white-space: nowrap; }
.ads-drow__roas b { font-size: 15px; font-weight: 700; margin-left: 2px; }
.ads-drow__bar { display: grid; grid-template-columns: minmax(0, 1fr) 96px; align-items: center; gap: 10px; margin-top: 5px; }
.ads-track { height: 5px; border-radius: 4px; background: rgba(255, 255, 255, 0.05); overflow: hidden; }
.ads-fill { display: block; height: 100%; width: calc(var(--v) * 1%); min-width: 1px; border-radius: 4px; transform-origin: left center; }
.ads-fill--rev { background: var(--ads-rev); }
.ads-fill--cost { background: var(--ads-cost); }
.ads-drow.is-partial .ads-fill { opacity: 0.45; outline: 1px dashed rgba(255, 255, 255, 0.5); outline-offset: -1px; }
.ads-drow__v { font-size: 13px; font-weight: 650; text-align: right; white-space: nowrap; }
.ads-drow__v--rev { color: var(--ads-rev-ink); }
.ads-drow__v--cost { color: var(--ads-cost-ink); }

/* ---------- devices / platforms ---------- */
.ads-srows { display: grid; gap: 10px; margin-top: 14px; }
.ads-srow { min-width: 0; padding-top: 10px; border-top: 1px solid var(--ea-line); }
.ads-srow__top { display: flex; align-items: baseline; gap: 10px; }
.ads-srow__name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ads-srow__name i { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.ads-srow__v { flex-shrink: 0; font-size: 15px; font-weight: 700; }
.ads-srow__note { margin-top: 2px; font-size: 12px; color: var(--ea-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- «Як рахуємо» ---------- */
.ads .ads-how { margin-top: 4px; padding: 0 4px; }
.ads .ads-how ul { margin: 0 0 8px 17px; padding-left: 14px; }
.ads .ads-how li { margin: 6px 0; }

@media (prefers-reduced-motion: reduce) {
    .ads-span, .ads .ads-roas__big { transition: none !important; }
}
