/* Design tokens. Bootstrap 5.3 builds its components from --bs-* custom
   properties, so overriding those here re-skins existing markup without
   editing a class name in sixty-two templates. */
:root {
  --app-primary: #1e40af;
  --app-primary-dark: #1a3691;
  --app-secondary: #3b82f6;
  --app-accent: #f59e0b;
  --app-bg: #f8fafc;
  --app-surface: #ffffff;
  --app-text: #0f172a;
  --app-muted: #475569;
  --app-border: #e2e8f0;
  --app-focus: #1e40af;
  --app-font-sans: "Fira Sans", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --app-font-mono: "Fira Code", ui-monospace, SFMono-Regular, "Cascadia Mono",
    Consolas, monospace;
  --app-radius: 0.5rem;
  --app-shadow: 0 1px 2px rgb(15 23 42 / 6%), 0 1px 3px rgb(15 23 42 / 10%);
  /* Every box on every page: the dashboard's faint lift, border and corners
     (the user, 2026-10-06, after seeing only the dashboard's boxes lifted). */
  --app-card-shadow: 0 1px 2px rgb(15 23 42 / 4%), 0 4px 12px rgb(15 23 42 / 5%);
  --app-card-border: #e5eaf2;
  --app-card-radius: 0.75rem;

  --bs-body-font-family: var(--app-font-sans);
  --bs-body-color: var(--app-text);
  --bs-body-bg: var(--app-bg);
  --bs-border-color: var(--app-border);
  --bs-secondary-color: var(--app-muted);
  --bs-link-color: var(--app-primary);
  --bs-link-hover-color: var(--app-primary-dark);
  --bs-border-radius: var(--app-radius);
}

.skip-link {
  left: 1rem;
  position: absolute;
  top: -4rem;
  z-index: 1050;
}

.skip-link:focus {
  top: 1rem;
}

:focus-visible {
  outline: 3px solid var(--app-focus);
  outline-offset: 3px;
}

/* Bootstrap 5.3 compiles each button's colour into its own --bs-btn-*
   properties, so setting --bs-primary alone would not reach them. */
.btn-primary {
  --bs-btn-bg: var(--app-primary);
  --bs-btn-border-color: var(--app-primary);
  --bs-btn-hover-bg: var(--app-primary-dark);
  --bs-btn-hover-border-color: var(--app-primary-dark);
  --bs-btn-active-bg: var(--app-primary-dark);
  --bs-btn-active-border-color: var(--app-primary-dark);
  --bs-btn-disabled-bg: var(--app-primary);
  --bs-btn-disabled-border-color: var(--app-primary);
}

.btn-warning {
  --bs-btn-bg: var(--app-accent);
  --bs-btn-border-color: var(--app-accent);
  --bs-btn-color: #0f172a;
  --bs-btn-hover-color: #0f172a;
}

body {
  font-family: var(--app-font-sans);
}

/* Figures and identifiers. A monospaced, tabular face lines the decimal
   points up down a column, so a number that has gained a digit is visible at
   a glance - which is the whole job of a page about money. */
.numeric {
  font-family: var(--app-font-mono);
  font-variant-numeric: tabular-nums;
}

.card,
.table {
  background-color: var(--app-surface);
}

.card {
  --bs-card-border-radius: var(--app-card-radius);
  --bs-card-border-color: var(--app-card-border);
  box-shadow: var(--app-card-shadow);
}

/* A card's title reads as a title: larger and bolder than the bold labels
   inside the card, on a darker band (the user chose this from three
   previews, 2026-09-30). */
.card-header {
  background-color: var(--app-border);
}

.card-header > h2 {
  font-size: 1rem;
  font-weight: 700;
}

/* A header's outline button keeps a white fill: its blue text measured
   3.7:1 on the darker band, under the 4.5:1 floor. Set through the button's
   own variable so its hover fill still applies. Outline buttons only: a
   solid one's white text on a white fill vanished (2026-09-30). */
.card-header [class*="btn-outline-"] {
  --bs-btn-bg: var(--app-surface);
}

/* A card's text sits one size below the page's (the user, 2026-09-30).
   Inputs, buttons and the dashboard's figures set their own sizes. */
.card-body {
  font-size: 0.9375rem;
}

/* Touch targets stay at the accessibility floor even though this is a dense
   application. */
.btn,
.form-control,
.form-select {
  min-height: 44px;
}

/* The floor stretches a button taller than its padding makes it - a btn-sm
   by 13px - so its label is centred in the box rather than left at the top
   (the user, 2026-09-28). */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* A label on one line: 「开出发票」 broke in two beside a date box. */
  white-space: nowrap;
}

/* The issue date box shares the draft's button row, as wide as a date. */
.issue-form .form-control {
  width: auto;
}

/* A checkbox itself stays a normal 16px box - enlarging it would look
   wrong - but its clickable area, shared with the label, meets the same
   44px floor. */
.form-check {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: 0;
}

/* The flex above would put inline choices one under the other. */
.form-check-inline {
  display: inline-flex;
  margin-right: 1.5rem;
}

.form-check-label {
  padding: 0.5rem 0;
  margin-left: 0.25rem;
}

/* Bootstrap rings an unchecked radio or checkbox in --bs-border-color, which
   is --app-border here: about 1.2:1 on a card, so an unchosen option read as
   bare text. Only the unchecked state is touched - a checked one keeps
   Bootstrap's filled primary. */
.form-check-input:not(:checked) {
  border-color: var(--app-muted);
}

/* "Appears in the document" beside a label. It was a pale grey pill that,
   walked on 2026-09-23, nobody would notice - and it is the one warning on
   the form that what is typed here is printed into a contract two parties
   sign. Filled with the accent, dark text, about 8:1. */
.document-mark {
  background-color: var(--app-accent);
  color: var(--app-text);
  font-weight: 600;
}

/* Same floor for pagination controls: the visible link keeps its usual
   padding, but the hit area grows to 44px. */
.page-link {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.table > :not(caption) > * > * {
  padding-block: 0.5rem;
}

.table-hover > tbody > tr:hover > * {
  background-color: #f1f5f9;
}

a,
.btn,
.form-control,
.form-select {
  transition:
    background-color 200ms ease,
    border-color 200ms ease,
    color 200ms ease;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

.icon {
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
  vertical-align: -0.2em;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  flex: none;
  /* As tall as the page, not one screen: a long page showed a break below
     it (the user, 2026-09-28). */
  align-self: stretch;
  width: 15rem;
  background-color: var(--app-surface);
  border-right: 1px solid var(--app-border);
  min-height: 100vh;
  padding: 1rem 0.75rem;
}

.app-sidebar__summary {
  display: none;
}

/* At desktop width the group list must always be visible, whatever the
   <details> element's own open/closed state happens to be - otherwise
   closing the Menu disclosure while narrow and then widening the window
   leaves a native "hidden until open" content block with nothing left to
   reopen it (the Menu control is hidden again above the breakpoint). The
   native `details:not([open]) > *:not(summary) { display: none }` rule
   this overrides lives in the browser's own stylesheet, not this file. */
@media (min-width: 768px) {
  .app-sidebar__disclosure > .app-sidebar__group {
    display: block !important;
  }

  /* Browsers that implement the newer <details> rendering model (Chrome
     131+) collapse closed content through an internal ::details-content
     pseudo-element rather than a plain `display: none` on the children, so
     the override above alone is not enough there - the pseudo-element
     itself must be forced open too. */
  .app-sidebar__disclosure::details-content {
    content-visibility: visible !important;
    height: auto !important;
    overflow: visible !important;
  }
}

.app-sidebar__group + .app-sidebar__group {
  margin-top: 1.5rem;
}

/* A group's heading stands over its items (the user, 2026-10-05: the 11px
   headings sat under 16px items): as large as they are, bold and dark, and
   it folds the group. The items are indented beneath it. */
.app-sidebar__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 0.75rem;
  border-radius: var(--app-radius);
  cursor: pointer;
  list-style: none;
}

.app-sidebar__toggle::-webkit-details-marker {
  display: none;
}

.app-sidebar__toggle:hover {
  background-color: #f1f5f9;
}

.app-sidebar__toggle::after {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--app-muted);
  border-bottom: 2px solid var(--app-muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.app-sidebar__section[open] > .app-sidebar__toggle::after {
  transform: rotate(45deg);
}

.app-sidebar__heading {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--app-text);
  margin: 0;
}

.app-sidebar__list {
  list-style: none;
  margin: 0;
  padding: 0 0 0 0.75rem;
}

.app-sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 44px;
  padding: 0 0.75rem;
  font-size: 0.9375rem;
  border-radius: var(--app-radius);
  color: var(--app-text);
  text-decoration: none;
}

