/* =====================================================================
   Finance Core - stylesheet
   A ledger, not a dashboard. Ink on paper, ruled lines, figures that
   line up in a column. One signal colour, used sparingly.
   ===================================================================== */

:root {
  --paper:        #FCFCFA;
  --paper-sunk:   #F4F4F0;
  --ink:          #16191D;
  --ink-soft:     #3D454F;
  --muted:        #6B7480;
  --rule:         #E3E5E1;
  --rule-strong:  #C9CDC7;
  --signal:       #0E5B49;
  --signal-soft:  #E7F0ED;
  --amber:        #A9661A;
  --amber-soft:   #FBF2E4;
  --red:          #9B3025;
  --red-soft:     #FBEDEB;

  --f-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
            "Helvetica Neue", Arial, "Noto Sans Arabic", sans-serif;

  --step--1: 0.8125rem;
  --step-0:  0.9375rem;
  --step-1:  1.0625rem;
  --step-2:  1.375rem;
  --step-3:  1.875rem;

  --gap:   1rem;
  --gap-2: 1.5rem;
  --gap-3: 2.5rem;
}

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

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

body {
  margin: 0;
  font-family: var(--f-sans);
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
}

h1, h2, h3 { margin: 0 0 0.5em; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p  { margin: 0 0 1em; }
a  { color: var(--signal); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* Every amount in this system lines up in its column. In Arabic the
   page runs the other way, so "end" is used rather than "right": the
   figures stay on the outside edge either way. */
.num, td.num, .amount {
  font-variant-numeric: tabular-nums;
  text-align: end;
  white-space: nowrap;
}

/* ---------------------------------------------------------------------
   SIGN IN  -  the one place we spend any boldness
   A ruled ledger page on the left, a quiet form on the right.
   --------------------------------------------------------------------- */

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.auth__ledger {
  background: var(--ink);
  color: var(--paper);
  padding: var(--gap-3);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

/* The ruled lines. Fine, evenly spaced, like an accounts book. */
.auth__ledger::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0 31px,
    rgba(252, 252, 250, 0.09) 31px 32px
  );
  pointer-events: none;
}

.auth__mark {
  position: relative;
  z-index: 1;
  font-size: var(--step-2);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.auth__mark span { color: var(--signal); }

.auth__statement { position: relative; z-index: 1; max-width: 34ch; }
.auth__statement h1 { font-size: var(--step-3); margin-bottom: 0.4em; }
.auth__statement p  { color: rgba(252, 252, 250, 0.68); margin: 0; }

.auth__foot {
  position: relative;
  z-index: 1;
  font-size: var(--step--1);
  color: rgba(252, 252, 250, 0.45);
}

.auth__panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gap-3) var(--gap-2);
}

.auth__form { width: 100%; max-width: 23rem; }
.auth__form h2 { margin-bottom: 0.25em; }
.auth__form .lede { color: var(--muted); margin-bottom: var(--gap-2); }

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth__ledger { padding: var(--gap-2); gap: var(--gap-2); min-height: 34vh; }
  .auth__statement h1 { font-size: var(--step-2); }
}

/* ---------------------------------------------------------------------
   FORMS
   --------------------------------------------------------------------- */

.field { margin-bottom: var(--gap); }

.field label {
  display: block;
  font-size: var(--step--1);
  color: var(--ink-soft);
  margin-bottom: 0.35rem;
  font-weight: 500;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="email"],
.field input[type="date"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  transition: border-color 120ms ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--signal);
  outline: 2px solid var(--signal-soft);
  outline-offset: 0;
}

.field .hint { font-size: var(--step--1); color: var(--muted); margin-top: 0.3rem; }
.field--split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }

@media (max-width: 560px) { .field--split { grid-template-columns: 1fr; } }

