/* Pearloc Ads Command Center. Dark only, mobile first: everything is laid out for a
   390px phone and widens from there. Colours are tokens, so the palette can be
   swapped here without touching the page or the charts. */

:root {
  color-scheme: dark;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;

  --page: #0b0a09;
  --surface: #151311;
  --surface-2: #1c1a17;
  --surface-3: #25221e;
  --hair: rgba(255, 240, 210, 0.09);
  --hair-strong: rgba(255, 240, 210, 0.17);
  --grid: #24211d;
  --axis: #3a362f;

  --ink: #f3f0e9;
  --ink-2: #c6c1b5;
  --ink-3: #8f897c;

  --gold: #c9a961;
  --gold-bright: #e6cf9a;
  --gold-deep: #a5843f;
  --gold-dark: #7d6229;
  --gold-wash: rgba(201, 169, 97, 0.13);

  /* Categorical series, in this fixed order. Checked against --surface for
     colour-blind separation and contrast; do not reorder or add a ninth. */
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --s5: #d55181;
  --s6: #008300;
  --s7: #9085e9;
  --s8: #e66767;
  --other: #6a655b;

  /* Status: only ever with an icon and a word beside it. */
  --good: #2fb344;
  --warn: #fab219;
  --bad: #f0605d;

  --radius: 14px;
  --gap: 12px;
  --pad: 14px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 340px at 50% -160px, rgba(201, 169, 97, 0.1), transparent 70%),
    var(--page);
  background-attachment: fixed;
  color: var(--ink);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}

h2,
h3,
p {
  margin: 0;
}

button,
input {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 6px;
}

.muted {
  color: var(--ink-3);
}

/* ---------------------------------------------------------------- top bar */

/* On a phone: brand and sign-out on one line, the sync time on its own line below. */
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 10px;
  padding: 14px var(--gap) 10px;
  padding-top: max(14px, env(safe-area-inset-top));
}

.top-tools {
  display: contents;
}

.top-tools .sync {
  order: 3;
  flex-basis: 100%;
  text-align: left;
}

.brand {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-mark {
  color: var(--gold);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}

.brand-sub {
  color: var(--ink-3);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sync {
  color: var(--ink-2);
  font-size: 12px;
  text-align: right;
  line-height: 1.3;
}

.sync-warn {
  color: var(--ink);
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--good);
  vertical-align: 1px;
}

.dot-bad {
  background: var(--bad);
}

.ghost {
  padding: 7px 12px;
  border: 1px solid var(--hair-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.ghost:hover {
  border-color: var(--gold);
  color: var(--ink);
}

.primary {
  padding: 11px 16px;
  border: 1px solid var(--gold);
  border-radius: 10px;
  background: var(--gold);
  color: #17130a;
  font-weight: 600;
  cursor: pointer;
}

.primary:hover {
  background: var(--gold-bright);
}

.primary.small {
  padding: 8px 14px;
  font-size: 13px;
}

/* ---------------------------------------------------------------- page and cards */

.page {
  display: grid;
  gap: var(--gap);
  grid-template-columns: minmax(0, 1fr);
  max-width: 1560px;
  margin: 0 auto;
  padding: 4px var(--gap) calc(28px + env(safe-area-inset-bottom));
}

.banner {
  max-width: 1512px;
  margin: 0 var(--gap) var(--gap);
  padding: 10px 14px;
  border: 1px solid var(--hair-strong);
  border-left: 3px solid var(--warn);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13px;
}

.card {
  min-width: 0;
  padding: var(--pad);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 240, 210, 0.022), transparent 120px), var(--surface);
  transition: opacity 0.2s;
}

/* While numbers reload the last render stays put, only dimmed. */
.busy .card {
  opacity: 0.7;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

h2 {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h2::after {
  content: "";
  display: block;
  width: 22px;
  height: 1px;
  margin-top: 7px;
  background: var(--gold);
}

h3 {
  margin: 20px 0 10px;
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sub {
  margin-top: 7px;
  color: var(--ink-3);
  font-size: 12px;
}

.note {
  margin-top: 10px;
  color: var(--ink-3);
  font-size: 12px;
}

.note strong {
  color: var(--ink-2);
  font-weight: 600;
}

.chart {
  position: relative;
  height: 250px;
}

.chart.short {
  height: 150px;
}

/* ---------------------------------------------------------------- tags, chips, hatching */

.hatch {
  background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0 1.5px, transparent 1.5px 6px);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border: 1px solid var(--hair-strong);
  border-radius: 999px;
  color: var(--ink-3);
  font-size: 10.5px;
  line-height: 1.5;
  white-space: nowrap;
}

.tag-early {
  border-style: dashed;
}

.tag-migration {
  padding-left: 22px;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.28) 0 1.5px, transparent 1.5px 5px) 7px 50% / 10px 10px no-repeat;
  color: var(--ink-2);
  white-space: normal;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-2);
  font-size: 11px;
  white-space: nowrap;
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--fmt, var(--other));
}

