/*
  Platform styles

  Brand colours (--brand, --deep, --accent, --soft) live in brand.css.

  The look is calm and light, in the spirit of modern banking apps:
  a soft grey page, white cards with thin borders, rounded pill buttons,
  and money shown large, with small raised cents (see the money filter).
  Navy is for actions and the page you are on. Colour is kept for meaning:
  green for paid or released, red for owed or on hold.
*/

/* ---------- Fonts, saved in static/fonts ---------- */

@font-face {
  font-family: "Poppins";
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/poppins-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/poppins-latin-500-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/poppins-latin-600-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/poppins-latin-700-normal.woff2") format("woff2");
}

:root {
  /* The platform is light only. This also keeps form boxes and scrollbars light. */
  color-scheme: light;

  --white: #ffffff;
  --canvas: #f5f6f9;  /* the page behind the cards */
  --tint: #eef0f5;    /* quiet fills: table hover, side notes */
  --ink: #121433;
  --muted: #5d6280;
  --faint: #8a8fa8;   /* small labels */
  --rule: #e4e6ee;
  --rule-strong: #cfd3de;

  --stamp: #b42318;
  --stamp-soft: #fcebea;
  --green: #047857;
  --green-soft: #e6f6ee;
  --needs: #fff4dc;   /* light amber: a needed box that is still empty */
  --amber: #b45309;

  --heading: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius: 10px;      /* boxes and small cards */
  --radius-card: 14px; /* cards and tables */
  --shadow: 0 1px 2px rgba(18, 20, 51, 0.05);
  --shadow-raised: 0 1px 3px rgba(18, 20, 51, 0.08), 0 4px 12px rgba(18, 20, 51, 0.04);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 15px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--heading);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 16px;
}

p {
  margin: 0;
}

a {
  color: var(--brand);
  text-underline-offset: 3px;
}

img {
  max-width: 100%;
}

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

/* Anything marked hidden stays hidden, even if a rule below gives it a display */
[hidden] {
  display: none !important;
}

/* Text for screen readers only */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Icons drawn by {% icon "name" %}. They take the colour of the text around them. */
.icon {
  width: 20px;
  height: 20px;
  flex: none;
  vertical-align: middle;
}

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


/* ---------- Money: 12,500 with a small raised .50 ---------- */

.money {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.money .cents {
  margin-left: 1px;
  font-size: 0.62em;
  vertical-align: 0.38em;
  line-height: 0;
}

/* In big figures the cents are smaller and quieter still */
.money-card-total .money .cents,
.big-figure .money .cents {
  font-size: 0.45em;
  vertical-align: 0.95em;
  color: var(--muted);
}


/* ---------- Platform logo ---------- */

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  text-decoration: none;
}

.brand img {
  height: 60px;
  width: auto;
}

/* A "Show" button inside password boxes (added by app.js) */
.password-box {
  position: relative;
}

.password-box input {
  padding-right: 76px;
}

.show-password {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--brand);
  font: 500 14px var(--body);
  cursor: pointer;
}

/* Only with a mouse: on a phone a tap would leave it grey */
@media (hover: hover) {
  .show-password:hover {
    background: var(--tint);
  }
}


/* ---------- Buttons ---------- */

/* Rounded pill buttons. Navy for the main action on a page. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: 500 15px/1 var(--body);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn .icon {
  width: 18px;
  height: 18px;
}

.btn-main {
  background: var(--deep);
  color: var(--white);
  box-shadow: 0 1px 2px rgba(3, 7, 94, 0.25);
}

.btn-main:hover {
  background: var(--brand);
}

.btn-plain {
  background: var(--white);
  color: var(--ink);
  border-color: var(--rule);
  box-shadow: var(--shadow);
}

.btn-plain:hover {
  border-color: var(--rule-strong);
  background: #fafbfc;
}

.btn-danger {
  background: var(--white);
  color: var(--stamp);
  border-color: var(--rule);
  box-shadow: var(--shadow);
}

.btn-danger:hover {
  border-color: var(--stamp);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn-small {
  min-height: 34px;
  padding: 0 14px;
  font-size: 14px;
}

.btn-wide {
  width: 100%;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}


/* ---------- Forms ---------- */

