/* Plain CSS. No framework, no build step -- the next maintainer edits this file
   and refreshes the browser. Layout is fluid so approvers can work on a phone. */

/* ---------- Aqura identity ----------
   The palette is defined once, here, and nothing below states a colour of its
   own. Two sets of names follow it: the --aq-* tokens are the identity, and the
   short names the rest of the file already used (--ink, --line, --brand and so
   on) are kept as aliases pointing at them. That way a rule written before the
   restyle still resolves to the right colour, and there is one place to look
   when a colour is wrong. */
:root {
  /* Core */
  --aq-navy:   #0B1F3A;  /* headers, sidebar, footer, primary dark surface */
  --aq-slate:  #16233D;  /* cards and panels on dark surfaces */
  --aq-cyan:   #00C2CB;  /* primary actions, active states, focus rings */
  --aq-gold:   #C9A227;  /* status only: Approved / Awarded badges. Never money values. */
  --aq-grey:   #E6EAF0;  /* text on dark, dividers */

  /* Light-surface support */
  --aq-bg:        #F5F7FA;  /* page background */
  --aq-card:      #FFFFFF;  /* cards on light background */
  --aq-ink:       #0B1F3A;  /* body text on light */
  --aq-ink-dim:   #5C6B85;  /* secondary text on light */
  --aq-line:      #D8DFE9;  /* borders on light */
  --aq-line-dark: #22304E;  /* borders on dark */

  /* The identity names one text colour for dark surfaces, --aq-grey, and the
     sidebar needs two more: a quiet one for the group headings and a red for
     sign-out. Neither is a new hue -- they are the light-surface pair lifted
     until they carry on navy, which the originals do not:
       --aq-ink-dim #5C6B85 on navy = 3.06:1, short of AA for 12px text
       --aq-red     #E04B4B on navy = 4.49:1, a hair short of the same
     Lifted, they read 5.29:1 and 8.31:1. */
  --aq-ink-dim-dark: #7E93B4;  /* secondary text on navy */
  --aq-red-on-dark:  #F0A9A9;  /* destructive text on navy */

  /* Finance semantics -- cash flow module ONLY */
  --aq-jade:   #1FA97A;  /* inflows, certified progress claims */
  --aq-copper: #D97742;  /* outflows, committed PO spend */
  --aq-red:    #E04B4B;  /* negative net position, breach alerts */

  /* Type. Figures are set in the monospace stack wherever a column of them has
     to be scanned down -- tables, totals, KPIs -- so the digits line up. */
  --aq-font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --aq-mono: ui-monospace, Menlo, Consolas, monospace;

  /* Tints, derived from the palette rather than added to it: a navy wash for
     row hover and dark-surface fills, and the faintest of card shadows. */
  --aq-navy-04: rgba(11, 31, 58, 0.04);
  --aq-navy-08: rgba(11, 31, 58, 0.08);
  --aq-shadow:  0 1px 2px rgba(11, 31, 58, 0.06);

  /* Legacy names, mapped onto the identity. */
  --ink: var(--aq-ink);
  --muted: var(--aq-ink-dim);
  --line: var(--aq-line);
  --bg: var(--aq-bg);
  --card: var(--aq-card);
  --brand: var(--aq-navy);
  --brand-dark: var(--aq-navy);
  --ok: var(--aq-jade);
  --warn: var(--aq-copper);
  --bad: var(--aq-red);
}

* { box-sizing: border-box; }

/* The `hidden` attribute means hidden.
   The browser says so already -- [hidden] { display: none } -- but that is a
   user-agent rule, and *any* author `display` beats it regardless of
   specificity. So a panel styled `display: flex` stays on screen when script
   sets `hidden`, and its Close button appears to do nothing. Everything
   scripted on these pages toggles `hidden`, so it is stated once here. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--aq-font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--aq-ink);
  background: var(--aq-bg);
}

/* Cyan does not have the contrast to be read as body text on white, so a link
   on a light surface is ink and carries an underline to mark it as a link.
   Cyan is kept for what it can do at this size: the underline on hover. */
a { color: var(--aq-ink); text-decoration-color: var(--aq-line); }
a:hover { text-decoration-color: var(--aq-cyan); }

/* One focus treatment, on everything, in the one colour that is unambiguously
   "this is where you are". Applied to :focus-visible so a mouse click does not
   leave a ring behind it, with a :focus fallback for older browsers. */
:focus { outline: 2px solid var(--aq-cyan); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }
:focus-visible { outline: 2px solid var(--aq-cyan); outline-offset: 2px; }

/* A section label: the small uppercase heading that names a group of fields or
   a table column. Quiet enough to be read past, present enough to be found.
   Set once here and referred to by the table and form rules further down --
   note it is opt-in, because a tick box's wording is a sentence and must not
   be shouted. */
.section-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--aq-ink-dim);
}

/* Figures, wherever a column of them is read down rather than across. */
.num, .money, .table td.num, .table th.num { font-family: var(--aq-mono); }

h1, h2, h3 { font-weight: 700; }

/* ---------- the shell ----------
   A navy sidebar down the left, the light content area beside it. The sidebar
   holds its own scroll, so a long nav never pushes the page down and the
   content scrolls under a nav that stays put. */
.shell { display: flex; align-items: flex-start; min-height: 100vh; }
.workspace { flex: 1 1 auto; min-width: 0; }

.sidebar {
  flex: none;
  width: 248px;
  align-self: stretch;
  position: sticky;
  top: 0;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--aq-navy);
  color: var(--aq-grey);
  font-size: 13px;
}
.sidebar a { color: var(--aq-grey); text-decoration: none; }
/* ---------- the module switch ----------
   One badge, two modules: Aqura for procurement, Aqura Pricing for the
   tender price library. The logo is where people press when they want to be
   somewhere else, so that is where the choice lives.

   A <details>, like the nav groups, so it works with no script at all. The
   marker is taken off because the lockup is the control -- an arrow beside a
   logo reads as decoration somebody has left in. */
.module-switch { position: relative; }
.module-switch > summary { cursor: pointer; list-style: none; }
.module-switch > summary::-webkit-details-marker { display: none; }
.module-switch > summary::marker { content: ""; }
.module-switch > summary:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* The second word, smaller and lighter, so "AQURA Pricing" reads as one
   lockup with a qualifier rather than as two words of equal weight. */
.brand-word em {
  font-style: normal;
  font-weight: 400;
  opacity: 0.75;
  margin-left: 0.35rem;
}

/* Over the sidebar rather than pushing it down: opening the switch must not
   move the navigation underneath somebody's cursor. */
.module-menu {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 40;
  margin-top: 0.4rem;
  padding: 0.3rem;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
/* ``.sidebar .module-item``, not ``.module-item``. The menu is a white panel
   inside the navy sidebar, and ``.sidebar a`` sets the pale grey that navy
   needs. One class and one element beats one class, so that grey won and the
   two names were white-on-white: the menu opened and appeared empty. Two
   classes takes it back. Anything light-on-dark that opens a light surface
   inside itself has this problem waiting in it. */
.sidebar .module-item {
  display: block;
  padding: 0.5rem 0.6rem;
  border-radius: 4px;
  text-decoration: none;
  color: var(--aq-ink);
}
.sidebar .module-item:hover { background: #eef4fa; color: var(--aq-ink); }
/* Where you already are. Shown rather than spelt out: with the descriptions
   gone these are two words, and a sentence explaining which one you are on
   would be longer than the menu. */
.sidebar .module-item.current { background: #eef4fa; font-weight: 600; color: var(--aq-ink); }


/* Clear space around the mark is its own corner radius -- 15/64 of however
   large it is drawn, which at 32px is 7.5px. */
.brand { font-weight: 700; position: relative; }
/* The phone's Menu button, in the corner of the brand row. Hidden at desktop
   width, where the whole menu is a column beside the page. See nav.js. */
.nav-toggle { display: none; }
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--aq-line-dark);
}
/* The badge's own field is navy, and so is the bar it sits on: without an edge
   it dissolves and only the vessel shape reads. The hairline gives it back. */
.brand-mark {
  display: block;
  width: 32px; height: 32px;
  border-radius: 7.5px;
  box-shadow: 0 0 0 1px var(--aq-line-dark);
}
.brand-word {
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 6px;
  /* The tracking is applied to the right of the last letter too, which throws
     the gap to whatever follows. Pulled back by one space's worth. */
  margin-right: -6px;
  color: #fff;
}

/* Which company this installation is, and the way to the other one.
   Only drawn where a second installation is configured -- on a single-company
   install there is nothing to be confused about and nothing to switch to. */
.company-switch {
  padding: 0 14px 12px;
  border-bottom: 1px solid var(--aq-line-dark);
  margin-bottom: 8px;
}
/* Deliberately loud. Two installations of the same system look identical, and
   the cost of not noticing which one you are in is a requisition raised
   against the wrong company's numbering -- which cannot be moved afterwards,
   only cancelled and retyped. */
.company-here {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  letter-spacing: 0.5px;
}
.company-other {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--aq-grey);
  text-decoration: underline;
}
.company-other:hover { color: #fff; }

.mainnav { flex: 1 1 auto; overflow-y: auto; padding: 10px 0 14px; }

/* One row of the nav, whether it is a link, a summary or the sign-out button.
   The left edge is the marker: transparent until you are on the page. */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 16px 9px 19px;
  border: 0;
  border-left: 3px solid transparent;
  background: none;
  color: var(--aq-grey);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.nav-item.current {
  background: var(--aq-slate);
  border-left-color: var(--aq-cyan);
  color: #fff;
}
/* Items inside a group are stepped in, so the group reads as their heading
   rather than as another destination. */
.nav-group .nav-item { padding-left: 38px; font-size: 12.5px; }
.nav-user .nav-item { padding-left: 51px; font-size: 12.5px; }

/* The count of things waiting on this person. Gold, and navy on it rather than
   a darker brown -- navy is the darkest value the identity has. */
.nav-count {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  color: var(--aq-navy);
  background: var(--aq-gold);
  border-radius: 9px;
  padding: 2px 7px;
}

/* ---------- nav groups ----------
   <details> rather than script: the groups open and close with the page's own
   markup, and a browser with no JavaScript behaves identically. Sharing one
   name makes them exclusive -- opening one closes the last, which is the
   accordion behaviour, done by the platform. */
.nav-group { margin-top: 14px; }
.nav-group > summary {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 9px 16px 9px 22px;
  list-style: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--aq-ink-dim-dark);
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary:hover { color: var(--aq-grey); }
.nav-group > summary::after {
  content: "";
  margin-left: auto;
  width: 0; height: 0;
  border-left: 4px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.18s ease;
}
.nav-group[open] > summary::after { transform: rotate(90deg); }
/* A group is not the page you are on, but it can be holding it. */
.nav-group.has-current > summary { color: var(--aq-grey); }

@media (prefers-reduced-motion: reduce) {
  .nav-group > summary::after { transition: none; }
}

/* ---------- the person signed in ---------- */
.nav-user { border-top: 1px solid var(--aq-line-dark); }
.nav-user > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  list-style: none;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--aq-grey);
}
.nav-user > summary::-webkit-details-marker { display: none; }
.nav-user > summary::after {
  content: "";
  margin-left: auto;
  width: 0; height: 0;
  border-left: 4px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.18s ease;
}
.nav-user[open] > summary::after { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) {
  .nav-user > summary::after { transition: none; }
}
.avatar {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--aq-slate);
  border: 1px solid var(--aq-line-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  color: var(--aq-cyan);
}
/* Signing out is not undoable in the way the other two are. Marked, but not
   filled: it is not the thing on this panel the eye should land on. */
.nav-item.danger { color: var(--aq-red-on-dark); }
.nav-item.danger:hover { background: rgba(224, 75, 75, 0.14); color: var(--aq-red-on-dark); }

.nav-user form { margin: 0; }
.inline { display: inline; }

/* ---------- the shell on a phone ----------
   Below the breakpoint the sidebar stops being a column and becomes a band
   across the top. The groups are still closed, so it is nine or ten rows deep
   at rest rather than the whole nav, and the content follows underneath. */
@media (max-width: 900px) {
  .shell { flex-direction: column; min-height: 0; }
  .sidebar {
    width: 100%;
    position: static;
    max-height: none;
    border-bottom: 1px solid var(--aq-line-dark);
  }
  .mainnav { overflow-y: visible; }
  .workspace { width: 100%; }

  /* Folded behind the Menu button, so the page starts at the top of the
     screen rather than half way down it. Only where nav.js has run -- it sets
     .js-nav -- so without the script the menu stays open as it always was.
     The company name stays: it says which installation this is. */
  html.js-nav .nav-toggle {
    display: inline-flex;
    align-items: center;
    position: absolute;
    top: 16px;
    right: 14px;
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--aq-line-dark);
    border-radius: 6px;
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 15px;
    cursor: pointer;
  }
  html.js-nav .sidebar:not(.open) .mainnav,
  html.js-nav .sidebar:not(.open) .nav-user { display: none; }
}

/* ---------- layout ---------- */
.container { max-width: 1100px; margin: 1.5rem auto; padding: 0 1rem; }
/* A line grid has thirteen columns and 1100px is not enough for them: the
   headings collided with each other and the last column ran off the edge.
   Widened only where one is present, so every reading screen keeps the
   measure that makes prose comfortable. A browser without :has() simply keeps
   1100px, which is what it had before.

   Nearly the whole window, and the cap is deliberately generous. A data grid
   is not prose: there is no measure beyond which it becomes hard to read, and
   every pixel withheld from it comes off the description.

   ``wide-grid`` says the same thing about a table that is not an entry grid
   but is just as wide -- the claim programme carries eight columns and types
   into three of them. Held at 1100px it scrolled sideways inside its card,
   which takes the heading and the paragraph explaining it off the screen
   along with the figures. */
/* A page that wants the window without having a grid to ask for it.
   ``wide-grid`` is carried by a table, so a page whose width is set by
   anything else -- a column of cards, a canvas, a pair of panes read against
   each other -- has nothing to hang it on. This is that hook. Nothing uses it
   today: the review screen did, and became a table instead. Kept because the
   next page of its kind will want it and the reasoning is the hard part. */
/* ``100%``, not ``99vw``. The shell is a flex row: a 248px navy sidebar and
   the workspace beside it. A viewport unit measures the window, so a container
   inside that workspace asking for 99vw asked for very nearly the whole window
   on top of the sidebar, and overran the right edge by about the sidebar's
   width -- the last column and the end of every paragraph went off-screen.
   ``100%`` is the workspace, which is the room there actually is. */