.fmt-video {
  --fmt: var(--s1);
}

.fmt-catalog {
  --fmt: var(--s2);
}

.fmt-hybrid {
  --fmt: var(--s3);
}

.fmt-image {
  --fmt: var(--s4);
}

.fmt-unknown {
  --fmt: var(--other);
}

/* Numbers that it is too soon to judge, or that mix in untrusted days. */
.early {
  color: var(--ink-3);
}

/* ---------------------------------------------------------------- legend, table view */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
  font-size: 12px;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.legend .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

.key {
  flex: none;
  width: 14px;
  height: 2px;
  border-radius: 1px;
  background: var(--key);
}

.key-dash {
  height: 0;
  border-top: 1px dashed var(--key);
  background: none;
}

.key-box {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.key-hatch {
  width: 14px;
  height: 10px;
  border-radius: 2px;
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.34) 0 1.5px, transparent 1.5px 5px);
  outline: 1px solid var(--hair-strong);
}

.key-diamond {
  width: 8px;
  height: 8px;
  border-radius: 0;
  transform: rotate(45deg);
}

.key-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.key-ring {
  width: 9px;
  height: 9px;
  border: 1.5px solid var(--key);
  border-radius: 50%;
  background: none;
}

.table-view {
  margin-top: 10px;
  font-size: 12px;
}

.table-view summary {
  display: inline-block;
  padding: 4px 0;
  color: var(--ink-3);
  cursor: pointer;
  list-style: none;
}

.table-view summary::-webkit-details-marker {
  display: none;
}

.table-view summary::before {
  content: "+ ";
  color: var(--gold);
}

.table-view[open] summary::before {
  content: "– ";
}

.table-scroll {
  overflow-x: auto;
  margin-top: 6px;
  -webkit-overflow-scrolling: touch;
}

table {
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.plain {
  width: 100%;
  font-size: 12px;
}

.plain caption {
  padding-bottom: 6px;
  color: var(--ink-3);
  text-align: left;
}

.plain th,
.plain td {
  padding: 6px 10px 6px 0;
  border-bottom: 1px solid var(--hair);
  color: var(--ink-2);
  font-weight: 400;
  text-align: left;
  white-space: nowrap;
}

.plain thead th {
  color: var(--ink-3);
  font-size: 11px;
}

.plain .num {
  padding-right: 0;
  padding-left: 12px;
  text-align: right;
}

/* ---------------------------------------------------------------- panel 1: today */

.today-grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: minmax(0, 1fr);
}

.hero {
  padding: 14px;
  border: 1px solid var(--hair-strong);
  border-radius: 12px;
  background: linear-gradient(160deg, var(--gold-wash), transparent 60%), var(--surface-2);
}

.hero-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 2px;
}

.hero-value {
  font-size: 56px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.hero-of {
  color: var(--ink-2);
  font-size: 15px;
}

.status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--ink);
  font-size: 13px;
}

.status-icon {
  font-size: 10px;
}

.status-good .status-icon {
  color: var(--good);
}

.status-warn .status-icon {
  color: var(--warn);
}

.status-bad .status-icon {
  color: var(--bad);
}

.meter {
  position: relative;
  height: 8px;
  margin: 16px 0 8px;
  border-radius: 4px;
  background: rgba(201, 169, 97, 0.16);
}

.meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--w);
  border-radius: 4px;
  background: var(--gold);
}

.meter-mark {
  position: absolute;
  top: -5px;
  bottom: -5px;
  left: var(--x);
  width: 0;
  border-left: 2px solid var(--ink);
}

.meter-target {
  border-left: 2px dashed var(--ink-2);
}

.meter-key {
  margin-bottom: 0;
  font-size: 11.5px;
}

.key-tick {
  width: 0;
  height: 12px;
  border-left: 2px solid var(--key);
  background: none;
}

.key-tick-dash {
  width: 0;
  height: 12px;
  border-left: 2px dashed var(--key);
  background: none;
}

.hint {
  margin-top: 10px;
  color: var(--ink-3);
  font-size: 12px;
}

.tiles {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tile {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--hair);
  border-radius: 12px;
  background: var(--surface-2);
}

.tile-label {
  color: var(--ink-3);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tile-value {
  margin-top: 3px;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.tile-hint {
  color: var(--ink-3);
  font-size: 11.5px;
}

/* ---------------------------------------------------------------- panel 4: ad table */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 10px;
}

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.seg button {
  padding: 7px 12px;
  border: 1px solid var(--hair-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}

.seg button:hover {
  background: rgba(255, 240, 210, 0.05);
}

.seg button.on {
  border-color: var(--gold);
  background: var(--gold-wash);
  color: var(--ink);
  font-weight: 600;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  width: 34px;
  height: 20px;
  border: 1px solid var(--hair-strong);
  border-radius: 999px;
  background: var(--surface-3);
  transition: background 0.15s;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink-3);
  transition: transform 0.15s, background 0.15s;
}

.switch input:checked + .switch-track {
  border-color: var(--gold);
  background: var(--gold-wash);
}

.switch input:checked + .switch-track::after {
  background: var(--gold);
  transform: translateX(14px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.custom {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--hair);
}

.custom label {
  display: grid;
  gap: 3px;
  color: var(--ink-3);
  font-size: 11px;
}

.custom input {
  padding: 7px 9px;
  border: 1px solid var(--hair-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color-scheme: dark;
}

.range-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 10px;
}

.table-wrap {
  overflow-x: auto;
  margin: 0 calc(var(--pad) * -1);
  border-top: 1px solid var(--hair);
  -webkit-overflow-scrolling: touch;
}

.ads {
  width: 100%;
  font-size: 12.5px;
}

.ads th,
.ads td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--hair);
  white-space: nowrap;
}

.ads td {
  text-align: right;
}

.ads thead th {
  padding: 0;
  background: var(--surface);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 500;
  text-align: right;
}

.sort {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.sort:hover {
  color: var(--ink);
}

th[aria-sort] .sort {
  color: var(--gold);
}

.sort-arrow {
  width: 8px;
  font-size: 8px;
}

/* The ad's name stays put while the numbers scroll sideways. */
.ads .sticky {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 150px;
  min-width: 150px;
  max-width: 150px;
  padding-left: var(--pad);
  background: var(--surface);
  box-shadow: 1px 0 0 var(--hair-strong);
  font-weight: 400;
  text-align: left;
  white-space: normal;
}

.ads thead .sticky .sort {
  justify-content: flex-start;
  padding-left: var(--pad);
}

.ads thead .sticky {
  padding-left: 0;
}

.ad-name {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.3;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ad-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 6px;
  margin-top: 4px;
}

tr.ad {
  cursor: pointer;
}

tr.ad:hover td,
tr.ad:hover .sticky {
  background: var(--surface-2);
}

tr.ad:focus-visible {
  outline-offset: -2px;
}

tr.camp th,
tr.camp td,
tr.total th,
tr.total td {
  background: var(--surface-2);
  color: var(--ink-2);
  font-weight: 600;
}

tr.camp .sticky,
tr.total .sticky {
  background: var(--surface-2);
}

.camp-name {
  display: block;
  color: var(--ink);
  font-size: 11px;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.camp-count {
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 400;
}

.range {
  display: block;
  color: var(--ink-3);
  font-size: 10.5px;
  line-height: 1.2;
}

.ads td.early,
.ads td.early .range {
  color: var(--ink-3);
  font-weight: 400;
}

.empty {
  padding: 22px 0 8px;
  color: var(--ink-3);
  text-align: center;
}

/* ---------------------------------------------------------------- panel 5: ad detail */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.6);
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 21;
  overflow-y: auto;
  padding: var(--pad);
  padding-top: max(var(--pad), env(safe-area-inset-top));
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  background: var(--page);
  -webkit-overflow-scrolling: touch;
}