.form {
  display: grid;
  gap: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.form-grid .span-2 {
  grid-column: 1 / -1;
}

/* Boxes keep their height even when the field beside them has help text */
.form-grid,
.field {
  align-items: start;
  align-content: start;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-weight: 500;
  font-size: 14px;
}

.field .optional {
  color: var(--muted);
  font-weight: 400;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0; /* date boxes would otherwise refuse to shrink */
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
  font: 16px/1.4 var(--body);
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input[type="file"] {
  padding: 9px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--deep);
  box-shadow: 0 0 0 4px rgba(3, 7, 94, 0.08);
}

.field.has-error input,
.field.has-error select {
  border-color: var(--stamp);
}

.help,
.help li {
  color: var(--muted);
  font-size: 14px;
}

.help ul {
  margin: 0;
  padding-left: 18px;
}

.error-text {
  color: var(--stamp);
  font-size: 14px;
  font-weight: 500;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}


/* ---------- Messages after an action ---------- */

.notices {
  display: grid;
  gap: 8px;
  margin-bottom: 24px;
}

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 16px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: var(--shadow);
  color: var(--ink);
}

.notice .icon {
  color: var(--brand);
  margin-top: 2px;
}

.notice.error {
  border-color: #f3c7c3;
  background: var(--stamp-soft);
}

.notice.error .icon {
  color: var(--stamp);
}


/* ---------- Sign in, register and other pages before the workspace ---------- */

/* Deep navy at the top, lightening towards the bottom like the sky at dusk,
   with a soft glow of the logo's light blue rising from below */
.entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  min-height: 100vh;
  padding: 56px 20px 36px;
  background:
    radial-gradient(ellipse 80% 55% at 50% 115%, rgba(31, 185, 220, 0.32), transparent 70%),
    linear-gradient(180deg, var(--deep) 0%, #0d1672 50%, #24338f 100%);
  color: var(--on-deep);
}

.entry :focus-visible {
  outline-color: var(--accent);
}

.entry-box :focus-visible {
  outline-color: var(--deep);
}

.entry-brand {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}

.entry-brand img {
  width: 150px;
  height: auto;
}

.entry-brand .about {
  max-width: 38ch;
  font-size: 15px;
  line-height: 1.55;
  color: var(--on-deep);
}

/* The form sits in a white card that floats on the navy */
.entry-box {
  width: 100%;
  max-width: 440px;
  padding: 36px 36px 32px;
  border-radius: 20px;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(0, 2, 40, 0.35), 0 2px 6px rgba(0, 2, 40, 0.2);
}

.entry-box.wide {
  max-width: 620px;
}

.entry-box h1 {
  margin-bottom: 6px;
  font-size: 26px;
}

.entry-box .lead {
  color: var(--muted);
  margin-bottom: 26px;
}

.entry .small-print {
  margin-top: auto;
  font-size: 13px;
  color: var(--on-deep-quiet);
}

.entry-links {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.form-part {
  margin: 8px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  font-family: var(--heading);
  font-size: 19px;
}

.form-part:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}


/* ---------- The workspace layout: menu on the left, work on the right ---------- */

/* The menu sits on the same soft grey as the page, with a thin line between them */
.app {
  --rail-width: 252px;
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto; /* on short screens the menu scrolls instead of cutting off Sign out */
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--rule);
  background: var(--canvas);
  color: var(--muted);
}

.rail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px 14px 20px;
}

/* The company's own card, like the account switcher in a banking app */
.company-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 12px 10px;
  padding: 9px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

.company-chip img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--white);
}

.company-chip .initials {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--deep);
  color: var(--white);
  font: 600 13px/1 var(--heading);
}

.company-chip strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}

.nav {
  display: grid;
  align-content: start;
  gap: 1px;
  padding: 4px 12px;
  /* Only the links scroll on short screens. The logo and Sign out stay in place. */
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--rule-strong) transparent;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: #3c4160;
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
}

.nav a .icon {
  color: var(--faint);
}

.nav a:hover {
  background: rgba(18, 20, 51, 0.045);
  color: var(--ink);
}

/* The page you are on: a white raised pill */
.nav a.here {
  border-color: var(--rule);
  background: var(--white);
  box-shadow: var(--shadow);
  color: var(--ink);
}

.nav a.here .icon {
  color: var(--deep);
}

/* Group headings in the menu. Each one folds its group away, like a drawer. */
.nav-group-items {
  display: grid;
  gap: 1px;
}

.nav-label {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
  margin: 16px 0 4px;
  padding: 2px 10px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--faint);
  font: 500 12.5px/1.4 var(--body);
  text-align: left;
  cursor: pointer;
}

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

/* The arrow points down when the group is open, and right when it is folded away */
.nav-label .icon {
  width: 16px;
  height: 16px;
  opacity: 0.8;
  transform: rotate(90deg);
  transition: transform 0.15s ease;
}

.nav-label:hover .icon {
  opacity: 1;
}

.nav-group.closed .nav-label .icon {
  transform: rotate(0deg);
}

.nav-group.closed .nav-group-items {
  display: none;
}

/* Before the script runs, fold the groups that were closed last time (see base.html).
   The group holding the page you are on stays open. */
