/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

:root {
  --ink: #1a1d21;
  --ink-muted: #5c6470;
  /* Faint, but never below the 4.5:1 body-text minimum: this carries content,
     not decoration — the form's hints, the "—" that means a question went
     unanswered, and "Not sent yet" against a client text that did not go.
     4.8:1 on white and 4.5:1 on the sunken surface it sits on in table rows. */
  --ink-faint: #6b7280;
  --rule: #e2e5ea;
  --surface: #ffffff;
  --surface-sunken: #f6f7f9;

  /* Provisional figures are not a warning about a mistake — they are a warning
     that the number will move. Amber, not red: nothing is wrong. */
  /* A field the form rejected. 7.3:1 on white and 6.5:1 on its own tint, so
     the message reads as text rather than only as a colour. Redefined for dark
     mode below — the tint is an input's *background*, so leaving it light there
     left the firm typing dark-mode ink onto a near-white fill. */
  --error: #a4262c;
  --error-bg: #fdf0ef;
  --caution: #8a5a00;
  --caution-bg: #fdf6e6;
  --caution-rule: #e8c987;

  --settled: #2f6b4f;
  --settled-bg: #eef5f1;

  --measure: 52rem;
  /* The width of the page body, which the account bar above it matches. Prose
     by default; a wide page sets --page-measure on <body> instead. */
  --page-measure: var(--measure);
  --measure-wide: 68rem;
}

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

body {
  margin: 0;
  padding: 2.5rem 1.5rem 4rem;
  background: var(--surface-sunken);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Money and dates are compared down the column, so they need consistent digit
   widths. Tabular figures keep them from shifting against each other. */
.client__payoff,
.client__facts dd {
  font-variant-numeric: tabular-nums;
}

/* ---- Flash ------------------------------------------------------------- */

.flash {
  max-width: var(--measure);
  margin: 0 auto 1.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  font-size: 0.9375rem;
}

.flash--alert {
  border-color: var(--caution-rule);
  background: var(--caution-bg);
  color: var(--caution);
}

.flash--notice {
  border-color: #b9d4c6;
  background: var(--settled-bg);
  color: var(--settled);
}

/* ---- Dashboard --------------------------------------------------------- */

.dashboard,
.sign-in {
  max-width: var(--measure);
  margin: 0 auto;
}

.dashboard__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.dashboard__header h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.dashboard__firm {
  margin: 0.25rem 0 0;
  color: var(--ink-muted);
  font-size: 1rem;
}

.empty {
  padding: 2rem;
  border: 1px dashed var(--rule);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-muted);
  text-align: center;
}

/* ---- Client cards ------------------------------------------------------ */

.clients {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.client {
  padding: 1.5rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface);
}

.client__name {
  margin: 0 0 1.25rem;
  font-size: 1.125rem;
  font-weight: 620;
}

.client__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1.25rem;
  margin: 0;
}

.client__facts > div {
  min-width: 0;
}

