:root {
  /* Colours: use these, not new hex values. */
  --text: #172538;
  --text-2: #263b54;
  --text-3: #44546b;
  --muted: #65768d;
  --faint: #8a96a8;
  --bg: #f4f6fa;
  --surface: #fff;
  --surface-alt: #f8fafc;
  --hover: #eaf0f8;
  --border: #dce2ec;
  --border-soft: #edf0f5;
  --border-strong: #ccd4df;
  --accent: #2555e7;
  --accent-hover: #1944c8;
  --accent-text: #274eaa;
  --accent-bg: #eaf0ff;
  --accent-border: #b7caff;
  --focus: #9bb7ff;
  --ok: #1c7251;
  --ok-bg: #e5f4ed;
  --ok-border: #b9e0cb;
  --bad: #a83629;
  --bad-bg: #fde9e5;
  --bad-border: #f0b4ab;
  --warn: #85560a;
  --warn-accent: #d98a00;
  --warn-bg: #fff4dd;
  --warn-border: #f1d49a;
  --nav-bg: #112037;
  --nav-text: #bfcce0;
  --nav-muted: #8293ae;
  --nav-active: #263c61;
  --nav-hover: #203450;
  --nav-chip: #3d5070;
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/fonts/inter.woff2) format('woff2');
}
:root {
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.5;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
[hidden] {
  display: none !important;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  border-radius: 7px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
}
button:hover {
  background: var(--hover);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.primary:hover {
  background: var(--accent-hover);
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 10px;
  font-size: 0.875rem;
}
input[type='checkbox'] {
  width: auto;
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 600;
}
input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
a {
  color: var(--accent);
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font-size: 1.5rem;
  letter-spacing: -0.5px;
  font-weight: 650;
}
h2 {
  font-size: 1.125rem;
  font-weight: 650;
}
p {
  color: var(--muted);
}
code {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.875rem;
  word-break: break-all;
}
.shell {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  min-height: 100vh;
}
aside {
  background: var(--nav-bg);
  color: #fff;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.wordmark {
  font-weight: 750;
  font-size: 1.35rem;
  letter-spacing: -0.8px;
  color: inherit;
  text-decoration: none;
}
.aside-label {
  color: var(--nav-muted);
  font-size: 0.7rem;
  letter-spacing: 1.5px;
  margin: 6px 0 22px;
}
nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
nav a {
  padding: 9px 11px;
  color: var(--nav-text);
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.875rem;
  display: flex;
  justify-content: space-between;
}
nav a.active {
  color: #fff;
  background: var(--nav-active);
}
nav a:hover {
  background: var(--nav-hover);
}
nav .count {
  font-size: 0.8rem;
  padding: 0 6px;
  background: var(--nav-chip);
  border-radius: 4px;
}
.aside-foot {
  margin-top: auto;
  padding-top: 24px;
  font-size: 0.875rem;
}
.aside-foot p {
  color: var(--nav-muted);
  margin: 10px 0 14px;
}
.aside-foot button {
  color: var(--nav-text);
  background: transparent;
  border-color: var(--text-3);
}
main {
  padding: 24px 32px 40px;
  min-width: 0;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 18px;
}
.badge {
  font-size: 0.8125rem;
  background: var(--accent-bg);
  color: var(--accent-text);
  padding: 7px 12px;
  border-radius: 20px;
  white-space: nowrap;
}
.banner {
  border: 1px solid var(--accent-border);
  background: var(--accent-bg);
  color: var(--accent-text);
  border-radius: 7px;
  padding: 9px 14px;
  font-size: 0.875rem;
  margin-bottom: 14px;
}
.notice {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  width: max-content;
  max-width: min(640px, calc(100vw - 28px));
  border-left: 3px solid var(--accent);
  background: var(--accent-bg);
  color: var(--accent-text);
  padding: 13px 44px 13px 17px;
  border-radius: 7px;
  box-shadow: 0 10px 40px #11203730;
  cursor: pointer;
}
.notice::after {
  content: '×';
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.25rem;
  line-height: 1;
  opacity: 0.7;
}
.notice.error {
  background: var(--bad-bg);
  border-color: var(--bad);
  color: var(--bad);
}
.toolbar {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 10px;
}
.toolbar label {
  min-width: 145px;
  flex: 1;
}
.toolbar button {
  height: 39px;
  white-space: nowrap;
}
.coverage {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 10px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
}
.metric-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.875rem;
}
.metric strong {
  display: block;
  font-size: 1.625rem;
  font-weight: 650;
  letter-spacing: -1px;
  margin: 4px 0;
}
.metric small {
  font-size: 0.8125rem;
  color: var(--muted);
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 18px 0 10px;
}
.section-head p {
  font-size: 0.875rem;
  margin-top: 4px;
}
.section-head > span {
  font-size: 0.8125rem;
  color: var(--muted);
}
.table-wrap {
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: auto;
  background: var(--surface);
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: right;
  font-size: 0.875rem;
}
th {
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--surface-alt);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
}
th:first-child,
td:first-child {
  text-align: left;
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
tr:last-child td {
  border-bottom: 0;
}
td strong {
  font-size: 0.875rem;
  font-weight: 600;
}
td small {
  display: block;
  color: var(--muted);
  font-size: 0.8125rem;
  margin-top: 3px;
}
.footnote {
  font-size: 0.8125rem;
  line-height: 1.5;
  margin: 10px 0;
}
.empty {
  padding: 34px;
  text-align: center;
  color: var(--muted);
  white-space: normal;
}
.intro {
  margin-bottom: 16px;
  max-width: 760px;
}
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}
.panel,
.account-card,
.proposal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}
.account-card header {
  margin-bottom: 20px;
}
.account-card h2 {
  font-size: 1rem;
}
.account-card form {
  display: grid;
  gap: 14px;
}
.account-card p {
  font-size: 0.875rem;
  margin: 8px 0 14px;
}
.check {
  flex-direction: row;
  align-items: center;
  font-weight: 400;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 16px;
}
.panel {
  margin-bottom: 16px;
}
.panel p {
  font-size: 0.9375rem;
  margin: 6px 0 12px;
}
.panel textarea {
  min-height: 90px;
  margin-bottom: 10px;
}
.proposal {
  margin-bottom: 14px;
}
.proposal-batch {
  background: var(--accent-bg);
  border-color: var(--accent-border);
}
.proposal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
}
.proposal-head p {
  font-size: 0.875rem;
  margin-top: 4px;
}
.change-values {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-top: 20px;
  padding: 15px;
  background: var(--surface-alt);
  border-radius: 6px;
  font-size: 1.125rem;
}
.change-values small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}
.status {
  display: inline-block;
  font-size: 0.75rem;
  border-radius: 4px;
  background: var(--accent-bg);
  color: var(--accent-text);
  padding: 4px 8px;
}
.status.applied {
  background: var(--ok-bg);
  color: var(--ok);
}
.status.failed,
.status.unknown {
  background: var(--bad-bg);
  color: var(--bad);
}
.proposal .meta {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 10px;
}
details {
  margin-top: 16px;
}
summary {
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-3);
}
details > div {
  padding-top: 14px;
}
.fresh-row,
.audit-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.fresh-row small,
.audit-row small {
  display: block;
  color: var(--muted);
}
.setup {
  max-width: 840px;
}
.setup h2:not(:first-child) {
  margin-top: 28px;
}
.setup li {
  margin: 10px 0;
  color: var(--text-3);
}
.endpoint {
  padding: 16px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: grid;
  gap: 8px;
  margin: 18px 0;
}
.endpoint span {
  font-size: 0.8125rem;
  color: var(--muted);
}
.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: var(--nav-bg);
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 40px;
  max-width: 470px;
  width: 100%;
}
.login .wordmark {
  color: var(--accent);
  margin-bottom: 24px;
}
.login h1 {
  font-size: 2.5rem;
  line-height: 1.15;
  margin-bottom: 16px;
}
.login p {
  font-size: 0.9375rem;
  margin: 12px 0;
}
.login form {
  display: grid;
  gap: 16px;
  margin: 24px 0;
}
.login #login-error {
  color: var(--bad);
}
#mode-label {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.75rem;
  color: var(--nav-text);
}
.aside-foot a {
  color: var(--nav-text);
}
.login .legal-links {
  font-size: 0.8125rem;
}
/* Compact controls and cards remain usable without sideways page scrolling. */
.date-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 8px;
}
.date-presets button {
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 0.8125rem;
  min-height: 32px;
}
.date-presets button[aria-pressed='true'] {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent-hover);
}
.comment-card {
  padding: 16px 18px;
  margin: 10px 0;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
}
.comment-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.comment-heading time,
.comment-card .meta {
  font-size: 0.8125rem;
  color: var(--muted);
}
.comment-message {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
  margin: 14px 0;
}
.comment-card a {
  display: inline-block;
  margin-top: 12px;
}
.view,
form,
label,
.proposal-head > div {
  min-width: 0;
}
.proposal .meta,
.proposal-head p,
.fresh-row,
.notice,
.banner {
  overflow-wrap: anywhere;
}
td small {
  white-space: normal;
  min-width: 100px;
}
#report-rows td:first-child {
  white-space: normal;
  min-width: 220px;
}
.toolbar select {
  max-width: 100%;
}
#proposal-form label {
  flex-basis: 180px;
}
#change-current {
  margin-bottom: 0;
}
[hidden] td::before {
  content: none !important;
}
.comment-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.comment-controls small {
  flex-basis: 100%;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.comment-controls button {
  min-height: 44px;
}
.comment-controls button:disabled {
  cursor: not-allowed;
}
.status.visible-comment {
  background: var(--ok-bg);
  color: var(--ok);
}
.status.hidden-comment {
  background: var(--warn-bg);
  color: var(--warn);
}
.comment-card .meta {
  overflow-wrap: anywhere;
}
.bid-cap-cell {
  white-space: normal;
  min-width: 140px;
}
.bid-cap-cell details {
  margin: 0;
}
.bid-cap-cell summary {
  color: var(--accent);
}
.bid-cap-cell ul {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  text-align: left;
}
.bid-cap-cell li + li {
  margin-top: 10px;
}
.bid-cap-cell small {
  overflow-wrap: anywhere;
}
.daily-table th[scope='row'] {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.875rem;
  background: var(--surface);
  color: var(--text);
  white-space: nowrap;
}
.daily-table th small {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 400;
}
.daily-table tfoot th[scope='row'],
.daily-table tfoot td {
  background: var(--accent-bg);
  font-weight: 650;
  border-top: 2px solid var(--accent-border);
}
.daily-table .future-day {
  color: var(--faint);
}
.daily-table .bid-cap-cell {
  max-width: 320px;
}
.daily-table .bid-cap-cell details {
  min-width: 160px;
}
#daily-totals .metric strong small {
  font-weight: 400;
  letter-spacing: 0;
  font-size: 0.8rem;
  display: block;
}
#daily-filters label {
  flex-basis: 220px;
}
#daily-totals {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
#daily-totals .metric {
  min-width: 0;
}
#daily-totals .metric strong {
  overflow-wrap: anywhere;
}
/* Slightly tighter daily rows without reducing text size. */
.daily-table tbody th,
.daily-table tbody td,
.daily-table tfoot th,
.daily-table tfoot td {
  padding-top: 12px;
  padding-bottom: 12px;
}
/* Creative Performance: compact metrics with Meta-hosted media. */
#creative-filters label {
  flex-basis: 240px;
}
.creative-controls {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: start;
}
.creative-toggle {
  display: flex;
  gap: 4px;
  background: var(--border);
  padding: 4px;
  border-radius: 9px;
}
.creative-toggle button {
  border: 0;
  background: transparent;
  padding: 8px 16px;
  min-height: 36px;
}
.creative-toggle button[aria-pressed='true'] {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 4px #11203718;
}
.creative-table-wrap {
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.creative-table {
  min-width: 1060px;
  display: table;
}
.creative-table th,
.creative-table td {
  padding: 10px 12px;
  vertical-align: middle;
}
.creative-table td:nth-child(2),
.creative-table td:nth-child(3),
.creative-table th[scope='row'] {
  white-space: normal;
  min-width: 140px;
  max-width: 240px;
  text-align: left;
  overflow-wrap: anywhere;
}
/* Headers of the text columns follow their left-aligned cells. */
.creative-table thead th:nth-child(2),
.creative-table thead th:nth-child(3),
.creative-table thead th:nth-child(4) {
  text-align: left;
}
.creative-table th[scope='row'] {
  background: transparent;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 600;
}
.creative-table tbody tr:hover {
  background: var(--accent-bg);
}
.creative-table small {
  font-size: 0.72rem;
  min-width: 0;
}
.creative-thumb {
  padding: 0;
  border: 0;
  border-radius: 6px;
  position: relative;
  width: 60px;
  height: 60px;
  overflow: hidden;
  background: var(--surface-alt);
  display: block;
}
.creative-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.creative-type,
.creative-rank {
  position: absolute;
  background: #112037dc;
  color: white;
  font-size: 10px;
  padding: 3px 6px;
  border-radius: 4px;
  bottom: 4px;
  right: 4px;
}
.creative-rank {
  top: 8px;
  left: 8px;
  bottom: auto;
  right: auto;
  font-size: 12px;
}
.creative-no-image {
  font-size: 11px;
  color: var(--muted);
  padding: 8px;
  display: block;
  text-align: center;
}
.creative-status-chip {
  display: inline-block;
  background: var(--border-soft);
  color: var(--text-3);
  border-radius: 5px;
  padding: 4px 7px;
  font-size: 11px;
  white-space: normal;
}
.creative-status-chip.is-active {
  background: var(--ok-bg);
  color: var(--ok);
}
.creative-status-chip.is-rejected {
  background: var(--bad-bg);
  color: var(--bad);
}
.creative-library {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.creative-card {
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  overflow: hidden;
}
.creative-card-image {
  display: block;
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--border-soft);
  width: 100%;
  min-height: 100px;
}
/* Images keep their own shape; width/height from Meta reserve that shape before the image loads. */
.creative-card-image img {
  width: 100%;
  height: auto;
  display: block;
}
.creative-card-info {
  padding: 12px;
  font-size: 0.75rem;
}
.creative-card-info h3 {
  font-size: 0.85rem;
  margin: 0 0 8px;
  overflow-wrap: anywhere;
  line-height: 1.4;
}
.creative-card-info p {
  font-size: 0.72rem;
  line-height: 1.5;
  margin: 7px 0;
  overflow-wrap: anywhere;
  color: var(--muted);
}
.creative-card-info p strong {
  display: block;
  color: var(--text-2);
}
.creative-card-info dl {
  border-top: 1px solid var(--border-soft);
  padding-top: 8px;
  margin: 10px 0 4px;
}
.creative-card-info dl div {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  margin: 6px 0;
}
.creative-card-info dt {
  color: var(--muted);
  font-size: 0.7rem;
}
.creative-card-info dd {
  margin: 0;
  font-weight: 650;
}
.creative-card-info small {
  font-size: 0.65rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.creative-preview {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 300px;
  max-width: calc(100vw - 28px);
  background: var(--surface);
  box-shadow: 0 12px 50px #11203740;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  z-index: 50;
}
.creative-preview img {
  display: block;
  width: 100%;
  max-height: 340px;
  object-fit: contain;
  border-radius: 6px;
}
.creative-preview p {
  font-size: 0.8rem;
  overflow-wrap: anywhere;
  margin: 8px 0 0;
}
.creative-preview button {
  position: absolute;
  right: 4px;
  top: 4px;
  min-width: 32px;
  min-height: 32px;
  padding: 3px;
  border-radius: 50%;
  background: var(--surface);
}
.creative-thumb:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}
/* Stable layout while data loads: no scrollbar width jumps, fixed-width digits, and stale results stay in place (dimmed) until new ones replace them. */
html {
  scrollbar-gutter: stable;
}
table,
.metric strong,
.change-values {
  font-variant-numeric: tabular-nums;
}
.view[aria-busy='true'] :is(.metrics, .table-wrap, .creative-library) {
  opacity: 0.5;
  transition: opacity 0.15s;
}
#totals:empty,
#totals .metric {
  min-height: 190px;
}
.metric-empty {
  display: grid;
  align-content: center;
  gap: 6px;
}
#daily-totals:empty {
  min-height: 140px;
}
.footnote:empty {
  min-height: 1.7em;
}
.coverage:empty {
  min-height: 1.5em;
}
/* Working buttons: a spinner replaces the label at the same size, so nothing around the button moves. */
button[aria-busy='true'] {
  position: relative;
  opacity: 1;
  color: transparent !important;
  cursor: progress;
}
button[aria-busy='true']::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 1.1em;
  height: 1.1em;
  border: 2px solid var(--text-2);
  border-right-color: transparent;
  border-radius: 50%;
  animation: button-spin 0.7s linear infinite;
}
.primary[aria-busy='true']::after {
  border-color: #fff;
  border-right-color: transparent;
}
.aside-foot button[aria-busy='true']::after {
  border-color: var(--nav-text);
  border-right-color: transparent;
}
@keyframes button-spin {
  to {
    transform: rotate(360deg);
  }
}
/* Overview cards: conversions and costs under the spend headline. */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}
.metric-grid div {
  min-width: 0;
}
.metric-grid dt {
  font-size: 0.75rem;
  color: var(--muted);
}
.metric-grid dd {
  margin: 2px 0 0;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.metric-grid dd small {
  display: block;
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--muted);
}
/* "About these numbers" toggles under each table. */
.about ul {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--muted);
  max-width: 820px;
}
.about li + li {
  margin-top: 4px;
}
.about li:empty {
  display: none;
}
/* Dropdowns: custom arrow with room on the right instead of the browser's edge-hugging default. */
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23627087' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px 8px;
}
/* Issues: live problems flagged at the top, resolved history small and grey at the bottom. */
nav .nav-alert {
  display: inline-block;
  background: var(--bad);
  color: #fff;
  font-weight: 650;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}