main.container:has(.wide-page) { max-width: min(100%, 2400px); padding: 0 0.6rem; }
main.container:has(table.entry-table),
main.container:has(table.wide-grid) { max-width: min(100%, 2400px); padding: 0 0.6rem; }
/* ---------- the price library's review queue ----------
   One row per price, with all three answers on it: file it under an item,
   create a new one, or take it out.

   ``table-layout: fixed``, because without it the ``colgroup`` is only a
   suggestion. ``.table`` lays out automatically, so each column takes what
   its content asks for -- here the "why it is here" sentence asked for a
   great deal and the three action columns asked for very little, which put a
   hand's breadth of nothing in the middle of the row and squeezed the work
   against the right edge. Fixed, the widths are the widths.

   ``min-width`` so a narrow window scrolls the table inside its card rather
   than crushing eight columns into nothing. The card already handles that. */
.review-queue { table-layout: fixed; min-width: 123rem; }
.review-queue td, .review-queue th { vertical-align: top; }

/* Every ``File it under`` the same width, whatever its longest option happens
   to be. Left to size themselves one row offered a short pipe name and the
   next a long cable-ladder one, and a ragged edge down a column of controls
   that all do the same thing reads as though it means something. A name too
   long is cut with the browser's own ellipsis and shows whole when opened. */
.review-queue .rowform { flex-wrap: nowrap; }
.review-queue .rowform select {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  max-width: none;
}
.review-queue .rowform .btn-small { flex: 0 0 auto; }

/* The other two answers. Their fields wrap within the cell and share it, so
   a narrow column puts each on its own line and a wide one sets them side by
   side, without either needing a width of its own. */
/* One line, and it stays one line. Wrapping, three fields and a button made
   this cell three rows tall and every other cell on the row inherited the
   height -- which is the empty space under the shorter columns. The fields
   share what the column has and give up width to each other instead. */
.review-other { display: flex; flex-wrap: nowrap; align-items: flex-end; gap: 0.3rem; margin: 0; }
.review-other .field { flex: 1 1 0; display: flex; flex-direction: column; gap: 0.05rem; margin: 0; }
.review-other .field input, .review-other .field select { width: 100%; min-width: 0; }
.review-other .btn-small { flex: 0 0 auto; margin: 0; }

/* ---------- deciding a page of rows at once ----------
   A bar of actions above the table it acts on, and a narrow tick column down
   its left. The bar holds nothing but the two decisions and a count, so it
   reads as one action over many rows rather than a form of its own. */
.bulk-bar { display: flex; align-items: center; gap: 0.4rem; margin: 0 0 0.5rem; }
.bulk-bar .btn-small { margin: 0; }
.table th.tick, .table td.tick { width: 1.8rem; text-align: center; }

/* Two decisions on one line. In a cell narrow enough they stacked, and the
   row was then twice as tall as the words in it -- which is the same thing
   ``rowform`` fixes for a select and its button. */
.row-actions { display: flex; align-items: center; gap: 0.3rem; }
.row-actions form { display: inline; margin: 0; }
.row-actions .btn-small { margin: 0; }

.grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid { grid-template-columns: 1fr 1fr; } }

