/* The design system: every colour, size and spacing of the page is one of
   these properties (docs/design-system.md). Colour has three meanings:
   amber is "my place", green is "in my list", red is "wrong or stale". */
:root {
  --ink: #1f1c18;
  --ink-2: #6a645a;
  --ink-3: #a59e92;
  --ink-4: #cdc6b9;
  --surface: #ffffff;
  --chrome: #f5f3ee;
  --desk: #e6e2da;
  --line: #ece8e0;
  --line-strong: #d3cdc1;
  --hover: #f8f6f2;
  --child: #faf9f5;
  --button-hover: #e9e5dc;
  --pill: #e7e3da;
  /* --amber and --amber-wash are repeated in `amber` of
     src/clj/afruits/body_page.clj, the mark in the body of an email. */
  --amber: #ff7020;
  --amber-ink: #b3470a;
  --amber-wash: #fff0e2;
  --amber-ring: rgba(255, 112, 32, 0.25);
  --green: #1f7a4a;
  --green-wash: #e3f2e8;
  --green-wash-hover: #cfe8d8;
  --red: #b3261e;
  --red-wash: #fdecea;
  --on-dark: #ffffff;
  --shadow: rgba(31, 28, 24, 0.3);

  /* Every size of the page is a multiple of --u, a pixel at the default
     text size; the text size switch sets --scale (1, 16/14 or 18/14).
     The height of a row, --row-h, is set by the table, which needs the
     same number for the rows it draws. */
  --scale: 1;
  --u: calc(var(--scale) * 1px);

  --font: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --size-cell: calc(14 * var(--u));
  --size-price: calc(14.5 * var(--u));
  --size-secondary: calc(13 * var(--u));
  --size-heading: calc(13 * var(--u));
  --size-tab: calc(15 * var(--u));
  --size-footer: calc(12.5 * var(--u));
  --size-key-cap: calc(15 * var(--u));
  --size-key-symbol: calc(19 * var(--u));

  --head-h: calc(30 * var(--u));
  --bar-h: calc(48 * var(--u));
  --foot-h: calc(26 * var(--u));
  --cell-pad: calc(8 * var(--u));
  --icon-button-w: calc(23 * var(--u));
  --icon-button-h: calc(22 * var(--u));
  --chevron-w: calc(17 * var(--u));
  --icon: calc(15 * var(--u));
  --price-tail: calc(58 * var(--u));
  --radius: calc(6 * var(--u));
  --key-cap: calc(32 * var(--u));
  --window-margin: calc(24 * var(--u));
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  font: var(--size-cell)/1.3 var(--font);
  color: var(--ink);
  background: var(--surface);
  font-variant-numeric: tabular-nums lining-nums;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: calc(2 * var(--u)) solid var(--amber);
  outline-offset: 1px;
}

#app {
  height: 100%;
}

.icon {
  width: var(--icon);
  height: var(--icon);
  flex: none;
}

.page {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* The top bar, one line: tabs, the tools of the tab, the reminder of the
   keys and the profile */
.bar {
  flex: none;
  display: flex;
  align-items: stretch;
  gap: calc(20 * var(--u));
  height: var(--bar-h);
  padding: 0 calc(14 * var(--u)) 0 calc(6 * var(--u));
  background: var(--chrome);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}

.tabs {
  display: flex;
  align-items: stretch;
}

.tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: calc(7 * var(--u));
  padding: 0 calc(12 * var(--u));
  border: none;
  background: none;
  color: var(--ink-2);
  font-size: var(--size-tab);
  cursor: pointer;
}

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

.tab.current {
  color: var(--ink);
  font-weight: 600;
}

.tab.current::after {
  content: "";
  position: absolute;
  left: calc(12 * var(--u));
  right: calc(12 * var(--u));
  bottom: -1px;
  height: calc(3 * var(--u));
  background: var(--amber);
}

.count {
  min-width: calc(20 * var(--u));
  padding: 0 calc(6 * var(--u));
  border-radius: calc(9 * var(--u));
  background: var(--pill);
  color: var(--ink-2);
  font-size: var(--size-footer);
  font-weight: 600;
  line-height: calc(18 * var(--u));
  text-align: center;
}

.count.listed {
  background: var(--green);
  color: var(--on-dark);
}

