/*
 * Receipt Runner's look, carried over from the Electron app (app/src/styles/variables.less) and receiptrunner.com:
 * a navy top bar, Receipt Runner blue for actions, green for receipts that are done, Lato throughout.
 */
:root {
  --navy: #0e2749;
  --navy-line: #3c506c;
  --navy-muted: #aab4c8;
  --blue: #1f56a0;
  --blue-soft: #e8eef8;
  --green: #40ad36;
  --green-text: #2b7a23;
  --green-badge: #2b8224;
  --green-soft: #e8f5e7;
  --red: #c23434;
  --red-soft: #fbeaea;
  --grey: #f2f4f8;
  --grey-shade: #e4e8f0;
  --line: #d8dee8;
  --ink: #242a33;
  --muted: #626a77;
  --surface: #ffffff;
  --on-color: #ffffff; /* text on blue, green, red and navy */
  --blue-hover: #1a4b8c;
  --blue-line: #bcd0ec;
  --navy-hover: #1a3560;
  --navy-deep: #04101f;
  --control-line: #cfd6e6; /* borders and 3D shadows of buttons and fields */
  --grey-light: #f7f8fb;
  --grey-hover: #f9fafc;
  --grey-mid: #eceff4;
  --grey-top: #e6eaf2;
  --ink-secondary: #4c5563;
  --warn: #8a5a00;
  --warn-soft: #fff4e0;
  --warn-line: #f0d49c;
  --folio: #5a3fdc; /* Folio's own purple, in the setup guide that mimics its screens */
  --folio-deep: #3b2a91;
  --folio-line: #9a95ad;
  --shadow-popover: 0 8px 30px rgba(14, 39, 73, 0.28);
  --shadow-card: 0 2px 6px rgba(14, 39, 73, 0.12);
  --font: "Lato", system-ui, -apple-system, "Segoe UI", sans-serif;
  --topbar: 56px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--grey);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
}

a { color: var(--blue); }
a:hover { color: var(--navy); }
h1 { font-size: 28px; margin: 0 0 8px; }
h2 { font-size: 20px; margin: 0 0 8px; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
svg.icon-fill { fill: currentColor; stroke: none; }

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

/* Buttons: Receipt Runner's hard shadow. */
.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  background: var(--blue);
  box-shadow: 0 4px 0 var(--navy);
  color: var(--on-color);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { color: var(--on-color); background: var(--blue-hover); }
.button:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--navy); }
.button--secondary, .button--outline { background: var(--surface); color: var(--blue); border: 1px solid var(--control-line); box-shadow: 0 3px 0 var(--control-line); font-weight: 400; }
.button--secondary:hover, .button--outline:hover { background: var(--surface); color: var(--navy); }
.button--card { padding: 7px 14px; background: var(--surface); color: var(--blue); border: 1px solid var(--surface); box-shadow: 0 2px 0 var(--control-line); font-weight: 400; font-size: 15px; }
.button--card:hover { background: var(--surface); color: var(--navy); }
.button--choice { width: 100%; justify-content: center; padding: 9px 8px; background: var(--surface); color: var(--blue); border: 1px solid var(--control-line); box-shadow: 0 2px 0 var(--control-line); font-weight: 700; font-size: 14px; }
.button--choice:hover { background: var(--blue-soft); color: var(--navy); }
.button--choice.is-selected { background: var(--blue); color: var(--on-color); border-color: var(--blue); box-shadow: 0 2px 0 var(--navy); }
.button--choice:disabled { opacity: 0.45; cursor: default; }
.button--small { padding: 6px 12px; font-size: 14px; box-shadow: 0 2px 0 var(--navy); }

.link-button { display: inline-flex; align-items: center; gap: 6px; background: none; border: none; padding: 0; color: var(--blue); font: inherit; cursor: pointer; text-align: left; }
.link-button:hover { color: var(--navy); }
form.button_to { display: inline; }

.flash { padding: 10px 16px; background: var(--blue-soft); color: var(--navy); border-bottom: 1px solid var(--line); }
.flash--alert { background: var(--red-soft); color: var(--red); }
.flash--alert a, .flash--alert a:hover { color: inherit; font-weight: 700; }