.issues-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.issues-toolbar .coverage {
  margin: 0;
}
.issues-toolbar button {
  white-space: nowrap;
  flex: none;
}
.issues-flag {
  min-height: 74px;
  margin-bottom: 18px;
}
.issues-flag-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: 10px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.issues-flag-box strong {
  font-size: 1.125rem;
  font-weight: 650;
}
.issues-flag-box span {
  font-size: 0.875rem;
}
.issues-flag-box.is-alert {
  background: var(--bad-bg);
  border-color: var(--bad-border);
  color: var(--bad);
}
.issues-flag-box.is-ok {
  background: var(--ok-bg);
  border-color: var(--ok-border);
  color: var(--ok);
}
.issues-flag-box.is-warning {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn);
}
.issues-flag-box.is-empty {
  color: var(--text-3);
}
.issues-current {
  display: grid;
  gap: 12px;
}
.issue-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--faint);
  border-radius: 10px;
  padding: 16px 20px;
  min-width: 0;
}
.issue-card.is-critical {
  border-left-color: var(--bad);
}
.issue-card.is-warning {
  border-left-color: var(--warn-accent);
}
.issue-card.is-info {
  border-left-color: var(--accent);
}
.issue-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--border-soft);
  flex: none;
}
.issue-body {
  min-width: 0;
  flex: 1;
}
.issue-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  font-size: 0.75rem;
  color: var(--muted);
}
.issue-top time {
  margin-left: auto;
}
.issue-chip {
  border-radius: 4px;
  padding: 2px 7px;
  font-weight: 600;
  background: var(--border-soft);
  color: var(--text-3);
}
.is-critical .issue-chip {
  background: var(--bad-bg);
  color: var(--bad);
}
.is-warning .issue-chip {
  background: var(--warn-bg);
  color: var(--warn);
}
.is-info .issue-chip {
  background: var(--accent-bg);
  color: var(--accent-text);
}
.issue-card h3 {
  font-size: 1rem;
  font-weight: 650;
  margin: 6px 0 2px;
}
.issue-object {
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}
.issue-object strong {
  color: var(--text-2);
  font-weight: 600;
}
.issue-object small {
  display: block;
  font-size: 0.8125rem;
  color: var(--muted);
}
.issue-reasons {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 0.8125rem;
  color: var(--text-3);
  overflow-wrap: anywhere;
}
.issue-stale {
  font-size: 0.8125rem;
  color: var(--warn);
  margin-top: 8px;
}
.issue-card a {
  display: inline-block;
  font-size: 0.8125rem;
  margin-top: 10px;
}
.issues-history {
  margin-top: 40px;
  color: var(--faint);
}
.issues-history h2 {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--faint);
  margin-bottom: 6px;
}
.issues-history ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.issues-history li {
  font-size: 0.8125rem;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}