.count.wrong {
  background: var(--red);
  color: var(--on-dark);
}

.count.plain {
  min-width: 0;
  padding: 0;
  background: none;
  color: var(--ink-3);
  font-weight: 400;
}

.new-dot {
  width: calc(7 * var(--u));
  height: calc(7 * var(--u));
  border-radius: 50%;
  background: var(--red);
}

/* The tools take the space between the tabs and the buttons at the right
   end, and the search takes all of it that the other tools leave. It
   gives way first, down to a width that shows a word of ten letters
   whole. Below that the labels of the switch of size groups and of the
   clearing of the short list leave the bar for their tooltips
   (`.bar.tight`), when the page finds that the parts of the tools no
   longer fit in them. */
.tools {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: calc(16 * var(--u));
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 0;
  min-width: calc(150 * var(--u));
}

.search .icon {
  position: absolute;
  left: calc(9 * var(--u));
  color: var(--ink-3);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: calc(30 * var(--u));
  padding: 0 calc(4 * var(--u)) 0 calc(30 * var(--u));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit;
  color: var(--ink);
  outline: none;
}

.search input::placeholder {
  color: var(--ink-3);
}

.search input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 calc(2 * var(--u)) var(--amber-ring);
}

.switch {
  --label-gap: calc(8 * var(--u));
  position: relative;
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--label-gap);
  cursor: pointer;
  user-select: none;
}

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

.switch .track {
  position: relative;
  width: calc(30 * var(--u));
  height: calc(18 * var(--u));
  border-radius: calc(9 * var(--u));
  background: var(--ink-4);
  transition: background 120ms;
}

.switch .track::after {
  content: "";
  position: absolute;
  top: calc(2 * var(--u));
  left: calc(2 * var(--u));
  width: calc(14 * var(--u));
  height: calc(14 * var(--u));
  border-radius: 50%;
  background: var(--surface);
  transition: transform 120ms;
}

.switch input:checked + .track {
  background: var(--ink);
}

.switch input:checked + .track::after {
  transform: translateX(calc(12 * var(--u)));
}

.switch input:focus-visible + .track {
  box-shadow: 0 0 0 calc(2 * var(--u)) var(--amber-ring);
}

/* The clearing of the short list in the top bar: a bin and its words,
   which leave a tight bar as the label of the switch does */
.clear-list-button {
  --label-gap: calc(6 * var(--u));
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--label-gap);
}

/* A label of a control of a tight bar: of no width, its gap taken back,
   but still measured by the page, so that the bar knows when it fits
   again */
.bar.tight .bar-label {
  max-width: 0;
  margin-left: calc(-1 * var(--label-gap));
  overflow: hidden;
}

.quiet-button {
  height: calc(28 * var(--u));
  padding: 0 calc(10 * var(--u));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.quiet-button:hover {
  border-color: var(--ink-2);
}

/* The day and the time of the last answer, at the right end of the footer */
.status {
  display: flex;
  flex: none;
  align-items: center;
  margin-left: auto;
  gap: calc(7 * var(--u));
  color: var(--ink-2);
}

.status .dot {
  width: calc(8 * var(--u));
  height: calc(8 * var(--u));
  border-radius: 50%;
  background: var(--green);
}

.status b {
  font-weight: 600;
  color: var(--ink);
}

.status.stale,
.status.stale b {
  color: var(--red);
}

.status.stale .dot {
  background: var(--red);
}

/* Why the new emails are not being read, before the window and the time */
.status .mail-problem {
  margin-right: calc(10 * var(--u));
  font-weight: 600;
  color: var(--red);
}

.text-size-switch {
  display: flex;
  align-items: center;
}

.text-size {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: calc(22 * var(--u));
  height: calc(26 * var(--u));
  padding: 0 0 calc(3 * var(--u));
  border: none;
  border-radius: var(--radius);
  background: none;
  color: var(--ink-2);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.text-size:hover {
  color: var(--ink);
  background: var(--button-hover);
}

.text-size.current {
  color: var(--ink);
  box-shadow: inset 0 calc(-2 * var(--u)) 0 var(--amber);
}

.language-switch {
  display: flex;
  align-items: center;
}

.language {
  height: calc(26 * var(--u));
  padding: 0 calc(8 * var(--u));
  border: 1px solid var(--line-strong);
  margin-left: -1px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--size-footer);
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.language:first-child {
  margin-left: 0;
  border-radius: var(--radius) 0 0 var(--radius);
}

.language:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.language.current {
  position: relative;
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-dark);
}

/* The sign-in: a narrow form in the middle of the page */
.sign-in-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--chrome);
}