.client__facts dt {
  margin-bottom: 0.25rem;
  color: var(--ink-faint);
  font-size: 0.75rem;
  font-weight: 550;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.client__facts dd {
  margin: 0;
  font-size: 1rem;
}

/* The payoff is what the firm came to read. It outranks every other fact on
   the card, so it is the only figure that gets size and weight.
   Scoped through .client__facts to outrank the `dd` base rule above — as a bare
   class it loses on specificity and silently renders at body size. */
.client__facts .client__payoff {
  font-size: 1.5rem;
  font-weight: 640;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

/* Absence of a price is information, not a blank. Italic and muted so it reads
   as an explanation rather than as a value. */
.client__facts .client__unavailable {
  color: var(--ink-muted);
  font-style: italic;
}

.client__facts .client__status {
  font-weight: 570;
  color: var(--settled);
}

/* A settled advance is finished business. Muting the whole card keeps the
   active ones visually first without hiding it. */
.client--paid-off {
  background: var(--surface-sunken);
}

.client--paid-off .client__name {
  color: var(--ink-muted);
}

/* ---- Payoff note -------------------------------------------------------- */

/* Deliberately quiet. This replaced an amber §1.9 caution that rendered under
   every active row and could never clear, because nothing in the app supplies
   net proceeds — a permanent alarm on every line reads as noise and trains firms
   to ignore it. The line's job now is smaller and factual: name the source of
   the figure and give a route to question it. Muted body text is correct for
   that; escalating it back to a caution would restore the original problem. */
.client__payoff-note {
  margin: 1rem 0 0;
  color: var(--ink-muted);
  font-size: 0.8125rem;
  line-height: 1.45;
}

/* ---- Account bar ------------------------------------------------------- */

/* The account bar has to line up with the page beneath it, and the pages are
   not all one width: firm-facing screens are --measure (prose), while the admin
   queue is 68rem (a table to scan). A fixed --measure here left the email and
   Sign out floating 16rem short of the queue's right edge. The width now comes
   from a custom property the body sets, so the two cannot drift. */
.layout--wide {
  --page-measure: var(--measure-wide);
}

.account {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  max-width: var(--page-measure, var(--measure));
  margin: 0 auto 1.5rem;
  font-size: 0.875rem;
}

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

/* Sign out reimplemented the button styles rather than using them, which is how
   it ended up without the hover and focus treatment every other button has. It
   is the same control, one size smaller. */
.account__sign-out button {
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.account__sign-out button:hover {
  background: var(--surface-sunken);
  border-color: var(--ink-muted);
}

.account__sign-out button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* ---- Auth pages -------------------------------------------------------- */

.auth {
  max-width: 26rem;
  margin: 0 auto;
  padding: 2rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface);
}

.auth h1 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  font-weight: 650;
}

.auth__intro {
  margin: 0 0 1.5rem;
  color: var(--ink-muted);
  font-size: 0.9375rem;
}

.auth__form {
  display: grid;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.375rem;
}

.field label {
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--ink-muted);
}

.field input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.field input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.field__hint {
  margin: 0;
  color: var(--ink-faint);
  font-size: 0.8125rem;
}

.button {
  display: inline-block;
  padding: 0.625rem 1rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--ink);
  color: var(--surface);
  font: inherit;
  font-weight: 550;
  /* a.button would otherwise carry the underline links get */
  text-decoration: none;
  cursor: pointer;
}

/* Hover has to be visible at a glance, not a 10% opacity shift nobody notices —
   these buttons text clients and create advances, so knowing which one is under
   the cursor matters. Darkening the fill reads on any background; the shadow and
   the press-down confirm it.

   Keyed on the class rather than the element: button_to renders a <button> and
   form.submit an <input type=submit>, and scoping the interactive states to
   .auth__form's inputs left every other submit button without them — which is
   why Deny and Add note behaved differently from Start review and Approve. */
.button {
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, color 0.12s ease;
}

.button:hover {
  background: #000;
  border-color: #000;
  box-shadow: 0 1px 3px rgba(26, 29, 33, 0.25);
}

.button:active {
  box-shadow: none;
  transform: translateY(1px);
}

/* Keyboard users get the same signal as mouse users, plus a ring — :hover alone
   leaves a tab-through invisible. */
.button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .button {
    transition: none;
  }

  .button:active {
    transform: none;
  }
}

.auth__aside {
  margin: 1.25rem 0 0;
  font-size: 0.875rem;
}

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

/* ---- Form pages -------------------------------------------------------- */

.form-page {
  max-width: var(--measure);
  margin: 0 auto;
}

.form-page__header {
  margin-bottom: 2rem;
}

.form-page__header h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.form-page__intro {
  margin: 0;
  max-width: 44ch;
  color: var(--ink-muted);
}

.request-form {
  display: grid;
  gap: 1.5rem;
}

.fieldset {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 1.5rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface);
}