html.closed-business:not(.menu-small) [data-group="business"]:not(:has(.here)) .nav-group-items,
html.closed-money:not(.menu-small) [data-group="money"]:not(:has(.here)) .nav-group-items,
html.closed-team:not(.menu-small) [data-group="team"]:not(:has(.here)) .nav-group-items,
html.closed-settings:not(.menu-small) [data-group="settings"]:not(:has(.here)) .nav-group-items {
  display: none;
}

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

.rail-bottom {
  margin-top: auto;
  padding: 14px 12px 18px;
  border-top: 1px solid var(--rule);
}

.me {
  padding: 0 10px 8px;
}

.me strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.me span {
  font-size: 13px;
  color: var(--faint);
}

.rail-bottom form {
  margin: 0;
}

.rail-bottom button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: #3c4160;
  font: 500 14.5px/1.4 var(--body);
  cursor: pointer;
}

.rail-bottom button .icon {
  color: var(--faint);
}

.rail-bottom button:hover {
  background: rgba(18, 20, 51, 0.045);
  color: var(--ink);
}

/* The bird on its own, for the small menu */
.brand .brand-mark {
  display: none;
}

/* The button that makes the menu smaller. Only on laptops and bigger screens. */
.collapse-button {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  color: var(--faint);
  cursor: pointer;
}

.collapse-button:hover {
  border-color: var(--rule);
  background: var(--white);
  color: var(--ink);
}

.collapse-button .icon {
  width: 20px;
  height: 20px;
}

.collapse-button .when-small,
.menu-small .collapse-button .when-big {
  display: none;
}

.menu-small .collapse-button .when-small {
  display: block;
}

.menu-button {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.menu-button .icon {
  width: 22px;
  height: 22px;
}

.menu-button .when-open,
.menu-button[aria-expanded="true"] .when-closed {
  display: none;
}

.menu-button[aria-expanded="true"] .when-open {
  display: block;
}

.nav .icon,
.rail-bottom button .icon {
  width: 20px;
  height: 20px;
}

.main {
  min-width: 0;
  padding: 18px clamp(20px, 4vw, 48px) 64px;
  max-width: 1200px;
}

/* ---------- The top bar: find a truck, and the New menu ---------- */

.top-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.find-truck {
  position: relative;
  flex: 1;
  max-width: 460px;
  display: flex;
  align-items: center;
}

.find-truck .icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--faint);
  pointer-events: none;
}

.find-truck input {
  width: 100%;
  min-height: 40px;
  padding: 8px 40px 8px 40px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--white);
  box-shadow: var(--shadow);
  color: var(--ink);
  font: 15px var(--body);
}

.find-truck input::placeholder {
  color: var(--faint);
}

.find-truck input:focus {
  outline: none;
  border-color: var(--deep);
  box-shadow: 0 0 0 4px rgba(3, 7, 94, 0.08);
}

.find-truck kbd {
  position: absolute;
  right: 12px;
  padding: 1px 7px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  color: var(--faint);
  font: 12px/1.5 var(--body);
}

.find-truck input:focus ~ kbd {
  display: none;
}

.new-menu {
  position: relative;
  margin-left: auto;
}

.new-menu summary {
  list-style: none;
}

.new-menu summary::-webkit-details-marker {
  display: none;
}

.new-menu-items {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  min-width: 200px;
  display: grid;
  padding: 6px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: var(--shadow-raised);
}

.new-menu-items a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 14.5px;
  text-decoration: none;
}

.new-menu-items a .icon {
  width: 18px;
  height: 18px;
  color: var(--faint);
}

.new-menu-items a:hover {
  background: var(--canvas);
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.page-head p {
  margin-top: 6px;
  color: var(--muted);
  max-width: 64ch;
}


/* ---------- Sections and panels inside pages ---------- */

.columns {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 40px;
  align-items: start;
}

.section + .section {
  margin-top: 40px;
}

/* Sections side by side in two columns start at the same line */
.columns > .section + .section {
  margin-top: 0;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 14px;
}

.section-head p {
  color: var(--muted);
  font-size: 14px;
}

.section-head a {
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.section-head a:hover {
  text-decoration: underline;
}

/* White cards on the grey page */
.panel {
  padding: 24px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: var(--shadow);
}

/* Side notes: quieter, with no card */
.panel.paper {
  background: transparent;
  border: 1px dashed var(--rule-strong);
  box-shadow: none;
}

.panel h2 {
  margin-bottom: 6px;
}

.panel > p.muted {
  margin-bottom: 18px;
}

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


/* ---------- Setup list on the workspace ---------- */

.steps {
  list-style: none;
  margin: 0;
  padding: 0 20px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: var(--shadow);
}

.steps li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 0;
  border-top: 1px solid var(--rule);
}

.steps li:first-child {
  border-top: 0;
}

.steps .icon {
  width: 22px;
  height: 22px;
  color: var(--rule-strong);
}

.steps .done .icon {
  color: var(--green);
}

.steps .done strong {
  color: var(--muted);
  text-decoration: line-through;
}

.steps strong {
  font-weight: 500;
}

.steps p {
  color: var(--muted);
  font-size: 14px;
}

.steps .step-action {
  margin-left: auto;
  white-space: nowrap;
}


/* ---------- Tables ---------- */

/* Tables sit in a white card. Headings are small and quiet, rows light up on hover. */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: var(--shadow);
}

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