.sign-in-bar {
  display: flex;
  justify-content: flex-end;
  padding: calc(11 * var(--u)) calc(14 * var(--u));
}

.sign-in-form {
  display: flex;
  flex-direction: column;
  gap: calc(14 * var(--u));
  width: calc(340 * var(--u));
  margin: calc(80 * var(--u)) auto 0;
  padding: calc(24 * var(--u));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.sign-in-form h1 {
  margin: 0;
  font-size: var(--size-tab);
  font-weight: 600;
}

.sign-in-form .field {
  display: flex;
  flex-direction: column;
  gap: calc(5 * var(--u));
  color: var(--ink-2);
}

.sign-in-form input {
  height: calc(32 * var(--u));
  padding: 0 calc(8 * var(--u));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit;
  color: var(--ink);
  outline: none;
}

.sign-in-form input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 calc(2 * var(--u)) var(--amber-ring);
}

.sign-in-message {
  margin: 0;
  color: var(--red);
}

.sign-in-button {
  height: calc(32 * var(--u));
  border: none;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--on-dark);
  font-weight: 600;
  cursor: pointer;
}

.sign-in-button:disabled {
  background: var(--ink-3);
  cursor: default;
}

/* Lines under the bar: loading, a failure, the stale table, the list not kept */
.status-line {
  flex: none;
  padding: calc(7 * var(--u)) calc(14 * var(--u));
  color: var(--ink-2);
}

.status-line.failed {
  color: var(--red);
}

.status-line.stale {
  background: var(--red);
  color: var(--on-dark);
  font-weight: 600;
}

/* The table, and the panel of the original beside it */
.work {
  flex: 1;
  display: flex;
  min-height: 0;
}

.table-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.table {
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  contain: strict;
}

.table-head,
.table-row {
  display: grid;
  width: 100%;
}

.table-head {
  position: sticky;
  top: 0;
  z-index: 1;
  height: var(--head-h);
  background: var(--chrome);
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink-2);
  font-size: var(--size-heading);
  font-weight: 600;
}

.head-cell {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 0 var(--cell-pad);
  background: var(--chrome);
}

/* The icon buttons and the product stay in place when the table scrolls
   sideways; the other columns pass under them. */
.cell.pinned,
.head-cell.pinned {
  position: sticky;
  z-index: 1;
  left: var(--actions-w);
  background: var(--row-bg);
}

.cell.actions.pinned,
.head-cell.actions.pinned {
  left: 0;
}

.head-cell.pinned {
  z-index: 4;
  background: var(--chrome);
}

.scrolled-sideways .cell.pinned:not(.actions),
.scrolled-sideways .head-cell.pinned:not(.actions) {
  box-shadow: calc(6 * var(--u)) 0 calc(6 * var(--u)) calc(-6 * var(--u)) var(--shadow);
}