.card {
  background: var(--aq-card);
  border: 1px solid var(--aq-line);
  border-radius: 6px;
  box-shadow: var(--aq-shadow);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.card h2 { margin-top: 0; font-size: 1.05rem; }

h1 { font-size: 1.4rem; font-weight: 700; margin: 0 0 0.35rem; }
.muted { color: var(--aq-ink-dim); }

/* The explanatory paragraphs, a size down from the body.
 *
 * These screens carry a lot of guidance -- why a field exists, what happens if
 * it is left empty, which document a sentence prints on -- and it is worth
 * having. At body size it competed with the fields it was explaining and
 * pushed them off the screen: a form where the hints are as loud as the boxes
 * is a form somebody scrolls past.
 *
 * ``p.muted`` and not ``.muted``: the class is on nine hundred-odd elements,
 * including cells and labels inside tables where a second size would fight
 * with the table's own. A paragraph is the shape guidance takes.
 *
 * 13px against the body's 15. Smaller than this and it stops being read at
 * all, which would be worse than it taking the room.
 */
p.muted { font-size: 0.87rem; }

/* The payment schedule, sitting inside the payment-terms clause box. Ruled off
   so it reads as part of that agreement rather than as a separate section --
   which is what having it in two places led people to do. */
fieldset.schedule {
  margin: 0.75rem 0 0;
  padding: 0.75rem 1rem 0.25rem;
  border: 1px solid var(--line, #d8dee6);
  border-radius: 4px;
  background: #fbfcfd;
}
fieldset.schedule legend {
  padding: 0 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
}
fieldset.schedule .table { margin-bottom: 0.5rem; }

/* The card that carries the payment schedule.

   Prose measure until there is a schedule in it, and then as wide as the table
   needs. The clause boxes were capped at 760px and the schedule's five dated
   columns alone came to 704 of it, so the description -- the column somebody
   types a sentence into -- was left about twenty pixels: the heading wrapped
   one letter to a line and the box could not be used at all. A table gets the
   window, which is the same reasoning as ``main.container:has(table.entry-table)``
   further up, and the pages that draw this one are already widened by it.

   The writing in the card keeps its own measure all the same. A clause typed
   across a thousand pixels is a clause nobody reads back, and the six boxes
   above the schedule are exactly that. Without ``:has()`` a browser keeps the
   narrow card and the table scrolls sideways instead, which is the fallback
   the wrapper is there for. */
.card.schedule-card { max-width: 48rem; }
.card.schedule-card:has(fieldset.schedule) { max-width: 1040px; }
.card.schedule-card:has(fieldset.schedule) :is(textarea, label, p.muted) {
  max-width: 48rem;
}

/* Current or backdated, on the invoice raise forms. Ruled off like the
   schedule above: the date and the choice that governs it are one question,
   and loose radios between ordinary fields read as two. */
fieldset.date-choice {
  margin: 0.75rem 0;
  padding: 0.6rem 1rem 0.3rem;
  border: 1px solid var(--line, #d8dee6);
  border-radius: 4px;
  background: #fbfcfd;
}
fieldset.date-choice legend {
  padding: 0 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
}
fieldset.date-choice label.choice {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  margin: 0.15rem 0;
  font-weight: 400;
}
fieldset.date-choice label.choice input { width: auto; margin: 0; }
fieldset.date-choice label.small {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}
fieldset.date-choice input[type="date"] { max-width: 12rem; }
fieldset.date-choice p { margin-bottom: 0.35rem; }

/* A heading row inside a table, naming the group of rows under it. Shaded so
   the eye reads it as a divider rather than as another record. */
tr.group-head td {
  background: #eef2f7;
  border-top: 2px solid var(--line, #d8dee6);
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

/* --- Reports ---------------------------------------------------------- */

/* Moving between the reports without going back to the top nav. The current
   one is marked rather than linked, so it is obvious which page you are on. */
.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0 0 1rem;
  border-bottom: 1px solid var(--line, #d8dee6);
}
.subnav a {
  padding: 0.45rem 0.9rem;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  margin-bottom: -1px;
}
.subnav a:hover { background: #f2f5f9; color: inherit; }
.subnav a.current {
  background: #fff;
  color: inherit;
  font-weight: 600;
  border-color: var(--line, #d8dee6);
}

/* A proportion, shown as a bar beside the figure rather than instead of it.
   The number is the answer; the bar is only there so a column of them can be
   scanned for the one that is out of line. */
.bar {
  display: inline-block;
  width: 6rem;
  height: 0.6rem;
  vertical-align: middle;
  background: #e8ecf1;
  border-radius: 3px;
  overflow: hidden;
}
.bar-fill {
  display: block;
  height: 100%;
  background: var(--brand, #3d6ea8);
}
/* Over budget. The bar is capped at full width, so without a colour a line
   50% over and one exactly spent would look identical. */
.bar-over { background: var(--bad, #b03636); }

/* A row that needs somebody to look at it -- an overspent budget line, an
   invoice already past due. */
.row-alert { background: #fdf0f0; }

/* A negative figure, or one taken away. Matches the printed documents, where
   a deduction reads in the same colour. */
.deduction { color: var(--bad, #b03636); }

/* The filters above a report. They submit on change where scripting is on,
   and carry their own button where it is not. */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
}
.filter-bar label { display: flex; flex-direction: column; font-size: 0.85rem; gap: 0.2rem; }

/* Definitions under a report, saying what each column actually counts. */
dl.terms { margin: 0; }
dl.terms dt { font-weight: 600; margin-top: 0.6rem; }
dl.terms dd { margin: 0.1rem 0 0; color: var(--muted); }

/* A list that is a list of links, not a bulleted paragraph. */
ul.plain { list-style: none; padding-left: 0; margin: 0; }
ul.plain li { padding: 0.25rem 0; }

/* ---------- tables ----------

   **One size for every table in the application.** It used to be 0.92rem here
   and 0.75rem on the finance ledgers, which meant two tables on adjoining
   screens -- often carrying the same figures -- did not look like the same kind
   of thing. A table is a table: the same type, the same padding, the same
   tabular figures, whether it is holding four rows or four hundred.

   This does not reach the printed documents. They have their own stylesheet
   and their own measurements, driven by the type size set at Admin ->
   Letterhead, because how a purchase order prints is a decision about paper
   rather than about screens. */
.table { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
/* Tight down the page, generous across it. Rows are what a dense table is
   trying to fit more of; columns are where it becomes unreadable, because a
   right-aligned figure ends hard against whatever the next column starts with
   and 3,000,000.00 01/08/2026 reads as one number. */
.table th, .table td {
  text-align: left;
  padding: 0.3rem 0.65rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
/* A column of figures gets a wider gutter on the side it is pushed against.
   Two number columns side by side are the case this exists for: without it
   their digits meet in the middle with nothing between them. */
.table td.num, .table th.num { padding-right: 0.9rem; }
.table td.num + td.num, .table th.num + th.num { padding-left: 0.9rem; }
/* Figures a size larger than the words around them. They are what these
   screens are for -- a ledger is read for its amounts and skimmed for
   everything else -- and at one size the money had to be hunted for.

   A **total is a figure too**, and so is a subtotal. Both are marked up as
   ``<th>`` -- forty totals across fourteen screens, plus the running subtotals
   on a claim -- so sizing on the tag made the sum of a column smaller than the
   column, which is the one figure on the panel somebody is most likely to be
   looking for.

   So every numeric cell is a figure, and the exception is stated instead: a
   heading in ``<thead>`` is a label -- "Amount (RM)" -- and stays at the
   table's own size. Written this way round because the exception is the small
   list and the rule is the long one. */
.table td.num,
.table th.num,
.table .money { font-size: 0.88rem; }
.table thead th.num { font-size: 0.75rem; }
/* A figure being typed reads like the figures around it: right-aligned,
   tabular, same stack.

   Matched on ``inputmode="decimal"`` rather than on a class, because that
   attribute is already on every box in the system that takes a number -- it is
   what puts the numeric keypad on a phone -- and one rule here is worth
   twenty-nine templates remembering to carry a class. It covers the line grids
   on requisitions, orders, quotations and receipts as well as the money
   screens, which is the point: a quantity column that reads one way on an
   order and another on a receipt is the same column twice. */
.table input.num,
.table input[inputmode="decimal"],
.entry-table input[inputmode="decimal"] {
  font-family: var(--aq-mono);
  text-align: right;
  font-variant-numeric: tabular-nums;
  /* The same size as the figures they sit beside. A box a size smaller than
     the column it belongs to is the giveaway that a figure was typed rather
     than calculated, which is not a distinction worth drawing. */
  font-size: 0.88rem;
}
.table .small, .table .muted.small { font-size: 0.7rem; }
.table code { font-size: 0.95em; }
.table-wrap { overflow-x: auto; }

/* Kept as a name because several screens carry it, and because "this one is a
   ledger" is worth saying in the markup. It no longer changes anything: every
   table is this size now. */
.table-compact { font-size: inherit; }

/* Controls inside a table, on a screen big enough for them.
   Deliberately **not** applied on a phone: the rule further down sets every
   input to 16px there, because anything smaller makes iOS Safari zoom the page
   on focus, and a form that jumps about when you tap it is worse than a table
   that takes another line. */
@media (min-width: 701px) {
  /* Text boxes in a table take the table's size. Money boxes are excluded by
     name: they follow the figures in their column, which are set a size
     larger, and this rule comes later in the file and would otherwise win on
     equal specificity. */
  .table select,
  .table input[type="text"]:not([inputmode="decimal"]) {
    font-size: 0.75rem;
    padding: 0.15rem 0.3rem;
    min-height: 0;
  }
  /* The exclusion above is about **type size** only: a money box follows the
     figures in its column, which are set a size larger. It is not about
     height, and leaving the full form padding on it made the box stand at
     twice the height of the name box beside it -- one row reading as two, the
     same fault .owed-table was given the same treatment for. So the padding
     comes off here and the type size stays. */
  .table input[inputmode="decimal"] {
    padding: 0.15rem 0.3rem;
    min-height: 0;
  }
  /* Room to read an account name without the column jumping about as the
     selection changes. */
  .table select.source { max-width: 13rem; }
}

/* A control and its button on one line, inside a table cell.
   Selects and text inputs are width:100% everywhere else, which is right on a
   form and wrong in a table: it pushed the button onto a line of its own, so a
   column that is one action read as two rows. */
/* ``.rowform`` is asked for explicitly; every form inside a row menu gets the
   same treatment without being asked, because they are all the same shape: a
   couple of fields and the button that saves them, sitting in one cell of a
   table. Stacked, a date and its Save button took three rows where one would
   do, and a month of deliveries became a page of scrolling. */
.rowform,
.rowmenu form {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}
/* One line, and it stays one line. The free-text box gives up width instead of
   pushing the button onto a row of its own -- which is what "wrap" did, and it
   put Save under the date it belonged to on every row of the calendar.
   A row menu keeps wrapping: those carry half a dozen fields and are a form
   that happens to live in a cell, not a single action. */
.rowform { flex-wrap: nowrap; }
.rowform select,
.rowform input[type="text"],
.rowform input[type="date"],
.rowform input[type="number"],
.rowmenu form select,
.rowmenu form input[type="text"],
.rowmenu form input[type="date"],
.rowmenu form input[type="number"] { width: auto; }
.rowform select, .rowmenu form select { flex: 0 1 auto; min-width: 6rem; }
/* A form-level button borrowed into a table cell brings its form-level
   margins with it. ``.btn-secondary`` carries a 1rem top margin, which is
   right under a card's last field and wrong in a row: it pushed the button
   down out of line with the select beside it and took the row's height with
   it. Killed at every width -- it is a layout artefact, not a size. */
.rowform .btn { margin-top: 0; margin-left: 0; }

/* And above the phone breakpoint, the row is the height of a line of text
   rather than half again as tall. Both controls carry the padding of a field
   on a full-width form, where there is room for it; in a table cell that
   padding is what makes a single-action column stand taller than the words
   beside it, and a table is read across.

   Deliberately not below 700px, where the rules further down this file make
   controls 16px with a fat tap target. Those are not decoration: 16px is what
   stops iOS Safari zooming the page when a select takes focus, and a button
   small enough to look tidy on a desktop is a button nobody can hit on a
   phone. Tidiness is worth less than either. */
@media (min-width: 701px) {
  .rowform select,
  .rowform input[type="text"],
  .rowform input[type="date"],
  .rowform input[type="number"] { padding: 0.15rem 0.4rem; font-size: 0.9rem; }
  .rowform .btn { padding: 0.15rem 0.7rem; font-size: 0.9rem; }
}
.rowform input[type="date"], .rowmenu form input[type="date"] { flex: 0 0 auto; }
/* The free-text box takes what is left, and gives it back first when the
   column is narrow. ``min-width: 0`` is the part that matters: a flex item's
   default minimum is its content width, which is what stopped it shrinking and
   forced the button to wrap. */
.rowform input[type="text"],
.rowmenu form input[type="text"] { flex: 1 1 4rem; min-width: 0; }
.rowform .btn-link, .rowform .btn,
.rowmenu form .btn-link, .rowmenu form .btn { white-space: nowrap; }
/* A label wrapping its own control -- "As at [date]" -- stays on one line
   rather than putting the caption above the box. */
.rowform label,
.rowmenu form label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  white-space: nowrap;
}
/* A paragraph of explanation inside one is still a paragraph: it takes the
   full width and drops below the controls rather than trying to sit in line
   with them. */
.rowform p, .rowmenu form p { flex: 1 0 100%; margin: 0.2rem 0 0; }

/* The second line of a two-line cell: a free-text box under the controls it
   belongs to. A reason is a sentence, and squeezed in beside a date and two
   buttons there was room for about four words of it. */
.rowform-second { width: 100%; margin-top: 0.25rem; }

/* Document references -- PR-C134-021, P26-016, CI-26-0008 -- read in the same
   type as everything around them.

   They were set in the monospace stack, which put two typefaces in every table
   in the system: the reference in one and the client's name beside it in
   another. Monospace earns its place where characters have to line up in a
   column, and a reference is read across, not down. **Money is the exception
   and keeps it**, because a column of figures is exactly the case it is for.
   Kept a shade smaller, so a reference still reads as a label rather than as
   part of the sentence. */
code { font-family: inherit; font-size: 0.95em; }

/* ---------- forms ---------- */
label { display: block; margin: 0.75rem 0 0.25rem; font-weight: 600; font-size: 0.9rem; }
/* ``search`` belongs here with the rest. Left out, it fell back to the
   browser's own control: a smaller font in a shorter box, sitting beside a
   select that had been styled -- which is exactly how the filter bar on the
   requisition list came to have two boxes of different heights. A type is
   added to this list when it is first used, and that is the step that was
   missed. ``date`` and ``number`` are still outside it, styled only inside
   the tables that use them most. */
input[type=text], input[type=password], input[type=email], input[type=search],
select, textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
  /* A height rather than a line-height, which is what this wanted to be:
     Chromium ignores ``line-height`` on a select and lays it out at its own
     intrinsic size, so every select in the building sat 3.5px shorter than
     the text box beside it. Two controls on one row at two heights is the
     kind of thing nobody reports and everybody sees.

     Written as the sum it is -- one line of text, the padding above and
     below, and the border -- so it still holds if the type size changes.
     ``box-sizing: border-box`` is global, so this is the outside of the box.
     ``min-height``, because a textarea is deliberately taller. */
  line-height: 1.5;
  min-height: calc(1.5em + 1rem + 2px);
  background: #fff;
}
/* Shorter than it was, everywhere. 0.5rem top and bottom made a button half
   again as tall as the line of text it sits beside, which is fine under a
   form and wrong in a table row, in a toolbar, and beside a heading -- six
   rows of the invoice register spent a third of their height on padding.

   Only the height comes down: the sides keep their room, because a label
   crowded against a border is harder to read than a tall button.

   The phone breakpoint at the foot of this file puts the padding back at
   0.65rem and the type at 16px. That is not decoration -- it is the tap
   target, and a button small enough to look tidy on a desktop is one nobody
   can hit with a thumb. */
.btn {
  display: inline-block;
  padding: 0.3rem 0.95rem;
  border: 1px solid transparent;
  border-radius: 4px;
  font: inherit;
  cursor: pointer;
}
/* ``text-decoration`` because these are anchors as often as buttons, and an
   underlined label inside a filled button reads as a link that has been
   styled by accident. ``.btn-secondary`` has always cleared it; this one was
   missed, so the two sat beside each other looking like different things. */
.btn-primary {
  background: var(--brand); color: #fff; margin-top: 1rem; text-decoration: none;
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-link {
  background: none; border: none; color: inherit; cursor: pointer;
  font: inherit; text-decoration: underline; padding: 0;
}

/* ---------- login ---------- */
/* Which company's system this is, on the page where getting it wrong costs
   most. Set in the brand navy and given room, because the whole job of this
   line is to be noticed by somebody who is not looking for it. */
.login-company {
  text-align: center;
  margin: 0.25rem 0 0.5rem;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 2px;
  color: var(--aq-navy, #1C3F94);
}

.login-wrap { max-width: 380px; margin: 4rem auto; padding: 0 1rem; }
.login-wrap h1 { text-align: center; }
.login-wrap .muted { text-align: center; margin-bottom: 1.25rem; }
/* Clear space is the badge's corner radius -- 15/64 of the badge as drawn.
   The badge is 64 of the asset's 360 units wide, so at 300px across it renders
   at 53px and wants 12.5px of air. Rounded up, and centred. */
.login-logo {
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
  margin: 0 auto 0.75rem;
  padding: 13px;
}

/* ---------- flashes and tags ---------- */
.flash { padding: 0.6rem 0.9rem; border-radius: 4px; margin-bottom: 1rem; border: 1px solid; }
.flash-error   { background: #fdf0f0; border-color: #e6b3b3; color: var(--bad); }
.flash-success { background: #eff8f2; border-color: #b3ddc4; color: var(--ok); }
.flash-info    { background: #eef4fa; border-color: #b9cfe4; color: var(--brand-dark); }
.flash-warning { background: #fdf6e7; border-color: #e3cd94; color: var(--warn); }

.tag {
  display: inline-block; padding: 0.1rem 0.5rem; border-radius: 10px;
  background: #e8edf3; color: var(--muted); font-size: 0.78rem; margin-right: 0.25rem;
  white-space: nowrap;
}
.tag-approved { background: #e2f2e9; color: var(--ok); }
.tag-probation { background: #fbf1dd; color: var(--warn); }
.tag-blacklisted { background: #fae4e4; color: var(--bad); }

.checklist { margin: 0.5rem 0 0; padding-left: 1.1rem; }
.checklist li { margin-bottom: 0.2rem; }

/* ---------- opt-in clause blocks ----------
   A tick box that switches a block of standard wording on, and the wording
   itself beneath it. Dimmed while it is off, so a screenful of clauses reads
   at a glance as "these two are going out and those four are not". */
.clause {
  border-top: 1px solid var(--line);
  padding-top: 0.7rem;
  margin-top: 0.9rem;
}
.clause .tick {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  cursor: pointer;
  font-weight: 400;
}
.clause .tick input { width: auto; margin: 0; }
.clause p.muted { margin: 0.15rem 0 0.3rem 1.6rem; }
.clause textarea { opacity: 0.55; }
.clause:has(input:checked) textarea { opacity: 1; }

/* ---------- record screens ----------
   A label-and-value table for reading one record, as against .table which
   lists many. The first column is the field name, so it is narrow and does
   not compete with the value for width. */
.table.kv th {
  width: 14rem;
  font-weight: 600;
  text-align: left;
  color: var(--muted);
  white-space: nowrap;
}
.table.kv td { width: auto; }

/* A code beside a heading -- the supplier code next to the supplier's name.
   Present, but not shouting. */
.subtle { color: var(--muted); font-size: 0.8em; font-weight: 400; }

/* A filter bar: label and control side by side, wrapping on a narrow screen
   rather than becoming a column of full-width inputs. */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
}
.filters label { margin: 0; font-weight: 600; font-size: 0.85rem; }
.filters input, .filters select { width: auto; min-width: 9rem; }
/* Capped, because a select sizes itself to its longest option, and one supplier
   category is a 66-character sentence ("Preparation System, Channel Mixer,
   Dosing Pump…"). That one row stretched the control across half the card and
   pushed the Filter button onto a second line. The bar is a row of controls,
   not a form, and it should read as one. */
.filters select:not(.wide),
.filters input[type=search] { width: 13rem; max-width: 13rem; }
/* For the one that is a whole sentence by design -- "C134 — Sungai Selangor
   Phase 3" -- where clipping it would leave two projects looking identical. */
.filters select.wide { max-width: 26rem; }
.filters .btn { margin: 0; }

/* While a filter is running.
 *
 * live-filter.js has always set aria-busy on the results container and
 * nothing ever styled it, which did not matter while a Search button sat
 * beside the box: clicking it was the feedback. With the button gone --
 * it only ever repainted rows the typing had already filtered -- a slow
 * list is a screen that sits perfectly still for two seconds after you
 * type, and the honest reading of that is that the search is broken.
 *
 * Opacity rather than a spinner: the rows underneath are still the real
 * answer to the previous keystroke, and dimming says "being replaced"
 * without taking them away and making the page jump. */
[aria-busy="true"] {
  opacity: 0.55;
  transition: opacity 120ms ease-in;
}

/* Adding one row to a list that is already on the screen -- a contact, say.
   Same idea as .filters, but it is an entry form rather than a filter, so the
   fields get room to breathe. */
.row-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 0.9rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.row-form label { margin: 0 0 0.2rem; font-weight: 600; font-size: 0.85rem; }
.row-form input { width: auto; min-width: 10rem; }

/* One field is one item, with its label stacked above its box. Without the
   wrapper the label and the input are two flex items of their own: the row
   reads "Name [ ] Designation [ ]" across, and the moment it wraps the
   labels and the boxes come apart and it stops reading at all. */
.row-form .field { display: flex; flex-direction: column; flex: 1 1 9rem; min-width: 0; }
.row-form .field input { width: 100%; min-width: 0; }
.row-form .btn { margin: 0; }

/* A tickbox reads left to right with its wording, not stacked above it like
   the text fields. */
label.checkbox {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 400;
}
label.checkbox input { width: auto; margin: 0; }

/* Destructive, and it should look it. Outlined rather than filled: it sits
   beside ordinary buttons and must not be the thing the eye lands on first. */
.btn-danger {
  background: #fff;
  border-color: var(--bad);
  color: var(--bad);
  margin-top: 1rem;
}
.btn-danger:hover { background: #fdf0f0; }

/* A quotation row for something nobody asked for: the supplier's own addition.
   Tinted rather than moved to the bottom, so the row keeps the position it was
   typed in and the eye still separates it from the request's own items. */
.entry-table tr.is-extra { background: var(--aq-navy-04); }
.grid-add { margin: 0.6rem 0 0; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

/* ---------- budget lines, as bars ----------

   A figure tells an approver whether a line has room; a bar tells them at a
   glance which line on the job is nearly gone. Both are shown, because the
   figure is the one they are signing against. */
.budget-line { padding: 0.6rem 0; border-top: 1px solid var(--line); }
.budget-line:first-of-type { border-top: 0; }
.budget-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.budget-figures { display: flex; gap: 1.5rem; text-align: right; }
.budget-figures .num { display: block; font-size: 0.88rem; }

/* The track is grey and the fill sits on it, so "how much is left" is the
   visible remainder rather than something to be worked out. */
.budget-track {
  display: flex;
  height: 8px;
  margin: 0.4rem 0 0.3rem;
  border-radius: 4px;
  background: var(--aq-navy-08);
  overflow: hidden;
}
.budget-fill { background: var(--aq-navy); }
/* What this request would add, set apart from what is already spent: the two
   are different kinds of certainty and a single bar would blur them. */
.budget-fill.is-proposed { background: var(--aq-cyan); opacity: 0.85; }

/* The line this requisition is charged to. Marked rather than moved to the
   top: the order of the lines is the order somebody reads them in on every
   other screen. */
.budget-line.is-mine { background: var(--aq-navy-04); border-radius: 6px; padding: 0.6rem 0.7rem; }
.budget-total { border-top: 2px solid var(--line); margin-top: 0.4rem; }
.is-over { color: var(--bad); }

/* ---------- audit trail ---------- */
.chain-ok  { color: var(--ok); font-weight: 600; }
.chain-bad { color: var(--bad); font-weight: 600; }
.hash { font-family: ui-monospace, Consolas, monospace; font-size: 0.75rem; color: var(--muted); }
.json { white-space: pre-wrap; word-break: break-word; font-size: 0.78rem; margin: 0; }

/* ---------- approval chain ---------- */
.field-row { display: grid; gap: 0 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .field-row { grid-template-columns: 1fr 1fr; } }

/* Three and four across, for a run of short fields -- a postcode beside a
   state beside a country. Stacked, those four ran a card down half a screen
   to hold twenty characters. The phone rule below puts them all back in one
   column, and has to name these two because a class-plus-class selector
   outranks the plain one whatever the order. */
@media (min-width: 640px) {
  .field-row.three { grid-template-columns: 1fr 1fr 1fr; }
  .field-row.four { grid-template-columns: 1fr 1fr 1fr 1fr; }
  /* A long one beside a short one: a sentence in a dropdown next to a box
     that holds two digits. An even split gives the short one half a card to
     hold "30" in, and the long one a line it has to wrap. */
  .field-row.narrow-last { grid-template-columns: 1fr auto; }
}

.band {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  background: #fbfcfd;
}
.band-head {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1rem;
  justify-content: space-between; align-items: baseline;
}
.chain-list { margin: 0.5rem 0 0; padding-left: 1.4rem; }
.chain-list li { margin-bottom: 0.15rem; }

.preview-result {
  margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line);
}
tr.row-escalation td { background: #fdf8ec; }

.actions { white-space: nowrap; }
.actions form { display: inline; margin-right: 0.4rem; }
.actions button[disabled] { color: var(--line); cursor: default; text-decoration: none; }
/* Flush with the top of the row, like everything else in it.

   The same artefact ``.rowform .btn`` kills a few hundred lines above, in
   the other place it showed: ``.btn-primary`` and ``.btn-secondary`` both
   carry a 1rem top margin, which is right under a card's last field and
   wrong in a table cell. Review and Pass for payment sat sixteen pixels
   below the supplier, the reference and the amount they belong to, and took
   the row's height with them -- six rows of a register costing a screenful
   of blank.

   On the cell rather than on the buttons, because the margin is what these
   buttons should have anywhere else. A table row is the one place it is a
   mistake, and the row is the thing that knows that. */
.table td.actions .btn { margin-top: 0; }

textarea { font: inherit; }
/* The select is styled with the other controls above. This rule used to
   repeat all five properties here and, restating ``font: inherit`` after
   them, quietly reset what that rule had set. */

/* A long dropdown you type into. One control, not a search box beside a
   select: the field below is the native select, clipped rather than hidden
   so that `required` still works and a validation bubble still points here. */
.combo { position: relative; }
.combo-input {
  width: 100%; padding: 0.5rem 1.6rem 0.5rem 0.6rem; font: inherit;
  border: 1px solid var(--line); border-radius: 4px; background: #fff;
  /* The chevron, so it still reads as a dropdown. */
  background-image: linear-gradient(45deg, transparent 50%, #5b7384 50%),
                    linear-gradient(135deg, #5b7384 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.combo-native {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; pointer-events: none;
}
.combo-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 2px);
  margin: 0; padding: 0.2rem; list-style: none; max-height: 16rem; overflow-y: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 6px 20px rgba(15, 34, 48, 0.14);
}
.combo-row { padding: 0.35rem 0.5rem; border-radius: 4px; cursor: pointer; font-size: 0.95rem; }
.combo-row:hover, .combo-row.is-active { background: #eef4f7; }
.combo-row[aria-selected="true"] { font-weight: 600; }
.combo-none { color: var(--muted, #5b7384); cursor: default; }

/* ---------- multi-row entry table + CSV import ---------- */
/* --- line grid ----------------------------------------------------------

   A grid is read down, not across: what matters is how many lines fit on the
   screen at once. So the cells are tight and the type is a notch smaller than
   the body, which roughly doubles the rows visible without making anything
   hard to read. The generous padding the rest of the tables use is right for
   a report and wrong for eighty lines of data entry. */

/* The line grids read at the same size as every other table -- they are the
   most-used table in the system, and having them a size of their own was the
   loudest of the inconsistencies. */
.entry-table { width: 100%; table-layout: fixed; font-size: 0.75rem; }
/* Top, not middle: the description and detail boxes grow to the text in
   them, and a one-line quantity floating in the middle of a three-line row
   is harder to scan across than one sitting on the same line as the words
   it belongs to. */
.entry-table td { vertical-align: top; padding: 0.2rem 0.2rem; }
/* Headings wrap. They used to be nowrap, which does not make a column wider
   -- it makes the heading overflow it, so "Description" ran across "Detail"
   and "Discount" across "SST %" and neither could be read. Two short lines in
   the heading row costs a few pixels of height once; a heading nobody can read
   costs somebody a wrong column every time they use the screen. */
.entry-table th {
  padding: 0.25rem 0.2rem;
  font-size: 0.75rem;
  white-space: normal;
  line-height: 1.15;
  vertical-align: bottom;
  /* A word longer than its column breaks rather than running across the one
     beside it. Wrapping alone does not help a single word, which is how
     "Remarks" came to sit on top of "Delivery". */
  overflow-wrap: break-word;
}
.entry-table td.rownum { font-size: 0.75rem; color: var(--muted); width: 1.8rem; }

/* Guarded for the same reason as the other tables: on a phone every input goes
   back to 16px, or iOS Safari zooms the page the moment somebody taps a cell.
   A line grid is exactly where that is most annoying. */
@media (min-width: 701px) {
  .entry-table input[type=text],
  .entry-table input[type=number],
  .entry-table textarea,
  .entry-table select {
    padding: 0.2rem 0.3rem;
    font-size: 0.75rem;
    line-height: 1.25;
    border-radius: 3px;
  }
}

/* --- the boxes that hold words -----------------------------------------

   Description and detail are textareas rather than single-line inputs, for
   two reasons that turned out to be the same reason. A description on a real
   order is often a paragraph -- a pump with its duty, its material and its
   connection size -- and typing it into a box that shows twenty characters
   means proof-reading it by arrowing left and right. And an item list copied
   off a supplier's quotation frequently has line breaks in it that used to be
   flattened on the way in.

   Two lines to start, grown to fit by enhance.js as somebody types, and
   draggable beyond that. Capped so one enormous line cannot push the rest of
   the grid off the screen -- past the cap it scrolls inside its own box. */
.entry-table textarea {
  width: 100%;
  min-height: 2.4rem;
  max-height: 9rem;
  resize: vertical;
  overflow-y: auto;
  font: inherit;
  border: 1px solid var(--line);
  background: #fff;
}

/* A box armed to take the next paste whole, by double-clicking it.

   Marked, and not subtly: a double-click is also just how somebody selects a
   word, so a box that had quietly changed what Ctrl+V does without saying so
   would be worse than not offering it. The note under the grid says it in
   words as well -- this is the part you see while your eyes are on the cell.

   Cyan is the colour the focus rings already use for "this is the active
   thing", which is what being armed amounts to. */
.entry-table textarea.grid-paste-whole {
  border-color: var(--aq-cyan);
  box-shadow: 0 0 0 2px rgba(0, 194, 203, 0.28);
  background: #f3feff;
}

/* Column widths, so the table fits the page instead of scrolling sideways to
   reach the last column. Description takes whatever is left over. */
/* The narrow ones are sized to their content and no wider. Every millimetre
   taken by a column holding "3" or "unit" is a millimetre off the description,
   which is the column somebody is actually reading. */
.entry-table col.c-kind { width: 5.2rem; }
/* One or two digits, occasionally a fraction. It does not need the width of a
   price. */
.entry-table col.c-qty { width: 3.6rem; }
/* "unit", "set", "nos", "m". Four characters is the long case. */
.entry-table col.c-uom { width: 3.4rem; }
/* The one figure column that needs real room: seven digits with their
   separators and two decimals -- 1,234,567.00 -- has to fit without the box
   scrolling sideways as somebody types it. */
.entry-table col.c-price { width: 6.8rem; }
.entry-table col.c-cat { width: 6.5rem; }
/* Both hold one or two digits. The discount placeholder is longer than
   anything typed into it, so it is allowed to be clipped a little rather than
   set the width of the column for the life of the screen. */
.entry-table col.c-disc { width: 4rem; }
.entry-table col.c-tax { width: 3.2rem; }
/* A date input draws its own dd/mm/yyyy and a calendar button, and neither
   shrinks. Undersized, the button is clipped off the right of the cell --
   which is what had happened, because this class was used in the order form's
   colgroup and never defined here at all. */
.entry-table col.c-date { width: 7.8rem; }
/* The budget line, which now reads "102.1 - Pipework and fittings" rather
   than "102.1". Wider than the code needed and narrower than the name wants:
   the closed box shows enough to recognise the line, the open list shows all
   of it, and the description columns keep the room they are for. */
.entry-table col.c-budget { width: 9.5rem; }
.entry-table col.c-menu { width: 1.9rem; }

/* The three that carry words. Percentages, not rem, so they take the room the
   fixed columns leave and grow with the window rather than fighting it.
   Description and detail get the lion's share: they are what the grid is for,
   and on a real order they hold a paragraph, not a word. */
.entry-table col.c-desc { width: 27%; }
.entry-table col.c-detail { width: 21%; }
/* Wide enough for its own heading. "Remarks" is a single word -- wrapping
   cannot break it, so an undersized column does not get a two-line heading,
   it gets one that runs into Delivery. */
.entry-table col.c-remarks { width: 11%; }

/* Hidden from the screen, kept for a screen reader. Used on the row-menu
   column, whose heading -- "Row", "Move" -- is wider than the 1.9rem the
   column can spare, so it was being clipped by the edge of the table. A
   heading nobody can read is worse than no heading; a column with no
   accessible name at all is worse still. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --- the row menu ------------------------------------------------------ */

.entry-table td.rowtools,
.row-menus td.rowtools { width: 1.9rem; padding: 0; text-align: center; }

.rowmenu { position: relative; display: inline-block; }
.rowmenu > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.15rem 0.3rem;
  border-radius: 3px;
  color: #64748b;
  user-select: none;
  font-size: 1rem;
  line-height: 1;
}
.rowmenu > summary::-webkit-details-marker { display: none; }
.rowmenu > summary:hover { background: #eef2f8; color: #1f2937; }
.rowmenu[open] > summary { background: #e2e8f0; color: #111827; }

.rowmenu-items {
  position: absolute;
  right: 0;
  z-index: 40;
  min-width: 15rem;
  background: #fff;
  border: 1px solid #cbd2dd;
  border-radius: 5px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
  padding: 0.2rem;
  text-align: left;
}
.rowmenu-items button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  padding: 0.4rem 0.6rem;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  color: #1f2937;
}
.rowmenu-items button:hover:not(:disabled) { background: #eef2f8; }
.rowmenu-items button:disabled { opacity: 0.4; cursor: default; }
.rowmenu-items button.danger { color: #b91c1c; }
.rowmenu-items button.danger:hover:not(:disabled) { background: #fdeceb; }

/* Opened by right-click, the menu is placed at the pointer by grid.js. */
.rowmenu.at-pointer .rowmenu-items { position: fixed; right: auto; }

/* What the request asked for, shown beside what is being typed. Quiet, but
   not so quiet that a supplier pricing a different quantity goes unnoticed. */
/* One supplier's line on a judgement criterion: a name, a score and a note,
   on one row rather than three stacked labels. */
.judgement-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.3rem 0;
}
.judgement-row label { margin: 0; min-width: 12rem; }
.judgement-row input[type=text] { margin: 0; }

.asked-qty { font-size: 0.8rem; color: #475569; }
.asked-qty strong { color: #1f2937; }

/* A block selected with Shift, ready to copy. */
.entry-table td.cell-selected { background: #e5eefc; }

.grid-help { margin-top: 0.4rem; font-size: 0.85rem; }
.grid-note { margin-top: 0.4rem; font-style: italic; }

/* A value typed once at the head of a column and applied to the blank cells
   under it. Set lighter than the heading it sits below so it reads as an entry
   field rather than as part of the column's name.

   **This rule used to start `.entry-table td.rowselect,`**, with the comment
   above sitting between the two selectors -- so the tick cell was picking up
   `display: block` and `width: 100%` and breaking out of its own row. The
   checkbox rendered on a line of its own above the row number, which is what
   made the first column of every grid two rows tall. A comment inside a
   selector list does not end it. */
.entry-table th input.col-default {
  display: block;
  width: 100%;
  margin-top: 0.15rem;
  padding: 0.1rem 0.2rem;
  font-size: 0.72rem;
  font-weight: 400;
  text-align: center;
}

/* The tick column. Narrow, centred, and the box is left where the browser
   draws it -- a restyled checkbox is a checkbox somebody cannot tell the state
   of. */
.entry-table th.rowselect,
.entry-table td.rowselect,
.row-menus th.rowselect,
.row-menus td.rowselect {
  width: 1.7rem;
  padding: 0 0.2rem;
  text-align: center;
  vertical-align: middle;
}
.entry-table td.rowselect input,
.row-menus td.rowselect input { margin: 0; }

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0.3rem 0 0.5rem;
  padding: 0.35rem 0.5rem;
  background: #f6f8fb;
  border: 1px solid var(--line, #cbd2dd);
  border-radius: 4px;
}
.bulk-all { display: flex; align-items: center; gap: 0.3rem; margin: 0; font-weight: 600; }
.bulk-all input { margin: 0; }
.bulk-count { min-width: 12rem; font-size: 0.85rem; }
.btn-small.danger { color: #b91c1c; border-color: #e7b7b5; }
.btn-small.danger:hover:not(:disabled) { background: #fdeceb; border-color: #d9534f; }

.grid-undo { display: flex; align-items: center; gap: 0.4rem; margin: 0.3rem 0 0.5rem; }

/* Undo, redo and "add more lines" on one line: the three that act on the grid
   as a whole rather than on the rows somebody has ticked. The row inside it
   keeps its own spacing to itself, or the two margins stack and the tools sit
   further from the grid than the grid's own heading does. */
.grid-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem 0.75rem; }
.grid-tools .grid-undo { margin: 0.3rem 0; }
.btn-small {
  border: 1px solid var(--line, #cbd2dd);
  background: #fff;
  border-radius: 4px;
  padding: 0.25rem 0.7rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.btn-small:hover:not(:disabled) { background: #eef2f8; border-color: #94a3b8; }
.btn-small:disabled { opacity: 0.4; cursor: default; }

/* A primary button asked to be small. ``.btn-small`` is declared after
   ``.btn-primary`` and sets a white background at the same specificity, so
   the later rule won: the navy fill went, the white label stayed, and the
   button came out white on white with only its border to show it was there.
   It looked like an empty text box, and that is what somebody reported.

   ``btn-primary btn-small`` is a combination anybody would reasonably write
   -- the two classes say "the important one" and "the small one" -- so the
   fix belongs here rather than in whichever template wrote it. */
.btn-primary.btn-small {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.btn-primary.btn-small:hover:not(:disabled) {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

@media (max-width: 800px) {
  /* Stacked on a phone the fixed layout is wrong -- every cell gets its own
     line, so let the widths go back to automatic. */
  .entry-table { table-layout: auto; }
  .entry-table td.rowtools { width: auto; text-align: left; }
  .rowmenu-items { right: auto; left: 0; }

  /* With the widths automatic, a box has nothing to size itself against, so
     it needs a floor to stay usable.
     **This line used to sit outside this block**, one line below the closing
     brace, so it applied at every width: on the desktop grid it forced every
     text box to 9rem, which is wider than the Qty column (5rem) and the UoM
     column (4rem). The boxes overflowed their cells and sat on top of the
     next column, which is what made the row look shifted against its own
     headings. */
  .entry-table input[type=text], .entry-table input[type=email] { min-width: 9rem; }
}

/* On the fixed layout the column decides the width, so a box takes its cell
   and nothing more. Said explicitly rather than left to the default, because
   the default -- the content's own width -- is what overflows a narrow
   column. */
.entry-table input[type=text],
.entry-table input[type=email],
.entry-table input[type=number],
.entry-table select { min-width: 0; }
.rownum { color: var(--muted); text-align: right; width: 2.5rem; }
.req { color: var(--bad); }

.role-chips { display: flex; flex-wrap: wrap; gap: 0.15rem 0.5rem; min-width: 14rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  margin: 0; font-weight: 400; font-size: 0.82rem; white-space: nowrap;
}
.chip input { width: auto; margin: 0; }

.btn-secondary {
  background: #fff; border-color: var(--line); color: var(--brand);
  text-decoration: none; margin-top: 1rem;
}
/* The gap belongs between two buttons, not in front of the first one.
   Carried unconditionally, it indented every lone secondary button by half a
   rem -- so an Actions card started its row to the right of the heading, the
   text, the label and the box beneath it, and looked like a mistake because
   it was one. Only where something precedes it on the line, which is the
   case it was written for. A button that posts sits in its own one-line
   form, so that counts as the thing in front. */
.btn + .btn-secondary,
form.inline + .btn-secondary,
.btn-secondary + .btn-secondary { margin-left: 0.5rem; }
.btn-secondary:hover { background: #eef4fa; }

/* ---------- one step in a document's Actions card ----------
   A heading, the button that does it, then the explanation underneath.

   The 0.5rem left margin on ``.btn-secondary`` is there so a secondary sits
   beside a primary in a row of buttons. A button that starts its own block
   has nothing to sit beside, and that margin put it eight pixels right of
   the heading and the paragraph it belongs to -- every box in the card
   starting on a slightly different vertical. Killed here, where the button
   is the first thing on its line. */
.action-step { margin-top: 0.9rem; }
.action-step > h3 { margin-bottom: 0.5rem; }
.action-step > .btn,
.action-step > form > .btn { margin-top: 0; margin-left: 0; }
.action-step > form { margin: 0; }
.action-step > p { margin-top: 0.6rem; }

tr.row-rejected td { background: #fdf3f3; }
.temp-password { font-size: 1rem; letter-spacing: 0.02em; background: #f4f6f9; padding: 0.1rem 0.35rem; }
input[type=file] { width: 100%; padding: 0.5rem 0; font: inherit; }

/* The running total, in the entry grid's own foot.
 *
 * It sits there rather than in a table of its own so that each figure lands
 * under the money column it was worked out from. A separate table has its own
 * columns by definition, and lining them up with the grid above by hand is a
 * measurement that goes wrong the first time a column changes width.
 *
 * No cell borders: these are not more rows of the list, they are what the
 * list came to, and ruling them like rows invites somebody to read them as
 * one. The label sits against its figure, right-aligned, for the same reason
 * a printed invoice does it that way. */
/* A figure on the supplier invoice's comparison panel that does not agree
   with what the lines come to. Coloured rather than merely present, because
   the panel's other cells are dashes and a reader scanning four rows for the
   one that differs should not have to read them. ``--bad`` is the same red the
   cash flow uses for a breach -- a difference here is not an error in what
   somebody typed, but it is the thing on the panel worth looking at. */
/* The delivery-order fields on the invoice's attachment form: a DO number
   and whether it was signed. Neither means anything on an invoice.

   Inverted on purpose -- this *hides* them when "their invoice" is chosen,
   rather than revealing them when "delivery order" is. A browser without
   :has() therefore leaves both showing, which is what the screen did before;
   the other way round would take the DO fields away on such a browser and
   leave no way to type a DO number at all. */
/* On the supplier invoice's billed grid the columns are sized by a colgroup,
   so a box should fill the column it is in rather than carry a width of its
   own. Left to themselves the quantity boxes were twice the width of the
   figures in them while the description wrapped onto three lines. */
table.entry-table[data-billed-lines] input[type="text"] { width: 100%; max-width: none; }

/* And *Read it* goes the other way: only their invoice is read into the
   invoice's own figures, so the button is withheld where the box says
   delivery order. Inverted like the rule below -- a browser without :has()
   shows the button and the server refuses it with a sentence, which is the
   right way round. The server is the control; this is the courtesy. */
/* The proforma question belongs to a claim, not to goods: a supplier asking
   to be paid before shipping sends a proforma, and goods delivered are
   invoiced. Hidden rather than removed, because some suppliers do send a
   proper tax invoice up front and that has to be recordable.

   Inverted like the others -- this hides it when goods is chosen, so a browser
   without :has() shows it and the box is simply ignored for goods, rather than
   losing it for the claims that need it. */
form:has(select[name="kind"] option[value="goods"]:checked) [data-when-claim] {
  display: none;
}

form:has(select[name="kind"] option[value="delivery_order"]:checked) [data-read-button] {
  display: none;
}

form:has(select[name="kind"] option[value="supplier_invoice"]:checked) [data-when-delivery] {
  display: none;
}

/* The traffic light on a supplier invoice.
   Colour *and* a word: roughly one man in twelve cannot tell red from amber,
   and a control nobody can read is not a control. */
.signal {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.signal-red { background: #FBE3E3; color: #8A1F1F; }
.signal-amber { background: #FDF0DC; color: #7A4A08; }
.signal-green { background: #E2F2E6; color: #1E5B2E; }
.signal-grey { background: var(--aq-navy-04); color: var(--aq-muted); }

[data-billed][data-differs] { color: var(--bad); font-weight: 600; }

.entry-table tfoot.order-total td { border: none; padding-top: 0.2rem; padding-bottom: 0.2rem; }
.entry-table tfoot.order-total tr:last-child td { padding-top: 0.45rem; }

/* ---------- phones and tablets ----------
   Staff approve and raise requests from their own phones, so every screen has
   to survive a narrow viewport. Wide data tables become stacked cards: each
   cell shows its column heading from the data-label attribute. */
@media (max-width: 700px) {
  .container { margin: 1rem auto; padding: 0 0.75rem; }

  .topbar { padding: 0.6rem 0.9rem; }
  .mainnav { order: 3; width: 100%; gap: 0.25rem 1rem; }
  /* The old top bar's links. Not the sidebar's: this took the padding off
     Dashboard and Waiting for you, and they sat against the edge, larger than
     the rows below them. */
  .mainnav a:not(.nav-item) { padding: 0.35rem 0; font-size: 0.95rem; }
  .userbox { margin-left: auto; }

  /* 16px minimum, or iOS Safari zooms the page on focus. */
  input[type=text], input[type=password], input[type=email], select, textarea {
    font-size: 16px;
    padding: 0.6rem;
  }
  .btn { padding: 0.65rem 1.1rem; font-size: 16px; }
  .btn-secondary { margin-left: 0; display: block; text-align: center; }

  .field-row, .field-row.three, .field-row.four { grid-template-columns: 1fr; }
  .card { padding: 0.85rem; }

  .entry-table, .entry-table thead, .entry-table tbody,
  .entry-table tr, .entry-table td { display: block; width: 100%; }
  .entry-table thead { display: none; }
  .entry-table tr {
    border: 1px solid var(--line); border-radius: 5px;
    padding: 0.5rem; margin-bottom: 0.75rem; background: #fbfcfd;
  }
  .entry-table td { border: none; padding: 0.25rem 0; }
  .entry-table td::before {
    content: attr(data-label);
    display: block; font-size: 0.78rem; font-weight: 600; color: var(--muted);
  }
  .entry-table .rownum { text-align: left; font-weight: 600; }
  .entry-table .rownum::before { content: none; }

  /* The work lists, the same way, because the button is in the last column.
   *
   * ``.table-wrap`` scrolls a wide table sideways, which on a phone puts the
   * Review button off the right-hand edge -- and a touch on a scrollable
   * strip is taken as a pan rather than a tap, so the cells that *are* links
   * stop answering too. An approver looking at a list of things waiting for
   * them could not open any of them.
   *
   * The labels these rules read have been on these cells all along; what was
   * missing was a rule pointing at them. Stacked, every row is a card, every
   * cell is full width, and the button is the last thing in it.
   *
   * Named rather than applied to every ``.table``: a two-column panel of
   * label and value reads perfectly well as a table on a phone, and stacking
   * it would double its height to say the same thing. */
  .table.stacks, .table.stacks tbody, .table.stacks tr, .table.stacks td {
    display: block;
    width: 100%;
  }
  .table.stacks thead { display: none; }
  .table.stacks tr {
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 0.6rem;
    margin-bottom: 0.75rem;
    background: #fbfcfd;
  }
  .table.stacks td, .table.stacks td.num {
    border: none;
    padding: 0.2rem 0;
    text-align: left;
  }
  /* Only where there is a heading to repeat. The action cell has none, and an
     empty label above a button is a blank line nobody can account for. */
  .table.stacks td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
  }
  /* Full width, so it cannot be missed and cannot be mistaken for text. */
  .table.stacks td .btn { display: block; text-align: center; margin-top: 0.35rem; }
  .role-chips { min-width: 0; }
  .chip { font-size: 0.9rem; padding: 0.15rem 0; }

  .band-head { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
  .footer { flex-direction: column; gap: 0.35rem; }
}

/* ---------- footer ----------
   Navy, closing the page the way the top bar opens it. Full-bleed, with the
   text held to the same measure as the content above it. */
.footer {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between;
  max-width: 1100px; margin: 2rem auto 0; padding: 1rem;
  color: var(--aq-ink-dim); font-size: 0.8rem;
  border-top: 1px solid var(--aq-line);
}

/* ---------- the rolling cash chart ----------
   Server-drawn SVG, so it prints and needs no script. Its one rule:
   **confidence is opacity and line style, never hue.** Jade is money in and
   copper is money out in both halves; what separates recorded fact from
   forecast is that the forecast is lighter and its line is dashed. A
   colour-blind reader still sees the split, and so does a photocopy.

   Red appears only when the balance actually goes under. A warning that is
   always on is not a warning. */
.cash-panel {
  background: var(--aq-navy);
  border-radius: 8px;
  padding: 1.25rem 1.25rem 0.75rem;
  margin-bottom: 1.25rem;
}
.cash-panel h2,
.cash-panel .cash-caption { color: var(--aq-grey); }
.cash-panel h2 { margin: 0 0 0.35rem; font-size: 1rem; }
.cash-panel .cash-caption {
  margin: 0 0 1rem;
  opacity: 0.72;
  font-size: 0.85rem;
  max-width: 62em;
}
.cash-panel .cash-figures {
  display: flex;
  flex-wrap: wrap;
  gap: 1.75rem;
  margin: 0 0 1rem;
  color: var(--aq-grey);
}
.cash-panel .cash-figures div { font-size: 0.85rem; opacity: 0.72; }
.cash-panel .cash-figures strong {
  display: block;
  font-size: 1.15rem;
  opacity: 1;
  font-variant-numeric: tabular-nums;
}
.cash-panel .cash-figures .is-breach strong { color: var(--aq-red-on-dark); }

svg.cashchart { width: 100%; height: auto; display: block; }

svg.cashchart .grid      { stroke: rgba(230, 234, 240, 0.10); stroke-width: 1; }
/* Nought. Drawn over the bars rather than under them, and heavier than the
   other gridlines because it is not one of them: it is the line the chart is
   read against. Still grey, not red -- the colour on this chart means "under",
   and a permanently coloured baseline would spend that meaning before anything
   had gone wrong. */
svg.cashchart .grid-zero { stroke: rgba(230, 234, 240, 0.55); stroke-width: 1.5; }
svg.cashchart .axis,
svg.cashchart .week,
svg.cashchart .week-date,
svg.cashchart .divide-label {
  fill: var(--aq-grey);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  letter-spacing: 0.08em;
}
svg.cashchart .axis      { font-size: 12px; opacity: 0.6; }
/* The unit sits above the figures it governs, and is stated once. Brighter
   than the numbers because reading them without it gets the scale wrong by a
   factor of a thousand. */
svg.cashchart .axis-unit { font-size: 11px; opacity: 0.9; letter-spacing: 0.1em; }
svg.cashchart .week      { font-size: 12px; opacity: 0.85; }
svg.cashchart .week-date { font-size: 10px; opacity: 0.45; }

/* The moment the record stops and the forecast starts. */
svg.cashchart .divide {
  stroke: var(--aq-gold);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0.85;
}
svg.cashchart .divide-label { font-size: 11px; fill: var(--aq-gold); opacity: 0.9; }

/* Hue says which direction the money went. Opacity says how sure we are. */
svg.cashchart .bar-in  { fill: var(--aq-jade); }
svg.cashchart .bar-out { fill: var(--aq-copper); }
svg.cashchart .actual   { fill-opacity: 0.95; }
svg.cashchart .forecast { fill-opacity: 0.45; }

svg.cashchart .net-actual,
svg.cashchart .net-forecast,
svg.cashchart .net-breach {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
svg.cashchart .net-actual   { stroke: var(--aq-cyan); }
svg.cashchart .net-forecast { stroke: var(--aq-cyan); opacity: 0.7; stroke-dasharray: 6 4; }
svg.cashchart .net-breach   { stroke: var(--aq-red); stroke-dasharray: 6 4; }

svg.cashchart .dot-actual   { fill: var(--aq-cyan); }
svg.cashchart .dot-forecast { fill: var(--aq-navy); stroke: var(--aq-cyan); stroke-width: 1.6; }

svg.cashchart .breach-ring {
  fill: none;
  stroke: var(--aq-red);
  stroke-width: 2.4;
}
svg.cashchart .breach-label {
  fill: var(--aq-red-on-dark);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.cash-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin: 0.5rem 0 0;
  padding: 0.75rem 0 0.25rem;
  border-top: 1px solid rgba(230, 234, 240, 0.10);
  list-style: none;
  color: var(--aq-grey);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  opacity: 0.8;
}
.cash-legend li { display: flex; align-items: center; gap: 0.45rem; }
.cash-legend i {
  width: 20px;
  height: 0;
  border-top-width: 3px;
  border-top-style: solid;
  display: inline-block;
}
/* --- the scenario comparison line ---------------------------------------
   Baseline and scenario are the same measure, so they are the same hue. What
   separates them is weight and dash, exactly as actual and forecast are
   separated on the rolling chart: it survives a photocopy, and a reader who
   cannot tell the two greens apart can still tell the ghost from the line. */
svg.cashchart .net-baseline,
svg.cashchart .net-scenario {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
svg.cashchart .net-baseline {
  stroke: var(--aq-grey);
  opacity: 0.45;
  stroke-dasharray: 6 4;
}
svg.cashchart .net-scenario { stroke: var(--aq-cyan); stroke-width: 2.6; }
svg.cashchart .dot-breach   { fill: var(--aq-red); }
svg.cashchart .buffer {
  stroke: var(--aq-gold);
  stroke-width: 1.25;
  stroke-dasharray: 2 4;
  opacity: 0.85;
}
svg.cashchart .buffer-label {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 10px;
  fill: var(--aq-gold);
  letter-spacing: 0.09em;
  opacity: 0.9;
}
.cash-legend .k-baseline { border-top-color: var(--aq-grey); border-top-style: dashed; opacity: 0.6; }
.cash-legend .k-scenario { border-top-color: var(--aq-cyan); }
.cash-legend .k-buffer   { border-top-color: var(--aq-gold); border-top-style: dotted; }

.cash-legend .k-in       { border-top-color: var(--aq-jade); }
.cash-legend .k-out      { border-top-color: var(--aq-copper); }
.cash-legend .k-actual   { border-top-color: var(--aq-cyan); }
.cash-legend .k-forecast { border-top-color: var(--aq-cyan); border-top-style: dashed; opacity: 0.75; }
.cash-legend .k-breach   { border-top-color: var(--aq-red); border-top-style: dashed; }

/* The figures, on hover. A transparent strip over each period, so pointing
   anywhere in the column brings its numbers up rather than having to find a
   3px dot. Pure CSS: no script, and it survives one being blocked. */
svg.cashchart .hotzone { fill: transparent; }
svg.cashchart .hotspot:hover .hotzone { fill: rgba(230, 234, 240, 0.05); }
svg.cashchart .tip { opacity: 0; pointer-events: none; transition: opacity 90ms ease-out; }
svg.cashchart .hotspot:hover .tip { opacity: 1; }
svg.cashchart .tip-card {
  fill: #0B1F3A;
  stroke: rgba(230, 234, 240, 0.22);
  stroke-width: 1;
}
svg.cashchart .tip-title,
svg.cashchart .tip-row {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
  fill: var(--aq-grey);
}
svg.cashchart .tip-title { font-size: 11px; letter-spacing: 0.06em; opacity: 0.75; }
svg.cashchart .tip-figure { font-variant-numeric: tabular-nums; }
svg.cashchart .tip-in  { fill: var(--aq-jade); }
svg.cashchart .tip-out { fill: var(--aq-copper); }
svg.cashchart .tip-net { fill: var(--aq-cyan); }

/* The grain picker sits with the chart, not with the page filters: it changes
   how this panel is cut, and nothing else. */
.cash-panel .cash-grain { display: flex; align-items: center; gap: 0.6rem; margin: 0 0 1rem; }
.cash-panel .cash-grain label {
  color: var(--aq-grey);
  opacity: 0.72;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.cash-panel .cash-grain select {
  background: var(--aq-slate);
  color: var(--aq-grey);
  border: 1px solid rgba(230, 234, 240, 0.22);
  border-radius: 4px;
  padding: 0.3rem 0.5rem;
  font: inherit;
  font-size: 0.85rem;
}

/* ---------- the delivery calendar ----------
   A month grid somebody plans a crane against. Today is named as well as
   tinted: a colour alone is lost on a photocopy and on a reader who cannot
   see it, and "which square is today" is the first thing anybody looks for. */
.calendar td.calendar-day { vertical-align: top; }
.calendar .calendar-date {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted, #6B7280);
  margin-bottom: 0.25rem;
}
.calendar .calendar-other { background: rgba(0, 0, 0, 0.02); }
.calendar .calendar-other .calendar-date { opacity: 0.5; }

.calendar td.calendar-today {
  background: rgba(0, 194, 203, 0.08);
  box-shadow: inset 0 0 0 2px var(--aq-cyan);
}
.calendar .calendar-today .calendar-date { color: var(--aq-navy); font-weight: 700; }
.calendar .calendar-today-tag {
  background: var(--aq-cyan);
  color: var(--aq-navy);
  border-radius: 3px;
  padding: 0 0.35rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.09em;
}

.calendar .calendar-item {
  border-top: 1px solid var(--line, #E6EAF0);
  padding: 0.35rem 0 0.2rem;
  margin-top: 0.3rem;
}
.calendar .calendar-item:first-of-type { border-top: 0; margin-top: 0; }

/* A month grid has thirty-five boxes on it and the reader is scanning, not
   reading. Everything under the order number is set small and tight; the
   order number stays full size because it is what they click. */
.calendar .calendar-meta {
  font-size: 0.72rem;
  line-height: 1.25;
  color: var(--muted, #6B7280);
  overflow-wrap: anywhere;
}
.calendar .calendar-meta strong { color: var(--ink, #16233D); }
.calendar .calendar-item .tag { font-size: 0.6rem; padding: 0 0.3rem; }
.calendar .calendar-item .small { font-size: 0.72rem; line-height: 1.25; }

/* An overdue figure in an ageing table. Weight and colour together, never
   colour alone: the report gets photocopied and read by people who cannot see
   red, and "which column is the bad one" has to survive both. */
.table .is-late { font-weight: 700; color: var(--aq-red); }


/* =======================================================================
   Cash flow scenarios
   =======================================================================
   The page is read the way a scenario is argued: the two figures that decide
   it first, the picture second, the working underneath. Nothing here is
   coloured to mean anything the words do not already say. */

/* The headline pair. Bigger than anything else on the page, because "when do
   we run out" and "how big a line do we need" are the whole exercise; the
   month-by-month table exists to be checked, not to be read first. */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem;
  margin: 0 0 1.25rem;
}
.kpi {
  background: var(--aq-card);
  border: 1px solid var(--aq-line);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  box-shadow: var(--aq-shadow);
}
.kpi .kpi-key {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--aq-ink-dim);
  font-weight: 700;
}
.kpi .kpi-value {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--aq-mono);
  font-size: 1.3rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.kpi .kpi-was {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.75rem;
  color: var(--aq-ink-dim);
}
.kpi .kpi-was s { opacity: 0.75; }
.kpi.is-bad  .kpi-value { color: var(--aq-red); }
.kpi.is-good .kpi-value { color: var(--aq-jade); }

/* A scenario print-out must never be mistaken for the forecast. Stated in
   words at the top of the page, and repeated as a band down the side so it
   survives being screenshotted from halfway down. */
.scenario-page { position: relative; }
.scenario-page::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 -0.85rem;
  width: 4px;
  border-radius: 2px;
  background: repeating-linear-gradient(
    -45deg, var(--aq-gold) 0 6px, transparent 6px 12px
  );
  opacity: 0.7;
  pointer-events: none;
}
@media (max-width: 760px) { .scenario-page::before { display: none; } }

/* Panels within the page. Plain sections rather than scripted tabs: the whole
   thing prints, and a tab nobody can print is a tab that gets photographed. */
.scenario-section { margin: 0 0 1.25rem; }
.scenario-section > h2 {
  font-size: 1rem;
  margin: 0 0 0.15rem;
}
.scenario-section > .section-hint {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--aq-ink-dim);
  max-width: 62em;
}

/* The transactions behind a period. A <details> rather than a drawer: it costs
   no script, it prints open if somebody expands it, and it keeps the figure
   and its contents in the same place on the page. */
.drill { margin: 0; }
.drill > summary {
  cursor: pointer;
  font-family: var(--aq-mono);
  font-variant-numeric: tabular-nums;
  list-style: none;
}
.drill > summary::-webkit-details-marker { display: none; }
.drill > summary::after {
  content: " ▸";
  color: var(--aq-ink-dim);
  font-family: var(--aq-font);
}
.drill[open] > summary::after { content: " ▾"; }
.drill > summary:hover { color: var(--aq-cyan); }
.drill .drill-body {
  margin: 0.4rem 0 0.2rem;
  padding: 0.5rem 0.75rem;
  background: var(--aq-bg);
  border-left: 3px solid var(--aq-line);
  border-radius: 0 6px 6px 0;
}
/* The same size as every other table, so a figure drilled into looks like the
   figure it came from. */
.drill .drill-body table { margin: 0; font-size: 0.75rem; }

/* The chain of adjustments that produced a figure. Monospace so the arrows
   line up and the reader can see it is a sequence, not a list of opinions. */
.trace-chain {
  font-family: var(--aq-mono);
  font-size: 0.75rem;
  color: var(--aq-ink-dim);
  margin: 0.15rem 0 0;
  padding: 0;
  list-style: none;
}
.trace-chain li::before { content: "→ "; opacity: 0.6; }

/* Data quality. The maths can only be as good as the ledger under it, so the
   gaps are named on the page rather than left for somebody to infer from a
   number that looks wrong. */
.quality-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.6rem;
}
.quality-item {
  border: 1px solid var(--aq-line);
  border-left-width: 3px;
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  background: var(--aq-card);
}
.quality-item.is-clear { border-left-color: var(--aq-jade); }
.quality-item.needs-filling { border-left-color: var(--aq-gold); }
.quality-item .quality-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
}
.quality-item .quality-count {
  font-family: var(--aq-mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.quality-item.needs-filling .quality-count { color: var(--aq-gold); }
.quality-item.is-clear .quality-count { color: var(--aq-jade); }
.quality-item .quality-note {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--aq-ink-dim);
}

/* Tabs, built from a stack of sections by static/tabs.js. Without the script
   every panel is on the page one after another with its own heading, so this
   only has to style the enhanced case; the plain one is already styled by the
   ordinary section rules. */
.tabstrip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0 0 0.9rem;
  border-bottom: 1px solid var(--aq-line);
  padding-bottom: 0.4rem;
}
.tabstrip button {
  border: 1px solid transparent;
  background: none;
  color: var(--aq-ink-dim);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
}
.tabstrip button:hover { color: var(--aq-ink); background: var(--aq-navy-04); }
.tabstrip button.current {
  background: var(--aq-card);
  border-color: var(--aq-line);
  color: var(--aq-ink);
  box-shadow: var(--aq-shadow);
}

/* The period grid. Figures are the point of it, so they get the monospace
   stack and the columns line up; the period name stays in the body face
   because it is read as words, not scanned as digits. */
.period-grid td.num, .period-grid th.num { font-variant-numeric: tabular-nums; }
.period-grid tbody tr.is-breach td.closing { color: var(--aq-red); font-weight: 700; }
.period-grid tbody tr.is-touched td.period { border-left: 3px solid var(--aq-cyan); }
.period-grid td.period { border-left: 3px solid transparent; }
.period-grid td.out    { color: var(--aq-copper); }
.period-grid td.net-down { color: var(--aq-red); }
.period-grid td.count  { color: var(--aq-ink-dim); }
.period-grid .nil      { color: var(--aq-ink-dim); }

/* Scenario lines on the comparison chart. Told apart by dash pattern as well
   as by weight: there is no hue to spare here, and a dash survives both a
   photocopy and a reader who cannot separate the greens. */
svg.cashchart .net-scenario.line-1 { stroke: var(--aq-cyan); stroke-dasharray: none; }
svg.cashchart .net-scenario.line-2 { stroke: var(--aq-cyan); stroke-dasharray: 10 4; opacity: 0.9; }
svg.cashchart .net-scenario.line-3 { stroke: var(--aq-cyan); stroke-dasharray: 2 4; opacity: 0.8; }
svg.cashchart .series-label {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  fill: var(--aq-cyan);
}

/* The comparison table under it: one row per scenario, the two headline
   figures first because they are what the meeting is deciding on. */
.standings td.headline { font-weight: 700; }
.standings tr.is-baseline td { background: var(--aq-navy-04); }
.standings td.worse { color: var(--aq-red); }
.standings td.better { color: var(--aq-jade); }


/* The adjustment lines. One row per move, everything about it on the row. */
.presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 0 0.25rem;
}
.presets .section-label { margin-right: 0.2rem; }
.presets form { display: inline; }
.presets button { font-size: 0.78rem; padding: 0.3rem 0.6rem; }

.panel-head { margin-bottom: 0.5rem; }

.adjustment-lines tbody tr.is-off td { opacity: 0.45; }
.adjustment-lines td.actions { white-space: nowrap; }
.adjustment-lines td.actions button { padding: 0.15rem 0.4rem; font-size: 0.8rem; }

/* The on/off switch. A button, because it submits -- there is no scripted
   state that can get out of step with the figures above it. */
.switch {
  width: 34px;
  height: 20px;
  border-radius: 999px;
  border: none;
  background: var(--aq-cyan);
  position: relative;
  padding: 0;
  cursor: pointer;
}
.switch[aria-pressed="false"] { background: var(--aq-line); }
.switch .switch-dot {
  position: absolute;
  top: 3px;
  left: 17px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
}
.switch[aria-pressed="false"] .switch-dot { left: 3px; }

/* With nothing switched on the page is the forecast, so the striped band that
   marks a scenario print-out is not drawn. */
.scenario-page.is-baseline::before { display: none; }

/* Expanding a period in the grid. The summary is the whole cell, so the click
   target is the period name rather than a marker beside it. */
.period-grid .drill > summary { padding: 0.1rem 0; }
.period-grid .drill[open] > summary { font-weight: 700; }


/* --- the drill panel ------------------------------------------------------
   A figure in the forecast grid is a link to the block of transactions behind
   it. With scripting those blocks stay hidden and the panel shows them; with
   scripting off, :target reveals the block in place. One set of markup, two
   ways of reading it, and no request either way. */
.cell-drill {
  color: inherit;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--aq-line);
  text-underline-offset: 3px;
  cursor: pointer;
}
.cell-drill:hover {
  text-decoration-style: solid;
  text-decoration-color: var(--aq-cyan);
}

/* An adjustment line on the claim sheet: what it is for, and which way it
   goes, in the column that names the line. They are one answer -- "less
   liquidated damages" -- and two cells for it would leave the sheet with a
   column that is blank on every row but these. */
.adjust-what {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.adjust-what input { flex: 1 1 auto; min-width: 0; }
.adjust-what select { flex: 0 0 auto; width: auto; }
/* The blank one at the foot, which is how another is added. Lighter, so the
   row that records nothing yet does not read as a line of the claim. */
.adjust-new input::placeholder { font-style: italic; }

/* A figure that came back refused. The box holding it says so, rather than
   only the message at the top of the page: on a long screen the two can be
   far enough apart that the message is read and the box is not found. */
.is-refused {
  border-color: var(--aq-red);
  background: rgba(224, 75, 75, 0.06);
}
.is-refused:focus {
  outline-color: var(--aq-red);
  border-color: var(--aq-red);
}

/* A payment application reaches its bottom line twice: across the current
   column -- this month's movement, less what this certificate holds and
   concedes -- and down the total column, from the gross to date less
   everything ever held, conceded and paid. The two have to meet.

   Where they do not, both figures stand and the difference is said. It is
   money claimed earlier and never paid for, which is ordinary on a client
   who disallowed a line and a mistake where an opening position was typed
   with the retention already netted off -- and the arithmetic cannot tell
   those apart, so nothing here refuses a save. */
.sheet-off { color: var(--aq-red); }
.sheet-off-note > td {
  color: var(--aq-red);
  font-weight: 400;
  white-space: normal;
}
.sheet-off-note.is-quiet { display: none; }

/* Retention held, one line per job, with that job's claims underneath. The
   figure is a link to the row below it and :target reveals it in place: no
   script, it prints, and the address bar carries which job was opened -- so
   the link can be sent to whoever asked how much the client is holding.

   Deliberately not ``.cell-drill``. That class is bound by drill.js, which
   looks for a cash-flow ``.drill-source`` block; here it would swallow the
   click and show nothing. */
.ret-drill {
  color: inherit;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--aq-line);
  text-underline-offset: 3px;
  cursor: pointer;
}
.ret-drill:hover {
  text-decoration-style: solid;
  text-decoration-color: var(--aq-cyan);
}
.ret-detail { display: none; }
/* Scriptless: the anchor reveals it. */
.ret-detail:target { display: table-row; }
/* With expand-row.js, which opens it where it stands rather than navigating
   to it -- a reader half way down a list of fourteen should still be there
   when the detail appears. The :target rule then stands down, or a fragment
   left in the address bar would hold open a row the toggle has just closed. */
.ret-detail.is-open { display: table-row; }
body.has-expand .ret-detail:target:not(.is-open) { display: none; }
.ret-detail > td {
  background: var(--aq-bg);
  border-left: 3px solid var(--aq-cyan);
}
.ret-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 0.4rem;
}
/* The same size as every other table, so a figure drilled into looks like the
   figure it came from. */
.ret-detail table { margin: 0; font-size: 0.8rem; }
/* Printed, the working belongs with the summary rather than behind a click. */
@media print {
  .ret-detail { display: table-row; }
  .ret-detail-head a { display: none; }
}

.drill-source {
  display: none;
  margin: 0.75rem 0;
  padding: 0.75rem;
  border: 1px solid var(--aq-line);
  border-left: 3px solid var(--aq-cyan);
  border-radius: 0 8px 8px 0;
  background: var(--aq-card);
}
/* Scriptless: the anchor reveals it. Once the panel exists it must not. */
.drill-source:target { display: block; }
body.has-drill-panel .drill-source:target { display: none; }

.drill-scrim {
  position: fixed;
  inset: 0;
  background: rgba(11, 31, 58, 0.34);
  z-index: 55;
}
.drill-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(720px, 94vw);
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: var(--aq-card);
  border-left: 1px solid var(--aq-line);
  box-shadow: -16px 0 40px -20px rgba(11, 31, 58, 0.45);
}
.drill-panel > header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--aq-line);
}
.drill-panel > header h2 { margin: 0; font-size: 1rem; flex: 1 1 auto; }
.drill-panel .drill-body { overflow: auto; padding: 0 0 1rem; }
.drill-panel .drill-body .drill-source {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}
.drill-panel .pad { padding: 0.75rem 1.1rem; }
.drill-panel .trace-row td { padding-top: 0; }

/* The page behind does not scroll while the panel is open. */
body.drill-open { overflow: hidden; }

@media print {
  .drill-scrim, .drill-panel { display: none !important; }
  .drill-source { display: block !important; }
}

/* ---------------------------------------------------------------------------
   The owed table on Payments.

   Its columns are stated in the markup; these rules make the controls inside
   them fit rather than fight. Left to itself the browser handed the width to
   whatever held the longest string -- a select full of account names -- and
   squeezed the two columns somebody actually reads, the invoice number and the
   order it belongs to.
   --------------------------------------------------------------------------- */

/* Sized by capping the controls, not by dictating the columns.

   A fixed layout was tried and was worse: the stated widths came to almost the
   whole table, so the one column left to size itself -- the supplier -- got
   the scraps and wrapped "ProMinent Fluid Controls (M) Sdn Bhd" one word to a
   line, eight rows deep. The browser is good at sizing a column to its
   content; what it cannot know is that a select and a money box do not need
   all the room they ask for. So those two are capped, and the space they give
   back goes where it is wanted -- the invoice and order numbers -- without
   anything having to say so. */

/* Shorter than the 13rem a source picker gets elsewhere. Account names here
   are short -- "RHB 561", "UOB" -- and a longer one is clipped by the select
   itself, which is what a dropdown is for. Every rem taken off this column is
   a rem the supplier name gets, and the supplier is the one column on the row
   that is genuinely long. */
.owed-table select.source { max-width: 7rem; min-width: 0; }

/* The supplier is bounded at both ends. A floor, so a company name stops
   breaking across four lines while a dropdown sits half empty beside it; and a
   ceiling, because it is the only column long enough to push the table past
   the edge of the window and start it scrolling sideways. Between the two it
   wraps to a second line, which costs a row a few millimetres of height and
   saves the whole table from being read through a letterbox. */
.owed-table td:nth-child(3),
.owed-table th:nth-child(3) { min-width: 8rem; max-width: 12rem; }

/* The reference is a cheque number, not a sentence. */
.owed-table input[name^="reference_"] { max-width: 7.5rem; }

/* Wide enough for a seven-figure sum and no wider, so the row is one line
   deep. ``226,647.16`` is eleven characters. */
.owed-table input.num { max-width: 7rem; }

/* One height for every box on the row.

   Money boxes are set a size larger than other table inputs everywhere else,
   so they match the figures in the column above them, and they are excluded by
   name from the compact padding the text boxes get. Both are right on their
   own; side by side on the same row they read as one box swollen next to its
   neighbour, which is what the amount box looked like against the cheque
   number. Here they are given the same metrics and the row settles to one
   height. The monospace and the right alignment stay -- those are what make a
   column of figures readable, and they cost no height. */
.owed-table td input[type="text"] {
  font-size: 0.8rem;
  padding: 0.15rem 0.35rem;
  min-height: 0;
  line-height: 1.5;
}
.owed-table td, .owed-table th { vertical-align: middle; }

/* One token each, so they keep it whole rather than breaking mid-number.
   Everything else -- the supplier, above all -- wraps as it likes.

   Counted from the left, so they move when a column is inserted: tick,
   invoice, supplier, order, project, due. Adding Project pushed Due along by
   one, and a stale number here would have wrapped a date instead. */
.owed-table td:nth-child(2),
.owed-table td:nth-child(4),
.owed-table td:nth-child(5),
.owed-table td:nth-child(6),
.owed-table th:nth-child(4),
.owed-table th:nth-child(5) { white-space: nowrap; }

/* ---------------------------------------------------------------------------
   The claim programme.

   Eight columns of boxes in a row is a lot of furniture, and at the width a
   text input takes by default it read as a form somebody had spilled into a
   table. Each box is sized to what it holds instead, which is what makes the
   row scan as a line of a schedule rather than a stack of fields.
   --------------------------------------------------------------------------- */

.programme-table input[type="text"],
.programme-table input[type="date"] {
  font-size: 0.8rem;
  padding: 0.15rem 0.35rem;
  min-height: 0;
  line-height: 1.5;
}
/* A claim number is "PC 07"; the money boxes hold seven figures and a comma. */
.programme-table td:first-child input { max-width: 5.5rem; }
.programme-table input.num { max-width: 7rem; }
.programme-table input[type="date"] { max-width: 8.5rem; }

/* One token each. The figures and dates keep their own line; only the status
   cell, which carries a sentence about the variance, is allowed to wrap. */
.programme-table td, .programme-table th { vertical-align: middle; white-space: nowrap; }
.programme-table td:nth-child(9) { white-space: normal; }

/* The headings wrap, the figures under them do not.
   "Forecast this period (RM)" held on one line is 190px of a table that has
   eight columns and a sidebar beside it; over two lines it is the width of
   the figures underneath, which is what the column actually needs. A heading
   is read once and the column is read every time. */
.programme-table th { white-space: normal; }
.programme-table thead th { line-height: 1.25; }

/* And the claim's name, which is the column that actually grew. "PC 01" is
   five characters and "Progressive Claim No. 27" is twenty-four: held on one
   line it took a hundred and thirty pixels off the figures beside it and the
   card scrolled sideways, which takes the heading and the paragraph
   explaining it off the screen along with them. */
.programme-table td:first-child { white-space: normal; min-width: 7rem; }

/* A budget heading, in the tables that show a cost plan.
   Set apart rather than merely bold: a heading carries the sum of the lines
   under it and nothing of its own, so a reader adding the column down the page
   would double-count if the two read alike. */
/* The three levels of a cost plan, told apart by weight and ground rather
   than by indentation alone.

   Indentation on its own is four spaces in a narrow column, and on a
   forty-line chart a reader loses which tier a row belongs to halfway down --
   which matters here because the tiers mean different things: a discipline
   totals its packages, a package totals its items, and only the items can be
   charged to. Darkest at the top, plain white at the bottom, so the eye reads
   the structure without reading the codes.

   Deliberately quiet: these rows are read for their figures, and a table with
   three strong bands in it is a table nobody can scan down a column of. */
.budget-row-0 > td { background: #eef1f6; font-weight: 600; }
.budget-row-1 > td { background: #f7f9fb; }
.budget-row-2 > td { background: #fff; }
/* An overspend still wins. It is what somebody came to the page to find, and
   a level shade must never hide it. */
.budget-row-0.row-alert > td,
.budget-row-1.row-alert > td,
.budget-row-2.row-alert > td { background: #fdeceb; }

.budget-heading td { background: #f4f6f9; }
.budget-heading code { font-weight: 700; }
/* A heading's own shade comes from its level, not from being a heading: at
   three levels "heading" is two different rows. */
.budget-row-0.budget-heading > td { background: #eef1f6; }
.budget-row-1.budget-heading > td { background: #f7f9fb; }

/* The note under a heading's budget: "from its sub-lines".
   It sits in the money column, which is sized for a figure and not for a
   sentence, so left alone it wrapped to three words and two lines and made the
   row twice as tall as the ones around it. Kept on one line, and the column
   opens far enough for it. */
.budget-note {
  white-space: nowrap;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 400;
}

/* The budget table's in-place editing. The boxes sit in cells sized for the
   text they replace, so they take the cell rather than the 100% a form field
   gets everywhere else -- which would push each row's buttons onto a line of
   their own, the same fault .rowform exists for. */
.table td .budget-amount { width: 9rem; text-align: right; }
.table td input[type="text"][name="name"] { width: 100%; min-width: 12rem; }
/* One height for both boxes on the row, stated rather than arrived at. The two
   carry different type sizes on purpose -- the figure follows its column, the
   name follows the table -- so matching their padding still leaves them a few
   pixels apart, and a chart read down forty-two rows shows that. ``box-sizing:
   border-box`` is set globally, so an explicit height is the same rendered
   height whatever the font does. */
/* Guarded like every other control-in-a-table rule: on a phone the cells
   stack into a card and every input goes back to 16px, because anything
   smaller makes iOS Safari zoom the page on focus. Nothing about a stacked
   card needs these two boxes the same height. */
@media (min-width: 701px) {
  .table td input[type="text"][name="name"],
  .table td .budget-amount {
    height: 1.6rem;
    /* Vertical padding comes off because the height now says it. Left on, it
       eats into a box 1.6rem tall and the larger of the two type sizes starts
       clipping its own descenders; an input centres its text vertically
       without help. The side padding stays -- a figure hard against the border
       reads as a fault. */
    padding-top: 0;
    padding-bottom: 0;
  }
}
/* Two cards that are alternatives, side by side once there is room.

   Grid rather than flex, so the two columns are equal whatever is in them: the
   add-a-line form is three times the height of the upload card, and a flex row
   would have sized the columns to their content and left the short one looking
   like a mistake. `align-items: start` stops the short card stretching to
   match the tall one, which would have given it a foot of empty white.

   One column until there is room for two. The threshold is the page's own
   measure, not a device: below it the cards keep the width they always had. */
.admin-columns {
  display: grid;
  grid-template-columns: minmax(0, 560px);
  align-items: start;
  gap: 1rem;
}

@media (min-width: 1000px) {
  /* Capped, not shared out. These are forms -- a file to choose, a few
     boxes and the sentences explaining them -- and on a page widened for its
     grid an equal share of 2400px is a text box four feet long with a
     sentence stretched across it. 560px is the measure the cards were
     written to and the one they keep when the column stacks. */
  .admin-columns { grid-template-columns: repeat(2, minmax(0, 560px)); }
}

/* Two header boxes, side by side.

   Written for the direct order -- what is being bought and from whom, and the
   evidence that it was a choice -- and named for the shape rather than that
   screen, because the claim pages want it for the same reason: the claim and
   the certificate are two halves of one decision, and reading one while
   filling in the other meant scrolling past the whole of the first.

   Equal halves -- see the rule below. 1100px rather than the usual breakpoint,
   because below that two columns of form fields are narrower than the
   sentences explaining them, and a hint nobody can read is worse than a longer
   page. */
.paired-columns { display: grid; gap: 0 1.2rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 1100px) {
  /* Equal halves.

     The order box had the wider share, on the argument that it asks the most.
     What that actually produced was two boxes of different widths holding
     fields of the same kind, which reads as one being more important than the
     other -- and the requisition half, where the quotes and their attachments
     go, was the one being squeezed. They are two halves of one decision, so
     they get one width. */
  .paired-columns { grid-template-columns: 1fr 1fr; }
}
/* The cards inside it drop the fixed width they carry when stacked: the column
   is the width now, and a max-width would leave the second half of it empty. */
.paired-columns > .card { max-width: none; }

/* The quotation a competing supplier sent, under the row it belongs to.

   A sub-row of the quotes table rather than a column of its own: a file input
   and a paste box do not fit beside three figures, and what is attached is
   read after the figure it supports rather than beside it. */
.quote-evidence { padding-top: 0.2rem; padding-bottom: 0.6rem; }
.quote-evidence .quote-upload-js {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.4rem 0.9rem;
}
.quote-evidence label { display: flex; flex-direction: column; margin: 0; font-weight: 600; }
.quote-evidence input[type="file"] { width: auto; }
.quote-evidence textarea { min-width: 14rem; min-height: 2.4rem; }
/* The paste box and the button that keeps it, side by side and wrapping as a
   pair. Loose in the flex row, the button dropped to a line of its own under a
   box that still looked empty, which reads as "nothing happened". */
.quote-evidence .quote-paste { display: flex; align-items: flex-end; gap: 0.5rem; }
.quote-evidence .quote-paste label { flex: 1 1 auto; min-width: 0; }
.quote-evidence .btn { margin: 0; }
.quote-files { margin: 0 0 0.3rem; padding-left: 1.1rem; }
.quote-files.is-empty { display: none; }

.budget-heading-name { font-weight: 700; }
/* The heading picker sits beside the code, on the same line.

   It was underneath, to keep the code column narrow. That was the wrong trade:
   it made every row of a forty-two line chart two lines tall, which costs far
   more reading than the few millimetres it saved. It is only ever as wide as
   "under MECH-01" needs, because the options say where a line goes, not what
   the heading is called -- the name is already on the row above. */
/* The code, now that it is typed rather than read. Monospaced and only as
   wide as a code, so a column of them still reads down as a column -- a
   full-width box here would push the heading picker onto a second line and
   undo what the rule below is for.

   The width comes from the ``size`` attribute, which the server sets from the
   longest code on the chart. A width fixed here was set for the longest code
   any project might ever carry, and charts do not have one: numbered 1, 1.1,
   1.2.1 every box sat two-thirds empty. ``width: auto`` is what lets ``size``
   through -- a width in this rule would override it. */
.table td .line-code {
  display: inline-block;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 0.1rem 0.3rem;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.78rem;
  height: 1.4rem;
  vertical-align: middle;
}

.table td .line-parent {
  display: inline-block;
  width: auto;
  max-width: 8rem;
  margin: 0 0 0 0.4rem;
  font-size: 0.7rem;
  padding: 0 0.2rem;
  height: 1.4rem;
  vertical-align: middle;
}

/* The code and its picker are one thing and stay on one line. Only on a real
   screen: on a phone the row is a stacked card and wrapping is what should
   happen. */
@media (min-width: 701px) {
  .table td[data-label="Code"] { white-space: nowrap; }
}
.actions .btn-link.danger { color: #b91c1c; }

/* The one Save under a whole sheet of rows. Set apart from the table with a
   rule above it so it reads as "everything above this", not as a footer of the
   last row -- which is what it looked like when it sat flush. */
.grid-save {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px solid #e2e8f0;
}
.grid-save .muted { flex: 1 1 18rem; font-size: 0.85rem; }

/* The GL box. Narrow, because the codes are short and a full-width field here
   stole room from the name, which is the column people actually read. */
.gl-code { max-width: 7rem; }

/* A column of tick boxes where a dropdown would not do -- a contract may name
   more than one account, typically one per currency. Boxed and indented so the
   group reads as one answer to one question rather than as several fields. */
.tick-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.2rem 0 0.4rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
}
.tick-list .tick { display: flex; align-items: baseline; gap: 0.45rem; font-weight: 400; }
.tick-list .tick input { width: auto; margin: 0; }

/* A text box with its button at the right end of the same line -- a note and
   the button that sends it. On a phone, too narrow for both, the button drops
   below rather than squeezing the box to nothing. */
.input-with-button {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}
.input-with-button > input,
.input-with-button > textarea,
.input-with-button > select { flex: 1 1 16rem; min-width: 0; margin: 0; }
.input-with-button > .btn { flex: 0 0 auto; margin: 0; }
/* A note box grows downwards, so the button sits against its first line
   rather than floating in the middle of a box three lines deep. Resizing is
   left to the writer, vertically: a box dragged wider than the card is a
   layout nobody asked for. */
.input-with-button:has(> textarea) { align-items: flex-start; }
.input-with-button > textarea { resize: vertical; min-height: 3.4rem; }

/* A short, known figure and the button that takes it, kept on one line.

   The shared rule above gives a box a 16rem basis, which is right for one
   that might hold a sentence and too much for an invoice number: inside a row
   of buttons there was not room for both, so the inner flex wrapped and the
   button sat under the box it belongs to.

   It wraps again on a phone, where there is no width to argue about. */
.input-with-button.is-number { flex-wrap: nowrap; }
.input-with-button.is-number > input { flex: 0 1 14rem; }
@media (max-width: 640px) {
  .input-with-button.is-number { flex-wrap: wrap; }
  .input-with-button.is-number > input { flex: 1 1 100%; }
}

/* Two buttons offering what can be done with the thing above them, on one
   line. Stacked with a paragraph between, they read as two unrelated parts
   of the page rather than as a choice.

   The gap matches the one between a label and its control elsewhere, and the
   row wraps rather than squeezing: on a phone a button pushed to half its
   label is worse than a second line. The margin below is the one a lone
   ``.btn`` would have had, so nothing moves on the pages that have one. */
.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin: 0.75rem 0 0.25rem;
}
/* A descendant, not a child: a button that posts somewhere sits inside its
   own one-line form, and that form is the flex item. Both lose their margins
   so the row's own gap is the only spacing, and the first button starts flush
   with the text beneath it. */
.button-row .btn { margin: 0; }
.button-row > form { margin: 0; }

/* A card's heading with an action at its right end -- the grid and the
   button that fills it. Wraps under the heading on a narrow screen. */
.card-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}
.card-title-row > h2 { margin-bottom: 0; }

/* The cash buffer: a period ending under it, but not under nought. The gold
   of the buffer's own line, so the warning reads as the line it crossed --
   the red is kept for going under. */
svg.cashchart .buffer-ring {
  fill: none;
  stroke: var(--aq-gold);
  stroke-width: 2;
}
.row-under-buffer { background: #fdf6e3; }
.cash-panel .cash-figures .is-under-buffer strong { color: #b7791f; }
.cash-buffer-form { margin-top: 0.8rem; max-width: 34rem; }

/* ---------- the budget chart ---------- */

/* What the cost plan comes to, under the chart it is the sum of. Set apart
   from the Save bar below it: one is a figure to read and the other is a
   button to press, and running them together made the figure look like part
   of the button's explanation. */
.chart-total {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 1rem;
  margin-top: 0.8rem;
  padding: 0.6rem 0.8rem;
  border-top: 2px solid var(--aq-line);
  font-size: 1.05rem;
}

/* A code shown rather than offered: plain text until it is clicked, and an
   ordinary box from then on. The width does not change between the two, or
   every row would jump sideways as somebody tabbed along it. */
input[data-unlock][readonly] {
  border-color: transparent;
  background: transparent;
  cursor: text;
}
input[data-unlock][readonly]:hover {
  border-color: var(--aq-line);
  background: #fff;
}

/* The reminder on the filter bar: at the end of the row, because it acts on
   the list those controls just built. Small, because it is a courtesy rather
   than the screen's purpose -- and the bell carries the meaning, so the
   wording beside it can be the count alone. */
.btn-small.remind { white-space: nowrap; }
.btn-small.remind span { margin-right: 0.2rem; }

/* The GL account is a short code -- five or six characters -- and sat in a box
   as wide as the name beside it, which is width taken from the two columns
   people actually type in. */
.gl-code { width: auto; min-width: 5rem; max-width: 7rem; }
th.gl { width: 6rem; }

/* The estimator's own sub-code, narrower still: a bill number or an item
   number off somebody else's document -- "3/1-3/3", "A1" -- and never a
   sentence. It sits second from the left, so every millimetre it holds is
   taken from the name, which is the column the chart is read by. */
.line-sub-code { width: auto; min-width: 3.5rem; max-width: 5.5rem; }
th.sub-code { width: 5.5rem; }

/* --- The cash flow assistant ------------------------------------------- */

/* A drawer down the right, because a conversation is a sidebar to the work
   rather than a section of it: the chart stays on screen while the answer
   about it is read, and a thread four questions long does not push the rest
   of the page away.

   It sits over the page rather than resizing it -- a layout that reflowed
   would move the chart somebody is reading the answer about. On a phone it
   takes the full width, where there is no "beside" to be.

   Nothing here is a chat bubble. Two columns of coloured ovals would say
   "toy" about the one screen a director reads before signing. */
.assistant-launch { margin: 0.75rem 0 0; }

.assistant-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 60;
  width: min(460px, 100vw);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 1.1rem 1.1rem;
  background: var(--card, #fff);
  border-left: 1px solid var(--line, #d8dee6);
  box-shadow: -18px 0 40px rgba(11, 31, 58, 0.18);
  overflow: hidden;
}
.assistant-drawer[hidden] { display: none; }

.assistant-head { display: flex; gap: 0.75rem; align-items: flex-start; }
.assistant-head h2 { margin: 0; font-size: 1.05rem; }
.assistant-basis {
  margin: 0.3rem 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted, #5b6672);
}
.assistant-tools { margin-left: auto; display: flex; gap: 0.3rem; flex: none; }
.assistant-tools button {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--line, #d8dee6);
  border-radius: 6px;
  background: none;
  cursor: pointer;
}
.assistant-tools button:hover { background: var(--tint, #eef2f7); }
.assistant-tools [data-assistant-close] { font-size: 1.05rem; line-height: 1; padding: 0.2rem 0.5rem; }

/* Earlier threads. A list of first questions, which is what somebody
   recognises a conversation by. */
.assistant-history {
  border: 1px solid var(--line, #d8dee6);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  max-height: 45%;
  overflow-y: auto;
}
.assistant-history[hidden] { display: none; }
.assistant-history ul { list-style: none; margin: 0.4rem 0 0; padding: 0; }
.assistant-history li { display: flex; gap: 0.4rem; align-items: baseline; }
.assistant-chat {
  flex: 1;
  text-align: left;
  font: inherit;
  font-size: 0.88rem;
  padding: 0.3rem 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.assistant-chat:hover { text-decoration: underline; }
.assistant-drop {
  font: inherit;
  font-size: 0.75rem;
  border: 0;
  background: none;
  color: var(--muted, #5b6672);
  cursor: pointer;
}
.assistant-drop:hover { color: var(--danger, #b3261e); }

/* The thread takes whatever height is left, and scrolls on its own so the
   box you type into never leaves the screen. */
.assistant-drawer .assistant-thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0.25rem 0;
}
.assistant-drawer .assistant-ask { margin-top: auto; }
.assistant-drawer .assistant-ask .muted { margin: 0.4rem 0 0; }

/* The chart the server drew for a scenario, under the answer that quoted it,
   with the file to send on. An <img> at a server route: the drawing is the
   server's and it stays the server's. */
.assistant-chart { margin: 0.6rem 0 0; }
.assistant-chart img { width: 100%; height: auto; display: block; border-radius: 6px; }
.assistant-download {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.82rem;
}

@media (max-width: 640px) {
  .assistant-drawer { width: 100vw; border-left: 0; }
}

/* A conversation is not part of the printed report. What gets printed from
   this page is the forecast; the chart file has its own print layout. */
@media print {
  .assistant-drawer, .assistant-launch { display: none; }
}

.cash-assistant .assistant-thread { margin: 0.75rem 0; }
.assistant-turn { padding: 0.6rem 0; border-top: 1px solid var(--line, #d8dee6); }
.assistant-turn:first-child { border-top: 0; }
.assistant-who {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #5b6672);
}
.assistant-said p { margin: 0.35rem 0; }
.assistant-turn.is-user .assistant-said { color: var(--muted, #5b6672); }

/* An answer about six months of cash arrives as a table of months, which is
   the readable shape of it. Narrower type than a report table: this is an
   aside under a sentence, not the page's own figures. */
.assistant-said .assistant-table { margin: 0.5rem 0; font-size: 0.9rem; }
.assistant-said .assistant-table th,
.assistant-said .assistant-table td { padding: 0.25rem 0.5rem; }
.assistant-said .assistant-table td + td { text-align: right; }
.assistant-said .assistant-table th + th { text-align: right; }
.assistant-list { margin: 0.35rem 0; padding-left: 1.2rem; }
.assistant-list li { margin: 0.2rem 0; }

/* The three figures somebody asks for by name, under the answer that quoted
   them, so a reader checking one against the chart has them together. */
.assistant-metrics { display: flex; flex-wrap: wrap; gap: 1.25rem; padding: 0.5rem 0 0.2rem; }
.assistant-metric { display: flex; flex-direction: column; }
.assistant-metric-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #5b6672);
}
.assistant-metric-when { font-size: 0.8rem; color: var(--muted, #5b6672); }

/* What the scenario assumed, in its own words. Chips because they are a list
   somebody scans, and because an assumption that cannot be seen cannot be
   argued with. */
.assistant-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.assistant-chip {
  font-size: 0.8rem;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--line, #d8dee6);
  border-radius: 999px;
}

.assistant-starters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.assistant-starters button {
  font-size: 0.85rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--line, #d8dee6);
  border-radius: 999px;
  background: none;
  cursor: pointer;
}
.assistant-starters button:hover { background: var(--tint, #eef2f7); }

@media (max-width: 640px) {
  .assistant-metrics { gap: 0.9rem; }
}

/* ---------- what an approver filed with their signature ---------- */
/* The cell these sit in keeps `white-space: pre-line`, so a comment breaks
   where it was typed. That would also break the markup of a file line at
   every newline in the template, so the line puts itself back to normal. */
.decision-paper { white-space: normal; margin-top: 0.3rem; font-size: 0.85rem; }
.decision-paper .muted { margin-left: 0.4rem; }