/* The app: a navy top bar, and everything else under it. */
.app { display: flex; flex-direction: column; height: 100vh; }
.app__main { flex: 1; min-height: 0; overflow-y: auto; padding: 32px 40px; }
.app__main:has(.review) { display: flex; flex-direction: column; padding: 0; overflow: hidden; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-shrink: 0; height: var(--topbar); padding: 0 12px 0 20px; background: var(--navy); color: var(--on-color); }
.topbar__logo img { display: block; width: auto; height: 38px; }
.topbar__user { display: flex; align-items: center; gap: 8px; max-width: 100%; height: 40px; padding: 0 10px 0 12px; border: none; border-radius: 4px; background: none; color: inherit; font: inherit; cursor: pointer; }
.topbar__user:hover, .topbar__user[aria-expanded="true"] { background: var(--navy-hover); }
.topbar__name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* Menus: a button, and a panel over the page under it. */
.menu { position: relative; min-width: 0; }
.menu__panel { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; width: max-content; min-width: 240px; max-width: min(340px, calc(100vw - 16px)); padding: 8px 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-popover); }
.menu__note { margin: 0 0 8px; padding: 4px 16px 12px; border-bottom: 1px solid var(--grey-shade); font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.menu__heading { margin: 0; padding: 4px 16px; font-size: 14px; font-style: italic; color: var(--muted); }
.menu__item { position: relative; display: block; width: 100%; padding: 9px 16px 9px 44px; border: none; background: none; color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer; overflow-wrap: anywhere; }
.menu__item svg { position: absolute; left: 16px; top: 13px; color: var(--blue); }
.menu__item:hover, .menu__item:focus-visible { background: var(--blue-soft); color: var(--navy); }
.menu__item.is-current { font-weight: 700; }
.menu .button_to { display: block; }
.menu__divider { margin: 8px 0; border: none; border-top: 1px solid var(--grey-shade); }

/* The period at the top of the list: a step back, its name, which opens the picker, and a step forward. */
.period { position: relative; display: flex; align-items: center; gap: 6px; }
.period__step, .period__current { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; border: 1px solid var(--control-line); border-radius: 4px; background: var(--surface); box-shadow: 0 2px 0 var(--control-line); color: var(--blue); font: inherit; cursor: pointer; }
.period__step { width: 36px; padding: 0; }
.period__step:hover, .period__current:hover { background: var(--blue-soft); color: var(--navy); }
.period__step:disabled { background: var(--surface); color: var(--blue); opacity: 0.45; cursor: default; }
.period__current { padding: 0 12px; color: var(--ink); font-weight: 700; white-space: nowrap; }
.period__current svg { color: var(--blue); }
.period__current[aria-expanded="true"] { background: var(--blue); border-color: var(--blue); box-shadow: 0 2px 0 var(--navy); color: var(--on-color); }
.period__current[aria-expanded="true"] svg { color: inherit; }
/* Under the period, as wide as the list allows (the container that 100cqw and the queries refer to). */
/* Three columns: the MVA periods (with their setting), the years, and any dates. */
.period__popover { position: absolute; top: calc(100% + 10px); left: 0; z-index: 10; display: flex; width: min(760px, calc(100cqw - 2 * var(--list-gutter))); padding: 24px 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-popover); }
.period__popover[hidden] { display: none; }
.period__column { padding: 0 24px; }
.period__column + .period__column { border-left: 1px solid var(--grey-shade); }
.period__terms { width: 236px; flex-shrink: 0; }
.period__years { width: 128px; flex-shrink: 0; }
.period__custom { flex: 1; }
.period__title { font-size: 16px; }
.period__choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.period__choices--single { grid-template-columns: minmax(0, 1fr); }
.period__choices .button_to { display: block; }
.period__form { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.period__form label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.period__form input[type="date"] { padding: 7px 10px; border: 1px solid var(--control-line); font: inherit; color: var(--ink); }
.period__hint { font-size: 13px; color: var(--muted); }
/* Beside the chosen transaction, or on a phone, the columns stack. */
@container (max-width: 680px) {
  .period__popover { flex-direction: column; gap: 20px; }
  .period__column { width: auto; }
  .period__column + .period__column { padding-top: 20px; border-left: none; border-top: 1px solid var(--grey-shade); }
  .period__years .period__choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Review: the period's transactions in the middle, the chosen transaction on the right. */
.review { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(420px, 46%) minmax(0, 1fr); }
/* --list-gutter: the list's side padding, which the period popover also keeps clear of. */
/* A column, so the footer sits at the bottom when the list is short. */
.review__list { --list-gutter: 24px; container-type: inline-size; display: flex; flex-direction: column; overflow-y: auto; background: var(--grey); border-right: 1px solid var(--line); }
.review__detail { display: block; overflow-y: auto; background: var(--surface); }
.review__detail[busy] { opacity: 0.6; transition: opacity 0.15s 0.1s; }
/* Nothing chosen: one list across the page, its contents centred, until a transaction opens beside it. */
.review:has(> .review__detail:empty) { grid-template-columns: minmax(0, 1fr); }
.review > .review__detail:empty { display: none; }
.review:has(> .review__detail:empty) .review__list { border-right: none; }
/* Wide enough to fill a laptop's screen, so opening a transaction there only narrows the list and what you're reading
   doesn't move; on bigger screens a centred block. */
.review:has(> .review__detail:empty) .review__list > :not(.footer) { width: 100%; max-width: 1920px; margin-inline: auto; }

/* The top of the list: the company and period with the search beside them, then how far along the period is, or,
   when it's all done, the runner. */
/* The period on the left, the search on the right; on a phone the search goes under the period. */
.list__top { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(200px, 280px); grid-template-areas: "period . search"; align-items: center; gap: 12px 24px; padding: 14px var(--list-gutter); background: var(--grey-top); border-bottom: 1px solid var(--line); }
.list__top > .period { grid-area: period; }
.list__search { grid-area: search; height: 38px; }
.search-field:focus-within { outline: 2px solid var(--blue); outline-offset: -1px; }
.list__done, .list__next, .list__status { grid-column: 1 / -1; }
.list__status { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; }
.list__status em { color: var(--ink-secondary); }
.list__synced { font-size: 14px; color: var(--muted); }
.list__done { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px 8px 16px; text-align: center; }
.list__done + .list__status, .list__next + .list__status { justify-content: center; margin-top: -8px; }
.list__done img { width: 260px; height: auto; }
.list__done h2 { color: var(--ink-secondary); line-height: 1.35; }
/* Nothing left to check, but receipts still to go to Folio: what's next, with its button beside it. */
.list__next { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 16px; padding: 14px 8px 18px; text-align: center; }
.list__next h2 { margin: 0; color: var(--ink-secondary); line-height: 1.35; }
.list__next h2 span { white-space: nowrap; }
.list__next--failed h2, .list__next-failed, .list__next-dot { color: var(--red); }
.list__next-dot { margin: 0 -8px; font-size: 20px; font-weight: 700; }
.list__next .link-button { font-size: 20px; font-weight: 700; }
.list__next-more { flex-basis: 100%; margin: 0; font-style: italic; color: var(--ink-secondary); }
@container (max-width: 520px) {
  .list__top { grid-template-columns: minmax(0, 1fr); grid-template-areas: "period" "search"; }
}
.list__group-summary { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; padding: 18px 24px; border-bottom: 1px solid var(--grey-shade); background: var(--grey-mid); font-weight: 700; }
.list__group--none .list__group-summary, .list__group--ignored .list__group-summary { background: var(--grey-light); font-weight: 400; font-style: italic; color: var(--ink-secondary); }
.list__show, .list__bulk .link-button { font-style: normal; }
/* "Ignore all" and "Stop ignoring all" act on the whole group, so they show only while all of it does, like the
   Electron app's: unfolded, and not narrowed by the search. */
.list__group:has(.list__rows[hidden], .list__row[hidden]) .list__bulk { display: none; }
.list__row { display: flex; align-items: center; gap: 16px; padding: 14px 20px 14px 24px; border-bottom: 1px solid var(--grey-shade); color: var(--ink); text-decoration: none; }
.list__row:hover { background: var(--grey-hover); color: var(--ink); }
.list__row.is-current { background: var(--surface); box-shadow: inset 4px 0 0 var(--blue); }
.list__row[hidden] { display: none; }
.list__group--done .list__row { color: var(--muted); }
.list__no-match { margin: 0; padding: 18px 24px; font-style: italic; color: var(--ink-secondary); }
.list__date { width: 110px; flex-shrink: 0; white-space: nowrap; }
.list__text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list__row.is-current .list__text { white-space: normal; }
.list__amount { flex-shrink: 0; white-space: nowrap; }

.badge { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex-shrink: 0; border-radius: 14px; font-size: 14px; font-weight: 700; }
.badge--ready, .badge--done { background: var(--green-badge); color: var(--on-color); }
.badge--strong { background: var(--blue-soft); color: var(--blue); border: 1px solid var(--blue-line); }
.badge--unsure { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn-line); }
.badge--none, .badge--ignored, .badge--unsearched { background: var(--grey-shade); color: var(--muted); }
.badge--search-failed { background: var(--red-soft); color: var(--red); border: 1px solid var(--red); }
/* A transaction whose email is being searched: a ring turns around its badge, like the Electron app's. While the search
   waits its turn, the ring is dashed and still. */
.badge { position: relative; }
.badge.is-searching::before, .badge.is-waiting::before { content: ""; position: absolute; inset: -5px; border-radius: 50%; }
.badge.is-waiting::before { border: 2px dashed var(--blue-line); }
.badge.is-searching::before { border: 2px solid transparent; border-top-color: var(--blue); border-right-color: var(--blue); animation: badge-turn 1s linear infinite; }
@keyframes badge-turn { to { transform: rotate(360deg); } }
.list__searching { display: inline-flex; align-items: center; gap: 10px; }
.list__searching progress { width: 120px; height: 6px; border: none; border-radius: 3px; background: var(--control-line); overflow: hidden; appearance: none; }
.list__searching progress::-webkit-progress-bar { background: var(--control-line); }
.list__searching progress::-webkit-progress-value { background: var(--blue); }
.list__searching progress::-moz-progress-bar { background: var(--blue); }

/* The chosen transaction. */
.transaction { padding: 28px 36px 40px; }
.transaction__header { padding-bottom: 18px; margin-bottom: 20px; border-bottom: 1px solid var(--grey-shade); }
.transaction__title { margin: 0 0 8px; font-size: 18px; line-height: 1.35; }
.transaction__facts { display: flex; gap: 36px; margin: 0; font-size: 17px; }
.transaction__lead { margin: 0 0 14px; font-size: 16px; font-weight: 400; line-height: 1.45; }
.transaction__receipts { display: flex; flex-direction: column; gap: 14px; }
.transaction__folio { margin-bottom: 28px; }
.transaction__others, .transaction__ignored { display: flex; flex-direction: column; gap: 14px; }
.transaction__others > summary, .transaction__ignored > summary { list-style: none; }
.transaction__others[open] > summary { margin-bottom: 14px; }
.transaction__ignored ul { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.transaction__ignored li { display: flex; justify-content: space-between; gap: 12px; }
.transaction__help { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-top: 36px; }
.transaction__question { margin: 12px 0 0; font-size: 16px; font-weight: 400; }
.transaction__note { max-width: 560px; margin: 0; color: var(--ink-secondary); font-size: 15px; }
.transaction__search { width: 100%; max-width: 440px; }
.search-field { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--control-line); background: var(--surface); color: var(--blue); }
.search-field input { flex: 1; border: none; outline: none; font: inherit; color: var(--ink); }
.transaction__nav { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 36px; }
.transaction__keys { margin-top: 20px; font-size: 13px; }

/* A receipt card: the email, what it matched, and a thumbnail. */
.receipt { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 8px 18px; padding: 18px 18px 18px 22px; background: var(--grey-light); border-left: 5px solid var(--control-line); }
.receipt--attached { background: var(--green-soft); border-left-color: var(--green); }
.receipt__main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.receipt__subject { margin: 0; font-size: 17px; line-height: 1.35; overflow-wrap: anywhere; }
.receipt__meta { margin: 0; font-size: 14px; color: var(--ink-secondary); overflow-wrap: anywhere; }
.receipt__matches { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 0; font-size: 15px; }
.receipt__matches em { color: var(--muted); }
.match { display: inline-flex; align-items: center; gap: 5px; }
.match--found { color: var(--green-text); }
.match--missing { color: var(--red); }
.receipt__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 6px; font-size: 15px; }
.receipt__thumbnail { position: relative; width: 120px; height: 156px; cursor: pointer; overflow: hidden; background: var(--surface); border: 1px solid var(--control-line); box-shadow: var(--shadow-card); }
.receipt__thumbnail iframe { width: 600px; height: 780px; border: 0; transform: scale(0.2); transform-origin: 0 0; pointer-events: none; }
.receipt__thumbnail img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.receipt__pdf { position: absolute; left: 6px; bottom: 6px; padding: 1px 5px; background: var(--red); color: var(--on-color); font-size: 10px; font-weight: 900; }
.receipt__email { grid-column: 1 / -1; }