/* The right edge of a heading, dragged to change the width of its column */
.resize-handle {
  position: absolute;
  top: 0;
  right: calc(-4 * var(--u));
  z-index: 3;
  width: calc(9 * var(--u));
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.resize-handle::after {
  content: "";
  position: absolute;
  top: calc(7 * var(--u));
  bottom: calc(7 * var(--u));
  left: calc(4 * var(--u));
  width: 1px;
  background: var(--line-strong);
}

.resize-handle:hover::after,
.resize-handle.dragging::after {
  top: 0;
  bottom: 0;
  left: calc(3 * var(--u));
  width: calc(2 * var(--u));
  background: var(--amber);
}

body.resizing-column {
  cursor: col-resize;
  user-select: none;
}

.head-cell.number {
  justify-content: flex-end;
}

.head-cell.sortable {
  padding: 0;
}

.head-cell .label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sort {
  display: flex;
  align-items: center;
  gap: calc(3 * var(--u));
  min-width: 0;
  height: 100%;
  padding: 0 var(--cell-pad);
  border: none;
  background: none;
  font-weight: 600;
  cursor: pointer;
}

.sort .icon {
  width: calc(13 * var(--u));
  height: calc(13 * var(--u));
  visibility: hidden;
}

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

.sort:hover .icon {
  visibility: visible;
  color: var(--ink-3);
}

.head-cell.sorted .sort {
  color: var(--ink);
}

.head-cell.sorted .sort .icon {
  visibility: visible;
  color: var(--amber-ink);
}

.grouped .head-cell.price .sort {
  padding-right: calc(var(--price-tail) + calc(4 * var(--u)));
}

.head-cell.unit .sort {
  padding: 0 calc(4 * var(--u));
}

.head-cell.unit .sort .icon {
  display: none;
}

.head-cell.unit.sorted .sort .icon {
  display: block;
}

.table-row {
  --row-bg: var(--surface);
  position: absolute;
  left: 0;
  top: 0;
  height: var(--row-h);
  background: var(--row-bg);
  border-bottom: 1px solid var(--line);
}

.table-row.static {
  position: relative;
}

.table-row:hover {
  --row-bg: var(--hover);
}

.table-row.in-group {
  --row-bg: var(--child);
}

.table-row.run-end {
  border-bottom-color: var(--line-strong);
}

/* A row whose offers are all in the short list; the cursor row keeps its
   own colour */
.table-row:has(.icon-button.listed):not(.cursor) {
  --row-bg: var(--green-wash);
}

/* The cursor row, which the keys act on */
.table-row.cursor,
.table-row.cursor:hover {
  --row-bg: var(--amber-wash);
}

/* Grey bars in place of the rows while the offers load */
.table-row.placeholder,
.table-row.placeholder:hover {
  --row-bg: var(--surface);
}

.table-row.placeholder .cell.price {
  align-items: center;
}

.table-row.placeholder .bar {
  display: inline-block;
  height: calc(9 * var(--u));
  border-radius: calc(3 * var(--u));
  background: var(--line);
  vertical-align: middle;
}

/* The emails of the window under the left-out offers: those not read
   and those of unknown senders. The block scrolls on its own, so that
   the table above keeps its rows. */
.emails-block {
  flex: none;
  max-height: 40%;
  overflow: auto;
  border-top: 1px solid var(--line-strong);
  background: var(--chrome);
  padding: calc(4 * var(--u)) calc(14 * var(--u)) calc(10 * var(--u));
}

.emails-section h2 {
  margin: calc(8 * var(--u)) 0 calc(2 * var(--u));
  font-size: var(--size-tab);
  font-weight: 600;
}

.emails-section.not-read h2 {
  color: var(--red);
}

.emails-hint {
  margin: 0 0 calc(4 * var(--u));
  color: var(--ink-2);
  font-size: var(--size-secondary);
}

.emails-section table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--size-cell);
}

.emails-section th {
  padding: calc(3 * var(--u)) var(--cell-pad);
  color: var(--ink-2);
  font-size: var(--size-heading);
  font-weight: 600;
  text-align: left;
  border-bottom: 1px solid var(--line-strong);
}

.emails-section td {
  padding: calc(3 * var(--u)) var(--cell-pad);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.emails-section .date,
.emails-section .number,
.emails-section .open {
  width: 1%;
  white-space: nowrap;
}

.emails-section .number {
  text-align: right;
}

/* A sentence in place of the rows: no lists today, nothing found */
.table-message {
  position: sticky;
  left: 0;
  max-width: calc(560 * var(--u));
  margin: calc(72 * var(--u)) auto 0;
  padding: 0 calc(24 * var(--u));
  text-align: center;
  color: var(--ink-2);
  font-size: var(--size-tab);
}

.table-message strong {
  display: block;
  margin-bottom: calc(6 * var(--u));
  color: var(--ink);
  font-size: calc(18 * var(--u));
  font-weight: 600;
}

.table-message p {
  margin: calc(6 * var(--u)) 0 0;
}

.table-message .quiet-button {
  margin-top: calc(8 * var(--u));
}

.link-button {
  padding: 0;
  border: none;
  background: none;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: calc(3 * var(--u));
  cursor: pointer;
}

.link-button:hover {
  text-decoration-thickness: calc(2 * var(--u));
}

/* The table is one stop of Tab; the cursor row shows where the focus is */
.table:focus-visible {
  outline: none;
}

/* The row whose original was opened last */
.table-row.last-opened .cell.actions::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: calc(3 * var(--u));
  background: var(--amber);
}