.issues-history li small {
  display: block;
  font-size: 0.75rem;
  color: var(--faint);
}
.view[aria-busy='true'] :is(.issues-current, .issues-history) {
  opacity: 0.5;
  transition: opacity 0.15s;
}
/* Launch campaigns */
.launch-step h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.launch-step > p {
  font-size: 0.875rem;
  margin: -8px 0 14px;
}
.step-no {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent-hover);
  font-size: 0.8125rem;
  flex: none;
}
.choice {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.choice label {
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 13px 14px;
  cursor: pointer;
  font-weight: 400;
}
.choice label:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-bg);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.choice input {
  width: auto;
  margin: 3px 0 0;
}
.choice strong {
  display: block;
  font-weight: 650;
}
.choice small {
  display: block;
  color: var(--muted);
  font-size: 0.8125rem;
}
.launch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.launch-grid .wide {
  grid-column: 1 / -1;
}
.launch-names {
  margin-top: 18px;
}
#launch-target {
  margin: 0;
}
#launch-copy label {
  max-width: 560px;
}
.launch-summary {
  list-style: none;
  margin: 14px 0 0;
  padding: 14px 16px;
  background: var(--surface-alt);
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--text-3);
  display: grid;
  gap: 4px;
}
.launch-summary:empty {
  display: none;
}
.launch-placements {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px 12px;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  grid-column: 1 / -1;
}
.launch-placements legend {
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0 4px;
}
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: 10px;
  padding: 26px;
  align-items: center;
  text-align: center;
  cursor: pointer;
  background: var(--surface-alt);
  font-weight: 400;
  color: var(--muted);
}
.dropzone.is-over,
.dropzone:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.dropzone strong {
  color: var(--accent);
}
.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.dropzone:has(input:disabled) {
  opacity: 0.5;
  cursor: not-allowed;
}
.dropzone:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.launch-media {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.launch-media:empty {
  display: none;
}
.launch-file {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px;
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
}
.launch-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  background: var(--border-soft);
}
.launch-thumb :is(img, video) {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.launch-thumb span {
  position: absolute;
  left: 6px;
  bottom: 6px;
  background: #112037cc;
  color: #fff;
  font-size: 0.6875rem;
  border-radius: 4px;
  padding: 2px 6px;
}
.launch-file label {
  font-size: 0.75rem;
}
.launch-file input {
  padding: 7px 9px;
}
.launch-file-status {
  font-size: 0.75rem;
  min-height: 1.5em;
  overflow-wrap: anywhere;
}
.launch-file-status.is-ready {
  color: var(--ok);
}
.launch-file-status.is-failed {
  color: var(--bad);
}
.launch-file button {
  padding: 6px 10px;
  font-size: 0.75rem;
}
.launch-submit {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}
.launch-submit p {
  font-size: 0.875rem;
  flex: 1;
  min-width: 220px;
}
.launch-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--faint);
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 14px;
}
.launch-card.is-paused {
  border-left-color: var(--accent);
}
.launch-card.is-active {
  border-left-color: var(--ok);
}
.launch-card.is-failed {
  border-left-color: var(--bad);
}
.launch-card h3 {
  font-size: 1rem;
  font-weight: 650;
  margin: 0;
  overflow-wrap: anywhere;
}
.launch-card .proposal-head p {
  font-size: 0.8125rem;
}
.status.active {
  background: var(--ok-bg);
  color: var(--ok);
}
.status.failed {
  background: var(--bad-bg);
  color: var(--bad);
}
.launch-items {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  font-size: 0.875rem;
}
.launch-items li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 7px 0;
  border-top: 1px solid var(--border-soft);
  overflow-wrap: anywhere;
}
.launch-items span {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 110px;
}
.launch-items strong {
  font-weight: 600;
}
.launch-items a {
  font-size: 0.8125rem;
  margin-left: auto;
}
.launch-items small {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 0.8125rem;
}
.launch-progress,
.launch-error,
.launch-warning {
  font-size: 0.875rem;
  margin-top: 10px;
  overflow-wrap: anywhere;
}
.launch-error {
  color: var(--bad);
}
.launch-warning {
  color: var(--warn);
}
.launch-card .actions {
  align-items: center;
}
.launch-card .actions small {
  color: var(--muted);
  font-size: 0.8125rem;
}
.launch-card .meta {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 10px;
}
.view[aria-busy='true'] #launch-form {
  opacity: 0.6;
  transition: opacity 0.15s;
}
.account-facts {
  list-style: none;
  margin: -8px 0 18px;
  padding: 0;
  font-size: 0.875rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.account-facts li {
  margin: 2px 0;
}
.account-card h3 {
  font-size: 0.9375rem;
  font-weight: 650;
  margin: 0;
}
.connect-block {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}
.connect-block h3 {
  margin-bottom: 12px;
}
.connect-block > p {
  margin: -4px 0 12px;
}
.connect-block form,
.connect-replace form {
  display: grid;
  gap: 12px;
}
.connect-block > small,
.connect-other small {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 10px;
  overflow-wrap: anywhere;
}
.connect-replace {
  margin: 0 0 20px;
}
.connect-replace form {
  margin-top: 12px;
}
.token-steps {
  margin-top: 12px;
}
.token-steps ol {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 0.8125rem;
  color: var(--text-3);
  overflow-wrap: anywhere;
}
.token-steps li {
  margin: 4px 0;
}
.account-settings {
  border-top: 1px solid var(--border-soft);
  padding-top: 18px;
}
.connect-other {
  margin-top: 18px;
  border-top: 1px solid var(--border-soft);
  padding-top: 12px;
}
.connect-other > div {
  margin-top: 12px;
}
.connect-other small {
  margin-top: 6px;
}
input[readonly] {
  background: var(--surface-alt);
  color: var(--text-3);
}
.launch-draft-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
}
.launch-draft-bar button {
  padding: 7px 12px;
}
.launch-card.is-draft {
  border-left-color: var(--border-strong);
}
.launch-text {
  display: grid;
  gap: 6px;
  align-content: start;
}
.link-button {
  justify-self: start;
  background: none;
  border: 0;
  padding: 4px 0;
  color: var(--accent);
  font-size: 0.8125rem;
}
.link-button:hover {
  background: none;
  text-decoration: underline;
}
.launch-text-note {
  font-size: 0.8125rem;
  margin: -4px 0 0;
}
.launch-problems {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 0.875rem;
}
.launch-problems li {
  border-radius: 7px;
  padding: 9px 13px;
  overflow-wrap: anywhere;
}
.launch-problems .is-block {
  background: var(--bad-bg);
  color: var(--bad);
}
.launch-problems .is-warn {
  background: var(--warn-bg);
  color: var(--warn);
}
.launch-checks {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 14px;
}
.launch-checks.is-stale {
  opacity: 0.55;
}
.launch-checks.is-stale h3::after {
  content: ' · out of date, the form has changed';
  font-weight: 400;
  color: var(--muted);
}
.launch-checks h3 {
  font-size: 0.9375rem;
  font-weight: 650;
  margin: 0 0 8px;
}
.launch-checks ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.875rem;
}
.launch-checks li {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  overflow-wrap: anywhere;
}
.launch-checks li > span {
  font-weight: 700;
  width: 1em;
  flex: none;
}
.launch-checks li p,
.launch-checks > p {
  margin: 4px 0 0;
  font-size: 0.8125rem;
}
.launch-checks small {
  color: var(--muted);
}
.launch-checks .is-ok > span {
  color: var(--ok);
}
.launch-checks .is-failed,
.launch-checks .is-failed > span {
  color: var(--bad);
}
.launch-checks .is-skipped > span {
  color: var(--faint);
}
/* Step 4 has its own layout: wide boxes for long text, narrow ones for short choices. */
.ad-text-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.ad-text-grid > * {
  grid-column: 1 / -1;
}
.ad-text-grid > .half {
  grid-column: span 3;
}
.ad-text-grid > .two-thirds {
  grid-column: span 4;
}
.ad-text-grid > .third {
  grid-column: span 2;
}
.ad-text-grid textarea {
  resize: vertical;
  min-height: 3.6em;
  max-height: 320px;
  overflow-y: auto;
}
.launch-more-row {
  position: relative;
  display: block;
}
.launch-more-row :is(input, textarea) {
  width: 100%;
  padding-right: 38px;
}
.launch-more-row .launch-more-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
}
.launch-more-row .launch-more-remove:hover {
  background: var(--surface-alt);
  color: var(--bad);
}
.launch-anyway {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}
.launch-anyway small {
  flex: 1;
  min-width: 220px;
  font-size: 0.8125rem;
  color: var(--muted);
}
.launch-category {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 18px;
  display: grid;
  gap: 8px;
}
.launch-category > p {
  font-size: 0.8125rem;
  margin: 0;
}
.launch-category label:not(.check) {
  max-width: 420px;
}
#launch-manual :is(input, select):disabled {
  background: var(--surface-alt);
  color: var(--text-3);
  opacity: 1;
}
/* Campaigns */
.state {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  padding: 3px 8px;
  white-space: nowrap;
  background: var(--border-soft);
  color: var(--text-3);
}
.state.is-ok {
  background: var(--ok-bg);
  color: var(--ok);
}
.state.is-wait {
  background: var(--accent-bg);
  color: var(--accent-text);
}
.state.is-bad {
  background: var(--bad-bg);
  color: var(--bad);
}
.campaigns-table td {
  vertical-align: middle;
}
.campaigns-table td:first-child {
  white-space: normal;
  min-width: 240px;
}
.campaigns-table button {
  padding: 7px 12px;
}
.manage-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 22px;
  margin: 14px 0;
}
.manage-campaign {
  border-left: 4px solid var(--accent);
}
.manage-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}
/* A real basis so the states drop below the name on narrow screens instead of squeezing it. */
.manage-head > div:first-child {
  min-width: 0;
  flex: 1 1 260px;
}
.manage-head h2,
.manage-head h3 {
  margin: 0;
  overflow-wrap: anywhere;
}
.manage-head h3 {
  font-size: 1rem;
  font-weight: 650;
}
.manage-head p {
  font-size: 0.8125rem;
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.manage-states {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 0.8125rem;
}
.manage-notes {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 0.8125rem;
  color: var(--bad);
  overflow-wrap: anywhere;
}
.manage-card details {
  margin-top: 12px;
}
.manage-ads {
  margin-top: 14px;
  border-top: 1px solid var(--border-soft);
}
.manage-ad {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}
.manage-ad:last-child {
  border-bottom: 0;
}
.manage-ad details {
  margin-top: 6px;
}
.manage-ad-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.manage-ad-row img,
.manage-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--border-soft);
  flex: none;
}
.manage-ad-name {
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}
.manage-ad-name small {
  display: block;
  color: var(--muted);
  font-size: 0.8125rem;
}
.manage-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.manage-form .wide,
.manage-form .check {
  grid-column: 1 / -1;
}
.manage-ad-text {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.manage-ad-text > [data-texts='message'] {
  grid-column: 1 / -1;
}
.manage-texts {
  display: grid;
  gap: 8px;
  align-content: start;
}
#campaign-back {
  margin-bottom: 4px;
}
.view[aria-busy='true'] :is(#campaigns-list, #campaign-detail) {
  opacity: 0.6;
  transition: opacity 0.15s;
}
.manage-delivery {
  color: var(--muted);
  font-size: 0.75rem;
}
.launch-own-text {
  font-size: 0.75rem;
  color: var(--accent-text);
  overflow-wrap: anywhere;
}
.manage-duplicate {
  align-items: flex-end;
}
.manage-duplicate small {
  flex: 1;
  min-width: 220px;
  font-size: 0.8125rem;
  color: var(--muted);
}
.manage-duplicate label {
  min-width: 200px;
}
.manage-copy {
  margin-top: 10px;
}
.manage-states .link-button {
  font-size: 0.8125rem;
}
/* Copy from another account: that account's own pixel, event and EU details. */
.launch-cross {
  margin: 14px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.launch-cross-head {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-3);
}
.launch-verified {
  margin-top: 18px;
}
.launch-verified p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-3);
}
/* Text per ad: one row per file, the image beside its own text. */
.launch-media.is-own {
  grid-template-columns: 1fr;
}
.launch-file.is-own {
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
}
.launch-file-body {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.launch-file-text {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.launch-file-text .wide {
  grid-column: 1 / -1;
}
.launch-file-text label {
  font-size: 0.75rem;
}
.launch-file-text :is(input, select, textarea) {
  padding: 7px 9px;
}
.launch-file-text textarea {
  resize: vertical;
  min-height: 3.4em;
  max-height: 260px;
  overflow-y: auto;
}
.launch-file-text small {
  font-size: 0.75rem;
  color: var(--muted);
}
.launch-file-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
/* Phone-only pieces (bottom-bar icons and More, folded filters, phone wording) stay out of the desktop layout. */
.icon {
  display: none;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.more-tab,
.fold-bar,
.phone-only {
  display: none;
}
#creative .creative-toggle {
  width: max-content;
  margin-bottom: 8px;
}

@media (max-width: 1200px) {
  .creative-library {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 1100px) {
  #daily-totals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  /* On narrower screens headlines and descriptions get the full width rather than half. */
  .ad-text-grid > .half.launch-text {
    grid-column: 1 / -1;
  }
}
@media (max-width: 1000px) {
  .shell {
    grid-template-columns: 190px 1fr;
  }
  aside {
    padding: 20px 12px;
  }
  main {
    padding: 22px 20px 36px;
  }
  .toolbar label {
    min-width: 130px;
  }
}
@media (max-width: 900px) {
  .launch-file-text {
    grid-template-columns: 1fr;
  }
}

/* Phones: a bottom bar instead of the sidebar, filters folded into one line, and compact rows instead of cards. */
@media (max-width: 700px) {
  /* Shell: content runs full width and clears the bottom bar. */
  .shell {
    display: block;
  }
  main {
    padding: 14px 12px calc(78px + env(safe-area-inset-bottom));
  }
  main > header {
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-bottom: 12px;
  }
  h1 {
    font-size: 1.25rem;
  }
  .badge {
    font-size: 0.75rem;
    padding: 4px 9px;
  }
  #mode-banner,
  .wide-only {
    display: none;
  }
  .phone-only {
    display: block;
  }
  .banner {
    font-size: 0.8125rem;
    padding: 8px 11px;
    margin-bottom: 12px;
  }
  .notice {
    bottom: calc(70px + env(safe-area-inset-bottom));
  }

  /* Bottom bar: Overview, Daily, Campaigns, Launch and More. */
  aside {
    position: fixed;
    inset: auto 0 0;
    z-index: 50;
    height: auto;
    padding: 0;
    background: none;
    color: var(--text);
  }
  aside > .wordmark,
  .aside-label,
  .aside-foot,
  nav > a:not(.tab),
  .tab-rest {
    display: none;
  }
  nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--border);
  }
  nav .tab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 56px;
    padding: 6px 2px;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 600;
  }
  nav .tab:hover,
  nav .tab.active {
    background: none;
  }
  nav .tab.active {
    color: var(--accent);
  }
  nav .tab .icon {
    display: block;
  }
  .more-tab .nav-alert {
    position: absolute;
    top: 5px;
    left: calc(50% + 5px);
    min-width: 17px;
    padding: 0 4px;
    font-size: 0.6875rem;
    line-height: 1.5;
  }
  /* More: the other pages and Sign out rise above the bar; the page behind dims. */
  aside.more-open::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background: #11203766;
  }
  aside.more-open .aside-foot {
    order: -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 10px 16px;
    background: var(--surface);
    border-radius: 14px 14px 0 0;
  }
  aside.more-open .aside-foot p {
    display: none;
  }
  aside.more-open #mode-label {
    color: var(--muted);
  }
  aside.more-open .aside-foot button {
    min-height: 36px;
    padding: 6px 12px;
    color: var(--text-2);
    border-color: var(--border-strong);
  }
  aside.more-open nav > a:not(.tab) {
    display: flex;
    order: -1;
    grid-column: 1 / -1;
    align-items: center;
    padding: 12px 16px;
    border-radius: 0;
    border-top: 1px solid var(--border-soft);
    color: var(--text);
    font-size: 0.9375rem;
  }
  aside.more-open nav > a:not(.tab):hover {
    background: var(--hover);
  }
  aside.more-open nav > a.active:not(.tab) {
    background: var(--accent-bg);
    color: var(--accent-text);
  }
  aside.more-open nav {
    border-top: 0;
  }
  aside.more-open nav .tab {
    border-top: 1px solid var(--border);
  }
  nav .count {
    background: var(--border-soft);
    color: var(--muted);
  }

  /* Filters fold into one line that shows the current choice; the round button refreshes from Meta. */
  .fold-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
  }
  .fold-toggle {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 22px;
    text-align: left;
  }
  .fold-summary {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .fold-hint {
    flex: none;
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-weight: 500;
  }
  .fold-hint::after {
    content: '';
    width: 7px;
    height: 7px;
    border: solid currentColor;
    border-width: 0 1.6px 1.6px 0;
    transform: translateY(-2px) rotate(45deg);
  }
  .fold.open .fold-hint::after {
    transform: translateY(2px) rotate(-135deg);
  }
  .fold-refresh {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    padding: 0;
    border-radius: 50%;
    color: var(--accent);
  }
  .fold-refresh .icon {
    display: block;
    width: 20px;
    height: 20px;
  }
  .fold:not(.open) > :not(.fold-bar),
  .fold:not(.open) + .footnote,
  .fold:has(> form[hidden]) > .fold-bar {
    display: none;
  }
  .fold.open {
    margin-bottom: 12px;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
  }
  .fold.open .fold-bar {
    margin-bottom: 12px;
  }
  .fold .date-presets {
    margin-bottom: 0;
  }

  /* Forms: two columns, the first field full width; 16px text so iPhones don't zoom in. */
  .toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
    gap: 10px;
  }
  .toolbar label {
    min-width: 0;
  }
  .toolbar label:first-child {
    grid-column: 1/-1;
  }
  .toolbar button {
    height: auto;
    white-space: normal;
  }
  #sync,
  #daily-sync {
    grid-column: 1/-1;
    order: 2;
  }
  #daily-filters label,
  #creative-filters label,
  #creative-refresh,
  #comments-form button {
    grid-column: 1/-1;
  }
  button,
  input,
  select,
  textarea {
    min-height: 44px;
  }
  input,
  select,
  textarea {
    font-size: 16px;
    max-width: 100%;
    min-width: 0;
  }
  input[type='checkbox'] {
    min-height: 20px;
    min-width: 20px;
  }
  .date-presets button {
    flex: 1 0 auto;
    min-height: 36px;
  }
  /* Keep native iOS date controls within their grid cells. */
  #filters .date-field {
    min-inline-size: 0;
  }
  #filters input[type='date'] {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    inline-size: 100%;
    min-inline-size: 0;
    max-inline-size: 100%;
    height: 44px;
  }
  #filters input[type='date']::-webkit-date-and-time-value {
    min-width: 0;
    text-align: left;
  }
  #filters input[type='date']::-webkit-datetime-edit {
    min-width: 0;
    padding: 0;
  }
  /* From and To share a row; slimmer insides keep the date clear of Chrome's calendar icon down to 320px. */
  #filters input[type='date'] {
    padding-inline: 8px 6px;
  }
  #filters input[type='date']::-webkit-calendar-picker-indicator {
    margin-inline-start: 2px;
  }

  /* Cards and panels. */
  .panel,
  .account-card,
  .proposal,
  .comment-card,
  .manage-card {
    padding: 14px;
  }
  .account-grid {
    grid-template-columns: 1fr;
  }
  .account-card header {
    gap: 10px;
  }
  .proposal-head,
  .section-head {
    flex-wrap: wrap;
  }
  .section-head {
    gap: 4px 12px;
    margin: 14px 0 8px;
  }
  .change-values {
    gap: 12px;
    font-size: 1rem;
    flex-wrap: wrap;
  }
  .coverage,
  .footnote {
    font-size: 0.75rem;
    margin: 0 0 8px;
  }
  .login-card {
    padding: 25px;
  }
  .login h1 {
    font-size: 2rem;
  }

  /* Headline figures: two small tiles a row (one when there is one currency). */
  .metrics {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
  }
  .metric {
    padding: 11px 12px;
  }
  .metric-label,
  .metric small {
    font-size: 0.75rem;
  }
  .metric small {
    display: block;
    line-height: 1.4;
  }
  .metric strong {
    font-size: 1.25rem;
    letter-spacing: -0.4px;
    margin: 2px 0;
  }
  .metric-grid {
    gap: 6px 10px;
    margin-top: 8px;
    padding-top: 8px;
  }
  .metric-grid dt {
    font-size: 0.6875rem;
  }
  .metric-grid dd {
    font-size: 0.875rem;
  }
  #totals:empty,
  #totals .metric,
  #daily-totals:empty {
    min-height: 0;
  }
  #daily-totals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Overview: one row per campaign (spend, then conversions · cost per conversion); a tap opens the rest. */
  #report table,
  #report tbody {
    display: block;
  }
  #report thead {
    display: none;
  }
  #report-rows tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: 'name spend spend' 'name conv cpa';
    column-gap: 6px;
    align-items: start;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border-soft);
    cursor: pointer;
  }
  #report-rows tr:last-child {
    border-bottom: 0;
  }
  #report-rows tr.open {
    background: var(--surface-alt);
  }
  #report-rows td {
    display: none;
    min-width: 0;
    padding: 0;
    border: 0;
    white-space: normal;
    font-size: 0.8125rem;
  }
  #report-rows td small {
    min-width: 0;
  }
  #report-rows td:nth-child(1) {
    display: block;
    grid-area: name;
    min-width: 0;
    padding-right: 6px;
    overflow-wrap: anywhere;
  }
  #report-rows td:nth-child(1) small {
    margin-top: 1px;
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #report-rows td:nth-child(2) {
    display: block;
    grid-area: spend;
    font-size: 0.875rem;
    font-weight: 600;
  }
  #report-rows td:nth-child(5),
  #report-rows td:nth-child(6) {
    display: block;
    color: var(--muted);
  }
  #report-rows td:nth-child(5) {
    grid-area: conv;
  }
  #report-rows td:nth-child(5) small {
    display: inline;
    margin: 0 0 0 3px;
    font-size: inherit;
  }
  #report-rows td:nth-child(6) {
    grid-area: cpa;
  }
  #report-rows td:nth-child(6)::before {
    content: '· ';
  }
  #report-rows tr.open td:is(:nth-child(3), :nth-child(4), :nth-child(7), :nth-child(8), :nth-child(9)) {
    display: block;
    grid-column: 1 / -1;
    padding-top: 6px;
    min-width: 0;
  }
  #report-rows tr.open td:is(:nth-child(3), :nth-child(4), :nth-child(7), :nth-child(8), :nth-child(9))::before {
    content: attr(data-label);
    float: left;
    color: var(--muted);
  }
  #report-rows tr.open td:nth-child(3) {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-soft);
  }
  #report-rows tr.open td:nth-child(10) {
    display: block;
    grid-column: 1 / -1;
    margin-top: 10px;
  }
  #report-rows tr.open td:nth-child(10) button {
    width: 100%;
    min-height: 38px;
    padding: 6px 12px;
  }
  #report-rows td.empty {
    display: block;
    grid-column: 1 / -1;
    padding: 12px 0;
    text-align: left;
  }

  /* Campaigns: name and Open on top, status and budget below. */
  .campaigns-table,
  .campaigns-table tbody {
    display: block;
  }
  .campaigns-table thead {
    display: none;
  }
  .campaigns-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'name open' 'state budget';
    gap: 6px 10px;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-soft);
  }
  .campaigns-table tr:last-child {
    border-bottom: 0;
  }
  .campaigns-table td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    white-space: normal;
    text-align: left;
  }
  .campaigns-table td:nth-child(1) {
    grid-area: name;
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .campaigns-table td:nth-child(2) {
    grid-area: state;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
  }
  .campaigns-table td:nth-child(3) {
    grid-area: budget;
    font-size: 0.8125rem;
    color: var(--text-3);
    text-align: right;
  }
  .campaigns-table td:nth-child(4) {
    grid-area: open;
  }
  .campaigns-table td:nth-child(4) button {
    min-height: 34px;
    padding: 5px 12px;
  }

  /* Daily and Creative keep their tables and scroll sideways; the day stays pinned on the left. */
  .daily-table {
    min-width: 900px;
  }
  .daily-table th:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--surface-alt);
    box-shadow: 2px 0 3px #1120370a;
  }
  .daily-table tfoot th:first-child {
    background: var(--accent-bg);
  }
  .daily-table :is(tbody, tfoot) :is(th, td) {
    padding: 9px 10px;
  }
  .daily-table small {
    white-space: nowrap;
  }
  .creative-table th,
  .creative-table td {
    padding: 9px 10px;
  }
  #creative .creative-toggle {
    width: auto;
  }
  .creative-toggle button {
    flex: 1;
    min-height: 36px;
  }
  .creative-library {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .creative-card-info {
    padding: 10px;
  }
  .creative-preview {
    right: 12px;
    bottom: calc(70px + env(safe-area-inset-bottom));
    z-index: 55;
    width: 250px;
  }
  .creative-preview img {
    max-height: 280px;
  }

  /* Issues */
  .issue-card {
    padding: 14px;
    gap: 12px;
  }
  .issue-thumb {
    width: 48px;
    height: 48px;
  }
  .issue-top time {
    margin-left: 0;
    flex-basis: 100%;
  }

  /* Launch */
  .launch-media {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .launch-submit button {
    flex: 1;
  }
  .launch-items a {
    margin-left: 0;
  }
  .ad-text-grid > :is(.half, .two-thirds, .third) {
    grid-column: 1 / -1;
  }
  .launch-file.is-own {
    grid-template-columns: 1fr;
  }
  .launch-file.is-own .launch-thumb {
    max-width: 160px;
  }
}

@media (max-width: 360px) {
  .creative-library {
    grid-template-columns: 1fr;
  }
}
@media (prefers-reduced-motion: reduce) {
  button[aria-busy='true']::after {
    animation-duration: 1.6s;
  }
}