.app-sidebar__link:hover {
  background-color: #f1f5f9;
}

.app-sidebar__link.is-current {
  background-color: var(--app-primary);
  color: #ffffff;
  font-weight: 600;
}

.app-main {
  flex: 1 1 auto;
  min-width: 0;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background-color: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
}

.app-brand {
  font-weight: 600;
  color: var(--app-text);
  text-decoration: none;
}

.app-topbar__right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.app-content {
  padding: 1.5rem;
  max-width: 80rem;
  /* Centred in the space beside the sidebar, not stuck to its left edge
     with the gap all on the right (the user, 2026-09-28). */
  margin-inline: auto;
}

@media (max-width: 767.98px) {
  .app-shell {
    display: block;
  }

  .app-sidebar {
    width: auto;
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--app-border);
  }

  .app-sidebar__summary {
    display: block;
    min-height: 44px;
    padding: 0.625rem 0.75rem;
    font-weight: 600;
    cursor: pointer;
  }

  .app-sidebar__disclosure:not([open]) .app-sidebar__group {
    display: none;
  }
}

.form-section + .form-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--app-border);
}

/* Field labels are bold everywhere: in regular weight they read as flat as
   the text around them (the user, 2026-09-28). */
.form-label {
  font-weight: 600;
}

/* The forms filled in part by part (compose a description, an invoice, a new
   project) number their sections. Each .steps container restarts the count;
   the number sits in a filled circle in front of the heading. Only inside
   .steps: form_row.html marks every section caption, and a form with no
   .steps would otherwise read 1, 1, 1. */
.steps {
  counter-reset: step;
}

.steps .step-heading {
  counter-increment: step;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--app-text);
}

.steps .step-heading::before {
  content: counter(step);
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 50%;
  background: var(--app-primary);
  color: #fff;
  font-size: 0.875rem;
}

.form-section__caption {
  color: var(--app-text);
  padding-bottom: 0.375rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--app-border);
}

/* Create and edit pages as cards (the user's reference, 2026-10-06): each
   group a card with an icon tile, a bold caption and a lead; two columns from
   1200px. */
.form-cards {
  display: grid;
  gap: 1.25rem;
  align-items: start;
}

@media (min-width: 1200px) {
  .form-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* A table's own grid (invoice lines, payment plan, balances) after the form's
   (a script may sit between the two, hence ~ and not +): the same gap as between two cards of one grid. */
.form-cards ~ .form-cards {
  margin-top: 1.25rem;
}

.form-card {
  border: 1px solid var(--app-card-border);
  border-radius: var(--app-card-radius);
  background-color: var(--app-surface);
  box-shadow: var(--app-card-shadow);
  overflow: hidden;
}

/* A numbered form (project, invoice): the card counts, and its tile shows the
   number instead of an icon (the user, 2026-10-06, keeping 2026-09-28's
   numbered steps). The heading's own circle is not drawn inside a card. */
.steps .form-card {
  counter-increment: step;
}

.steps .form-card__icon.is-number::before {
  content: counter(step);
  font-size: 1.0625rem;
  font-weight: 700;
}

.steps .form-card .step-heading {
  counter-increment: none;
  display: block;
  font-size: 1.0625rem;
  font-weight: 700;
}

.steps .form-card .step-heading::before {
  content: none;
}

/* A run of fields set off inside a card (ruled_fields): a line above and
   below, in the card's own border colour (the user, 2026-10-07, on the
   project form's dates). */
.form-card__rule hr {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--app-card-border);
  opacity: 1;
}

/* Suggested project names as chips under the name field (the user,
   2026-10-07); the chosen one in the card icons' blue. */
.name-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.name-chip {
  padding: 0.375rem 0.875rem;
  border: 1px solid var(--app-card-border);
  border-radius: 999px;
  background-color: var(--app-surface);
  color: var(--app-text);
  font-size: 0.9375rem;
  line-height: 1.4;
}

.name-chip:hover {
  border-color: #93c5fd;
  background-color: #f1f5f9;
}

.name-chip.is-chosen {
  border-color: #93c5fd;
  background-color: #dbeafe;
  color: #1e40af;
  font-weight: 600;
}

/* A table in a card takes the grid's full width. */
.form-card--wide {
  grid-column: 1 / -1;
}

.form-card__head {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--app-border);
  background-color: #f1f5f9;
}

.form-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  color: #1e40af;
  background-color: #dbeafe;
}

.form-card__icon .icon {
  width: 1.25rem;
  height: 1.25rem;
}

.form-card__title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
}

.form-card__lead {
  margin: 0.125rem 0 0;
  color: var(--app-muted);
  font-size: 0.875rem;
}

.form-card__body {
  padding: 1.25rem;
}

.form-card .form-control,
.form-card .form-select {
  min-height: 2.75rem;
  border-color: #cbd5e1;
  border-radius: 0.5rem;
}

/* The rule above has the specificity of Bootstrap's own state colours and
   loads after them, so the states are restated inside a card. */
.form-card .form-control.is-invalid,
.form-card .form-select.is-invalid {
  border-color: var(--bs-form-invalid-border-color);
}

.form-card .form-control:focus,
.form-card .form-select:focus {
  border-color: var(--app-focus);
}

/* An invoice line groups its own fields inside the Lines card, so it needs a
   boundary of its own. Same border token and radius as the rest of the app's
   panels, rather than Bootstrap's raw .border.rounded utilities. */
.invoice-line {
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
}

/* Placeholders an applied template filled from the invoice already being
   typed. Token and value read as two aligned columns rather than one
   semicolon-separated run of text - this is supporting information
   confirming the fill picked up the right project and customer, not the
   line's main content, so it stays quiet: no card or border of its own. */
.filled-tokens {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 0.75rem;
  row-gap: 0.25rem;
  margin: 0;
}

.filled-tokens dt {
  font-family: var(--app-font-mono);
}

.filled-tokens dd {
  margin: 0;
}

/* The compose page's read-only template text. The body keeps its own line
   breaks, and each placeholder is tinted by who answers it: the invoice
   (primary) or the user (warning). Bootstrap's subtle/emphasis pairs keep
   the contrast in both themes. */
.template-fold > summary {
  cursor: pointer;
  list-style: none;
}

.template-fold > summary::-webkit-details-marker {
  display: none;
}

.template-fold > summary::after {
  content: "\25B8";
  color: var(--bs-secondary-color);
}

.template-fold[open] > summary::after {
  content: "\25BE";
}

.template-text {
  white-space: pre-wrap;
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bs-secondary-bg);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
}

.template-token {
  font-family: var(--app-font-mono);
  font-size: 0.875em;
  padding: 0 0.25rem;
  border-radius: 0.25rem;
}

.template-token-filled {
  color: var(--bs-primary-text-emphasis);
  background: var(--bs-primary-bg-subtle);
}

.template-token-asked {
  color: var(--bs-warning-text-emphasis);
  background: var(--bs-warning-bg-subtle);
}

/* Bootstrap paints .form-control/.form-select from --bs-body-bg, which this
   file points at the page ground (--app-bg) so the rest of the page reads as
   one surface. On a card, which is also painted from --app-surface, that
   makes an input indistinguishable from the card behind it. Give inputs
   their own explicit background and a border strong enough to read as a
   control boundary without borrowing from --app-border (which stays quiet
   for table rules and card edges). */
.form-control,
.form-select {
  background-color: var(--app-surface);
  border-color: #64748b;
}

.form-control:hover,
.form-select:hover {
  border-color: #475569;
}

/* Table headings are a grey band of dark bold text. As 12px muted capitals
   on the row's own colour they went unseen (the user, 2026-09-28; grey band
   chosen over dark and light blue). */
.table > thead > tr > th {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--app-text);
  background-color: #f1f5f9;
  border-bottom: 2px solid #cbd5e1;
  white-space: nowrap;
}

/* A table's rows are as large as its heading: 16px rows under 14px
   headings read as headings smaller than their content (the user,
   2026-10-06, chosen for every table). */
.table > tbody > tr > td {
  font-size: 0.875rem;
}

.table > tbody > tr > th {
  font-size: 0.875rem;
}

/* Badges are sized in em; kept at the 12px they had in a 16px row. */
.table .badge {
  font-size: 0.75rem;
}

/* Codes and amounts are one token each: "JCI-2026-004" broke after its
   hyphen and "USD 30000.00" after the currency. */
.table .numeric {
  white-space: nowrap;
}

/* The calendar (the user's reference layout, 2026-10-06): a header with the
   month, its arrows and Today; a dot legend; the month grid of light event
   cards; and a side panel that always lists one day's events. The four state
   colours are the ones `_state_class.html` gives the badges, lightened for
   cards. Below 1200px the panel goes under the grid; on a phone the cells
   show dots and the panel carries the detail. */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-bottom: 1.25rem;
}