.email { border: 1px solid var(--line); background: var(--surface); }
.email__header { padding: 12px 16px; border-bottom: 1px solid var(--grey-shade); font-size: 14px; }
.email__subject { font-size: 16px; margin: 0 0 4px; }
.email__attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.email__body { display: block; width: 100%; height: 600px; border: 0; }
.email__pdf { display: block; width: 100%; height: 760px; border: 0; border-top: 1px solid var(--grey-shade); }
.file-link { padding: 3px 10px; border: 1px solid var(--control-line); background: var(--grey); font-size: 13px; text-decoration: none; }

/* Settings pages and signing in. Signed out, the page takes the top bar's navy, so the logo sits on its own colour. */
body:has(.signed-out) { background: var(--navy); }
.signed-out { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; max-width: 400px; margin: 0 auto; padding: 48px 16px; color: var(--on-color); }
.signed-out__logo { display: block; width: 240px; max-width: 100%; height: auto; margin-bottom: 40px; }
.signed-out__content { display: flex; flex-direction: column; gap: 16px; width: 100%; text-align: center; }
.signed-out h1 { margin: 0; font-size: 24px; }
.signed-out p { margin: 0; color: var(--navy-muted); }
.signed-out strong { color: var(--on-color); }
.signed-out a, .signed-out .link-button { color: var(--on-color); text-decoration: underline; }
.signed-out a:hover, .signed-out .link-button:hover { color: var(--navy-muted); }
.signed-out .flash { width: 100%; margin-bottom: 20px; border: none; border-radius: 4px; text-align: center; }
.signed-out form:not(.button_to) { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.signed-out label { font-weight: 700; }
.signed-out .input { max-width: none; margin: 0; padding: 12px 14px; border: none; border-radius: 4px; background: var(--surface); color: var(--ink); }
.signed-out .button { justify-content: center; width: 100%; box-shadow: 0 4px 0 var(--navy-deep); }
.signed-out .button:active { box-shadow: 0 2px 0 var(--navy-deep); }
.signed-out .button--outline { background: transparent; color: var(--on-color); border: 1px solid var(--navy-muted); box-shadow: 0 3px 0 var(--navy-deep); font-weight: 700; }
.signed-out .button--outline:hover { background: var(--navy-hover); color: var(--on-color); }
.signed-out__or { display: flex; align-items: center; gap: 12px; color: var(--navy-muted); font-size: 14px; }
.signed-out__or::before, .signed-out__or::after { content: ""; flex: 1; border-top: 1px solid var(--navy-line); }
.signed-out .signed-out__code { text-align: center; font-size: 28px; letter-spacing: 0.3em; font-variant-numeric: tabular-nums; }
.signed-out__links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; font-size: 14px; }
.signed-out__passkeys { display: contents; }
.signed-out .signed-out__passkeys [hidden] { display: none; }
.signed-out__error { padding: 10px 16px; border-radius: 4px; background: var(--red-soft); color: var(--red); }
/* Whose account the emailed link signs in to, so nobody is led into someone else's by a forwarded link. */
.signed-out__notice { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; border-radius: 4px; background: var(--warn-soft); }
.signed-out .signed-out__notice p { color: var(--ink); }
.signed-out .signed-out__notice p + p { color: var(--warn); font-weight: 700; }
.signed-out .signed-out__notice strong { color: var(--ink); overflow-wrap: anywhere; }