.cell {
  min-width: 0;
  padding: 0 var(--cell-pad);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  line-height: calc(var(--row-h) - 1px);
}

.cell.number {
  text-align: right;
}

.in-group .cell.shared {
  color: var(--ink-3);
}

.cell.unit {
  padding-left: calc(4 * var(--u));
  color: var(--ink-2);
  font-size: var(--size-secondary);
}

.cell.price {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  padding-right: calc(4 * var(--u));
  font-size: var(--size-price);
}

.price-number {
  font-weight: 600;
}

.price-text {
  color: var(--ink-2);
  font-size: var(--size-secondary);
}

.price-tail {
  flex: none;
  width: 0;
  overflow: hidden;
  color: var(--ink-2);
  font-size: var(--size-secondary);
  text-align: left;
}

.grouped .price-tail {
  width: var(--price-tail);
  padding-left: calc(5 * var(--u));
}

.product-word {
  margin-left: calc(7 * var(--u));
  color: var(--ink-2);
  font-size: var(--size-secondary);
}

.in-group .cell.shared .product-word {
  color: var(--ink-3);
}

.size-count {
  margin-left: calc(6 * var(--u));
  color: var(--ink-3);
  font-size: var(--size-footer);
}

.list-marked-error {
  color: var(--red);
  font-weight: 600;
}

/* Icon buttons of a row */
.cell.actions {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 0 calc(4 * var(--u)) 0 calc(7 * var(--u));
  overflow: visible;
}

.cell.actions .action {
  display: contents;
}

.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--icon-button-w);
  height: var(--icon-button-h);
  padding: 0;
  border: none;
  border-radius: calc(5 * var(--u));
  background: none;
  color: var(--ink-2);
  cursor: pointer;
}

.icon-button:hover {
  background: var(--button-hover);
  color: var(--ink);
}

.icon-button.chevron {
  width: var(--chevron-w);
}

.icon-button.chevron .icon {
  width: calc(14 * var(--u));
  height: calc(14 * var(--u));
}

.icon-button.none {
  visibility: hidden;
}

.icon-button.listed {
  background: var(--green-wash);
  color: var(--green);
}

.icon-button.listed:hover {
  background: var(--green-wash-hover);
  color: var(--green);
}

.icon-button.partly {
  color: var(--green);
}

.cell.end-action {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: visible;
}

.icon-button.mark-error {
  color: var(--ink-4);
}

.table-row:hover .icon-button.mark-error,
.table-row.cursor .icon-button.mark-error {
  color: var(--ink-2);
}

.table-row .icon-button.mark-error:hover {
  background: var(--red-wash);
  color: var(--red);
}

.icon-button[aria-pressed="true"] {
  color: var(--amber-ink);
}

/* The panel of the original */
.panel-edge {
  position: relative;
  flex: none;
  width: calc(7 * var(--u));
  margin: 0 calc(-3 * var(--u));
  z-index: 2;
  cursor: col-resize;
  touch-action: none;
}

.panel-edge::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(3 * var(--u));
  width: 1px;
  background: var(--line-strong);
}

.panel-edge:hover::after,
body.resizing-panel .panel-edge::after {
  left: calc(2 * var(--u));
  width: calc(3 * var(--u));
  background: var(--amber);
}

body.resizing-panel {
  cursor: col-resize;
  user-select: none;
}

/* A frame under the pointer would take the drag away from the edge. */
body.resizing-panel .document {
  pointer-events: none;
}

.panel {
  flex: none;
  display: flex;
  flex-direction: column;
  min-width: calc(380 * var(--u));
  max-width: calc(100% - 420 * var(--u));
  background: var(--desk);
}

.panel-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: calc(4 * var(--u));
  height: var(--head-h);
  padding: 0 calc(6 * var(--u)) 0 calc(12 * var(--u));
  background: var(--chrome);
  border-bottom: 1px solid var(--line-strong);
  font-size: var(--size-heading);
  white-space: nowrap;
}

.panel-document {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink-2);
}

.panel-document b {
  margin-right: calc(6 * var(--u));
  color: var(--ink);
  font-weight: 600;
}

.panel-kind {
  margin: 0 calc(4 * var(--u));
  color: var(--ink-2);
}