.page-head__title {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
}

.page-head__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  color: #2563eb;
  background-color: #dbeafe;
}

.page-head__icon .icon {
  width: 1.5rem;
  height: 1.5rem;
}

.calendar-head__month {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.page-head h1 {
  font-weight: 700;
}

.calendar-head__month h1 {
  margin: 0 0.5rem 0 0;
}

.calendar-head__step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
}

.calendar-head__today {
  height: 2.5rem;
}

/* Its own row under the month and the buttons: all three on one row needed
   a 1530px window, and at 1280 the buttons fell under the legend. The
   cancelled switch closes the row on the right. */
.calendar-legend-row {
  display: flex;
  flex-wrap: wrap;
  order: 1;
  flex-basis: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}

/* A link drawn as a switch, in the same rounded grey outline as the view
   switch, so it no longer reads as a stray underlined link (the user,
   2026-10-06). It stays a link: no JavaScript. */
.calendar-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.25rem;
  padding: 0 0.875rem 0 0.625rem;
  border: 1px solid var(--app-border);
  border-radius: 999px;
  color: var(--app-text);
  background-color: var(--app-surface);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
}

.calendar-switch:hover {
  color: var(--app-text);
  background-color: var(--app-bg);
}

.calendar-switch__track {
  position: relative;
  flex: none;
  width: 2rem;
  height: 1.125rem;
  border-radius: 999px;
  background-color: #cbd5e1;
  transition: background-color 0.15s ease;
}

.calendar-switch__track::after {
  position: absolute;
  top: 0.125rem;
  left: 0.125rem;
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 999px;
  background-color: #fff;
  box-shadow: 0 1px 2px rgb(15 23 42 / 25%);
  content: "";
  transition: transform 0.15s ease;
}

.calendar-switch.is-on .calendar-switch__track {
  background-color: #2563eb;
}

.calendar-switch.is-on .calendar-switch__track::after {
  transform: translateX(0.875rem);
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
}

.calendar-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.calendar-legend__dot {
  display: inline-block;
  flex: none;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 999px;
  background-color: #2563eb;
}

