/* The production page. Its tokens are the app's (assets/css/colors.css,
   DESIGN.md): the same greys, the same violet for Capy, orange for what
   waits on a person, red for what failed. Kept by hand, since the tool
   shares no build with the app. */

@font-face {
  font-family: "Gabarito";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/fonts/gabarito-latin.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Gabarito";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/fonts/gabarito-latin-ext.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF,
    U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  --canvas: #efeff1;
  --frame: #f7f7f9;
  --surface: #ffffff;
  --sunken: #f3f3f6;
  --hover: #eeeef1;
  --selected: #e8e8ec;
  --line: #e6e6ea;
  --line-strong: #d3d3d9;
  --fg: #111114;
  --fg-2: #3d3d46;
  --fg-3: #6b6b76;
  --fg-4: #a1a1ab;
  --accent: #5e5ce6;
  --accent-soft: #eeedfd;
  --attn: #ea580c;
  --attn-fg: #c2410c;
  --attn-soft: #fff1e7;
  --neg: #dc2626;
  --neg-fg: #b91c1c;
  --neg-soft: #fdecec;
  --lift: 0 1px 2px rgb(17 17 20 / 0.08);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --canvas: #08080a;
    --frame: #0f0f12;
    --surface: #17171c;
    --sunken: #1d1d23;
    --hover: #232329;
    --selected: #2b2b32;
    --line: #28282f;
    --line-strong: #37373f;
    --fg: #f3f3f5;
    --fg-2: #c6c6ce;
    --fg-3: #8e8e99;
    --fg-4: #5b5b65;
    --accent: #7270f0;
    --accent-soft: #211f3e;
    --attn: #ff7a2e;
    --attn-fg: #ff9a5c;
    --attn-soft: #2b1a0e;
    --neg: #f05252;
    --neg-fg: #f87171;
    --neg-soft: #2a1212;
    --lift: 0 1px 2px rgb(0 0 0 / 0.4);
  }

  .logo-light { display: none; }
}

@media (prefers-color-scheme: light) {
  .logo-dark { display: none; }
}

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

html,
body {
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--canvas);
  color: var(--fg);
  font: 400 14px/1.45 "Gabarito", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, select { font: inherit; color: inherit; }

::selection {
  background: var(--accent-soft);
  color: var(--fg);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.mono {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
}

/* The frame: one panel over the canvas; it scrolls, the document does not. */
#shell {
  display: flex;
  height: 100%;
  padding: 8px;
}

#frame {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: clip;
  background: var(--frame);
  border: 1px solid var(--line);
  border-radius: 14px;
}

#bar {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-height: 48px;
  padding: 8px 24px;
}

#page {
  flex: 1;
  min-height: 0;
  overflow: hidden auto;
  overscroll-behavior-y: contain;
  padding: 12px 24px 32px;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: auto;
}

.crumbs img { height: 20px; width: auto; margin-right: 2px; }
.crumbs span { color: var(--fg-3); }
.crumbs b { font-weight: 500; }

.icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon.small { width: 14px; height: 14px; }
.crumbs .icon { color: var(--fg-4); }

.source {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--fg-3);
}

.source b { font-weight: 400; color: var(--fg-2); overflow-wrap: anywhere; }

.dot {
  display: inline-block;
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
}

.dot.ink { background: var(--fg); }

/* The key of a chart's outlined column, drawn as that column. */
.key-outline {
  display: block;
  width: 7px;
  height: 10px;
  border: 1px solid var(--fg-3);
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
}

.dot.accent { background: var(--accent); }
.dot.attn { background: var(--attn); }
.dot.neg { background: var(--neg); }

.with-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--fg-2);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms, color 150ms, scale 150ms;
}

a.btn { text-decoration: none; }
.btn:hover { background: var(--hover); color: var(--fg); }
.btn:active { scale: 0.96; }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn.square { width: 32px; padding: 0; }

@media (prefers-reduced-motion: no-preference) {
  .spinning { animation: spin 900ms linear infinite; }
}

@keyframes spin { to { rotate: 360deg; } }

.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.seg button {
  height: 28px;
  padding: 0 12px;
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--fg-3);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: color 150ms;
}

.seg button:hover { color: var(--fg); }

.seg button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--fg);
  box-shadow: var(--lift), 0 0 0 1px var(--line);
}

.select {
  height: 32px;
  max-width: 15rem;
  padding: 0 30px 0 10px;
  appearance: none;
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b6b76' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E")
    no-repeat right 8px center;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--fg-2);
  text-overflow: ellipsis;
  cursor: pointer;
}

.select:hover { background-color: var(--hover); }

/* The day */
.heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
}

.heading h1 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.heading p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-top: 4px;
  color: var(--fg-2);
}

.heading p .quiet { color: var(--fg-3); }
.heading nav { display: flex; gap: 6px; }

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.label {
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  color: var(--fg-3);
}

/* The path: five stages. At a desk they share their rows, so the figures,
   what became of them, what stands now and the columns line up across the
   stages; between a phone and a desk a stage sets its figure beside its
   columns; on a phone it is one column. */
.path {
  display: grid;
}