.panel-separator {
  width: 1px;
  height: calc(16 * var(--u));
  margin: 0 calc(4 * var(--u));
  background: var(--line-strong);
}

/* The zoom of a PDF: smaller, the percent as plain text of the heading,
   and larger. */
.zoom {
  display: flex;
  align-items: center;
  gap: calc(4 * var(--u));
}

.zoom-percent {
  color: var(--ink-2);
}

.as-read {
  flex: none;
  max-height: 45%;
  overflow: auto;
  padding: calc(10 * var(--u)) calc(14 * var(--u)) calc(12 * var(--u));
  background: var(--surface);
  border-bottom: 1px solid var(--line-strong);
}

.read-top {
  display: flex;
  align-items: baseline;
  gap: calc(12 * var(--u));
}

.read-product {
  flex: 1;
  min-width: 0;
  font-size: calc(17 * var(--u));
  font-weight: 600;
}

.read-product .product-word {
  margin-left: calc(8 * var(--u));
  font-size: var(--size-cell);
  font-weight: 400;
}

.read-price {
  font-size: calc(22 * var(--u));
  font-weight: 700;
  white-space: nowrap;
}

.read-price small {
  margin-left: calc(5 * var(--u));
  color: var(--ink-2);
  font-size: var(--size-cell);
  font-weight: 400;
}

.read-fields {
  display: flex;
  flex-wrap: wrap;
  gap: calc(3 * var(--u)) calc(18 * var(--u));
  margin: calc(6 * var(--u)) 0 0;
}

.read-fields div {
  display: flex;
  gap: calc(6 * var(--u));
}

.read-fields dt {
  color: var(--ink-3);
}

.read-fields dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.read-actions {
  display: flex;
  gap: calc(8 * var(--u));
  margin-top: calc(10 * var(--u));
}

.read-actions .quiet-button {
  display: flex;
  align-items: center;
  gap: calc(6 * var(--u));
}

.read-actions .quiet-button.listed {
  border-color: var(--green);
  background: var(--green-wash);
  color: var(--green);
}

.read-actions .read-wrong {
  margin-left: auto;
  color: var(--ink-2);
}

.read-actions .read-wrong:hover {
  border-color: var(--red);
  background: var(--red-wash);
  color: var(--red);
}

.document-desk {
  flex: 1;
  display: flex;
  min-height: 0;
}

.document {
  flex: 1;
  width: 100%;
  border: none;
}

.document.page {
  background: var(--surface);
}

/* The room of the scroll bars stays, so that a picture fitted to the
   width does not change its size when it grows taller than the view. */
.document.picture {
  overflow: auto;
  scrollbar-gutter: stable;
  padding: calc(18 * var(--u));
}

/* Its width is the zoom, set by the page. */
.document.picture img {
  display: block;
  max-width: none;
  margin: 0 auto;
  background: var(--surface);
  box-shadow: 0 1px 3px var(--shadow);
}

/* A PDF drawn by PDF.js, whose viewer scrolls an element placed
   absolutely and styles its pages with pdfjs/pdf_viewer.css. */
.document.pdf {
  position: relative;
  min-width: 0;
}

.pdf-scroller {
  position: absolute;
  inset: 0;
  overflow: auto;
}

/* The page of the table is also .page; the pages of a PDF keep their own
   layout. */
.pdfViewer .page {
  display: block;
}

/* The line an offer was read from, marked over the drawn page, and its
   value marked stronger. The wash is multiplied into the page, so the
   print shows through it; the marks take no pointer, so the text under
   them can still be selected. */
.offer-mark {
  position: absolute;
  pointer-events: none;
}

/* The bar stands just left of the first word, the wash reaches it. */
.offer-mark-line {
  --bar: calc(3 * var(--u));
  --gap: calc(4 * var(--u));
  box-sizing: content-box;
  margin-left: calc(-1 * (var(--bar) + var(--gap)));
  padding-left: var(--gap);
  border-left: var(--bar) solid var(--amber);
  background: var(--amber-wash);
  mix-blend-mode: multiply;
}

.offer-mark-value {
  outline: calc(2 * var(--u)) solid var(--amber);
  outline-offset: calc(1 * var(--u));
}

.original-missing {
  margin: calc(48 * var(--u)) auto 0;
  text-align: center;
  color: var(--ink-2);
  font-size: var(--size-tab);
}