/* Laid flat in the page, for printing or capturing the whole sheet at once. */
.sheet.flat {
  position: static;
  overflow: visible;
}

.sheet-open {
  overflow: hidden;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.sheet-title {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.25;
  text-transform: none;
  overflow-wrap: anywhere;
}

.sheet-title::after {
  display: none;
}

.sheet-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 6px;
  color: var(--ink-3);
  font-size: 12px;
}

.trend-grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: minmax(0, 1fr);
}

.trend {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--hair);
  border-radius: 12px;
  background: var(--surface);
}

.trend-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 600;
}

.trend-title .muted {
  font-size: 11.5px;
  font-weight: 400;
}

.panel-box {
  padding: 12px;
  border: 1px solid var(--hair);
  border-radius: 12px;
  background: var(--surface);
}

.funnel {
  display: grid;
  gap: 12px;
}

.funnel-row {
  display: grid;
  gap: 4px 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.funnel-label {
  color: var(--ink-2);
  font-size: 12.5px;
}

.funnel-value {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.funnel-track {
  grid-column: 1 / -1;
  height: 14px;
}

.funnel-fill {
  display: block;
  width: var(--w);
  min-width: 2px;
  height: 100%;
  border-radius: 0 4px 4px 0;
  background: var(--step);
}

/* One hue, lighter to darker down the funnel: the order is in the colour. */
.step-1 {
  --step: var(--gold-bright);
}

.step-2 {
  --step: var(--gold);
}

.step-3 {
  --step: var(--gold-deep);
}

.step-4 {
  --step: var(--gold-dark);
}

/* ---------------------------------------------------------------- panel 6: formats */

.fmt-blocks {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr);
}

.fmt-block h3 {
  margin-top: 0;
}

.fmt-row {
  display: grid;
  gap: 2px 10px;
  grid-template-columns: 70px minmax(0, 1fr);
  align-items: start;
  padding: 7px 0;
  border-top: 1px solid var(--hair);
}

.bar-line {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) minmax(104px, auto);
  align-items: center;
  min-height: 20px;
}

.bar-track {
  display: flex;
  gap: 2px;
  height: 10px;
}

.bar-fill {
  width: var(--w);
  height: 100%;
  border-radius: 0 3px 3px 0;
  background-color: var(--fmt, var(--other));
}

.bar-fill.hatch {
  background-color: color-mix(in srgb, var(--fmt, var(--other)) 38%, transparent);
}

.bar-fill + .bar-fill {
  border-radius: 0 3px 3px 0;
}

.bar-fill:has(+ .bar-fill) {
  border-radius: 0;
}

.bar-val {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.bar-val small {
  display: block;
  color: var(--ink-3);
  font-size: 10.5px;
  line-height: 1.2;
}

.key-solid {
  width: 14px;
  height: 10px;
  border-radius: 2px;
  background: var(--ink-2);
}

/* ---------------------------------------------------------------- panel 7: heatmap */

.heat {
  display: grid;
  gap: 2px;
  grid-template-columns: 28px repeat(24, minmax(0, 1fr));
  align-items: center;
}

.heat-hour,
.heat-day {
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1;
}

.heat-hour {
  padding-bottom: 3px;
  white-space: nowrap;
}

.heat-cell {
  aspect-ratio: 1;
  min-height: 11px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: color-mix(in srgb, var(--gold) calc(var(--a) * 100%), var(--surface-3));
  cursor: pointer;
}

.heat-cell:hover,
.heat-cell:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 0;
}

.heat-scale {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--ink-3);
  font-size: 11.5px;
}

.heat-ramp {
  width: 96px;
  height: 8px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--surface-3), var(--gold));
}

.heat-readout {
  min-height: 1.45em;
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 12.5px;
}