.heading + .panel { margin-top: 16px; }

.stage {
  display: grid;
  row-gap: 16px;
  min-width: 0;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.stage:last-child { border-bottom: 0; }

.stage-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stage-head h3 {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.stage-head .rule {
  flex: 1;
  min-width: 12px;
  height: 1px;
  background: var(--line-strong);
}

.stage-head .icon {
  display: none;
  margin-left: -6px;
  color: var(--fg-4);
}

.ring {
  display: grid;
  flex: none;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  color: var(--fg-2);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.ring.neg { background: var(--neg-soft); border-color: var(--neg); color: var(--neg-fg); }
.ring.attn { background: var(--attn-soft); border-color: var(--attn); color: var(--attn-fg); }

.figure b {
  display: block;
  font-size: 32px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
}

.figure p { font-size: 13px; color: var(--fg-3); }
.figure p:first-of-type { margin-top: 8px; color: var(--fg-2); }

/* A list of outcomes is one grid, so its counts share a column as wide as
   the widest of them and every label starts on the same edge. */
.outcomes {
  display: grid;
  grid-template-columns: 7px auto minmax(0, 1fr);
  column-gap: 8px;
  align-self: start;
  font-size: 13px;
}

.outcomes li {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  align-items: baseline;
  padding: 6px 0;
  color: var(--fg-2);
}

.outcomes li + li { border-top: 1px solid var(--line); }
.outcomes .dot { translate: 0 -1px; }
.outcomes .key-outline { translate: 0 1px; }
.outcomes b { font-weight: 600; text-align: right; color: var(--fg); }
.outcomes li.zero, .outcomes li.zero b { font-weight: 400; color: var(--fg-3); }
.outcomes small { display: block; font-size: 12px; color: var(--fg-3); overflow-wrap: anywhere; }

.now { align-self: start; }
.now .label { margin-bottom: 4px; }
/* What failed in the window stands under what stands now, a step apart. */
.now .window { margin-top: 8px; }
.now .none { padding: 6px 0; font-size: 13px; color: var(--fg-3); }

.chart { min-width: 0; }

.chart-top,
.chart-axis {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  line-height: 16px;
  color: var(--fg-3);
}

.chart-top { margin-bottom: 8px; }
.chart-axis { margin-top: 14px; }
.chart-top .readout { display: none; font-weight: 500; color: var(--fg); }
.chart.pointing .chart-top .rest { display: none; }
.chart.pointing .chart-top .readout { display: inline; }

.cols {
  --gap: 3px;
  display: flex;
  align-items: flex-end;
  gap: var(--gap);
  height: 64px;
  border-bottom: 1px solid var(--line);
}

.cols.tall { height: 96px; }
.cols.d30 { --gap: 2px; }
.cols.d90 { --gap: 1px; }

.col {
  position: relative;
  z-index: 0;
  display: flex;
  flex: 1;
  align-items: flex-end;
  justify-content: center;
  min-width: 0;
  height: 100%;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}

/* A day's slot: the whole pitch of its column, square, from above the chart
   through the axis, so it reads as a place on the axis and never as a
   column of its own. The chosen day also carries a dot under the axis. */
.col::before {
  content: "";
  position: absolute;
  inset: -6px calc(var(--gap) / -2) -11px;
  z-index: -1;
}

.col.on::before { background: var(--sunken); }
.col[aria-pressed="true"]::before { background: var(--selected); }

.col[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-top: 5px;
  translate: -50% 0;
  border-radius: 50%;
  background: var(--fg);
}

.bar {
  position: relative;
  display: flex;
  flex-direction: column-reverse;
  width: 100%;
  max-width: 24px;
  height: 100%;
  transform-origin: bottom;
}

.bar i {
  position: relative;
  display: block;
  min-height: 2px;
  background: var(--line-strong);
}

.bar i + i { border-top: 1px solid var(--surface); }
.bar i:last-child { border-radius: 4px 4px 0 0; }
.bar i.ink { background: var(--fg); }
.bar i.accent { background: var(--accent); }
.bar i.attn { background: var(--attn); }
.bar i.neg { background: var(--neg); }

.bar u {
  position: absolute;
  inset: auto 0 0;
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
}

/* A chart moves when its data does, and only then. */
@media (prefers-reduced-motion: no-preference) {
  .fresh .bar { animation: grow 420ms var(--ease) both; }
}

@keyframes grow { from { transform: scaleY(0); } }

/* Tables */
.disclosure { margin-top: 12px; }

.disclosure summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border-radius: 7px;
  color: var(--fg-2);
  font-size: 13px;
  font-weight: 500;
  list-style: none;
  cursor: pointer;
}

.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary:hover { color: var(--fg); }
.disclosure summary .icon { transition: rotate 150ms; }
.disclosure[open] summary .icon { rotate: 90deg; }
.disclosure .panel { margin-top: 8px; }

/* A table wider than its panel scrolls sideways, with a shadow at the edge
   that has more. */
.scroll {
  overflow-x: auto;
  border-radius: 9px;
  background:
    linear-gradient(to right, var(--surface) 30%, transparent) left / 40px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 30%, transparent) right / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgb(17 17 20 / 0.14), transparent) left / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgb(17 17 20 / 0.14), transparent) right / 12px 100% no-repeat scroll;
  background-color: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 8px 12px;
  font-weight: 400;
  text-align: right;
  vertical-align: top;
}