.document .try-again {
  display: block;
  margin: calc(12 * var(--u)) auto 0;
}

/* The footer: the counts of the tab, and the day with the time of the
   last answer */
.foot {
  flex: none;
  display: flex;
  align-items: center;
  gap: calc(18 * var(--u));
  height: var(--foot-h);
  padding: 0 calc(12 * var(--u));
  border-top: 1px solid var(--line-strong);
  background: var(--chrome);
  color: var(--ink-2);
  font-size: var(--size-footer);
  white-space: nowrap;
  overflow: hidden;
}

.foot b {
  color: var(--ink);
  font-weight: 600;
}


/* The buttons of the reminder of the keys and of the profile, at the
   right end of the top bar */
.key-help-button,
.profile-button {
  flex: none;
  align-self: center;
  width: calc(26 * var(--u));
  height: calc(26 * var(--u));
}

.key-help-button .icon,
.profile-button .icon {
  width: calc(18 * var(--u));
  height: calc(18 * var(--u));
}

.profile {
  position: relative;
  display: flex;
  flex: none;
}

.profile-button.open {
  background: var(--button-hover);
  color: var(--ink);
}

/* The menu of the profile, under its button, its right edge on the
   button's */
.profile-menu {
  position: absolute;
  top: calc(100% + 4 * var(--u));
  right: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: calc(12 * var(--u));
  min-width: calc(220 * var(--u));
  padding: calc(14 * var(--u));
  border: 1px solid var(--line-strong);
  border-radius: calc(8 * var(--u));
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 calc(6 * var(--u)) calc(24 * var(--u)) var(--shadow);
  white-space: nowrap;
}

.profile-email {
  padding-bottom: calc(10 * var(--u));
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
}

.profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(16 * var(--u));
}

.profile-sign-out {
  display: flex;
  flex-direction: column;
  gap: calc(8 * var(--u));
}

.profile-link {
  color: var(--ink);
}

.profile-link:hover {
  color: var(--amber-ink);
}

.sign-out-failed {
  white-space: normal;
  color: var(--red);
}

/* The reminder of the keys: a window over the dimmed page, one column of
   key caps with the name of each line next to them */
.key-help {
  max-width: calc(100vw - 2 * var(--window-margin));
  max-height: calc(100vh - 2 * var(--window-margin));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: calc(10 * var(--u));
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 calc(12 * var(--u)) calc(40 * var(--u)) var(--shadow);
  overflow: hidden;
}

.key-help[open] {
  display: flex;
  flex-direction: column;
}

.key-help::backdrop {
  background: var(--shadow);
}

.key-help-content {
  min-height: 0;
  padding: 0 calc(28 * var(--u)) calc(24 * var(--u));
  overflow: auto;
}

.key-help-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(24 * var(--u));
  padding: calc(18 * var(--u)) 0 calc(4 * var(--u));
  background: var(--surface);
}

.key-help-head h2 {
  margin: 0;
  font-size: var(--size-tab);
  font-weight: 600;
}

/* One grid for the whole window, so that the caps of every section stand
   in one column */
.key-help-sections {
  display: grid;
  grid-template-columns: max-content max-content;
  column-gap: calc(20 * var(--u));
}

.key-help-section,
.key-help-section ul,
.key-help-section li {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
}

.key-help-section h3 {
  grid-column: 1 / -1;
  margin: calc(18 * var(--u)) 0 calc(8 * var(--u));
  color: var(--ink-2);
  font-size: var(--size-heading);
  font-weight: 600;
}

.key-help-section ul {
  row-gap: calc(8 * var(--u));
  margin: 0;
  padding: 0;
  list-style: none;
}

.key-help-section li {
  align-items: center;
}

.key-help .key-caps {
  display: flex;
  gap: calc(14 * var(--u));
}

.key-help .combination {
  display: flex;
  gap: calc(5 * var(--u));
}

.key-help kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--key-cap);
  height: var(--key-cap);
  margin: 0;
  padding: 0 calc(10 * var(--u));
  border: 1px solid var(--line-strong);
  border-bottom-width: calc(3 * var(--u));
  border-radius: calc(7 * var(--u));
  background: var(--chrome);
  font: inherit;
  font-size: var(--size-key-cap);
  font-weight: 600;
  line-height: 1;
}