.btn {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  font: inherit;
  font-weight: 500;
  color: #fff;
  background: var(--signal);
  border: 1px solid var(--signal);
  border-radius: 3px;
  cursor: pointer;
  transition: background 120ms ease;
}
.btn:hover { background: #0B4A3B; text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--block { display: block; width: 100%; }
.btn--quiet {
  color: var(--ink-soft);
  background: transparent;
  border-color: var(--rule-strong);
}
.btn--quiet:hover { background: var(--paper-sunk); }

/* ---------------------------------------------------------------------
   APP SHELL
   --------------------------------------------------------------------- */

.shell { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  background: var(--ink);
  color: rgba(252, 252, 250, 0.82);
  padding: var(--gap-2) 0;
  display: flex;
  flex-direction: column;
}

.sidebar__mark {
  padding: 0 var(--gap-2) var(--gap-2);
  font-size: var(--step-1);
  font-weight: 600;
  color: var(--paper);
  letter-spacing: -0.02em;
}
.sidebar__mark span { color: var(--signal); }

.sidebar nav a {
  display: block;
  padding: 0.5rem var(--gap-2);
  color: rgba(252, 252, 250, 0.78);
  font-size: var(--step-0);
  border-inline-start: 2px solid transparent;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.05); text-decoration: none; }
.sidebar nav a[aria-current="page"] {
  color: #fff;
  background: rgba(255,255,255,0.07);
  border-inline-start-color: var(--signal);
}
.sidebar__group {
  padding: var(--gap) var(--gap-2) 0.3rem;
  font-size: var(--step--1);
  color: rgba(252,252,250,0.4);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: 0.7rem var(--gap-2);
  background: #fff;
  border-bottom: 1px solid var(--rule);
}
.topbar form { display: inline-flex; gap: 0.4rem; align-items: center; margin: 0; }
.topbar select {
  font: inherit;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  background: #fff;
}
.topbar__user { font-size: var(--step--1); color: var(--muted); }

main { padding: var(--gap-2); max-width: 76rem; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; overflow-x: auto; padding: 0; align-items: center; }
  .sidebar__mark { padding: 0.7rem var(--gap); }
  .sidebar__group { display: none; }
  .sidebar nav { display: flex; }
  .sidebar nav a { white-space: nowrap; border-inline-start: 0; border-bottom: 2px solid transparent; }
  .sidebar nav a[aria-current="page"] { border-bottom-color: var(--signal); }
  main { padding: var(--gap); }
}

/* ---------------------------------------------------------------------
   MESSAGES
   --------------------------------------------------------------------- */

.msg {
  padding: 0.7rem 0.9rem;
  border-radius: 3px;
  margin-bottom: var(--gap);
  font-size: var(--step-0);
  border-inline-start: 3px solid;
}
.msg--success { background: var(--signal-soft); border-color: var(--signal); color: #0B4A3B; }
.msg--error   { background: var(--red-soft);    border-color: var(--red);    color: var(--red); }
.msg--warning { background: var(--amber-soft);  border-color: var(--amber);  color: var(--amber); }

/* ---------------------------------------------------------------------
   SETUP CHECKLIST  -  a real sequence, so it is numbered
   --------------------------------------------------------------------- */

.checklist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }

.checklist li {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr) auto;
  gap: var(--gap);
  align-items: baseline;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
}
.checklist .step-no { color: var(--muted); font-size: var(--step--1); }
.checklist .step-label { font-weight: 500; }
.step-note { color: var(--muted); font-size: var(--step--1); display: block;
             font-weight: 400; margin-top: .15rem; }
.checklist li[data-done="1"] .step-label { color: var(--muted); font-weight: 400; }
.checklist li[data-done="1"] .step-no { color: var(--signal); }

.progress { color: var(--muted); font-size: var(--step--1); margin-bottom: var(--gap-2); }

/* ---------------------------------------------------------------------
   TABLES
   --------------------------------------------------------------------- */

table.data { width: 100%; border-collapse: collapse; font-size: var(--step-0); }
table.data th, table.data td { padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--rule); text-align: start; }
table.data th { font-weight: 600; font-size: var(--step--1); color: var(--ink-soft); background: var(--paper-sunk); }
table.data tbody tr:hover { background: var(--paper-sunk); }
table.data tfoot td { font-weight: 600; border-top: 2px solid var(--rule-strong); }

.card {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: var(--gap-2);
  margin-bottom: var(--gap-2);
}

.page-head { margin-bottom: var(--gap-2); }
.page-head p { color: var(--muted); margin: 0; }

/* ---------------------------------------------------------------------
   ARABIC / RTL
   --------------------------------------------------------------------- */

[dir="rtl"] body { font-family: "Noto Sans Arabic", var(--f-sans); }
/* Amounts read left to right even on an Arabic page: 1,250.500 is not
   reversed, and an accountant expects the decimal point where it always
   is. The column itself sits on the outside edge. */