.calendar-legend__dot--due_soon { background-color: #f59e0b; }
.calendar-legend__dot--overdue { background-color: #dc2626; }
.calendar-legend__dot--completed { background-color: #16a34a; }
.calendar-legend__dot--cancelled { background-color: #94a3b8; }

.page-head__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.calendar-views {
  display: inline-flex;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  background-color: var(--app-surface);
  overflow: hidden;
}

.calendar-views__item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0 1rem;
  color: var(--app-text);
  font-weight: 500;
  text-decoration: none;
}

.calendar-views__item + .calendar-views__item {
  border-left: 1px solid var(--app-border);
}

.calendar-views__item:hover {
  background-color: var(--app-bg);
}

.calendar-views__item.is-active {
  color: #fff;
  background-color: #1e293b;
}

.calendar-layout {
  display: grid;
  gap: 1.25rem;
  align-items: start;
}

@media (min-width: 1200px) {
  .calendar-layout {
    grid-template-columns: minmax(0, 1fr) 18.5rem;
  }
}

.calendar-month {
  border: 1px solid var(--app-card-border);
  border-radius: var(--app-card-radius);
  background-color: var(--app-surface);
  overflow: hidden;
  box-shadow: var(--app-card-shadow);
}

/* A fixed layout with seven equal columns: content sizing let one long title
   blow a single day's column out (2026-09). */
.calendar-grid {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.calendar-grid th {
  padding: 0.625rem 0.25rem;
  border-bottom: 1px solid var(--app-border);
  background-color: #f1f5f9;
  color: var(--app-muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
}

.calendar-cell {
  height: 7.5rem;
  padding: 0.375rem;
  border: 1px solid #edf1f5;
  vertical-align: top;
}

.calendar-grid tr > .calendar-cell:first-child { border-left: 0; }
.calendar-grid tr > .calendar-cell:last-child { border-right: 0; }
.calendar-grid tbody tr:last-child > .calendar-cell { border-bottom: 0; }

.calendar-cell.is-outside {
  background-color: #fafbfc;
}

.calendar-cell.is-today {
  background-color: #eff6ff;
}

.calendar-cell.is-selected {
  box-shadow: inset 0 0 0 2px #2563eb;
}

.calendar-cell__day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  margin-bottom: 0.25rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  color: var(--app-text);
  font-weight: 600;
  text-decoration: none;
}

.calendar-cell__day:hover {
  background-color: #e2e8f0;
}

.calendar-cell.is-outside .calendar-cell__day {
  color: #94a3b8;
  font-weight: 400;
}

.calendar-cell.is-today .calendar-cell__day {
  color: #fff;
  background-color: #2563eb;
}

.calendar-cell__dots,
.calendar-grid__short {
  display: none;
}

.calendar-cell__events {
  display: grid;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.calendar-card {
  display: flex;
  align-items: flex-start;
  gap: 0.375rem;
  padding: 0.3125rem 0.4375rem;
  border-radius: 0.375rem;
  color: #1e3a8a;
  background-color: #dbeafe;
  text-decoration: none;
}

.calendar-card:hover {
  filter: brightness(0.97);
}

/* Spelled out, not left to `.calendar-card`: the panel's entries and the
   list's icons carry only the state class. */
.calendar-card--upcoming { color: #1e3a8a; background-color: #dbeafe; }
.calendar-card--due_soon { color: #92400e; background-color: #fef3c7; }
.calendar-card--overdue { color: #991b1b; background-color: #fee2e2; }
.calendar-card--completed { color: #166534; background-color: #dcfce7; }
.calendar-card--cancelled { color: #475569; background-color: #f1f5f9; }

.calendar-card__icon {
  width: 1rem;
  height: 1rem;
  margin-top: 0.0625rem;
}

.calendar-card__text {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}

.calendar-card__name {
  overflow: hidden;
  font-size: 0.75rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-card__type {
  overflow: hidden;
  font-size: 0.6875rem;
  opacity: 0.85;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-cell__more {
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0 0.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
}

.calendar-day-panel {
  padding: 1.25rem;
  border: 1px solid var(--app-card-border);
  border-radius: var(--app-card-radius);
  background-color: var(--app-surface);
  box-shadow: var(--app-card-shadow);
}

.calendar-day-panel__title {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 700;
}

.calendar-day-panel__count,
.calendar-day-panel__empty {
  margin: 0.25rem 0 0;
  color: var(--app-muted);
}

.calendar-day-panel__events {
  display: grid;
  gap: 0.625rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.calendar-entry {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.625rem;
  text-decoration: none;
}

.calendar-entry__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background-color: rgb(255 255 255 / 70%);
}

.calendar-entry__text {
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.35;
}

.calendar-entry__name {
  overflow-wrap: anywhere;
  font-weight: 600;
}

.calendar-entry__type {
  font-size: 0.875rem;
  opacity: 0.85;
}

.calendar-entry__state {
  flex: none;
}

/* A country's flag (the user's round images, 2026-10-06) in place of the
   round icon: 32px in a list row, 48px in a country page's header. A country
   without a flag keeps the icon. */
.country-flag {
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgb(15 23 42 / 8%);
}

/* In the page header, where the round icon goes. */
.country-flag--title {
  width: 3rem;
  height: 3rem;
}

/* A detail page's related records (a company's bank accounts, an invoice's
   lines) in a card like its Details, the table flush with the card's edges,
   instead of a bare heading and table under it (the user, 2026-10-06). */
.detail-section__table {
  padding: 0;
}

.detail-section__table .table > :not(caption) > * > :first-child {
  padding-left: 1rem;
}

.detail-section__table .table > :not(caption) > * > :last-child {
  padding-right: 1rem;
}

.detail-section__table .table > tbody > tr:last-child > * {
  border-bottom: 0;
}

.detail-section__note {
  padding: 1rem 1rem 0;
}

/* Every list page in the event list's dress (the user, 2026-10-06: first
   the event list, which looked like another system, then 「全站的列表页面」):
   filters and table in one white panel, filters on one row, each row led by
   a round icon and a bold link. */
.list-panel {
  padding: 1.25rem;
  border: 1px solid var(--app-card-border);
  border-radius: var(--app-card-radius);
  background-color: var(--app-surface);
  box-shadow: var(--app-card-shadow);
}

.list-panel__filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

/* Capped, so a page with one filter does not stretch a select across the
   whole panel (a lone State select measured 938px). */
.list-panel__filter {
  flex: 1 1 10rem;
  min-width: 0;
  max-width: 16rem;
}

.list-panel__filter--wide {
  flex-basis: 14rem;
  max-width: 24rem;
}

.list-panel__filters .form-label {
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.list-panel__check {
  align-self: center;
  margin: 0;
}

.list-panel__table {
  margin-bottom: 0;
}

.list-row {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--app-text);
  text-decoration: none;
}

.list-row:hover .list-row__name {
  color: var(--app-primary);
  text-decoration: underline;
}

.list-row__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
}

.list-row__icon .icon {
  width: 1rem;
  height: 1rem;
}

.list-row__name {
  font-weight: 600;
}

.list-row__name.is-quiet {
  color: var(--app-muted);
  font-weight: 400;
}

/* A record's icon is light blue, grey once inactive; an event's takes its
   state colour from `calendar-card--*` instead (marked .is-state). */
.list-row__icon:not(.is-state) {
  color: #1e3a8a;
  background-color: #dbeafe;
}

.list-row__icon.is-inactive {
  color: #64748b;
  background-color: #f1f5f9;
}

/* Codes and amounts in the text face, as on the dashboard; the digits keep
   their equal widths. */
.list-panel .numeric {
  font-family: inherit;
}

/* Below 1600px, with the panel beside it, a cell is 94px wide at 1280 and
   117px at 1440: too narrow for the icon and the name (an invoice number
   measured 74px), so the card keeps its colour and the name, and
   the panel carries the type (the user's choice, 2026-10-06). */
@media (max-width: 1599.98px) {
  .calendar-cell {
    padding: 0.25rem;
  }

  .calendar-card {
    padding: 0.25rem 0.3125rem;
  }

  .calendar-card__icon,
  .calendar-card__type {
    display: none;
  }
}

/* A phone: seven card columns do not fit in 375px, so a day shows a dot per
   event and the panel under the grid lists them. */
@media (max-width: 575.98px) {
  /* The month, its arrows and Today need the icon's 62px to share a row. */
  .page-head__icon {
    display: none;
  }

  .calendar-grid th {
    font-size: 0.75rem;
  }

  /* Hidden from sight only: a screen reader still reads "Monday". */
  .calendar-grid__long {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .calendar-grid__short {
    display: inline;
  }

  .calendar-cell {
    height: 3.75rem;
    padding: 0.25rem 0.125rem;
    text-align: center;
  }

  .calendar-cell__events,
  .calendar-cell__more {
    display: none;
  }

  .calendar-cell__dots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.1875rem;
  }

  .calendar-cell__plus {
    color: var(--app-muted);
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 0.4375rem;
  }

  .calendar-cell__dots .calendar-legend__dot {
    width: 0.4375rem;
    height: 0.4375rem;
  }
}

/* A centred card used by the anonymous branch of base.html: sign-in and the
   sanitized error pages. */
.auth-card {
  width: 100%;
  max-width: 24rem;
}

/* The dashboard cards explain themselves. The user accepted the dashboard and
   then said they did not know what the cards meant, so each carries a hint.

   Built without JavaScript, so this is not Bootstrap's tooltip. The
   bubble is revealed on `:focus-within` as well as `:hover`, which is what
   lets a keyboard and a touch screen reach it - hover alone would have left
   the hint to mice only. It is faded with `opacity` rather than removed with
   `display`, so the text stays in the accessibility tree and the marker's
   `aria-describedby` keeps pointing at something that is really there. */
.card-help {
  position: relative;
  display: inline-flex;
  /* The button is a 44px touch target; the negative margin stops that floor
     from inflating the heading it sits in. */
  margin: -0.6875rem 0;
}

.card-help__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: help;
}

/* Deliberately not subtle. The first version used a hairline grey circle on
   a grey heading and the user could not find it at all - a hint nobody sees
   is not a quiet hint, it is a missing one. */
.card-help__ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.375rem;
  height: 1.375rem;
  border: 1px solid rgba(var(--bs-primary-rgb), 0.35);
  border-radius: 50%;
  background: rgba(var(--bs-primary-rgb), 0.1);
  color: var(--bs-primary);
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1;
}

.card-help__mark:hover .card-help__ring,
.card-help__mark:focus-visible .card-help__ring {
  border-color: var(--bs-primary);
  background: var(--bs-primary);
  color: #fff;
}

.card-help__bubble {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 30;
  width: 16rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  background: var(--bs-body-bg);
  box-shadow: var(--bs-box-shadow-sm);
  color: var(--bs-body-color);
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  text-transform: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease-in-out;
}

.card-help:hover .card-help__bubble,
.card-help:focus-within .card-help__bubble {
  opacity: 1;
}

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

/* ---------------------------------------------------------------------------
   The sign-in page.

   Laid out from a reference the user supplied: one card floating on a tinted
   ground, split into a coloured brand panel and a white form panel, with
   underlined fields and a pill button. The reference's palette was teal; ours
   stays the application's own blue, because the point was the arrangement.

   The reference's isometric illustration is not reproduced. There is no such
   asset in this project and inventing one would put a stock picture of a
   phone on the first screen of an invoicing tool. The panel carries a
   geometric motif built from CSS instead, so it costs no request and no
   JavaScript.
   --------------------------------------------------------------------------- */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1rem;
  background:
    radial-gradient(60rem 40rem at 15% 0%, rgba(59, 130, 246, 0.16), transparent 60%),
    radial-gradient(50rem 40rem at 100% 100%, rgba(30, 64, 175, 0.12), transparent 55%),
    var(--app-bg);
}

.auth-split {
  display: grid;
  grid-template-columns: 1fr;
  width: 100%;
  max-width: 56rem;
  overflow: hidden;
  border-radius: 1.5rem;
  background: var(--app-surface);
  box-shadow: 0 1.5rem 3rem rgb(15 23 42 / 12%), 0 0.25rem 0.75rem rgb(15 23 42 / 6%);
}

@media (min-width: 48em) {
  .auth-split {
    grid-template-columns: 5fr 7fr;
  }
}

.auth-split__brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 11rem;
  padding: 2rem;
  overflow: hidden;
  background: linear-gradient(150deg, var(--app-secondary) 0%, var(--app-primary) 70%);
  color: #fff;
}

/* The reference's signature move is that the coloured panel does not end in a
   straight line - it sweeps into the white. The panel is widened past its own
   grid column and given an elliptical right edge, so the curve is the panel
   itself rather than a picture of one. The form's left padding grows by the
   same amount, so no text ever sits under the bulge. */
@media (min-width: 48em) {
  .auth-split__brand {
    z-index: 1;
    min-height: 26rem;
    margin-right: -3rem;
    border-radius: 0 5rem 5rem 0 / 0 40% 40% 0;
  }
}

/* The curve the reference sweeps across its brand panel, as one rotated
   rounded square rather than an image. */
.auth-split__motif {
  position: absolute;
  top: -30%;
  right: -45%;
  width: 100%;
  padding-bottom: 100%;
  border-radius: 42%;
  background: rgba(255, 255, 255, 0.12);
}

.auth-split__motif::after {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: 42%;
  background: rgba(255, 255, 255, 0.14);
}

/* The reference sets its welcome word vertically down the panel's left edge.
   Below the split it would be a word turned on its side for no reason, so it
   returns to the baseline. */
.auth-split__welcome {
  position: relative;
  margin: 0 0 0.75rem;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  /* White on this gradient's lightest stop is 3.67:1, which clears the 3:1
     large-text floor. Fading it further would not, so it stays near-opaque. */
  color: rgba(255, 255, 255, 0.95);
}

@media (min-width: 48em) {
  .auth-split__welcome {
    position: absolute;
    top: 2rem;
    left: 1.5rem;
    margin: 0;
    writing-mode: vertical-rl;
    /* Reading upward, as the reference does. Rotated about its own centre so
       the box stays where it was positioned; an origin at the corner throws
       the word off the panel entirely, which is what the first attempt did. */
    transform: rotate(180deg);
    font-size: 2.75rem;
  }

  /* Chinese already sets vertically, and it sets upright: vertical-rl stacks
     the characters without laying them on their side, so the 180deg flip that
     makes a Latin word climb the panel would stand the Chinese one on its
     head. Reading top to bottom is the correct direction for it anyway. */
  .auth-split__welcome:lang(zh) {
    transform: none;
  }
}

.auth-split__tagline {
  position: relative;
  margin: 0;
  font-size: 0.875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  /* 0.82 white on this gradient's lightest stop clears 4.5:1. */
  color: rgba(255, 255, 255, 0.92);
}

.auth-split__form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2.5rem 2rem;
}

@media (min-width: 48em) {
  .auth-split__form {
    padding: 3.5rem 3.5rem 3.5rem 6rem;
  }
}

/* The switcher opens the form panel, right-aligned above the heading, so it
   reads as a page control rather than as part of the form. On a signed-out
   page there is no topbar to carry it, so this is the only way in. */
.auth-split__language {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1.5rem;
}

.auth-split__heading {
  margin: 0 0 2rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--app-primary);
}

.auth-field {
  margin-bottom: 1.75rem;
}

/* Kept on the page rather than floated into the input. A placeholder is not a
   label: it disappears the moment somebody types, exactly when they are most
   likely to want to check which box they are in. */
.auth-field__label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  color: var(--app-muted);
}

.auth-field__control {
  position: relative;
}

.auth-field__input {
  width: 100%;
  /* The project's touch-target floor. */
  min-height: 2.75rem;
  padding: 0.5rem 2.25rem 0.5rem 0;
  border: 0;
  border-bottom: 2px solid var(--app-border);
  border-radius: 0;
  background: transparent;
  color: var(--app-text);
  font-family: inherit;
  font-size: 1rem;
}

.auth-field__input:focus {
  border-bottom-color: var(--app-primary);
  outline: none;
}

/* An underlined field has no box to ring, so focus is drawn on the wrapper -
   the field still announces itself to a keyboard, which the border colour
   alone would not do for someone who cannot see the hue change. */
.auth-field__control:focus-within {
  outline: 3px solid var(--app-focus);
  outline-offset: 4px;
  border-radius: 0.25rem;
}

.auth-field__input.is-invalid {
  border-bottom-color: var(--bs-danger);
}

.auth-field__icon {
  position: absolute;
  top: 50%;
  right: 0;
  width: 1.25rem;
  height: 1.25rem;
  transform: translateY(-50%);
  color: var(--app-muted);
  pointer-events: none;
}

.auth-field__error {
  margin-top: 0.375rem;
  font-size: 0.875rem;
  color: var(--bs-danger);
}

.auth-submit {
  width: 100%;
  min-height: 3rem;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ---------------------------------------------------------------------------
   The getting-started step numeral.

   The user sent a reference layout - a 3x3 grid of large outlined numerals,
   each cell an icon, a title and a paragraph in its own colour - and asked
   whether to use it. The numeral was kept; the grid was not. A three-column
   grid reads 1, 4, 7 across its top row, which is fatal for a panel whose one
   job is to convey order; the reference's per-cell colours carry no meaning,
   and under this project's rule that colour is never the only signal a
   decorative colour is worse than none because it implies a code to decode -
   this panel's colour already has a job (available, blocked, done); and a
   cell holding an icon, a title and prose has nowhere to put the state or the
   button that this panel is made of. So the list stays vertical and the digit
   gets the size.

   Contrast: --app-muted (#475569) on the card's --app-surface (#ffffff)
   measures 7.58:1 against this project's 4.5:1 floor. Both are fixed hex
   tokens, and `.card` above paints from --app-surface directly, so the ratio
   does not move if a theme is ever added. There is deliberately no `opacity`
   here: a previous phase faded a badge to `opacity-50` and it measured
   2.08:1, half the contrast of the very text a "colour is never the only
   signal" rule depends on. The reference's hollow, stroke-only numeral is not
   reproduced for the same reason - a glyph whose interior is the background
   has no ratio the 4.5:1 floor can be checked against, and the brief's own
   instruction is to make the numeral darker rather than ship one nobody can
   read. Size and weight carry the presence instead of an outline.

   The width is set in `ch` on a tabular face so every row's label starts on
   the same vertical line whatever digit precedes it; `line-height: 1` keeps
   the numeral's cap aligned with the label beside it rather than sitting a
   half-line low. It steps down below 480px so a 375px screen keeps each
   step's name and its button on the row instead of wrapping them under it. */
.getting-started__number {
  flex: none;
  width: 1.6ch;
  font-family: var(--app-font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1;
  text-align: right;
  color: var(--app-muted);
}

@media (max-width: 479.98px) {
  .getting-started__number {
    font-size: 1.75rem;
  }
}

/* The step list's fold control. The eight steps are reference and the panel
   arrives folded once none of them can be started, so this line is the only
   thing standing between a reader and the order - it has to look like it
   opens something and be hittable with a thumb at 375px.

   `list-style` is deliberately not touched. Setting `list-style: none` is
   what removes the disclosure triangle, and on WebKit it removes the marker
   entirely - the affordance would be gone with nothing put in its place, and
   nothing draws a replacement. `min-height` and
   the padding give the 44px target; `cursor: pointer` is the pointer half of
   the same promise, because a browser's default `summary` cursor is an
   arrow and reads as static text. */
.getting-started__fold > summary {
  min-height: 44px;
  padding: 0.5rem 0;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
}

/* The same promise on the panel's other disclosure. A fully-set-up account
   gets a one-line `<details>` instead of this one, and its `<summary>` does
   exactly the same job - so it must not read as static text while this one
   reads as a control. Only the pointer half is repeated: that summary is a
   Bootstrap `card-body py-3`, already far past 44px and already padded, so
   restating the padding here would only fight it. `min-height` is stated
   anyway, because a later change to that card's padding must not be able to
   take the target below a fingertip in silence. `list-style` is untouched
   for the reason above. Its wording is not this rule's business and is not
   changed. */
.getting-started__done > summary {
  min-height: 44px;
  cursor: pointer;
}


/* The payment plan on the create-project page: one aligned table, the fee
   first, then the milestones, with the headings once (2026-09-28). Every row
   is its own grid on the same columns, so rows the script adds line up. */
.plan-grid__row {
  display: grid;
  /* Stage, name, amount, date, remove (the name: 2026-09-28). */
  grid-template-columns: 10rem minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) 5rem;
  gap: 0.5rem 1rem;
  align-items: start;
  padding: 0.5rem 0;
  /* Inset, so the heading band's text lines up with the cells below. */
  padding-inline: 0.75rem;
  border-bottom: 1px solid var(--app-border);
}

/* The headings as every other table's (the user, 2026-10-07: the small grey
   text did not read as headings). */
.plan-grid__head {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--app-text);
  background-color: #f1f5f9;
  border-bottom: 2px solid #cbd5e1;
  border-radius: 0.5rem 0.5rem 0 0;
}

.plan-grid__stage {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  /* As tall as an input (44px), so the icon and text sit level with it. */
  min-height: 2.75rem;
  font-weight: 500;
}

/* A row lights up under the pointer, as a list's row does (the user,
   2026-10-07), so a wide row is easy to follow. */
.plan-grid__row:not(.plan-grid__head):not(.plan-grid__total):hover {
  background-color: #f1f5f9;
}

/* A stage's icon, a small tile like a card's: a flag for a milestone, money
   for the fee (the user, 2026-10-07). */
.plan-grid__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.5rem;
  color: #1e40af;
  background-color: #dbeafe;
}

.plan-grid__mark .icon {
  width: 1rem;
  height: 1rem;
}

.plan-grid__actions {
  padding-top: 0.2rem;
}

/* A fresh relationship's next step, on its agreements panel (2026-09-30):
   the same blue note as the fee's verdict, and a button that pulses three
   times to be noticed, then rests. */
.next-step {
  padding: 0.75rem 1rem;
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--app-primary);
  border-radius: var(--app-radius);
}

.btn-pulse {
  animation: btn-pulse 1.6s ease-out 0.4s 3;
}

@keyframes btn-pulse {
  0% {
    box-shadow: 0 0 0 0 rgb(30 64 175 / 45%);
  }

  100% {
    box-shadow: 0 0 0 0.75rem rgb(30 64 175 / 0%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn-pulse {
    animation: none;
  }
}

/* The commitment fee's verdict, shown as a decision already made. */
.fee-verdict {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--app-primary);
  border-radius: var(--app-radius);
}

.plan-rule {
  color: var(--app-muted);
}

/* The total and the contract amount, on the plan table's columns. */
.plan-grid--totals {
  margin-top: 0.75rem;
  border-top: 2px solid var(--app-border);
}

.plan-grid__total {
  border-bottom: 0;
  padding-block: 0.25rem;
}

/* The totals' figures sit in the amount column, past the name column. */
.plan-grid__total .plan-grid__stage {
  grid-column: 1 / 3;
  min-height: 0;
}

/* Lined up with the text inside the amount inputs above. */
.plan-grid__figure {
  padding-left: calc(0.75rem + 1px);
  font-weight: 600;
}

.plan-grid__status {
  grid-column: 4 / -1;
  font-weight: 600;
}

.plan-grid__none {
  padding-top: 0.4rem;
  color: var(--app-muted);
}

@media (min-width: 768px) {
  /* The headings name the columns; each label stays for a screen reader. */
  .plan-grid__label {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  /* With the label hidden, a date's "?" sits after the date on its line,
     not alone above it, so the date lines up with the amount (2026-09-30). */
  .plan-grid__date {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 0.25rem;
  }

  .plan-grid__date > .form-control {
    flex: 1 1 0;
    min-width: 0;
  }

  /* The ring is 22px inside a 44px target; the target overhangs into the
     column gap on its right rather than taking the date's width. */
  .plan-grid__date .card-help {
    order: 1;
    margin-right: -0.6875rem;
  }

  /* The date column is wider than the amount's, so dd/mm/yyyy still fits
     beside its "?". */
  .plan-grid__row {
    grid-template-columns: 10rem minmax(0, 1.2fr) minmax(0, 0.9fr) minmax(0, 1.3fr) 5rem;
  }

  .plan-grid__date > .text-danger {
    flex-basis: 100%;
    order: 2;
  }
}

@media (max-width: 767.98px) {
  .plan-grid__head {
    display: none;
  }

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

  .plan-grid__stage,
  .plan-grid__actions {
    grid-column: 1 / -1;
    padding-top: 0;
    font-weight: 600;
  }

  .plan-grid__total .plan-grid__stage {
    grid-column: auto;
    font-weight: 500;
  }

  .plan-grid__name {
    grid-column: 1 / -1;
  }

  .plan-grid__none {
    display: none;
  }

  .plan-grid__status {
    grid-column: 1 / -1;
  }

  .fee-verdict {
    flex-direction: column;
  }
}

/* A card that follows another is spaced from it, so two panels never touch
   (the project page, 2026-09-28). A margin already there collapses into this
   one rather than doubling it. */
.card + .card {
  margin-top: 1rem;
}

/* The「?」beside a status (the user, 2026-09-29) is the card help above,
   with a wider bubble that opens rightwards from the label and one line per
   status. */
.card-help--status .card-help__bubble {
  left: 0;
  right: auto;
  width: 24rem;
  max-width: calc(100vw - 2rem);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Faded, the bubble still takes space, so on a phone it must end inside the
   screen: it starts at the button, at most about 7rem from the edge. */
@media (max-width: 575.98px) {
  .card-help--status .card-help__bubble {
    width: calc(100vw - 8rem);
  }
}

.card-help__item {
  display: block;
}

.card-help__item + .card-help__item {
  margin-top: 0.375rem;
}

/* A detail page's ways back, together at its bottom (the user, 2026-10-05).
   A button is inline-flex, which drops the space after the chevron. */
.back-buttons .btn {
  gap: 0.25rem;
}

/* Light blue, blue text (the user, 2026-10-05: the grey ones looked dull). */
.btn-back {
  --bs-btn-color: var(--app-primary);
  --bs-btn-bg: #dbeafe;
  --bs-btn-border-color: #bfdbfe;
  --bs-btn-hover-color: var(--app-primary-dark);
  --bs-btn-hover-bg: #bfdbfe;
  --bs-btn-hover-border-color: #93c5fd;
  --bs-btn-active-color: var(--app-primary-dark);
  --bs-btn-active-bg: #bfdbfe;
  --bs-btn-active-border-color: #93c5fd;
  --bs-btn-focus-shadow-rgb: 30, 64, 175;
}

.agreement-gaps {
  font-size: 14px;
}

.agreement-gaps.alert {
  padding: 0.5rem 0.75rem;
  margin: 0.25rem 0 0;
}

/* The dashboard's collection progress (the user, 2026-10-05): one blue,
   darkest for the furthest along - paid, issued, draft. Segments stand 2px
   apart with rounded outer ends; a project's bar is thinner than its
   currency's. */
.progress-bar-stack {
  display: flex;
  gap: 2px;
  width: 100%;
  margin: 0.25rem 0;
}

.progress-bar-stack--lg {
  height: 24px;
  margin: 0.75rem 0 1rem;
}

.progress-bar-stack--sm {
  height: 12px;
  margin: 0;
}

.progress-bar__seg {
  display: block;
  height: 100%;
  min-width: 4px;
}

.progress-bar__seg:first-child {
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
}

.progress-bar__seg:last-child {
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
}

.progress-bar__seg--paid {
  background-color: #1e40af;
}

.progress-bar__seg--issued {
  background-color: #3b82f6;
}

.progress-bar__seg--draft {
  background-color: #93c5fd;
}

.collection-progress__label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: var(--app-muted);
}

.collection-progress__swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.collection-progress__project {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr) 11rem;
  gap: 1rem;
  align-items: center;
  padding-top: 0.875rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid #edf1f6;
}

@media (max-width: 575.98px) {
  /* A project's stages take their own line under the code and the amount:
     between them its bar was 5px wide at 375px. */
  .collection-progress__project {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 0.25rem;
    padding: 0.25rem 0;
  }

  .collection-progress__project .collection-progress__stages {
    grid-column: 1 / -1;
    order: 3;
  }
}

/* The receivables tiles (the user, 2026-10-05): each marker matches its part
   of the collection progress bar; the overdue tile turns red only when
   something is late. */
.receivables-tile__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.625rem;
}

.receivables-tile__icon .icon {
  width: 1.25rem;
  height: 1.25rem;
}

.receivables-tile__icon--paid {
  color: #16a34a;
  background-color: #dcfce7;
}

.receivables-tile__icon--issued {
  color: #3b82f6;
  background-color: #dbeafe;
}

.receivables-tile__icon--draft {
  color: #f59e0b;
  background-color: #fef3c7;
}

.receivables-tile__icon--overdue {
  color: #dc2626;
  background-color: #fee2e2;
}

.receivables-tile__label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--app-text);
  white-space: nowrap;
  margin: 0;
}

.receivables-tile__note {
  display: block;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--app-muted);
}