th:first-child, td:first-child { min-width: 11rem; padding-left: 20px; text-align: left; }
th:last-child, td:last-child { padding-right: 20px; }

thead th {
  background: var(--sunken);
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  color: var(--fg-3);
  vertical-align: bottom;
}

tbody tr { border-top: 1px solid var(--line); }
tbody th { color: var(--fg); }
td.none, td .none { color: var(--fg-3); }
td.strong { font-weight: 500; }
.failed { font-weight: 500; color: var(--neg-fg); }
tr.chosen { background: var(--selected); }

.numbers { min-width: 78rem; }
.numbers th:first-child, .numbers td:first-child { min-width: 0; padding-left: 12px; white-space: nowrap; }
.numbers tbody th { color: var(--fg-2); }
.numbers .groups th { background: var(--surface); color: var(--fg); font-size: 13px; font-weight: 600; text-align: left; padding-top: 10px; padding-bottom: 4px; }
.numbers .start { border-left: 1px solid var(--line); }

.part-bar {
  display: flex;
  gap: 1px;
  height: 6px;
  max-width: 14rem;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--sunken);
}

.part-bar i { display: block; min-width: 2px; background: var(--line-strong); }
.part-bar i.ink { background: var(--fg); }
.part-bar i.accent { background: var(--accent); }
.part-bar i.attn { background: var(--attn); }
.part-bar.share { display: block; max-width: none; }
.part-bar.share i { height: 100%; border-radius: 3px; }

.lower {
  display: grid;
  align-items: start;
  gap: 16px;
  margin-top: 32px;
}

.lower + .lower { margin-top: 16px; }

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 8px;
  padding: 16px 20px 12px;
}

.panel-head h2,
.accounts h2,
.spend h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panel-head .count { color: var(--fg-3); }
.panel-head .window { margin-left: auto; font-size: 13px; color: var(--fg-3); }
.panel-head + .scroll,
.spend-top + .scroll {
  border-top: 1px solid var(--line);
  border-radius: 0 0 9px 9px;
}
.panel .more { padding: 12px 20px; border-top: 1px solid var(--line); }

.panel .empty { padding: 16px 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--fg-3); }

.spend-top {
  display: grid;
  gap: 16px 32px;
  padding: 16px 20px 20px;
}

.spend-top .total {
  margin-top: 12px;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.spend-top .quiet { font-size: 13px; color: var(--fg-3); }

.spend-top dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  margin-top: 12px;
  font-size: 13px;
}

.spend-top dt { color: var(--fg-3); }
.spend-source small { margin-left: 6px; font-size: 13px; color: var(--fg-3); }

.org a {
  color: var(--fg);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

.org a:hover { text-decoration-color: var(--fg); }
.org small { display: block; font-size: 12px; color: var(--fg-3); }
.orgs td, .orgs tbody th { padding-top: 10px; padding-bottom: 10px; }
.orgs td { white-space: nowrap; }

.accounts { margin-top: 32px; }
.accounts h2 { margin-bottom: 12px; }

.accounts dl {
  display: grid;
  gap: 1px;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.accounts dl > div { padding: 16px 20px; background: var(--surface); }
.accounts dd.value { margin-top: 6px; font-size: 24px; font-weight: 600; line-height: 1.25; letter-spacing: -0.015em; }
.accounts dd.note { margin-top: 4px; font-size: 13px; color: var(--fg-3); }
.accounts dd.note.attn { color: var(--fg-2); }

.reading,
.unread {
  padding: 20px;
}

.reading {
  display: grid;
  place-items: center;
  min-height: 16rem;
  font-size: 13px;
  color: var(--fg-3);
}

.reading.tall { min-height: 26rem; margin-top: 16px; }
.unread b { font-weight: 600; }
.unread p { max-width: 75ch; margin: 4px 0 12px; color: var(--fg-2); overflow-wrap: anywhere; }

@media (min-width: 40rem) {
  .accounts dl { grid-template-columns: repeat(2, 1fr); }
  .spend-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
}

@media (min-width: 40rem) and (max-width: 63.99rem) {
  .stage {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 32px;
  }

  .stage-head { grid-column: 1 / -1; }
  .figure { grid-area: 2 / 1; }
  .chart { grid-area: 2 / 2; }
  .stage > .outcomes { grid-area: 3 / 1; }
  .now { grid-area: 3 / 2; }
}

@media (min-width: 64rem) {
  .path {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: auto auto 1fr auto auto;
  }

  .stage {
    grid-row: span 5;
    grid-template-rows: subgrid;
    padding: 20px 16px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .stage:last-child { border-right: 0; }
  .stage-head .icon { display: block; }
  .accounts dl { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 80rem) {
  .stage { padding: 20px; }
  .lower { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 39.99rem) {
  #bar { padding: 8px 12px; }
  #page { padding: 12px 16px 24px; }
  .source { order: 3; width: 100%; }
}