/* A person's passkeys, with a form to add one on this device. */
.passkeys { max-width: 640px; display: flex; flex-direction: column; gap: 16px; }
.passkeys h1, .passkeys h2, .passkeys p { margin: 0; }
.passkeys__list { list-style: none; margin: 0; padding: 0; background: var(--surface); }
.passkeys__item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 16px; padding: 14px 16px; border-bottom: 1px solid var(--grey-shade); }
.passkeys__rename { display: flex; align-items: center; gap: 8px; }
.passkeys__rename .input { flex: 1; margin: 0; }
.passkeys__meta { grid-row: 2; font-size: 14px; }
.passkeys__add { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 16px; padding: 20px; background: var(--surface); }
.passkeys__add-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; width: 100%; }
.passkeys__add-row .input { flex: 1; min-width: 200px; margin: 0; }
.passkeys [hidden] { display: none; }
.passkeys__error { padding: 8px 12px; background: var(--red-soft); color: var(--red); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.empty-state { max-width: 560px; margin: 40px auto; padding: 32px; text-align: center; background: var(--surface); }
.empty-state__illustration { width: 280px; height: auto; }

.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--grey-shade); font-size: 12px; }
.chip--needed { background: var(--warn-soft); color: var(--warn); font-weight: 700; }

/* Text, email and password fields. */
.input {
  width: 100%;
  max-width: 360px;
  padding: 9px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--control-line);
  font: inherit;
}