.receivables-tile--alert {
  border-color: #fca5a5;
  background-color: #fef2f2;
}

.receivables-tile--alert .receivables-tile__icon--overdue {
  color: #dc2626;
  background-color: #fecaca;
}

.receivables-tile__alert-text {
  color: #b91c1c;
}

.collection-progress__legend {
  font-size: 0.9375rem;
}

.collection-progress__legend .collection-progress__swatch {
  display: inline-block;
  margin-right: 0.375rem;
}


/* A project's payment stages (the user, 2026-10-05): one equal step each,
   coloured as the collection progress bar colours its parts. */
.stage-steps {
  display: flex;
  gap: 2px;
}

.stage-step {
  flex: 1 1 0;
  min-width: 2.75rem;
  padding: 0.25rem 0.375rem;
  border-radius: 0;
  font-family: var(--app-font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
}

.stage-step--paid {
  background-color: #1e40af;
  color: #ffffff;
}

.stage-step--issued {
  background-color: #3b82f6;
  color: #ffffff;
}

.stage-step--overdue {
  background-color: #dc2626;
  color: #ffffff;
}

.stage-step--draft {
  background-color: #e0ecfd;
  color: #1e40af;
}

.stage-steps__summary {
  margin-top: 0.375rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--app-muted);
}

.project-list__progress {
  min-width: 16rem;
}