.fieldset legend {
  padding: 0 0.5rem;
  margin-left: -0.5rem;
  color: var(--ink-faint);
  font-size: 0.75rem;
  font-weight: 550;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Paired inputs sit side by side on a wide screen and stack on a narrow one
   without a media query. */
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
}

/* .fieldset and .field each set a display, which outranks the browser's own
   [hidden] rule — without this the conditional underwriting questions would
   stay on screen after the controller hid them. */
.fieldset[hidden],
.field[hidden] {
  display: none;
}

.fieldset select,
.fieldset textarea {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.fieldset textarea {
  resize: vertical;
}

.fieldset select:focus-visible,
.fieldset textarea:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

/* The dollar sign sits inside the input's border so the prefix reads as part
   of the field rather than as a label beside it. */
.field__prefixed {
  display: flex;
  align-items: center;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
}

.field__prefixed:focus-within {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.field__prefix {
  padding: 0 0.25rem 0 0.75rem;
  color: var(--ink-muted);
}

.field__prefixed input {
  border: none;
  background: transparent;
  padding-left: 0;
}

.field__prefixed input:focus-visible {
  outline: none;
}

.errors {
  padding: 1rem 1.25rem;
  border: 1px solid var(--caution-rule);
  border-left-width: 3px;
  border-radius: 0 6px 6px 0;
  background: var(--caution-bg);
  color: var(--caution);
}

/* The summary takes focus when a rejected form comes back, so it needs a ring
   like anything else that can hold focus — otherwise a sighted keyboard user
   sees the page move and cannot tell where they now are. */
.errors:focus-visible {
  outline: 2px solid var(--caution);
  outline-offset: 2px;
}

.errors__title {
  margin: 0 0 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.errors ul {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.875rem;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* The secondary action: an outline rather than a fill, so it reads as the
   quieter of two choices without competing with the primary one.
   This used to set only `color`, which left --ink-muted text on the inherited
   dark fill at 2.83:1 — under the 4.5:1 minimum, and hard to read in practice. */
.button--quiet {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--rule);
  font-size: 0.9375rem;
  font-weight: 500;
}

.button--quiet:hover {
  background: var(--surface-sunken);
  border-color: var(--ink-muted);
  color: var(--ink);
  box-shadow: none;
}

/* Deny texts a client and cannot be recalled, so it should not look like the
   mild secondary action it shared a style with. Outlined rather than filled —
   it is still the rarer choice and should not out-shout Approve — but in the
   caution colour, and the hover fills it so there is no doubt what is about to
   happen. */
.button--caution {
  background: var(--surface);
  color: var(--caution);
  border-color: var(--caution-rule);
  font-size: 0.9375rem;
  font-weight: 550;
}

.button--caution:hover {
  background: var(--caution);
  border-color: var(--caution);
  color: var(--surface);
  box-shadow: 0 1px 3px rgba(26, 29, 33, 0.2);
}

.button--caution:focus-visible {
  outline-color: var(--caution);
}

/* Required-field marker. Colour alone is never the signal — the glyph carries
   it, and the input's own `required` attribute carries it to assistive tech —
   so this is only reinforcement for people who can see it. */
.field__required {
  color: var(--caution);
  font-weight: 700;
  margin-left: 0.125rem;
}

.form__legend {
  margin: 0 0 1.25rem;
  font-size: 0.875rem;
  color: var(--ink-muted);
}

/* ---- Fields that need attention ---------------------------------------- */
/* Rails wraps an invalid field in .field_with_errors, which ships with no
   styling at all — so a rejected form showed a summary at the top and gave no
   clue which of a dozen fields it meant. On the full underwriting form that is
   a hunt.

   Colour is not the only signal: the summary at the top of the form names each
   field and gives the reason in words, and the label turns bold as well as red.
   This is reinforcement for people who can see it, not the only route. */
.field_with_errors {
  display: contents;
}

.field_with_errors label {
  color: var(--error);
  font-weight: 600;
}

.field_with_errors input,
.field_with_errors select,
.field_with_errors textarea {
  border-color: var(--error);
  background: var(--error-bg);
}

.field_with_errors input:focus-visible,
.field_with_errors select:focus-visible,
.field_with_errors textarea:focus-visible {
  outline-color: var(--error);
}

@media (forced-colors: active) {
  .field_with_errors input,
  .field_with_errors select,
  .field_with_errors textarea {
    border-color: revert;
    background: revert;
  }
}


/* ---- Table striping ----------------------------------------------------- */
/* Alternating rows, so an eye tracking across a wide row does not drift into
   the one above or below. These tables run to seven columns, and the queue is
   scanned rather than read.
   Rows and not columns deliberately: the data reads horizontally, and vertical
   banding would cut across the direction the eye is already travelling.

   --surface-sunken keeps every cell well clear of the contrast minimum: 15.8:1
   for primary text and 5.6:1 for the muted secondary line beneath a client's
   name. The stripe is a scanning aid, so it must never be the thing carrying
   meaning — status and tier still have their own badges. */
.queue__table tbody tr:nth-child(even),
.requests__table tbody tr:nth-child(even) {
  background: var(--surface-sunken);
}

/* Hover outranks the stripe, so the row under the cursor is unambiguous on
   both the plain and the striped rows. */
.queue__table tbody tr:hover,
.requests__table tbody tr:hover {
  background: var(--bg-hover, #eef0f4);
}

/* Striping is decoration. In forced-colors mode the system palette owns the
   background, and painting one here would fight it. */
@media (forced-colors: active) {
  .queue__table tbody tr:nth-child(even),
  .requests__table tbody tr:nth-child(even),
  .queue__table tbody tr:hover,
  .requests__table tbody tr:hover {
    background: revert;
  }
}


/* ---- Focus ------------------------------------------------------------- */
/* Every interactive element needs a visible focus ring, not just the ones that
   look like buttons: a keyboard user tabbing through the app has no other way
   to tell where they are. These sit on varied backgrounds, so the ring is
   stated explicitly rather than left to the browser. */
.filters__tab:focus-visible,
.search__clear:focus-visible,
.detail__back a:focus-visible,
.empty a:focus-visible,
.account__user + form button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 3px;
}

/* A tab is a navigation target, so hovering it should read as "you can go
   here" rather than as nothing at all. */
.filters__tab {
  transition: color 0.12s ease, border-color 0.12s ease;
}


/* ---- A firm's own funding requests -------------------------------------- */
/* The same shape as the admin queue, and deliberately so: it is a table to scan
   rather than prose. Its own classes because what it shows differs — a firm sees
   status and never SettleUp's commentary. */

.requests {
  max-width: var(--page-measure, var(--measure));
  margin: 0 auto;
}

.requests__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.requests__header h1 {
  margin: 0;
}

.requests__subtitle {
  margin: 0.25rem 0 0;
  color: var(--ink-muted);
  font-size: 0.9375rem;
}

.requests__scroll {
  overflow-x: auto;
}

.requests__table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 0.375rem;
}

.requests__table th,
.requests__table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

.requests__table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  font-weight: 600;
}

.requests__table tr:last-child td {
  border-bottom: 0;
}

.requests__sub {
  display: block;
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.requests__actions {
  text-align: right;
  white-space: nowrap;
}

/* ---- Admin: the incoming request queue --------------------------------- */

/* SettleUp's own screens, drawn on the same tokens as the firm-facing portal so
   the internal tool reads as the same product rather than something bolted on.
   The queue is wider than --measure: it is a table to scan, not prose to read. */

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

/* Hidden until tabbed to, then a real target sitting over the page. Not
   .visually-hidden with a focus override: this one has to take up space and
   be clickable once it appears, which a clip-path cannot undo cleanly. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 0 0 6px 0;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.queue,
.detail {
  max-width: var(--page-measure, var(--measure));
  margin: 0 auto;
}

.queue__header,
.detail__header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.queue__header h1,
.detail__header h1 {
  margin: 0 0 0.25rem;
}

.queue__subtitle,
.detail__meta {
  margin: 0;
  color: var(--ink-faint);
  font-size: 0.875rem;
}

/* ---- Filters ---- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 1.25rem;
}

.filters__tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  color: var(--ink-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: 0.9375rem;
}

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

.filters__tab--current {
  color: var(--ink);
  border-bottom-color: var(--ink);
  font-weight: 600;
}

.filters__count {
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
  color: var(--ink-faint);
  background: var(--surface-sunken);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0 0.4rem;
}

.filters__tab--current .filters__count {
  color: var(--ink);
}

/* ---- Search ---- */

.search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.search__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.search__field {
  flex: 1 1 18rem;
  min-width: 0;
}

.search__clear {
  color: var(--ink-muted);
  font-size: 0.875rem;
}

/* ---- The table ---- */

/* The table scrolls inside its own container so the page never scrolls
   sideways on a narrow screen. */
.queue__scroll {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 0.5rem;
  background: var(--surface);
}

.queue__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.queue__table th,
.queue__table td {
  text-align: left;
  padding: 0.75rem 1rem;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}

.queue__table thead th {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-sunken);
}

.queue__table tbody tr:last-child th,
.queue__table tbody tr:last-child td {
  border-bottom: 0;
}

.queue__table .numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* The second line under firm, client and received: the detail that answers
   "which of these do I pick up next" without opening anything. */
.queue__sub,
.facts__sub {
  display: block;
  color: var(--ink-faint);
  font-size: 0.8125rem;
  margin-top: 0.125rem;
}

.received__date {
  display: block;
  white-space: nowrap;
}

.received__time {
  display: block;
  color: var(--ink-faint);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.queue__actions {
  text-align: right;
  white-space: nowrap;
}

/* ---- Badges ---- */

.tier,
.status {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.5rem;
  border-radius: 0.25rem;
  white-space: nowrap;
  border: 1px solid transparent;
}

/* Fast track carries no underwriting answers to read, which is a fact about
   the row worth seeing before opening it — so the two tiers are told apart by
   weight, not colour: neither is a warning. */
.tier--fast_track {
  background: var(--surface-sunken);
  color: var(--ink-muted);
  border-color: var(--rule);
}

.tier--full_underwriting {
  background: var(--surface-sunken);
  color: var(--ink);
  border-color: var(--ink-faint);
}

/* Submitted and in review are both "with SettleUp, nothing needed from you",
   so they share a treatment rather than implying a difference the firm can act
   on. */
.status--submitted,
.status--in_review {
  background: var(--caution-bg);
  color: var(--caution);
  border-color: var(--caution-rule);
}

.status--approved,
.status--funded {
  background: var(--settled-bg);
  color: var(--settled);
}

.status--denied,
.status--withdrawn {
  background: var(--surface-sunken);
  color: var(--ink-muted);
  border-color: var(--rule);
}

/* ---- Request detail ---- */

.detail__back {
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.detail__badges {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.detail__pending {
  background: var(--surface-sunken);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--caution-rule);
  border-radius: 0.25rem;
  padding: 0.75rem 1rem;
  margin: 0 0 1.5rem;
  color: var(--ink-muted);
  font-size: 0.875rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 0.5rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.panel h2 {
  margin: 0 0 1rem;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
}

.panel__prose {
  margin: 0;
  color: var(--ink);
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem 1.5rem;
  margin: 0;
}

.facts > div {
  min-width: 0;
}

.facts dt {
  font-size: 0.8125rem;
  color: var(--ink-muted);
  margin-bottom: 0.15rem;
}

.facts dd {
  margin: 0;
  overflow-wrap: break-word;
}

.facts__figure {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.answer--missing {
  color: var(--ink-faint);
}

@media (max-width: 40rem) {
  .queue__table th,
  .queue__table td {
    padding: 0.625rem 0.75rem;
  }
}

/* ---- Dark mode --------------------------------------------------------- */

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8eaed;
    --ink-muted: #a2abb8;
    --ink-faint: #8a94a2;
    --rule: #2f353d;
    --surface: #1b1f24;
    --surface-sunken: #14171b;

    /* These have to be restated here, not inherited. --error-bg fills a
       rejected input, so the light tint against dark-mode --ink was 1.08:1 —
       a firm correcting the field could not read their own typing. 8.4:1 for
       the label, and 14.1:1 for text typed into the field. */
    --error: #f2a0a4;
    --error-bg: #2c1618;

    --caution: #f0c674;
    --caution-bg: #2e2413;
    --caution-rule: #7a5f24;

    --settled: #7cc4a0;
    --settled-bg: #16241d;
  }

  .flash--notice {
    border-color: #2c4a3b;
  }

  /* The tier badges lean on borders rather than fills, which need a touch more
     contrast against the darker sunken surface to stay legible. */
  .tier--full_underwriting {
    border-color: var(--ink-muted);
  }
}

/* ---- Admin actions, activity, and notes --------------------------------- */

.actions__row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.actions__note {
  margin: 0.5rem 0 1rem;
  font-size: 0.875rem;
  color: var(--ink-muted);
}

.actions__label {
  display: block;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.actions__reason,
.notes__field {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 0.25rem;
  font: inherit;
  resize: vertical;
}

.actions__deny {
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
}

.actions__subhead {
  margin: 1.5rem 0 0.5rem;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

/* Each row is one thing that happened, with what is known about it beside. A
   status nobody has confirmed is muted rather than absent, so "sent" and
   "arrived" do not read alike. */
.activity,
.notes {
  list-style: none;
  margin: 0;
  padding: 0;
}

.activity li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.875rem;
}

.activity li:last-child {
  border-bottom: 0;
}

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

.notes__item {
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--surface-sunken);
  border: 1px solid var(--rule);
  border-radius: 0.25rem;
}

.notes__body {
  margin: 0;
  white-space: pre-wrap;
}

.notes__meta {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.notes__form {
  display: grid;
  gap: 0.5rem;
  justify-items: start;
}

/* What to do after approving. The portal does not send the agreement — that
   stays in DocuSign — so this is instructions rather than controls, and is
   styled as a quiet aside rather than something clickable. */
.next-step {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface-sunken);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--caution-rule);
  border-radius: 0.25rem;
}

.next-step__head {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

.next-step__list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.875rem;
}

.next-step__list li + li {
  margin-top: 0.375rem;
}

/* ---- Envelope match confirmation ---------------------------------------- */

/* The candidate list on the confirmation screen. Each row is a request the
   agreement might belong to, with the reasons it was suggested, and the button
   that files it. Deliberately a list rather than a table: the reasons are prose
   and a person reads them before choosing. */
.candidates {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.candidates__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--rule);
  border-radius: 0.25rem;
  background: var(--surface-sunken);
}

.candidates__detail {
  min-width: 14rem;
  flex: 1 1 20rem;
}

.candidates__item h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.candidates__meta,
.candidates__reasons {
  margin: 0;
  font-size: 0.875rem;
  color: var(--ink-muted);
}

.candidates__reasons {
  margin-top: 0.25rem;
}

/* An agreement whose figures did not read. Carries the caution rule the pending
   notice uses, because it is the same kind of statement: something is blocked
   and here is what would unblock it. */
.panel--warning {
  border-left: 3px solid var(--caution-rule);
}

.problems {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  color: var(--ink-muted);
  font-size: 0.875rem;
}

.problems li + li {
  margin-top: 0.25rem;
}

/* ---- Print ------------------------------------------------------------- */

/* Firms print payoff figures to file with a case. The provisional notice must
   survive the trip — background colors are commonly dropped, so restore a
   visible border and keep it with the card it qualifies. */
@media print {
  body {
    padding: 0;
    background: #fff;
  }

  .client {
    break-inside: avoid;
  }

  .client__payoff-note {
    color: #000;
  }
}
