/* Fonts are bundled with the app (IBM Plex, SIL Open Font License: fonts/OFL.txt). */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("/static/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("/static/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("/static/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("/static/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("/static/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  /* Search fields, filters, dropdowns and buttons at the top of a page:
     one height and corner, as on the dashboard. */
  --control-height: 44px;
  --control-radius: 8px;
  /* Each colour is light-dark(light, dark): the browser picks by color-scheme,
     which follows the system unless someone chose a theme on their profile. */
  color-scheme: light dark;

  --bg: light-dark(#F4F5F7, #111317);
  --surface: light-dark(#FFFFFF, #1A1D23);
  --surface-2: light-dark(#FAFBFC, #1E2128);
  --surface-3: light-dark(#F7F8FA, #22262E);
  --text: light-dark(#16181D, #E8EAED);
  --text-2: light-dark(#3B414C, #C8CCD3);
  --muted: light-dark(#5B6270, #9AA1AC);
  --border: light-dark(#E2E5EA, #2C3038);
  --border-soft: light-dark(#ECEEF2, #262A31);
  --accent: light-dark(#1F4FD8, #7DA2FF);
  --accent-hover: light-dark(#163BA6, #A5BFFF);
  --accent-soft: light-dark(#EAF0FD, #1C2540);
  --accent-border: light-dark(#C9D7FA, #2F3E6B);
  --topbar: light-dark(#16181D, #0B0C0F);
  --topbar-text: #C5CAD3;
  --topbar-active: light-dark(#2B2F38, #22252C);

  /* Status: colour is never the only signal; labels always accompany it. */
  --bad: #A3300F;
  --bad-bg: light-dark(#FCE9E2, #3A1B12);
  --bad-text: light-dark(#8A2A0C, #FFB59E);
  --bad-border: light-dark(#EBB8A6, #6B2F1D);
  --warn: #E0A100;
  --warn-bg: light-dark(#FBF0D4, #3A2C08);
  --warn-text: light-dark(#6E4A00, #F5D277);
  --warn-border: light-dark(#E8D29A, #6A5313);
  --ok: #6BA48A;
  --ok-bg: light-dark(#E3F1EA, #16301F);
  --ok-text: light-dark(#245740, #9FD9B8);
  --idle: light-dark(#D4D8DF, #3A3F48);
  /* Blop's pie colour, for highlights like toasts. */
  --brand: light-dark(#3442C9, #8C97FF);
  --on-brand: light-dark(#FFFFFF, #15171C);
  /* A platform logo with nothing linked: there, but barely. */
  --icon-off: light-dark(#D4D8DF, #33373F);

  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }

/* Elements the scripts hide, whatever their display style. */
[hidden] { display: none !important; }
/* With enhance.js running, forms that submit on change need no button. */
.js form[data-autosubmit] [type="submit"] { display: none; }

body {
  margin: 0;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ---------- Top bar ---------- */

.topbar { background: var(--topbar); }
/* Same box as main (padding inside the max width) so the logo lines up with the page. */
.topbar-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 28px;
  min-height: 60px;
}
/* The wordmark SVG has padding round the letters; pull it back so the b lines up with the page. */
.brand { display: flex; align-items: center; margin-left: -2px; }
.brand img { display: block; height: 30px; width: auto; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 4px; font-size: 14px; }
.topbar nav a { color: var(--topbar-text); padding: 8px 12px; border-radius: 6px; }
.topbar nav a:hover { color: #FFFFFF; text-decoration: none; }
.topbar nav a.active { color: #FFFFFF; background: var(--topbar-active); }
.account {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--topbar-text);
}
.account:hover { color: #FFFFFF; background: var(--topbar-active); text-decoration: none; }
/* The blop's on/off switch (blop.js), just before the name. */
.sound-toggle { margin-left: auto; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--topbar-text); cursor: pointer; }
.sound-toggle:not([hidden]) + .account { margin-left: -20px; }
.sound-toggle:hover { color: #FFFFFF; background: var(--topbar-active); }
.sound-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sound-toggle .sound-on, .sound-toggle[aria-pressed="true"] .sound-off { display: none; }
.sound-toggle[aria-pressed="true"] .sound-on { display: block; }
.sound-toggle[aria-pressed="true"] { color: #FFFFFF; }
/* On, but the browser waits for a click before it plays anything. */
.sound-toggle.blocked { color: var(--warn); }
.account.active { color: #FFFFFF; background: var(--topbar-active); }

/* Initials in the logo's pie colour. */
.avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #8C97FF;
  color: #15171C;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.avatar-large { width: 56px; height: 56px; font-size: 20px; }
.nav-badge {
  background: var(--bad);
  color: #FFFFFF;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 12px;
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}

main {
  max-width: 1360px;
  margin: 0 auto;
  padding: 32px 32px 64px;
}
/* A list that fills the window (fit-rows.js) leaves this much below the page. */
.fit-rows main { padding-bottom: 20px; }

h1 { margin: 0 0 1rem; font-size: 30px; font-weight: 600; letter-spacing: -0.01em; }
h2 { margin: 0; font-size: 1.1rem; }

.muted { color: var(--muted); margin: 0; }
.muted-inline { color: var(--muted); font-size: 0.9rem; }
.empty { color: var(--muted); }
.warn { color: var(--warn-text); }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); }

.page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.page-header h1 { margin-bottom: 0.3rem; }

.breadcrumb { color: var(--muted); font-size: 0.9rem; margin: 0 0 0.25rem; }

/* ---------- Controls ---------- */

button, a.button {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--text);
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
  text-decoration: none;
}
button:hover, a.button:hover { filter: brightness(1.15); text-decoration: none; color: var(--bg); }
button.secondary, a.button.secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  font-weight: 400;
}
button.secondary:hover, a.button.secondary:hover { color: var(--text); filter: none; border-color: var(--muted); }
button.small { min-height: 32px; padding: 0 12px; font-size: 13px; }

input[type="text"], input[type="search"], textarea, select {
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
}

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.tabs, .segmented {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}
.tabs a, .segmented a {
  padding: 7px 14px;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 14px;
}
.tabs a:hover, .segmented a:hover { text-decoration: none; background: var(--surface-3); }
.tabs a.active, .segmented a.active { background: var(--text); color: var(--bg); }
.tabs .count { opacity: 0.75; font-variant-numeric: tabular-nums; margin-left: 0.25rem; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  padding: 0 12px;
  min-height: var(--control-height);
}
.search input { border: 0; padding: 0; background: transparent; outline: none; width: 200px; }

/* ---------- Login ---------- */

body.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 36px 32px;
  width: 100%;
  max-width: 380px;
  margin: 0;
  text-align: center;
}
.login-card h1 { margin-bottom: 0.75rem; }
.login-card h1 img { display: block; margin: 0 auto; height: auto; }
.login-card .muted { margin-bottom: 1.5rem; }
.login-card .notice { text-align: left; }
.login-card .button { width: 100%; justify-content: center; }
.login-options { display: flex; flex-direction: column; gap: 10px; }
.login-button { display: inline-flex; align-items: center; gap: 10px; }
/* The provider's mark in the button's own text colour. */
.login-mark { flex: none; width: 16px; height: 16px; background: currentColor; -webkit-mask: var(--mark) center / contain no-repeat; mask: var(--mark) center / contain no-repeat; }
.login-mark-microsoft { --mark: url("/static/platforms/microsoft_ads.svg"); }
.login-note { color: var(--muted); font-size: 13px; margin: 0.75rem 0 0; }

/* ---------- Profile ---------- */

.profile { display: flex; flex-direction: column; gap: 1rem; max-width: 640px; }
.profile .card h2 + .muted { margin-top: 0.25rem; }
.profile-who { display: flex; align-items: center; gap: 16px; }
.profile-who .muted { margin: 0.15rem 0 0; }

.theme-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 1rem; }
/* The cards are buttons; undo the default button look. */
button.theme-option {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  min-height: 0;
  padding: 10px;
  text-align: left;
  font-weight: 400;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
}
button.theme-option:hover { color: var(--text); filter: none; border-color: var(--muted); }
button.theme-option[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
button.theme-option:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-label { font-weight: 500; font-size: 14px; margin-top: 8px; }
.theme-hint { color: var(--muted); font-size: 12px; }

/* Small drawings of the app in each theme, in fixed colours. */
.theme-preview {
  --p-bg: #F4F5F7; --p-bar: #16181D; --p-line: #D4D8DF;
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 64px;
  border-radius: 6px;
  background: var(--p-bg);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}
.theme-preview-dark { --p-bg: #111317; --p-bar: #0B0C0F; --p-line: #3A3F48; }
.theme-preview-system { background: linear-gradient(135deg, #F4F5F7 50%, #111317 50%); }
.theme-preview-bar { height: 12px; background: var(--p-bar); }
.theme-preview-line { height: 6px; margin: 0 10px; border-radius: 3px; background: var(--p-line); }
.theme-preview-system .theme-preview-line { background: #8C97FF; opacity: 0.6; }
.theme-preview-line.short { width: 40%; }

.session-list { list-style: none; margin: 0; padding: 0; }
.session {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border-soft);
}
.session:last-child { padding-bottom: 0; }
.session-device { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; font-weight: 500; font-size: 14px; }

@media (max-width: 520px) {
  .theme-picker { grid-template-columns: 1fr; }
}

/* ---------- Customers ---------- */

.customer-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 1.25rem; }
.customer-tools-side > .muted { font-size: 14px; margin: 0; }
/* Three tiles of the same width on one line with the search field, as tall
   as it; they share what the search leaves and stack on a phone. */
.customer-list-tools { flex-wrap: nowrap; }
.customer-list-tools .customer-search { flex: 1 1 320px; min-width: 0; }
.customer-list-tools .customer-tools-side { flex: 0 1 630px; min-width: 0; }
.view-tiles.customer-filter { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 0; }
.customer-filter .view-tile { min-height: var(--control-height); padding: 0 16px; white-space: nowrap; }
@media (max-width: 760px) {
  .customer-list-tools { flex-wrap: wrap; }
  .customer-list-tools .customer-tools-side { flex-basis: 100%; }
  .customer-filter { grid-template-columns: 1fr; }
}
.segmented .count { opacity: 0.75; font-variant-numeric: tabular-nums; }
.customer-search {
  flex: 1 1 420px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  min-height: var(--control-height);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  color: var(--muted);
}
.customer-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.customer-search input[type="search"] { flex: 1; min-width: 0; border: 0; padding: 0; background: transparent; outline: none; font-size: 14px; }
/* Campaigns: the search, then a customer and a platform dropdown as tall as it. */
.campaign-filters select { min-height: var(--control-height); border-radius: var(--control-radius); padding: 0 40px 0 12px; max-width: 320px; }
/* Chrome pins its own arrow to the edge, so draw one with room on the right. */
.campaign-filters select, .dashboard-tools select, .snooze-control select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A919C' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}
.campaign-filters .filter-submit { min-height: var(--control-height); border-radius: var(--control-radius); }
.select-search { position: relative; }
.select-search-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 280px;
  min-height: var(--control-height);
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--muted);
  font-weight: 400;
  text-align: left;
}
.select-search-button:hover { color: var(--text); filter: none; border-color: var(--muted); }
.select-search.chosen .select-search-button { color: var(--text); }
.select-search-current { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-search-button::after {
  content: "";
  flex: none;
  width: 12px;
  height: 12px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
}
.select-search-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px light-dark(rgb(22 24 29 / 0.14), rgb(0 0 0 / 0.5));
  overflow: hidden;
}
.select-search-panel[hidden] { display: none; }
.select-search-panel.no-search input[type="search"] { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; }
.select-search-panel input[type="search"] {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  border-radius: 0;
  padding: 12px 14px;
  background: transparent;
  outline: none;
}
.select-search-list { max-height: 300px; overflow-y: auto; margin: 0; padding: 4px 0; list-style: none; }
.select-search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  font-size: 14px;
  cursor: pointer;
}
.select-search-item[hidden] { display: none; }
.select-search-item.active { background: var(--surface-3); }
.select-search-item[aria-selected="true"] { color: var(--accent); font-weight: 500; }
.select-search-item > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-search-count { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
/* With htmx, the filters apply on each choice and need no button. */
.js .campaign-filters .filter-submit { display: none; }
/* Inside the linking rows: the same dropdown, row height. */
.link-row .select-search { min-width: 0; }
.link-row .select-search-button { width: 100%; min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 6px; color: var(--text); }
.link-row .select-search-item { padding: 7px 12px; font-size: 13px; }
/* A customer field with its matches listed under it (customer-picker.js). */
.customer-picker { min-width: 0; }
.customer-picker input { width: 100%; box-sizing: border-box; }
.customer-picker .select-search-panel { min-width: 320px; }
.customer-picker .picker-empty { margin: 0; padding: 8px 14px; }
.campaign-count { display: block; margin: 0 0 10px; }

/* One column per platform; a platform's logo is lit when an account is linked. */
/* Rows have a fixed least height so the panel can show 15 of them and scroll
   the rest under a header that stays put. A name that wraps makes its row taller.
   With JavaScript, fit-rows.js fills the window with whole rows instead. */
.coverage {
  --coverage-head: 42px;
  --coverage-row: 49px;
  max-height: calc(var(--coverage-head) + 15 * var(--coverage-row) + 2px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: auto;
  overscroll-behavior: contain;
  /* Holds the rows' visually hidden text, which would otherwise stretch the page. */
  position: relative;
}
.coverage-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(5, 92px) 128px;
  align-items: center;
  min-width: 808px;
  min-height: var(--coverage-row);
  padding: 12px 20px;
  border-top: 1px solid var(--border-soft);
  /* For the name's link, which covers the row. */
  position: relative;
}
.coverage-head {
  position: sticky;
  top: 0;
  /* Above the rows' plus buttons when they scroll under it. */
  z-index: 2;
  min-height: var(--coverage-head);
  background: var(--surface);
  border-top: 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}
.coverage-platform { justify-self: center; }
.coverage-name { font-size: 14px; font-weight: 500; min-width: 0; color: var(--text); }
.coverage-name:hover { text-decoration: none; color: var(--text); }
/* The whole row opens the customer. */
.coverage-name::after { content: ""; position: absolute; inset: 0; }
.coverage-row:not(.coverage-head):hover { background: var(--surface-2); }
.coverage-row.inactive .coverage-name { color: var(--muted); }
.coverage-cell { justify-self: center; position: relative; display: inline-block; line-height: 0; }
/* Small and a step softer than the text, so a page of logos doesn't outweigh the names. */
.coverage-cell .platform-icon { width: 18px; height: 18px; background: var(--icon-off); }
.coverage-cell.linked .platform-icon { background: var(--text-2); }
.coverage-count {
  position: absolute;
  left: 11px;
  top: -9px;
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  border: 2px solid var(--surface);
  background: var(--text);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  line-height: 1;
}
.coverage-waiting {
  position: absolute;
  right: -5px;
  top: -5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  /* The accent, as suggestions on the customer page. */
  background: var(--accent);
}
/* The team as overlapping initials, and a plus to join it. */
/* Above the row's link, for the names on hover and the plus. One avatar
   high whatever it holds, so joining or leaving doesn't move the rows. */
.coverage-people { display: inline-flex; align-items: center; height: 24px; padding-left: 16px; position: relative; z-index: 1; justify-self: start; }
.avatar-small { width: 24px; height: 24px; font-size: 10px; box-shadow: 0 0 0 2px var(--surface); }
.coverage-people .avatar-small + .avatar-small, .coverage-leave + .avatar-small { margin-left: -6px; }
/* Initials as a button that takes someone off a team (the customer list,
   the customer page): on hover they turn into a red cross. */
.coverage-leave { display: inline-flex; margin: 0; }
.avatar-remove { min-height: 0; padding: 0; border: 0; cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; }
.avatar-small.avatar-remove { font-size: 10px; }
/* Not right after joining, while the pointer is still on them
   (customer-team.js): only once it has left and come back. */
.avatar-remove:not(.just-joined):hover { filter: none; background: var(--bad-bg); color: var(--bad-text); }
.avatar-remove.just-joined:hover { filter: none; }
/* A drawn cross: the "×" character sits off-centre in most fonts. */
.avatar-remove-cross { display: none; }
.avatar-remove:not(.just-joined):hover .avatar-remove-initials { display: none; }
.avatar-remove:not(.just-joined):hover .avatar-remove-cross { display: block; }
.coverage-row:hover .avatar-small { box-shadow: 0 0 0 2px var(--surface-2); }
/* "Add me to the team": a dashed circle the size of an avatar, beside them. */
/* Flex, not block: a block's line box would make the row a few pixels
   taller with the plus than without it. */
.coverage-join { display: inline-flex; margin: 0 0 0 6px; }
.coverage-people > .coverage-join:first-child { margin-left: 0; }
.coverage-join-button {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  min-height: 0;
  padding: 0;
  border: 1px dashed var(--muted);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
}
.coverage-join-button:hover { color: var(--accent); border-color: var(--accent); border-style: solid; background: var(--accent-soft); filter: none; }
.coverage-more { margin-left: 6px; font-size: 12px; color: var(--muted); }
.coverage-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.coverage-legend > span { display: inline-flex; align-items: center; gap: 8px; }
.coverage-legend .platform-icon { width: 18px; height: 18px; }
.legend-count { position: static; border: 0; }
.legend-cell .coverage-waiting { border-color: var(--bg); width: 9px; height: 9px; }

/* ---------- Integrations ---------- */

/* The switch for all automatic syncs, in the page header. */
.sync-switch { margin: 0; }
.switch { display: inline-flex; align-items: center; gap: 10px; padding: 6px 12px 6px 8px; font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; cursor: pointer; }
/* Like a secondary button: the global button hover would brighten it and turn its text the page colour. */
button.switch:hover { color: var(--text); filter: none; border-color: var(--muted); background: var(--surface-2); }
.switch.switch-plain, button.switch.switch-plain:hover { padding: 0; background: none; border: 0; border-radius: 0; }
button.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-track { position: relative; width: 34px; height: 20px; border-radius: 999px; background: var(--idle); transition: background 0.15s; }
.switch-knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 2px rgb(0 0 0 / 0.25); transition: transform 0.15s; }
.switch[aria-checked="true"] .switch-track { background: var(--brand); }
.switch[aria-checked="true"] .switch-knob { transform: translateX(14px); }

/* One row per source, with its controls; a failed sync shows its error under it. */
.source-list { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.source-row {
  display: grid;
  grid-template-columns: 26px repeat(8, minmax(0, 1fr));
  align-items: center;
  gap: 16px;
  min-height: 60px;
  padding: 8px 20px;
  font-size: 14px;
}
.source-list-head {
  min-height: 40px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
}
.source-item { border-top: 1px solid var(--border-soft); }
.source-item-bad { background: color-mix(in srgb, var(--bad-bg) 35%, var(--surface)); }
.source-item-bad { box-shadow: inset 3px 0 0 var(--bad); }
.source-icon { flex: none; color: var(--text); }
.source-row .platform-icon { width: 24px; height: 24px; }
.source-name { min-width: 0; font-weight: 600; }
.source-row .status-pill { justify-self: start; }
.status-pill { font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.status-pill-ok { background: var(--ok-bg); color: var(--ok-text); }
.status-pill-warn { background: var(--warn-bg); color: var(--warn-text); }
.status-pill-bad { background: var(--bad-bg); color: var(--bad-text); }
.status-pill-idle { background: var(--surface-3); color: var(--muted); border: 1px solid var(--border); }
.source-every { display: flex; align-items: center; gap: 6px; }
.source-every select { width: 100%; height: 32px; padding: 0 8px; font-size: 13px; border-radius: 6px; }
/* With enhance.js running, the interval saves on change and needs no button. */
.js .source-every [type="submit"] { display: none; }
.source-through { font-size: 13px; }
.source-when { font-size: 13px; }
.source-connect { display: flex; flex-wrap: wrap; gap: 6px; }
.source-connect form { margin: 0; }
.source-error { color: var(--bad-text); }

.source-error-box { margin: 0 20px 14px 62px; padding: 10px 14px; font-size: 13px; color: var(--bad-text); background: var(--bad-bg); border: 1px solid var(--bad-border); border-radius: 8px; overflow-wrap: anywhere; }

/* Narrow screens: name, status and the controls. */
@media (max-width: 760px) {
  .source-row { grid-template-columns: 24px minmax(0, 1fr) auto auto auto auto; padding: 8px 14px; gap: 12px; }
  .source-through, .source-when, .source-list-head { display: none; }
  .source-error-box { margin: 0 14px 14px; }
}

/* ---------- Customer page ---------- */

/* Fills the gap between the top bar and the content (main's 32px top padding
   included), its text centred in it. */
.back-link { display: flex; align-items: center; width: fit-content; height: 64px; margin-top: -32px; font-size: 16px; }
.customer-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.customer-head h1 { margin: 0; font-size: 24px; }
/* Name and IDs head the left column, so the right column starts level with them. */
.card.customer-card { max-width: none; margin-bottom: 16px; }
.customer-legal { display: block; margin: 4px 0 0; }
.customer-ids { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 0; }
.chip { font-size: 13px; color: var(--text-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; }

/* In the left column, one line each: they choose what the right column shows,
   and the arrow says so. */
.view-tiles { display: grid; gap: 8px; margin-top: 16px; }
.view-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 14px 0 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  color: var(--text);
  font-size: 14px;
}
/* Like the small secondary buttons; the chosen one in the accent, as the
   report's quick periods. */
.view-tile:hover { color: var(--text); text-decoration: none; border-color: var(--muted); }
.view-tile.active { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }
.view-tile.active:hover { color: var(--accent); border-color: var(--accent); }
.view-tile-label { flex: 1; min-width: 0; }
.view-tile.active .view-tile-label { font-weight: 500; }
.view-tile-value { font-family: var(--mono); font-size: 15px; font-weight: 500; }
.view-tile-arrow { flex: none; color: var(--muted); }
.view-tile:hover .view-tile-arrow { color: var(--text); }
.view-tile.active .view-tile-arrow { color: var(--accent); }

/* PowerOffice details: one wide card, three columns that stack on a phone. */
/* PowerOffice details on the left, ad accounts and campaigns on the right;
   stacked on narrow screens. */
.customer-layout { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr); gap: 22px; align-items: start; }
.customer-main { min-width: 0; }
@media (max-width: 1000px) { .customer-layout { grid-template-columns: minmax(0, 1fr); } }
.card.po-card { max-width: none; margin-bottom: 0; }
/* The people responsible for a customer: a search to add, chips to remove. */
.card.users-card { max-width: none; margin-top: 16px; overflow: visible; }
.users-card h2 { font-size: 16px; margin-bottom: 14px; }
/* The team under the field: initials, removed by clicking them. */
.team-avatars { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
.team-avatars form { display: flex; margin: 0; }
.users-empty { display: block; margin-top: 12px; }
.po-card h2 { font-size: 16px; margin-bottom: 16px; }
/* One column per heading, each as wide as its content, the space between shared out. */
/* Contact | Customer with invoicing below it; one column on narrow screens. */
.po-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 20px 48px; }
.po-columns > div { min-width: 0; }
.po-columns .side-label { margin: 0 0 10px; }
.po-columns .facts + .side-label, .po-columns .muted-inline + .side-label { margin-top: 20px; }
.po-columns .facts { margin: 0; font-size: 14px; }
.po-columns .facts dd { overflow-wrap: anywhere; }
.side-label { font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }

.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { font-size: 20px; }

.platform-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
/* Ad accounts per platform, one under the other. */
.platform-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.platform-grid .platform-card { margin-bottom: 0; }
.platform-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 18px; background: var(--surface-2); border-bottom: 1px solid var(--border-soft); }
.platform-card-head h3 { margin: 0; font-size: 15px; }
.platform-card-head .push { margin-left: auto; font-size: 14px; }
.platform-card-head .platform-icon { width: 20px; height: 20px; }
.platform-card .table-scroll { padding: 0 8px; }
/* A customer's ad accounts and running campaigns scroll in place; fit-rows.js
   sizes the area to the window. */
/* The right column is one card, its title inside like "From PowerOffice", so
   both columns start level. Each platform is a card in it, its heading and
   rows one piece: the table inside has no frame of its own. */
.main-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: clip; }
.main-panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; padding: 20px 16px 16px; }
.main-panel-head h2 { font-size: 16px; margin: 0; }
.main-panel > .empty { margin: 0; padding: 0 16px 20px; }
/* A scroll bar of a set width, its room always kept, so the cards' right edge
   lines up with the note in the heading whether the list scrolls or not. */
.main-panel .card-scroll { padding: 0 8px 16px 16px; scrollbar-gutter: stable; }
.main-panel .card-scroll::-webkit-scrollbar { width: 8px; }
.main-panel .card-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.main-panel .card-scroll::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.main-panel .platform-card { border-radius: 10px; }
.main-panel .platform-card-head { border-radius: 9px 9px 0 0; }
.main-panel .platform-card .table-scroll { padding: 0; }
/* The customer page's panel scrolls as a whole: no scroller inside it. */
.main-panel .platform-card .table-scroll { max-height: none; overflow: visible; }
.main-panel .platform-card table { border: 0; border-radius: 0; background: transparent; }
.main-panel .platform-card tbody tr:last-child td { border-bottom: 0; }
.card-scroll { overflow-y: auto; overscroll-behavior: contain; }
/* Customer page: the platform cards on their own, without a card around
   them, 16px apart like the cards beside them. */
.main-panel-bare { background: none; border: 0; border-radius: 0; overflow: visible; }
.main-panel-bare .card-scroll:not(.platform-grid) .platform-card { margin-bottom: 16px; }
.main-panel-bare .card-scroll .platform-card:last-child { margin-bottom: 0; }
/* Nothing to show: a chip in the middle of the column, which then runs as
   tall as the one beside it. */
.empty-chip { display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 8px 16px; font-size: 13px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; }
.customer-main:has(.empty-chip) { align-self: stretch; display: flex; }
.customer-main:has(.empty-chip) > .main-panel-bare { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 160px; }
@media (max-width: 1000px) {
  .customer-main:has(.empty-chip) > .main-panel-bare { min-height: 0; justify-content: flex-start; }
}
.main-panel-bare .card-scroll { padding: 0; scrollbar-gutter: auto; }
.main-panel-bare .platform-card { border-radius: 12px; }
.main-panel-bare .platform-card-head { border-radius: 11px 11px 0 0; }
.card-scroll .platform-card:last-child { margin-bottom: 0; }
.platform-card-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 18px; border-top: 1px solid var(--border-soft); font-size: 14px; }
.platform-card-head + .platform-card-row { border-top: 0; }
/* A suggested account: a rounded box as wide as the row's content, like the
   search field under it, with Link and Dismiss. */
.suggestion-box { flex: 1 1 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; min-width: 0; padding: 7px 8px 7px 12px; background: var(--accent-soft); border: 1px solid var(--accent-border); border-radius: 8px; }
.suggestion-actions { display: flex; gap: 6px; margin-left: auto; }
.suggestion-box .pill { margin-left: 6px; padding: 1px 7px; font-size: 11px; vertical-align: 1px; }
.suggestion-actions form { margin: 0; }
/* Linking an account on the customer page: a dropdown under the search
   field, about five rows tall. The script opens it on focus and filters it;
   without the script it shows while the field has focus. */
.platform-card:has(.account-picker) { overflow: visible; }
.account-picker { position: relative; }
.picker-list {
  display: none;
  position: absolute;
  z-index: 20;
  left: 18px;
  right: 18px;
  top: calc(100% - 4px);
  max-height: 232px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px light-dark(rgb(22 24 29 / 0.14), rgb(0 0 0 / 0.5));
}
.account-picker.open .picker-list,
.account-picker:not(.enhanced):focus-within .picker-list { display: block; }
button.picker-item {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border: 0;
  border-top: 1px solid var(--border-soft);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-weight: 400;
  text-align: left;
}
button.picker-item:first-child { border-top: 0; }
button.picker-item:hover, button.picker-item:focus-visible { background: var(--surface-3); color: var(--text); filter: none; outline: none; }
.picker-item-name { min-width: 0; }
.picker-item[hidden], .picker-empty[hidden] { display: none; }
.picker-empty { margin: 0; padding: 12px 14px; }
.platform-card-name { flex: 1 1 240px; min-width: 0; }
.platform-icon.off { background: var(--icon-off); }


/* Platform logos in one colour: the SVG is a mask, the background colours it,
   so they follow the theme. Set the colour with `background`. */
.platform-icon {
  display: block;
  width: 24px;
  height: 24px;
  background: var(--text);
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.platform-icon-adform { --icon: url("/static/platforms/adform.svg"); }
.platform-icon-google_ads { --icon: url("/static/platforms/google_ads.svg"); }
.platform-icon-meta { --icon: url("/static/platforms/meta.svg"); }
.platform-icon-snapchat { --icon: url("/static/platforms/snapchat.svg"); }
.platform-icon-linkedin { --icon: url("/static/platforms/linkedin.svg"); }
.platform-icon-bigquery { --icon: url("/static/platforms/bigquery.svg"); }
.platform-icon-adtraction { --icon: url("/static/platforms/adtraction.svg"); }
.platform-icon-criteo { --icon: url("/static/platforms/criteo.svg"); }
.platform-icon-microsoft_ads { --icon: url("/static/platforms/microsoft_ads.svg"); }

/* ---------- Toasts ---------- */

/* Messages after an action, bottom right, gone after a few seconds (enhance.js). */
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  max-width: min(420px, calc(100vw - 40px));
}
.toast {
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 10px 30px light-dark(rgb(22 24 29 / 0.18), rgb(0 0 0 / 0.5));
  animation: toast-in 200ms ease-out;
  transition: opacity 400ms, transform 400ms;
}
.toast-error { background: var(--bad); color: #FFFFFF; }
.toast.leaving { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; transition: none; }
}

/* ---------- Notices ---------- */

.notice {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 1rem;
  font-size: 14px;
}
.notice-info { background: var(--accent-soft); border-color: var(--accent-border); }
.notice-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.notice-error { background: var(--bad-bg); border-color: var(--bad-border); color: var(--bad-text); }
.notice a { font-weight: 500; }
.notice-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.notice-row .push { margin-left: auto; }

.sync-line { display: flex; flex-wrap: wrap; gap: 1rem; margin: -0.25rem 0 1rem; }

/* ---------- Pills, dots, badges ---------- */

.pill {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pill-bad { background: var(--bad-bg); color: var(--bad-text); }
.pill-warn { background: var(--warn-bg); color: var(--warn-text); }
.pill-accent { background: var(--accent); color: var(--surface); }
.pill-ok { background: var(--ok-bg); color: var(--ok-text); }
.pill-neutral, .pill-idle, .pill-muted { background: var(--surface-3); color: var(--muted); border: 1px solid var(--border); }
.pill-resolved { background: var(--surface-3); color: var(--muted); }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; vertical-align: middle; }
.dot-bad { background: var(--bad); }
.dot-warn { background: var(--warn); }
.dot-ok { background: var(--ok); }
.dot-idle, .dot-muted, .dot-resolved { background: var(--idle); }
.dot-fix { background: var(--accent); }
/* When a fix is checked, under the alert's numbers. */
.alert-fix-check { margin: 0 0 12px; font-size: 13px; color: var(--text-2); }

.badge {
  font-size: 0.8rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.badge-ok { color: var(--ok-text); border-color: var(--ok); }
.badge-warn { color: var(--warn-text); border-color: var(--warn); }

.platform-mark {
  font-family: var(--mono);
  font-size: 11px;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--text);
  color: var(--bg);
  flex-shrink: 0;
}

/* ---------- Tables ---------- */

/* A table inside a card: scrolls in place past a fixed height, with its
   header row kept in view, like the table cards (which fill the window). */
.table-scroll { overflow: auto; max-height: 480px; overscroll-behavior: contain; }
.table-scroll thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); box-shadow: inset 0 -1px var(--border); border-bottom: 0; }
/* A table in its own card that scrolls under a header that stays put, like
   the customer list. fit-rows.js fills the window with whole rows. */
.table-card {
  max-height: 70vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: auto;
  overscroll-behavior: contain;
  position: relative;
}
.coverage::-webkit-scrollbar, .table-card::-webkit-scrollbar { width: 8px; height: 8px; }
.coverage::-webkit-scrollbar-thumb, .table-card::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.coverage::-webkit-scrollbar-thumb:hover, .table-card::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.coverage::-webkit-scrollbar-corner, .table-card::-webkit-scrollbar-corner { background: transparent; }
.table-card table { border: 0; border-radius: 0; background: transparent; }
.table-card thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  border-bottom: 0;
  box-shadow: inset 0 -1px var(--border);
}
.table-card tfoot th, .table-card tfoot td { position: sticky; bottom: 0; z-index: 1; background: var(--surface); }
.table-card th:first-child, .table-card td:first-child { padding-left: 20px; }
.table-card th:last-child, .table-card td:last-child { padding-right: 20px; }
/* Adform direct buys under the list: folded away, since they aren't followed. */
.direct-card { margin-top: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.direct-card summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 14px 20px; cursor: pointer; list-style: none; }
.direct-card summary::-webkit-details-marker { display: none; }
.direct-card summary::before { content: "▸"; color: var(--muted); transition: transform 0.15s; }
.direct-card[open] summary::before { transform: rotate(90deg); }
.direct-card[open] summary { border-bottom: 1px solid var(--border); }
.direct-title { font-weight: 600; font-size: 14px; }
.direct-card table { border: 0; border-radius: 0; background: transparent; }
/* Fixed column widths, so filtering doesn't make the columns jump about.
   The figures get what their longest value needs; Campaign takes the rest.
   Below the minimum width the card scrolls sideways. */
table.campaign-table { table-layout: fixed; min-width: 1240px; }
.campaign-table td { overflow-wrap: anywhere; }
.campaign-table .col-customer { width: 180px; }
.campaign-table .col-advertiser { width: 220px; }
.campaign-table .col-period { width: 160px; }
.campaign-table .col-budget { width: 160px; }
.campaign-table .col-spent { width: 110px; }
.campaign-table .col-expected { width: 130px; }
.campaign-table .col-pacing { width: 150px; }
.direct-card th:first-child, .direct-card td:first-child { padding-left: 20px; }
.direct-card th:last-child, .direct-card td:last-child { padding-right: 20px; }
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
th, td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border-soft); }
/* Table text a step below the page's, like the list rows elsewhere. */
td { font-size: 14px; }
th { font-size: 12px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
tbody tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.inactive td { color: var(--muted); }
/* Middle, so each line's text lines up with its button. */
table.accounts td { vertical-align: middle; }
/* Equal columns; the last holds the button. */
table.accounts { table-layout: fixed; width: 100%; }
table.accounts th:last-child { width: 130px; }
/* Linked rows have two buttons. */
table.accounts.linked th:last-child { width: 250px; }
table.accounts .row-action form + form { margin-left: 6px; }
table.accounts .num { text-align: left; }
table.accounts td { overflow-wrap: anywhere; }
table.accounts .row-action { text-align: right; white-space: nowrap; }
.account-platform { display: inline-flex; align-items: center; gap: 8px; }
.account-platform .platform-icon { width: 16px; height: 16px; background: var(--text-2); flex: none; }

/* ---------- Cards and tiles ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  max-width: 640px;
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.card .muted { margin-bottom: 1rem; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.5rem; margin: 0 0 1.25rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 1.25rem;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  color: var(--text);
}
a.tile:hover { text-decoration: none; border-color: var(--muted); color: var(--text); }
.tile-label { font-size: 13px; color: var(--muted); }
.tile-value { font-family: var(--mono); font-size: 32px; font-weight: 500; margin-top: 6px; line-height: 1.1; }
.tile-hint { font-size: 13px; color: var(--muted); margin-top: 2px; }
.tile-bad .tile-value { color: var(--bad); }
.tile-warn .tile-value { color: var(--warn-text); }

/* ---------- Dashboard: triage list ---------- */

.customer-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.customer-list-head, .customer-row {
  display: grid;
  grid-template-columns: 22px minmax(200px, 1.2fr) minmax(0, 2fr);
  gap: 16px;
  align-items: center;
  padding: 12px 20px;
}
.customer-list-head {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
details.customer { border-bottom: 1px solid var(--border-soft); }
details.customer:last-child { border-bottom: none; }
details.customer > summary { list-style: none; cursor: pointer; }
details.customer > summary::-webkit-details-marker { display: none; }
details.customer > summary:hover { background: var(--surface-2); }
details.customer[open] > summary { background: var(--surface-2); }
.customer-name { font-weight: 600; font-size: 15px; }
.customer-meta { font-size: 13px; color: var(--muted); }
.chevron { color: var(--muted); transition: transform 0.15s; }
details.customer[open] .chevron { transform: rotate(90deg); }

.platform-lines { display: flex; flex-direction: column; gap: 8px; }
.platform-line {
  display: grid;
  grid-template-columns: 110px minmax(100px, 1fr) auto;
  gap: 12px;
  align-items: center;
  font-size: 13px;
}
.platform-name { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.distribution { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--border-soft); }
.distribution .seg-bad { background: var(--bad); }
.distribution .seg-warn { background: var(--warn); }
.distribution .seg-ok { background: var(--ok); }
.platform-counts { display: flex; gap: 6px; align-items: center; white-space: nowrap; }

.customer-body { padding: 4px 20px 20px 58px; background: var(--surface-2); }
.platform-block + .platform-block { margin-top: 12px; }
.platform-header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; padding: 12px 0 8px; }
.platform-header .push { margin-left: auto; font-size: 14px; }
table.pacing { min-width: 760px; font-size: 14px; }
table.pacing td { vertical-align: middle; }
.pacing-bar { position: relative; height: 8px; border-radius: 4px; background: var(--border-soft); min-width: 160px; }
.pacing-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; }
.pacing-fill.bad { background: var(--bad); }
.pacing-fill.warn { background: var(--warn); }
.pacing-fill.ok { background: var(--ok); }
.pacing-fill.idle { background: var(--idle); }
.pacing-marker { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); }
.pacing-numbers { display: flex; justify-content: space-between; gap: 8px; font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 6px; }

.legend { display: flex; flex-wrap: wrap; gap: 20px; font-size: 13px; color: var(--muted); margin-top: 16px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend + .legend { margin-top: 8px; }
.swatch { width: 12px; height: 10px; border-radius: 2px; display: inline-block; }
.swatch-bad { background: var(--bad); }
.swatch-warn { background: var(--warn); }
.swatch-ok { background: var(--ok); }
.swatch-idle { background: var(--idle); }
.swatch-marker { width: 2px; height: 12px; background: var(--text); }

/* ---------- Dashboard: wall ---------- */

/* The dashboard: a summary strip, then one card per customer: a small
   table of its platforms (a bar, then under, over and running), headed by
   its totals. Quiet by default; colour is only for what's off. */
.dashboard-header { align-items: center; }
.dashboard-header h1 { margin: 0; }
.dashboard-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* The dropdowns and the search are one width and height. */
.dashboard-tools select, .dashboard-tools .search { width: 240px; min-height: var(--control-height); border-radius: var(--control-radius); }
.dashboard-tools select { padding: 0 40px 0 12px; cursor: pointer; }
.dashboard-tools .search input { flex: 1; width: auto; min-width: 0; }
/* With htmx, changing a dropdown updates the page and needs no button. */
.js .dashboard-submit { display: none; }
@media (max-width: 760px) {
  .dashboard-tools, .dashboard-tools select, .dashboard-tools .search { width: 100%; }
}
.summary { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
/* The number, and what it counts below it; centred. */
.summary-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; color: var(--text); min-width: 0; text-align: center; }
.summary-cell + .summary-cell { border-left: 1px solid var(--border-soft); }
.summary-value { margin: 6px 0; font-size: 28px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
/* One line each, so the six cells line up in one row. */
.summary-note { max-width: 100%; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-bad .summary-value { color: var(--bad-text); }
.summary-warn .summary-value { color: var(--warn-text); }
.summary-ok .summary-value { color: var(--ok-text); }
.summary-handled .summary-value { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.summary-handled .pacing-icon { width: 22px; height: 22px; }
/* On a phone, three to a row. */
@media (max-width: 760px) {
  .summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .summary-cell:nth-child(3n + 1) { border-left: 0; }
  .summary-cell:nth-child(n + 4) { border-top: 1px solid var(--border-soft); }
  .summary-value { font-size: 22px; }
}
/* Two customers to a row; every card lists the same platforms in the same
   order, so the cards are the same height and a platform is always in the
   same place. */
.wall { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
/* Below this two cards leave too little room for the bars. */
@media (max-width: 1000px) { .wall { grid-template-columns: minmax(0, 1fr); } }
.wall-card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--text); min-width: 0; }
/* The name's link covers the card; the counts are links of their own above it. */
.wall-card-link { color: inherit; }
.wall-card-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.wall-card-link:hover { text-decoration: none; color: inherit; }
.wall-card:has(.wall-card-link:hover) { border-color: var(--muted); }
.wall-card-link:focus-visible { outline: none; }
.wall-card:has(.wall-card-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
a.wall-total, a.wall-count { position: relative; z-index: 1; text-decoration: none; }
a.wall-total:hover { text-decoration: underline; }
a.wall-count:hover { text-decoration: none; box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 35%, transparent); }
a.wall-count.handled:hover { box-shadow: inset 0 0 0 1px var(--border), 0 0 0 2px color-mix(in srgb, currentColor 35%, transparent); }
/* The head and the platform rows share their columns, so each total sits
   over its column. */
.wall-card-head, .wall-platform { display: grid; grid-template-columns: 96px minmax(40px, 1fr) repeat(4, 60px); align-items: center; gap: 12px; }
.wall-card-head { padding-bottom: 10px; border-bottom: 1px solid var(--border-soft); }
.wall-name { grid-column: 1 / 3; display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.wall-name h2 { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pacing-icon { flex: none; }
.wall-total { justify-self: end; display: inline-flex; align-items: center; gap: 5px; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted); }
.wall-total:last-child { color: var(--text-2); }
.wall-total.bad { color: var(--bad-text); }
.wall-total.warn { color: var(--warn-text); }
.wall-total.handled { color: var(--text-2); }
.wall-platform { min-height: 22px; font-size: 13px; color: var(--text-2); }
.wall-platform-name { white-space: nowrap; }
.wall-platform-quiet { color: var(--muted); }
/* Under and over: a chip when there are any, a dash when none. */
.wall-count { justify-self: end; min-width: 22px; padding: 3px 7px; border-radius: 999px; line-height: 1; text-align: center; font-variant-numeric: tabular-nums; color: var(--muted); }
/* A line box leaves room for descenders, which digits don't have, so they
   sit low in a chip. Trimmed to the digits' height, the padding centres
   them; the bare counts get the same box, so all three line up. */
@supports (text-box: trim-both cap alphabetic) {
  .wall-count { padding: 5px 7px; text-box: trim-both cap alphabetic; }
}
.wall-platform:not(.wall-platform-quiet) .wall-count:last-child { color: var(--text-2); }
.wall-count.bad { font-weight: 600; background: var(--bad-bg); color: var(--bad-text); }
.wall-count.warn { font-weight: 600; background: var(--warn-bg); color: var(--warn-text); }
/* Someone is on it: a grey chip, there but not alarming. */
.wall-count.handled { font-weight: 600; background: var(--surface-3); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--border); }
/* Each part's length is its share of the platform's running campaigns. */
.wall-bar { display: flex; gap: 2px; height: 10px; border-radius: 5px; overflow: hidden; background: var(--border-soft); }
.wall-bar-part { flex: 0 1 0; min-width: 3px; }
.wall-bar-part.bad { background: var(--bad); }
.wall-bar-part.warn { background: var(--warn); }
.wall-bar-part.ok { background: var(--ok); }
.wall-bar-part.idle { background: var(--idle); }
/* Being fixed or snoozed: grey, striped, so it reads as "known". */
.wall-bar-part.handled, .swatch-handled { background: repeating-linear-gradient(135deg, var(--muted) 0 3px, var(--idle) 3px 6px); }
@media (max-width: 520px) {
  .wall-card-head, .wall-platform { grid-template-columns: 76px minmax(0, 1fr) repeat(4, 40px); gap: 8px; }
}
/* Changed at the last check (dashboard-changes.js): a ring for a few
   minutes, and a pulse when it happens. */
.wall-card-changed { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.wall-card-changed:has(.wall-card-link:hover) { border-color: var(--accent); }
.wall-card-new { animation: wall-changed 1.2s ease-out 2; }
@keyframes wall-changed { 0% { box-shadow: 0 0 0 1px var(--accent), 0 0 0 0 var(--accent-border); } 60% { box-shadow: 0 0 0 1px var(--accent), 0 0 0 10px transparent; } }
@media (prefers-reduced-motion: reduce) { .wall-card-new { animation: none; } }
.wall-changed { flex: none; font-size: 12px; font-weight: 500; color: var(--accent); white-space: nowrap; }

/* ---------- Alert kinds and charts ---------- */

.alert-kind.bad { color: var(--bad-text); font-weight: 500; }
.alert-kind.warn { color: var(--warn-text); font-weight: 500; }
.alert-kind.muted, .alert-kind.resolved { color: var(--muted); font-weight: 500; }
.alert-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.alert-actions form { margin: 0; }

.chart { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.chart figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 14px; }
.chart-area {
  position: relative;
  height: 200px;
  border-bottom: 1px solid var(--idle);
  display: flex;
  gap: 4px;
  align-items: flex-end;
  padding: 0 2px;
}
.chart-bar { flex: 1; min-width: 4px; background: var(--accent); border-radius: 3px 3px 0 0; }
.chart-bar.zero { background: var(--bad); height: 2px !important; border-radius: 1px; }
.chart-line { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--text); pointer-events: none; }
.chart-labels { display: flex; gap: 4px; padding: 0 2px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.chart-labels span { flex: 1; min-width: 4px; text-align: center; overflow: hidden; }


/* ---------- Accounts page ---------- */

/* Accounts "needs linking": two steps (strong matches, then one at a
   time), each one panel of ruled rows. Rows share a height and their columns
   line up, platform logos sit in a fixed column, and each panel has its main
   button in the top right. */
.accounts-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
/* The scope as two tiles, like the customer filters, a little lower. */
.view-tiles.scope-filter { grid-auto-flow: column; grid-auto-columns: minmax(0, max-content); gap: 8px; margin: 0 0 8px; }
.scope-filter .view-tile { min-height: 40px; padding: 0 16px; white-space: nowrap; }
.scope-filter .view-tile-label { flex: none; }
/* Search and scope on one line, the tiles as tall as the search field. */
.account-tools { flex-wrap: nowrap; }
.account-tools .customer-search { flex: 1 1 320px; min-width: 0; }
.account-tools .scope-filter { margin: 0; }
.account-tools .scope-filter .view-tile { min-height: var(--control-height); padding: 0 16px; }
@media (max-width: 760px) {
  .account-tools { flex-wrap: wrap; }
}
.underline-tabs { display: flex; flex-wrap: wrap; gap: 24px; }
.underline-tabs a { padding: 10px 0; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 14px; }
.underline-tabs a:hover { color: var(--text); text-decoration: none; }
.underline-tabs a.active { color: var(--text); font-weight: 500; border-bottom-color: var(--accent); }
.underline-tabs .count { margin-left: 4px; font-family: var(--mono); font-size: 13px; font-weight: 400; color: var(--muted); }

.link-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.link-steps li { display: flex; align-items: baseline; gap: 12px; padding: 14px 20px; border-left: 1px solid var(--border); margin-left: -1px; }
.link-steps a { color: var(--text); font-weight: 500; }
.link-step-number { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.link-step-detail { margin-left: auto; font-size: 13px; color: var(--muted); text-align: right; }
.link-steps .done a { color: var(--muted); font-weight: 400; }
.link-steps li.active { background: var(--surface-3); box-shadow: inset 0 -2px var(--accent); }
.link-steps li.active a { color: var(--text); font-weight: 600; }

.link-panel {
  margin-bottom: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  /* Not hidden: the customer and platform dropdowns open past its edge. */
  overflow: visible;
  scroll-margin-top: 16px;
}
.link-panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; }
.link-panel-head h2 { font-size: 16px; font-weight: 600; }
.link-panel-head p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.link-position { font-family: var(--mono); font-size: 13px; color: var(--muted); }

/* One row of a panel; each kind sets its columns. */
.link-row {
  display: grid;
  align-items: center;
  column-gap: 16px;
  min-height: 48px;
  padding: 6px 20px;
  border-top: 1px solid var(--border-soft);
  font-size: 14px;
}
.link-row .platform-icon { width: 18px; height: 18px; background: var(--text-2); }
.link-row .num { font-family: var(--mono); font-size: 13px; color: var(--text-2); }
.link-row .num.none { color: var(--muted); }
.link-row input[type="text"], .link-row select { min-height: 32px; padding: 0 10px; font-size: 13px; min-width: 0; }
.link-row input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.link-row-labels {
  min-height: 34px;
  padding-block: 0;
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.link-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.link-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-sub, .link-reason { font-size: 12px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-reason { font-size: 13px; }
.link-sub button.link { font-size: 12px; }
.link-id { margin-left: 4px; font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--muted); }
.link-actions { display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
.link-actions button, .link-actions .button { white-space: nowrap; }
.link-actions form { margin: 0; }
button.quiet { background: transparent; border-color: transparent; color: var(--muted); font-weight: 400; padding: 0 8px; }
button.quiet:hover { color: var(--text); background: var(--surface-3); filter: none; }

/* Reports: the period, the cost table and the rows' accounts. */
.report-dates { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.report-period { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 16px; }
/* As wide as the date (8 digits, 2 dots) with the same space at the sides as
   above and below it (about 10px in a 32px field). */
.report-period input[type="text"] { width: calc(8ch + 0.5em + 22px); min-height: 32px; padding: 0 10px; font-size: 13px; font-variant-numeric: tabular-nums; }
.report-quick { display: flex; flex-wrap: wrap; gap: 6px; }
/* Quick periods look like the small secondary buttons; the chosen one in the accent. */
.report-quick a { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; font-size: 13px; color: var(--text); text-decoration: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.report-quick a:hover { border-color: var(--muted); }
.report-quick a.active { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); font-weight: 500; }
.report-quick a.active:hover { border-color: var(--accent); }
.report-tools { display: flex; gap: 8px; margin-left: auto; }
.report-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); font-size: 14px; }
.report-table th, .report-table td { padding: 10px 14px; border-bottom: 1px solid var(--border-soft); text-align: left; white-space: nowrap; }
.report-table thead th { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
.report-table tbody th, .report-table tfoot th { font-size: 14px; font-weight: 500; letter-spacing: normal; text-transform: none; color: var(--text); }
/* Widths from the table, not its numbers, so columns stay put when the period
   changes: the company a fixed share, the amount columns (--cols, with Total)
   alike, each with room for "12 345 678 NOK"; narrower, the card scrolls. */
.report-table { table-layout: fixed; min-width: calc(200px + var(--cols) * 140px); }
.report-table thead th:first-child { width: 22%; }
.report-table tbody th { overflow: hidden; text-overflow: ellipsis; }
.report-table .num { text-align: right; font-family: var(--mono); font-size: 13px; }
.report-table thead .num { font-family: inherit; font-size: 11px; }
.report-table .none { color: var(--muted); }
.report-table .report-total, .report-table tfoot th, .report-table tfoot td { font-weight: 600; }
.report-table tfoot th, .report-table tfoot td { border-top: 2px solid var(--border); border-bottom: none; }
/* Below the table: space it off the table's bottom edge. */
.report-incomplete { margin-top: 16px; }
.report-add-row { grid-template-columns: minmax(0, 1fr) 120px; }
.report-account-hidden { opacity: 0.6; }
/* The list of saved reports: one full-width row each, with its platforms. */
.report-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.report-list li + li { border-top: 1px solid var(--border-soft); }
.report-item { display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr) 150px 16px; align-items: center; gap: 12px 24px; padding: 18px 20px; color: var(--text); }
a.report-item:hover { text-decoration: none; color: var(--text); background: var(--surface-2); }
.report-item-name { font-size: 16px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.report-item-platforms { display: flex; flex-wrap: wrap; gap: 6px 8px; min-width: 0; }
.report-platform { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; font-size: 12px; color: var(--text-2); background: var(--surface-3); border: 1px solid var(--border); border-radius: 999px; }
.report-platform .platform-icon, .report-platform-choice .platform-icon { width: 14px; height: 14px; background: var(--text-2); flex: none; }
.report-item-size { font-size: 13px; color: var(--muted); white-space: nowrap; text-align: right; }
.report-item-chevron { color: var(--muted); }
@media (max-width: 760px) {
  .report-item { grid-template-columns: minmax(0, 1fr) 16px; }
  .report-item-platforms, .report-item-size { grid-column: 1; }
  .report-item-chevron { grid-column: 2; grid-row: 1; }
}
/* Naming a report and picking its platforms: the new-report page and Setup. */
.report-form-actions { display: flex; justify-content: flex-end; gap: 8px; }
/* Name, platforms and Save on one line, the description under them. */
.report-settings { display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr) auto; align-items: start; gap: 16px 24px; padding: 4px 20px 18px; }
.report-settings .report-description { grid-column: 1 / -1; grid-row: 2; }
.report-settings .link-actions { align-self: end; }
@media (max-width: 760px) {
  .report-settings { grid-template-columns: minmax(0, 1fr); }
  .report-settings .report-description { grid-row: auto; }
}
.report-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); flex: 1 1 240px; min-width: 0; }
.report-field input { min-height: 36px; font-size: 14px; }
.report-description textarea { font-size: 14px; line-height: 1.45; resize: vertical; }
.report-about { margin: 4px 0 0; }
.report-platforms { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; flex: 999 1 420px; }
.report-platforms legend { padding: 0; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.report-platform-choice { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; font-size: 13px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.report-platform-choice:has(input:checked) { border-color: var(--accent-border); background: var(--accent-soft); }
.report-platform-choice input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.report-account-row { grid-template-columns: 18px minmax(0, 1fr) auto 90px; }
.report-row-panel .link-panel-head { padding-block: 12px; }
.report-row-panel .link-panel-head form { margin: 0; }

/* A new rule: name start, platform, customer, button. */
.new-rule-row { grid-template-columns: minmax(0, 1fr) 180px minmax(0, 1.4fr) 120px; }
.new-rule-row.link-row-labels { min-height: 34px; }
@media (max-width: 760px) {
  .new-rule-row { grid-template-columns: minmax(0, 1fr); row-gap: 8px; padding-block: 12px; }
  .new-rule-row.link-row-labels { display: none; }
  .new-rule-row .link-actions { justify-content: flex-start; }
}

/* Rules: one row each; opening one lists the accounts its name start matches. */
.rule-list { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.rule-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 130px minmax(0, 1.4fr) 80px 90px 100px 72px 16px;
  align-items: center;
  gap: 16px;
  min-height: 52px;
  padding: 6px 20px;
  font-size: 14px;
}
.rule-row .num { text-align: right; font-family: var(--mono); font-size: 13px; color: var(--text-2); }
.rule-list-head { min-height: 34px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
.rule-list-head .num { font-family: inherit; font-size: inherit; color: inherit; }
.rule-item { border-top: 1px solid var(--border-soft); }
.rule-item > summary { cursor: pointer; list-style: none; }
.rule-item > summary::-webkit-details-marker { display: none; }
.rule-item > summary:hover { background: var(--surface-2); }
.rule-item > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.rule-prefix { font-family: var(--mono); font-size: 13px; white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.rule-platform { display: flex; align-items: center; gap: 8px; }
.rule-platform .platform-icon, .rule-accounts .platform-icon { width: 16px; height: 16px; background: var(--text-2); flex: none; }
.rule-customer { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule-delete { justify-self: end; }
.rule-chevron { color: var(--muted); transition: transform 0.15s; }
.rule-item[open] .rule-chevron { transform: rotate(90deg); }
.rule-none { margin: 0; padding: 4px 20px 16px; }
/* Big rules match hundreds of accounts: the list scrolls on its own. */
.rule-accounts { list-style: none; margin: 0; padding: 0 0 8px; max-height: 420px; overflow-y: auto; border-top: 1px solid var(--border-soft); }
.rule-accounts li { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; min-height: 38px; padding: 4px 20px; font-size: 13px; }
.rule-accounts li + li { border-top: 1px solid var(--border-soft); }
.rule-accounts .status-pill a { color: inherit; }
.rule-relink { margin: 0; }
@media (max-width: 760px) {
  .rule-row { grid-template-columns: minmax(0, 1fr) auto 16px; padding: 8px 14px; gap: 4px 12px; }
  .rule-list-head, .rule-platform, .rule-row .num, .rule-row .nowrap { display: none; }
  .rule-customer { grid-column: 1; grid-row: 2; }
  .rule-accounts li { padding: 4px 14px; }
}


/* A panel's rows that scroll in place (fit-rows.js fills the window with
   whole rows); the labels row stays at the top. */
.link-scroll { max-height: 70vh; overflow-y: auto; overscroll-behavior: contain; border-radius: 0 0 10px 10px; }
.link-scroll > .link-row-labels { position: sticky; top: 0; z-index: 1; }
/* Strong matches: tick, logo, account, why; grouped by customer. */
/* One line per account: the customer, the account, why they match. */
.strong-row { grid-template-columns: 16px minmax(0, 1fr) 18px minmax(0, 1.2fr) minmax(0, 1.4fr); cursor: pointer; }
.strong-row .link-customer { font-weight: 500; overflow-wrap: anywhere; }
.strong-row.link-row-labels { cursor: default; }
label.strong-row:hover { background: var(--surface-2); }

/* One at a time: one account per card, laid out as a question to answer:
   the account and what it spends, the possible customers to pick from, and
   one main button (static/decide.js). */
.decide { display: flex; flex-direction: column; gap: 16px; }
.decide-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.decide-head h2 { margin: 0; font-size: 20px; font-weight: 600; }
.decide-progress { display: flex; align-items: center; gap: 12px; flex: 0 1 300px; font-family: var(--mono); font-size: 13px; color: var(--muted); white-space: nowrap; }
.decide-bar { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.decide-bar div { height: 100%; background: var(--accent); }
.decide-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: visible; }
.decide-card > * + * { border-top: 1px solid var(--border-soft); }
.decide h4 { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.decide-account { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 32px; padding: 22px 24px; }
.decide-who { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.decide-logo { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--border); }
.decide-logo .platform-icon { width: 20px; height: 20px; background: var(--text-2); }
.decide-name { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.decide-name h3 { margin: 0; font-size: 22px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.decide-name p { margin: 0; font-size: 13px; color: var(--muted); }
.decide-figures { display: flex; flex-wrap: wrap; gap: 8px 32px; margin: 0; }
.decide-figures dt { font-size: 12px; color: var(--muted); }
.decide-figures dd { margin: 0; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.decide-figures dd span { font-size: 13px; font-weight: 400; color: var(--muted); }
.decide-candidates { display: flex; flex-direction: column; gap: 10px; padding: 20px 24px; }
.decide-choices { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.candidate { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 0; border: 1px solid var(--border); border-radius: 10px; }
.candidate:has(input:checked) { border-color: var(--accent-border); background: var(--accent-soft); }
.candidate label { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 10px 0 10px 16px; cursor: pointer; }
.candidate input[type="radio"] { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.candidate-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.candidate-name { font-weight: 600; overflow-wrap: anywhere; }
.candidate-reason { font-size: 13px; color: var(--text-2); }
.decide-other { display: flex; gap: 8px; margin: 0; border-radius: 10px; }
.js .decide-other [data-main-links] { display: none; }
/* The search is the choice: it has a customer in it (decide.js). */
.decide-other.chosen input[type="text"] { border-color: var(--accent-border); background: var(--accent-soft); }
.decide-other .customer-picker { flex: 1; }
.decide-other input[type="text"] { width: 100%; min-height: 40px; }
.decide-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 24px; background: var(--surface-2); border-radius: 0 0 14px 14px; }
.decide-secondary { display: flex; flex-wrap: wrap; gap: 8px; }
.decide-secondary form { margin: 0; }
button.decide-link { min-height: 44px; font-weight: 600; }
.decide kbd { font-family: var(--mono); font-size: 11px; opacity: 0.7; }
.decide-hint { margin-left: 8px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.decide-next { display: flex; flex-direction: column; gap: 10px; }
.decide-next ul { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.decide-next li { display: grid; grid-template-columns: 16px minmax(0, 1fr); align-items: center; gap: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 10px; min-width: 0; }
.decide-next .platform-icon { width: 16px; height: 16px; background: var(--text-2); }
.decide-empty { display: flex; flex-wrap: wrap; gap: 12px; padding: 18px 24px; }
@media (max-width: 760px) {
  .decide-next ul { grid-template-columns: minmax(0, 1fr); }
  .decide-actions { flex-direction: column-reverse; align-items: stretch; }
  button.decide-link { justify-content: center; }
}

.picker-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.picker-row input[type="text"], .picker-row input[type="search"] { flex: 1 1 220px; }
button.link {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: 400;
  font-size: 13px;
}
button.link:hover { color: var(--accent-hover); filter: none; text-decoration: underline; }
a.button.small { min-height: 32px; padding: 0 12px; font-size: 13px; }

form.inline { display: inline-flex; gap: 0.25rem; align-items: center; margin: 0.1rem 0; }

/* ---------- Phone width ---------- */

@media (max-width: 760px) {
  .topbar-inner, main { padding-left: 16px; padding-right: 16px; }
  .customer-list-head { display: none; }
  .customer-row { grid-template-columns: 22px 1fr; }
  .customer-row .platform-lines { grid-column: 1 / -1; }
  .platform-line { grid-template-columns: 1fr; gap: 6px; }
  .customer-body { padding-left: 16px; }
}

/* A campaign's page: two cards across the top, the rest full width. */
.campaign-top { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.campaign-top .card.customer-card, .campaign-top .card.side-card { margin: 0; }
.campaign-top .card.customer-card { display: flex; flex-direction: column; }
.campaign-top .platform-link { align-self: flex-start; }
/* The campaign card and, when it can be always on, that setting's own card
   under it; the campaign card takes the height About leaves. */
.campaign-left { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.campaign-left .card.customer-card { flex: 1; }
.card.always-on-card { max-width: none; margin: 0; }
.always-on-card h2 { font-size: 16px; margin-bottom: 12px; }
.always-on-settings { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; }
.end-buffer { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.end-buffer input[type="number"] { width: 58px; min-height: 30px; margin: 0 4px; padding: 0 4px 0 10px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.js .end-buffer .filter-submit { display: none; }
@media (max-width: 1000px) { .campaign-top { grid-template-columns: minmax(0, 1fr); } }
.card.side-card { max-width: none; margin-top: 16px; }
.side-card h2 { font-size: 16px; margin-bottom: 14px; }
.campaign-card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13px; }
.campaign-card-top .push { margin-left: auto; }
.campaign-card-top .platform-icon { width: 18px; height: 18px; }
h1.campaign-name { margin: 0; font-size: 20px; line-height: 1.3; overflow-wrap: anywhere; }
.platform-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 14px; font-weight: 500; color: var(--accent); text-decoration: none; }
.platform-link:hover { color: var(--accent-hover); text-decoration: underline; }
.campaign-facts { margin: 0; font-size: 14px; }
.campaign-facts dd { overflow-wrap: anywhere; }
.alert-kind { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--idle); }
.dot-bad { background: var(--bad); }
.dot-warn { background: var(--warn); }
.campaign-note textarea { width: 100%; box-sizing: border-box; min-height: 64px; resize: vertical; font-size: 13px; }
.campaign-alert-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.campaign-alert-actions .push { flex: 1; }
.change-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }

.campaign-main > .main-panel + .main-panel { margin-top: 16px; }

/* History: one line per event, oldest first, then the form to act on it. */
.history { margin: 0; padding: 0 16px 16px; list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.history li { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; }
.history time { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.history-text { overflow-wrap: anywhere; }
.history-main { font-weight: 500; }
.history-empty { display: block; padding: 0 16px 16px; font-size: 13px; }
.history-composer { padding: 14px 16px 16px; border-top: 1px solid var(--border-soft); }
.history-status { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 10px; }
.history-composer .alert-fix-check { margin-bottom: 10px; }
/* Dropdown, date and button read as one control; a divider sets it apart
   from Mark as fixed, which is a different decision. */
.snooze-control { display: inline-flex; align-items: stretch; max-width: 100%; margin-right: 8px; padding-right: 14px; border-right: 1px solid var(--border); }
.snooze-control select { flex: 0 1 auto; min-width: 0; padding: 0 36px 0 12px; background-position: right 14px center; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.snooze-control input { margin-left: -1px; border-radius: 0; }
.snooze-control button { flex: none; margin-left: -1px; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.snooze-control select:focus, .snooze-control input:focus, .snooze-control input.invalid { position: relative; z-index: 1; }
/* The form is at the bottom of its card: the calendar opens upward, and the
   card (which clips by default) has to let it out. */
.main-panel#alerts { overflow: visible; }
.snooze-control .date-picker-panel { top: auto; bottom: calc(100% + 6px); }
.snooze-control select, .snooze-control input { width: auto; min-height: 32px; font-size: 13px; }
.snooze-control input {
  width: 158px;
  padding-right: 30px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238A8F98' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M16 3v4M8 3v4M3 11h18'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}
.snooze-control input.invalid, .snooze-control input.invalid:focus { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.snooze-control input.invalid::placeholder { color: var(--bad-text); }
/* The date only matters for "Until date"; without :has it just stays. */
@supports selector(:has(*)) {
  .snooze-control .snooze-date { display: none; }
  .snooze-control:has(option[value="date"]:checked) .snooze-date { display: block; }
}
.insight { display: flex; align-items: baseline; gap: 10px; margin: 0 16px 18px; }
.insight > .dot { transform: translateY(-1px); }
.insight-headline { margin: 0; font-size: 16px; font-weight: 500; line-height: 1.4; }
.insight-detail { margin: 2px 0 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid var(--border-soft); }
.kpi { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 20px; min-width: 0; text-align: center; }
.kpi + .kpi { border-left: 1px solid var(--border-soft); }
.kpi-label { font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.kpi-value { font-family: var(--mono); font-size: 22px; font-weight: 500; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.kpi-unit { font-size: 13px; color: var(--muted); }
/* A small label beside a name: "Always on". */
.tag { display: inline-block; margin-left: 4px; padding: 1px 7px; border: 1px solid var(--border); border-radius: 999px; font-size: 11px; font-weight: 500; color: var(--text-2); white-space: nowrap; vertical-align: 1px; }
.kpi-bad { color: var(--bad-text); }
.kpi-warn { color: var(--warn-text); }
.kpi-ok { color: var(--ok-text); }

/* Spend so far against an even spread. The SVG stretches to the box; text and
   markers are HTML on top so they keep their size. */
.cumulative { margin: 0; padding: 36px 24px 20px 76px; border-top: 1px solid var(--border-soft); }
.cumulative-plot { position: relative; height: 240px; }
.cumulative-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.cumulative-grid { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border-soft); }
.cumulative-tick { position: absolute; left: -52px; width: 44px; margin-bottom: -8px; text-align: right; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.cumulative-area { fill: color-mix(in srgb, var(--accent) 12%, transparent); }
.cumulative-spent { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.cumulative-projection { stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.cumulative-even { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 2 4; vector-effect: non-scaling-stroke; }
.cumulative-budget { stroke: var(--text); stroke-width: 1.5; stroke-dasharray: 6 5; vector-effect: non-scaling-stroke; }
.cumulative-today { position: absolute; width: 10px; height: 10px; margin: 0 0 -5px -5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--surface); }
.cumulative-out { position: absolute; top: 0; bottom: 0; right: 0; border-left: 1px solid color-mix(in srgb, var(--bad) 60%, transparent); background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--bad) 12%, transparent) 0 6px, transparent 6px 12px); }
.cumulative-out-label { position: absolute; bottom: 8px; padding-left: 10px; font-size: 12px; color: var(--bad-text); white-space: nowrap; }
.cumulative-labels { position: relative; height: 18px; margin-top: 8px; }
/* A budget or end-date change: a dotted line with a marker at the top. */
.cumulative-change { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed var(--warn); }
.cumulative-change::before { content: ""; position: absolute; top: -5px; left: -5px; width: 8px; height: 8px; background: var(--warn); transform: rotate(45deg); }
.legend-change { width: 8px; height: 8px; background: var(--warn); transform: rotate(45deg); }
/* Hovering the trajectory: a line down through the day, a dot on the spend,
   and the numbers beside it (cumulative-hover.js). */
.cumulative-plot[data-points] { cursor: crosshair; }
.cumulative-guide { position: absolute; top: 0; bottom: 0; border-left: 1px solid color-mix(in srgb, var(--text) 30%, transparent); pointer-events: none; }
.cumulative-dot { position: absolute; z-index: 1; width: 12px; height: 12px; margin: 0 0 -6px -6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px color-mix(in srgb, var(--accent) 35%, transparent); pointer-events: none; }
.cumulative-dot.projected { background: var(--surface); border: 2px solid var(--accent); box-sizing: border-box; }
.cumulative-tip {
  position: absolute;
  z-index: 2;
  top: 0;
  min-width: 190px;
  margin-left: 14px;
  padding: 10px 12px;
  background: var(--text);
  color: var(--bg);
  border-radius: 8px;
  font-size: 12px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.3);
  pointer-events: none;
}
.cumulative-tip.flip { margin-left: 0; transform: translateX(calc(-100% - 14px)); }
.cumulative-guide[hidden], .cumulative-dot[hidden], .cumulative-tip[hidden] { display: none; }
.cumulative-tip-day { margin-bottom: 6px; font-weight: 600; white-space: nowrap; }
.cumulative-tip-row { display: flex; justify-content: space-between; gap: 16px; line-height: 1.6; white-space: nowrap; }
.cumulative-tip-row span:first-child { opacity: 0.7; }
.cumulative-tip-row strong, .cumulative-tip-row span + span { font-family: var(--mono); font-weight: 500; }
.cumulative-labels span { position: absolute; transform: translateX(-50%); font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.cumulative .legend { margin-top: 14px; font-size: 12px; }
.legend-line { width: 16px; border-top: 3px solid var(--accent); }
.legend-projection { border-top-style: dashed; }
.legend-even { border-top: 2px dotted var(--muted); }
.legend-budget { border-top: 2px dashed var(--text); }

/* The charts stack, each the panel's full width. */
.range-picker { flex-wrap: wrap; }
.campaign-charts { border-top: 1px solid var(--border-soft); }
.campaign-charts .chart { padding: 18px 20px 20px; }
.campaign-charts .chart + .chart { border-top: 1px solid var(--border-soft); }
.campaign-charts .chart-area { height: 150px; gap: 3px; }
.chart-bar.over { background: var(--warn); }
/* Every seventh day is labelled; the label may run wider than its bar. */
.campaign-charts .chart-labels span { overflow: visible; white-space: nowrap; }
/* Each day is a full-height column, so the whole column answers the pointer;
   its spend shows just above the bar. */
.daily-col { position: relative; flex: 1; min-width: 4px; height: 100%; display: flex; align-items: flex-end; cursor: default; }
.daily-col .chart-bar { flex: 1; transition: filter 0.1s; }
.daily-col:hover .chart-bar { filter: brightness(1.25); box-shadow: 0 0 0 2px color-mix(in srgb, var(--text) 35%, transparent); }
/* A slot before the campaign or its data: a faint line, not the red of a
   day without spend. */
.chart-bar.none { background: var(--border); height: 2px !important; border-radius: 1px; }
.daily-col.empty:hover .chart-bar { filter: none; box-shadow: none; background: var(--muted); }
.daily-tip {
  display: none;
  position: absolute;
  z-index: 2;
  bottom: calc(var(--h) + 8px);
  left: 50%;
  transform: translateX(-50%);
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px;
  background: var(--text);
  color: var(--bg);
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 6px 16px rgb(0 0 0 / 0.25);
}
.daily-tip span { opacity: 0.7; }
.daily-tip strong { font-family: var(--mono); font-weight: 500; }
.daily-col:hover .daily-tip { display: flex; }
.daily-tip-note { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-style: normal; opacity: 0.85; }
/* Alerts that opened or resolved that day, under the axis. */
.daily-alerts { position: absolute; left: 50%; bottom: -12px; display: flex; gap: 2px; transform: translateX(-50%); pointer-events: none; }
.daily-alerts .dot { width: 6px; height: 6px; }
.dot-ok { background: var(--ok); }
.daily-legend { margin-top: 6px; font-size: 12px; }
/* Near the edges the text opens inwards instead of being cut off. */
.daily-col.tip-start .daily-tip { left: 0; transform: none; }
.daily-col.tip-end .daily-tip { left: auto; right: 0; transform: none; }
/* Seven boxes in a row, like the figures above: the day, its average spend,
   a meter against the busiest day, and how it compares with the average day. */
.campaign-charts .weekdays { padding-bottom: 0; }
.weekday-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); margin: 4px -20px 0; border-top: 1px solid var(--border-soft); }
.weekday { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 10px 16px; min-width: 0; text-align: center; }
.weekday + .weekday { border-left: 1px solid var(--border-soft); }
.weekday.weekend { background: var(--surface-3); }
.weekday-label { font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.weekday-value { font-family: var(--mono); font-size: 18px; font-weight: 500; }
.weekday-meter { width: 100%; max-width: 96px; height: 6px; border-radius: 3px; background: var(--border-soft); overflow: hidden; }
.weekday-meter span { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.weekday.weekend .weekday-meter span { background: var(--muted); }
.weekday-change { font-family: var(--mono); font-size: 12px; color: var(--muted); }
@media (max-width: 640px) { .weekday-row { grid-template-columns: repeat(4, minmax(0, 1fr)); } .weekday:nth-child(5) { border-left: 0; } }
.sibling-table { border: 0; border-radius: 0; background: transparent; min-width: 640px; }
.sibling-table tr.current td { background: var(--accent-soft); }
.sibling-table tbody tr:last-child td { border-bottom: 0; }

/* A row's name, edited in place in its panel's head. */
.report-row-head { display: flex; align-items: center; gap: 8px; flex: 1 1 280px; min-width: 0; margin: 0; }
input.report-row-name { flex: 0 1 420px; min-width: 0; min-height: 34px; margin-left: -9px; padding: 0 8px; font-size: 16px; font-weight: 600; color: var(--text); background: transparent; border: 1px solid transparent; border-radius: 6px; }
input.report-row-name:hover { border-color: var(--border); }
input.report-row-name:focus { border-color: var(--accent-border); background: var(--surface-2); }
.js .report-row-head [type="submit"] { display: none; }
/* Rows are moved by their header (report-rows.js); without it there's no grip. */
.report-row-grip { display: none; }
.js .report-row-grip { display: inline-flex; justify-content: center; min-height: 28px; width: 22px; padding: 0; margin-right: -4px; color: var(--muted); background: transparent; border: 0; cursor: grab; }
.js .report-row-grip:hover { color: var(--text); }
.js .report-row-panel > .link-panel-head { cursor: grab; }
.js .report-row-panel > .link-panel-head :is(input, button:not(.report-row-grip), a) { cursor: auto; }
.report-row-panel.dragging { opacity: 0.4; }
.report-add-row-button { margin: -8px 0 24px; }
.js [data-report-new] .report-add-row [type="submit"] { display: none; }

/* A calendar under a date field (date-picker.js), weeks starting on Monday. */
.date-picker { position: relative; }
.date-picker input, input[data-date-picker] { text-align: center; }
.date-picker-panel { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: 260px; padding: 10px; box-sizing: border-box; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px light-dark(rgb(22 24 29 / 0.14), rgb(0 0 0 / 0.5)); }
.date-picker-panel[hidden] { display: none; }
.date-picker-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text); }
.date-picker-head button { width: 28px; min-height: 28px; padding: 0; }
.date-picker-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.date-picker-grid .weekday { padding: 4px 0; font-size: 11px; color: var(--muted); }
.date-picker-head button, .date-picker-grid button { justify-content: center; }
.date-picker-grid button { min-height: 30px; padding: 0; font-size: 13px; font-weight: 400; color: var(--text); background: transparent; border: 1px solid transparent; border-radius: 6px; font-variant-numeric: tabular-nums; }
.date-picker-grid button:hover { color: var(--text); background: var(--surface-3); filter: none; }
.date-picker-grid button.outside { color: var(--muted); }
.date-picker-grid button:disabled { color: var(--muted); opacity: 0.35; cursor: default; background: transparent; }
.date-picker-grid button.today { border-color: var(--border); }
.date-picker-grid button.chosen, .date-picker-grid button.chosen:hover { background: var(--text); color: var(--bg); font-weight: 600; }