/* The dashboard after the user's reference layout (2026-10-05): a tinted
   table head (its rounder, softly shadowed cards are every page's since
   2026-10-06, from the --app-card-* tokens); a coloured edge on the
   received tile; an icon square beside each section's bold heading. */
.dashboard .table thead th {
  background-color: #f1f5f9;
  font-weight: 600;
}

.dashboard .receivables-tile--paid {
  border-left: 4px solid #16a34a;
}

.receivables-tile__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.receivables-tile__head .card-help {
  margin-left: auto;
}

.dashboard-section__title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
}

.dashboard-section__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
}

.dashboard-section__icon .icon {
  width: 1.25rem;
  height: 1.25rem;
}

.dashboard-section__icon--progress {
  color: #2563eb;
  background-color: #dbeafe;
}

.dashboard-section__icon--reserve {
  color: #15803d;
  background-color: #dcfce7;
}

.dashboard-section__icon--overdue {
  color: #7c3aed;
  background-color: #ede9fe;
}

.dashboard-section__icon--upcoming {
  color: #2563eb;
  background-color: #dbeafe;
}

.dashboard-section__title .card-help {
  margin-left: auto;
}

/* Type and spacing on the dashboard (the user, 2026-10-05: 「留意字体大小运用还有
   每次分行时候的空间…避免眼睛劳累」). Body text 15px with 1.6 line spacing;
   nothing under 13px; a section's lead sits a full line above its content;
   a legend's amount sits under its label with the share in brackets. */
.dashboard {
  font-size: 0.9375rem;
  line-height: 1.6;
}

.dashboard .card-body {
  padding: 1.25rem 1.5rem;
}