/* ---------------------------------------------------------------- panel 8: tracking health */

.health {
  width: 100%;
  font-size: 12.5px;
}

.health th,
.health td {
  padding: 8px 8px 8px 0;
  border-bottom: 1px solid var(--hair);
  font-weight: 400;
  text-align: right;
  white-space: nowrap;
}

.health th:first-child,
.health td:first-child {
  text-align: left;
}

.health thead th {
  color: var(--ink-3);
  font-size: 11px;
}

.health tbody th {
  color: var(--ink);
}

.health .flagged td:last-child,
.health .flagged th:first-child {
  font-weight: 600;
}

.health .flagged {
  box-shadow: inset 3px 0 0 var(--bad);
}

.health .flagged th:first-child {
  padding-left: 9px;
}

.health-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.untrusted-days {
  margin-top: 12px;
}

.untrusted-days tbody th,
.untrusted-days td {
  color: var(--ink-3);
}

/* ---------------------------------------------------------------- login */

.login-body {
  display: grid;
  place-items: center;
  padding: 24px 18px;
}

.login {
  display: grid;
  gap: 22px;
  width: min(360px, 100%);
}

.brand-lg {
  align-items: center;
  text-align: center;
}

.brand-lg .brand-mark {
  font-size: 22px;
}

.brand-lg .brand-sub {
  margin-top: 4px;
  font-size: 11px;
}

.login-card {
  display: grid;
  gap: 10px;
  padding: 22px;
  border: 1px solid var(--hair-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.login-card label {
  color: var(--ink-3);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.login-card input {
  padding: 12px;
  border: 1px solid var(--hair-strong);
  border-radius: 10px;
  background: var(--page);
  font-size: 16px;
}

.login-card input:focus-visible {
  border-color: var(--gold);
  outline: 0;
}

.login-error {
  padding-left: 10px;
  border-left: 3px solid var(--bad);
  color: var(--ink);
  font-size: 13px;
}

.login-foot {
  color: var(--ink-3);
  font-size: 12px;
  text-align: center;
}

/* ---------------------------------------------------------------- wider screens */

@media (min-width: 640px) {
  :root {
    --gap: 16px;
    --pad: 20px;
  }

  .top {
    flex-wrap: nowrap;
    padding: 20px 24px 12px;
  }

  .top-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
  }

  .top-tools .sync {
    order: 0;
    flex-basis: auto;
    text-align: right;
  }

  .page {
    padding-right: 24px;
    padding-left: 24px;
  }

  .chart {
    height: 300px;
  }

  .tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ads .sticky {
    width: 210px;
    min-width: 210px;
    max-width: 210px;
  }

  .fmt-blocks,
  .trend-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .funnel-row {
    grid-template-columns: 170px minmax(0, 1fr) 190px;
  }

  .funnel-track {
    grid-column: auto;
    grid-row: 1;
    grid-column-start: 2;
  }

  .funnel-value {
    grid-column-start: 3;
  }
}

@media (min-width: 900px) {
  .today-grid {
    grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.6fr);
  }

  .tiles {
    align-content: stretch;
  }

  .tile {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .sheet {
    left: auto;
    width: min(880px, 94vw);
    border-left: 1px solid var(--hair-strong);
    box-shadow: -30px 0 60px rgba(0, 0, 0, 0.5);
  }

  .sheet.flat {
    margin-left: auto;
    box-shadow: none;
  }
}

@media (min-width: 1100px) {
  /* All nineteen columns fit a laptop screen without scrolling. */
  .ads th,
  .ads td {
    padding-right: 7px;
    padding-left: 7px;
  }

  .sort {
    padding-right: 7px;
    padding-left: 7px;
  }

  .page {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "today today"
      "orders share"
      "ads ads"
      "formats heat"
      "formats health";
    align-items: start;
  }

  .area-today {
    grid-area: today;
  }

  .area-orders {
    grid-area: orders;
  }

  .area-share {
    grid-area: share;
  }

  .area-ads {
    grid-area: ads;
  }

  .area-formats {
    grid-area: formats;
  }

  .area-heat {
    grid-area: heat;
  }

  .area-health {
    grid-area: health;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