th {
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule);
  color: var(--faint);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

td {
  padding: 14px 16px;
  border-top: 1px solid var(--rule);
  vertical-align: middle;
}

tbody tr:first-child td {
  border-top: 0;
}

.table-wrap tbody tr:hover td {
  background: #fafbfd;
}

td strong {
  display: block;
  font-weight: 500;
}

/* Second line in a cell, like an email under a name */
td .muted {
  display: block;
}

.row-off td {
  color: var(--muted);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.row-actions form {
  margin: 0;
  display: flex;
  gap: 8px;
}

.row-actions select {
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--white);
  font: 14px var(--body);
}

/* Status tags: a soft pill with a small dot in the status colour */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 9px;
  border-radius: 999px;
  background: var(--tint);
  color: #3c4160;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}

.tag.brand {
  background: #e8ebf7;
  color: var(--brand);
}

.tag.green {
  background: var(--green-soft);
  color: var(--green);
}

.tag.red {
  background: var(--stamp-soft);
  color: var(--stamp);
}

.empty {
  padding: 28px;
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius-card);
  color: var(--muted);
}


/* ---------- Small pieces ---------- */

.space-top {
  margin-top: 14px;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: var(--shadow);
}

.facts div {
  padding: 18px 20px;
}

.facts div + div {
  border-left: 1px solid var(--rule);
}

.facts b {
  display: block;
  font: 400 32px/1.15 var(--heading);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.facts span {
  color: var(--muted);
  font-size: 14px;
}

.copy-box {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.copy-box input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  font: 14px var(--body);
  color: var(--muted);
}

.logo-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.logo-preview img,
.logo-preview .no-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--white);
}

.logo-preview .no-logo {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
}

.status-line {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--white);
}

.status-line .icon {
  color: var(--brand);
  width: 24px;
  height: 24px;
}


/* Money and counts line up in columns */
.number {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.notice.late {
  border-color: #f3c7c3;
  background: var(--stamp-soft);
}

.notice.late .icon {
  color: var(--stamp);
}

.notice a {
  margin-left: auto;
  font-weight: 500;
  white-space: nowrap;
}


/* ---------- Lists with search and pages ---------- */

.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.search-bar input {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  padding: 8px 16px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  box-shadow: var(--shadow);
  font: 16px var(--body);
}

.pager {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
  color: var(--muted);
}

.back-link {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

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

.back-link::before {
  content: "\2039\00a0";
}


/* ---------- Business Book ---------- */

.head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.money-cards.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* The filters above the book: truck, consignee, month, status */
.filter-bar {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 12px;
}

.filter-bar label {
  font-size: 13px;
  color: var(--muted);
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 46px;
}

.row-link {
  color: var(--ink);
  text-decoration: none;
}

.row-link:hover {
  text-decoration: underline;
}

.book-table td:first-child strong {
  white-space: nowrap;
}

.book-table .short {
  display: block;
  font-size: 13px;
}

/* One box per charge on the operation form */
.charge-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 16px;
  margin-top: 8px;
}

.charge-grid label {
  font-size: 14px;
}

.charge-total {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

.charge-total strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

/* Details of one operation */
.details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: var(--shadow);
}

.details div {
  padding: 13px 18px;
  border-bottom: 1px solid var(--rule);
}

.details div:nth-child(odd):not(.wide) {
  border-right: 1px solid var(--rule);
}

.details .wide {
  grid-column: 1 / -1;
}

.details div:last-child {
  border-bottom: 0;
}

.details dt {
  color: var(--faint);
  font-size: 13px;
}

.details dd {
  margin: 2px 0 0;
}

.status-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.status-form select {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--white);
  font: 15px var(--body);
}


/* ---------- Announcements ---------- */

.board {
  list-style: none;
  margin: 0;
  padding: 0 22px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: var(--shadow);
}

.board li {
  padding: 18px 0 20px;
  border-top: 1px solid var(--rule);
}