/* The arrows of the font are small for their size */
.key-help kbd.square {
  width: var(--key-cap);
  padding: 0;
  font-size: var(--size-key-symbol);
}

.key-name {
  font-size: var(--size-tab);
}

.key-name::first-letter {
  text-transform: uppercase;
}

/* The line that offers to undo a mark */
.mark-notice {
  position: fixed;
  left: 50%;
  bottom: calc(44 * var(--u));
  z-index: 3;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: calc(14 * var(--u));
  padding: calc(9 * var(--u)) calc(10 * var(--u)) calc(9 * var(--u)) calc(16 * var(--u));
  border-radius: calc(8 * var(--u));
  background: var(--ink);
  color: var(--on-dark);
  box-shadow: 0 calc(6 * var(--u)) calc(24 * var(--u)) var(--shadow);
  overflow: hidden;
}

.mark-notice.failed {
  background: var(--red);
}

/* What a mark shows first: the offer, the field where the person may say
   what is wrong with it, and the two ways on. It stays until one is taken */
.mark-notice.describing {
  flex-direction: column;
  align-items: stretch;
  gap: calc(10 * var(--u));
  width: calc(520 * var(--u));
  padding: calc(14 * var(--u)) calc(16 * var(--u));
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.mark-note {
  padding: calc(8 * var(--u)) calc(10 * var(--u));
  border: 1px solid var(--line-strong);
  border-radius: calc(5 * var(--u));
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  line-height: 1.4;
  resize: vertical;
}

.mark-note-actions {
  display: flex;
  justify-content: flex-end;
  gap: calc(10 * var(--u));
}

/* The one filled button of the window: it keeps the words */
.keep-note {
  height: calc(28 * var(--u));
  padding: 0 calc(14 * var(--u));
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--on-dark);
  font-weight: 600;
  cursor: pointer;
}

.keep-note:disabled {
  border-color: var(--ink-4);
  background: var(--ink-4);
  cursor: default;
}

.mark-note::placeholder {
  color: var(--ink-3);
}

.mark-note:focus {
  border-color: var(--amber);
  outline: calc(3 * var(--u)) solid var(--amber-ring);
}

.mark-note-failed {
  color: var(--red);
}

/* The time the undo lasts, draining; the page sets its duration */
.time-left {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: calc(3 * var(--u));
  background: var(--amber);
  transform-origin: left;
  animation-name: drain;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes drain {
  to {
    transform: scaleX(0);
  }
}

.undo {
  height: calc(26 * var(--u));
  padding: 0 calc(12 * var(--u));
  border: 1px solid var(--on-dark);
  border-radius: calc(5 * var(--u));
  background: none;
  color: var(--on-dark);
  font-weight: 600;
  cursor: pointer;
}

@media (max-width: 1500px) {
  .bar {
    gap: calc(10 * var(--u));
  }

  .tab {
    padding: 0 calc(7 * var(--u));
  }

  .tab.current::after {
    left: calc(7 * var(--u));
    right: calc(7 * var(--u));
  }
}

@media (prefers-reduced-motion: reduce) {
  .switch .track,
  .switch .track::after {
    transition: none;
  }
}

/* The status page of the reading of the mail: one column of short
   tables, drawn by the server (afruits.status-page) */
.status-page main {
  max-width: calc(1100 * var(--u));
  margin: 0 auto;
  padding: calc(24 * var(--u));
}

.status-page h1 {
  margin: 0 0 calc(12 * var(--u));
  font-size: calc(22 * var(--u));
}

.status-page h2 {
  margin: calc(24 * var(--u)) 0 calc(8 * var(--u));
  font-size: calc(16 * var(--u));
}

.status-page table {
  border-collapse: collapse;
}

.status-page th,
.status-page td {
  padding: calc(4 * var(--u)) var(--cell-pad);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.status-page thead th {
  font-size: var(--size-heading);
  font-weight: 600;
  color: var(--ink-2);
}

.status-page tbody th {
  font-weight: normal;
}

.status-page .number {
  text-align: right;
}

.status-page time {
  white-space: nowrap;
}

.status-page .error-text {
  color: var(--ink-2);
  font-size: var(--size-secondary);
}

.status-page .none {
  color: var(--ink-2);
}