/* Settings: one page, a section for the person and their mailboxes, then one for each company and its Folio. */
.settings { max-width: 760px; }
.settings__header { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 8px; }
.settings__nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.settings__section { padding: 28px 0; border-top: 1px solid var(--line); scroll-margin-top: 16px; }
.settings__section h2 { font-size: 22px; }
.settings__subsection { margin-top: 28px; scroll-margin-top: 16px; }
.settings__subsection h3 { margin: 0 0 8px; font-size: 18px; }
.settings__form { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; margin: 16px 0; }
.settings__form label { display: flex; flex-direction: column; gap: 4px; width: 100%; max-width: 420px; }
.settings__form .input, .settings__form select { width: 100%; padding: 9px 12px; margin: 0; border: 1px solid var(--control-line); background: var(--surface); font: inherit; }
.settings__list { list-style: none; margin: 16px 0; padding: 0; background: var(--surface); }
.settings__list li { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--grey-shade); }
.settings__item-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.settings__replace { margin-top: 20px; }
.settings__replace > summary { list-style: none; }
.chip--ok { background: var(--green-soft); color: var(--green-text); font-weight: 700; }

/* Get help. */
.help { max-width: 760px; }

/* The Electron app's footer: at the end of the list, and at the bottom of the screen when the list is short. */
.footer { margin-top: auto; padding: 40px var(--list-gutter, 24px); border-top: 1px solid var(--grey-shade); background: var(--grey-mid); text-align: center; font-size: 14px; color: var(--muted); }
.review__list > :nth-last-child(2) { margin-bottom: 40px; }
.footer p { margin: 0; }
.footer p + p { margin-top: 16px; }
.footer__flag { width: 1.1em; height: 0.8em; stroke: none; vertical-align: -0.05em; }
.help h2 { margin-top: 28px; }