.board li:first-child {
  border-top: 0;
}

.board-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.board-head h2,
.board-head h3 {
  font-size: 17px;
}

.board-text {
  margin-top: 10px;
  max-width: 68ch;
}

.board-text p + p {
  margin-top: 8px;
}


/* ---------- Approve or decline a request ---------- */

.decide-form {
  display: grid;
  gap: 8px;
  min-width: 220px;
}

.decide-form input {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  font: 15px var(--body);
}

.decide-form .row-actions {
  justify-content: flex-start;
}


/* ---------- Cash book ---------- */

.day-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.day-name {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.day-name h2 {
  font-size: 22px;
}

.money-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

/* Like the balance card in a banking app: a quiet label, then a big, light figure */
.money-card {
  padding: 20px 22px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: var(--shadow);
}

.money-card-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.money-card-total {
  margin: 6px 0 14px;
  font-family: var(--heading);
  font-size: 34px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.money-card-total .unit {
  margin-left: 4px;
  color: var(--faint);
  font-size: 15px;
  letter-spacing: 0;
}

.money-card-foot {
  color: var(--muted);
  font-size: 14px;
}

.money-card-foot strong {
  color: var(--ink);
  font-weight: 500;
}

.money-card-label .icon {
  width: 18px;
  height: 18px;
  color: var(--faint);
}

/* The quick actions under "Welcome" on the workspace */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -10px 0 32px;
}

.money-card dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}

.money-card dt {
  color: var(--faint);
  font-size: 13px;
}

.money-card dd {
  margin: 0;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.count-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.count-table th,
.count-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
}

.count-table th {
  color: var(--faint);
  font-weight: 500;
}

.count-table td {
  text-align: right;
}

.count-table thead th:not(:first-child) {
  text-align: right;
}

.short {
  color: var(--stamp);
  font-weight: 500;
}

.amount-in {
  color: var(--green);
  font-weight: 500;
}

.panel + .panel {
  margin-top: 20px;
}


/* A tick box with its label and help beside it */
.check-field label {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-weight: 400;
  cursor: pointer;
}

.check-field input[type="checkbox"] {
  flex: none;
  width: 20px;
  height: 20px;
  min-height: 0;
  margin: 2px 0 0;
  padding: 0;
  accent-color: var(--brand);
}

.check-field .help {
  display: block;
  margin-top: 2px;
}


/* ---------- Monthly fee ---------- */

.fee-now h2 {
  margin: 12px 0 6px;
  font-size: clamp(26px, 3vw, 34px);
  font-variant-numeric: tabular-nums;
}


/* ---------- Documents ---------- */

.form-grid.one {
  grid-template-columns: minmax(0, 1fr);
}

.file-picker {
  gap: 10px;
}

.field-label {
  font-weight: 500;
  font-size: 14px;
}

/* With JavaScript, our buttons replace the browser's plain file box */
.js .file-picker .file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.file-buttons {
  display: none;
  flex-wrap: wrap;
  gap: 10px;
}

.js .file-buttons {
  display: flex;
}

.file-picker .file-buttons .btn {
  font-weight: 500;
  font-size: 15px;
}

/* Keyboard users see where they are on the hidden file box */
.file-picker .file-input:focus-visible + .file-buttons label {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.file-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--white);
}

.file-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--rule);
  font-size: 15px;
}

.file-list li:first-child {
  border-top: 0;
}

.file-list .file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-list .file-total {
  background: var(--tint);
  color: var(--muted);
  grid-template-columns: minmax(0, 1fr);
}

.file-list .file-total.too-much {
  background: var(--stamp-soft);
  color: var(--stamp);
}

.upload-progress {
  display: grid;
  gap: 6px;
  font-size: 15px;
}

.upload-progress progress {
  width: 100%;
  height: 10px;
  accent-color: var(--brand);
}

