/* Campaign Control - UI layer (loaded after app.css).
   Calm SaaS panel: left navigation, two hero cards, Platform -> Account -> Campaign tree.
   Colour is semantic (pace / status), never decorative; numbers are tabular and right-aligned. */

:root {
  --side-w: 232px;
  --side-bg: #13263d;
  --side-text: #c4d2e3;
  --side-muted: #7f93ab;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(16, 32, 52, .05), 0 4px 16px rgba(16, 32, 52, .04);
  --line-soft: #e8ecf1;
  --band: #f6f8fb;
  --accent: #24507f;
  --g: #3b78d8;  --m: #5b6ee1;  --t: #3a3f46;
  --good: var(--ok);  --good-bg: var(--ok-bg);
  --bad: var(--crit); --bad-bg: var(--crit-bg);
  --quiet: var(--neutral); --quiet-bg: var(--neutral-bg);
}
@media (prefers-color-scheme: dark) {
  :root { --side-bg: #0b1826; --line-soft: #243140; --band: #19222c; --accent: #8fb4dd;
    --g: #7aa7ef; --m: #9aa6f4; --t: #c7ccd3; --shadow: none; }
}

body { font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
/* The [hidden] attribute always wins over layout rules (display: grid / flex / inline-flex below) -
   view filters hide rows, accounts, platforms, chips and pills with it. */
[hidden] { display: none !important; }
.num, .mc, .hbig, .hof, .plats, .diag dd, .kv dd { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- layout + navigation */
.navtoggle { position: absolute; opacity: 0; pointer-events: none; }
.mtop { display: none; }
.side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--side-bg); color: var(--side-text);
  display: flex; flex-direction: column; padding: 18px 12px; overflow-y: auto; z-index: 30; }
.side .brand { color: #fff; font-weight: 650; display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; }
.side .brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px;
  background: #fff; color: #152f4e; font-size: 11px; font-weight: 800; }
.snav { display: flex; flex-direction: column; gap: 2px; }
.snav a { color: var(--side-text); padding: 8px 12px; border-radius: 8px; font-weight: 500; }
.snav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.snav a.active { background: rgba(255,255,255,.12); color: #fff; }
.sgroup { margin-top: 26px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.08); }
.sgroup-h { display: block; color: var(--side-muted); font-size: 11px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; padding: 4px 12px 8px; }
.sgroup-h:hover, .sgroup-h.active { color: #fff; text-decoration: none; }
.snav-sub a { font-size: 13px; padding: 6px 12px; color: #aebfd3; }
.snav-note { display: block; font-size: 10.5px; color: var(--side-muted); font-weight: 400; }
.side-foot { margin-top: auto; padding: 18px 10px 4px; font-size: 12px; color: var(--side-muted); }
.side-foot .ro { margin: 0 0 8px; }
.side-foot .userbox { display: flex; gap: 12px; }
.side-foot a, .side-foot .linklike { color: var(--side-text); }
body.has-side .maincol { margin-left: var(--side-w); min-height: 100vh; }
.page { padding: 28px 36px 40px; max-width: 1480px; margin: 0; }
.foot { text-align: left; padding: 8px 36px 28px; }
.flash { border-radius: 10px; }
.flash-err { background: var(--crit-bg); color: var(--crit); border-color: transparent; }

/* ---------------------------------------------------------------- page header */
.chead { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px 32px; flex-wrap: wrap; margin-bottom: 22px; }
.chead h1 { font-size: 28px; font-weight: 700; letter-spacing: -.01em; margin: 0; }
.chead .crumbs { margin: 0 0 4px; font-size: 12px; }
.exec { margin: 6px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 13px; }
.exec-line { font-weight: 600; color: var(--text); }
.exec-meta { color: var(--muted); }
.chead-tools { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.syncb { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 10px;
  border-radius: 99px; }
.syncb:hover { text-decoration: none; }
.syncb-ok { color: var(--ok); background: var(--ok-bg); }
.syncb-warn { color: var(--warn); background: var(--warn-bg); }

.fbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin: 0; padding: 0; background: none; border: 0; }
.fbar label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); font-weight: 600;
  letter-spacing: .03em; text-transform: uppercase; }
.fbar select, .fbar input, .tform select, .tform input, .monthnav select {
  height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text);
  padding: 0 10px; font: inherit; font-size: 13px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.btn { border-radius: 8px; }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; height: 34px; display: inline-flex; align-items: center; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); width: 300px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(16,32,52,.14); padding: 12px; z-index: 25; }
.menu-pop p { margin: 0 0 10px; }
.menu-item { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; background: none; border: 0;
  font: inherit; color: var(--link); cursor: pointer; }
.menu-item:hover { background: var(--surface-2); text-decoration: none; }

/* ---------------------------------------------------------------- hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; margin-bottom: 28px; }
.hcard { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 22px 24px 18px; min-width: 0; }
.hc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.hc-head h2 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.hnum { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.hbig { font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.hof { font-size: 15px; color: var(--muted); }
.hof b, .hplan { color: var(--text); font-weight: 600; }
.hmeta { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.hmeta b { color: var(--text); font-size: 15px; }
.sep { margin: 0 4px; color: var(--line); }
.tlabel { margin: -4px 0 4px; font-size: 14px; font-weight: 600; }
.tstatus { margin: 12px 0 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tguide { margin: 6px 0 0; }
.tempty { font-size: 15px; margin: 4px 0 14px; }

.meter { position: relative; display: block; height: 8px; border-radius: 99px; background: var(--surface-2); margin-top: 12px; overflow: visible; }
.meter-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 99px; background: var(--accent); }
.meter-budget.meter-over .meter-fill { background: var(--crit); }
/* target fill = the tone of the target pace (same source as the badge): good green, bad red, else grey */
.meter-target .meter-fill { background: var(--muted); opacity: .45; }
.meter-target.meter-good .meter-fill { background: var(--good); opacity: 1; }
.meter-target.meter-bad .meter-fill { background: var(--bad); opacity: 1; }
.meter-exp { position: absolute; top: -4px; width: 2px; height: 16px; margin-left: -1px; background: var(--text); border-radius: 1px; opacity: .55; }
.meter-none { visibility: hidden; }
.mc .meter { height: 4px; margin: 6px 0 0 auto; max-width: 150px; }
.mc .meter-exp { top: -3px; height: 10px; }