/* The steps to make a Folio API key, with small copies of what to look for in Folio. */
.guide { list-style: none; counter-reset: step; margin: 20px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.guide__step { position: relative; padding: 18px 20px 18px 64px; background: var(--surface); counter-increment: step; }
.guide__step::before { content: counter(step); position: absolute; left: 18px; top: 16px; width: 30px; height: 30px; border-radius: 15px; background: var(--blue); color: var(--on-color); font-weight: 900; display: flex; align-items: center; justify-content: center; }
.guide__step h4 { margin: 4px 0 10px; font-size: 17px; }
.guide__step p { margin: 8px 0 0; }
.guide__form { display: flex; flex-wrap: wrap; gap: 10px; }
.guide__form .input { flex: 1; min-width: 240px; padding: 10px 12px; margin: 0; border: 1px solid var(--control-line); font: inherit; }
.folio-button { display: inline-block; padding: 10px 18px; border-radius: 8px; background: var(--folio); box-shadow: 0 3px 0 var(--folio-deep); color: var(--on-color); font-size: 15px; }
.folio-choices { display: flex; flex-direction: column; gap: 8px; }
.folio-choice { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.folio-choice::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--folio-line); box-sizing: border-box; }
.folio-choice.is-chosen { font-weight: 700; }
.folio-choice.is-chosen::before { border: 5px solid var(--folio); }
.folio-choice.is-never { color: var(--muted); text-decoration: line-through; }
.folio-field { display: inline-block; min-width: 260px; padding: 9px 14px; border: 2px solid var(--folio); border-radius: 8px; font-size: 15px; }
.transaction__upload { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin: 4px 0 8px; }
.badge--uploading { background: var(--blue-soft); color: var(--blue); }
.badge--failed { background: var(--red); color: var(--on-color); }
.list__group--failed .list__group-summary { background: var(--red-soft); color: var(--red); }