.doc-files {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.doc-file {
  display: grid;
  grid-template-rows: auto 1fr auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* The whole page of a scan shows, on a light background, rather than a cropped part */
.doc-preview {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  background: var(--tint);
  color: var(--muted);
  text-decoration: none;
}

.doc-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.doc-pdf {
  display: grid;
  justify-items: center;
  gap: 4px;
  font-weight: 600;
}

.doc-pdf .icon {
  width: 40px;
  height: 40px;
  color: var(--stamp);
}

.doc-file-text {
  display: grid;
  gap: 2px;
  padding: 12px 14px 0;
  font-size: 15px;
}

.doc-file-text strong {
  overflow-wrap: anywhere;
}

.doc-file-text .muted {
  font-size: 14px;
}

.doc-file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 10px 14px 14px;
  font-size: 14px;
}

.doc-file-actions a {
  font-weight: 500;
  text-decoration: none;
}

.doc-file-actions a:hover {
  text-decoration: underline;
}

/* On phones the three file buttons fill the width, easy to tap with a thumb */
@media (max-width: 600px) {
  .js .file-buttons {
    display: grid;
  }
}

.plain-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.plain-list li {
  padding: 10px 0;
  border-top: 1px solid var(--rule);
}

.plain-list li:first-child {
  border-top: 0;
}


/* ---------- Edit as grid ---------- */

/* The grid needs the whole width of the screen */
.main.main-wide {
  max-width: none;
}

/* The table scrolls inside its box, so the headings and references stay in view */
.grid-wrap {
  overflow: auto;
  max-height: calc(100vh - 240px);
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: var(--shadow);
}

/* Fixed column widths: long charge names wrap instead of stretching the column.
   With a width of 1px, the table grows to exactly the sum of its columns. */
.grid-table {
  table-layout: fixed;
  width: 1px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 15px;
}

.grid-table th,
.grid-table td {
  padding: 0;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: var(--white);
}

.grid-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px;
  background: #fafbfd;
  border-bottom-color: var(--rule);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  vertical-align: bottom;
  line-height: 1.3;
  white-space: normal; /* table headings elsewhere stay on one line; here long names wrap */
}

.grid-table thead th span {
  display: block;
  color: var(--muted);
  font-weight: 400;
}

/* The reference column stays on the left while scrolling sideways */
.grid-table .grid-ref {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 160px;
  padding: 0 12px;
  border-right-color: var(--rule-strong);
  white-space: nowrap;
  text-align: left;
  font-weight: 600;
}

.grid-table thead .grid-ref {
  z-index: 3;
  padding: 10px 12px;
}

.grid-table .grid-ref a {
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}

.grid-table .grid-ref a:hover {
  text-decoration: underline;
}

.grid-table .w-date { width: 160px; }
.grid-table .w-medium { width: 140px; }
.grid-table .w-wide { width: 210px; }
.grid-table .w-money { width: 130px; }
.grid-table .w-save { width: 190px; }

/* Figures the grid works out: the charges total and the record status */
.grid-table .grid-figure {
  padding: 0 10px;
  background: var(--tint);
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
}

.grid-table [data-record] {
  text-align: left;
}

.grid-table .grid-save {
  padding: 0 10px;
  white-space: nowrap;
}

.grid-save .btn + .row-state {
  margin-left: 8px;
}

.grid-save .btn {
  min-height: 32px;
  padding: 0 12px;
  font-size: 14px;
}

.row-state {
  font-size: 14px;
  font-weight: 600;
}

.row-state[data-state="saving"] {
  color: var(--muted);
}

.row-state[data-state="saved"] {
  color: var(--green);
}

.row-state[data-state="failed"] {
  color: var(--stamp);
}

/* Above the grid: how many rows, what is not saved yet, and the keys */
.grid-info {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 20px;
  margin-bottom: 10px;
  font-size: 15px;
}

.grid-info strong {
  font-weight: 600;
}

/* The keys are always on their own line, so the line above does not jump while saving */
.grid-info .muted {
  flex-basis: 100%;
}

/* The boxes fill their cells with no border of their own, like a spreadsheet */
.grid-table input,
.grid-table select {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: 15px/1.3 var(--body);
}

.grid-table input[type="number"] {
  text-align: right;
  -moz-appearance: textfield;
}

/* No up and down arrows in amount boxes: the arrow keys move between rows instead */
.grid-table input[type="number"]::-webkit-inner-spin-button,
.grid-table input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.grid-table input:focus,
.grid-table select:focus {
  outline: 2px solid var(--deep);
  outline-offset: -2px;
  background-color: var(--white);
}

.grid-table input.needs-value {
  background: var(--needs);
}

.grid-table tr.changed .grid-ref {
  box-shadow: inset 4px 0 0 var(--brand);
}

.grid-table td.cell-changed {
  background: var(--soft);
}

.grid-table td.cell-problem,
.grid-table tr.has-problem .grid-ref {
  background: var(--stamp-soft);
}

.grid-table tr.has-problem .grid-ref {
  box-shadow: inset 4px 0 0 var(--stamp);
}

.grid-problems td {
  padding: 8px 12px;
  background: var(--stamp-soft);
  color: var(--stamp);
  font-size: 14px;
}

/* The message stays in view when the grid is scrolled sideways */
.grid-problem-text {
  position: sticky;
  left: 12px;
  display: inline-flex;
  gap: 6px;
  align-items: flex-start;
  max-width: calc(100vw - 420px);
}

.grid-problems .icon {
  width: 18px;
  height: 18px;
}