.plats { list-style: none; margin: 16px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line-soft);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pl { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "dot name" "dot v" "dot share"; column-gap: 8px; }
.pl-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-top: 6px; }
.pl .pl-dot { grid-area: dot; }
.pl-google_ads .pl-dot, .pg-google_ads .pl-dot, .pl-chip.pl-google_ads .pl-dot { background: var(--g); }
.pl-meta .pl-dot, .pg-meta .pl-dot, .pl-chip.pl-meta .pl-dot { background: var(--m); }
.pl-tiktok .pl-dot, .pg-tiktok .pl-dot, .pl-chip.pl-tiktok .pl-dot { background: var(--t); }
.pl-name { grid-area: name; font-size: 12px; color: var(--muted); }
.pl-v { grid-area: v; font-weight: 650; font-size: 15px; }
.pl-share { grid-area: share; font-size: 11.5px; color: var(--muted); }
.pl-no_account .pl-v, .pl-not_connected .pl-v, .pl-no_data .pl-v { font-weight: 400; font-size: 13px; }

.hmore { margin-top: 14px; font-size: 13px; }
.hmore > summary { cursor: pointer; color: var(--link); font-weight: 500; }
.kv { display: grid; grid-template-columns: 1fr; gap: 4px; margin: 10px 0 0; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px dashed var(--line-soft); padding: 3px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }
.diag { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--line-soft); font-size: 12.5px; }
.diag > div { display: flex; gap: 6px; }
.diag dt { color: var(--muted); }
.diag dd { margin: 0; font-weight: 600; }

.tform { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 10px 0 8px; }
.tform label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); font-weight: 600; }
.tform input { width: 150px; }