.dashboard .small {
  font-size: 0.875rem;
}

.dashboard-section__lead {
  font-size: 0.875rem;
  color: var(--app-muted);
  margin-top: 0.25rem;
  margin-bottom: 1rem;
  margin-left: 3.25rem;
}

.dashboard-section__body {
  font-size: 0.9375rem;
  line-height: 1.7;
  margin: 0;
}

.dashboard-section__empty {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background-color: #f8fafc;
  color: var(--app-muted);
}

.receivables-tile__amount {
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.3;
  margin-top: 0.25rem;
}

.receivables-tile__sub {
  font-size: 0.875rem;
  color: var(--app-muted);
  margin-top: 0.375rem;
}

.collection-progress__total-row {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 0.625rem;
}

.collection-progress__total-label {
  font-size: 1rem;
  color: var(--app-muted);
}

.collection-progress__total {
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.3;
  color: #1e3a8a;
  font-variant-numeric: tabular-nums;
}

.collection-progress__legend-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
  color: var(--app-text);
}

.collection-progress__legend-value {
  font-size: 0.9375rem;
  color: var(--app-muted);
  margin-top: 0.25rem;
  padding-left: 1.25rem;
}

.collection-progress__share {
  font-size: 0.9375rem;
  color: var(--app-muted);
  margin-left: 0.125rem;
}

.collection-progress__projects-heading {
  font-size: 1rem;
  font-weight: 700;
  background-color: #f5f8fd;
  border-radius: 0.5rem;
  padding: 0.625rem 0.75rem;
  margin: 1.5rem 0 0.25rem;
}

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

.collection-progress__none {
  font-size: 0.9375rem;
  color: var(--app-muted);
  padding: 0.75rem 0;
}

.collection-progress__all {
  font-size: 0.9375rem;
  margin: 1rem 0 0;
}

/* The lightbulb that marks getting started, on its floating button and in
   its dialog's heading. */
.getting-started__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 3rem;
  height: 3rem;
  border-radius: 0.875rem;
  color: #d97706;
  background-color: #fef3c7;
}

.getting-started__icon .icon {
  width: 1.5rem;
  height: 1.5rem;
}

@media (max-width: 991.98px) {
  /* A lead's indent matches a heading's icon only when there is room for
     both. */
  .dashboard-section__lead {
    margin-left: 0;
  }
}

/* Compared with the reference (the user, 2026-10-05): the total with its
   label at the right of the heading row; figures in the text face; the
   stage steps joined into one bar; where a project stands darker than what
   comes next; 「待收」 quiet before a dark amount. */
.dashboard .numeric {
  font-family: var(--app-font-sans);
  font-variant-numeric: tabular-nums;
}

.collection-progress__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

/* The lead the user kept under the heading row; no icon to line up with. */
.collection-progress__lead {
  margin-left: 0;
}

.collection-progress__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.collection-progress--next {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #edf1f6;
}

.collection-progress__code {
  font-size: 0.9375rem;
}

.stage-step:first-child {
  border-radius: 6px 0 0 6px;
}

.stage-step:last-child {
  border-radius: 0 6px 6px 0;
}

.stage-step:only-child {
  border-radius: 6px;
}

.stage-steps__now {
  color: var(--app-text);
  font-weight: 500;
}

.stage-steps__summary--overdue,
.stage-steps__summary--overdue .stage-steps__now {
  color: #b91c1c;
}

.collection-progress__awaiting-label {
  font-size: 0.9375rem;
  color: var(--app-muted);
  margin-right: 0.375rem;
}

.collection-progress__awaiting-amount {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--app-text);
  font-variant-numeric: tabular-nums;
}

/* Getting started floats at the middle of the dashboard's right edge and
   opens as a dialog (the user, 2026-10-05). Quiet once nothing is left to
   set up; a red count while steps are ready to start. */
.getting-started-fab {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 1030;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  width: 4.5rem;
  padding: 0.75rem 0.375rem;
  border: 1px solid #fcd34d;
  border-right: 0;
  border-radius: 1rem 0 0 1rem;
  background-color: #fffbeb;
  color: #92400e;
  box-shadow: 0 4px 16px rgb(15 23 42 / 12%);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
}

.getting-started-fab:hover,
.getting-started-fab:focus-visible {
  background-color: #fef3c7;
}

.getting-started-fab__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background-color: #fef3c7;
  color: #d97706;
}

.getting-started-fab__icon .icon {
  width: 1.375rem;
  height: 1.375rem;
}

.getting-started-fab__count {
  position: absolute;
  top: 0.375rem;
  left: 0.375rem;
  min-width: 1.375rem;
  height: 1.375rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background-color: #dc2626;
  color: #ffffff;
  font-size: 0.8125rem;
  line-height: 1.375rem;
  text-align: center;
}

.getting-started-fab--quiet {
  background-color: #ffffff;
  border-color: #e2e8f0;
  color: var(--app-muted);
}

.getting-started-fab--quiet .getting-started-fab__icon {
  background-color: #f1f5f9;
  color: var(--app-muted);
}

.getting-started-dialog {
  width: min(40rem, calc(100vw - 2rem));
  max-height: calc(100vh - 4rem);
  padding: 0;
  border: 0;
  border-radius: 1rem;
  box-shadow: 0 20px 48px rgb(15 23 42 / 25%);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.getting-started-dialog::backdrop {
  background-color: rgb(15 23 42 / 45%);
}

.getting-started-dialog__head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #edf1f6;
  background-color: #ffffff;
}