/* On phones the reference column is a little narrower */
@media (max-width: 600px) {
  .grid-table .grid-ref {
    width: 148px;
    padding: 0 10px;
    font-size: 13px;
  }
}

/* The save bar stays at the bottom of the screen */
.grid-bar {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 0;
  background: var(--canvas);
}


/* On phones the save bar scrolls with the page, instead of covering the grid */
@media (max-width: 600px) {
  .grid-bar {
    position: static;
  }
}


/* ---------- Dropdowns ----------
   A simple arrow in place of the browser's own, which looks different everywhere. */

.field select,
.status-form select,
.row-actions select,
.grid-table select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath fill='%238a8fa8' d='M480-345 240-585l43-43 197 198 197-198 43 43-240 240Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
}

.row-actions select {
  padding-right: 32px;
  background-position: right 8px center;
}


/* ---------- Tablets and phones ---------- */

@media (max-width: 960px) {
  .columns {
    grid-template-columns: minmax(0, 1fr);
  }

}

@media (max-width: 820px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
  }

  /* On phones the menu is a white bar along the top */
  .rail {
    position: sticky;
    z-index: 10;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    background: var(--white);
  }

  .rail-top {
    padding: 10px 16px;
  }

  .brand {
    flex-direction: row;
    align-items: center;
  }

  .brand img {
    height: 42px;
  }

  .top-bar {
    margin-bottom: 22px;
  }

  .find-truck {
    max-width: none;
  }

  .find-truck kbd {
    display: none;
  }

  .collapse-button {
    display: none;
  }

  .menu-button {
    display: grid;
    place-items: center;
  }

  /* The menu folds away on phones until the menu button is pressed */
  .rail .company-chip,
  .rail .nav,
  .rail .rail-bottom {
    display: none;
  }

  .rail.open .company-chip,
  .rail.open .nav,
  .rail.open .rail-bottom {
    display: flex;
  }

  .rail.open .nav,
  .rail.open .rail-bottom {
    flex-direction: column;
  }

  .rail.open .rail-bottom {
    display: block;
    margin-top: 8px;
  }

  .main {
    padding-top: 16px;
  }
}

@media (max-width: 820px) {
  /* On phones, put the form above the list where people need it first */
  .form-first > .panel {
    order: -1;
  }
}

