/* Binary Books — app UI. Signature indigo sidebar, calm light pages, flat colour only (no gradients, ever). */

:root {
  /* ink and greys */
  --ink: #10132b;
  --ink-2: #3d4257;
  --muted: #646b80;
  --muted-2: #5b6275;
  --faint: #9aa0b2;
  --line: #e4e6ec;      /* cards */
  --line-2: #d5d8e1;    /* buttons */
  --line-3: #eef0f4;    /* rows and inner rules */
  --field: #e1e3ea;     /* fields and filters */
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fafbfc; /* table heads, card footers */
  --fill: #f1f2f5;
  --fill-2: #eceef2;
  /* brand */
  --indigo: #23245c;        /* the primary action */
  --indigo-hover: #1a1b4a;
  --indigo-deep: #121335;   /* the sidebar */
  --indigo-ink: #23245c;
  --indigo-soft: #eeeef8;
  --indigo-tint: #f4f4fb;
  --ring: #e3e4f6;
  --violet: #6f5fd8;
  --cyan: #4cc9e6;
  --cyan-ink: #0b6f86;      /* links */
  --link: var(--cyan-ink);
  --cyan-hover: #08566a;
  --cyan-soft: #e6f6fa;
  /* status: text on tint */
  --green: #0f6b47; --green-soft: #e6f4ee;
  --amber: #8a5300; --amber-soft: #fdf1dc;
  --red: #b42318; --red-soft: #fdecea; --red-line: #f4c7c3;
  --blue: #2e4bc6; --blue-soft: #edf0fd;
  --grey: #3d4257; --grey-soft: #f1f2f5;
  /* the sidebar */
  --side-bg: #121335; --side-card: #1b1d47; --side-card-hover: #212356; --side-line: #26285c; --side-hover: #1c1e4c;
  --side-active: #262862; --side-text: #c5c7e6; --side-muted: #9a9dc4; --side-title: #8c8fb8; --side-rule: #24265a;
  --side-avatar: #2a2c66;
  /* dark surfaces: the save bar, toasts */
  --night: #10132b; --night-line: #3a3f66;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 19, 43, .04);
  --shadow-md: 0 12px 32px rgba(16, 19, 43, .16);
  --shadow-lg: 0 24px 64px rgba(16, 19, 43, .28);
  --display: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --heading: "Inter Tight", Inter, system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --arabic: "IBM Plex Sans Arabic", "Geeza Pro", sans-serif;
  --sidebar: 240px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 var(--display); -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11" 1; /* Inter's single-storey a reads calmer */
}
body.no-scroll { overflow: hidden; }
a { color: var(--cyan-ink); text-decoration: none; }
a:hover { color: var(--cyan-hover); }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
/* figures and document numbers: Inter with even-width digits, so columns line up */
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
/* real codes only: keys, web addresses, number formats */
.code { font-family: var(--mono); font-size: .93em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pre { white-space: pre-line; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.tnum { font-variant-numeric: tabular-nums; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: 14px; }
.clip { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.danger-text, .btn.danger-text { color: var(--red); }
.icon { flex: none; }
[hidden] { display: none !important; }
/* a plain-English line beside a finance word */
.explain { font-size: 13px; line-height: 1.5; color: var(--muted-2); }
.term { border-bottom: 1px dotted var(--faint); cursor: help; }

/* ---------- form controls ---------- */
input, select, textarea {
  font: 400 14px/1.4 var(--display); color: var(--ink); background: var(--surface);
  border: 1px solid var(--field); border-radius: var(--radius-sm);
  padding: 8px 12px; min-height: 38px; width: 100%; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--indigo); }
textarea { resize: vertical; line-height: 1.5; padding: 9px 12px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover:not(:disabled):not(:focus), select:hover:not(:disabled):not(:focus), textarea:hover:not(:disabled):not(:focus) { border-color: var(--line-2); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px var(--ring);
}
input:disabled, select:disabled, textarea:disabled { background-color: var(--surface-2); color: var(--ink-2); }
/* the browser's own arrow sits flush against the border: draw one with room around it */
select {
  -webkit-appearance: none; appearance: none; cursor: pointer; text-overflow: ellipsis;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23646b80' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 8px;
}
select:disabled { cursor: default; opacity: .75; }
select[multiple], select[size] { padding-right: 11px; background-image: none; }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input.num { text-align: right; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
/* a field changed since it was saved */
.is-changed input, .is-changed textarea, .is-changed select, input.is-changed, textarea.is-changed, select.is-changed {
  border-color: var(--indigo); box-shadow: 0 0 0 3px var(--ring);
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field__label em { font-style: normal; color: var(--red); }
.field__hint { font-size: 13px; line-height: 1.45; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.field__hint.ok { color: var(--green); }
.inline-field { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.inline-field input { width: auto; }
.form-error { color: var(--red); font-size: 13px; font-weight: 500; margin-right: auto; }

.grid-1, .grid-2, .grid-3, .grid-5 { display: grid; gap: 14px 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 13.5px/1 var(--display); height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
  color: var(--ink); background: var(--surface);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, .icon-btn:focus-visible, .chip:focus-visible, .link-btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--ring); }
.btn--primary { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--indigo-hover); border-color: var(--indigo-hover); color: #fff; }
.btn--ghost { border-color: var(--line-2); color: var(--ink); background: var(--surface); }
.btn--ghost:hover:not(:disabled) { border-color: var(--faint); background: var(--surface-2); color: var(--ink); }
/* starting something that can't be undone: red outline; the final "Yes, delete": filled red */
.btn--danger-ghost { border-color: var(--red-line); color: var(--red); background: var(--surface); }
.btn--danger-ghost:hover:not(:disabled) { background: var(--red-soft); color: var(--red); }
.btn--danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn--danger:hover:not(:disabled) { background: #96190f; border-color: #96190f; color: #fff; }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn--lg { height: 46px; padding: 0 18px; font-size: 15px; border-radius: 9px; }
.btn--block { width: 100%; justify-content: flex-start; }
.btn--block .icon:last-child:not(:first-child) { margin-left: auto; }
.signin .btn--block { justify-content: center; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm);
  border: 0; background: transparent; color: var(--muted); cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--fill); color: var(--ink); }
.icon-btn.danger { color: var(--red); }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); }
/* an icon button with a border, beside other buttons */
.icon-btn--box { width: 36px; height: 36px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); }
.link-btn {
  display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 0;
  font: 600 13px var(--display); color: var(--cyan-ink); cursor: pointer;
}
.link-btn:hover { color: var(--cyan-hover); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px;
  font: 500 13px var(--display); padding: 0 11px; border-radius: 99px;
  border: 1px solid var(--field); background: var(--surface); color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.chip:hover:not(:disabled) { border-color: var(--line-2); color: var(--ink); }
.chip.is-on { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.chip__n { font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.is-on .chip__n { color: #c9cbea; }
.chip--alert:not(.is-on) { border-color: var(--red-line); background: var(--surface); color: var(--red); }
.chip--alert:not(.is-on) .chip__n { color: var(--red); }
.due { white-space: nowrap; font-size: 13.5px; color: var(--ink-2); }
.due--late { color: var(--red); font-weight: 600; }
.due--paid { color: var(--green); font-weight: 600; }
.due--zero { color: var(--amber); font-weight: 600; }
.bal--done { color: var(--muted); }
.bal--late { color: var(--red); font-weight: 600; }

/* status pill: a dot and a word */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px;
  font: 600 12.5px/1 var(--display); white-space: nowrap; vertical-align: middle;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge--grey { background: var(--grey-soft); color: var(--grey); }
.badge--blue { background: var(--blue-soft); color: var(--blue); }
.badge--green { background: var(--green-soft); color: var(--green); }
.badge--amber { background: var(--amber-soft); color: var(--amber); }
.badge--red { background: var(--red-soft); color: var(--red); }
.badge--indigo { background: var(--indigo-soft); color: var(--indigo); }
/* a small square tag: R2, Advance, Template */
.tag {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px;
  font: 600 12px/1 var(--display); white-space: nowrap; background: var(--indigo-soft); color: var(--indigo);
}
.tag--green { background: var(--green-soft); color: var(--green); }
.tag--amber { background: var(--amber-soft); color: var(--amber); }
.tag--grey { background: var(--grey-soft); color: var(--grey); }
.tag--blue { background: var(--blue-soft); color: var(--blue); }

/* ---------- shell ---------- */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40;
  display: flex; flex-direction: column; gap: 8px; padding: 14px 12px 10px;
  background: var(--side-bg); color: var(--side-text); overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--side-line) transparent;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 4px; color: #fff; }
.brand:hover { color: #fff; }
.brand img { border-radius: 8px; display: block; flex: none; }
.brand__type { display: flex; flex-direction: column; line-height: 1.1; }
.brand__type strong { font: 700 13px/1.1 var(--heading); letter-spacing: .16em; }
.brand__type span { font: 500 9.5px var(--display); letter-spacing: .34em; color: var(--side-muted); margin-top: 3px; }
.brand--dark { color: var(--indigo); }
.brand--dark:hover { color: var(--indigo); }
.brand--dark .brand__type span { color: var(--muted); }
.brand--sm { padding: 0; }
.brand--sm .brand__type strong { font-size: 12px; }
.brand--sm .brand__type span { font-size: 8.5px; }

/* the firm being worked in, and switching to another */
.firm { position: relative; }
.firm__btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: 10px; font: inherit; text-align: left;
  background: var(--side-card); border: 1px solid var(--side-line); color: #fff; cursor: pointer;
}
.firm__btn:hover { background: var(--side-card-hover); }
.firm__btn.is-static { cursor: default; }
.firm__btn .icon { color: var(--side-muted); margin-left: auto; flex: none; }
.firm__name { display: block; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.firm__sub { display: block; font-size: 12px; color: var(--side-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.firm__logo {
  width: 28px; height: 28px; border-radius: 7px; flex: none; display: grid; place-items: center;
  background: #fff; color: var(--indigo-deep); font: 700 13px var(--heading);
}
.firm__menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 5; padding: 6px; border-radius: 12px;
  background: #fff; color: var(--ink); box-shadow: 0 14px 36px rgba(10, 12, 40, .4);
}
.rail-toggle { display: none; place-items: center; flex: none; height: 30px; border: 1px solid var(--side-line); border-radius: 8px; background: none;
  color: var(--side-muted); cursor: pointer; }
.rail-toggle:hover { color: #fff; background: var(--side-hover); }
body.rail-open .rail-toggle { justify-self: end; width: 30px; }
.rail-tip {
  position: fixed; z-index: 70; transform: translateY(-50%); pointer-events: none; white-space: nowrap;
  padding: 6px 10px; border-radius: 7px; background: var(--night); color: #fff; font: 500 13px var(--display);
  box-shadow: 0 6px 18px rgba(16, 19, 43, .25); animation: fade .1s ease;
}
.firm__menu--side { position: fixed; right: auto; width: 260px; z-index: 60; }
.firm__title { font: 600 11px var(--display); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 6px 8px 4px; }
.firm__item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 8px; background: none;
  font: inherit; font-size: 13.5px; color: var(--ink); text-align: left; cursor: pointer;
}
.firm__item:hover { background: var(--indigo-tint); }
.firm__item.is-on { font-weight: 600; background: var(--indigo-tint); }
.firm__item.is-on .icon { color: var(--indigo); margin-left: auto; }
.firm__item .firm__logo { width: 26px; height: 26px; background: var(--indigo-deep); color: #fff; }
.firm__add { color: var(--indigo); font-weight: 600; border-top: 1px solid var(--line-3); border-radius: 0 0 8px 8px; margin-top: 4px; padding-top: 10px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
/* a group's title row: its name, Choose pages (on hover), and More / Less */
.nav-group__head { display: flex; align-items: center; gap: 4px; min-height: 22px; padding: 8px 4px 0 8px; }
.nav-group__title { flex: 1; min-width: 0; font: 600 11px var(--display); text-transform: uppercase; letter-spacing: .08em; color: var(--side-title); }
.nav-group__toggle { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; cursor: pointer; text-align: left; }
.nav-group__toggle:hover { color: #fff; }
.nav-group__toggle .icon { opacity: .8; }
.nav-choose { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--side-muted);
  cursor: pointer; opacity: 0; transition: opacity .12s ease; }
.nav-group__head:hover .nav-choose, .nav-choose:focus-visible { opacity: 1; }
.nav-choose:hover { background: var(--side-hover); color: #fff; }
.nav-more { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 6px; border: 0; border-radius: 6px; background: none;
  color: var(--side-muted); font: 500 12.5px var(--display); cursor: pointer; }
.nav-more:hover { background: var(--side-hover); color: #fff; }
.nav-pill { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 6px; border-radius: 9px; font: 600 11.5px var(--display);
  font-style: normal; font-variant-numeric: tabular-nums; background: rgba(255, 255, 255, .10); color: var(--side-text); }
.nav-pill--warn { background: rgba(242, 184, 75, .16); color: #F2B84B; }
.nav-more .nav-pill { margin-left: 2px; }
.nav-rule { border: 0; border-top: 1px solid rgba(255, 255, 255, .08); margin: 6px 8px; }
.nav-group--end { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--side-rule); }
/* a page's row: the link, and its pin (shown on hover, or always when pinned and hovered) */
.nav-row { position: relative; }
.nav-pin { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 22px; height: 22px; padding: 0;
  border: 0; border-radius: 6px; background: var(--side-bg); color: var(--side-muted); cursor: pointer; opacity: 0; transition: opacity .12s ease; }
.nav-row:hover .nav-pin, .nav-pin:focus-visible { opacity: 1; }
.nav-pin:hover { color: #fff; background: var(--side-card-hover); }
.nav-row.is-pinned .nav-pin .icon { fill: currentColor; }
.nav-row:hover .nav-link__n { visibility: hidden; }
.nav-link {
  display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 30px 0 8px; border-radius: 8px;
  color: var(--side-text); font: 500 13.5px var(--display);
}
.nav-link:hover { background: var(--side-hover); color: #fff; }
.nav-link.is-active { background: var(--side-active); color: #fff; font-weight: 600; box-shadow: inset 2px 0 0 var(--cyan); }
.nav-link.is-active .icon { color: var(--cyan); }
.nav-link__n { margin-left: auto; margin-right: -22px; display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 6px; border-radius: 9px;
  font: 600 11.5px var(--display); font-style: normal; font-variant-numeric: tabular-nums; background: rgba(255, 255, 255, .10); color: var(--side-text); }
.nav-link.is-active .nav-link__n { color: var(--side-muted); }
/* search, under the firm card */
.side-search { flex: none; display: flex; align-items: center; gap: 9px; width: 100%; height: 36px; padding: 0 7px 0 10px; border-radius: 9px; cursor: pointer;
  background: var(--side-card); border: 1px solid var(--side-line); color: var(--side-muted); font: 500 13.5px var(--display); text-align: left; }
.side-search:hover { background: var(--side-card-hover); color: #fff; }
.side-search:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
.side-search span { flex: 1; }
.side-search kbd { font: 600 11px var(--display); letter-spacing: .02em; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--side-line);
  background: var(--side-bg); color: var(--side-muted); box-shadow: none; }
kbd { font: 500 11.5px var(--display); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-2); background: var(--surface); color: var(--muted-2); }
/* ⌘K: search and jump */
.finder-layer { position: fixed; inset: 0; z-index: 150; display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px;
  background: rgba(16, 19, 43, .42); animation: fade .12s ease; }
.finder { width: min(640px, 100%); max-height: 72vh; display: flex; flex-direction: column; overflow: hidden; border-radius: 14px;
  background: var(--surface); box-shadow: 0 24px 60px rgba(16, 19, 43, .3); animation: pop .16s ease; }
.finder__bar { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.finder__bar input { flex: 1; height: 54px; border: 0 !important; box-shadow: none !important; background: none; padding: 0; font-size: 16px; color: var(--ink); }
.finder__list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.finder__group { padding: 10px 10px 4px; font: 600 11.5px var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.finder__row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.finder__row.is-at { background: var(--indigo-tint); }
.finder__ic { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--fill); color: var(--ink-2); }
.finder__row.is-at .finder__ic { background: var(--indigo); color: #fff; }
.finder__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.finder__main b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.finder__main span { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.finder__amt { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.finder__note { padding: 14px 10px; font-size: 13.5px; color: var(--muted); }
.finder__foot { display: flex; gap: 18px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--line-3); background: var(--surface-2); font-size: 12.5px; color: var(--muted); }
.finder__foot kbd { margin-right: 3px; }
/* the bell, at the start of the top bar */
.bell { position: relative; }
.bell__btn { position: relative; }
.bell__n { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center; border-radius: 99px;
  background: var(--red); color: #fff; font: 700 11px var(--display); border: 2px solid var(--surface); }
.bell__menu { width: min(380px, 92vw); padding: 0; right: 0; left: auto; }
.bell__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line-3); }
.bell__head b { font-size: 14px; }
.bell__list { list-style: none; margin: 0; padding: 4px; max-height: 60vh; overflow-y: auto; }
.bell__list a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--ink); }
.bell__list a:hover { background: var(--surface-2); }
.bell__list .needs__main b { white-space: normal; }
.bell__foot { display: block; padding: 10px 14px; border-top: 1px solid var(--line-3); font-size: 13px; font-weight: 500; text-align: center; }
.sidebar__foot { position: relative; margin-top: auto; padding-top: 6px; border-top: 1px solid var(--side-rule); }
.sidebar__user {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border: 0; border-radius: 10px; background: none;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.sidebar__user:hover, .sidebar__user[aria-expanded="true"] { background: var(--side-hover); }
.sidebar__user.is-here { box-shadow: inset 2px 0 0 var(--cyan); }
.sidebar__user > .icon { color: var(--side-muted); flex: none; }
.sidebar__user .grow { min-width: 0; }
.user-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 5; padding: 6px; border-radius: 12px; background: #fff; color: var(--ink);
  box-shadow: 0 14px 36px rgba(10, 12, 40, .4); animation: pop .12s ease; }
.user-menu a, .user-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none;
  font: 500 13.5px var(--display); color: var(--ink); text-align: left; cursor: pointer; }
.user-menu a:hover, .user-menu button:hover, .user-menu a.is-on { background: var(--indigo-tint); }
.user-menu .icon { color: var(--muted); }
.user-menu hr { border: 0; border-top: 1px solid var(--line-3); margin: 4px 6px; }
.user-menu__out, .user-menu__out .icon { color: var(--red) !important; }
/* Choose pages: a group's pages, each shown in front or under More */
.choose-pages { position: fixed; z-index: 60; width: 330px; padding: 14px; border-radius: 12px; background: #fff; color: var(--ink); border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(16, 19, 43, .18); animation: pop .12s ease; }
.choose-pages b { font: 600 14px var(--display); }
.choose-pages p { margin: 2px 0 8px; font-size: 13px; color: var(--muted); }
.choose-pages ul { list-style: none; margin: 0; padding: 0; }
.choose-pages li { display: flex; align-items: center; gap: 10px; height: 40px; font-size: 13.5px; }
.choose-pages li > span:first-of-type { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.choose-pages li .icon { color: var(--muted); }
.choose-pages__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line-3); }
.seg--sm { padding: 2px; }
.seg--sm button { height: 26px; padding: 0 9px; font-size: 12.5px; }
.sidebar__user strong { display: block; color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user .small { color: var(--side-muted); font-size: 12px; }
.sidebar__user .icon-btn { color: var(--side-muted); }
.sidebar__user .icon-btn:hover { background: var(--side-hover); color: #fff; }
.avatar {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: var(--side-avatar); color: #fff; font: 600 12px var(--display);
}

.main { margin-left: var(--sidebar); min-width: 0; overflow-x: clip; }
.topbar { display: none; }
.scrim { display: none; }

.page { max-width: 1240px; margin: 0 auto; padding: 28px 32px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font: 600 26px/1.2 var(--heading); letter-spacing: -.02em; }
.page-head__sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.back-link:hover { color: var(--ink); }
/* the bar along the top of a page: where you are, and its actions (the main one last) */
.page-top {
  position: sticky; top: 0; z-index: 25; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  min-height: 60px; margin: -28px -32px 24px; padding: 10px 32px; background: var(--surface);
}
/* the white and its line run the full width behind the bar (the page clips the sides, so it doesn't widen); menus that
   open from the bar drop below it freely */
.page-top::before { content: ""; position: absolute; z-index: -1; top: 0; bottom: 0; left: -100vmax; right: -100vmax;
  background: var(--surface); border-bottom: 1px solid var(--line); pointer-events: none; }
.page-top .crumb { flex: 1 1 260px; min-width: min(260px, 100%); margin: 0; }
.crumb > a, .crumb > b, .crumb > span { white-space: nowrap; }
.page-top .page-head__actions { flex-wrap: wrap; justify-content: flex-end; }
.page-top .page-head__actions { margin-left: auto; }
.page-top + .page-head { margin-bottom: 20px; }
.crumb { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.crumb > span[aria-hidden] { color: var(--faint); }
.crumb__back { display: inline-grid; place-items: center; width: 32px; height: 32px; margin-left: -8px; border-radius: 8px; color: var(--ink-2); }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--ink); }
.crumb b { color: var(--ink); font-weight: 600; }
.section-title { font: 600 15px var(--display); margin: 28px 0 12px; }

/* ---------- cards, tables ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.pad { padding: 18px 20px; }
.card-title {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px;
  font: 600 14px var(--display); color: var(--ink);
}
.card-title a, .card-title .link-btn { font-size: 13px; font-weight: 500; }
.card__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 20px;
  border-top: 1px solid var(--line-3); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); font-size: 13px; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 10px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
/* a list in one card: tabs (with how many and how much), search and Open in, the table, what it adds up to */
.lcard { overflow: hidden; }
.ltabs { display: flex; align-items: stretch; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.ltabs::-webkit-scrollbar { display: none; }
.ltab { display: inline-flex; align-items: center; gap: 8px; padding: 14px 10px 12px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; font: 500 13.5px var(--display); color: var(--ink-2); white-space: nowrap; cursor: pointer; }
.ltab:hover { color: var(--ink); }
.ltab.is-on { color: var(--ink); font-weight: 600; border-bottom-color: var(--indigo); }
.ltab__n { font: 500 12.5px var(--display); color: var(--muted); font-variant-numeric: tabular-nums; }
.ltab--late, .ltab--late .ltab__n { color: var(--red); }
.ltab--late .ltab__n { font-weight: 600; }
.ltabs__rule { width: 1px; margin: 12px 8px; background: var(--line); flex: none; }
.ltools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.ltools .search { max-width: 440px; }
.ltools .open-in { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.lcard__body { padding: 20px; }
.ltools__note { margin-left: auto; max-width: 420px; line-height: 1.45; }
.lcard .table th { background: var(--surface); }
.lcard .table td { padding-top: 12px; padding-bottom: 12px; }
.table-wrap--bare .table thead th { border-radius: 0; }
.lcard__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 13px 20px;
  border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.lcard__foot b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.lcard__foot b.danger-text { color: var(--red); }
.lcard .load-more { padding: 0 0 16px; }
.warn-text { color: var(--amber); }
.table td.strong { font-weight: 600; color: var(--ink); }
.table tr.is-dim td { color: var(--muted); }
.table tr.is-dim td.strong { color: var(--muted); }
.search { position: relative; flex: 1 1 280px; max-width: 420px; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 34px; min-height: 36px; font-size: 13.5px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font: 500 12.5px var(--display); white-space: nowrap;
  color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.table thead th:first-child { border-top-left-radius: var(--radius); }
.table thead th:last-child { border-top-right-radius: var(--radius); }
.table th.num { text-align: right; }
.table td { padding: 11px 16px; border-bottom: 1px solid var(--line-3); vertical-align: middle; }
.table td.num { font-weight: 600; }
.table td.num.muted { font-weight: 400; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot th { border-top: 1px solid var(--line); border-bottom: 0; color: var(--ink); font-size: 13.5px; font-weight: 600; background: var(--surface-2); }
/* a person or a customer in a table: initials, name, a second line */
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who__ini { width: 28px; height: 28px; border-radius: 7px; background: var(--fill); color: var(--ink-2); display: grid; place-items: center; font: 600 12px var(--display); flex: none; }
.who__ini--round { border-radius: 50%; }
.who__text { min-width: 0; }
.who__text b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who__sub { display: block; font-size: 13px; color: var(--muted); }
.who__sub.clip { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who__text small { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* files attached to a document, customer or supplier; files can be dropped on the card */
.files.is-over { outline: 2px dashed var(--cyan); outline-offset: -6px; background: var(--cyan-soft); }
.files__empty { margin: 4px 0 0; }
.files__list { list-style: none; margin: 8px 0 0; padding: 0; }
.files__list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.files__thumb { flex: none; width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line);
  display: grid; place-items: center; overflow: hidden; text-decoration: none; }
.files__thumb img { width: 100%; height: 100%; object-fit: cover; }
.files__ext { font: 700 10px/1 var(--mono); text-transform: uppercase; color: var(--indigo-ink); }
.files__main { flex: 1; min-width: 0; }
.files__name { display: block; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Delivery & invoicing: per item, its name (two lines at most) and a short bar each for delivered and invoiced */
.fulfil__of { margin: -2px 0 6px; }
.fulfil { list-style: none; margin: 0; padding: 0; }
.fulfil li { padding: 10px 0; border-top: 1px solid var(--line); display: grid; gap: 5px; }
.fulfil li:first-child { border-top: 0; padding-top: 4px; }
.fulfil__name { font-weight: 600; font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fulfil__bar { display: grid; grid-template-columns: 66px minmax(40px, 1fr) auto; align-items: center; gap: 8px; font-size: 12.5px; }
.fulfil__label { color: var(--muted); }
.fulfil__track { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.fulfil__track i { display: block; height: 100%; background: var(--cyan); }
.fulfil__bar.is-done .fulfil__track i { background: var(--green); }
.fulfil__bar.is-over .fulfil__track i { background: var(--amber); }
.fulfil__bar.is-over .fulfil__n { color: var(--amber); }
.fulfil__n { white-space: nowrap; text-align: right; }
.fulfil__note { padding-left: 74px; margin-top: -3px; }
.btn--wrap { white-space: normal; text-align: left; line-height: 1.3; }

/* an on/off switch */
.switch { flex: none; width: 38px; height: 22px; border-radius: 11px; border: 0; padding: 0; background: var(--line-2); position: relative; cursor: pointer;
  transition: background .15s ease; }
/* on is the brand's indigo, not green: green means money in */
.switch span { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(21, 22, 58, .25);
  transition: transform .15s ease; }
.switch.is-on { background: var(--indigo); }
.switch.is-on span { transform: translateX(16px); }
.switch:disabled { opacity: .55; cursor: default; }
.switch:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--ring); }

/* Integrations: a catalogue of tiles (search, category filters), each opening its settings panel */
.integ-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.integ-bar .search { flex: 1 1 240px; max-width: 360px; }
.integ-sum { margin: -4px 0 14px; }
.integ-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 14px; align-items: start; margin-top: 6px; }
.integ-group { min-width: 0; }
.integ-group.span-2 { grid-column: span 2; } .integ-group.span-3 { grid-column: span 3; }
.integ-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.integ-group.span-2 .integ-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.integ-group.span-3 .integ-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.integ-cat { font: 600 14px var(--display); color: var(--ink); margin: 0 0 10px; }
.integ-grid > .tile { height: 100%; }
@media (max-width: 1240px) {
  .integ-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .integ-group.span-3 { grid-column: span 2; }
  .integ-group.span-3 .integ-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .integ-groups { grid-template-columns: minmax(0, 1fr); }
  .integ-group.span-2, .integ-group.span-3 { grid-column: auto; }
  .integ-group .integ-grid { grid-template-columns: minmax(0, 1fr) !important; }
}
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tile__head { display: flex; align-items: flex-start; gap: 12px; }
.tile__icon { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: #fff; }
.meter-bar { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; margin-top: 12px; }
.meter-bar i { display: block; height: 100%; background: var(--cyan-ink); border-radius: 6px; }
.meter-bar.is-warn i { background: var(--amber); }
.tile__icon--logo { background: var(--surface); border: 1px solid var(--line); }
.tile__icon.is-violet { background: var(--violet); } .tile__icon.is-indigo { background: var(--indigo-ink); }
.tile__icon.is-cyan { background: var(--cyan-ink); } .tile__icon.is-green { background: var(--green); } .tile__icon.is-blue { background: var(--blue); }
.tile__title { flex: 1; min-width: 0; }
.tile__title strong { display: block; font: 600 15px var(--display); }
.tile__title span { font-size: 13px; color: var(--muted); }
.tile__blurb { margin: 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile__foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line-3); font-size: 13px; }
.tile__state { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px; font-weight: 600; font-size: 12.5px; background: var(--grey-soft); }
.tile__state.is-active { background: var(--green-soft); } .tile__state.is-setup { background: var(--amber-soft); }
.tile__state::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tile__state.is-active { color: var(--green); } .tile__state.is-off { color: var(--muted); } .tile__state.is-setup { color: var(--amber); }
.tile__detail { color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-sec { padding: 14px 0; border-top: 1px solid var(--line); }
.panel-sec:first-child { border-top: 0; padding-top: 0; }
.panel-sec h3 { font: 600 14px var(--display); margin: 0 0 8px; }
.panel-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.key-chip { font: 600 13px var(--mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; color: var(--ink); }
.copy-field { display: flex; gap: 8px; }
.copy-field input { flex: 1; font-family: var(--mono); }

/* reading a scanned invoice; what to check on a draft read by AI; the Integrations page */
/* invoice scans: a panel in the corner while they're read in the background */
.scan-tray { position: fixed; z-index: 42; right: 18px; bottom: 18px; width: min(360px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .2s ease; }
.scan-tray__head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 14px; background: var(--indigo-deep); color: #fff; border: 0; font: inherit; text-align: left; cursor: pointer; }
.scan-tray__head .muted { color: #b9bbe0; }
.scan-tray__list { list-style: none; margin: 0; padding: 4px 0; max-height: min(320px, 50vh); overflow-y: auto; }
.scan-tray__foot { display: flex; justify-content: flex-end; padding: 6px 14px 10px; border-top: 1px solid var(--line); }
.scan-job { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.scan-job + .scan-job { border-top: 1px solid var(--line); }
.scan-job__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.scan-job__main strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan-job__mark { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--green-soft); color: var(--green); }
.scan-job.is-failed .scan-job__mark { background: var(--red-soft); color: var(--red); }
.scan-job.is-done { animation: scan-done .5s ease; }
.scan-job__bar { position: relative; height: 3px; margin-top: 5px; border-radius: 3px; background: var(--cyan-soft); overflow: hidden; }
.scan-job__bar i { position: absolute; top: 0; bottom: 0; left: 0; width: 35%; border-radius: 3px; background: var(--cyan); animation: scan-bar 1.6s ease-in-out infinite; }
/* a page with lines of text and a beam passing over it */
.scan-doc { flex: none; position: relative; width: 24px; height: 30px; border: 2px solid var(--indigo-ink); border-radius: 4px; background: var(--surface); overflow: hidden; }
.scan-doc::before { content: ""; position: absolute; left: 4px; top: 5px; width: 12px; height: 2px; border-radius: 1px; background: var(--line-2); box-shadow: 0 5px 0 var(--line-2), 0 10px 0 var(--line-2), 0 15px 0 var(--line-2); }
.scan-doc i { position: absolute; left: -2px; right: -2px; top: 0; height: 2px; background: var(--cyan); box-shadow: 0 0 0 1px var(--cyan-soft); animation: scan-beam 1.4s ease-in-out infinite alternate; }
.scan-doc--sm { width: 16px; height: 20px; border-color: #fff; background: transparent; }
.scan-doc--sm::before { left: 3px; top: 4px; width: 7px; height: 1.5px; background: #8a8cc0; box-shadow: 0 4px 0 #8a8cc0, 0 8px 0 #8a8cc0; }
@keyframes scan-beam { from { transform: translateY(1px); } to { transform: translateY(24px); } }
.scan-doc--sm i { animation-name: scan-beam-sm; }
@keyframes scan-beam-sm { from { transform: translateY(1px); } to { transform: translateY(15px); } }
@keyframes scan-bar { 0% { transform: translateX(-100%); } 100% { transform: translateX(290%); } }
@keyframes scan-done { 0% { background: var(--green-soft); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) {
  .scan-doc i { animation: none; top: 45%; }
  .scan-job__bar i { animation: none; width: 100%; opacity: .5; }
  .scan-job.is-done, .scan-tray { animation: none; }
}
@media (max-width: 760px) {
  .scan-tray { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  body:has(.action-bar) .scan-tray { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .scan-tray:not(.is-open) { width: auto; }
  .menu-open .scan-tray { display: none; }
}
.scan-notice { border-left: 3px solid var(--amber); }
.scan-notice__list { margin: 8px 0 0; padding-left: 18px; font-size: 13.5px; }
.scan-notice__list li { margin: 3px 0; }
.integ .card-title { gap: 8px; }
.integ__setup { background: var(--amber-soft); border-radius: var(--radius-sm); padding: 10px 12px; margin: 8px 0 12px; }
.integ__setup ol { margin: 6px 0 0; padding-left: 18px; }
.integ__setup li { margin: 3px 0; }
.integ__limit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px; }
.integ__limit input { width: 90px; }
.stats--row { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 8px; }
.stats--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* a cheque's state and its next steps, under a payment line */
.cheque-tag { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-top: 6px; }
.cheque-tag.has-acts { margin-top: 8px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.cheque-tag__state, .cheque-tag__acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.cheque-act { --tone: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 99px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font: 600 12px var(--display); cursor: pointer;
  transition: border-color .15s, color .15s; }
.cheque-act::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tone); }
.cheque-act:hover, .cheque-act:focus-visible { border-color: var(--tone); color: var(--tone); }
.cheque-act.is-blue { --tone: var(--blue); } .cheque-act.is-green { --tone: var(--green); } .cheque-act.is-red { --tone: var(--red); }

/* a small table inside a side card */
.table--tight th, .table--tight td { padding: 7px 6px; }
.table--tight th:first-child, .table--tight td:first-child { padding-left: 0; }
.table--tight th:last-child, .table--tight td:last-child { padding-right: 0; }
.table--tight th { background: none; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.row-actions { white-space: nowrap; text-align: right; width: 1%; }
.row-actions .icon-btn { opacity: .55; }
tr:hover .row-actions .icon-btn { opacity: 1; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 44px 24px;
  border: 1.5px dashed var(--line-2); border-radius: var(--radius); background: var(--surface-2); }
.empty__bits { font: 600 12px var(--mono); letter-spacing: .4em; margin-right: -.4em; color: var(--cyan-ink); }
.empty h3 { font: 600 17px var(--heading); letter-spacing: -.01em; margin-top: 2px; }
.empty p { color: var(--muted-2); margin: 0 0 8px; max-width: 380px; font-size: 13.5px; line-height: 1.5; }
.error-box { background: var(--red-soft); color: var(--red); border: 1px solid var(--red-line); padding: 14px 16px; border-radius: var(--radius); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13.5px; }

.spinner {
  width: 28px; height: 28px; margin: 60px auto; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--indigo); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot, .boot-error { min-height: 100vh; display: grid; place-items: center; }
.boot-error { grid-auto-flow: row; align-content: center; gap: 12px; padding: 16px; text-align: center; color: var(--ink-2); }

/* shown while the device has no internet: across the top of the page (beside the sidebar), at the bottom on phones */
.offline-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 35; padding: 10px 20px; text-align: center; font-size: 13.5px;
  background: var(--night); color: #fff;
}
.offline-bar strong { font-weight: 700; }
.offline-bar { animation: bar-in .2s ease-out backwards; }
.offline-bar.is-leaving { animation: bar-out .16s ease-in forwards; }
@keyframes bar-in { from { transform: translateY(var(--bar-from, -100%)); } }
@keyframes bar-out { to { transform: translateY(var(--bar-from, -100%)); opacity: 0; } }
.shell + .offline-bar { left: var(--sidebar); }
body.is-offline .main { padding-top: 38px; }

.load-more { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 16px 0 4px; }

/* ---------- dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stats--stack { grid-template-columns: 1fr; margin: 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stat > span { font: 500 13px var(--display); color: var(--muted-2); }
.stat strong { font: 600 24px/1.1 var(--heading); letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.stat em { font-size: 13px; color: var(--muted); }
.stat em { font-style: normal; }
.stat em a { color: inherit; text-decoration: underline; text-decoration-color: transparent; }
.stat em a:hover { text-decoration-color: currentColor; }
.stat__cur { font: 500 13px var(--display); letter-spacing: 0; margin-right: 4px; color: var(--muted); }
.stat--accent .stat__cur { color: var(--side-muted); }
.stat--accent .stat__late { color: #ffb4ac; font-weight: 600; }
.stat--accent { background: var(--indigo-deep); border-color: var(--indigo-deep); color: #fff; }
.stat--accent > span, .stat--accent em { color: var(--side-muted); }

.dash-figures { margin-bottom: 16px; }
.dash-figures > div { padding: 18px 22px; gap: 6px; }
.dash-figures b { font-size: 24px; letter-spacing: -.02em; }
.dash-figures em { font-style: normal; font-size: 13px; line-height: 1.45; color: var(--muted); }
.dash-figures em a { color: var(--link); }
.dash-figures .stat__cur { margin-right: 4px; }
.dash-late { color: var(--red) !important; font-weight: 600; }
.dash-callout { margin-bottom: 16px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.dash-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.dash-card { display: flex; flex-direction: column; gap: 18px; }
.dash-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dash-card__head h2 { font: 600 15px var(--display); }
.dash-card__head p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.dash-card__head a, .dash-card__head .muted { font-size: 13px; white-space: nowrap; }
/* who owes you: one bar split by how late, and the figure for each part */
.age-bar { display: flex; gap: 2px; height: 12px; border-radius: 99px; overflow: hidden; background: var(--fill); }
.age-bar span { min-width: 4px; }
.age--0 { background: var(--green); } .age--1 { background: #c27a0e; } .age--2 { background: #d4570f; }
.age--3 { background: var(--red); } .age--4 { background: #7a1a12; }
.age-keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 12px; }
.age-keys > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.age-keys span { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted-2); }
.age-keys i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.age-keys b { font: 600 15px var(--display); text-align: left; }
.age-keys .is-zero b { color: var(--muted); font-weight: 500; }
/* needs you today */
.needs { position: sticky; top: 84px; overflow: hidden; }
.needs__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line-3); }
.needs__head h2 { font: 600 15px var(--display); }
.needs ul { list-style: none; margin: 0; padding: 0; }
.needs li + li { border-top: 1px solid var(--line-3); }
.needs a { display: flex; align-items: center; gap: 12px; padding: 13px 20px; color: var(--ink); }
.needs a:hover { background: var(--surface-2); color: var(--ink); }
.needs__icon { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 8px; }
.needs__icon--red { background: var(--red-soft); color: var(--red); }
.needs__icon--amber { background: var(--amber-soft); color: var(--amber); }
.needs__icon--blue { background: var(--blue-soft); color: var(--blue); }
.needs__icon--grey { background: var(--fill); color: var(--ink-2); }
.needs__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.needs__main b { font-size: 13.5px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.needs__main span { font-size: 13px; line-height: 1.4; color: var(--muted); }
.needs__amt { font: 600 13.5px var(--display); white-space: nowrap; }
.needs__none { display: flex; align-items: center; gap: 8px; margin: 0; padding: 18px 20px; font-size: 13.5px; color: var(--muted); }
.needs__none .icon { color: var(--green); }
.dash-recent .dash-card__head { padding: 18px 20px 6px; }
.dash-recent .table-wrap { border: 0; box-shadow: none; border-radius: 0; }
.dash-recent .strong { font-weight: 600; color: var(--ink); }
/* a new company's first steps */
.starters { max-width: 880px; }
.starters h2 { font: 600 18px var(--heading); }
.starters > p { margin: 4px 0 12px; font-size: 13.5px; }
.starters ol { list-style: none; margin: 0; padding: 0; }
.starters li { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line-3); }
.starters li:first-child { border-top: 0; }
.starters__n { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--fill); font: 600 13px var(--display); color: var(--ink-2); }
.starters li .grow { display: flex; flex-direction: column; gap: 3px; }
.starters li b { font-size: 14.5px; font-weight: 600; }
.starters li .grow > span { font-size: 13px; color: var(--muted); }
.starters .btn { flex: none; }

.chart { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 6px; }
.chart__col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.chart__bar { width: 100%; max-width: 28px; border-radius: 4px 4px 0 0; background: var(--indigo); }
.chart__col:last-child .chart__bar { background: var(--cyan); }
.chart__lbl { font-size: 12px; color: var(--muted); }


/* ---------- detail page ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 9px 16px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 500; font-size: 13.5px; }
.kv dd { margin: 0; }

/* ---------- document editor ---------- */
.editor-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.editor-bottom { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 16px; margin-top: 16px; align-items: start; }

.lines { --cols: 34px minmax(220px, 1fr) 76px 80px 110px 74px 70px 120px 100px; }

.lines__head, .lines__row { display: grid; grid-template-columns: var(--cols); gap: 8px; align-items: start; padding: 0 14px; }
.lines__head.lines--plain, .lines__row.lines--plain { grid-template-columns: 34px minmax(220px, 1fr) 80px 80px minmax(150px, 220px) 100px; }
.lines__section {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line);
  background: var(--indigo-tint); color: var(--indigo);
}
.lines__section input { font-weight: 600; color: var(--indigo); background: #fff; }
.lines__heading { flex: 1; min-width: 0; }
.lines__section .icon-btn { color: var(--indigo); }
.page-note { max-width: 760px; margin: -6px 0 16px; line-height: 1.55; }
.page-note .icon { vertical-align: -2px; }
.tpl-tag { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 5px; background: var(--green-soft);
  color: var(--green); font-size: 12px; font-weight: 600; vertical-align: 1px; }
.lines__serial textarea { min-height: 38px; field-sizing: content; max-height: 200px; font-size: 13px; }
.lines__head {
  font: 500 12.5px var(--display); color: var(--muted);
  padding-top: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); background: var(--surface-2);
  border-radius: var(--radius) var(--radius) 0 0;
}
.lines__row { padding-top: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.lines__row input, .lines__row textarea { padding: 8px 9px; }
.lines__no { padding-top: 9px; color: var(--muted); font-size: 13px; }
.lines__amt { padding-top: 9px; font-weight: 600; }
.lines__tools { display: flex; gap: 0; justify-content: flex-end; padding-top: 2px; }
.lines__tools .icon-btn { width: 28px; height: 30px; }
.lines__desc textarea { min-height: 38px; field-sizing: content; max-height: 220px; }
.lines__foot { display: flex; align-items: center; gap: 14px; padding: 12px 14px; flex-wrap: wrap; }

.combo { position: relative; }
.combo__list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 5px;
  list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-md); max-height: 300px; overflow-y: auto;
}
.combo__list li { padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 14px; }
.combo__list li.is-active { background: var(--indigo-tint); }
.combo__row { display: flex; justify-content: space-between; gap: 12px; }

.totals-card .tot-input { width: 140px; }
.tot-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 14px; }
.tot-disc { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; }
.tot-disc .link-btn { font-size: inherit; }
.tot-row--round { flex-wrap: wrap; background: var(--surface-2); border: 1px solid var(--line-3); margin: 2px -10px; padding: 6px 10px; border-radius: var(--radius-sm); font-size: 13.5px; color: var(--ink-2); }
.tot-row--round label { white-space: nowrap; }
.tot-row--round .tot-target { margin-left: auto; }
.tot-target { display: flex; gap: 6px; align-items: center; }
.tot-target input { width: 108px; }
.tot-row--grand { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; font: 600 18px var(--heading); }
.sticky-save {
  position: sticky; bottom: 0; z-index: 20; display: flex; justify-content: flex-end; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 18px -12px 0; padding: 12px; background: var(--bg); border-top: 1px solid var(--line-2);
}
/* the running total, always in view while editing */
.sticky-save__sum { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-right: auto; font-size: 13px; color: var(--muted); }
.sticky-save__sum .mono { color: var(--ink); }
.sticky-save__total { font-size: 15px; font-weight: 700; color: var(--ink); }

/* ---------- document view ---------- */
.view-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.paper-scroll { overflow-x: auto; padding-bottom: 6px; }
/* the printed page on a grey stage */
.paper-stage { padding: 24px; border-radius: var(--radius); background: #e9ebf0; min-width: 0; }
.view-grid > * { min-width: 0; }
.paper-stage .paper { box-shadow: 0 1px 3px rgba(16, 19, 43, .12), 0 6px 18px rgba(16, 19, 43, .06); }
.view-side { display: flex; flex-direction: column; gap: 14px; }
/* its cards keep their height: the column scrolls, they don't get squeezed (Compact's folds would be cut off) */
.view-side > * { flex-shrink: 0; }
/* beside the page on a wide screen the column scrolls on its own, so the document stays in view */
@media (min-width: 1101px) {
  .view-side { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow-y: auto; overscroll-behavior: contain;
    padding-right: 4px; margin-right: -4px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
}
.view-side > .card.pad { padding: 16px 18px; box-shadow: none; }
/* a document's dates and total, right of its heading */
.doc-facts { display: flex; gap: 28px; margin: 0; }
.doc-facts div { display: flex; flex-direction: column; gap: 2px; }
.doc-facts dt { font-size: 13px; color: var(--muted); }
.doc-facts dd { margin: 0; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.page--view .page-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page--view .page-head__sub b { color: var(--ink); font-weight: 600; }
.page--view > .desktop-only > .jsteps { margin-bottom: 20px; }
.sc__eyebrow { font-size: 13px; color: var(--muted); }
.sc--money { gap: 14px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 8px; vertical-align: 1px; }
.dot--green { background: var(--green); } .dot--amber { background: #e9b44c; }
.kvs__total span, .kvs__total b { color: var(--ink) !important; font-weight: 600; }
/* payments as a timeline: a dot for each, coloured by whether it counts yet */
.pay-list--line { margin: 0; }
.pay-list.pay-list--line li { position: relative; align-items: flex-start; padding: 10px 0 10px 20px; }
.pay-list.pay-list--line li:first-child { border-top: 0; padding-top: 2px; }
.pay-list--line li::before { content: ""; position: absolute; left: 2px; top: 16px; width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.pay-list--line li:first-child::before { top: 8px; }
.pay-list--line li.is-amber::before { background: #e9b44c; } .pay-list--line li.is-red::before { background: var(--red); }
/* the More card: the rarer actions, each with what it does */
.more-list { list-style: none; margin: 0 -6px; padding: 0; }
.more-list button { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 9px 6px; border: 0; border-radius: 8px; background: none;
  font: inherit; font-size: 13.5px; color: var(--ink); text-align: left; cursor: pointer; }
.more-list button:hover:not(:disabled) { background: var(--surface-2); }
.more-list button > .icon { margin-top: 1px; color: var(--ink-2); flex: none; }
.more-list button > .icon:last-child { color: var(--muted); }
.more-list small { display: block; margin-top: 2px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.more-list .is-danger, .more-list .is-danger > .icon { color: var(--red); }
.confirm-inline { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 10px; background: var(--red-soft); border: 1px solid #f5c9c4; font-size: 13px; }
.confirm-inline b { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.confirm-inline span { color: var(--ink-2); line-height: 1.45; }
.confirm-inline div { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.pay-list, .rel-list, .user-list { list-style: none; margin: 10px 0 0; padding: 0; }
.pay-list li, .user-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-3); }
.user-list li { justify-content: flex-start; }
.user-list { margin: 0 0 12px; }
.user-list li:first-child { border-top: 0; }
.user-list li.is-off .avatar { background: var(--line-2); color: var(--muted); }
.users__sum { margin: 0 0 8px; }
.users__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.users__bar .search { flex: 1 1 180px; }
.rel-list li a { display: flex; flex-direction: column; padding: 7px 0; }
.rel-list li + li { border-top: 1px solid var(--line-3); }

/* ---------- settings ---------- */
.settings { display: flex; flex-direction: column; gap: 16px; border: 0; padding: 0; margin: 0; min-width: 0; }
/* settings: a menu of sections on the left, each section a row of what it is and its fields */
.set-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; align-items: start; }
.set-nav { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 14px; }
.set-nav > div { display: flex; flex-direction: column; gap: 2px; }
.set-nav__title { padding: 0 10px 4px; font: 600 11px var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.set-nav button { padding: 7px 10px; border: 0; border-radius: 8px; background: none; font: 500 13.5px var(--display); color: var(--ink-2); text-align: left; cursor: pointer; }
.set-nav button:hover { background: var(--surface); color: var(--ink); }
.set-nav button { display: flex; align-items: center; gap: 8px; }
.set-nav button.is-on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: inset 2px 0 0 var(--indigo), 0 1px 2px rgba(16, 19, 43, .06); }
.set-nav__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); flex: none; margin-left: auto; }
.chip .set-nav__dot { margin-left: 2px; }
.chip.is-on .set-nav__dot { background: #ffd58a; }
.set-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.set-sec { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; padding: 22px 24px; border-top: 1px solid var(--line-3); scroll-margin-top: 84px; }
.card > .set-sec:first-child { border-top: 0; }
.set-sec__about h2 { font: 600 14.5px var(--display); }
.set-sec__about p { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.set-sec__fields { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.set-preview__stage { padding: 16px; border-radius: 10px; background: #e9ebf0; }
.paper.lh-strip { min-height: 62mm; }
.logo-ctl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.logo-ctl__thumb { height: 44px; padding: 4px 8px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.logo-ctl__thumb img { max-height: 34px; max-width: 120px; object-fit: contain; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; }
.input-affix--end > span { padding: 0 12px 0 0; }
.pw-form { display: flex; flex-direction: column; gap: 12px; max-width: 420px; }
.pw-form .card-title { margin: 0; }
@media (max-width: 1100px) {
  .set-layout { grid-template-columns: minmax(0, 1fr); }
  .set-nav { position: static; flex-direction: row; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 0 4px; padding-bottom: 2px; }
  .set-nav::-webkit-scrollbar { display: none; }
  .set-nav > div { flex-direction: row; gap: 4px; }
  .set-nav__title { display: none; }
  .set-nav button { white-space: nowrap; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 7px 13px; }
  .set-nav button.is-on { box-shadow: none; background: var(--indigo); border-color: var(--indigo); color: #fff; }
  .set-nav button.is-on .set-nav__dot { background: #ffd58a; }
  .set-sec { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; align-items: start; }
.settings-grid form .btn { margin-top: 14px; }
.settings-grid .form-error { margin-top: 10px; }

/* ---------- modal & toasts ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: rgba(16, 19, 43, .42); animation: fade .15s ease;
}
.modal {
  color: var(--ink); /* a pop-up opened from the sidebar doesn't take its pale text */
  width: 100%; max-width: 620px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); animation: pop .18s ease;
}
.modal--wide { max-width: 900px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line-3); }
.modal__head h2 { font: 600 18px var(--heading); letter-spacing: -.01em; }
.modal__body { padding: 20px 22px; overflow-y: auto; }
.modal__foot { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line-3); background: var(--surface-2); }
.modal__foot-left { display: flex; gap: 8px; margin-right: auto; }
.modal__left { margin-right: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.toasts { position: fixed; z-index: 200; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; background: var(--night); color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 500; line-height: 1.45;
  box-shadow: 0 8px 24px rgba(16, 19, 43, .25); animation: pop .2s ease; max-width: min(90vw, 560px); pointer-events: auto; }
.toast__act { flex: none; border: 0; background: none; padding: 0; font: 600 13.5px var(--display); color: var(--cyan); cursor: pointer; }
.toast--err { background: var(--red); }

/* ---------- phone-only / desktop-only pieces ---------- */
.phone-only { display: none !important; }
@media (max-width: 600px) {
  .phone-only { display: revert !important; }
  .crumb__back.phone-only { display: inline-grid !important; }
  .desktop-only { display: none !important; }
}

/* ---------- open in: full page or side peek ---------- */
.toolbar .open-in { display: flex; align-items: center; gap: 8px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius-sm); background: var(--fill-2); }
.seg button { all: unset; height: 28px; padding: 0 11px; border-radius: 6px; display: inline-flex; align-items: center; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.seg button:hover:not(.is-on) { color: var(--ink); }
.seg button.is-on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 19, 43, .08); }
.seg button:focus-visible { box-shadow: 0 0 0 3px var(--ring); }
.table tr.is-peek td { background: var(--indigo-tint); }
.table tr.is-peek td:first-child { box-shadow: inset 3px 0 0 var(--indigo); }

/* the peek: a column on the right of a wide screen (the page makes room), over the page on a tablet,
   a sheet from the bottom on a phone */
.peek {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 45; width: 460px; max-width: 92vw;
  display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: -12px 0 30px rgba(16, 19, 43, .08); animation: peek-in .2s cubic-bezier(.2, .7, .2, 1) backwards;
}
@keyframes peek-in { from { opacity: 0; transform: translateX(16px); } }
.peek-scrim { display: none; }
@media (min-width: 1101px) { body.has-peek .main { margin-right: 460px; } }
.peek__head { display: flex; align-items: center; gap: 4px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line); }
.peek__title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.peek__title strong { font-size: 17px; }
.peek__body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.peek__money { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.peek__money > div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; display: flex; flex-direction: column; min-width: 0; }
.peek__money span { font-size: 12.5px; color: var(--muted); }
.peek__money strong { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.peek__status { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.peek__body .paper-scroll { border-radius: var(--radius-sm); background: var(--bg); padding: 10px 0; }
.peek__foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--line); }
.peek__keys { margin-left: auto; }
@media (max-width: 1100px) { .peek__keys { display: none; } }
@media (max-width: 600px) {
  .peek-scrim { display: block; position: fixed; inset: 0; z-index: 44; background: rgba(12, 13, 38, .45); }
  .peek { top: auto; left: 0; width: auto; max-width: none; height: 82vh; border-left: 0; border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 30px rgba(21, 22, 58, .14); animation-name: sheet-in; }
  .peek__head .btn { padding: 6px 10px; font-size: 13px; }
  .peek__foot .btn { flex: 1; min-height: 44px; }
}
@keyframes sheet-in { from { opacity: 0; transform: translateY(40px); } }

/* ---------- between phone and wide desktop: the page beside the sidebar is narrow ---------- */
@media (max-width: 1240px) {
  body .dash-grid, body .party-grid { grid-template-columns: minmax(0, 1fr); }
  body .needs { position: static; }
  body .people__row, body .people__head { grid-template-columns: minmax(0, 1fr) 130px 120px 20px; }
  body .people__row .people__how, body .people__head .people__how { display: none; }
  body .set-sec { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  body .num-grid { grid-template-columns: 140px minmax(0, 1fr) 100px 130px; }
  /* a cheque: its buttons go under the text, so the text keeps the width */
  body .cq { grid-template-columns: 52px minmax(0, 1fr) auto; }
  body .cq__acts { grid-column: 2 / -1; justify-content: flex-start; max-width: none; }
}
@media (max-width: 1000px) {
  body .vat-sum { flex-direction: column; align-items: flex-start; }
}

/* ---------- phone: tabs along the bottom, and the sheets they open ---------- */
.tabbar, .topbar__firm, .topbar__me, .topbar__bell { display: none; }
.psheet-layer { position: fixed; inset: 0; z-index: 90; display: flex; align-items: flex-end; background: rgba(12, 13, 38, .45); animation: fade .15s ease; }
.psheet { width: 100%; max-height: 88vh; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
  border-radius: 20px 20px 0 0; background: var(--surface); box-shadow: 0 -12px 30px rgba(21, 22, 58, .16); animation: sheet-in .2s cubic-bezier(.2, .7, .2, 1); }
.psheet__handle { align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin-bottom: 2px; }
.psheet__head, .psheet__firm, .psheet__me { display: flex; align-items: center; gap: 12px; }
.psheet__head h2 { flex: 1; font: 600 18px var(--heading); }
.psheet__firm { padding-bottom: 12px; border-bottom: 1px solid var(--line-3); }
.psheet__firm .firm__logo { width: 36px; height: 36px; border-radius: 9px; background: var(--indigo-deep); color: #fff; font-size: 15px; }
.psheet__firm b, .psheet__me b { display: block; font-size: 15px; font-weight: 600; }
.psheet__group { display: flex; flex-direction: column; gap: 8px; }
.psheet__firms { display: flex; flex-wrap: wrap; gap: 8px; margin-top: -4px; }
.psheet__firms .chip { height: 38px; font-size: 14px; }
.psheet__firms .firm__logo { width: 22px; height: 22px; border-radius: 6px; background: var(--indigo-deep); color: #fff; font-size: 11px; }
.psheet__title { font: 600 11.5px var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.psheet__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.psheet__grid a { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; border-radius: 12px; background: var(--surface-2);
  border: 1px solid var(--line-3); color: var(--ink); font-size: 15px; font-weight: 500; }
.psheet__grid a .icon { color: var(--indigo); flex: none; }
.psheet__new { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.psheet__new a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); color: var(--ink); }
.psheet__new b { display: block; font-size: 15px; font-weight: 600; }
.psheet__new .grow > span { font-size: 13px; color: var(--muted); }
.quick-ico { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--indigo-soft); color: var(--indigo); }
.psheet__me { padding-top: 12px; border-top: 1px solid var(--line-3); }
@media (max-width: 600px) {
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; align-items: flex-end; justify-content: space-around;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  .tabbar__tab { all: unset; box-sizing: border-box; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0;
    font: 500 12px var(--display); color: var(--muted); cursor: pointer; }
  .tabbar__tab.is-on { color: var(--indigo); font-weight: 600; }
  .tabbar__new { all: unset; box-sizing: border-box; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    font: 500 12px var(--display); color: var(--muted); cursor: pointer; }
  .tabbar__new > span { width: 52px; height: 52px; margin-top: -26px; display: grid; place-items: center; border-radius: 50%;
    background: var(--indigo); color: #fff; box-shadow: 0 6px 16px rgba(35, 36, 92, .35); }
  main { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  /* a document and the editor have their own bar at the bottom instead */
  body:has(.action-bar) .tabbar, body:has(.page--editor) .tabbar { display: none; }
  body:has(.action-bar) main, body:has(.page--editor) main { padding-bottom: 0; }
  body:not(:has(.action-bar)):not(:has(.page--editor)) .toasts { bottom: calc(90px + env(safe-area-inset-bottom)); }
  .topbar__menu, .topbar .brand__type { display: none; }
  .topbar__firm { display: block; flex: 1; min-width: 0; font: 600 15px var(--display); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar__me { display: grid; border: 0; cursor: pointer; }
  .topbar__bell { display: block; }
  .topbar__bell .bell__menu { position: fixed; top: 56px; left: 8px; right: 8px; width: auto; }
  .page-top .bell { display: none; }
  body:has(.page--dash) .topbar__search, body:has(.page--dash) .topbar__bell .icon-btn { color: #fff; border-color: #2b3058; background: transparent; }
  .page { padding: 16px 16px 32px; }
  .page-top { margin: -16px -16px 16px; padding: 8px 16px; min-height: 48px; }

  /* Home: the header runs dark into what customers owe; the jobs for today next, then four figures */
  body:has(.page--dash) .topbar { background: var(--indigo-deep); border-bottom-color: var(--indigo-deep); backdrop-filter: none; }
  body:has(.page--dash) .topbar__firm { color: #fff; }
  body:has(.page--dash) .topbar__me { background: #2a2c66; color: #fff; }
  .page--dash .page-top, .page--dash .page-head { display: none; }
  .page--dash { padding-top: 0 !important; }
  .phone-hero { display: block !important; margin: 0 -16px 18px; padding: 6px 16px 22px; background: var(--indigo-deep); color: #fff; }
  .phone-hero h1 { margin: 0 0 16px; font: 600 24px var(--heading); letter-spacing: -.02em; color: #fff; }
  .phone-hero__owe { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: 14px; background: #1c2040; border: 1px solid #2b3058; color: #fff; }
  .phone-hero__owe span { font-size: 13px; color: #b9bcd3; }
  .phone-hero__owe b { font: 600 32px/1.1 var(--heading); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
  .phone-hero__owe b small { font: 500 15px var(--display); color: #b9bcd3; margin-right: 6px; }
  .phone-hero__owe em { font-style: normal; font-size: 13px; font-weight: 600; color: #ffb4ac; }
  .page--dash .dash-grid { display: flex; flex-direction: column; gap: 16px; }
  .page--dash .needs { order: -2; border: 0; background: none; box-shadow: none; overflow: visible; }
  .page--dash .needs__head { padding: 0 0 10px; border: 0; }
  .page--dash .needs ul { display: flex; flex-direction: column; gap: 10px; }
  .page--dash .needs li + li { border-top: 0; }
  .page--dash .needs a { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
  .page--dash .needs__icon { width: 38px; height: 38px; border-radius: 10px; }
  .phone-tiles { order: -1; display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .phone-tiles a { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); min-width: 0; }
  .phone-tiles span, .phone-tiles em { font-size: 13px; color: var(--muted); font-style: normal; }
  .phone-tiles b { font: 600 17px var(--heading); font-variant-numeric: tabular-nums; }

  /* a document: no dates block or subject under the number, the money first */
  .page--view .doc-facts, .page--view .doc-subject { display: none; }
  .page--view .page-head h1 { font-size: 24px; }
  .doc-summary .hero-money { font-size: 34px; }
  .doc-summary .sc--money, .doc-summary__total { display: flex; flex-direction: column; gap: 10px; }
  .doc-summary__tp { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
  .doc-summary__tp b { color: var(--ink); font-weight: 600; }
  .doc-summary__paper .icon, .doc-summary__row .icon { color: var(--muted); flex: none; }
  .doc-summary__row { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
  .doc-summary__row strong { display: block; }
  .view-side > .desktop-only { display: none !important; }

  /* pop-ups are sheets from the bottom, with big buttons */
  .modal-backdrop { place-items: end stretch; padding: 0; }
  .modal { max-width: none; max-height: 92vh; border-radius: 20px 20px 0 0; animation: sheet-in .2s cubic-bezier(.2, .7, .2, 1); }
  .modal__head { padding: 16px; }
  .modal__body { padding: 16px; }
  .modal__foot { flex-direction: column-reverse; align-items: stretch; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .modal__foot .btn { justify-content: center; min-height: 48px; }
  .modal__foot-left, .modal__left { margin: 0; justify-content: center; }
  .pay-form { display: flex; flex-direction: column; gap: 14px; }
  .pay-form > * { width: 100%; }
  .pay-form input { width: 100%; }
  .pay-form .pay-amount { order: -2; }
  .pay-form .pay-date { order: -1; }
  .pay-form .pay-amount .input-affix { min-height: 56px; border-width: 1.5px; }
  .pay-form .pay-amount input { font: 600 24px var(--heading) !important; }
  .method-chips .chip { height: 42px; padding: 0 16px; font-size: 15px; }

  /* cheques: one card each, the buttons big enough for a thumb */
  .cq-group h2 { padding: 10px 14px; }
  .cq { grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px 12px; align-items: start; }
  .cq__amt { grid-column: 3; grid-row: 1; }
  .cq__main { grid-column: 2; grid-row: 1; }
  body .cq__acts { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
  .cq__acts > .muted { display: none; }
  .cq__acts .cheque-act { height: 42px; justify-content: center; font-size: 14px; }
  .cq__acts .strong-link { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; min-height: 46px; border-radius: 10px;
    background: var(--indigo); color: #fff; font-size: 14.5px; }
  .cq__acts .link-btn { justify-self: end; }
  .sum-strip > div { flex-basis: 50%; padding: 12px 14px; }
  .sum-strip b { font-size: 17px; }

  /* the save bar: pinned along the bottom, the total only */
  body .savebar { position: fixed; left: 0; right: 0; bottom: 0; width: auto; margin: 0; border-radius: 16px 16px 0 0; gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); z-index: 41; }
  body:not(:has(.action-bar)):not(:has(.page--editor)) .savebar.savebar { bottom: calc(66px + env(safe-area-inset-bottom)); left: 8px; right: 8px; border-radius: 14px; }
  body .savebar__text { flex: 1 1 100%; min-width: 0; font-size: 14px; }
  body .savebar__text small { display: none; }
  body .savebar__sum span:not(:last-child) { display: none; }
  body .savebar .btn { flex: 1; justify-content: center; min-height: 42px; padding: 0 10px; }
  .page--editor { padding-bottom: 150px; }

  /* VAT: the three figures one under the other */
  .vat-sum { padding: 18px; flex-direction: column; align-items: stretch; gap: 14px; }
  .vat-eq div { width: 100%; }
  .vat-eq { flex-direction: column; align-items: stretch; gap: 10px; width: 100%; }
  .vat-eq div { flex-direction: row; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; padding-top: 10px; border-top: 1px solid var(--line-3); }
  .vat-eq em { flex-basis: 100%; }
  .vat-eq i { display: none; }
}

/* ---------- phones ---------- */
@media (max-width: 600px) {
  /* typing never zooms the page on an iPhone (it does below 16 px) */
  input, textarea, select { font-size: 16px !important; }

  /* dashboard: one column; the jobs for today straight after the figures */
  main .dash-grid, main .editor-top, main .editor-bottom, main .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .dash-figures > div { flex-basis: 50%; padding: 14px 16px; }
  .dash-figures b { font-size: 18px; }
  .age-keys { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .starters li { flex-wrap: wrap; }

  /* lists: one card per row, what it is on the left, the amount (and when it's due) on the right */
  .table--cards, .table--cards tbody { display: block; }
  .table--cards thead { display: none; }
  .table--cards tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 3px; align-items: start;
    padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table--cards tbody tr:last-child { border-bottom: 0; }
  .table--cards td { display: block; padding: 0 !important; border: 0 !important; min-width: 0; background: none !important; box-shadow: none !important; }
  .table--cards td.hide-sm, .table--cards .row-actions { display: none; }
  .table--cards td:first-child { grid-column: 1; grid-row: 1; }
  .table--cards td.num { grid-column: 2; grid-row: 1; text-align: right; }
  .table--cards td.num ~ td.num { grid-row: 2; }
  .table--cards td:not(:first-child):not(.num):not(.c-side) { grid-column: 1; font-size: 13px; color: var(--ink-2); }
  .table--cards td.c-side { grid-column: 2; grid-row: 2; text-align: right; }
  .table--cards td.c-party > div, .table--cards .who__ini, .table--cards .who__sub { display: none; }
  .table--cards .who__date { display: block !important; font-size: 13px; color: var(--muted); }
  .ltools { padding: 12px 14px; }
  .ltools .search { flex-basis: 100%; max-width: none; }
  .ltools .open-in { margin-left: 0; flex-wrap: wrap; }
  .ltools .open-in > .muted { display: none; }
  .lcard__foot { padding: 12px 14px; }
  .table--cards tr.clickable:hover { background: var(--surface-2); }
  .table--cards tr.is-last, .table--cards tr.is-peek { background: var(--indigo-tint); box-shadow: inset 3px 0 0 var(--indigo); }
  .tel-link { color: var(--indigo-ink); font-weight: 500; }
  .toolbar .open-in { order: 3; }

  /* a document: figures and the page thumbnail first, the main actions in a bar at the bottom */
  .page--view { padding-bottom: 96px; }
  .page--view .view-grid > .paper-stage { display: none; }
  .doc-summary { display: flex !important; flex-direction: column; gap: 10px; margin-bottom: 14px; }
  .doc-summary__paper { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
  .doc-summary__paper strong { display: block; }
  .doc-summary__thumb { width: 54px; height: 76px; flex: none; background: #fff; box-shadow: 0 1px 4px rgba(21, 22, 58, .2); padding: 6px 5px; display: flex; flex-direction: column; gap: 4px; }
  .doc-summary__thumb i { display: block; height: 3px; background: var(--line-2); border-radius: 2px; }
  .doc-summary__thumb i:first-child { background: var(--indigo); }
  .doc-summary__thumb i:nth-child(2) { height: 6px; margin-top: 6px; background: var(--blue); }
  .action-bar { display: flex !important; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line-2); }
  .action-bar .btn { flex: 1; justify-content: center; min-height: 44px; }
  .action-bar .action-bar__more { flex: none; width: 48px; font-size: 18px; }
  .stepper .btn { min-width: 40px; justify-content: center; }

  /* the line editor: qty × rate = amount on one row, unit / discount / VAT folded away, a ⋯ menu per line */
  .lines__row:not(.lines--plain) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 44px;
    grid-template-areas: "desc desc desc more" "qty rate amt amt" "extra extra extra extra" "unit disc vat vat"; }
  .lines__row:not(.lines--plain) .lines__desc { grid-area: desc; }
  .lines__row:not(.lines--plain) .lines__more { grid-area: more; }
  .lines__row:not(.lines--plain) .c-qty { grid-area: qty; }
  .lines__row:not(.lines--plain) .c-rate { grid-area: rate; }
  .lines__row:not(.lines--plain) .lines__amt { grid-area: amt; text-align: right; align-self: end; padding-bottom: 10px; }
  .lines__row:not(.lines--plain) .lines__extra { grid-area: extra; }
  .lines__row:not(.lines--plain) .c-unit { grid-area: unit; }
  .lines__row:not(.lines--plain) .c-disc { grid-area: disc; }
  .lines__row:not(.lines--plain) .c-vat { grid-area: vat; }
  .lines__row:not(.lines--plain):not(.is-expanded) :is(.c-unit, .c-disc, .c-vat) { display: none; }
  .lines__row .lines__tools { display: none; }
  .lines__more { all: unset; box-sizing: border-box; width: 44px; height: 44px; display: grid !important; place-items: center; align-self: end;
    border: 1px solid var(--line); border-radius: 10px; font-size: 18px; color: var(--ink-2); cursor: pointer; }
  .lines--plain .lines__more { position: absolute; top: 6px; right: 10px; width: 36px; height: 36px; }
  .lines__extra { all: unset; font-size: 13px; color: var(--indigo-ink); cursor: pointer; padding: 4px 0; }
  .lines__menu { position: absolute; right: 12px; top: 64px; z-index: 5; display: flex; flex-direction: column; min-width: 180px; padding: 6px;
    background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 12px 30px rgba(21, 22, 58, .16); }
  .lines__menu button { all: unset; padding: 12px; border-radius: 8px; font-size: 15px; cursor: pointer; }
  .lines__menu button:disabled { opacity: .4; }
  .lines__menu button:not(:disabled):active { background: var(--surface-2); }
  .lines__section .icon-btn { width: 40px; height: 40px; }
  .sticky-save { flex-wrap: nowrap; }
  .sticky-save__sum { flex-direction: column; gap: 0; }
  .sticky-save__phone { position: relative; }
  .save-menu { position: absolute; right: 0; bottom: calc(100% + 8px); display: flex; flex-direction: column; min-width: 230px; padding: 6px;
    background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 12px 30px rgba(21, 22, 58, .16); }
  .save-menu button { all: unset; padding: 12px; border-radius: 8px; font-size: 15px; cursor: pointer; }
}

/* ---------- wide peek: menu folded to icons, a slim list, the document page beside it ---------- */
@media (min-width: 1101px) {
  body.has-wide .main { margin-left: 68px; }
  body.has-wide:not(.rail-open) .sidebar { width: 68px; padding: 16px 10px 12px; }
  body.has-wide:not(.rail-open) .sidebar .brand__type, body.has-wide:not(.rail-open) .nav-group__title, body.has-wide:not(.rail-open) .nav-link span,
  body.has-wide:not(.rail-open) .sidebar__user .grow, body.has-wide:not(.rail-open) .firm__btn .grow, body.has-wide:not(.rail-open) .firm__btn > .icon { display: none; }
  body.has-wide:not(.rail-open) .firm__btn { justify-content: center; padding: 8px 0; }
  body.has-wide:not(.rail-open) .nav-link__n, body.has-wide:not(.rail-open) .side-search span, body.has-wide:not(.rail-open) .side-search kbd { display: none; }
  body.has-wide:not(.rail-open) .nav-group__head, body.has-wide:not(.rail-open) .nav-pin, body.has-wide:not(.rail-open) .nav-rule,
  body.has-wide:not(.rail-open) .sidebar__user > .icon { display: none; }
  body.has-wide:not(.rail-open) .nav-group + .nav-group { border-top: 1px solid var(--side-rule); padding-top: 6px; margin-top: 4px; }
  body.has-wide:not(.rail-open) .side-search { justify-content: center; padding: 0; }
  body.has-wide:not(.rail-open) .brand { justify-content: center; padding: 0 0 6px; }
  body.has-wide:not(.rail-open) .nav-link { justify-content: center; padding: 10px 0; }
  body.has-wide:not(.rail-open) .sidebar__user { flex-direction: column; gap: 8px; }
  /* opened from the rail: the full menu over the page, until a link is chosen */
  body.has-wide.rail-open .sidebar { box-shadow: 12px 0 40px rgba(10, 12, 40, .35); }
  body.has-wide .rail-toggle { display: grid; }
}
.wide-layout { display: flex; align-items: flex-start; min-height: 100vh; }
.wide-list { position: sticky; top: 0; width: 300px; height: 100vh; flex: none; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line); }
.wide-list__head { display: flex; flex-direction: column; gap: 10px; padding: 18px 14px 12px; }
.wide-list__head strong { font-size: 18px; font-weight: 800; }
.wide-list__head .search { flex: none; }
.wide-list__rows { list-style: none; margin: 0; padding: 0; flex: 1; overflow-y: auto; }
.wide-row { all: unset; box-sizing: border-box; width: 100%; display: flex; justify-content: space-between; gap: 10px; padding: 11px 14px;
  border-top: 1px solid var(--line); cursor: pointer; }
.wide-row:hover { background: var(--surface-2); }
.wide-row.is-on { background: var(--indigo-tint); box-shadow: inset 2px 0 0 var(--indigo); }
.wide-row:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }
.wide-row__main, .wide-row__side { display: flex; flex-direction: column; min-width: 0; }
.wide-row__main strong { font-size: 13.5px; font-weight: 600; }
.wide-row__main .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wide-row__side { flex: none; text-align: right; font-size: 13px; }
.wide-list__foot { padding: 10px 14px; border-top: 1px solid var(--line); }
.wide-doc { flex: 1; min-width: 0; animation: wide-in .22s cubic-bezier(.2, .7, .2, 1) backwards; }
.wide-doc .page { max-width: none; }
@keyframes wide-in { from { opacity: 0; transform: translateX(24px); } }
@media print { .wide-list { display: none !important; } .wide-layout { display: block; } }

/* the A4 page full size on a phone: scroll and pinch to read it */
.paper-full { position: fixed; inset: 0; z-index: 120; display: flex; flex-direction: column; background: var(--bg); }
.paper-full__bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--line-2); }
.paper-full__body { flex: 1; overflow: auto; padding: 12px; -webkit-overflow-scrolling: touch; }
.paper-full__body .paper { box-shadow: 0 1px 4px rgba(21, 22, 58, .15); }
@media print { .paper-stage { padding: 0 !important; background: none !important; border-radius: 0 !important; }
  .paper-stage .paper { box-shadow: none !important; }
  .jsteps, .page-top, .paper-full, .peek, .peek-scrim, .action-bar, .demo-bar, .offline-bar, .scan-tray, .savebar, .tabbar, .confirm-layer { display: none !important; } }


/* ---------- VAT summary ---------- */
.vat-periods { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.vat-sum { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding: 24px 28px; margin-bottom: 16px; }
.vat-sum__head span { font-size: 13px; color: var(--muted); }
.vat-sum__head .hero-money { font-size: 40px; margin-top: 6px; }
.vat-eq { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.vat-eq div { display: flex; flex-direction: column; gap: 3px; }
.vat-eq span, .vat-eq em { font-size: 13px; color: var(--muted); font-style: normal; }
.vat-eq b { font: 600 20px var(--heading); font-variant-numeric: tabular-nums; }
.vat-eq__net { color: var(--indigo); }
.vat-eq i { font-style: normal; font-size: 20px; color: var(--muted); }
.lcard + .page-note { margin: 14px 0 0; }

/* ---------- cheques, grouped by when they can be cashed ---------- */
.cq-group h2 { margin: 0; padding: 10px 20px; border-bottom: 1px solid var(--line-3); background: var(--surface-2);
  font: 600 12px var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); }
.cq-group h2.is-alert { color: var(--red); }
.cq-group ul { list-style: none; margin: 0; padding: 0; }
.cq { display: grid; grid-template-columns: 52px minmax(0, 1fr) 110px auto; gap: 16px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line-3); }
.cq-group:last-of-type .cq:last-child { border-bottom: 0; }
.cq-date { width: 52px; height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.cq-date b { font: 600 18px/1 var(--heading); }
.cq-date span { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.cq-date.is-alert { border-color: #f5c9c4; background: var(--red-soft); }
.cq__title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cq__title b { font-size: 14px; font-weight: 600; }
.cq__due { font-size: 13px; font-weight: 600; color: var(--red); }
.cq__main p { margin: 4px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.cq__main a { color: var(--link); }
.cq__amt { font-size: 14.5px; font-weight: 600; text-align: right; }
.cq__acts { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; max-width: 330px; }
.strong-link { font-weight: 600; color: var(--link); }
@media (max-width: 760px) {
  .cq { grid-template-columns: 52px minmax(0, 1fr) auto; padding: 14px; }
  .cq__acts { grid-column: 2 / -1; justify-content: flex-start; max-width: none; }
}

/* ---------- pop-up bits ---------- */
.modal__lead { margin: -4px 0 16px; font-size: 13.5px; color: var(--muted); }
.firm-new__points { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.firm-new__points li { display: flex; gap: 12px; align-items: flex-start; }
.firm-new__points b { display: block; font-size: 14px; font-weight: 600; }
.firm-new__points li > span:last-child > span { font-size: 13px; color: var(--muted); }
.firm-new__preview { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; padding: 14px; border-radius: 12px; background: var(--side-bg); }
.firm-new__preview .muted { color: var(--side-muted); }
.firm-new__preview .firm__btn { max-width: 260px; }
.field__soft { font-weight: 400; color: var(--muted); }
/* a field with its unit in front: AED 4,704.00 */
.input-affix { display: flex; align-items: center; border: 1px solid var(--field); border-radius: var(--radius-sm); background: var(--surface); }
.input-affix:focus-within { border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-tint); }
.input-affix > span { padding: 0 0 0 12px; font-size: 13.5px; color: var(--muted); }
.input-affix input { border: 0 !important; box-shadow: none !important; background: none; }
.method-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.method-chips .chip { height: 36px; padding: 0 14px; font-size: 13.5px; }
.pay-form { align-items: start; }
.pay-pdc { font-size: 13px; }

/* payment reminder: the invoices to name, how it goes, and the message */
.remind { display: flex; flex-direction: column; gap: 16px; }
.remind .grid-2 { align-items: start; }
.remind .check-row { margin: 0; }
.remind-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); max-height: 220px; overflow-y: auto; }
.remind-list li + li { border-top: 1px solid var(--line-soft, var(--line)); }
.remind-list .check-row { padding: 10px 12px; align-items: center; font-size: 13.5px; }
.remind-list .check-row:hover { background: var(--bg); }
.remind-msg { min-height: 240px; font-size: 13.5px; }
.remind .field__label .link-btn { margin-left: 8px; font-size: 13px; }
.remind-last { margin: -4px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.btn.is-disabled { opacity: .5; pointer-events: none; }
.log-msg { padding: 8px 10px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; line-height: 1.5; max-height: 260px; overflow-y: auto; }

/* ---------- the save rule: a bar on pages you edit ---------- */
.savebar {
  position: sticky; bottom: 20px; z-index: 30; margin: 24px auto 0; width: min(620px, 100%);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px 10px 18px; border-radius: 12px;
  background: var(--night); color: #fff; box-shadow: 0 8px 24px rgba(16, 19, 43, .25); animation: bar-up .18s ease-out;
}
@keyframes bar-up { from { opacity: 0; transform: translateY(10px); } }
.savebar__text { flex: 1; min-width: 160px; font-size: 13.5px; font-weight: 500; }
.savebar__text small { display: block; color: var(--side-muted); font-size: 13px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.savebar .btn { height: 34px; }
.savebar .btn--ghost { background: transparent; color: #fff; border-color: var(--night-line); }
.savebar .btn--ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .06); color: #fff; border-color: #50557f; }
.savebar .btn--primary { background: #fff; border-color: #fff; color: var(--ink); }
.savebar .btn--primary:hover:not(:disabled) { background: #e9eaf2; border-color: #e9eaf2; color: var(--ink); }
.savebar--wide { width: min(780px, 100%); }
/* the running sums on the editor's bar */
.savebar__sum { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--side-muted); }
.savebar__sum b { color: #fff; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- asking first: a small confirm over the page ---------- */
.confirm-layer { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 16px; background: rgba(16, 19, 43, .38); animation: fade .12s ease; }
.confirm {
  width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(16, 19, 43, .18);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; animation: pop .16s ease;
}
.confirm h3 { font: 600 15px var(--display); }
.confirm p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.confirm__row { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }

/* ---------- callouts: a notice with a tone ---------- */
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; border: 1px solid; }
.callout > .icon { margin-top: 2px; }
.callout b, .callout strong { font-weight: 600; }
.callout--amber { background: #fffbf2; border-color: #f0d9a8; color: #5c3a00; }
.callout--blue { background: #f5f7fe; border-color: #d9dffa; color: #1e2f7a; }
.callout--red { background: #fef6f5; border-color: #f5c9c4; color: #7a1a12; }
.callout--grey { background: var(--bg); border-color: var(--line); color: var(--ink-2); }

/* ---------- menus: row menus and "More" ---------- */
.menu-wrap { position: relative; display: inline-flex; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 220px; padding: 6px; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-md); text-align: left; animation: pop .12s ease;
}
.menu--left { right: auto; left: 0; }
.menu--up { top: auto; bottom: calc(100% + 6px); }
.menu__item {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: none;
  font: 500 13.5px var(--display); color: var(--ink); text-align: left; cursor: pointer; white-space: nowrap;
}
.menu__item:hover, .menu__item:focus-visible { background: var(--indigo-tint); outline: 0; color: var(--ink); }
.menu__item small { display: block; font-size: 13px; font-weight: 400; color: var(--muted); white-space: normal; margin-top: 1px; }
.menu__item .icon { margin-top: 1px; color: var(--muted); }
.menu__item.is-danger, .menu__item.is-danger .icon { color: var(--red); }
.menu__item:disabled { opacity: .5; cursor: default; }
.menu hr { border: 0; border-top: 1px solid var(--line-3); margin: 4px 0; }

/* ---------- a summary strip: figures side by side in one card ---------- */
.sum-strip { display: flex; flex-wrap: wrap; }
.sum-strip > div { flex: 1 1 160px; display: flex; flex-direction: column; gap: 4px; padding: 16px 20px; border-left: 1px solid var(--line-3); min-width: 0; }
.sum-strip > div:first-child { border-left: 0; }
.sum-strip b { font: 600 20px var(--heading); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.sum-strip b small { font: 500 13px var(--display); color: var(--muted); margin-right: 4px; }
.sum-strip span { font-size: 13px; color: var(--muted); }

/* ---------- tabs: page tabs, and status tabs on a list card ---------- */
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); margin: 0 0 18px; overflow-x: auto; scrollbar-width: none; }
.tabs__tab {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; margin-bottom: -1px; padding: 0 2px; border: 0; border-bottom: 2px solid transparent;
  background: none; font: 500 14px var(--display); color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.tabs__tab:hover { color: var(--ink); }
.tabs__tab.is-on { border-bottom-color: var(--indigo); color: var(--ink); font-weight: 600; }
.tabs__n { font-size: 13px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.tabs__tab.is-alert, .tabs__tab.is-alert .tabs__n { color: var(--red); }
.tabs__pill { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 99px; background: var(--amber-soft); color: var(--amber); font-size: 12.5px; font-weight: 600; }
.tabs--list { padding: 0 20px; gap: 20px; }

/* ---------- progress across a job ---------- */
.jsteps { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 20px; margin: 0; list-style: none; }
.jstep { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink); }
.jstep__dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; font: 600 12px var(--display); background: var(--fill); color: var(--muted); }
.jstep.is-done .jstep__dot { background: var(--green-soft); color: var(--green); }
.jstep.is-now .jstep__dot { background: var(--indigo); color: #fff; }
.jstep b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.jstep small { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.jstep.is-later b { color: var(--ink-2); font-weight: 500; }
.jstep.is-skip { opacity: .55; }
.jstep.is-skip b { font-weight: 500; }
.jstep small a { color: var(--link); }
.jsteps__line { flex: 1 1 20px; height: 1px; background: var(--line-2); min-width: 12px; }

/* ---------- side cards beside a document ---------- */
.sc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.sc > h2 { font: 600 14px var(--display); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sc > h2 a, .sc > h2 .link-btn { font-size: 13px; font-weight: 500; }
.sc > p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted-2); }
.hero-money { font: 600 32px/1 var(--heading); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hero-money small { font: 500 15px var(--display); color: var(--muted); margin-right: 6px; letter-spacing: 0; }
.kvs { display: flex; flex-direction: column; }
.kvs > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13.5px; border-top: 1px solid var(--line-3); }
.kvs > div:first-child { border-top: 0; }
.kvs span { color: var(--muted); }
.kvs b { font-weight: 600; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 3px; background: var(--fill-2); overflow: hidden; display: flex; gap: 1px; }
.bar i { display: block; height: 100%; }
.bar .is-green { background: var(--green); } .bar .is-amber { background: #e9b44c; } .bar .is-red { background: var(--red); } .bar .is-indigo { background: var(--indigo); }
/* a choice as a card with a plain line under it (an invoice's status) */
.opts { display: flex; flex-direction: column; gap: 6px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: var(--ink); width: 100%; }
.opt:hover:not(:disabled) { border-color: var(--line-2); }
.opt.is-on { border-color: var(--indigo); background: var(--indigo-tint); box-shadow: inset 0 0 0 1px var(--indigo); }
.opt__ro { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid #b9bdcb; flex: none; margin-top: 2px; background: var(--surface); }
.opt.is-on .opt__ro { border: 5px solid var(--indigo); }
.opt b { display: block; font-size: 13.5px; font-weight: 600; }
.opt small { display: block; font-size: 13px; line-height: 1.45; color: var(--muted-2); }
.opt:disabled { cursor: default; background: var(--surface-2); }
/* a drop zone for files */
.drop { border: 1.5px dashed var(--line-2); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.drop small { font-size: 13px; font-weight: 400; color: var(--muted); }

/* ---------- coming back to a list ---------- */
/* the document just come back from: tinted, a cyan bar on its left edge and a "Just viewed" tag */
.table tr.is-last td { background: var(--indigo-tint); animation: last-glow 1.2s ease-out; }
.table tr.is-last td:first-child { box-shadow: inset 3px 0 0 var(--cyan); }
.table tr.is-last:hover td { background: var(--indigo-tint); }
@keyframes last-glow { from { background-color: var(--ring); } }
.just-tag { display: inline-block; margin-left: 8px; font-family: var(--display); font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--indigo); background: var(--surface); border: 1px solid var(--ring); border-radius: 99px; padding: 2px 8px; vertical-align: 1px; }
/* Newer / Older on a document page */
.stepper { display: flex; align-items: center; gap: 6px; margin-right: 6px; }
.stepper__pos { min-width: 64px; text-align: center; white-space: nowrap; }

/* ---------- activity log ---------- */
.log-filters { display: flex; flex-wrap: wrap; gap: 10px; }
.avatar--soft { background: var(--indigo-soft); color: var(--indigo); font-size: 11px; }
.log-filters .search { flex: 0 1 380px; }
.log-filters select { flex: 0 0 auto; width: auto; min-width: 150px; min-height: 40px; padding: 8px 34px 8px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background-color: var(--surface); font: inherit; font-size: 14px; color: var(--ink); max-width: 100%; }
.log-periods { margin: -4px 0 18px; align-items: center; }
.log-day { margin-bottom: 18px; }
.log-day__title { font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--ink-2); margin: 0 0 8px; display: flex; gap: 8px; align-items: baseline; }
.log-list { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.log-entry + .log-entry { border-top: 1px solid var(--line); }
.log-row { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; cursor: pointer; }
.log-row:hover { background: var(--surface-2); }
.log-row:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }
.log-entry.is-open > .log-row { background: var(--surface-2); }
.log-time { flex: none; width: 44px; font-size: 12.5px; color: var(--muted); padding-top: 3px; }
.avatar--sm { width: 26px; height: 26px; font-size: 12px; flex: none; }
.log-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.log-line1 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 14px; min-width: 0; }
.log-line1 strong { min-width: 0; overflow-wrap: anywhere; }
.log-summary { font-size: 13.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.log-row > .icon { flex: none; color: var(--muted); margin-top: 4px; }
.log-chev-space { width: 16px; flex: none; }
.log-detail { padding: 4px 16px 16px 72px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.log-diff { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.log-diff th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.log-diff td { padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.log-diff td:first-child { width: 22%; color: var(--ink-2); font-weight: 600; }
.log-detail del, .log-chg del { color: var(--red); background: var(--red-soft); text-decoration: line-through; padding: 0 3px; border-radius: 3px; }
.log-detail ins, .log-chg ins { color: var(--green); background: var(--green-soft); text-decoration: none; padding: 0 3px; border-radius: 3px; }
.log-lines { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.log-lines > strong { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.log-line { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 5px 9px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); }
.log-line--add { color: var(--green); border-color: #bfe0d0; background: var(--green-soft); }
.log-line--del { color: var(--red); border-color: var(--red-line); background: var(--red-soft); }
.log-chg { color: var(--ink-2); }
.log-snap { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; font-size: 13px; }
.log-snap dt { color: var(--muted); }
.log-snap dd { margin: 0; overflow-wrap: anywhere; }
.log-meta a { font-weight: 600; }
.log-list--compact .log-row { padding: 10px 2px; }
.log-list--compact .log-detail { padding: 4px 2px 12px; background: transparent; }
.log-list--compact .log-summary { font-size: 13px; }
.history-card .link-btn { margin-top: 8px; }
.party-history { margin-top: 18px; max-width: 720px; }
/* a customer's or supplier's page: their documents, and beside them contact, files, history */
.party-head { display: inline-flex; align-items: center; gap: 14px; }
.party-head__ini { width: 52px; height: 52px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--indigo-deep); color: #fff; font: 600 18px var(--heading); letter-spacing: 0; }
.party-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.party-main, .party-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.party-side > .card.pad { padding: 16px 18px; box-shadow: none; }
.kv--side { grid-template-columns: 90px 1fr; font-size: 13.5px; }
.page > .sum-strip { margin-bottom: 16px; }
.sum-strip em { font-style: normal; font-size: 13px; color: var(--muted); }
.ltools .chips { flex-wrap: nowrap; }
@media (max-width: 600px) { .log-detail { padding-left: 16px; } .log-time { width: 38px; } .log-diff td:first-child { width: 30%; } }

/* ---------- motion ----------
   Short (120–240 ms), ease-out, moves 8 px at most, plays once (only the loading rows repeat, while waiting),
   flat colours. Switched off for reduced motion and on paper (end of file). */
.route { animation: enter .18s cubic-bezier(.2, .7, .2, 1) backwards; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }
.table-wrap { animation: fade .16s ease-out backwards; }

.spinner-space { height: 148px; }
.skeleton-space { min-height: 240px; }
.skeleton { overflow: hidden; animation: fade .16s ease-out backwards; }
.skeleton__row { display: flex; align-items: center; gap: 18px; padding: 15px 14px; border-bottom: 1px solid var(--line); }
.skeleton__row:last-child { border-bottom: 0; }
.bone { display: block; height: 12px; border-radius: 6px; background: var(--fill-2); animation: pulse 1.2s ease-in-out infinite; }
.skeleton__end { width: 70px; margin-left: auto; }
@keyframes pulse { 50% { opacity: .5; } }

.chart__bar { transform-origin: bottom; animation: grow .52s cubic-bezier(.2, .7, .2, 1) backwards; }
@keyframes grow { from { transform: scaleY(0); } }

.combo__list { animation: drop .12s ease-out backwards; }
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } }

/* a still copy of a closing dialog (ui.js Modal) */
.modal-backdrop.is-leaving { animation: fade-out .12s ease-in forwards; pointer-events: none; }
.modal-backdrop.is-leaving .modal { animation: sink .12s ease-in forwards; }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sink { to { opacity: 0; transform: translateY(6px) scale(.98); } }
.toast.is-leaving { animation: toast-out .2s ease-in forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

.lines__row.is-new, .lines__section.is-new { animation: row-in .18s ease-out backwards, flash 1.1s ease-out; }
@keyframes row-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes flash { from { background-color: var(--indigo-tint); } }
.lines__row.is-leaving, .lines__section.is-leaving { animation: row-out .14s ease-in forwards; pointer-events: none; }
@keyframes row-out { to { opacity: 0; transform: translateX(8px); } }

.badge.is-changed { animation: settle .22s cubic-bezier(.2, .7, .2, 1) backwards; }
@keyframes settle { from { opacity: 0; transform: scale(.88); } }

/* ---------- sign in, first-run setup, the demo's way in ---------- */
.signin { min-height: 100vh; display: flex; background: var(--surface); }
.signin__art {
  flex: 1 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 40px; padding: 56px 64px;
  background: var(--indigo-deep); color: #fff;
}
.signin__art .brand { padding: 0; }
.signin__art .brand__type strong { font-size: 16px; }
.signin__pitch { display: flex; flex-direction: column; gap: 14px; max-width: 540px; }
.signin__pitch h1 { margin: 0; font: 600 44px/1.08 var(--heading); letter-spacing: -.03em; color: #fff; }
.signin__pitch p { margin: 0; font-size: 17px; line-height: 1.55; color: #b9bcd3; }
.signin__foot { margin: auto 0 0; font-size: 13px; font-weight: 500; color: #9da1be; }
.signin__preview { display: flex; flex-direction: column; gap: 16px; max-width: 560px; }
.signin__doc { display: flex; flex-direction: column; padding: 22px 24px; border-radius: 14px; background: #fff; color: var(--ink); }
.signin__doc-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.signin__doc-head > span:first-child { display: flex; flex-direction: column; gap: 2px; }
.signin__doc-head b { font-size: 15px; font-weight: 600; }
.signin__doc-head small { font-size: 13px; color: var(--muted); }
.signin__row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-3); font-size: 13px; font-weight: 500; color: var(--ink-2); }
.signin__doc-head + .signin__row { border-top: 0; }
.signin__row--total { color: var(--ink); font-weight: 600; }
.signin__row--total .num { font-size: 16px; }
.signin__tiles { display: flex; gap: 16px; }
.signin__tiles > div { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: 12px; background: #1c2040; border: 1px solid #2b3058; }
.signin__tiles span { font-size: 13px; font-weight: 500; color: #b9bcd3; }
.signin__tiles b { font: 600 22px var(--heading); letter-spacing: -.02em; text-align: left; }
.signin__points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; max-width: 560px; }
.signin__points li { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: 12px; background: #1c2040; border: 1px solid #2b3058; }
.signin__points li.is-later { opacity: .7; }
.signin__point-icon { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 8px; background: #2a2c66; color: var(--cyan); }
.signin__points b { display: block; margin-bottom: 3px; font: 600 16px var(--heading); color: #fff; }
.signin__points li > span:last-child > span { font-size: 14px; line-height: 1.5; color: #b9bcd3; }
.signin__side { flex: 1 1 440px; min-width: 0; display: flex; align-items: center; justify-content: center; padding: 48px 32px; }
.signin__card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.signin__title { display: flex; flex-direction: column; gap: 6px; }
.signin__title h2 { margin: 0; font: 600 28px/1.15 var(--heading); letter-spacing: -.02em; }
.signin__title p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--muted); }
.signin__card input { height: 44px; font-size: 15px; }
.signin__card .callout { padding: 11px 13px; border-radius: 9px; font-size: 13.5px; }
.signin__note { margin: 0; text-align: center; font-size: 13px; color: var(--muted); }
.signin__note--left { text-align: left; line-height: 1.5; }
.signin__phone-brand { display: none; }
.field__error { font-size: 13px; line-height: 1.4; color: var(--red); }
.field.has-error input, .field.has-error .phone, .field.has-error select { border-color: var(--red) !important; }
.signin__fix { align-self: flex-start; margin-top: -10px; font-size: 13.5px; }
.signin__lead { margin: 0 0 -6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.signin__demo-tag { align-self: flex-start; letter-spacing: .04em; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .view-grid { grid-template-columns: 1fr; }
  .view-side { position: static; }
  .lines { --cols: 30px minmax(180px, 1fr) 64px 70px 96px 64px 60px 104px 92px; }
}
@media (max-width: 900px) {
  .shell + .offline-bar { left: 0; top: auto; bottom: 0; border-bottom: 0; --bar-from: 100%; }
  body.is-offline .main { padding-top: 0; padding-bottom: 38px; }
  body.is-offline .toasts { bottom: 56px; }
  .sidebar { transform: translateX(-100%); visibility: hidden; transition: transform .25s ease, visibility 0s .25s; }
  .menu-open .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-lg); transition: transform .25s ease; }
  .menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(12, 13, 38, .4); }
  .main { margin-left: 0; }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30;
    padding: 10px 12px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
  }
  .page { padding-top: 20px; }
  /* the phone's own bar is the one that stays at the top */
  .page-top { position: relative; margin-top: -20px; min-height: 52px; }
  .editor-top, .editor-bottom, .dash-grid, .detail-grid, .party-grid { grid-template-columns: minmax(0, 1fr); }
  .needs { position: static; }
  .signin__art { display: none; }
  .signin__phone-brand { display: flex; padding: 0 0 6px; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .page-head h1 { font-size: 22px; }
  .stats { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-5 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .hide-sm { display: none; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .table td, .table th { padding: 10px; }
  .clip { max-width: 160px; }
  .lines__row, .lines__row.lines--plain { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* beside the sidebar the line sheet has no room for all its columns: each line is a card, as on a tablet */
@media (max-width: 1240px) {
  /* line items become stacked cards */
  .lines__head { display: none; }
  .lines__row, .lines__row.lines--plain {
    grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 14px; position: relative;
  }
  .lines__no { position: absolute; top: 6px; left: 14px; padding: 0; font-size: 11px; }
  .lines__desc { grid-column: 1 / -1; margin-top: 12px; }
  .lines__amt { grid-column: span 2; text-align: left; }
  .lines__tools { grid-column: span 2; }
  .lines__row input::placeholder { color: var(--muted); }
}
.lines__cell { display: block; min-width: 0; }
.lines__mlabel { display: none; }
@media (max-width: 900px) {
  .lines__mlabel { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 3px; }
  .lines__amt, .lines__tools { align-self: end; }
}
@media (max-width: 600px) {
  .lines__amt, .lines__tools { grid-column: span 1; }
}

@media (max-width: 900px) {
  .lines__serial { grid-column: 1 / -1; }
}
.num-grid { display: grid; grid-template-columns: 150px minmax(0, 1fr) 120px 150px; gap: 8px 14px; align-items: center; margin-top: 12px; }
.num-row { display: contents; }
.num-row__next .muted { display: none; }
@media (max-width: 760px) {
  .num-grid { display: flex; flex-direction: column; gap: 10px; }
  .num-grid__head { display: none; }
  .num-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 6px 10px; padding: 12px; border: 1px solid var(--line-3); border-radius: 10px; }
  .num-row strong { grid-column: 1 / -1; }
  .num-row__next { grid-column: 1 / -1; }
  .num-row__next .muted { display: inline; }
}
@media (max-width: 700px) {
  .num-grid { grid-template-columns: 1fr 1fr; }
  .num-grid > .field__label { display: none; }
  .num-grid > strong { grid-column: 1 / -1; margin-top: 8px; }
}

/* ---------- phone with country code ---------- */
.phone { display: flex; min-width: 0; }
.phone__cc { position: relative; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 10px;
  border: 1px solid var(--line-2); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: var(--surface-2); color: var(--ink-2); font-size: 14px; white-space: nowrap; }
.phone__cc::after { content: ""; width: 7px; height: 7px; margin: -4px 0 0 1px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.phone__cc select { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; padding: 0; }
.phone__cc:focus-within { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(76, 201, 230, .22); z-index: 1; }
.phone > input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; flex: 1; }
fieldset:disabled .phone__cc { cursor: default; }

/* ---------- purchasing (quotation → purchase orders) ---------- */
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--cyan); border-radius: inherit; transition: width .3s; }
.meter__label { margin: 6px 0 10px; }
.po-list a { display: flex; flex-direction: column; gap: 2px; }
.check-row { display: flex; align-items: flex-start; gap: 10px; margin: 14px 0; cursor: pointer; font-size: 14px; }
.check-row input, .po-chk input { width: 16px; height: 16px; padding: 0; margin: 2px 0 0; flex: none; accent-color: var(--indigo); }
.po-pick { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 10px; max-height: 46vh; overflow: auto; }
.po-pick .po-chk { width: 34px; }
.po-pick td { vertical-align: top; }
.po-pick tr.is-off td:not(.po-chk) { opacity: .5; }
.po-sec td { background: var(--indigo-tint); color: var(--indigo); font-weight: 600; font-size: 13px; padding-top: 7px; padding-bottom: 7px; }
.po-desc { font-weight: 500; }
.po-warn { color: var(--amber); }
.po-qty { width: 70px; padding: 6px 8px; }
.po-rate { width: 104px; padding: 6px 8px; }
.po-sum { margin-right: auto; }
.po-pick tr.is-loss td { background: var(--red-soft); }
.po-rate.is-bad { border-color: var(--red); }
.margin-pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font: 500 12.5px var(--mono); white-space: nowrap; }
.margin-pill.is-gain { background: var(--green-soft); color: var(--green); }
.margin-pill.is-loss { background: var(--red-soft); color: var(--red); }
.loss-box { border: 1px solid var(--red-line); background: #fef6f5; border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.loss-box p { margin: 0; }
.loss-box .check-row { margin: 0; }
.loss-reason { display: flex; flex-direction: column; gap: 4px; padding-left: 26px; }

/* ---------- quotation → proforma → tax invoice steps ---------- */
.flow { list-style: none; margin: 0; padding: 0; }
.flow__step { display: flex; gap: 12px; position: relative; padding-bottom: 16px; }
.flow__step:not(:last-child)::before { content: ""; position: absolute; left: 11px; top: 28px; bottom: 4px; width: 2px; background: var(--line-2); }
.flow__step.is-done:not(:last-child)::before { background: var(--green); }
.flow__dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 12px; font-weight: 700; box-sizing: border-box; }
.is-done .flow__dot { background: var(--green); color: #fff; }
.is-next .flow__dot { border: 2px solid var(--indigo); color: var(--indigo); }
.is-locked .flow__dot { background: var(--fill); color: var(--muted); }
.flow__body { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; padding-top: 2px; }
.flow__body > strong { font-size: 14.5px; }
.flow__body .btn { margin: 5px 0 2px; }
.is-locked .flow__body > strong { color: var(--ink-2); }
.flow__others { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.flow__label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.flow__btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- quotation revisions (same number, R1, R2 …) ---------- */
.rev-chip { display: inline-block; font: 600 12px var(--display); padding: 1px 6px; border-radius: 5px; background: var(--indigo-soft); color: var(--indigo); vertical-align: middle; letter-spacing: 0; }
.page-head h1 .rev-chip { font-size: 15px; padding: 2px 8px; border-radius: 6px; }
.lines__cell input.is-changed { border-color: var(--amber); background: var(--amber-soft); }
.lines__was { display: block; margin-top: 3px; font-size: 11px; color: var(--amber); text-align: right; white-space: nowrap; }
.rev-list { list-style: none; margin: 4px 0 0; padding: 0; }
.rev-item { display: flex; flex-direction: column; gap: 3px; padding: 11px 0; border-top: 1px solid var(--line); }
.rev-item:first-child { border-top: 0; }
.rev-item.is-viewing { background: var(--indigo-tint); margin: 0 -12px; padding: 11px 12px; border-radius: var(--radius-sm); border-top-color: transparent; }
.rev-item.is-viewing + .rev-item { border-top-color: transparent; }
.rev-item__head { display: flex; align-items: baseline; gap: 8px; }
.rev-item__tag { font-size: 12.5px; font-weight: 600; color: var(--indigo); }
.rev-item__total { margin-left: auto; }
.rev-item__changes { margin: 2px 0 0; padding-left: 16px; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.rev-item__link { font-weight: 600; margin-top: 2px; }
.notice--old { border-left-color: var(--amber); }
.notice--old > .icon { color: var(--amber); }

/* ---------- advance payments (proforma → tax invoice) ---------- */
.adv-tag { display: inline-block; font: 600 12px var(--display); padding: 1px 8px; border-radius: 5px; background: var(--green-soft); color: var(--green); vertical-align: middle; }
.adv-tag--ok { background: var(--green-soft); color: var(--green); margin-left: 4px; }
.pay-pcts { display: flex; flex-direction: column; gap: 6px; }
.rcpt-link { display: inline-flex; align-items: center; gap: 3px; font: 600 12px var(--mono); vertical-align: middle; margin-left: 4px; }
.notice--inline { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; margin: 4px 0 12px; padding: 12px; border: 1px solid var(--line);
  border-left: 3px solid var(--indigo); border-radius: var(--radius-sm); font-size: 13.5px; }
.sched { margin: 4px 0 8px; }
.sched__row { display: flex; justify-content: space-between; gap: 8px; }
.sched__amt { margin-left: auto; font-weight: 500; }
.is-later .flow__dot { border: 2px solid var(--line-2); color: var(--muted); }
.sched-edit { margin-top: 16px; }
.sched-edit__rows { display: grid; grid-template-columns: minmax(0, 1fr) 90px 120px 34px; gap: 8px; align-items: center; max-width: 640px; }
.sched-edit__rows .num { text-align: right; }

/* ---------- customer tabs & statement of account ---------- */
.stmt { display: flex; flex-direction: column; gap: 16px; }
.stmt__bar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.stmt__print { margin-left: auto; }
.stmt__screen { display: flex; flex-direction: column; gap: 16px; }
.stmt__screen .stats { margin: 0; }
.stmt__open td { background: var(--surface-2); }
.stmt__buckets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.stmt__bucket { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13px; color: var(--muted); }
.stmt__bucket strong { color: var(--ink); font-size: 15px; }
.stmt__bucket.is-late { background: var(--amber-soft); color: var(--amber); }
.stmt__bucket.is-late strong { color: var(--amber); }
.stmt__overdue { margin: 10px 0 0; padding-left: 18px; font-size: 13.5px; }
@media (max-width: 760px) { .stmt__buckets { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stmt__print { margin-left: 0; } }

/* ---------- purchase invoices (vendor invoice entered against a PO) ---------- */
.notice { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; border-left: 3px solid var(--indigo); font-size: 13.5px; line-height: 1.5; }
.notice > .icon { flex: none; margin-top: 2px; color: var(--indigo); }
.mt-xs { margin-top: 6px; }
.ok { color: var(--green); }
.diff-list { list-style: none; margin: 12px 0 0; padding: 0; font-size: 13.5px; line-height: 1.45; }
.diff { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 2px 10px; align-items: start; padding: 9px 0; }
.diff + .diff { border-top: 1px solid var(--line); }
.diff__tag { justify-self: start; margin-top: 1px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 99px; }
.diff__main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.diff__main strong { overflow-wrap: anywhere; }
.diff__what { color: var(--muted); font-size: 13px; }
.diff__what .mono { color: var(--ink-2); font-size: 12.5px; }
.diff__amt { white-space: nowrap; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-top: 1px; }
.diff__amt.is-up { color: var(--red); }
.diff__amt.is-down { color: var(--green); }
.diff--changed .diff__tag { background: var(--amber-soft); color: var(--amber); }
.diff--added .diff__tag { background: var(--blue-soft); color: var(--blue); }
.diff--missing .diff__tag { background: var(--red-soft); color: var(--red); }

/* ---------- Settings: what each role can do ---------- */
/* Users & roles */
.tabs__n { margin-left: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.tabs__n.is-alert { color: var(--amber); }
.users__role { width: auto; min-width: 140px; }
.people li { padding: 0; }
.people__row, .people__head { display: grid; grid-template-columns: minmax(0, 1fr) 170px 210px 130px 20px; align-items: center; gap: 14px; }
.people__row { all: unset; box-sizing: border-box; display: grid; grid-template-columns: minmax(0, 1fr) 170px 210px 130px 20px; align-items: center; gap: 14px;
  width: 100%; padding: 10px 6px; cursor: pointer; border-radius: var(--radius-sm); }
.people__head { padding: 8px 6px; border-bottom: 1px solid var(--line); font: 500 12.5px var(--display); color: var(--muted); }
.people__row:hover { background: var(--surface-2); }
.people__row:focus-visible { outline: 2px solid var(--cyan); }
.people__row > .icon { color: var(--muted); }
.people__who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.people__who .who__sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people__role { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.people__how { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.people__lock { color: var(--muted); display: inline-flex; }
.people__seen { color: var(--ink-2); }
li.is-off .people__row { opacity: .65; }
.people__via { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-weight: 700; font-size: 11px; }
.avatar--ghost { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--line-2); }
.role-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.role-card { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 6px; cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.role-card:hover { border-color: var(--indigo-ink); }
.role-card:focus-visible { outline: 2px solid var(--cyan); }
.role-card p { margin: 0; line-height: 1.5; }
.role-card__head { display: flex; align-items: center; gap: 8px; }
.role-card--new { align-items: center; justify-content: center; gap: 6px; min-height: 140px; text-align: center; border: 1.5px dashed #b9bdcb; background: var(--surface); }
.role-card--new:hover { border-color: var(--indigo); background: var(--indigo-tint); }
.role-card--new strong { font: 600 15px var(--display); color: var(--indigo); }
.role-card--new .small { max-width: 260px; line-height: 1.45; }
.role-card__plus { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--indigo); color: #fff; margin-bottom: 4px; box-shadow: 0 4px 12px rgba(35, 36, 92, .25); }
.notice-inline { background: var(--amber-soft); color: var(--amber); border-radius: var(--radius-sm); padding: 8px 12px; margin: 10px 0 0; }
.access__title { font-size: 15px; margin: 18px 0 4px; }
.access { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
.access__group { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.access__ghead { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 8px 12px; background: var(--surface-2); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.access__all { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); font-size: 12.5px; }
.access__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-top: 1px solid var(--line); }
.access__row.is-own { background: #fbfaf2; box-shadow: inset 3px 0 0 var(--amber); }
.access__label { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 14px; font-weight: 600; }
.access__label .small { font-weight: 400; }
.access__note { color: var(--blue); font-weight: 500; }
.access__reset { align-self: flex-start; font-weight: 500; }
.seg--access { flex: none; }
.seg--access button { padding: 6px 10px; font-size: 12.5px; min-width: 38px; text-align: center; }
.seg--access button:disabled { cursor: default; }
.seg--access button.is-on.lv-0 { background: var(--line-2); color: var(--ink-2); }
.access.is-locked .seg--access button:not(.is-on) { color: var(--line-2); }
.request__act { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.request__act select { width: auto; }
/* signing in with Google */
.steps { margin: 4px 0 0; padding-left: 18px; line-height: 1.6; }
.steps li { margin: 3px 0; }
.copyable { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; cursor: copy; word-break: break-all; }
.copyable:hover { border-color: var(--indigo-ink); }
.btn--google { background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); justify-content: center; gap: 10px; }
.btn--google:hover { border-color: var(--indigo-ink); background: var(--surface-2); }
.signin__or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.signin__or::before, .signin__or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
@media (max-width: 760px) {
  .people__how, .people__seen, .people__head { display: none; }
  .people__row { grid-template-columns: minmax(0, 1fr) auto 20px; }
  .access__row { flex-direction: column; align-items: stretch; }
  .seg--access { align-self: flex-start; }
  .request { flex-wrap: wrap; }
  .request__act { width: 100%; justify-content: flex-start; }
}

/* no motion when the device asks for less of it, and none on paper */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
@media print { *, *::before, *::after { animation: none !important; } }

/* ---------- the prospect demo (src/demo.js) ---------- */
.demo-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 9px 20px;
  background: var(--amber-soft); color: #5c3a00; border-bottom: 1px solid #f0d9a8; font-size: 13.5px; line-height: 1.45; }
.demo-bar strong { color: var(--amber); }
.demo-bar span { flex: 1; min-width: 0; }
.demo-bar__cta { flex: none; padding: 6px 12px; border-radius: 999px; background: var(--indigo); color: #fff; font-weight: 600; font-size: 13px; }
.demo-bar__cta:hover { background: var(--indigo-deep); }
.demo-tour { margin-bottom: 16px; border-left: 3px solid var(--amber); }
.demo-tour .card-title { display: flex; align-items: center; justify-content: space-between; }
.demo-tour__list { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; line-height: 1.5; }
.demo-tour__list a { color: var(--cyan-ink); text-decoration: underline; text-underline-offset: 2px; }
.tile__icon.is-amber { background: var(--amber); }
.lead-list { list-style: none; margin: 0; padding: 0; }
.lead-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.lead-list li:first-child { border-top: 0; }
.lead-list li > span { display: flex; flex-direction: column; min-width: 0; }
@media (max-width: 760px) {
  .demo-bar { padding: 8px 14px; font-size: 12.5px; }
  .lead-list li { flex-wrap: wrap; }
}
.scan-full { margin-left: 4px; font-size: 10px; }
.scan-about p { margin: 0 0 10px; }
.scan-about ul { margin: 0 0 12px; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; line-height: 1.5; }
.demo-tour__more { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 0; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: 13.5px; line-height: 1.5; }
.demo-tour__more > .icon { flex: none; margin-top: 2px; color: var(--violet); }
.demo-tour__more a { color: var(--cyan-ink); text-decoration: underline; text-underline-offset: 2px; }

/* how AI scanning works, in three pictures (scan.js, ScanPicture) */
.sill { display: flex; align-items: flex-start; justify-content: center; gap: 10px; margin: 0 0 18px; padding: 20px 14px 16px;
  border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); }
.sill__step { flex: 1 1 0; max-width: 190px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.sill__art { position: relative; width: 100%; height: 156px; display: grid; place-items: center; }
.sill__arrow { align-self: center; margin-top: -26px; color: var(--muted); font-size: 20px; }
.sill figcaption { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); text-align: center; }
.sill figcaption em { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--indigo); color: #fff;
  font: 700 11px var(--display); font-style: normal; flex: none; }
.sill-paper { position: relative; overflow: hidden; width: 116px; height: 150px; padding: 10px; display: flex; flex-direction: column; gap: 6px;
  background: #fff; border: 1px solid var(--line-2); border-radius: 6px; box-shadow: 0 6px 16px rgba(21, 22, 58, .08); transform: rotate(-3deg); }
.sill-paper.is-read { transform: none; }
.sill-paper i { display: block; height: 4px; border-radius: 2px; background: var(--line-2); }
.sill-paper__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.sill-paper__top b { font-size: 6.5px; letter-spacing: .08em; color: var(--ink); white-space: nowrap; }
.sill-paper__rows { display: grid; gap: 5px; margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--line); }
.sill-paper__rows span, .sill-hl { display: flex; gap: 4px; flex-wrap: wrap; }
.sill-hl--who { flex-direction: column; flex: 1; }
.sill-hl--tot { justify-content: flex-end; margin-top: auto; }
/* step 2: what the AI picks out is marked, and a line sweeps down the page */
.is-read .sill-hl { padding: 2px; margin: -2px; border-radius: 3px; background: var(--cyan-soft); outline: 1px solid var(--cyan); }
.is-read .sill-hl i { background: var(--cyan-ink); opacity: .55; }
.sill-beam { position: absolute; left: 0; right: 0; top: 8%; height: 2px; background: var(--cyan); box-shadow: 0 0 0 3px rgba(76, 201, 230, .18);
  animation: sill-sweep 2.6s ease-in-out infinite alternate; }
@keyframes sill-sweep { to { top: 90%; } }
.sill-phone { position: absolute; right: 18px; bottom: 6px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--indigo); color: #fff; box-shadow: 0 4px 10px rgba(21, 22, 58, .2); }
.sill-draft { width: 100%; max-width: 168px; display: flex; flex-direction: column; gap: 7px; padding: 12px; background: #fff;
  border: 1px solid var(--line-2); border-left: 3px solid var(--violet); border-radius: 8px; box-shadow: 0 6px 16px rgba(21, 22, 58, .08); }
.sill-draft strong { font-size: 11.5px; }
.sill-draft__row { display: flex; justify-content: space-between; gap: 6px; font-size: 11px; color: var(--muted); }
.sill-draft__row b { display: inline-flex; align-items: center; gap: 3px; color: var(--ink); font-weight: 600; white-space: nowrap; }
.sill-draft__row .icon { color: var(--green); }
.sill-draft__flag { margin-top: 2px; padding: 4px 7px; border-radius: 6px; background: var(--amber-soft); color: var(--amber); font-size: 10.5px; font-weight: 600; }
@media (max-width: 560px) {
  .sill { flex-direction: column; align-items: center; }
  .sill__step { max-width: 220px; }
  .sill__arrow { margin: -4px 0; transform: rotate(90deg); }
}
@media (prefers-reduced-motion: reduce) { .sill-beam { animation: none; top: 46%; } }
.demo-note { margin: -6px 0 14px; }

/* ---------- a trial firm (worker.js trialOf) ---------- */
.trial-bar { background: var(--blue-soft); color: var(--ink); border-bottom-color: var(--line); }
.trial-bar strong { color: var(--indigo); }
.trial-bar.is-ended { background: var(--amber-soft); color: #5c3a00; border-bottom-color: #f0d9a8; }
.trial-bar.is-ended strong { color: var(--amber); }
.trial-bar__acts { flex: none; display: flex; gap: 8px; }
.firm-new__trial { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.firm-new__trial .check-row { margin: 0; }
.firm-new__trial .check-row > span { display: flex; flex-direction: column; gap: 2px; }
.firm-new__trial-fields { display: flex; flex-wrap: wrap; gap: 10px 20px; margin: 12px 0 0 26px; }
@media (max-width: 600px) { .trial-bar { flex-wrap: wrap; } .trial-bar > span:first-child { flex-basis: 100%; } }

/* ---------- a private link's page (share.html, public/js/share.js) ---------- */
.share-body { background: var(--bg); }
.share-top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.share-top__what { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.share-top__what b { font: 600 16px var(--display); }
.share-top__what span { font-size: 13px; color: var(--muted); }
.share-page { max-width: 900px; margin: 0 auto; padding: 20px 16px 40px; }
.share-note { margin: 14px 4px 0; font-size: 13px; color: var(--muted); text-align: center; }
.share-msg { max-width: 460px; margin: 12vh auto; padding: 0 16px; text-align: center; }
.share-msg .card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px; }
.share-msg h1 { margin: 6px 0 0; font: 600 20px var(--display); }
.share-msg p { margin: 0; color: var(--ink-2); line-height: 1.5; }
@media (max-width: 600px) { .share-page { padding: 12px 8px 32px; } .share-page .paper-stage { padding: 8px; } .share-top { padding: 10px 12px; } }
@media print { .share-page { max-width: none; padding: 0; margin: 0; } }
/* the Share window in the app (public/js/sharing.js) */
.share-dlg { display: flex; flex-direction: column; gap: 14px; }
.share-dlg > p { margin: 0; line-height: 1.55; }
.share-dlg > .btn { align-self: flex-start; }
.share-dlg__url { display: flex; gap: 8px; }
.share-dlg__url input { flex: 1; min-width: 0; font: 500 13px var(--mono); }
.share-dlg__send { display: flex; flex-wrap: wrap; gap: 8px; }
.share-dlg__manage { display: flex; gap: 18px; flex-wrap: wrap; }
@media (max-width: 600px) { .share-dlg__send .btn { flex: 1 1 100%; justify-content: center; } }
.check-row .field__hint { display: block; margin-top: 2px; }
.link-btn.danger-text { color: var(--red); }
/* a list narrowed to one customer or supplier, and a period of dates */
.lfilters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lfilter-party { width: 200px; }
.lfilter-party input, .lfilter-period, .lfilter-dates input { height: 36px; font-size: 13.5px; }
.lfilter-period { width: auto; padding-right: 30px; }
.lfilter-dates { display: inline-flex; align-items: center; gap: 6px; }
.lfilter-dates input { width: 150px; }
.lfilter-chip { display: inline-flex; align-items: center; gap: 4px; height: 36px; max-width: 240px; padding: 0 4px 0 12px; border-radius: var(--radius-sm);
  background: var(--indigo); color: #fff; font-size: 13.5px; font-weight: 600; }
.lfilter-chip button { all: unset; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; cursor: pointer; }
.lfilter-chip button:hover { background: rgba(255, 255, 255, .15); }
.lfilter-chip button:focus-visible { box-shadow: 0 0 0 3px var(--ring); }
@media (max-width: 600px) { .lfilters { width: 100%; } .lfilter-party, .lfilter-period { flex: 1 1 140px; width: auto; } .lfilter-dates { width: 100%; } .lfilter-dates input { flex: 1; width: auto; } }
/* rows ticked on a list: how many, what they add up to, and what to do with them */
.lsel { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 20px; background: var(--indigo-tint); border-bottom: 1px solid var(--line); font-size: 13.5px; }
.table .c-tick { width: 36px; padding-right: 0; }
.table tr.is-ticked td { background: var(--indigo-tint); }
/* importing customers from a spreadsheet (public/js/importer.js) */
.imp-start { display: flex; flex-direction: column; gap: 16px; }
.imp-start > p { margin: 0; line-height: 1.55; }
.imp-start > .link-btn { align-self: flex-start; }
.imp-file { display: flex; align-items: center; gap: 14px; padding: 18px; border: 1.5px dashed var(--line-2); border-radius: var(--radius); cursor: pointer; color: var(--ink-2); }
.imp-file:hover { border-color: var(--indigo); background: var(--indigo-tint); }
.imp-file span { display: flex; flex-direction: column; gap: 2px; }
.imp-file small { font-size: 13px; color: var(--muted); }
.imp-file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.imp-file:focus-within { box-shadow: 0 0 0 3px var(--ring); }
.imp-read { margin-top: 8px; align-self: flex-start; }
.imp-sum { margin: 0 0 10px; }
.imp-table { overflow: auto; max-height: 56vh; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.imp-table th { vertical-align: top; min-width: 150px; background: var(--surface-2, #fafbfc); position: sticky; top: 0; z-index: 1; }
.imp-table th:first-child { min-width: 0; }
.imp-table th select { height: 32px; font-size: 13px; }
.imp-title { display: block; margin-top: 4px; font-size: 13px; font-weight: 400; color: var(--muted); }
.imp-table td { font-size: 13px; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.imp-table tr.is-dim td { opacity: .55; }
.imp-why { width: 1%; }
.imp-done { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; }
.imp-done__big { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 16px; font-weight: 600; color: var(--green); }
/* the VAT return, form 201, box by box (pages.js Vat201) */
.v201 { display: flex; flex-direction: column; gap: 14px; }
.v201__lead { margin: 0; line-height: 1.55; color: var(--ink-2); max-width: 820px; }
.v201 h3 { margin: 10px 0 0; font: 600 15px var(--display); }
.v201__t { border: 1px solid var(--line); border-radius: var(--radius-sm); }
.v201__t td { vertical-align: top; }
.v201__n { width: 64px; font-weight: 600; white-space: nowrap; color: var(--indigo-ink, var(--ink)); }
.v201__note { display: block; margin-top: 3px; font-size: 13px; color: var(--muted); line-height: 1.45; max-width: 620px; }
.v201__total td { font-weight: 700; background: var(--bg); }
.v201__t .num { width: 150px; white-space: nowrap; }
/* comparing two revisions of a quotation */
.cmp-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cmp-table { overflow: auto; max-height: 60vh; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.cmp-table td { vertical-align: top; }
.cmp-cell span, .cmp-cell b { display: block; white-space: nowrap; }
.cmp-cell span { font-size: 13px; color: var(--muted); }
.cmp-was { display: block; }
.cmp-added td { background: var(--green-soft); }
.cmp-removed td { background: var(--red-soft, #fdecea); }
.cmp-removed td:first-child { text-decoration: line-through; text-decoration-color: var(--red); }
.cmp-up { color: var(--ink); font-weight: 600; white-space: nowrap; }
.cmp-down { color: var(--ink); font-weight: 600; white-space: nowrap; }
.cmp-table tfoot td { font-weight: 600; background: var(--bg); }
.cmp-total td { font-size: 15px; }
.notice__acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
/* under a line's description: its VAT category when at 0%, and the account a vendor's line goes to */
.lines__sub { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.lines__sub label { display: inline-flex; align-items: center; gap: 6px; }
.lines__sub select { height: 30px; padding: 0 26px 0 8px; font-size: 13px; width: auto; max-width: 260px; }
.einv-flags { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; }
.einv-flags summary { cursor: pointer; font-size: 13.5px; font-weight: 500; }
.einv-flags__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 16px; margin-top: 8px; }
.einv-flags__list .check-row { margin: 6px 0; }
/* on a tax invoice or credit note: what an e-invoice would still need */
.einv-card h2 .muted { font-weight: 400; }
.einv-gaps { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13px; line-height: 1.45; color: var(--ink-2); }
/* the Accounting card: a document's entries */
.acc-entry { padding: 8px 0; border-top: 1px solid var(--line); }
.acc-entry:first-of-type { border-top: 0; }
.acc-entry__head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.acc-lines { width: 100%; border-collapse: collapse; font-size: 13px; }
.acc-lines td { padding: 2px 0; vertical-align: top; }
.acc-lines td.num { width: 84px; text-align: right; white-space: nowrap; }
.acc-indent { display: inline-block; width: 14px; }
/* the chart of accounts and the trial balance */
.coa-group { margin-bottom: 16px; }
.coa-group__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.coa-group__head h2 { margin: 0 0 2px; font: 600 15px var(--display); }
.coa-code { width: 70px; color: var(--muted); }
.coa-hint { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.books-start { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.books-start > .grow { display: flex; flex-direction: column; gap: 2px; }
.books-start__edit { display: inline-flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.books-start__edit input { height: 34px; width: 160px; }
.tb-total td { font-weight: 700; background: var(--bg); }
.tb-check { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.tb-check > .grow { display: flex; flex-direction: column; gap: 2px; min-width: 240px; }
.tb-check p { margin: 6px 0 0; font-size: 13.5px; font-weight: 600; }
/* a journal's lines (manual journals and the opening balances) */
.jl { border: 0; margin: 14px 0 0; padding: 0; min-width: 0; }
.jl.ob { padding: 12px 20px 4px; margin: 0; }
.jl-head, .jl-row, .jl-foot { display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(140px, 1fr) 120px 120px 32px; gap: 8px; align-items: center; }
.jl-head { font-size: 13px; color: var(--muted); padding: 0 0 6px; border-bottom: 1px solid var(--line); }
.jl-row { padding: 6px 0; border-bottom: 1px solid var(--line-soft, var(--line)); }
.jl-row select, .jl-row input, .jl-row .combo input { height: 36px; font-size: 13.5px; min-width: 0; }
.jl-amt { text-align: right; }
.jl-foot { padding: 8px 0; font-weight: 600; }
.jl-foot .link-btn { grid-column: 1 / 3; justify-self: start; }
.jl-foot .grow { display: none; }
.jl-sum { text-align: right; padding-right: 12px; }
.jl-check { margin: 4px 0 0; font-size: 13.5px; font-weight: 600; }
.jv-lines { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
@media (max-width: 760px) {
  .jl-head { display: none; }
  .jl-row { grid-template-columns: 1fr 1fr 32px; }
  .jl-row .jl-acc, .jl-row .jl-party, .jl-row .jl-memo { grid-column: 1 / 3; }
  .jl-row > .icon-btn { grid-column: 3; grid-row: 1; }
  .jl-foot { grid-template-columns: 1fr 1fr; } .jl-foot .link-btn { grid-column: 1 / 3; } .jl-sp { display: none; }
}
/* an expense */
.exp-form__set { border: 0; padding: 0; margin: 0; min-width: 0; }
.exp-vat { margin: 4px 0 8px; }
.exp-total b { font-size: 18px; padding-top: 6px; }
.exp-files { margin-top: 16px; }
/* the section templates list: a long name wraps rather than pushing the other columns out of the card */
.tpl-cell { width: 100%; }
.tpl-cell .tpl-name { white-space: normal; overflow-wrap: anywhere; }
.tpl-cell .who__text { min-width: 0; }
/* the statements: profit and loss, balance sheet */
.st td { padding-top: 9px; padding-bottom: 9px; }
.st .st-head td { padding-top: 18px; font: 600 13px var(--display); color: var(--muted); text-transform: none; border-bottom: 1px solid var(--line); }
.st .st-code { margin-right: 6px; }
.st .st-sub td { font-weight: 600; background: var(--bg); }
.st .st-total td { font-weight: 700; border-top: 2px solid var(--line-2); }
.st .st-net td { font-size: 15px; }
.pl-change { font-weight: 600; white-space: nowrap; }
.st-compare { margin: 0 0 0 auto; }
@media (max-width: 600px) { .st-compare { margin: 0; } }
/* bank reconciliation (public/js/bank.js) */
.bank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.bank-acc { display: flex; flex-direction: column; gap: 10px; }
.bank-acc__head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.bank-acc__head h2 { margin: 0 0 2px; font: 600 15px var(--display); }
.bank-acc__bal { display: flex; flex-direction: column; align-items: flex-end; }
.bank-acc__bal b { font-size: 18px; }
.bank-acc > .btn { align-self: flex-start; }
.bank-sts { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.bank-sts li + li { border-top: 1px solid var(--line); }
.bank-sts a { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 12px; color: var(--ink); font-size: 13.5px; }
.bank-sts a:hover { background: var(--bg); }
.bank-sts a .badge { justify-self: start; }
.bank-sts a b { grid-column: 2; grid-row: 1; text-align: right; }
.bank-lines td { vertical-align: top; }
.bank-lines tr.is-done td { background: var(--green-soft); }
.bank-act { min-width: 280px; }
.bank-match { display: flex; align-items: flex-start; gap: 6px; color: var(--green); font-size: 13.5px; }
.bank-match > span { flex: 1; color: var(--ink-2); }
.bank-match .icon-btn { margin-top: -4px; }
.bank-match a { color: var(--ink); }
.bank-sugg { display: block; font-size: 13px; margin-bottom: 6px; color: var(--ink-2); }
.bank-btns { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.bank-pending { margin-top: 16px; }
.bank-find { list-style: none; margin: 12px 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); max-height: 50vh; overflow: auto; }
.bank-find li + li { border-top: 1px solid var(--line); }
.bank-find label { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; font-size: 13.5px; }
.bank-find label > span:first-of-type { flex: 1; }
.bank-find label:hover { background: var(--indigo-tint); }
.bank-find label.is-on { background: var(--indigo-soft); }
.bank-find label:focus-within { box-shadow: inset 0 0 0 2px var(--ring); }
.bank-find input:disabled + span { opacity: .6; }
.bank-tally { font-size: 13.5px; display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.bank-tally.ok { color: var(--green); font-weight: 600; }
.bank-group { list-style: none; margin: 6px 0 0; padding: 0 0 0 2px; display: grid; gap: 4px; }
.bank-remember { display: grid; gap: 6px; margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.bank-remember input:not([type]) { width: 100%; }
.bank-reading { display: flex; gap: 16px; align-items: center; padding: 28px 8px; }
.bank-reading p { margin: 0; }
.imp-file--main { border-style: solid; border-color: var(--indigo); background: var(--indigo-tint); }
.tag--indigo { background: var(--indigo-soft); color: var(--indigo); }
.callout--green { background: var(--green-soft); border-color: #bfe3d2; color: #0b4d33; }
.bank-sugg .tag { margin-right: 4px; }
.bank-imp-bal { margin-top: 14px; align-items: start; }
@media (max-width: 600px) { .bank-act { min-width: 0; } .bank-grid { grid-template-columns: 1fr; } }
.imp-prev > .callout { margin-bottom: 12px; }
.modal .method-chips + .search, .modal .method-chips + .field { margin-top: 14px; }
/* closing the books (public/js/ledger.js ClosingBooks) */
.close-figure { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); margin-bottom: 14px; }
.close-figure span { color: var(--ink-2); font-size: 13.5px; }
.close-figure b { font: 600 22px var(--display); font-variant-numeric: tabular-nums; }
.close-figure small { font-size: 13px; color: var(--muted); margin-right: 4px; font-weight: 500; }
.close-sec { margin-top: 16px; }
@media (max-width: 600px) { .table--cards td.close-act { grid-column: 1 / -1; grid-row: auto; text-align: left; display: flex; gap: 12px; align-items: center; margin-top: 6px; } }
/* e-invoices (public/js/einvoice.js) */
.einv-btns { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 6px; }
.einv-problems { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.einv-problems li { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.einv-tabs { margin: 14px 0 12px; }
.einv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 12px; }
.einv-box { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.einv-box--hi { border-color: var(--indigo); background: var(--indigo-tint); }
.einv-box h3 { margin: 0 0 8px; font: 600 13px var(--display); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.einv-box dl { margin: 0; display: grid; grid-template-columns: minmax(80px, 38%) 1fr; gap: 4px 12px; font-size: 13.5px; }
.einv-box dt { color: var(--muted); }
.einv-box dd { margin: 0; overflow-wrap: anywhere; }
.einv-lines { margin-bottom: 12px; }
.einv-xml { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.einv-xml__bar { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--bg); }
.einv-xml pre { margin: 0; padding: 12px 14px; max-height: 55vh; overflow: auto; font: 12.5px/1.5 var(--mono); white-space: pre; background: var(--paper, #fff); }
.einv-chips { margin: 14px 0 10px; }
.einv-state { display: inline-flex; gap: 8px; align-items: center; }
.einv-badge { border: 0; cursor: pointer; font: inherit; }
.einv-badge:focus-visible { box-shadow: 0 0 0 3px var(--ring); }
/* the phone's sheets: each page can be pinned (pinned ones come first in More) */
.psheet__tile { position: relative; }
.psheet__tile a { padding-right: 38px; }
.psheet__pin { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: 8px; background: none; color: var(--muted-2); cursor: pointer; }
.psheet__tile.is-pinned .psheet__pin { color: var(--indigo); }
.psheet__tile.is-pinned .psheet__pin .icon { fill: currentColor; }
.chart__col { position: relative; }
.chart__tip { position: absolute; bottom: calc(100% - 4px); left: 50%; transform: translateX(-50%); padding: 4px 8px; border-radius: 6px; background: var(--night);
  color: #fff; font: 500 12.5px var(--display); white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .1s ease; z-index: 2; }
.chart__col:hover .chart__tip { opacity: 1; }
.chart__col:first-child .chart__tip { left: 0; transform: none; }
.chart__col:last-child .chart__tip { left: auto; right: 0; transform: none; }
/* the document's side column: Full or Compact (public/js/documents.js) */
.view-mode { display: flex; justify-content: flex-end; }
.sec:empty { display: none; }
.jump { display: flex; flex-direction: column; gap: 6px; }
.jump__t { font: 600 11px var(--display); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.jump__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.jump__chips .chip { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dot--bad { background: var(--red); }
.dot--warn { background: var(--amber); }
.dot--good { background: var(--green); }
.scroll-pill { position: fixed; left: 0; right: 0; margin: 0 auto; width: max-content; bottom: 20px; z-index: 30; box-sizing: border-box; display: flex; align-items: center; gap: 8px;
  max-width: calc(100vw - 32px); padding: 9px 16px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 6px 20px rgba(16, 19, 43, .14); font: 500 13px var(--display); color: var(--ink); cursor: pointer; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; animation: pop .16s ease; }
.scroll-pill .icon { color: var(--indigo); flex: none; }
@media (max-width: 760px) { .scroll-pill { bottom: calc(76px + env(safe-area-inset-bottom)); } .jump__chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } }
.folds { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.fold + .fold { border-top: 1px solid var(--line-3); }
.fold__row { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 14px; cursor: pointer; }
.fold__row:hover { background: var(--surface-2); }
.fold__row:focus-visible { box-shadow: inset 0 0 0 2px var(--ring); }
.fold__title { flex: 1; font: 500 14px var(--display); color: var(--ink); }
.fold__sum { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); max-width: 55%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fold__sum.is-bad { color: var(--red); }
.fold__sum.is-warn { color: var(--amber); }
.fold__sum.is-good { color: var(--green); }
.fold__row > .icon { color: var(--muted-2); flex: none; }
.fold__body { padding: 0 2px 4px; }
.fold__body > .sc, .fold__body > * > .sc { border: 0; box-shadow: none; margin: 0; padding-top: 4px; }
.fold__body .sc > h2:first-child { display: none; }
.status-pill { display: inline-flex; align-items: center; gap: 2px; padding: 0; border: 0; background: none; cursor: pointer; vertical-align: middle; }
.status-pill:hover .badge { filter: brightness(.96); }
.status-pill:focus-visible { outline: 2px solid var(--ring); border-radius: 99px; }
.scroll-pill span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* a quotation with options (public/js/documents.js QuoteLines, OptionsEditor, ChooseCard) */
.quote-lines { display: flex; flex-direction: column; gap: 12px; }
.quote-mode { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.opts-edit { display: flex; flex-direction: column; gap: 14px; }
.opt-edit { display: flex; flex-direction: column; gap: 8px; }
.opt-edit__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 2px 2px 0; }
.opt-edit__letter { font: 700 13px var(--display); color: #fff; background: var(--indigo); padding: 4px 10px; border-radius: 99px; }
.opt-edit__name { flex: 1; min-width: 180px; max-width: 320px; font-weight: 600; }
.opt-edit__rec { margin: 0; }
.opt-edit__why { width: 100%; }
.opts-edit__add { align-self: flex-start; }
.opt-tag { display: inline-block; padding: 2px 8px; border-radius: 99px; background: var(--indigo-soft); color: var(--indigo); font: 600 12px var(--display);
  vertical-align: middle; white-space: nowrap; }
.opt-tot { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.opt-tot th, .opt-tot td { padding: 6px 4px; border-bottom: 1px solid var(--line-3); }
.opt-tot th { font-weight: 600; color: var(--muted); }
.opt-tot__grand td { font-weight: 700; color: var(--ink); border-bottom: 0; }
.choose-card__opts { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.choose-card__opt { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); font: inherit; text-align: left; cursor: pointer; }
.choose-card__opt:hover:not(:disabled) { border-color: var(--indigo); background: var(--indigo-tint); }
.choose-card__opt:focus-visible { box-shadow: 0 0 0 3px var(--ring); }
.choose-card__opt.is-rec { border-color: var(--indigo); }
.choose-card__done { display: flex; align-items: center; gap: 6px; margin: 6px 0 4px; color: var(--ink); }
.choose-card__done .icon { color: var(--green); }
.choose-card__foot { font-size: 13px; }

/* ---------- a new firm's setup (public/js/setup.js) ---------- */
.setup { padding: 22px 24px 18px; display: grid; gap: 18px; margin-bottom: 16px; }
.setup__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.setup__head h2 { margin: 0; font: 600 19px var(--heading); color: var(--ink); }
.setup__head p { margin: 2px 0 0; }
.setup__prog { display: grid; gap: 6px; min-width: 220px; font-size: 13px; color: var(--ink-2); }
.setup__bar { display: block; height: 6px; border-radius: 99px; background: var(--fill-2); overflow: hidden; }
.setup__bar i { display: block; height: 100%; background: var(--green); border-radius: 99px; transition: width .3s; }
.setup__group h3 { margin: 0 0 4px; font: 600 12px var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.setup__group ol { list-style: none; margin: 0; padding: 0; }
.setup__group li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line-3); }
.setup__group li:first-child { border-top: 0; }
.setup__ring { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; color: #fff; }
.setup__group li.is-done .setup__ring { background: var(--green); border-color: var(--green); }
.setup__text { display: grid; gap: 1px; min-width: 0; color: inherit; text-decoration: none; }
.setup__text:hover b { color: var(--link); }
.setup__text b { font-weight: 600; font-size: 14px; color: var(--ink); }
.setup__text > span { font-size: 13px; color: var(--muted); }
.setup__group li.is-done .setup__text b { color: var(--muted); font-weight: 500; }
.setup__acts { display: flex; align-items: center; gap: 12px; }
.setup__ok { font-size: 13px; color: var(--green); font-weight: 500; }
.setup__foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line-3); padding-top: 12px; }
.setup--done { display: flex; align-items: center; gap: 10px; padding: 14px 18px; color: var(--green); background: var(--green-soft); border-color: transparent; }
.setup--done b { color: var(--green); font-weight: 600; }
.setup--done .link-btn { margin-left: auto; }
.dash-calm { display: flex; align-items: center; gap: 10px; padding: 14px 18px; margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.setup-banner { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--indigo-soft); color: var(--indigo-ink); font-size: 13.5px; max-width: 1240px; }
.setup-banner b { font-weight: 600; }
.setup-banner__n { flex: none; font-weight: 600; font-size: 12.5px; padding: 3px 9px; border-radius: 99px; background: var(--surface); color: var(--indigo); display: inline-flex; align-items: center; }
.setup-banner.is-done { background: var(--green-soft); color: var(--green); }
.setup-banner.is-done .setup-banner__n { color: var(--green); }
.setup-banner .link-btn { flex: none; white-space: nowrap; }
.setup-start__acts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
@media (max-width: 600px) {
  .setup { padding: 16px; gap: 14px; }
  .setup__group li { grid-template-columns: 22px minmax(0, 1fr); padding: 9px 0; }
  .setup__acts { grid-column: 2; }
  .setup__acts:not(:has(.link-btn)) { display: none; }
  .setup__acts .btn, .setup__ok { display: none; }
  .setup__group li.is-done .setup__text > span { display: none; }
  .setup__next.phone-only { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); display: flex !important; justify-content: center; align-items: center; gap: 6px; width: 100%; }
  .setup-banner { flex-wrap: wrap; margin: 0 0 12px; }
  .setup-banner .grow { flex-basis: 100%; order: 2; }
}

/* ---------- Duplicate: an unsaved copy, and where a copy came from ---------- */
.copy-line { display: block; margin: -6px 0 14px; font-size: 13px; color: var(--muted); }
.copy-line > svg { vertical-align: -2px; margin-right: 6px; }
.copy-line a { color: var(--link); font-weight: 500; }
.copy-line--warn { color: var(--amber); background: var(--amber-soft); padding: 8px 12px; border-radius: var(--radius-sm); margin-top: 0; }
.copy-line--warn a { color: var(--amber); text-decoration: underline; }
.copy-line--sub { margin: 4px 0 0; font-weight: 400; }
.confirm__alt { margin-right: auto; }

/* ---------- where a document came from: hover preview, and "already made" ---------- */
.doc-hover { position: fixed; z-index: 250; width: 320px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-md); display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; font-size: 13px; animation: fade .12s ease; }
.doc-hover__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
.doc-hover__party { font-weight: 500; color: var(--ink); }
.doc-hover__lines { list-style: none; margin: 2px 0 0; padding: 6px 0 0; border-top: 1px solid var(--line-3); display: grid; gap: 3px; }
.doc-hover__lines li { display: flex; justify-content: space-between; gap: 10px; color: var(--ink-2); }
.doc-hover__lines li > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-hover__lines li > span.mono { flex: none; }
.doc-hover__lines { grid-template-columns: minmax(0, 1fr); }
.doc-hover__head b { min-width: 0; }
.doc-hover__head .mono { white-space: nowrap; }
.doc-hover__head .badge { flex: none; }
.doc-hover__party { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-hover__total { display: flex; justify-content: space-between; padding-top: 6px; border-top: 1px solid var(--line-3); }
.doc-hover__acts { display: flex; gap: 8px; margin-top: 4px; }
.doc-hover--sheet { top: auto !important; left: 0 !important; right: 0; bottom: 0; width: auto; border-radius: 16px 16px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px)); }
.hover-scrim { position: fixed; inset: 0; z-index: 249; background: rgba(16, 19, 43, .3); }
.confirm--wide { max-width: 520px; }
.again-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; }
.again-list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.again-list li > span:nth-child(2) { display: flex; gap: 14px; }
.again-list__note { flex-basis: 100%; }
@media print { .doc-hover, .hover-scrim { display: none !important; } }

/* ---------- How will they pay? (a proforma for an advance, or the tax invoice straight away) ---------- */
.flow__choice { display: flex; align-items: center; gap: 10px; text-align: left; height: auto; padding-top: 9px; padding-bottom: 9px; margin-top: 8px; }
.flow__choice > span { flex: 1; min-width: 0; display: grid; gap: 1px; white-space: normal; }
.flow__choice > svg { flex: none; }
.flow__choice small { font-size: 12.5px; font-weight: 400; opacity: .8; }
.is-skip .flow__dot { border: 1.5px dashed var(--line-2); color: var(--muted); }

/* ---------- Settings → Document names ---------- */
.names { display: grid; gap: 14px; max-width: 640px; }
.names__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.names__row--locked { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--fill); color: var(--muted); font-size: 13.5px; }
.more-kept { display: flex; gap: 10px; padding: 10px 4px; color: var(--ink-2); }
.more-kept > .icon { flex: none; margin-top: 2px; color: var(--muted); }
.more-kept .grow { display: grid; gap: 3px; }
.more-kept small { color: var(--muted); font-size: 12.5px; }
.more-kept__btn { justify-self: start; margin-top: 6px; }
.confirm .field { margin-top: 10px; }
.gap-row td { padding: 6px 14px !important; font-size: 12.5px; color: var(--muted); background: var(--surface-2); border-top: 1px dashed var(--line-2); }
.gap-row:hover td { background: var(--surface-2); }
.sc__acts { display: inline-flex; gap: 14px; align-items: center; margin-left: auto; }
.sc > h2 .sc__acts { float: right; font-size: 13px; }
.pay-list li .link-btn.small { align-self: center; font-size: 12.5px; }
.is-grey .mono { color: var(--muted); }

/* ---------- Undo this job: the job's documents as steps, newest first ---------- */
.undo-steps { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.undo-steps li { display: flex; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.undo-steps li.is-next { border-color: var(--indigo); box-shadow: 0 0 0 3px var(--ring); }
.undo-steps li.is-later { opacity: .75; }
.undo-steps .grow { display: grid; gap: 3px; }
.undo-steps__n { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; border: 1.5px solid var(--line-2); color: var(--muted); }
.undo-steps li.is-done .undo-steps__n { background: var(--green); border-color: var(--green); color: #fff; }
.undo-steps li.is-next .undo-steps__n { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.undo-steps__acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.undo-steps__ok { color: var(--green); font-size: 13px; font-weight: 500; }

/* ---------- Choose pages: rearranging ---------- */
.choose-pages { width: 410px; }
.choose-pages li { gap: 8px; position: relative; border-radius: var(--radius-sm); }
.choose-pages li > .grow { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.choose-pages li > span:first-of-type.choose-moves { flex: none; }
.choose-grip { all: unset; cursor: grab; display: grid; place-items: center; width: 18px; height: 28px; color: var(--faint); border-radius: 4px; }
.choose-grip:focus-visible { box-shadow: 0 0 0 2px var(--ring); color: var(--ink); }
.choose-moves { display: inline-flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.choose-moves .icon-btn { width: 24px; height: 24px; }
.choose-pages li:hover .choose-moves, .choose-pages li:focus-within .choose-moves { opacity: 1; }
@media (hover: none) { .choose-moves { opacity: 1; } }
.choose-pages li.is-dragging { opacity: .45; }
.choose-pages li.drop-before::before, .choose-pages li.drop-after::after { content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--indigo); }
.choose-pages li.drop-before::before { top: -1px; } .choose-pages li.drop-after::after { bottom: -1px; }
.choose-pages__resets { display: grid; gap: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.vat-adv { margin-bottom: 16px; align-items: flex-start; }
.vat-adv .grow { display: grid; gap: 4px; }
.vat-adv__acts { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 6px; }
.vat-adv__list { margin: 6px 0 0; padding-left: 18px; font-size: 13px; display: grid; gap: 3px; }

/* ---------- Help (public/js/help.js) ---------- */
.help-topics { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.help-topic h2 { margin: 0 0 8px; font: 600 16px var(--heading); }
.help-topic ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.help-topic a { display: grid; gap: 1px; padding: 8px 10px; margin: 0 -10px; border-radius: var(--radius-sm); color: inherit; text-decoration: none; }
.help-topic a:hover { background: var(--surface-2); }
.help-topic a b { font-weight: 600; color: var(--ink); font-size: 14px; }
.help-topic a span { font-size: 13px; color: var(--muted); }
.help-foot { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.guide { display: grid; gap: 12px; font-size: 14.5px; line-height: 1.6; max-width: 640px; }
.guide h1 { margin: 0; }
.guide__when { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--indigo-tint); }
.guide__steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.guide__related { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.guide-scrim { position: fixed; inset: 0; z-index: 240; background: rgba(16, 19, 43, .25); }
.guide-panel { position: fixed; z-index: 241; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); background: var(--surface); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: fade .12s ease; }
.guide-panel header { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.guide-panel header b { flex: 1; font: 600 16px var(--heading); }
.guide-panel__body { padding: 16px; overflow-y: auto; }
@media (max-width: 600px) { .guide-panel { top: auto; height: 82vh; width: 100vw; border-radius: 16px 16px 0 0; } }
.help-link { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--link); vertical-align: middle; }
.help-link:hover { text-decoration: underline; }
.help-link__q { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid currentColor; font-size: 11.5px; font-weight: 700; line-height: 1; }
.page-head h1 .help-link { margin-left: 6px; }
.flow__body .help-link { margin-top: 8px; }
@media print { .guide-panel, .guide-scrim, .help-link { display: none !important; } }

/* ---------- the practice firm ---------- */
.practice-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 9px 20px; background: #fdf1c7; color: #6b4e00; font-size: 13.5px; border-bottom: 1px solid #f1d98a; }
.practice-bar .link-btn { color: #6b4e00; text-decoration: underline; }
.practice-bar__btn { background: #fff; border: 1px solid #e8cc6e; color: #6b4e00; }
.tag--practice { background: #fbe29a; color: #5e4400; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; }
.firm__logo--practice { background: #fbe29a !important; color: #5e4400 !important; }
.firm__item--practice { padding-left: 22px; }
.firm__add small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; white-space: normal; }
.firm__note { margin: 4px 10px 6px; font-size: 12px; color: var(--muted); line-height: 1.45; }

/* ---------- Start fresh (public/js/setup.js) ---------- */
.fresh { display: grid; gap: 12px; font-size: 14px; }
.fresh p { margin: 0; }
.fresh__cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.fresh__cols > div { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.fresh__cols ul { margin: 6px 0 0; padding-left: 18px; font-size: 13.5px; display: grid; gap: 2px; }
.fresh.is-locked { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--fill); color: var(--ink-2); }
.fresh.is-locked > .icon { flex: none; margin-top: 2px; color: var(--muted); }
.fresh--practice { display: flex; gap: 10px; align-items: center; }
.btn--danger-outline { border: 1px solid var(--red-line); color: var(--red); background: var(--surface); }
.btn--danger-outline:hover { background: var(--red-soft); }
.fresh-line { display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin: 0 0 16px; color: var(--green); background: var(--green-soft); border-color: transparent; font-size: 14px; }
.setup__practice { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: #fdf6dc; font-size: 13.5px; color: #6b4e00; }
.check-row { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; margin-top: 8px; }
.issue-first { display: grid; gap: 8px; margin-top: 4px; }
.issue-first .help-link { white-space: normal; line-height: 1.4; }

/* Settings in the demo: the sample company's details are locked (public/js/pages.js Settings) */
.lockset { display: contents; border: 0; margin: 0; padding: 0; min-width: 0; }
.lockset:disabled .field__label svg { vertical-align: -1px; color: var(--muted); }

/* E-invoicing panel (public/js/integrations.js EinvoicingPanel) and the Home reminder */
.einv-choice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.einv-choice.is-on { border-color: var(--indigo, #23245c); background: var(--fill); }
.einv-choice.is-off { opacity: .6; cursor: default; }
.einv-choice > span { display: grid; gap: 2px; }
.einv-choice input { margin-top: 3px; }
.einv-needed { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.einv-needed li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--danger, #b42318); }
.einv-needed li.is-ok { color: var(--ok, #0f6b47); }
.einv-needed li .grow { color: var(--ink); }
.einv-dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 13.5px; margin: 10px 0; }
.einv-dl dt { color: var(--muted); }
.einv-dl dd { margin: 0; }
.einv-sample { margin-top: 6px; }
.einv-remind { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.einv-check { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 13.5px; }
/* a line with no price (section 50) */
.lines__row.is-unpriced .c-rate input { border-color: #E9B44C; background: var(--amber-soft); }
.lines__noprice { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-top: 6px; font-size: 13px; color: var(--amber); }
.lines__noprice svg { color: var(--amber); flex: none; }
.tot-noprice { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--amber-soft); color: var(--amber); font-size: 13px; }
.tot-noprice svg { flex: none; }
.zero-fix { margin: 0 0 14px; }
.zero-fix__btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.fix-steps { margin: 0 0 14px; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; line-height: 1.5; }
.callout--amber .icon, .tot-noprice .icon { color: var(--amber); }
/* a purchase order: invoiced so far, the goods tick (section 51) */
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.mini-table th { text-align: left; font-weight: 500; color: var(--muted); padding: 6px 4px; border-bottom: 1px solid var(--line); }
.mini-table th.num, .mini-table td.num { text-align: right; width: 64px; }
.mini-table td { padding: 7px 4px; border-bottom: 1px solid var(--line-3); }
.mini-table td.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goods-tick { margin: 10px 0 4px; }

/* ---------- while Binary Books is being updated (section 52) ---------- */
.upkeep { min-height: 100vh; display: flex; background: var(--bg); }
.upkeep__art { flex: 0 1 520px; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; padding: 40px 48px;
  background: var(--indigo-deep); color: #fff; }
.upkeep__art .brand { padding: 0; }
.upkeep__pitch { display: flex; flex-direction: column; gap: 14px; }
.upkeep__pitch h1 { margin: 0; font: 600 34px/1.2 var(--heading); letter-spacing: -.01em; color: #fff; }
.upkeep__pitch p { margin: 0; font-size: 15px; line-height: 1.6; color: #c5c7e6; }
.upkeep__foot { margin: 0; font-size: 12.5px; color: #8c8fb8; }
.upkeep__side { flex: 1; min-width: 0; display: grid; place-items: center; padding: 32px 16px; }
.upkeep__card { width: 100%; max-width: 520px; box-sizing: border-box; display: flex; flex-direction: column; gap: 18px; padding: 36px 36px 30px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface); text-align: center; }
.upkeep__icon { color: var(--indigo); display: grid; place-items: center; }
.upkeep__card h2 { margin: 0; font: 600 26px/1.25 var(--heading); letter-spacing: -.01em; }
.upkeep__card > p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--ink-2); }
.upkeep__progress { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.upkeep__bar { height: 6px; border-radius: 3px; background: var(--line-3); overflow: hidden; }
.upkeep__bar i { display: block; height: 100%; width: 38%; border-radius: 3px; background: var(--indigo); animation: upkeep-move 1.8s ease-in-out infinite alternate; }
@keyframes upkeep-move { from { margin-left: 0; } to { margin-left: 62%; } }
@media (prefers-reduced-motion: reduce) { .upkeep__bar i { animation: none; } }
.upkeep__retry { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
.upkeep__note { margin: 0; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; text-align: left;
  font-size: 14px; line-height: 1.5; color: var(--ink-2); background: var(--bg); border: 1px solid var(--line); }
.upkeep__note .icon { flex: none; margin-top: 3px; color: var(--muted); }
.upkeep__phone-brand { display: none; }
@media (max-width: 760px) {
  .upkeep__art { display: none; }
  .upkeep__card { border: 0; background: transparent; padding: 24px 8px; }
  .upkeep__phone-brand { display: flex; align-items: center; justify-content: center; gap: 8px; font: 700 13px var(--heading); letter-spacing: .08em; }
  .upkeep__retry .btn { width: 100%; height: 48px; justify-content: center; }
}
.upkeep-bar { display: flex; align-items: center; gap: 12px; padding: 10px 24px; font-size: 14px; line-height: 1.45;
  background: #eef0fb; color: #23245c; border-bottom: 1px solid #d9dcf3; }
.upkeep-bar > span { flex: 1; min-width: 0; }
.upkeep-bar--soon { background: #fff6e5; color: #5c3a00; border-bottom-color: #f0d9a8; }
.upkeep-wait { position: fixed; z-index: 60; left: 50%; bottom: 92px; transform: translateX(-50%); width: min(760px, calc(100vw - 32px)); box-sizing: border-box;
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-md); }
@media (min-width: 1101px) { .upkeep-wait { left: calc(50% + 120px); } }
@media (max-width: 760px) { .upkeep-wait { bottom: calc(150px + env(safe-area-inset-bottom, 0px)); flex-wrap: wrap; } }
.upkeep-wait > .icon { flex: none; color: var(--indigo); }
.upkeep-wait b { display: block; font-size: 14.5px; }
.email-test__acts { margin-top: 10px; }