/*
 * Narrow screens, after the Electron app (app/src/styles/variables.less), which went to one column when its main area
 * was under 850px. Here the list needs its 420px and the transaction beside it about 500px for the receipt cards, so it's
 * one column at 960px and below: the chosen transaction opens under its row in the list. review_controller.js moves the
 * transaction frame there, and uses the same width. The page scrolls, rather than the list and the transaction each on
 * their own, and the top bar stays at the top.
 */
@media (max-width: 960px) {
  :root { scroll-padding-top: var(--topbar); }
  .app { height: auto; min-height: 100vh; }
  .app__main { padding: 24px 16px 40px; }
  .app__main:has(.review) { display: block; overflow: visible; }
  .review { display: flex; flex-direction: column; overflow-anchor: none; }
  .review__list { overflow: visible; border-right: none; }
  /* Under its row, the transaction carries on the row's white and blue edge. The row says what it is, and when searching
     the list hides the row, the transaction goes with it. */
  .review__list .review__detail { overflow: visible; box-shadow: inset 4px 0 0 var(--blue); border-bottom: 1px solid var(--grey-shade); }
  .review__list .transaction { padding: 4px 20px 32px 24px; }
  .review__list .transaction__header, .list__row[hidden] + .review__detail { display: none; }
  /* Moved under a row before that row's transaction has loaded: the one before keeps the space, unseen. */
  .review__list .review__detail[data-stale] { position: relative; }
  .review__list .review__detail[data-stale] > * { visibility: hidden; }
  .review__list .review__detail[data-stale]::before { content: "Loading…"; position: absolute; top: 4px; left: 24px; color: var(--muted); }
  /* Beside the list it waits to be moved under its row. A transaction that isn't in the list shows above it. */
  .review > .review__detail { order: -1; overflow: visible; border-bottom: 1px solid var(--line); }
  .review:has(.list__row.is-current) > .review__detail, .review > .review__detail:empty { display: none; }
}

/* Phones: rows put the date under the name, receipt cards leave out the thumbnail, and less padding all round. */
@media (max-width: 600px) {
  .topbar { padding: 0 8px 0 16px; }
  .topbar__logo img { height: 34px; }
  .review__list { --list-gutter: 16px; }
  .list__group-summary { padding-left: 16px; padding-right: 16px; }
  .list__done { padding: 8px 0 12px; }
  .list__done img { width: 200px; }
  .list__row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 2px 12px; padding: 12px 16px; }
  .list__text { grid-area: 1 / 1; }
  .list__date { grid-area: 2 / 1; width: auto; font-size: 14px; color: var(--muted); }
  .list__amount { grid-area: 1 / 2 / 3; }
  .list__row .badge { grid-area: 1 / 3 / 3; }

  .review__list .transaction { padding: 4px 16px 28px; }
  .review__list .review__detail[data-stale]::before { left: 16px; }
  .transaction { padding: 20px 16px 32px; }
  .transaction__facts { flex-wrap: wrap; gap: 4px 20px; }
  .transaction__ignored li { flex-wrap: wrap; }
  .receipt { grid-template-columns: minmax(0, 1fr); padding: 16px 14px 16px 16px; }
  .receipt__thumbnail { display: none; }

  .empty-state { margin: 0; padding: 24px 16px; }
  .empty-state__illustration { width: 200px; }
  .settings__list li { flex-wrap: wrap; }
  .guide__step { padding: 16px 16px 16px 56px; }
  .guide__step::before { left: 14px; }
  .folio-field { min-width: 0; }
}
.period__defaults { margin-top: 16px; font-size: 14px; }
.period__defaults > summary { list-style: none; color: var(--muted); }
.period__defaults > summary::-webkit-details-marker { display: none; }
.period__defaults > summary:hover { color: var(--blue); }
.period__defaults > summary svg { width: 14px; height: 14px; }
.period__defaults-form { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 10px; }
.period__defaults-form label { color: var(--muted); }
.period__defaults-form select { max-width: 100%; padding: 6px 8px; border: 1px solid var(--control-line); background: var(--surface); font: inherit; color: var(--ink); }

/* Movement only for those who want it. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
  /* Still, the half ring says it's being searched. */
  .badge.is-searching::before { animation: none; }
}