.getting-started-dialog__head h2 {
  flex: 1 1 auto;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.getting-started-dialog__body {
  padding: 1rem 1.25rem 1.25rem;
}

/* The companies that still need setting up: an amber banner at the top of
   the dashboard, each missing step a button (the user, 2026-10-05). */
.company-gaps-banner {
  background-color: #fffbeb;
  border: 1px solid #fcd34d;
  border-left: 5px solid #f59e0b;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.company-gaps-banner__title {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin: 0 0 0.5rem;
  font-size: 1.0625rem;
  font-weight: 700;
  color: #92400e;
}

.company-gaps-banner__title .icon {
  width: 1.25rem;
  height: 1.25rem;
  color: #d97706;
}

.company-gaps-banner__row {
  display: grid;
  grid-template-columns: 6rem minmax(8rem, 12rem) minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  padding: 0.625rem 0;
  border-top: 1px solid #fde68a;
}

.company-gaps-banner__code {
  font-weight: 700;
}

.company-gaps-banner__name {
  color: var(--app-muted);
}

.company-gaps-banner__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.company-gaps-banner__needs {
  font-size: 0.875rem;
  color: #92400e;
}

.company-gaps-banner__action {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.25rem 0.875rem;
  border: 1px solid #f59e0b;
  border-radius: 999px;
  background-color: #ffffff;
  color: #92400e;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}

.company-gaps-banner__action:hover,
.company-gaps-banner__action:focus-visible {
  background-color: #fef3c7;
  color: #78350f;
}

@media (max-width: 575.98px) {
  /* A company's code and name share a line; its buttons take the next. */
  .company-gaps-banner__row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .company-gaps-banner__actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 575.98px) {
  /* The floating button shrinks to its icon: at 72px it covered the right
     48px of the cards at 375px. The button's aria-label still names it. */
  .getting-started-fab {
    width: 2.75rem;
    padding: 0.375rem 0.25rem;
  }

  .getting-started-fab__icon {
    width: 2rem;
    height: 2rem;
  }

  .getting-started-fab__label {
    display: none;
  }

  .getting-started-fab__count {
    top: -0.375rem;
    left: -0.375rem;
  }
}

/* What a company still needs, on the companies list (the user, 2026-10-05):
   amber with its icon when something is missing, green when ready. */
.company-setup {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.125rem 0.625rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.5;
}

.company-setup .icon {
  width: 0.875rem;
  height: 0.875rem;
}

.company-setup--missing {
  background-color: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
}

.company-setup--ready {
  background-color: #dcfce7;
  color: #15803d;
}

/* A missing signatory: lighter than the banner, because it does not stop
   invoicing - only the agreements' signature lines. */
/* A value an agreement needs but nobody entered (it prints [TO BE
   COMPLETED]): an orange badge whose glow keeps pulsing until it is filled.
   The user chose a continuous pulse over three pulses on arrival
   (2026-10-06); a reader who asks for reduced motion gets it still. */
.missing-field {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.125rem 0.625rem;
  border: 1px solid #fb923c;
  border-radius: 999px;
  background-color: #fff7ed;
  color: #c2410c;
  font-size: 0.8125rem;
  font-weight: 700;
  animation: missing-field-pulse 2s ease-in-out infinite;
}

.missing-field .icon {
  width: 0.9rem;
  height: 0.9rem;
}

a.missing-field {
  text-decoration: none;
  cursor: pointer;
}

a.missing-field:hover,
a.missing-field:focus-visible {
  border-color: #ea580c;
  background-color: #ffedd5;
  color: #9a3412;
}

/* The field a badge links to: its label stays in view above it, and an
   orange ring says "this one". */
.form-control:target,
.form-select:target {
  scroll-margin-top: 6rem;
  box-shadow: 0 0 0 0.25rem rgb(249 115 22 / 30%);
}

@keyframes missing-field-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgb(249 115 22 / 45%);
  }

  50% {
    box-shadow: 0 0 0 0.375rem rgb(249 115 22 / 0%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .missing-field {
    animation: none;
  }
}

/* Grey and quiet it reminded nobody (the user, 2026-10-06: 「太闷太淡了」).
   Light orange with a bar, an icon, a bold lead and a button: something to
   do, one step below the amber banner's "cannot invoice". */
.company-signatory-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid #fed7aa;
  border-left: 5px solid #f97316;
  border-radius: 0.75rem;
  background-color: #fff7ed;
  color: #7c2d12;
  font-size: 0.9375rem;
}

.company-signatory-note__icon {
  width: 1.25rem;
  height: 1.25rem;
  color: #ea580c;
}

.company-signatory-note__text {
  flex: 1 1 16rem;
  margin: 0;
}

.company-signatory-note__action {
  --bs-btn-color: #c2410c;
  --bs-btn-border-color: #fb923c;
  --bs-btn-bg: #fff;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #ea580c;
  --bs-btn-hover-border-color: #ea580c;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #c2410c;
  --bs-btn-active-border-color: #c2410c;
  font-weight: 600;
}

.form-head-meta {
  display: grid;
  justify-items: end;
  gap: 0.25rem;
  text-align: right;
}

.form-head-meta__line {
  margin: 0;
  color: var(--app-muted);
  font-size: 0.875rem;
}

/* Cancel and submit stay in view at the bottom of the window. */
/* A rounded panel like the cards: on a short page it sits under them, on a
   long one it stays a little above the window's bottom (the user chose a
   panel over a strip with only a top line, 2026-10-06). */
.form-actions {
  position: sticky;
  bottom: 0.75rem;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding: 0.875rem 1.25rem;
  border: 1px solid var(--app-card-border);
  border-radius: var(--app-card-radius);
  background-color: var(--app-surface);
  box-shadow: 0 6px 16px -8px rgb(15 23 42 / 25%);
}

/* A form of one card: the buttons are that card's foot, not a bar across the
   page under a half-width card (the user, 2026-10-06: 「你这样的排版都敢交货」). */
.form-actions--attached {
  /* Not sticky; drawn above the card so the card's shadow does not fall
     across it, with the card's lift and its upward part clipped: card and
     foot read as one box. */
  position: relative;
  bottom: auto;
  z-index: 1;
  margin-top: 0;
  padding: 0.875rem 1.25rem;
  border: 1px solid var(--app-card-border);
  border-top: 0;
  border-radius: 0 0 var(--app-card-radius) var(--app-card-radius);
  box-shadow: var(--app-card-shadow);
  clip-path: inset(0 -1.5rem -1.5rem -1.5rem);
}

form:has(> .form-actions--attached) .form-card {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

@media (min-width: 1200px) {
  /* One column of .form-cards: the card's own width. */
  .form-actions--attached {
    max-width: calc((100% - 1.25rem) / 2);
  }
}

/* A form with a side column (the user, 2026-10-06, on the project form): its
   main cards take six tenths; the right four tenths hold the page's tip and
   the cards with few fields, one field per row (6/4 at the user's word,
   after seeing 2/3). Below 1200px everything is one column, the tip first. */
.form-layout {
  display: grid;
  gap: 1.25rem;
  align-items: start;
}

.form-layout__main,
.form-layout__side {
  display: contents;
}

.form-layout__side > .form-tip {
  order: -1;
}

/* After a first card beside the tip, the other cards two by two, each row
   level (the user, 2026-10-06, on the company form). */
.form-cards--rows {
  align-items: stretch;
}

/* A card left alone on the last row takes the whole row (the user,
   2026-10-06, on the partner form: 「直接一行过」). */
.form-cards--rows > .form-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

/* The payment plan or the invoice lines after the two columns. */
.form-layout ~ .form-cards {
  margin-top: 1.25rem;
}

@media (min-width: 1200px) {
  .form-layout {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }

  .form-layout__main,
  .form-layout__side {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
  }

  .form-layout__side > .form-tip {
    order: 0;
  }

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

  /* The other rows at the first row's 6:4, lined up under it (the user,
     2026-10-06, bank account form). */
  .form-cards--rows-6-4 {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }

  /* The two columns end level (the user, 2026-10-06: card 1 and card 2
     ended at different heights): both stretch to the taller one, and the
     last card of each grows to fill its column. */
  .form-layout {
    align-items: stretch;
  }

  .form-layout .form-cards--stack {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1.25rem;
    flex: 1 1 auto;
  }

  .form-layout .form-cards--stack > .form-card:last-child {
    flex: 1 1 auto;
  }

  /* A one-card form with only the tip on the right: the tip grows instead. */
  .form-layout__side > .form-tip:last-child {
    flex: 1 1 auto;
  }
}

/* A one-card form with a tip beside it (the user, 2026-10-06: 「右边有个用户
   提示，然后现有的框延展」): the card takes six tenths, the tip four
   tenths (6/4, the user, after seeing 2/3); below 1200px the tip comes
   first, to be read before filling in. */
.form-with-tip {
  display: grid;
  gap: 1.25rem;
  align-items: start;
}

.form-with-tip__main {
  min-width: 0;
}

/* Help-text size, as Bootstrap's .form-text: a tip is read once, beside the
   fields, and should not stand taller than the card it serves. */
.form-tip {
  font-size: 0.875rem;
  padding: 1.25rem;
  border: 1px solid #bfdbfe;
  border-radius: var(--app-card-radius);
  background-color: #eff6ff;
  box-shadow: var(--app-card-shadow);
  color: var(--app-text);
}

.form-tip__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.form-tip__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  color: #1e40af;
  background-color: #dbeafe;
}

.form-tip__title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
}

.form-tip__subtitle {
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.form-tip__steps {
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.form-tip__step {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.375rem 0;
  color: var(--app-muted);
}

.form-tip__number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #1e40af;
  background-color: #dbeafe;
}

.form-tip__step.is-current {
  color: var(--app-text);
  font-weight: 600;
}

.form-tip__step.is-current .form-tip__number {
  color: #fff;
  background-color: var(--app-primary);
}

.form-tip__now {
  margin-left: 0.25rem;
  padding: 0.0625rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #1e40af;
  background-color: #dbeafe;
}

.form-tip__notes {
  margin: 0;
  padding-left: 1.125rem;
}

.form-tip__note + .form-tip__note {
  margin-top: 0.5rem;
}

@media (min-width: 1200px) {
  .form-with-tip {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }

  .form-with-tip > .form-tip {
    grid-column: 2;
    grid-row: 1;
  }

  .form-with-tip > .form-with-tip__main {
    grid-column: 1;
    grid-row: 1;
  }

  /* The one card fills its column instead of half of it. */
  .form-with-tip .form-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  /* The card and the tip stand equally tall (the user, 2026-10-06): both
     columns stretch to the taller one, and the card grows inside its column
     so its foot ends level with the tip. */
  .form-with-tip {
    align-items: stretch;
  }

  .form-with-tip > .form-with-tip__main {
    display: flex;
    flex-direction: column;
  }

  .form-with-tip__main > form:has(.form-cards) {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
  }

  .form-with-tip__main .form-cards {
    flex: 1 1 auto;
    align-items: stretch;
  }

  .form-with-tip .form-actions--attached {
    max-width: none;
  }
}

@media (max-width: 575.98px) {
  .form-actions {
    flex-wrap: wrap;
  }

  .form-actions > * {
    flex: 1 1 0;
  }

  /* A way back to an earlier step takes its own row above Cancel and submit. */
  .form-actions > .me-auto {
    flex-basis: 100%;
  }
}

/* An icon inside the left edge of an email or web-address input. */
.input-icon {
  position: relative;
  display: block;
}

.input-icon > .icon {
  position: absolute;
  top: 50%;
  left: 0.875rem;
  color: var(--app-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.input-icon > .form-control {
  padding-left: 2.5rem;
}

.char-count {
  margin-top: 0.25rem;
  color: var(--app-muted);
  font-size: 0.8125rem;
  text-align: right;
}