[dir="rtl"] .num, [dir="rtl"] td.num, [dir="rtl"] .amount { direction: ltr; text-align: left; }
[dir="rtl"] input[type="date"], [dir="rtl"] input[inputmode="decimal"] { direction: ltr; text-align: start; }

/* A few places set a physical side inline. On an Arabic page they have
   to follow the text, not the screen. */
[dir="rtl"] .totals th { text-align: start; }
[dir="rtl"] .page-head, [dir="rtl"] .card, [dir="rtl"] .data { text-align: start; }

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


/* ---- printing -------------------------------------------------------
   Statements and reports get printed and posted to customers. The
   chrome goes, the figures stay. */
@media print {
  .sidebar, .topbar, .noprint, .btn, form.noprint { display: none !important; }
  .layout, .content { display: block; margin: 0; padding: 0; max-width: none; }
  .card { border: none; box-shadow: none; padding: 0; margin-bottom: 1rem;
          break-inside: avoid; }
  body { background: #fff; font-size: 11pt; }
  table.data { page-break-inside: auto; }
  table.data tr { page-break-inside: avoid; page-break-after: auto; }
  table.data thead { display: table-header-group; }
  a { text-decoration: none; color: inherit; }
}


/* ---- copyable values ------------------------------------------------
   A secret, a UUID, a hash. Long, exact, and nobody should have to
   select it by hand. */
.copyable {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  background: var(--paper-sunk);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: .6rem .7rem;
  margin: .5rem 0;
}
.copyable code {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--step--1);
  word-break: break-all;
  line-height: 1.5;
}
.copyable button {
  flex: 0 0 auto;
  font: inherit;
  font-size: var(--step--1);
  padding: .25rem .7rem;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.copyable button:hover { border-color: var(--signal); color: var(--signal); }

@media print { .copyable button { display: none; } }


/* ---------------------------------------------------------------------
   DASHBOARD TILES
   A few figures, large enough to read across a desk.
   --------------------------------------------------------------------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap-2);
}

.tile {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1rem 1.1rem;
}

.tile__label {
  color: var(--muted);
  font-size: var(--step--1);
  margin-bottom: .35rem;
}

.tile__figure {
  font-size: var(--step-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  margin-bottom: .6rem;
}

.tile__line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: var(--step--1);
  color: var(--muted);
  padding: .2rem 0;
  border-top: 1px solid var(--rule);
}
.tile__line:first-of-type { border-top: none; }
.tile__line .num { font-variant-numeric: tabular-nums; color: var(--ink); }

/* ---------------------------------------------------------------------
   SEARCH
   --------------------------------------------------------------------- */

.topbar__left {
  display: flex;
  align-items: center;
  gap: var(--gap);
  flex: 1;
  min-width: 0;
}

.search { position: relative; flex: 1; max-width: 26rem; }

.search input {
  width: 100%;
  font: inherit;
  font-size: var(--step--1);
  padding: .4rem .7rem;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  background: var(--paper);
  color: var(--ink);
}
.search input:focus {
  outline: none;
  border-color: var(--signal);
  box-shadow: 0 0 0 3px rgba(14, 91, 73, 0.09);
}

.search__results {
  position: absolute;
  inset-inline-start: 0;
  inset-inline-end: 0;
  top: calc(100% + .3rem);
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(22, 25, 29, 0.10);
  max-height: 70vh;
  overflow-y: auto;
  z-index: 60;
}

.search__group {
  padding: .45rem .7rem .2rem;
  font-size: var(--step--2);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  background: var(--paper-sunk);
}

.search__results a {
  display: block;
  padding: .5rem .7rem;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: var(--ink);
}
.search__results a:last-child { border-bottom: none; }
.search__results a:hover,
.search__results a:focus {
  background: var(--paper-sunk);
  outline: none;
}

.search__note {
  display: block;
  font-size: var(--step--1);
  color: var(--muted);
  margin-top: .1rem;
}

.search__none { padding: .7rem; color: var(--muted); font-size: var(--step--1); }

/* ---------------------------------------------------------------------
   NARROW SCREENS
   A phone in a warehouse, a tablet at a counter.
   --------------------------------------------------------------------- */

@media (max-width: 60rem) {
  .shell { grid-template-columns: 1fr; }

  .sidebar {
    position: static;
    height: auto;
    display: flex;
    flex-wrap: wrap;
    gap: .2rem .8rem;
    padding: .7rem 1rem;
  }
  .sidebar__mark { width: 100%; margin-bottom: .4rem; }
  .sidebar__group { display: none; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: .2rem .9rem; }
  .sidebar nav a { padding: .25rem 0; border: none; }

  .topbar { flex-wrap: wrap; gap: .5rem; }
  .search { max-width: none; }

  .content { padding: 1rem; }

  /* A wide table on a narrow screen scrolls rather than squashes. */
  .card > table.data,
  table.data { display: block; overflow-x: auto; white-space: nowrap; }

  .field--split { grid-template-columns: 1fr; }
}


/* ---------------------------------------------------------------------
   STATUS
   Readable across a desk, and readable by someone who cannot easily
   tell red from green. The word carries the meaning; the colour only
   helps you find it faster.
   --------------------------------------------------------------------- */

.pill {
  display: inline-block;
  font-size: var(--step--1);
  font-weight: 500;
  padding: .12rem .55rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.pill--paid    { background: #E7F1EC; color: #17704A; border-color: #C4E0D3; }
.pill--unpaid  { background: #FDF3DC; color: #8A6410; border-color: #EFDFB4; }
.pill--part    { background: #FDF3DC; color: #8A6410; border-color: #EFDFB4; }
.pill--overdue { background: #FBE9E9; color: #A32A2A; border-color: #F0CFCF; }
.pill--draft   { background: var(--paper-sunk); color: var(--muted); border-color: var(--rule); }
.pill--void    { background: var(--paper-sunk); color: var(--muted); border-color: var(--rule);
                 text-decoration: line-through; }

/* A whole row tinted, so a page of invoices reads at a glance. */
tr[data-state="overdue"] { background: #FDF6F6; }
tr[data-state="overdue"] td:first-child { box-shadow: inset 3px 0 0 #A32A2A; }
tr[data-state="unpaid"]  td:first-child,
tr[data-state="part"]    td:first-child { box-shadow: inset 3px 0 0 #C9A43F; }
tr[data-state="paid"]    td:first-child { box-shadow: inset 3px 0 0 #17704A; }
tr[data-state="draft"]   { color: var(--muted); }
tr[data-state="void"]    { color: var(--muted); }

@media print {
  tr[data-state] { background: transparent; }
  tr[data-state] td:first-child { box-shadow: none; }
  .pill { border-color: var(--rule-strong); }
}


/* ---------------------------------------------------------------------
   ACTION BAR
   The row above a document: back, send, print. What someone reaches for
   the moment the document is on screen.
   --------------------------------------------------------------------- */

.actionbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--gap);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: .9rem 1rem;
  margin-bottom: var(--gap-2);
}

.actionbar__title h1 { margin: 0; font-size: var(--step-1); }
.actionbar__title p  { margin: .15rem 0 0; color: var(--muted);
                       font-size: var(--step--1); }

.actionbar__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
}

.btn--off { opacity: .45; cursor: not-allowed; }

/* WhatsApp keeps its own colour, because people look for it. */
.btn--wa {
  background: #25D366;
  border-color: #1FB855;
  color: #08331A;
  font-weight: 600;
}
.btn--wa:hover { background: #1FB855; color: #062814; }

@media print { .actionbar { display: none; } }


/* ---------------------------------------------------------------------
   WHO YOU ARE
   Which account is signed in, visible without thinking about it.
   --------------------------------------------------------------------- */

.tier {
  display: inline-block;
  font-size: var(--step--2);
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .1rem .45rem;
  border-radius: 3px;
  margin-inline-start: .4rem;
  vertical-align: middle;
}

.tier--super_admin { background: #4A2E6B; color: #fff; }
.tier--admin       { background: #0E5B49; color: #fff; }
.tier--staff       { background: #E3E5E1; color: #3A4048; }
.tier--portal      { background: #E3E5E1; color: #3A4048; }

@media print { .tier { display: none; } }


/* ---------------------------------------------------------------------
   WHICH ACCOUNT IS SIGNED IN
   A strip across the top, not a small badge. Somebody about to reset
   another person's password should not have to look for it.
   --------------------------------------------------------------------- */

.tierbar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .7rem;
  padding: .4rem 1.2rem;
  font-size: var(--step--1);
  line-height: 1.5;
}

.tierbar strong {
  text-transform: uppercase;
  letter-spacing: .07em;
  font-size: var(--step--2);
  font-weight: 700;
}

.tierbar__who { margin-inline-start: auto; opacity: .85; }

/* Purple, used nowhere else in the system, so it reads as "not normal". */
.tierbar--super { background: #4A2E6B; color: #fff; }
.tierbar--admin { background: var(--paper-sunk); color: var(--muted);
                  border-bottom: 1px solid var(--rule); }

@media print { .tierbar { display: none; } }

@media (max-width: 60rem) {
  .tierbar span:not(.tierbar__who) { display: none; }
  .tierbar__who { margin-inline-start: auto; }
}


/* ---------------------------------------------------------------------
   PICKER
   A scrolling list of choices with a filter above it. Works at three
   branches and still works at thirty.
   --------------------------------------------------------------------- */

.picker {
  max-height: 16rem;
  overflow-y: auto;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  background: var(--paper);
}

.picker__row {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .4rem .7rem;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
}
.picker__row:last-of-type { border-bottom: none; }
.picker__row:hover { background: var(--paper-sunk); }
.picker__row input { margin: 0; }

.picker__none { padding: .7rem; color: var(--muted); font-size: var(--step--1); }


/* ---------------------------------------------------------------------
   DOCS
   The API guide, shown on screen. Long prose needs a narrower measure
   than a table does, or it is tiring to read.
   --------------------------------------------------------------------- */

.docs { max-width: 58rem; }
.docs h2 { margin: 1.6rem 0 .6rem; }
.docs h3 { margin: 1.2rem 0 .4rem; }
.docs p  { margin: .5rem 0; }
.docs li { margin: .2rem 0; }
.docs hr { border: none; border-top: 1px solid var(--rule); margin: 1.4rem 0; }
.docs code { background: var(--paper-sunk); padding: .05rem .25rem; border-radius: 3px; }
.docs__code {
  background: var(--paper-sunk);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: .7rem .9rem;
  overflow-x: auto;
  font-size: var(--step--1);
}
.docs__code code { background: none; padding: 0; }
.docs table { margin: .8rem 0; }


/* ---------------------------------------------------------------------
   SETTING UP
   The strip at the top of every screen while a set of books is still
   being built, the verdict block on the setup screens, and the dialog
   shown once on the first invoice of a session.

   All three say the same thing at different volumes, and none of them
   stops anybody working.
   --------------------------------------------------------------------- */

.readiness {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  align-items: center;
  justify-content: space-between;
  padding: .6rem .9rem;
  margin-bottom: var(--gap-2);
  border: 1px solid var(--rule);
  border-inline-start: 3px solid var(--rule-strong);
  border-radius: 4px;
  background: var(--paper-sunk);
  font-size: var(--step--1);
}
.readiness--not_ready { background: var(--amber-soft); border-color: #EBD9BC;
                        border-inline-start-color: var(--amber); }
.readiness--usable    { background: var(--paper-sunk);
                        border-inline-start-color: var(--rule-strong); }

.readiness__text    { min-width: 0; }
.readiness__next    { display: block; color: var(--ink-soft); margin-top: .15rem; }
.readiness__actions { display: flex; gap: .4rem; align-items: center; flex: 0 0 auto; }
.readiness__actions form { margin: 0; }
.readiness .btn { padding: .25rem .6rem; }

.verdict {
  border: 1px solid var(--rule);
  border-inline-start: 3px solid var(--signal);
  border-radius: 4px;
  background: var(--signal-soft);
  padding: .9rem 1.1rem;
  margin-bottom: var(--gap-2);
}
.verdict--not_ready { background: var(--amber-soft); border-color: #EBD9BC;
                      border-inline-start-color: var(--amber); }
.verdict--usable    { background: var(--paper-sunk);
                      border-inline-start-color: var(--rule-strong); }

.verdict p                { margin: 0; }
.verdict__headline        { font-weight: 600; font-size: var(--step-1); }
.verdict__counts,
.verdict__next            { color: var(--ink-soft); font-size: var(--step--1); margin-top: .3rem; }

/* Where a step stands. Same three words everywhere they appear. */
.pill--done    { background: #E7F1EC; color: #17704A; border-color: #C4E0D3; }
.pill--partial { background: var(--amber-soft); color: var(--amber); border-color: #EBD9BC; }
.pill--todo    { background: var(--paper-sunk); color: var(--muted); border-color: var(--rule); }

.checklist li[data-state="partial"] .step-no { color: var(--amber); }

.ready-dialog {
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  padding: 1.2rem 1.4rem;
  max-width: 34rem;
  width: calc(100% - 2rem);
  background: #fff;
  color: var(--ink);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .12);
}
.ready-dialog::backdrop      { background: rgba(22, 25, 29, .35); }
.ready-dialog h2             { font-size: var(--step-1); margin-bottom: .4rem; }
.ready-dialog p              { font-size: var(--step--1); }
.ready-dialog__list          { list-style: none; margin: .8rem 0; padding: 0;
                               border-top: 1px solid var(--rule); }
.ready-dialog__list li       { display: grid; grid-template-columns: .9rem 1fr auto;
                               gap: .6rem; align-items: baseline; padding: .55rem 0;
                               border-bottom: 1px solid var(--rule); }
.ready-dialog__actions       { display: flex; gap: .5rem; flex-wrap: wrap; }

.mark            { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; }
.mark--done      { background: var(--signal); }
.mark--partial   { background: var(--amber); }
.mark--todo      { background: var(--rule-strong); }

/* A module switch. The word beside it says which way it is set, so it
   does not rely on the shape of a checkbox alone. */
.switch                { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; }
.switch input          { width: 1.05rem; height: 1.05rem; accent-color: var(--signal); }
.switch span           { font-size: var(--step--1); color: var(--ink-soft); }

@media print {
  .readiness, .ready-dialog { display: none; }
}


/* ---------------------------------------------------------------------
   WHAT IS MISSING FROM A DOCUMENT
   Shown beside the invoice while it can still be put right. A warning,
   never a block, so it is quieter than an error and louder than a hint.
   --------------------------------------------------------------------- */

.gaps {
  border: 1px solid #EBD9BC;
  border-inline-start: 3px solid var(--amber);
  border-radius: 4px;
  background: var(--amber-soft);
  padding: .75rem 1rem;
  margin-top: var(--gap);
  margin-bottom: var(--gap);
  font-size: var(--step--1);
}
.gaps[hidden]     { display: none; }
.gaps__head       { font-weight: 600; margin: 0 0 .4rem; color: var(--amber); }
.gaps__list       { list-style: none; margin: 0 0 .4rem; padding: 0; }
.gaps__list li    { padding: .35rem 0; border-top: 1px solid #EBD9BC; }
.gaps__list li:first-child { border-top: none; }
.gaps .hint       { margin: 0; }

@media print { .gaps { display: none; } }

/* ---------------------------------------------------------------
   Whose books a setup screen is changing.
   One engine, many clients: the screen says which one.
   --------------------------------------------------------------- */
.whose__line {
  margin: 0 0 .75rem;
  font-weight: 600;
}
.whose__facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .35rem 1.25rem;
  margin: 0;
}
.whose__facts dt {
  color: var(--muted, #667);
  font-size: .875rem;
  white-space: nowrap;
}
.whose__facts dd {
  margin: 0;
}
.whose__facts dd .step-note {
  margin-inline-start: .5rem;
}
@media (max-width: 40rem) {
  .whose__facts { grid-template-columns: 1fr; gap: 0 0; }
  .whose__facts dd { margin-bottom: .6rem; }
}

/* ---------------------------------------------------------------
   Code pickers. The HS list runs to fourteen thousand entries, so
   the person searches rather than scrolls.
   --------------------------------------------------------------- */
.field input[type="search"] {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  background: var(--surface);
  color: var(--ink);
}
.field input[type="search"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.chosen {
  padding: 0.5rem 0.7rem;
  margin-bottom: 0.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2, #fafafa);
  font-size: var(--step--1);
}
.chosen strong { font-variant-numeric: tabular-nums; margin-inline-end: 0.5rem; }
.chosen em { color: var(--muted); }

.picker-results {
  list-style: none;
  margin: 0.3rem 0 0;
  padding: 0;
  max-height: 16rem;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.picker-results li {
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  font-size: var(--step--1);
  border-bottom: 1px solid var(--line);
}
.picker-results li:last-child { border-bottom: 0; }
.picker-results li:hover { background: var(--accent-soft, #eef3ff); }
.picker-results strong { font-variant-numeric: tabular-nums; margin-inline-end: 0.5rem; }