@media (max-width: 960px) {
  .filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .charge-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .money-cards,
  .money-cards.three,
  .filter-bar,
  .details {
    grid-template-columns: 1fr;
  }

  .details div:nth-child(odd):not(.wide) {
    border-right: 0;
  }

  .day-bar {
    grid-template-columns: 1fr 1fr;
  }

  .day-name {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-content: flex-start;
  }

  h1 {
    font-size: 26px;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .facts div + div {
    border-left: 0;
    border-top: 1px solid var(--rule);
  }

  .panel {
    padding: 18px;
  }

  /* Tables turn into stacked rows on small phones */
  .stack thead {
    display: none;
  }

  .stack tr {
    display: grid;
    gap: 6px;
    padding: 14px 16px;
    border-top: 1px solid var(--rule);
  }

  .stack tr:first-child {
    border-top: 0;
  }

  .stack td {
    padding: 0;
    border: 0;
  }

  .row-actions {
    justify-content: flex-start;
    margin-top: 6px;
  }

  .steps li {
    flex-wrap: wrap;
  }

  .steps .step-action {
    margin-left: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}


/* Phones: the status counts and team counts stay side by side as small tiles */
@media (max-width: 600px) {
  .money-cards.status-cards,
  .facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .status-cards .money-card {
    padding: 14px 12px;
  }

  .status-cards .tag {
    padding: 1px 8px 1px 7px;
    font-size: 12px;
  }

  .status-cards .money-card-total {
    margin: 8px 0 0;
    font-size: 28px;
  }

  .status-cards .money-card-foot {
    display: none;
  }

  .facts div {
    padding: 14px 12px;
  }

  .facts div + div {
    border-top: 0;
    border-left: 1px solid var(--rule);
  }

  .facts b {
    font-size: 26px;
  }

  .facts span {
    font-size: 13px;
  }

  .statement {
    padding: 22px 16px;
  }

}

/* Phones: a smaller logo and no tagline, so the form is on screen straight away */
@media (max-width: 600px) {
  .entry {
    gap: 20px;
    padding: 28px 14px 24px;
  }

  .entry-brand img {
    width: 104px;
  }

  .entry-brand .about {
    display: none;
  }

  .entry-box {
    padding: 26px 20px 22px;
    border-radius: 18px;
  }
}

/* ---------- Short laptop screens ----------
   With every menu link showing, the side menu is taller than many laptop screens.
   Here the logo gets smaller and your name sits beside Sign out, so more links fit. */

@media (min-width: 821px) and (max-height: 960px) {
  .rail-top {
    padding: 14px 20px 12px;
  }

  .brand {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }

  .brand img {
    height: 48px;
  }

  .company-chip {
    margin-bottom: 8px;
    padding: 6px 10px;
  }

  .nav a {
    padding: 6px 12px;
  }

  .nav-label {
    margin: 10px 0 2px;
  }

  .rail-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px 12px;
  }

  .me {
    min-width: 0;
    padding: 0 0 0 12px;
  }

  .me strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Just the Sign out icon here, so the name beside it has room */
  .rail-bottom button {
    flex: none;
    width: auto;
    padding: 9px;
  }

  .rail-bottom .nav-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}



/* ---------- The small menu: icons only ----------
   Turned on by the button at the top of the menu (see static/js/app.js). */

@media (min-width: 821px) {
  .menu-small .app {
    --rail-width: 76px;
  }

  .menu-small .rail-top {
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 16px 0 12px;
  }

  .menu-small .brand-logo {
    display: none;
  }

  .menu-small .brand-mark {
    display: block;
    width: 46px;
    height: auto;
  }

  .menu-small .company-chip > div,
  .menu-small .me {
    display: none;
  }

  .menu-small .company-chip {
    justify-content: center;
    margin: 0 12px 8px;
    padding: 6px;
  }

  /* Hide the words but keep them for screen readers */
  .menu-small .nav-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .menu-small .nav a,
  .menu-small .rail-bottom button {
    justify-content: center;
    padding: 9px 0;
  }

  /* Group headings become thin lines between the groups, and every icon shows */
  .menu-small .nav-label {
    width: calc(100% - 16px);
    height: 1px;
    margin: 8px 8px;
    padding: 0;
    overflow: hidden;
    border-radius: 0;
    background: var(--rule);
    color: transparent;
    pointer-events: none;
  }

  .menu-small .nav-group.closed .nav-group-items {
    display: grid;
  }

  .menu-small .rail-bottom {
    display: block;
    padding: 10px 12px 14px;
  }

  .menu-small .rail-bottom button {
    width: 100%;
  }
}

.charge-grid label .muted {
  font-weight: 400;
}

/* Filter bars with three boxes, like Bonds and Documents */
@media (min-width: 961px) {
  .three-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  }
}

/* A figure that opens the page behind it */
.card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.card-link {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card-link:hover {
  border-color: var(--rule-strong);
  box-shadow: var(--shadow-raised);
}


/* ---------- Statement for a consignee ---------- */

.statement {
  max-width: 980px;
  padding: 40px 44px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: var(--shadow-raised);
}

.letterhead {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--deep);
}

.letterhead h2 {
  font-size: 22px;
}

.letterhead p {
  margin-top: 4px;
  font-size: 14px;
}

.letterhead-logo {
  display: block;
  max-height: 64px;
  width: auto;
  margin-bottom: 10px;
}

.letterhead-for {
  text-align: right;
}

.letterhead-for h3 {
  font-size: 18px;
}

.statement-totals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0;
}

.statement-totals > div {
  padding: 16px 18px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: #fafbfd;
}

.statement-owed {
  margin: 2px 0;
  font: 400 26px/1.3 var(--heading);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* Inside the white sheet, the table needs no card of its own */
.statement .table-wrap {
  box-shadow: none;
}

.statement-table th.number,
.statement-table td.number {
  text-align: right;
}

.statement-table td:first-child {
  white-space: nowrap;
}

.statement-table tfoot th,
.statement-table tfoot td {
  color: var(--ink);
  font-weight: 500;
  border-top: 1px solid var(--rule-strong);
}

.statement-note {
  margin-top: 18px;
  font-size: 13px;
}

/* The letterhead and the two owed boxes stack on a phone */
@media (max-width: 600px) {
  .letterhead {
    flex-direction: column;
    gap: 14px;
  }

  .letterhead-for {
    text-align: left;
  }

  .statement-totals {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Printing ----------
   Only the page itself is printed: no menu, no buttons, no messages. */

@page {
  margin: 16mm;
}

@media print {
  .rail,
  .top-bar,
  .notices,
  .no-print {
    display: none !important;
  }

  body {
    background: none;
  }

  .table-wrap,
  .panel,
  .money-card {
    box-shadow: none;
  }

  .statement {
    max-width: none;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .app {
    display: block;
    background: none;
  }

  .main {
    max-width: none;
    padding: 0;
  }

  body {
    font-size: 12px;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
  }

  tr {
    break-inside: avoid;
  }
}