.hstatus .scount { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.hstatus h3 { margin: 0 0 8px; font-size: 13px; }
.hstatus ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hstatus li { display: flex; justify-content: space-between; align-items: center; }
.hstatus li b { font-size: 16px; }

/* ---------------------------------------------------------------- pace badges */
.pb { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; line-height: 1;
  padding: 5px 10px; border-radius: 99px; white-space: nowrap; }
.pb i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pb .pp { font-weight: 500; opacity: .85; }
.pb-good { color: var(--good); background: var(--good-bg); }
.pb-warn { color: var(--warn); background: var(--warn-bg); }
.pb-bad { color: var(--bad); background: var(--bad-bg); }
.pb-quiet { color: var(--quiet); background: var(--quiet-bg); }
.pb-sm { font-size: 11px; padding: 3px 7px; gap: 5px; }
.pb-sm i { width: 5px; height: 5px; }
.exec-mini { font-size: 11.5px; color: var(--muted); }

/* ---------------------------------------------------------------- detail tree */
.detail { margin-bottom: 26px; }
.dhead { display: flex; align-items: baseline; justify-content: space-between; margin: 6px 0 12px; }
.dhead h2 { margin: 0; font-size: 17px; }
.dhead { flex-wrap: wrap; gap: 8px 16px; }
.sortf { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.sortf label { display: flex; align-items: center; gap: 6px; }
.sortf select { height: 30px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--text); font: inherit; font-size: 12.5px; padding: 0 6px; }
.dhead h2 .muted { font-weight: 400; font-size: 14px; }
.tree-wrap { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
table.tree { width: 100%; border-collapse: separate; border-spacing: 0; }
table.tree th, table.tree td { padding: 11px 18px; border: 0; text-align: right; vertical-align: top; background: none; }
table.tree th.name, table.tree td.name { text-align: left; }
table.tree thead th { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
  padding-top: 14px; padding-bottom: 6px; white-space: nowrap; position: static; }
table.tree thead th a { color: inherit; }
table.tree thead th a:hover { color: var(--text); text-decoration: none; }
table.tree thead .si { margin-left: 4px; opacity: .45; }
table.tree thead .sorted .si { opacity: 1; }
.thsub { display: block; font-size: 10.5px; font-weight: 500; text-transform: none; letter-spacing: 0; }
table.tree tr.legend td { font-size: 11.5px; color: var(--muted); padding-top: 0; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); text-align: right; }
.legend-plan { border-bottom: 1px dashed currentColor; }
table.tree col.c-name, table.tree th.name { width: 38%; }

/* platform */
table.tree tbody.pgroup tr.plat th, table.tree tbody.pgroup tr.plat td { padding-top: 20px; padding-bottom: 12px; border-top: 1px solid var(--line); }
table.tree tbody.pgroup:first-of-type tr.plat th, table.tree tbody.pgroup:first-of-type tr.plat td { border-top: 0; }
.plat-name { display: inline-flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 700; color: var(--text); }
.plat-name .pl-dot { margin: 0; width: 10px; height: 10px; }
.plat-sub { display: block; margin: 2px 0 0 19px; font-size: 12px; font-weight: 400; color: var(--muted); }
tr.plat .act { font-size: 15px; }
/* account */
table.tree tr.acct th, table.tree tr.acct td { background: var(--band); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
table.tree tr.acct th.name { padding-left: 30px; box-shadow: inset 3px 0 0 var(--accent); }
.acc-name { font-weight: 650; font-size: 14px; color: var(--text); margin-right: 8px; }
.own { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 99px; vertical-align: 1px;
  color: var(--muted); border: 1px solid var(--line); background: var(--surface); }
.own-media_maker { color: var(--accent); border-color: transparent; background: rgba(36, 80, 127, .09); }
.acc-note { display: block; margin-left: 0; font-size: 11.5px; color: var(--muted); font-weight: 400; margin-top: 2px; }
tr.acct-unassigned th.name { box-shadow: inset 3px 0 0 var(--warn) !important; }
/* sub-groups (Meta: performance vs promoted posts) */
table.tree tr.sub th { text-align: left; padding: 12px 18px 4px 46px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); }
table.tree tr.sub-post th { color: var(--m); border-top: 1px dashed var(--line-soft); }
.sub-sum { margin-left: 8px; font-weight: 500; letter-spacing: 0; text-transform: none; font-size: 11.5px; }
/* campaign */
table.tree tr.r th, table.tree tr.r td { border-top: 1px solid var(--line-soft); font-size: 13.5px; }
table.tree tr.acct + tr.r th, table.tree tr.acct + tr.r td, table.tree tr.sub + tr.r th, table.tree tr.sub + tr.r td { border-top: 0; }
table.tree tr.r th.name { padding-left: 46px; font-weight: 400; }
table.portfolio tr.r th.name, table.clist tr.r th.name, table.tlist tr.r th.name { padding-left: 18px; }
table.tree tbody tr.r:hover th, table.tree tbody tr.r:hover td { background: rgba(36, 80, 127, .035); }
.cname { color: var(--text); }
a.cname:hover { color: var(--link); }
.cname.strong { font-weight: 650; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.tags .tag { font-size: 10.5px; padding: 0 7px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 0; }
.tag-out { color: var(--warn) !important; background: var(--warn-bg) !important; }
.tag-post { color: var(--m) !important; background: rgba(91, 110, 225, .1) !important; }
tr.r-idle .cname { color: var(--muted); }
tr.r-outside th.name .cname { color: var(--text); }
tr.empty-row td { text-align: left !important; padding-left: 46px !important; font-size: 12.5px; }

/* metric cell: realisation / plan, meter, % + pace */
.mc { white-space: nowrap; min-width: 150px; }
.mv { display: flex; justify-content: flex-end; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.act { font-weight: 600; color: var(--text); }
.of { color: var(--muted); font-size: 12.5px; }
.pv { color: var(--muted); }
.unit { font-size: 10.5px; color: var(--muted); letter-spacing: .03em; }
.ms { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 5px; font-size: 12px; color: var(--muted); }
.ms .pct { font-weight: 600; color: var(--text); }
.delta { font-size: 11.5px; }
.d-cheaper { color: var(--good); }
.d-pricier { color: var(--bad); }
.mplats { white-space: normal; }
.pl-chip { display: inline-flex; align-items: center; gap: 5px; margin: 0 0 3px 10px; font-size: 12.5px; }
.pl-chip .pl-dot { margin: 0; }

/* inline PLAN editing: plan values look editable, actuals do not */
button.pe { background: none; border: 0; padding: 1px 3px; margin: 0 -3px; font: inherit; color: var(--link); cursor: pointer;
  border-bottom: 1px dashed currentColor; border-radius: 3px; }
button.pe:hover { background: rgba(29, 95, 166, .08); }
button.pe-empty { font-style: italic; opacity: .85; }
.pe-input { width: 118px; height: 30px; font: inherit; font-size: 13px; text-align: right; padding: 0 8px; border: 1px solid var(--link);
  border-radius: 7px; background: var(--surface); color: var(--text); box-shadow: 0 0 0 3px rgba(29, 95, 166, .12); }
.pe-input.invalid { border-color: var(--crit); box-shadow: 0 0 0 3px rgba(179, 38, 30, .12); }
.pe-msg { display: block; font-size: 11.5px; color: var(--crit); white-space: normal; text-align: right; }
.saving { opacity: .6; }
.hof button.pe { font-weight: 600; }

/* lists: clients, targets, settings */
.inline-form { margin-top: 8px; text-align: left; white-space: normal; }
.inline-form > summary { cursor: pointer; color: var(--link); font-size: 12.5px; text-align: right; }
.inline-form .tform { justify-content: flex-end; }
.cfoot { margin-top: 18px; }
.setgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.setcard { display: block; color: var(--text); border-radius: var(--radius-lg); padding: 18px 20px; }
.setcard:hover { text-decoration: none; border-color: var(--link); }
.setcard h2 { margin: 0 0 6px; font-size: 15px; color: var(--link); }
.setcard p { margin: 0; font-size: 13px; }
.empty-state { padding: 22px; }
.monthnav { display: flex; gap: 6px; align-items: center; }

/* project plans (Caparol) inside the new layout; wrappers contain their absolutely positioned
   screen-reader labels (otherwise they widen the page) */
.projects { margin-bottom: 26px; }
.ovtable, .tree-wrap, .tablewrap { position: relative; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr; }
  .page { padding: 22px 22px 32px; }
}
@media (max-width: 860px) {
  body.has-side .maincol { margin-left: 0; }
  .mtop { display: flex; align-items: center; justify-content: space-between; height: 54px; padding: 0 16px;
    background: var(--side-bg); position: sticky; top: 0; z-index: 35; }
  .mtop .brand { color: #fff; font-weight: 650; display: flex; align-items: center; gap: 8px; }
  .navbtn { color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
  .side { display: none; top: 54px; width: min(300px, 86vw); box-shadow: 8px 0 30px rgba(0,0,0,.25); }
  .side > .brand { display: none; }
  .navtoggle:checked ~ .side { display: flex; }
  .page { padding: 18px 16px 28px; }
  .foot { padding: 8px 16px 24px; }
  .chead { align-items: flex-start; }
  .chead h1 { font-size: 23px; }
  .chead-tools { width: 100%; }
  .fbar { width: 100%; }
  .fbar label { flex: 1 1 130px; }
  .fbar select, .fbar input { width: 100%; }
  .menu-pop { left: 0; right: auto; width: min(320px, 90vw); }
  .hcard { padding: 18px 16px 14px; }
  .hbig { font-size: 28px; }
  .plats { grid-template-columns: 1fr; gap: 6px; }
  .pl { grid-template-columns: auto 1fr auto auto; grid-template-areas: "dot name v share"; align-items: baseline; column-gap: 10px; }
  .pl .pl-dot { margin: 0; align-self: center; }
  .hstatus .scount { grid-template-columns: 1fr; }

  /* the tree becomes stacked cards: platform header, account band, campaign cards */
  .tree-wrap { background: none; border: 0; box-shadow: none; overflow: visible; }
  table.tree, table.tree tbody, table.tree tr, table.tree th, table.tree td { display: block; width: 100%; }
  table.tree thead tr:first-child { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0 2px 8px; }
  table.tree thead tr:first-child th { width: auto; padding: 0; }
  table.tree thead th.name { flex-basis: 100%; }
  table.tree tr.legend { display: none; }
  table.tree tbody.pgroup { margin-bottom: 18px; }
  table.tree tr.plat, table.tree tr.acct, table.tree tr.r { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 10px;
    background: var(--surface); border: 1px solid var(--line-soft); border-radius: 12px; padding: 12px 14px; margin-top: 8px; }
  table.tree tr.plat { background: none; border: 0; padding: 12px 2px 4px; }
  table.tree tr.acct { background: var(--band); box-shadow: inset 3px 0 0 var(--accent); margin-top: 14px; }
  table.tree tr.r { margin-left: 12px; width: auto; }
  table.portfolio tr.r, table.clist tr.r, table.tlist tr.r { margin-left: 0; }
  table.tree th.name, table.tree tr.sub th { width: auto !important; }
  table.tree tr > th.name { grid-column: 1 / -1; padding: 0 0 8px !important; box-shadow: none !important; border: 0 !important; background: none !important; }
  table.tree tr > td.mc { padding: 0 !important; border: 0 !important; background: none !important; min-width: 0; white-space: normal; text-align: left; }
  table.tree td.mc::before { content: attr(data-label); display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
  .mv, .ms { justify-content: flex-start; }
  .mc .meter { margin-left: 0; }
  table.tree tr.sub { display: block; margin: 12px 0 0 12px; }
  table.tree tr.sub th { padding: 0 !important; border: 0 !important; }
  table.tree tr.r th, table.tree tr.r td, table.tree tr.acct th, table.tree tr.acct td { border: 0; }
  table.tree tbody tr.r:hover th, table.tree tbody tr.r:hover td { background: none; }
  table.clist tr.r, table.tlist tr.r, table.portfolio tr.r { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 10px; }
  .inline-form > summary, .inline-form .tform { text-align: left; justify-content: flex-start; }
  .pe-input { width: 100%; max-width: 180px; text-align: left; }
  .pe-msg { text-align: left; }
}
@media (max-width: 420px) {
  table.tree tr.plat, table.tree tr.acct, table.tree tr.r { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 10px; }
}
@media print {
  .side, .mtop, .fbar, .menu { display: none !important; }
  body.has-side .maincol { margin-left: 0; }
}

/* ---------------------------------------------------------------- budget = limit (nominal only) */
.limit-note { font-size: 11.5px; color: var(--muted); }
.bfig { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 20px; margin: 4px 0 0; }
.bfig > div { min-width: 0; }
.bfig dt { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.bfig dd { margin: 0; font-size: clamp(19px, 1.7vw, 24px); font-weight: 700; letter-spacing: -.01em; line-height: 1.2;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.bfig .bf-spent dd { font-size: clamp(21px, 1.9vw, 28px); }
.bfig dd button.pe { font-weight: 700; }
.bf-alt { display: block; font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.bfig .bf-over dd { color: var(--crit); }
.bwarn { margin: 12px 0 0; padding: 8px 12px; border-radius: 10px; background: var(--crit-bg); color: var(--crit); font-size: 13px; }
.bwarn a { color: inherit; text-decoration: underline; }
.overb { color: var(--crit); font-weight: 600; }
.ms .left { color: var(--muted); }
.exec-over { color: var(--crit) !important; }
.tcount { list-style: none; margin: 0 0 10px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; }
.tcount li { display: flex; justify-content: space-between; align-items: center; }
.tcount b { font-size: 16px; }
/* toolbar of the campaign tree: status filter + sort, wraps on mobile */
.dtools { flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; max-width: 100%; }
.dtools select { max-width: 100%; }
.dtools-note { font-size: 11.5px; color: var(--muted); flex-basis: 100%; text-align: right; }
@media (max-width: 860px) {
  .bfig { grid-template-columns: 1fr 1fr; }
  .bfig .bf-spent dd { font-size: 24px; }
  .tcount { grid-template-columns: 1fr; }
  .dhead { flex-direction: column; align-items: flex-start; }
  .dtools { justify-content: flex-start; width: 100%; }
  .dtools label { flex-wrap: wrap; }
  .dtools-note { text-align: left; }
}
.bf-alt button.pe { font-size: 12.5px; font-weight: 500; }
.bfig dd .pe-input { font-size: 13px; font-weight: 400; }
.ltools { justify-content: space-between; align-items: center; }
@media (max-width: 860px) { .ltools { flex-direction: row; flex-wrap: wrap; } }

/* ---------------------------------------------------------------- settings dropdown in the side menu */
details.sgroup > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; padding: 6px 12px; border-radius: 8px; }
details.sgroup > summary::-webkit-details-marker { display: none; }
details.sgroup > summary::after { content: "▾"; font-size: 12px; transition: transform .15s; transform: rotate(-90deg); }
details.sgroup[open] > summary::after { transform: rotate(0); }
details.sgroup > summary:hover { color: #fff; background: rgba(255,255,255,.06); }
details.sgroup > summary.active { color: #fff; }
details.sgroup .snav-sub { margin-top: 4px; }

/* ---------------------------------------------------------------- history */
.hfilters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; padding: 16px 18px; margin-bottom: 18px; border-radius: var(--radius-lg); }
.hfilters label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.hfilters select, .hfilters input { height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text);
  padding: 0 10px; font: inherit; font-size: 13px; text-transform: none; letter-spacing: 0; font-weight: 400; max-width: 100%; }
.hfilters .btn { height: 34px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; flex-basis: 100%; }
.presets a { font-size: 12.5px; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); color: var(--text); }
.presets a:hover { text-decoration: none; background: var(--line); }
.presets a.active { background: var(--accent); color: #fff; }
.hnote { flex-basis: 100%; margin: 0; }
table.htable tr.acct th.name { padding-left: 18px; }
table.htable tr.r th.name { padding-left: 34px; }
table.htable a.acc-name { color: var(--text); }
@media (max-width: 860px) {
  .hfilters label { flex: 1 1 140px; }
  .hfilters select, .hfilters input { width: 100%; }
  table.htable tr.acct, table.htable tr.r { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 10px; }
  table.htable tr.r { margin-left: 12px; }
}

/* ---------------------------------------------------------------- drill-down status chips (target status) */
.schips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; flex-basis: 100%; }
.schip { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 11px; border-radius: 99px;
  font-size: 12px; font-weight: 600; line-height: 1.1; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); cursor: pointer; user-select: none; transition: background .12s, border-color .12s, box-shadow .12s; }
.schip:hover { text-decoration: none; border-color: var(--muted); background: var(--surface-2); }
.schip:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.schip i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.schip b { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.schip-good i { background: var(--good); }
.schip-bad i { background: var(--bad); }
.schip-quiet i { background: var(--quiet); }
.schip.is-active { border-color: var(--accent); background: var(--accent); color: #fff; box-shadow: 0 0 0 3px rgba(36, 80, 127, .15); }
.schip.is-active b { color: #fff; }
.schip.is-active i { background: #fff; }
.tchipgrid .schips { justify-content: flex-start; }
.tchipgrid .schip { min-height: 34px; }
.fpill-wrap { display: inline-flex; }
.fpill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; background: var(--accent);
  color: #fff; font-size: 12.5px; font-weight: 600; min-height: 28px; }
.fpill:hover { text-decoration: none; filter: brightness(1.1); }
.dhead { gap: 8px 16px; }
@media (max-width: 860px) {
  .schips { justify-content: flex-start; }
  .schip { min-height: 36px; }
}

/* ---------------------------------------------------------------- compact single-row campaign tree (#overview)
   Every platform / account / campaign record is ONE line: value / plan and the extras (remaining,
   thin inline meter, %, target status, CPC delta) side by side - scanned horizontally. */
:is(table#overview, table#campaigns) { table-layout: fixed; }
:is(table#overview, table#campaigns) thead th.name { width: 31%; }
:is(table#overview, table#campaigns) thead th:nth-child(2) { width: 22%; }
:is(table#overview, table#campaigns) thead th:nth-child(3) { width: 29%; }
:is(table#overview, table#campaigns) thead th:nth-child(4) { width: 18%; }
:is(table#overview, table#campaigns) tbody th, :is(table#overview, table#campaigns) tbody td { padding-top: 6px; padding-bottom: 6px; vertical-align: middle; overflow: hidden; }
:is(table#overview, table#campaigns) tbody.pgroup tr.plat th, :is(table#overview, table#campaigns) tbody.pgroup tr.plat td { padding-top: 14px; padding-bottom: 8px; }
:is(table#overview, table#campaigns) tr.r th.name { padding-left: 40px; }
:is(table#overview, table#campaigns) tr.acct th.name { padding-left: 24px; }
:is(table#overview, table#campaigns) tr.sub th { padding: 8px 18px 2px 40px; }
:is(table#overview, table#campaigns) .nm { display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; }
:is(table#overview, table#campaigns) .nm .cname, :is(table#overview, table#campaigns) .nm .acc-name { overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; margin-right: 0; }
:is(table#overview, table#campaigns) .nm .tags { margin-top: 0; flex-wrap: nowrap; flex: none; }
:is(table#overview, table#campaigns) .nm .own { flex: none; }
:is(table#overview, table#campaigns) .nm .acc-note, :is(table#overview, table#campaigns) .nm .plat-sub { display: inline; margin: 0; flex: none; font-size: 12px; }
:is(table#overview, table#campaigns) .plat-name { font-size: 15px; flex: none; }
:is(table#overview, table#campaigns) .cl { display: flex; align-items: center; justify-content: flex-end; gap: 6px; white-space: nowrap; min-width: 0; }
:is(table#overview, table#campaigns) .cl .act { font-weight: 600; }
:is(table#overview, table#campaigns) .cl .x { font-size: 12px; color: var(--muted); }
:is(table#overview, table#campaigns) .cl .x.overb { color: var(--crit); font-weight: 600; }
:is(table#overview, table#campaigns) .cl .x.pct { color: var(--text); font-weight: 600; min-width: 34px; text-align: right; }
:is(table#overview, table#campaigns) .cl .delta.d-cheaper { color: var(--good); }
:is(table#overview, table#campaigns) .cl .delta.d-pricier { color: var(--bad); }
:is(table#overview, table#campaigns) .cl .meter { display: inline-block; flex: none; width: 44px; height: 4px; margin: 0 0 0 2px; }
:is(table#overview, table#campaigns) .cl .meter-exp { top: -3px; height: 10px; }
:is(table#overview, table#campaigns) .cl .pb-sm { padding: 2px 7px; }
:is(table#overview, table#campaigns) .cl .pe-input { height: 24px; width: 96px; font-size: 12.5px; }
:is(table#overview, table#campaigns) .cl .pe-msg { position: absolute; margin-top: 30px; background: var(--surface); padding: 2px 6px; border-radius: 6px;
  box-shadow: 0 4px 12px rgba(16,32,52,.15); z-index: 3; }
:is(table#overview, table#campaigns) td.mc { position: relative; }
@media (max-width: 1320px) and (min-width: 861px) {
  :is(table#overview, table#campaigns) .cl .meter { display: none; }                 /* keep one line: % and status stay */
  :is(table#overview, table#campaigns) thead th.name { width: 28%; }
  :is(table#overview, table#campaigns) thead th:nth-child(3) { width: 31%; }
}
@media (max-width: 1100px) and (min-width: 861px) {
  :is(table#overview, table#campaigns) .cl .x.left { display: none; }                /* remaining is in the tooltip of the value */
}

/* mobile: a compact card per record - name line + one line per metric (label left, values right) */
@media (max-width: 860px) {
  :is(table#overview, table#campaigns) { table-layout: auto; }
  :is(table#overview, table#campaigns) tr.plat, :is(table#overview, table#campaigns) tr.acct, :is(table#overview, table#campaigns) tr.r { grid-template-columns: 1fr; row-gap: 3px; padding: 9px 12px; }
  :is(table#overview, table#campaigns) tr.plat { padding: 12px 2px 4px; }
  :is(table#overview, table#campaigns) tr > th.name { padding: 0 0 3px !important; }
  :is(table#overview, table#campaigns) tr > td.mc { display: flex; align-items: center; gap: 10px; overflow: hidden; }
  :is(table#overview, table#campaigns) td.mc::before { flex: none; width: 92px; margin: 0; font-size: 10px; }
  :is(table#overview, table#campaigns) td.mc .cl { justify-content: flex-start; flex: 1; overflow: hidden; }
  :is(table#overview, table#campaigns) .cl .meter { width: 36px; }
  :is(table#overview, table#campaigns) .nm { flex-wrap: nowrap; }
}
/* "57 % / dziś 84 %" - realisation vs where the target should be today (the same pace as the badge) */
.x.exp, .ms .exp { font-size: 12px; color: var(--muted); white-space: nowrap; }
:is(table#overview, table#campaigns) thead th.name { width: 27%; }
:is(table#overview, table#campaigns) thead th:nth-child(2) { width: 21%; }
:is(table#overview, table#campaigns) thead th:nth-child(3) { width: 36%; }
:is(table#overview, table#campaigns) thead th:nth-child(4) { width: 16%; }
@media (max-width: 1320px) and (min-width: 861px) {
  :is(table#overview, table#campaigns) thead th.name { width: 25%; }
  :is(table#overview, table#campaigns) thead th:nth-child(3) { width: 38%; }
  :is(table#overview, table#campaigns) .cl .pb-sm .pp { display: none; }            /* the pp is in the badge's tooltip */
}

/* compact tree - final widths: every metric fits its column on one line (nothing clipped) */
:is(table#overview, table#campaigns) tbody th, :is(table#overview, table#campaigns) tbody td, :is(table#overview, table#campaigns) thead th { padding-left: 10px; padding-right: 10px; }
:is(table#overview, table#campaigns) thead th.name { width: 24%; }
:is(table#overview, table#campaigns) thead th:nth-child(2) { width: 23%; }
:is(table#overview, table#campaigns) thead th:nth-child(3) { width: 35%; }
:is(table#overview, table#campaigns) thead th:nth-child(4) { width: 18%; }
:is(table#overview, table#campaigns) tr.r th.name { padding-left: 30px; }
:is(table#overview, table#campaigns) tr.acct th.name { padding-left: 18px; }
:is(table#overview, table#campaigns) tbody.pgroup tr.plat th.name { padding-left: 10px; }
:is(table#overview, table#campaigns) .cl { gap: 5px; }
:is(table#overview, table#campaigns) .cl .x.pct { min-width: 0; }
@media (max-width: 1320px) and (min-width: 861px) {
  :is(table#overview, table#campaigns) thead th.name { width: 22%; }
  :is(table#overview, table#campaigns) thead th:nth-child(2) { width: 24%; }
  :is(table#overview, table#campaigns) thead th:nth-child(3) { width: 35%; }
  :is(table#overview, table#campaigns) thead th:nth-child(4) { width: 19%; }
  :is(table#overview, table#campaigns) .cl .pb-sm .pp { display: inline; }
}
@media (max-width: 1180px) and (min-width: 861px) {
  :is(table#overview, table#campaigns) .cl .x.exp { display: none; }                 /* "dziś" stays as the meter tick + tooltip */
  :is(table#overview, table#campaigns) .cl .x.left { display: none; }
}
:is(table#overview, table#campaigns) tr.plat .act { font-size: inherit; }
@media (max-width: 1180px) and (min-width: 861px) {
  :is(table#overview, table#campaigns) thead th.name { width: 21%; }
  :is(table#overview, table#campaigns) thead th:nth-child(2) { width: 22%; }
  :is(table#overview, table#campaigns) thead th:nth-child(3) { width: 35%; }
  :is(table#overview, table#campaigns) thead th:nth-child(4) { width: 22%; }
  :is(table#overview, table#campaigns) .mrate .unit { display: none; }
}
/* tablet (861-1024 px): the side menu folds into the top bar (as on phones), so the one-line tree
   keeps its full width instead of hiding data */
@media (max-width: 1024px) and (min-width: 861px) {
  body.has-side .maincol { margin-left: 0; }
  .mtop { display: flex; align-items: center; justify-content: space-between; height: 54px; padding: 0 22px;
    background: var(--side-bg); position: sticky; top: 0; z-index: 35; }
  .mtop .brand { color: #fff; font-weight: 650; display: flex; align-items: center; gap: 8px; }
  .navbtn { color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
  .side { display: none; top: 54px; width: min(300px, 86vw); box-shadow: 8px 0 30px rgba(0,0,0,.25); }
  .side > .brand { display: none; }
  .navtoggle:checked ~ .side { display: flex; }
  :is(table#overview, table#campaigns) thead th.name { width: 22%; }
  :is(table#overview, table#campaigns) thead th:nth-child(2) { width: 23%; }
  :is(table#overview, table#campaigns) thead th:nth-child(3) { width: 35%; }
  :is(table#overview, table#campaigns) thead th:nth-child(4) { width: 20%; }
}

@media (max-width: 860px) {
  :is(table#overview, table#campaigns) td.mc .cl { flex-wrap: wrap; row-gap: 2px; }   /* phone: wrap inside the card line, never clip */
}
/* the campaign name has priority over its tags in the one-line name cell */
:is(table#overview, table#campaigns) .nm .cname { flex: 0 1 auto; min-width: 55%; }
:is(table#overview, table#campaigns) .nm .tags { flex: 0 1 auto; min-width: 0; overflow: hidden; }
:is(table#overview, table#campaigns) .nm .tags .tag { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
@media (max-width: 860px) {
  :is(table#overview, table#campaigns) td.mc::before { width: 84px; white-space: nowrap; font-size: 9.5px; letter-spacing: .04em; }
}

/* ---------------------------------------------------------------- campaign tree: breathing room (desktop / tablet)
   Still ONE line per record, but ~50 px campaign rows (was 35): more padding and line-height,
   clearer platform / account separation, more legible status badge and progress bar. Fonts unchanged. */
@media (min-width: 861px) {
  :is(table#overview, table#campaigns) tbody th, :is(table#overview, table#campaigns) tbody td { line-height: 1.5; }
  :is(table#overview, table#campaigns) tr.r th, :is(table#overview, table#campaigns) tr.r td { padding-top: 13px; padding-bottom: 13px; }
  :is(table#overview, table#campaigns) tr.r + tr.r th, :is(table#overview, table#campaigns) tr.r + tr.r td { border-top-color: var(--line-soft); }
  :is(table#overview, table#campaigns) tr.acct th, :is(table#overview, table#campaigns) tr.acct td { padding-top: 16px; padding-bottom: 16px; }
  :is(table#overview, table#campaigns) tr.acct th.name { box-shadow: inset 4px 0 0 var(--accent); }
  :is(table#overview, table#campaigns) tr.acct .acc-name { font-size: 14.5px; }
  :is(table#overview, table#campaigns) tbody.pgroup tr.plat th, :is(table#overview, table#campaigns) tbody.pgroup tr.plat td { padding-top: 24px; padding-bottom: 14px; }
  :is(table#overview, table#campaigns) tbody.pgroup + tbody.pgroup tr.plat th, :is(table#overview, table#campaigns) tbody.pgroup + tbody.pgroup tr.plat td {
    border-top: 6px solid var(--bg); }
  :is(table#overview, table#campaigns) .plat-name { font-size: 16px; }
  :is(table#overview, table#campaigns) tr.sub th { padding: 14px 18px 6px 30px; }
  :is(table#overview, table#campaigns) .cl { gap: 7px; }
  :is(table#overview, table#campaigns) .cl .pb-sm { font-size: 11.5px; padding: 4px 9px; gap: 5px; }
  :is(table#overview, table#campaigns) .cl .pb-sm i { width: 6px; height: 6px; }
  :is(table#overview, table#campaigns) .cl .meter { width: 46px; height: 6px; border-radius: 99px; }
  :is(table#overview, table#campaigns) .cl .meter-exp { top: -3px; height: 12px; width: 2px; opacity: .7; }
  :is(table#overview, table#campaigns) .cl .x { font-size: 12.5px; }
}
@media (max-width: 1320px) and (min-width: 861px) {
  :is(table#overview, table#campaigns) .cl { gap: 5px; }
}

/* ---------------------------------------------------------------- KPI engine (app/kpi.py)
   KPI tag / manual KPI select in the name cell, the KPI unit next to the result, "posty" type tag. */
.tags .tag-kpi { color: var(--text) !important; background: var(--surface-2) !important; font-weight: 600; letter-spacing: .02em; }
.tags .tag-low { opacity: .75; border: 1px dashed currentColor !important; }
select.kpisel { appearance: none; -webkit-appearance: none; font: inherit; font-size: 10.5px; font-weight: 600; line-height: 1.5;
  padding: 0 16px 0 7px; border: 0; border-radius: 99px; background: var(--surface-2); color: var(--text); cursor: pointer;
  max-width: 132px; height: auto; margin: 0; min-height: 0;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 9px) 55%, calc(100% - 6px) 55%; background-size: 3px 3px, 3px 3px; background-repeat: no-repeat; }
select.kpisel:hover, select.kpisel:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
select.kpisel.kpisel-none { color: var(--warn); background-color: var(--warn-bg); }
select.kpisel.kpisel-low { box-shadow: inset 0 0 0 1px var(--line); }
select.kpisel.invalid { box-shadow: inset 0 0 0 1px var(--bad); }
.mres .unit, .mrate .unit { font-size: 11px; color: var(--muted); }
:is(table#overview, table#campaigns) .mres .act.muted { font-size: 12px; }
/* one-line tree: the unit of a result / cost metric is the row's KPI tag (CPC / CPV / CPM) - the cell
   keeps value / plan, meter, "X % / dziś Y %" and the status; the unit returns in the phone cards */
@media (min-width: 861px) {
  :is(table#overview, table#campaigns) .mres .unit, :is(table#overview, table#campaigns) .mrate .act + .unit { display: none; }
}
select.kpisel { max-width: 64px; }
:is(table#overview, table#campaigns) .nm .tags select.kpisel { flex: 0 0 auto; }
/* never shrink a piece of a metric line below its text (overlapping "98 %/ dziś") */
:is(table#overview, table#campaigns) .cl > * { flex-shrink: 0; }
@media (min-width: 861px) {
  :is(table#overview, table#campaigns) .cl { gap: 6px; }
  :is(table#overview, table#campaigns) .cl .meter { width: 38px; }
}
@media (max-width: 1320px) and (min-width: 861px) {
  :is(table#overview, table#campaigns) .cl { gap: 5px; }
}
@media (max-width: 1320px) and (min-width: 861px) {
  :is(table#overview, table#campaigns) .cl .meter { width: 30px; }
}
/* project cards (Caparol): the stat grid never pushes the card past its column (2 px scroll at 1024) */
.pcard { min-width: 0; }
.pcard dl { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
.pcard dl dd { overflow-wrap: anywhere; }
@media (max-width: 1320px) and (min-width: 861px) {
  :is(table#overview, table#campaigns) .cl { gap: 4px; }
  :is(table#overview, table#campaigns) .cl .pb-sm { padding: 4px 7px; }
}
:is(table#overview, table#campaigns) .nm .tags .tag[data-ctype] { flex: 0 0 auto; overflow: visible; }
select.kpisel.kpisel-warn, .tags .tag-warn { box-shadow: inset 0 0 0 1px var(--warn); color: var(--warn); }

/* ---------------------------------------------------------------- KAMPANIE: all campaigns, flat (1 campaign = 1 row)
   The cells are the tree's (shared :is(#overview, #campaigns) rules above); here only the flat
   table's columns, the filter bar and the phone cards. Rows ~49 px like the tree - readability first. */
.ccount { color: var(--muted); font-weight: 500; }
.cchips { justify-content: flex-start; margin: 4px 0 10px; }
.cfilters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.cfilters label { display: flex; align-items: center; gap: 6px; }
.cfilters select, .cfilters input[type="number"] { height: 30px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface);
  color: var(--text); font: inherit; font-size: 12.5px; padding: 0 6px; }
.cfilters input[type="number"] { width: 58px; }
.cfilters input.invalid { border-color: var(--bad); }
.cfilters .gapf { padding: 3px 4px 3px 10px; border-radius: 99px; background: var(--bad-bg, rgba(200, 40, 40, .06)); color: var(--text); }
.cfilters .gapf.is-on { box-shadow: inset 0 0 0 1px var(--bad); }
.cfilters .gapf > span:first-child { font-weight: 600; }
.cfilters .gapc { display: inline-flex; align-items: center; gap: 4px; }
.cfilters .gapc[hidden] { display: none !important; }
.cfilters .creset { font-size: 12px; }
.cmeta { margin: 0 0 8px; }
.cmeta b { color: var(--text); }
/* content-sized columns: numbers take exactly their width, the campaign name absorbs the rest (ellipsis) */
table#campaigns { table-layout: auto; }
table#campaigns thead th, table#campaigns tbody td { width: 1%; white-space: nowrap; }
table#campaigns thead th.name, table#campaigns tbody th.name { width: 100%; max-width: 0; }
table#campaigns tbody td.ccl { max-width: 140px; }
table#campaigns .kpi-in { display: inline-flex; }             /* the KPI (CPC / CPV / CPM ...) names the cost metric */
table#campaigns thead th.ccl, table#campaigns thead th.cpl, table#campaigns thead th.name, table#campaigns tbody td.ccl, table#campaigns tbody td.cpl { text-align: left; }
table#campaigns .cl .meter { display: none; }
table#campaigns .pl-dot.ccl-dot { display: none; }
table#campaigns .cl .x.overb .ob-l { display: none; }          /* "+133 zł" in red; the full text in the tooltip */
table#campaigns .cl .x.overb::before { content: "+"; }                  /* flat list: "X % / dziś Y %" + status carry the pace */
table#campaigns tbody td.ccl, table#campaigns tbody td.cpl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
table#campaigns tbody td.ccl a { color: var(--text); font-weight: 600; }
table#campaigns tbody td.cpl { color: var(--muted); }
table#campaigns .pl-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--muted); vertical-align: 1px; }
table#campaigns .pl-dot.pl-google_ads { background: #4285f4; }
table#campaigns .pl-dot.pl-meta { background: #5b6ee1; }
table#campaigns tr.r th.name { padding-left: 10px; }
table#campaigns tbody td.empty { padding: 28px 18px; text-align: left; color: var(--muted); }
@media (min-width: 861px) {
  table#campaigns .mres .unit { display: inline; }             /* rows mix KPIs: the unit stays next to the result */
  table#campaigns .cl .x.left { display: none; }               /* remaining: on the client card / tree */
  table#campaigns tr.r td.ccl, table#campaigns tr.r td.cpl { padding-top: 13px; padding-bottom: 13px; }
}
@media (max-width: 1400px) and (min-width: 861px) {
  /* narrower screens: the platform folds into a coloured dot before the client (label in its tooltip) */
  table#campaigns thead th:nth-child(3), table#campaigns tbody td.cpl { display: none; }
  table#campaigns .pl-dot.ccl-dot { display: inline-block; }
  table#campaigns .mres .unit { display: none; }
}
@media (max-width: 1180px) and (min-width: 861px) {        /* "dziś" is in the tooltip here (tree rule) */
}
/* a dense operational list: up to 1440 px the side menu folds into the top bar ("Menu"), as on tablets,
   so the campaign names get the width (the menu is one click away) */
@media (max-width: 1440px) and (min-width: 861px) {
  body.fold-side.has-side .maincol { margin-left: 0; }
  body.fold-side .mtop { display: flex; align-items: center; justify-content: space-between; height: 54px; padding: 0 22px;
    background: var(--side-bg); position: sticky; top: 0; z-index: 35; }
  body.fold-side .mtop .brand { color: #fff; font-weight: 650; display: flex; align-items: center; gap: 8px; }
  body.fold-side .navbtn { color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
  body.fold-side .side { display: none; top: 54px; width: min(300px, 86vw); box-shadow: 8px 0 30px rgba(0,0,0,.25); }
  body.fold-side .side > .brand { display: none; }
  body.fold-side .navtoggle:checked ~ .side { display: flex; }
}
/* phone: one compact card per campaign - Klient · Platforma / name / target + status / cost / CPC */
@media (max-width: 860px) {
  .cfilters { gap: 8px; }
  .cfilters label { flex: 1 1 140px; justify-content: space-between; }
  .cfilters .gapf { flex-basis: 100%; }
  .cfilters select { min-height: 38px; flex: 1; min-width: 0; }
  .cchips .schip { min-height: 36px; }
  table#campaigns tr.r { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; margin-left: 0; }
  table#campaigns tr.r > td.ccl { order: 1; grid-column: 1; padding: 0 !important; border: 0 !important; background: none !important; font-size: 12px; }
  table#campaigns tr.r > td.cpl { order: 2; grid-column: 2; padding: 0 !important; border: 0 !important; background: none !important; font-size: 12px; }
  table#campaigns tr.r > td.cpl::before { content: "·"; margin-right: 6px; color: var(--muted); }
  table#campaigns tr.r > td.ccl::before, table#campaigns tr.r > td.cpl::after { content: none; }
  table#campaigns tr.r > th.name { order: 3; grid-column: 1 / -1; padding: 2px 0 4px !important; }
  table#campaigns tr.r > td.mres { order: 4; grid-column: 1 / -1; }
  table#campaigns tr.r > td.mc:not(.mres):not(.mrate) { order: 5; grid-column: 1 / -1; }
  table#campaigns tr.r > td.mrate { order: 6; grid-column: 1 / -1; }
  table#campaigns thead tr:first-child th:nth-child(n) { width: auto; }
}
@media (max-width: 960px) and (min-width: 861px) {
  table#campaigns .mrate .delta { display: none; }            /* narrow tablet: the Δ is on the client card */
  table#campaigns tbody td.mc { padding-left: 6px; padding-right: 6px; }
}
/* AD HOC: own mini-plan, outside the client's main budget */
.tag-adhoc { font-weight: 700; letter-spacing: .03em; }
.sub-adhoc th { border-top: 1px dashed var(--line, #ccd); }
.adhoc-plan { display: inline-block; margin-left: 6px; }
.adhoc-plan > summary { list-style: none; cursor: pointer; display: inline; }
.adhoc-plan > summary::-webkit-details-marker { display: none; }
.adhoc-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; padding: 8px 0; white-space: normal; }
.adhoc-form label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--muted); }
.adhoc-form input { width: 9em; }
.adhoc-note { margin-top: 6px; }
