/*
 * Laxmi: the one stylesheet (S0 section 10). Link it with {% asset "css/laxmi.css" %}.
 *
 * R1-UI1 (D157): the new look, "bright white with deep blue" (docs/spec/R1-new-look/README.md).
 * Colours live only in the variables below. Text contrast: every text / background pair is at
 * least 4.5:1 (listed and tested in core/contrast.py). The border colours and the alert red are
 * decoration only (borders, dots, lines), never text.
 * Sizes: html is 16 px on a phone and 14 px from 768 px, so rem sizes follow; controls are 36 px
 * high on a computer and 44 px on a phone or with a coarse pointer.
 *
 * Every box that scrolls sideways also has position: relative (the method's phone-width lesson).
 */

@font-face {
  font-family: "Inter";
  src: url("../vendor/inter/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* R1-UI1 (D157): the new look's tokens (docs/spec/R1-new-look/README.md, "Tokens") */
  --page: #F6F7F9;
  --card: #FFFFFF;
  --border: #E4E7EC;
  --row-line: #EEF0F3;
  --table-head: #F9FAFB;
  --text: #101828;
  --text-secondary: #475467;
  --muted: #5D6B82;
  --primary: #1D4ED8;
  --primary-hover: #1E40AF;
  --primary-soft: #EFF4FF;
  --primary-soft-border: #C7D7FE;
  --on-primary: #FFFFFF;
  --money-in: #067647;
  --money-in-soft: #ECFDF3;
  --money-out: #B42318;
  --money-out-soft: #FEF3F2;
  --danger-border: #FDA29B;
  --waiting: #B54708;
  --waiting-soft: #FFFAEB;
  --waiting-border: #FEDF89;
  --approved: #175CD3;
  --approved-soft: #EFF8FF;
  --neutral-soft: #F2F4F7;
  --alert-dot: #D92D20;

  --radius: 12px;
  --radius-small: 8px;
  --space: 16px;
}

/* B-234, Release 2.0 T1 (START-HERE 4.26; D182, D187, D284): the "Maroon" theme, the person's own
   choice (My Profile): the brand colours only (Q14: the money, status and warning colours stay);
   on screens only, so a printed page stays as it is in Blue. The Laxmi lamp is maroon and gold in
   both themes already. */
@media screen {
  [data-theme="maroon"] {
    --primary: #8A1C33;
    --primary-hover: #6E1529;
    --primary-soft: #FBEFF2;
    --primary-soft-border: #F1C7D1;
  }
}

/* C-349 tokens (C018 section 1, the rulebook; D419). Every number here is the rule. The parts
   below (C-349 parts) use only these; the pages move onto them in C018's sweep (section 4.4). */
:where(:root) {
  /* 1.1 colour: the brand (the theme's), the neutrals, the area colours with their tints (about 8 %
     on white; Billing, Items & Stock and Capital Assets as the spec gives them), the status colours */
  --lx-brand: #1D4ED8;
  --lx-brand-hover: #1E40AF;
  --lx-brand-tint: #EFF4FF;
  --lx-brand-line: #C7D7FE;
  --lx-on-brand: #FFFFFF;
  --lx-text: #111827;
  --lx-text-secondary: #4B5563;
  --lx-muted: #6B7280;
  --lx-input-border: #8A94A6;
  --lx-line: #E5E7EB;
  --lx-page: #F6F7F9;
  --lx-card: #FFFFFF;
  --lx-locked: #F2F4F7;
  --lx-area-home: #1D4ED8;
  --lx-area-home-tint: #EDF1FC;
  --lx-area-company: #1D4ED8; /* B-274, C024 section 2: Home's blue */
  --lx-area-company-tint: #EDF1FC;
  --lx-area-payments: #C2410C;
  --lx-area-payments-tint: #FAF0EC;
  --lx-area-receipts: #0F766E;
  --lx-area-receipts-tint: #ECF4F3;
  --lx-area-contra: #4F46E5;
  --lx-area-contra-tint: #F1F0FD;
  --lx-area-receipt-due: #0E7490;
  --lx-area-receipt-due-tint: #ECF4F6;
  --lx-area-payment-due: #B45309;
  --lx-area-payment-due-tint: #F9F1EB;
  --lx-area-loans: #7C3AED;
  --lx-area-loans-tint: #F5EFFE;
  --lx-area-accounts: #0369A1;
  --lx-area-accounts-tint: #EBF3F7;
  --lx-area-employees: #BE185D;
  --lx-area-employees-tint: #FAEDF2;
  --lx-area-statements: #475569;
  --lx-area-statements-tint: #F0F1F3;
  --lx-area-reminders: #A16207;
  --lx-area-reminders-tint: #F7F2EB;
  --lx-area-accountant: #4D7C0F;
  --lx-area-accountant-tint: #F1F5EC;
  --lx-area-settings: #4B5563;
  --lx-area-settings-tint: #F1F1F3;
  --lx-area-billing: #A21CAF;
  --lx-area-billing-tint: #FBEAFD;
  --lx-area-stock: #92400E;
  --lx-area-stock-tint: #FBF0E6;
  --lx-area-assets: #155E75;
  --lx-area-assets-tint: #E6F2F6;
  --lx-area-backup: #4B5563;
  --lx-area-backup-tint: #F1F1F3;
  --lx-status-green: #067647;
  --lx-status-green-tint: #ECFDF3;
  --lx-status-amber: #B54708;
  --lx-status-amber-tint: #FFFAEB;
  --lx-status-red: #B42318;
  --lx-status-red-tint: #FEF3F2;
  --lx-status-blue: #175CD3;
  --lx-status-blue-tint: #EFF8FF;
  --lx-status-grey: #4B5563;
  --lx-status-grey-tint: #F2F4F7;
  /* 1.2 type: Inter with same-width figures; six sizes only */
  --lx-font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --lx-figures: tabular-nums;
  --lx-fs-title: 24px;
  --lx-fs-figure: 20px;
  --lx-fs-heading: 16px;
  --lx-fs-body: 14px;
  --lx-fs-label: 13px;
  --lx-fs-small: 12px;
  --lx-weight-regular: 400;
  --lx-weight-medium: 500;
  --lx-weight-semibold: 600;
  --lx-line-height: 1.45;
  --lx-letter-caps: 0.04em;
  /* 1.3 spacing (steps of 4 and 8) and shape */
  --lx-space-1: 4px;
  --lx-space-2: 8px;
  --lx-space-3: 12px;
  --lx-space-4: 16px;
  --lx-space-6: 24px;
  --lx-space-8: 32px;
  --lx-control: 40px;
  --lx-control-table: 32px;
  --lx-touch: 44px;
  --lx-row: 56px;
  --lx-radius-control: 8px;
  --lx-radius-card: 12px;
  --lx-radius-round: 999px;
  --lx-ring: 0 0 0 3px var(--lx-brand-tint);
  --lx-icon: 20px;
  --lx-icon-small: 16px;
  --lx-menu-width: 252px;
  --lx-top-bar: 64px;
}

/* C-349 (C018 2.7): Maroon changes only the brand tokens; area and status colours never change. */
@media screen {
  [data-theme="maroon"] {
    /* C-349 brand tokens (Maroon) */
    --lx-brand: #8A1C33;
    --lx-brand-hover: #6E1529;
    --lx-brand-tint: #FBEFF2;
    --lx-brand-line: #F5D9E0;
  }
}

/* C-349: Blue named too, so a Blue part inside a Maroon page (the Style Board) shows Blue. */
[data-theme="blue"] {
  --lx-brand: #1D4ED8;
  --lx-brand-hover: #1E40AF;
  --lx-brand-tint: #EFF4FF;
  --lx-brand-line: #C7D7FE;
}
/* C-349 tokens end */

/* ---------- base ---------- */

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

html {
  font-size:var(--lx-fs-heading);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  font-size:var(--lx-fs-body);
  line-height: 1.5;
  background: var(--page);
  color: var(--text);
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0 0 var(--lx-space-2);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* The page title (22 px on a computer, 18 px on a phone). */
h1 {
  font-size:var(--lx-fs-heading);
}

/* A section title inside a card: 15 px / 600. */
h2 {
  font-size:var(--lx-fs-body);
}

h3 {
  font-size:var(--lx-fs-body);
}

p {
  margin: 0 0 var(--lx-space-3);
}

a {
  color: var(--primary);
}

img,
svg {
  max-width: 100%;
}

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

/* ---------- text colours ---------- */

.text-secondary {
  color: var(--text-secondary);
}

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

.money-in {
  color: var(--money-in);
}

/* RR14 (R14, D223): a payment made is not red; red only for a warning. */
.money-out {
  color: var(--text);
}

.warning {
  color: var(--waiting);
}

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

/* ---------- cards ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--lx-space-6);
}

.section-title {
  margin: 0;
  font-size:var(--lx-fs-body);
  font-weight: 600;
}

/* A coloured line on top of a card (decoration only). */
.card-strip-gold {
  border-top: 3px solid var(--waiting-border);
}

.card-strip-in {
  border-top: 3px solid var(--money-in);
}

/* RR21a (D236): money out is not a warning, so not red. */
.card-strip-out {
  border-top: 3px solid var(--text-secondary);
}

.attention {
  background: var(--waiting-soft);
  color: var(--text);
  border: 1px solid var(--waiting-border);
  border-radius: var(--lx-radius-card);
  padding: var(--lx-space-3) var(--lx-space-4);
}

.attention-title {
  color: var(--waiting);
  font-weight: 600;
}

/* ---------- banners ---------- */

.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--lx-space-3);
  padding: var(--lx-space-3) var(--lx-space-4);
  border: 1px solid var(--border);
  border-radius: var(--lx-radius-card);
  background: var(--card);
  color: var(--text);
}

.banner-waiting {
  border-color: var(--waiting-border);
  background: var(--waiting-soft);
  color: var(--text);
}

.banner-icon {
  display: inline-flex;
  flex: none;
  color: var(--waiting);
}

.banner-body {
  flex: 1 1 240px;
  min-width: 0;
}

.banner-body p {
  margin: 0;
}

/* ---------- tags (22 px, a 6 px dot before the word) and pills ---------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--lx-space-2);
  height: var(--lx-space-6);
  padding: 0 var(--lx-space-2);
  border-radius: var(--lx-radius-round);
  background: var(--neutral-soft);
  color: var(--text-secondary);
  font-size:var(--lx-fs-small);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  overflow-wrap: normal;
}

.tag::before {
  content: "";
  width: 6px;
  height: calc(var(--lx-space-1) + 2px);
  flex: none;
  border-radius: var(--lx-radius-round);
  background: currentcolor;
}

/* A type tag: neutral, without the dot. */
.tag-neutral {
  background: var(--neutral-soft);
  color: var(--text-secondary);
}

.tag-neutral::before {
  display: none;
}

/* RR31 (R28, D275): a contra's tag in the Payments and Receipts lists: neutral, never red. */
.tag-contra {
  background: var(--neutral-soft);
  color: var(--text-secondary);
  white-space: nowrap;
}

.tag-contra::before {
  display: none;
}

.tag-paid {
  background: var(--money-in-soft);
  color: var(--money-in);
}

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

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

.tag-rejected {
  background: var(--money-out-soft);
  color: var(--money-out);
}

.pill {
  display: inline-block;
  white-space: nowrap;
  padding: 2px var(--lx-space-3);
  border-radius: var(--lx-radius-round);
  font-size:var(--lx-fs-small);
  font-weight: 600;
}

.pill-in {
  background: var(--money-in-soft);
  color: var(--money-in);
}

.pill-out {
  background: var(--neutral-soft);
  color: var(--text-secondary);
}

.pill-warning {
  background: var(--waiting-soft);
  color: var(--waiting);
}

/* ---------- tabs with their counts ---------- */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px var(--lx-space-6);
  border-bottom: 1px solid var(--border);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--lx-control);
  margin-bottom: -1px;
  padding: 8px 2px;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.tab-active {
  border-bottom-color: var(--primary);
  background: transparent;
  color: var(--primary);
  font-weight: 600;
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: var(--lx-icon);
  padding: 0 var(--lx-space-2);
  border-radius: var(--lx-radius-round);
  background: var(--neutral-soft);
  color: var(--text-secondary);
  font-size:var(--lx-fs-small);
  font-weight: 600;
}

/* ---------- buttons (36 px on a computer; 44 px for touch, below) ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--lx-space-2);
  min-height: var(--lx-control);
  padding: 0 var(--lx-space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.btn:hover {
  background: var(--page);
  color: var(--text);
}

.btn-secondary {
  border-color: var(--border);
  background: var(--card);
  color: var(--text);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--on-primary);
}

.btn-plain {
  border-color: transparent;
  background: transparent;
  color: var(--text-secondary);
}

.btn-danger {
  border-color: var(--danger-border);
  background: var(--card);
  color: var(--money-out);
}

.btn-danger:hover {
  background: var(--money-out-soft);
  color: var(--money-out);
}

.btn .icon {
  width: 20px; /* C-350 (C018 1.1): 20 in buttons */
  height: var(--lx-icon);
}

/* ---------- forms ---------- */

label {
  display: block;
  margin-bottom: var(--lx-space-2);
  color: var(--text-secondary);
  font-size:var(--lx-fs-label);
  font-weight: 500;
}

/* The small note after a label ("shown to …"); D161: no "optional" mark anywhere. */
.label-note {
  margin-left: 8px;
  color: var(--muted);
  font-weight: 400;
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--lx-control);
  padding: var(--lx-space-2) var(--lx-space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size:var(--lx-fs-body);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-height: 0;
  accent-color: var(--primary);
}

.field-help,
.field-state {
  color: var(--text-secondary);
  font-size:var(--lx-fs-label);
}

.field-error {
  color: var(--money-out);
  font-size:var(--lx-fs-label);
}

/* ---------- tables (scroll sideways on a narrow screen) ---------- */

.table-wrap {
  position: relative;
  overflow-x: auto;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: var(--lx-space-3) var(--lx-space-3);
  border-bottom: 1px solid var(--row-line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--table-head);
  color: var(--text-secondary);
  font-size:var(--lx-fs-small);
  font-weight: 600;
}

/* ---------- touch sizes: a phone, or any coarse pointer ---------- */

@media (max-width: 767px), (pointer: coarse) {
  .btn,
  input,
  select {
    min-height: var(--lx-touch);
  }
}

/* ---------- the menu (white, D157) ---------- */

.menu {
  background: var(--card);
  color: var(--text);
}

.menu-secondary {
  background: var(--card);
  color: var(--muted);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: var(--lx-space-3);
  min-height: var(--lx-control);
  padding: 0 var(--lx-space-3);
  border-radius: var(--radius-small);
  background: var(--card);
  color: var(--text-secondary);
  font-weight: 500;
  text-decoration: none;
}

.menu-item .icon {
  width: 20px; /* C-350 (C018 1.1): 20 in the menu */
  height: var(--lx-icon);
}

.menu-item-active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.menu-label {
  min-width: 0;
}

/* Approvals' count, in the waiting colours. */
.menu-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: var(--lx-icon);
  margin-left: auto;
  padding: 0 var(--lx-space-2);
  border-radius: var(--lx-radius-round);
  background: var(--waiting-soft);
  color: var(--waiting);
  font-size:var(--lx-fs-small);
  font-weight: 600;
}

/* A part not in this release: it still opens "Coming soon". */
.menu-soon {
  margin-left: auto;
  background: var(--card);
  color: var(--muted);
  font-size:var(--lx-fs-small);
  font-weight: 500;
}

/* ---------- icons (decoration: line drawings in SVG) ---------- */

.icon {
  width: 20px;
  height: var(--lx-icon);
  flex: none;
  fill: none;
  stroke: currentcolor;
  stroke-width: 2; /* C-350 (C018 1.1): Lucide, stroke 2 */
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-muted {
  stroke: var(--muted);
}

/* ---------- the screen frame (S0-005; computer 768 px and wider, phone below) ---------- */

.frame {
  min-height: 100vh;
}

.lamp {
  display: inline-flex;
  width: 32px;
  height: var(--lx-control-table);
  flex: none;
}

.lamp svg {
  width: 100%;
  height: 100%;
}

.lamp-small {
  width: var(--lx-control-table);
  height: var(--lx-control-table);
}

/* The side menu (computer) */

.side {
  display: none;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: var(--lx-space-3);
  padding: 0 var(--lx-space-2);
  background: var(--card);
  color: var(--text);
}

.side-brand-text {
  display: flex;
  flex-direction: column;
}

.side-brand-name {
  font-size:var(--lx-fs-heading);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.side-brand-line {
  background: var(--card);
  color: var(--muted);
  font-size:var(--lx-fs-small);
}

.side-menu {
  display: flex;
  flex-direction: column;
  gap: 0; /* D-507b (the Owner, 23:52): between groups only their margin, one item's gap */
}

.menu-item:hover {
  background: var(--page);
  color: var(--text);
}

.menu-item-active:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.side-business {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: auto;
  padding: 14px 6px 0;
  border-top: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 0.8571rem;
}

.side-business-name {
  background: var(--card);
  color: var(--text);
  font-size: 0.9286rem;
  font-weight: 600;
}

/* The top bar (computer) */

.top {
  display: none;
}

.top-title {
  display: flex;
  flex: 1 1 260px;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.top-heading {
  margin: 0;
  font-size:var(--lx-fs-title);
  font-weight: 600;
}

/* B-263 (C015 item 4): "← Back" at the top left beside the title of every inner page. */
.top-title-row {
  display: flex;
  align-items: center;
  gap: var(--lx-space-3);
  min-width: 0;
}

.back-link {
  flex: none;
  padding: var(--lx-space-1) var(--lx-space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text-secondary);
  font-size:var(--lx-fs-label);
  white-space: nowrap;
  text-decoration: none;
}

.back-link:hover,
.back-link:focus-visible {
  border-color: var(--primary);
  color: var(--primary);
}

/* B-264 (C015 item 14, C014 4A; mockup C015-05): the voucher's page: one clean bar, one line of
   ticks ("Show on voucher:"), the voucher centred under them. */
.voucher-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.voucher-bar-main,
.voucher-bar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.voucher-bar-title {
  font-weight: 600;
  white-space: nowrap;
}

.tag-generated {
  background: var(--lx-status-green-tint);
  color: var(--lx-status-green);
}

.tag-cancelled {
  background: var(--lx-status-grey-tint);
  color: var(--lx-status-grey);
}

.voucher-more {
  position: relative;
}

.voucher-more-button {
  min-width: 44px;
  list-style: none;
}

.voucher-more-button::-webkit-details-marker {
  display: none;
}

.voucher-more-panel {
  position: absolute;
  z-index: 5;
  top: calc(100% + 4px);
  right: 0;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  padding: 8px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--card);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--lx-text) 12%, transparent);
}

.voucher-more-item {
  padding: 8px 16px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.voucher-more-danger {
  color: var(--lx-status-red);
}

.voucher-show {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  margin-bottom: 16px;
  padding: 12px 16px;
}

.voucher-show-label {
  font-weight: 600;
  white-space: nowrap;
}

.voucher-show .check {
  white-space: nowrap;
}

.voucher-preview {
  display: flex;
  justify-content: center;
  overflow-x: auto;
}

.top-line {
  margin: 0;
  background: var(--card);
  color: var(--text-secondary);
  font-size:var(--lx-fs-label);
}

.top-line a {
  color: var(--primary);
  text-decoration: none;
}

/* The page's own buttons, then the bell and the initials. */
.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--lx-space-3);
}

/* The round initials and the account menu */

.account-menu {
  position: relative;
}

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--lx-control);
  height: var(--lx-control);
  border-radius: var(--lx-radius-round);
  background: var(--primary-soft);
  color: var(--primary);
  font-size:var(--lx-fs-label);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.avatar::-webkit-details-marker {
  display: none;
}

.account-panel {
  position: absolute;
  top: 44px;
  right: 0;
  z-index: 20;
  width: min(320px, 90vw);
  padding: var(--lx-space-2) 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--lx-text) 10%, transparent);
}

.account-who {
  display: flex;
  flex-direction: column;
  padding: var(--lx-space-2) var(--lx-space-4) var(--lx-space-3);
  border-bottom: 1px solid var(--border);
}

.account-name {
  font-weight: 600;
}

.account-line,
.account-business {
  background: var(--card);
  color: var(--text-secondary);
  font-size:var(--lx-fs-label);
}

.account-link,
.list-link {
  display: flex;
  align-items: center;
  gap: var(--lx-space-3);
  min-height: var(--lx-control);
  padding: var(--lx-space-2) var(--lx-space-4);
  background: var(--card);
  color: var(--text);
  text-decoration: none;
}

.list-link + .list-link {
  border-top: 1px solid var(--row-line);
  border-top-color: var(--row-line);
}

.list-card {
  padding: 0;
  overflow: hidden;
}

/* S2-021: the bell (computer top bar and phone top bar), its count and its list. */
.bell-menu {
  position: relative;
  margin-left: auto;
}

.top-actions .bell-menu {
  margin-left: 0;
}

.bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--lx-control);
  height: var(--lx-control);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--card);
  color: var(--text-secondary);
  list-style: none;
  cursor: pointer;
}

.bell::-webkit-details-marker {
  display: none;
}

.bell .icon {
  width: 18px;
  height: var(--lx-icon);
}

/* The count of new alerts, a small red mark on the bell's corner. */
.bell-count {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 18px;
  padding: 0 var(--lx-space-1);
  border-radius: var(--lx-radius-round);
  background: var(--money-out);
  color: var(--on-primary);
  font-size:var(--lx-fs-small);
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}

.bell-panel {
  position: absolute;
  top: 44px;
  right: 0;
  z-index: 20;
  width: min(340px, 90vw);
  padding: var(--lx-space-2) 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--lx-text) 10%, transparent);
}

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

.bell-item {
  display: block;
  min-height: var(--lx-control);
  padding: var(--lx-space-3) var(--lx-space-4);
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  overflow-wrap: normal;
}

.bell-list li + li {
  border-top: 1px solid var(--row-line);
}

.bell-nothing {
  margin: 0;
  padding: var(--lx-space-3) var(--lx-space-4);
  background: var(--card);
  color: var(--text-secondary);
}

/* The phone's top bar (white, as the computer's) */

.phone-top {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: var(--lx-space-3);
  min-height: var(--lx-row);
  padding: var(--lx-space-2) var(--lx-space-4);
  border-bottom: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}

.phone-title {
  min-width: 0;
  font-size:var(--lx-fs-heading);
  font-weight: 600;
  overflow-wrap: normal;
}

.phone-top .bell {
  width: 44px;
  height: var(--lx-touch);
}

/* Page content */

.content {
  display: flex;
  flex-direction: column;
  gap: var(--lx-space-6);
  width: 100%;
  padding: var(--lx-space-4);
  /* Room for the phone's bottom bar, so it never covers the page. */
  padding-bottom: calc(var(--lx-row) * 2);
}

.content-plain {
  padding-bottom: var(--space);
}

.welcome-heading {
  margin: 0;
  font-size:var(--lx-fs-heading);
}

.welcome-line {
  margin: 2px 0 0;
}

/* S2-021 (S2 section 10): Home's "Needs attention", quick buttons and this month's money; the
   phone's "New" page uses the same buttons. */
.attention-list {
  margin: var(--lx-space-1) 0 0;
  padding: 0;
  list-style: none;
}

.attention-list li + li {
  border-top: 1px dashed var(--waiting-border);
}

.attention-item {
  display: block;
  padding: var(--lx-space-1) 0;
  background: var(--waiting-soft);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.new-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--lx-space-3);
}

.quick-button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.quick-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-small);
  background: var(--page);
}

.quick-receipt {
  background: var(--money-in-soft);
  color: var(--money-in);
}

.quick-payment {
  background: var(--neutral-soft);
  color: var(--text-secondary);
}

.quick-transfer {
  background: var(--primary-soft);
  color: var(--primary);
}

/* Home's four figures (KPI cards) */

.kpis {
  display: grid;
  /* One column below about 440 px, so a crore stays whole inside its card. */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: var(--lx-space-4);
}

.kpi {
  display: flex;
  flex-direction: column;
  gap: var(--lx-space-2);
  padding: var(--lx-space-4) var(--lx-space-6);
}

.kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--lx-space-2);
}

.kpi-label {
  color: var(--text-secondary);
  font-size:var(--lx-fs-label);
  font-weight: 500;
}

.kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: var(--lx-space-8);
  flex: none;
  border-radius: var(--radius-small);
}

.kpi-icon .icon {
  width: 18px;
  height: var(--lx-icon);
}

.kpi-in {
  background: var(--money-in-soft);
  color: var(--money-in);
}

/* RR21a (D236): a payment's arrow in the ordinary icon colour (red only for a warning). */
.kpi-out {
  background: var(--neutral-soft);
  color: var(--text-secondary);
}

.kpi-bank {
  background: var(--primary-soft);
  color: var(--primary);
}

.kpi-waiting {
  background: var(--waiting-soft);
  color: var(--waiting);
}

.kpi-amount {
  font-size: clamp(1.25rem, 6vw, 1.7143rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.kpi-line {
  color: var(--text-secondary);
  font-size:var(--lx-fs-label);
}

/* "Recent entries" (2 parts) beside "Accounts" (1 part) */

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.recent,
.home-accounts {
  padding: 0;
  overflow: hidden;
}

.home-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--lx-space-3);
  padding: var(--lx-space-4) var(--lx-space-6);
  border-bottom: 1px solid var(--row-line);
}

.home-card-head a {
  background: var(--card);
  color: var(--primary);
  font-size:var(--lx-fs-label);
  font-weight: 600;
  text-decoration: none;
}

.recent-row,
.home-account {
  display: flex;
  align-items: center;
  gap: var(--lx-space-3);
  padding: var(--lx-space-3) var(--lx-space-6);
  background: var(--card);
  color: var(--text);
  text-decoration: none;
}

.recent-row + .recent-row,
.home-account + .home-account {
  border-top: 1px solid var(--row-line);
}

.recent-row:hover {
  background: var(--table-head);
  color: var(--text);
}

.recent-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: var(--lx-space-8);
  flex: none;
  border-radius: var(--radius-small);
}

.recent-icon .icon {
  width: 16px;
  height: var(--lx-icon-small);
}

.recent-what,
.home-account-what {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

.recent-name,
.home-account-name {
  font-weight: 600;
}

.recent-line {
  color: var(--text-secondary);
  font-size:var(--lx-fs-label);
}

.home-account-kind {
  color: var(--muted);
  font-size: 0.8571rem;
}

.recent-amount,
.home-account-amount {
  flex: none;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* On a phone the tag goes under the name, so the amount keeps its room. */
.recent-tag {
  flex: none;
}

.month-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 12px;
}

.month-label {
  margin: 0;
  color: var(--text-secondary);
}

.month-amount {
  margin: 4px 0 0;
  font-size: clamp(1.25rem, 6vw, 1.5rem);
  font-weight: 700;
  white-space: nowrap;
}

.empty-books {
  margin: 0;
}

.notice h2 {
  margin-bottom: var(--lx-space-1);
  font-size:var(--lx-fs-body);
}

/* The phone's bottom bar */

.bottom-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: end;
  padding: var(--lx-space-2) var(--lx-space-1) calc(var(--lx-space-2) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--card);
  color: var(--text-secondary);
}

.bottom-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: var(--lx-row);
  padding: var(--lx-space-1) 0;
  background: var(--card);
  color: var(--text-secondary);
  font-size:var(--lx-fs-small);
  font-weight: 500;
  text-decoration: none;
}

.bottom-item .icon {
  width: 22px;
  height: var(--lx-icon);
}

.bottom-item-active {
  background: var(--card);
  color: var(--primary);
  font-weight: 600;
}

.bottom-new .bottom-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--lx-row);
  height: var(--lx-row);
  margin-top: calc(var(--lx-space-6) * -1);
  border-radius: var(--lx-radius-round);
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--lx-brand) 25%, transparent);
}

.bottom-new .icon {
  width: 26px;
  height: var(--lx-icon);
}

@media (max-width: 767px) {
  .recent-row {
    flex-wrap: wrap;
  }

  .recent-what {
    flex-basis: calc(100% - 44px);
  }

  .recent-tag {
    margin-left: var(--lx-touch);
  }

  .recent-amount {
    margin-left: auto;
  }
}

/* RR37 (R41, D343): from 768 px the rows of Home's "Recent Entries" (and of the Approvals page's
   cards that carry chips) share one grid: each row a subgrid, so the chips start at one line and
   the amounts end at one line, the two columns as wide as the card's widest chip and amount; a row
   without a chip leaves its column empty. Below 768 px as before (the chip under the name). */
@media (min-width: 768px) {
  .home-recent {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    column-gap: var(--lx-space-3);
  }

  .home-recent > .home-card-head,
  .home-recent > .home-list-empty {
    grid-column: 1 / -1;
  }

  .home-recent > .recent-row {
    display: grid;
    grid-template-columns: subgrid;
    grid-column: 1 / -1;
    align-items: center;
  }

  .home-recent .recent-icon {
    grid-column: 1;
  }

  .home-recent .recent-what {
    grid-column: 2;
  }

  .home-recent .recent-tag {
    grid-column: 3;
    justify-self: start;
  }

  .home-recent .recent-amount {
    grid-column: 4;
    justify-self: end;
    text-align: right;
  }

  .decided-recently:has(.recent-tag) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    column-gap: var(--lx-space-3);
  }

  .decided-recently:has(.recent-tag) > .list-card-title {
    grid-column: 1 / -1;
  }

  .decided-recently:has(.recent-tag) > .recent-row {
    display: grid;
    grid-template-columns: subgrid;
    grid-column: 1 / -1;
    align-items: center;
  }

  .decided-recently .recent-what {
    grid-column: 1;
  }

  .decided-recently .decided-who {
    grid-column: 2;
  }

  .decided-recently .recent-tag {
    grid-column: 3;
    justify-self: start;
  }

  .decided-recently .recent-amount,
  .decided-recently:has(.recent-tag) > .recent-row > .btn {
    grid-column: 4;
    justify-self: end;
    text-align: right;
  }
}

@media (min-width: 768px) {
  html {
    font-size:var(--lx-fs-body);
  }

  h1 {
    font-size:var(--lx-fs-title);
  }

  .frame {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .side {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: var(--lx-space-4);
    height: 100vh;
    overflow-y: auto; /* D-507 (the Owner, 23:51): never spills; scrolls inside, one border */
    scrollbar-width: thin;
    padding: var(--lx-space-4) var(--lx-space-3);
    border-right: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
  }

  /* RR21b (D236): the bell and the initials stay at the top right on every page; the page's
     button under the title below 1093 px, at its right from 1093 px. */
  .top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title actions"
      "buttons buttons";
    align-items: center;
    gap: var(--lx-space-3) var(--lx-space-4);
    padding: var(--lx-space-4) var(--lx-space-8);
    border-bottom: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
  }

  .top-title {
    grid-area: title;
  }

  .top-buttons {
    display: flex;
    flex-wrap: wrap;
    grid-area: buttons;
    align-items: center;
    gap: var(--lx-space-3);
  }

  .top-buttons:empty {
    display: none;
  }

  .top-actions {
    flex-wrap: nowrap;
    grid-area: actions;
    justify-self: end;
  }

  .phone-top,
  .bottom-bar {
    display: none;
  }

  .content {
    padding: var(--lx-space-6) var(--lx-space-8) var(--lx-control);
  }

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

/* ---------- messages ---------- */

.messages {
  display: flex;
  flex-direction: column;
  gap: var(--lx-space-2);
}

.message {
  margin: 0;
  padding: var(--lx-space-3) var(--lx-space-4);
  border: 1px solid var(--border);
  border-left: 4px solid var(--money-in);
  border-radius: var(--radius-small);
  background: var(--card);
  color: var(--text);
  overflow-wrap: anywhere; /* B-272 (D469, F8): a long message wraps, never cut */
}

/* UI-13 (D143): an error message looks like an error. */
.message-error {
  border-left-color: var(--money-out);
  background: var(--money-out-soft);
  color: var(--money-out);
}

.form-alert {
  padding: var(--lx-space-3) var(--lx-space-4);
  border: 1px solid var(--money-out);
  border-radius: var(--radius-small);
  background: var(--money-out-soft);
  color: var(--money-out);
}

/* B-L4b (S 1.2; mockup 2): the loan form in the payment form's pieces. Its rows: one column on a
   phone, two from 768 px, three from 1093 px; "How the Money Moved" and "Terms" are headings with a
   line above (no boxes); the radio rows wrap on a phone. */
.loan-form-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0; /* B-L10a: no wider than its place (one rule, B-c1z) */
  max-width: 100%;
}

.loan-part {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.loan-top {
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.loan-part > .section-title {
  margin: 0;
}

.loan-form .choice {
  flex-wrap: wrap;
  align-items: center;
  gap: var(--lx-space-2) var(--lx-space-6);
}

/* B-L10a2 (the chat's render): never a visually hidden legend ("How the Money Moved"), which this
   rule had made 1440 px wide past the page's right edge. */
.loan-form .choice > legend:not(.visually-hidden) {
  width: 100%;
}

.loan-cell > .field {
  margin: 0;
}

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

@media (min-width: 1093px) {
  .loan-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* B-RR21b3 (RR21b items 4 and 5; D236): a person's form as one grid (one column on a phone, two
   from 768 px, three from 1093 px; Address across two); an entry's page three to a row from 1093
   px, in the form's order. */
.person-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px 24px;
}

.person-grid > .span-full {
  grid-column: 1 / -1;
}

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

  .person-grid > .span-2 {
    grid-column: span 2;
  }
}

@media (min-width: 1093px) {
  .person-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.person-grid > .party-types {
  grid-column: 1 / -1;
}

@media (min-width: 1093px) {
  .details.entry-details {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* B-RR21b3 (RR21b item 4; D236): "No Number?", a quiet link at the right of the label's line; its
   two choices beneath it; once chosen, the choice with "Undo". */
.pending-choice .pending-open,
.pending-choice .pending-pick,
.pending-choice .pending-undo {
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary);
  font: inherit;
  font-size:var(--lx-fs-small);
  cursor: pointer;
}

.pending-choice .pending-open {
  color: var(--text-secondary);
}

.pending-choice .pending-menu:not([hidden]),
.pending-choice .pending-chosen:not([hidden]) {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--lx-space-1) var(--lx-space-3);
  align-items: center;
}

.pending-choice .pending-state {
  color: var(--waiting);
  font-size:var(--lx-fs-small);
  font-weight: 600;
}

/* B-L10a (D253): nothing on the loan form wider than the page: its fieldsets and grid cells may
   shrink (a fieldset's own minimum is its content, a grid item's its longest word or box), its
   boxes never wider than their cell (a select is as wide as its longest name otherwise), and the
   radio and tick labels wrap. */
.loan-form fieldset {
  min-width: 0;
}

.loan-form .form-grid > * {
  min-width: 0;
}

.loan-form select,
.loan-form input,
.loan-form textarea {
  min-width: 0;
  max-width: 100%;
}

.loan-form .check {
  overflow-wrap: anywhere;
}

/* B-L9 (D252; mockup 3): a loan's Statement and Schedule: tables from 768 px (scrolling inside
   their card if need be, nothing cut off); below 768 px one card per row, the date and detail
   first, then each figure with its label. */
/* B-L13 (D272): their titles above their cards, with the page's usual space. */
.loan-section-title {
  margin: 24px 0 12px;
}

/* B-L14 (D280): the Loans table's Party column keeps its width and breaks a name only between
   words (the row's actions are one menu button). */
.loans-table .loans-party {
  min-width: 200px;
  overflow-wrap: normal;
  word-break: normal;
}

.loans-table .loans-actions {
  width: 1%;
  white-space: nowrap;
}

/* M-loans2 (D285): the table fits its card from 1280 px (it shows from there; cards below):
   the Balance cell's second line ("Approx. · last actual …") wraps under the amount, and up to
   1599 px the cells are tighter and the text a little smaller, so the Actions button is never cut
   off and nothing scrolls sideways. */
.loans-table td .cell-line {
  white-space: normal;
  min-width: 7em;
}

@media (min-width: 1280px) and (max-width: 1599px) {
  .loans-table th, .loans-table td {
    padding-left: 8px;
    padding-right: 8px;
    font-size: var(--lx-fs-label);
  }

  .loans-table th {
    font-size: var(--lx-fs-small);
  }
}

/* M-loans2 (D285): the filter row shrinks the search box first and never pokes past its card. */
.loans-toolbar .toolbar-search {
  flex: 1 1 160px;
  min-width: 120px;
}

.loans-toolbar .toolbar-select select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.loan-row-cards {
  display: none;
  margin: 0;
  padding: 0;
  list-style: none;
}

.loan-table-wrap {
  position: relative; /* M-loans: as every sideways-scroll box (its row menus are placed in it) */
  overflow-x: auto;
}

.loan-row-card {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.loan-row-card:last-child {
  border-bottom: 0;
}

.loan-row-head {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0 0 8px;
}

.loan-row-head .cell-line {
  flex-basis: 100%;
}

.loan-row-figures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  margin: 0;
}

.loan-row-figures dt {
  color: var(--muted);
}

.loan-row-figures dd {
  margin: 0;
}

/* B-252 (C003): "Print Statement"'s box under its button (no script: a details box), and each
   statement row's Generate Voucher / View Voucher at the row's right end (on a phone, under the
   row's card). */
.print-statement {
  position: relative;
}

.print-statement > summary {
  list-style: none;
  cursor: pointer;
}

.print-statement > summary::-webkit-details-marker {
  display: none;
}

.print-statement-box {
  position: absolute;
  z-index: 20;
  right: 0;
  width: min(320px, calc(100vw - 32px));
  margin-top: 8px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--lx-text) 10%, transparent);
}

.print-statement-box .field {
  margin-bottom: var(--lx-space-3);
}

.loan-statement td.loan-voucher {
  white-space: nowrap;
  text-align: right;
}

/* C-338d (the chat's review at 1093 px): Detail never squeezed (at least Date + Added) and never
   broken inside a word; from 1093 to 1279 px the row's voucher state goes on Detail's last line
   (chip, then button) and the Voucher column is hidden, so nothing runs past the card. */
.loan-statement .loan-detail {
  min-width: 16rem;
  overflow-wrap: normal;
  word-break: normal;
}

.loan-voucher-inline {
  display: none;
}

@media (min-width: 1093px) and (max-width: 1279px) {
  .loan-statement .loan-voucher-col {
    display: none;
  }

  .loan-statement .loan-voucher-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 8px;
    margin-top: 8px;
  }
}

.loan-row-voucher {
  margin: 8px 0 0;
}

/* B-252 (C003): the loan's statement print: A4 portrait on its own named page (never the
   voucher's A5), black on white, page numbers in the page's foot. */
@page loan-statement {
  size: A4 portrait;
  margin: 14mm 12mm 16mm;

  @bottom-right {
    content: "Page " counter(page) " of " counter(pages);
    font-size: 9pt;
  }
}

.loan-print {
  page: loan-statement;
  max-width: 186mm;
  margin: 0 auto;
  padding: 16px;
  background: var(--card);
  color: var(--text);
}

.loan-print-firm {
  text-align: center;
}

.loan-print-firm-name {
  font-size: 1.2857rem;
  font-weight: 700;
}

.loan-print-title {
  margin: 12px 0;
  font-size: 1.1429rem;
  text-align: center;
}

.loan-print-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 16px;
  margin: 0 0 12px;
}

.loan-print-facts dt {
  font-size: 0.8571rem;
}

.loan-print-facts dd {
  margin: 0;
  font-weight: 600;
}

.loan-print-table {
  width: 100%;
  border-collapse: collapse;
}

.loan-print-table th,
.loan-print-table td {
  padding: 6px 8px;
  border: 1px solid var(--text);
  vertical-align: top;
}

.loan-print-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.loan-print-table tr {
  break-inside: avoid;
}

.loan-print-table thead {
  display: table-header-group;
}

.loan-print-edge td {
  font-weight: 700;
}

.loan-print-printed {
  margin-top: 12px;
  font-size: 0.8571rem;
}

@media print {
  .loan-print-body {
    background: var(--card);
  }

  .loan-print {
    max-width: none;
    padding: 0;
  }
}

.loan-row-act {
  margin: 8px 0 0;
}

.loan-file {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* B-L10a (D253): below 1093 px the cards (at 768 px the tables squeezed the Detail column). */
@media (max-width: 1092px) {
  .loan-table-wrap {
    display: none;
  }

  .loan-row-cards {
    display: block;
  }
}

/* B-L7 (S 1.2 section 1): "This entry is now in Loans", a link to the loan, over an old entry's form. */
.loan-moved {
  margin: 0 0 var(--lx-space-4);
  padding: var(--lx-space-3) var(--lx-space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--card);
}

/* ---------- forms of the sign-in pages (S0-006) ---------- */

.form {
  display: flex;
  flex-direction: column;
  gap: var(--lx-space-4);
}

.field .field-error {
  margin: var(--lx-space-1) 0 0;
}

.password-box {
  position: relative;
}

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

.eye {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.check {
  display: flex;
  align-items: center;
  gap: var(--lx-space-2);
  margin: 0;
  font-weight: 400;
}

.btn-wide {
  width: 100%;
}

.account-form {
  margin: 0;
}

.account-button {
  width: 100%;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

/* ---------- the sign-in layout: left panel on a computer, the form alone on a phone ---------- */

.auth {
  min-height: 100vh;
}

.auth-panel {
  display: none;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.auth-brand-text {
  display: flex;
  flex-direction: column;
}

.auth-brand-name {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.auth-brand-line {
  background: var(--card);
  color: var(--muted);
}

.lamp-large {
  width: 64px;
  height: 64px;
}

.auth-claim {
  max-width: 18em;
  margin: 72px 0 32px;
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.25;
}

.auth-ticks {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-ticks li {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-by {
  margin-top: auto;
  background: var(--card);
  color: var(--muted);
  font-size: 0.9375rem;
}

.auth-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0 32px;
}

.auth-phone-brand {
  display: flex;
  align-self: stretch;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}

.auth-phone-name {
  font-size: 1.5rem;
  font-weight: 700;
}

.auth-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 440px;
  padding: 24px 20px 0;
}

.auth-box h1 {
  margin: 0;
}

.auth-note {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.auth-sign-out {
  margin-top: 8px;
}

.help-box h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.0625rem;
}

.help-box p {
  margin: 0;
}

@media (min-width: 768px) {
  .auth {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .auth-panel {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 64px 56px 48px;
    border-right: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
  }

  .auth-phone-brand {
    display: none;
  }

  .auth-main {
    justify-content: center;
    padding: 48px 32px;
  }
}

/* ---------- Users (S0-007) ---------- */

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.card-head h2 {
  margin: 0;
}

.pill-brand {
  background: var(--primary-soft);
  color: var(--primary);
}

.cell-line {
  display: block;
  font-size:var(--lx-fs-label);
}

.nowrap {
  white-space: nowrap;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 0.9375rem;
}

/* Table cells keep words whole (the page's "break anywhere" squeezed names to one letter per
   line); only a long email may break, and only on its own line (S0-007a). */
.users-table td,
.users-table th {
  overflow-wrap: normal;
}

.cell-email {
  overflow-wrap: anywhere;
}

@media (min-width: 768px) {
  .users-table .users-name {
    min-width: 14rem;
  }

  .users-table .users-last {
    white-space: nowrap;
  }

  /* The action links sit in the last column, each on its own line. */
  .row-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .row-actions a {
    white-space: nowrap;
  }
}

/* Below 768 px each person is a card: name; mobile and email; role and status side by side;
   "Last signed in"; the actions as buttons in a row that may wrap. */
@media (max-width: 1092px) {  /* RR21b (D236): cards up to 1092 px (cut at 768 px) */
  .users-table thead {
    display: none;
  }

  .users-table,
  .users-table tbody {
    display: block;
  }

  .users-table tr {
    display: grid;
    grid-template-areas:
      "name name"
      "role status"
      "last last"
      "actions actions";
    grid-template-columns: max-content 1fr;
    gap: 8px 10px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
  }

  .users-table td {
    display: block;
    padding: 0;
    border: 0;
  }

  .users-table .users-name {
    grid-area: name;
  }

  .users-table .users-role {
    grid-area: role;
  }

  .users-table .users-status {
    grid-area: status;
  }

  .users-table .users-last {
    grid-area: last;
  }

  .users-table .users-last::before {
    content: "Last signed in ";
    font-weight: 600;
  }

  .users-table .users-actions {
    grid-area: actions;
  }

  .row-actions a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    text-decoration: none;
  }
}

.form-card {
}

.form-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--lx-space-3);
  margin: var(--lx-space-2) 0 0;
}

.choice {
  display: flex;
  gap: var(--lx-space-6);
  margin: 0;
  padding: 0;
  border: 0;
}

.choice legend {
  margin-bottom: var(--lx-space-1);
  padding: 0;
  font-weight: 600;
}

.powers {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.powers legend {
  margin-bottom: 4px;
  padding: 0;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.9286rem;
}

.power {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  font-weight: 400;
}

.power input {
  margin-top: 4px;
}

.power-text {
  display: flex;
  flex-direction: column;
}

.power-label {
  font-weight: 600;
}

.once-box .otp {
  font-family: ui-monospace, monospace;
  font-size: 1.25rem;
  letter-spacing: 0.08em;
}

/* ---------- the Accounts page (S1-013) ---------- */

.card-strip-brand {
  border-top: 4px solid var(--primary);
}

.page-line {
  margin: 0;
}

/* The totals stack on a phone; side by side on a computer. */
.totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space);
}

.total p {
  margin: 0;
}

/* R1-UI2: the totals as Home's figure cards (13 px label, 24 px figure, no top strip). */
.total {
  padding: 18px 20px;
}

.totals .card-strip-brand,
.totals .card-strip-gold,
.totals .card-strip-in {
  border-top: 1px solid var(--border);
}

.total-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.9286rem;
  font-weight: 500;
}

.total-label .icon {
  width: 18px;
  height: var(--lx-icon);
}

.total-amount {
  margin: 8px 0 2px;
  font-size: clamp(1.25rem, 6vw, 1.7143rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.total-note {
  font-size: 0.9286rem;
}

/* The cards fill their row with no empty columns (S1-013a). R38 (E-532, D335): 40rem a card, so
   the name and its bank stand on one line beside the buttons' column: one card a row at 1093 and
   1440, two at 1920; one a row on a phone. */
.account-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 40rem), 1fr));
  gap: var(--space);
}

/* Each card is a container: on a narrow card (a phone) the buttons' column goes below the details
   (the container query below). Words never break inside. */
.account-card {
  container: account-card / inline-size;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  overflow-wrap: break-word;
}

/* R38 (E-532, D335): the name, balance and details on the left, taking the rest of the width; the
   buttons in one column on the card's right, one below the other, each the column's full width. */
.account-card-body {
  display: grid;
  grid-template-areas: "main buttons";
  grid-template-columns: minmax(0, 1fr) 11rem;
  gap: 0 16px;
}

.account-main {
  grid-area: main;
  min-width: 0;
}

.account-card .account-buttons {
  display: flex;
  flex-direction: column;
  grid-area: buttons;
  align-self: start;
  gap: 8px;
}

.account-card .account-buttons .btn {
  justify-content: center;
  width: 100%;
}

/* R38: on a phone (a card under 30rem) the column goes below the details, full width. */
@container account-card (width < 30rem) {
  .account-card-body {
    grid-template-areas:
      "main"
      "buttons";
    grid-template-columns: minmax(0, 1fr);
  }

  .account-card .account-buttons {
    width: 100%;
    margin-top: 12px;
  }
}

.account-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

/* R38: "As On dd/mm/yyyy ₹…" under today's balance; an amount never breaks inside. */
.account-as-on,
.total-as-on {
  margin: -6px 0 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.balance-today {
  margin-right: 6px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
}

.account-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: var(--radius-small);
  background: var(--primary-soft);
  color: var(--primary);
}

.account-icon-cash {
  background: var(--waiting-soft);
  color: var(--waiting);
}

.account-title {
  flex: 1 1 10rem;
  min-width: 0;
  overflow-wrap: break-word;
}

.account-title h3,
.account-title p {
  margin: 0;
}

/* R38 (E-532, D335): the account's name is never squeezed or cut: it wraps only between words. */
.account-title h3 {
  overflow-wrap: normal;
  word-break: normal;
}

.account-buttons {
  display: flex;
  gap: 8px;
}

.btn-small {
  min-height: var(--lx-control);
  padding: var(--lx-space-2) var(--lx-space-3);
}

.account-balance {
  margin: 12px 0;
  font-size: 1.5714rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.account-details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  margin: 0;
}

.account-details dt {
  background: var(--card);
  color: var(--text-secondary);
}

.account-details dd {
  margin: 0;
  font-weight: 600;
}

.closed-accounts {
  padding: 12px var(--space);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.closed-accounts summary {
  font-weight: 600;
  cursor: pointer;
}

.closed-list {
  margin: 8px 0 0;
  padding-left: 20px;
}

/* ---------- transfers (S1-014) ---------- */

.chip {
  flex: none;
  min-height: var(--lx-control);
  padding: var(--lx-space-2) var(--lx-space-4);
  border: 1px solid var(--border);
  border-radius: var(--lx-radius-round);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.account-pick {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.account-pick legend {
  margin-bottom: 4px;
  padding: 0;
  font-weight: 600;
}

/* "Bank" / "Cash" as a two-button switch (mockup 04): radio buttons, still keyboard-usable. */
.segmented {
  display: inline-flex;
  align-self: flex-start;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  overflow: hidden;
}

.segmented label {
  position: relative;
  display: flex;
  align-items: center;
  min-height: var(--lx-control);
  margin: 0;
  padding: 0 var(--lx-space-6);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.segmented label + label {
  border-left: 1px solid var(--border);
}

.segmented input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.segmented label:has(input:checked) {
  background: var(--primary);
  color: var(--on-primary);
}

.segmented label:has(input:focus-visible) {
  outline: 3px solid var(--waiting-border);
  outline-offset: -3px;
}

/* Laxmi's date field (S1-013a): the calendar button inside at the left, "Today" at the right. */
.date-box {
  position: relative;
  display: flex;
  align-items: center;
}

/* R15-7f item 1 (b): the padding holds the calendar button (48 px) and "Today" (84 px), so the
   whole date (11ch) gets room on top of them, at 768 px too. */
.date-box input[type="text"] {
  min-width: calc(11ch + 48px);
  padding-left: calc(var(--lx-space-2) * 6);
}

.date-box.has-today input[type="text"] {
  min-width: calc(11ch + 132px);
  padding-right: calc(var(--lx-space-1) * 21);
}

.date-pick {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

/* The browser's own picker, opened by the calendar button: invisible, not display: none (so
   showPicker() works), and without a name (never sent). */
.date-helper {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.date-box .date-today {
  position: absolute;
  right: 6px;
  min-height: var(--lx-control-table);
  padding: 2px var(--lx-space-3);
  font-size:var(--lx-fs-small);
}

/* The shared money box: "₹" inside at the left (S1-013a). */
.money-box {
  position: relative;
}

.money-box-sign {
  position: absolute;
  top: 50%;
  left: 14px;
  color: var(--text-secondary);
  font-weight: 600;
  transform: translateY(-50%);
}

.money-box input {
  padding-left: var(--lx-space-8);
}

/* The transfer form as mockup 04: two columns on a computer, one on a phone. */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--lx-space-4) var(--lx-space-6);
}

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

.transfer-card {
}

@media (min-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Transfers: a table on a computer, each transfer a card on a phone (S1-013a). Cells keep
   words whole. */
.transfers-table td,
.transfers-table th {
  overflow-wrap: normal;
}

@media (max-width: 1092px) {  /* RR21b (D236): cards up to 1092 px (cut at 768 px) */
  .transfers-table thead {
    display: none;
  }

  .transfers-table,
  .transfers-table tbody {
    display: block;
  }

  .transfers-table tr {
    display: grid;
    grid-template-areas:
      "date amount"
      "from to"
      "note note"
      "edit edit";
    grid-template-columns: auto 1fr;
    gap: 4px 8px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }

  .transfers-table td {
    display: block;
    padding: 0;
    border: 0;
    text-align: left;
  }

  .transfers-table .tr-date {
    grid-area: date;
    font-weight: 600;
  }

  .transfers-table .tr-amount {
    grid-area: amount;
    font-weight: 600;
    text-align: right;
  }

  .transfers-table .tr-from {
    grid-area: from;
  }

  .transfers-table .tr-from::after {
    content: " →";
  }

  .transfers-table .tr-to {
    grid-area: to;
  }

  .transfers-table .tr-note {
    grid-area: note;
    font-size: 0.9375rem;
  }

  .transfers-table .tr-edit {
    grid-area: edit;
  }

  .transfers-table .tr-note:empty,
  .transfers-table .tr-edit:empty {
    display: none;
  }
}

.transfer-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--waiting-soft);
  color: var(--text);
}

.money-col {
  text-align: right;
}

.all-transfers {
  margin: 12px 0 0;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--lx-space-3);
  margin-top: var(--lx-space-3);
  color: var(--text-secondary);
  font-size:var(--lx-fs-label);
}

/* ---------- Settings → Lists and the dialogs (S1-015) ---------- */

.search-form {
  flex: 1 1 14rem;
}

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

.list-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--lx-space-2) var(--lx-space-3);
  padding: var(--lx-space-3) 0;
  border-bottom: 1px solid var(--border);
}

.list-row-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.list-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--lx-space-2);
}

.list-row-actions form,
.tile-actions form {
  margin: 0;
}

.choice-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice-chips legend {
  margin-bottom: 4px;
  padding: 0;
  font-weight: 600;
}

.chip-choice {
  display: flex;
  align-items: center;
  gap: var(--lx-space-2);
  min-height: var(--lx-control);
  margin: 0;
  padding: var(--lx-space-1) var(--lx-space-4);
  border: 1px solid var(--border);
  border-radius: var(--lx-radius-round);
  font-weight: 600;
  position: relative;
  cursor: pointer;
  white-space: nowrap;
}

/* RR21b (D236): tiles wide enough that no word breaks; Edit and Hide small buttons that fit. */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(144px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.category-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 84px;
  padding: 12px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  text-align: center;
  cursor: pointer;
}

.tile-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  font-size: 0.8125rem;
  word-break: normal;
  overflow-wrap: normal;
}

.link-button {
  padding: 0;
  border: 0;
  background: var(--card);
  color: var(--primary);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.icon-picker {
  margin: 0;
  padding: 0;
  border: 0;
}

.icon-picker legend {
  margin-bottom: 4px;
  padding: 0;
  font-weight: 600;
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 8px;
}

.icon-choice {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  cursor: pointer;
}

.icon-choice input {
  position: absolute;
  opacity: 0;
}

.icon-choice:has(input:checked) {
  border: 2px solid var(--primary);
  background: var(--primary-soft);
}

.icon-choice:has(input:focus-visible) {
  outline: 3px solid var(--waiting-border);
  outline-offset: 2px;
}

.dialog {
  width: min(640px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
}

.dialog::backdrop {
  background: color-mix(in srgb, var(--lx-text) 45%, transparent);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--lx-space-4) var(--lx-space-6);
  border-bottom: 1px solid var(--border);
}

.dialog-head h2 {
  margin: 0;
}

.dialog-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--lx-control);
  height: var(--lx-control);
  border: 0;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.dialog-body {
  padding: var(--lx-space-4) var(--lx-space-6) var(--lx-space-6);
}

.dialog-add {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ---------- install on Android and the offline page (S0-009) ---------- */

.install-card h2 {
  margin-bottom: var(--lx-space-3);
}

.install-card p {
  margin: 0 0 var(--lx-space-2);
}

.offline {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-height: 100vh;
  padding: 32px 20px;
  text-align: center;
}

.offline-text {
  max-width: 24em;
  margin: 0;
  font-size: 1.125rem;
}

[hidden] {
  display: none !important;
}

/* S2-019: the Payments list's status tabs and status labels. R1-UI2: the tabs and their count
   pills take the base rules (README "Lists"); they wrap on a phone, so nothing scrolls
   sideways. */
@media (max-width: 767px), (pointer: coarse) {
  .tab {
    min-height: 44px;
  }
}

/* RR14 (R14, D223): a payment made is not red; red only for a warning. */
.payments-table .en-amount {
  color: var(--text);
}

.status {
  display: inline-block;
  padding: 2px var(--lx-space-3);
  border-radius: var(--lx-radius-round);
  background: var(--page);
  color: var(--text);
  font-size:var(--lx-fs-small);
  font-weight: 600;
  white-space: nowrap;
}

.status-paid {
  color: var(--money-in);
}

.status-waiting {
  color: var(--waiting);
}

.status-rejected {
  color: var(--money-out);
}

.status-approved {
  color: var(--primary);
}

@media (max-width: 999px) {  /* R15-7 item 0 (a): cards up to 999 px */
  .entries-table .en-status,
  .entries-table .en-action {
    grid-column: 1 / -1;
  }
}

/* P1-022b1: the stale line across an Approvals card (D131); the list's paid total (D135). */
.ap-alert {
  grid-column: 1 / -1;
  margin: 0;
}

/* R15-13 item 7 (g): the total may wrap after its "·" (the only plain space), so the Amount
   column needs only its widest amount. */
/* RR14b (D234): "Paid ₹…" on its own line under the total, right-aligned, never broken. */
.en-paid-total {
  display: block;
  font-weight: 400;
  white-space: nowrap;
}

/* S2-022 item 8: the chosen account's balance under the account box, never cut. P1-022b5
   (UI-10): its own class, at the field-help size (the Accounts page's .account-balance keeps
   its own size and margins). */
.entry-balance {
  margin: var(--lx-space-1) 0 0;
  font-size:var(--lx-fs-small);
  font-weight: 400;
}

.entry-balance:empty {
  display: none;
}

.entry-balance .money {
  white-space: nowrap;
}

/* P1-022b5 (UI-17): a whole part (an account's name, "· NEFT / RTGS / IMPS"). */
/* P1-022b5 (UI-17): the empty list's line inside the card's padding. */
.empty-list {
  padding: var(--space);
}

/* R1-UI2 (README "Lists"): one toolbar row; "Filters" opens the panel under it on every width
   (was the phone only, P1-022b5 UI-17). */
[data-filters][data-closed] {
  display: none;
}

/* P1-022b5 (UI-15): "See all" after the newest five. */
.see-all {
  display: block;
  padding: var(--lx-space-3) var(--lx-space-4);
  font-weight: 600;
}

/* S2-020: the Payments list's next step ("Mark paid", "Edit and send again"), Open's buttons and
   the "Approved by" / "Rejected by" line. */
.en-action {
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 999px) {  /* R15-7 item 0 (a): cards up to 999 px */
  .entries-table .en-action {
    grid-column: 1 / -1;
    text-align: left;
  }
}

.entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.decision-line {
  display: block;
  margin-top: 4px;
  color: var(--text-secondary);
}

/* B-258, C013 No. 3 (D376): the approver's corrections on the payment, "old → new". */
.correction-line {
  display: block;
}

.correction-field {
  font-weight: 600;
}

.correction-change {
  color: var(--text-secondary);
}

.seek-block {
  display: flex;
  gap: var(--lx-space-2);
  flex-direction: column;
  align-items: flex-end;
}

/* S2-020: Approvals (mockups 31, 46): one card per payment, its buttons on the right; on a phone
   the buttons go under it, side by side. */
.approvals-attention {
  margin-bottom: 0;
}

.attention-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 0 0;
}

.approval-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  margin-bottom: 0;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.ap-asked,
.ap-reason {
  margin: 0;
  color: var(--text-secondary);
}

.ap-party {
  margin: 4px 0;
  font-size: var(--lx-fs-heading);
}

.ap-amount {
  margin: 0;
  font-size: var(--lx-fs-figure);
  font-weight: 700;
  white-space: nowrap;
}

.ap-details {
  display: grid;
  gap: 12px 24px;
  margin: 0;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
}

.ap-details div {
  display: flex;
  gap: 2px;
  flex-direction: column;
  min-width: 0;
}

.ap-details dt {
  min-width: 0;
  color: var(--text-secondary);
  font-size: var(--lx-fs-small);
  font-weight: 500;
}

.ap-details dd {
  margin: 0;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.ap-files {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.ap-file {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text);
  text-decoration: none;
}

.ap-file-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.ap-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 170px;
}

.ap-buttons form,
.ap-buttons .btn {
  width: 100%;
}

.ap-reject summary {
  list-style: none;
}

.ap-reject summary::-webkit-details-marker {
  display: none;
}

.ap-reject-form {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.approvals-line {
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  font-size: 0.9286rem;
}

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

  .ap-buttons {
    flex-direction: row;
    flex-wrap: wrap;
    min-width: 0;
  }

  .ap-buttons > * {
    flex: 1 1 120px;
  }

  /* UI-6 (D143): Reject on the left, Approve on the right; the reason box takes the width. */
  .ap-reject {
    order: 1;
  }

  .ap-approve {
    order: 2;
  }

  .ap-open {
    order: 3;
  }

  .ap-reject[open] {
    flex-basis: 100%;
  }
}

/* UI-8 (D145): a chosen file's row: its name, its "Bill" / "Payment proof" and "Remove". */
.file-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--lx-space-2);
}

.file-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* UI-9 (D145): "Remove" apart from the file's link, a 44 px button; the question's page. */
.file-list .btn-remove {
  min-height: var(--lx-control);
  margin-left: auto;
}

/* P1-022c1 (D150): the saved file's row and its question inside the page take the whole row;
   the question's buttons wrap under it on a phone. */
.file-list [data-file-shown],
.file-list .remove-question {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--lx-space-2);
  width: 100%;
}

.file-list .remove-question .form-buttons {
  margin: 0;
}

.file-list .remove-question .btn {
  min-height: var(--lx-control);
}

/* D150: "Leave this page?" */
.leave-dialog .dialog-body {
  padding: var(--lx-space-6);
}

.leave-dialog .form-buttons {
  justify-content: flex-end;
}

/* A small label next to a name (S2-018f: "Owner"); R1-UI3: its own name, so .tag is the
   status / type tag only. */
.name-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

/* A value shown in a form where there is no choice (P0-018e: "Held by a Laxmi user"). */
.field-value {
  margin: 0;
  padding: 10px 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* ---------- receipts (S2-018; mockups 05, 06, 25) ---------- */

.entry-card {
}

.form-grid fieldset.field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.form-grid fieldset.field legend {
  margin-bottom: var(--lx-space-2);
  padding: 0;
  font-weight: 600;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--lx-space-2);
}

/* A chip that is a radio button: the input stays usable by keyboard, the chip shows the choice. */
.chip-choice input,
.tile-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.chip-choice:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.chip-choice:has(input:focus-visible),
.tile-choice:has(input:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.chip-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-style: dashed;
  color: var(--primary);
}

.party-search {
  margin-bottom: 6px;
}

.mode-block .chips {
  margin-bottom: var(--lx-space-3);
}

/* R1-UI5 (the Owner, 20:59: "align this properly"): the reference box is one cell of the grid.
   One reference field fills it; a cheque's number and date are its two halves, the bank under
   them. The label stays on one line; the help sits under the box. */
.reference-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--lx-space-4);
  align-content: start;
}

.reference-box[hidden] {
  display: none;
}

.reference-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--lx-space-4) var(--lx-space-4);
}

.reference-box .field-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-box .field-help {
  margin: var(--lx-space-1) 0 0;
  font-size:var(--lx-fs-small);
}

/* C-340 (C006 section 2; the chat's review of MC2): a payment's Crossed (A/C Payee) / Bearer sits
   under the Cheque No. at the cell's full width, one line each, never broken inside a word. */
.reference-box > .cheque-kind-under {
  display: flex;
  flex-wrap: wrap;
  gap: var(--lx-space-1) var(--lx-space-4);
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.cheque-kind-under .check {
  white-space: nowrap;
}

.files-block .file-rows {
  display: flex;
  flex-direction: column;
  gap: var(--lx-space-2);
  margin-bottom: var(--lx-space-2);
}

.file-row input[type="file"] {
  min-width: 0;
  max-width: 100%;
}

.file-list {
  margin: 0 0 var(--lx-space-3);
  padding: 0;
  list-style: none;
}

.file-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--lx-space-2);
  padding: var(--lx-space-2) 0;
  overflow-wrap: anywhere;
}

.gst-block {
  padding: var(--lx-space-4) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-small);
  background: var(--page);
}

.gst-block legend {
  padding: 0 var(--lx-space-2) !important;
}

.gst-switches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--lx-space-3) var(--lx-space-6);
  margin: var(--lx-space-3) 0;
}

.switch-line {
  display: flex;
  align-items: center;
  gap: var(--lx-space-2);
  min-height: var(--lx-control);
  font-weight: 600;
}

.switch-line input {
  width: 20px;
  height: var(--lx-icon);
  accent-color: var(--primary);
}

.gst-parts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 0;
}

.gst-parts > span {
  white-space: nowrap;
}

.category-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}

.tile-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 84px;
  padding: 10px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  text-align: center;
  cursor: pointer;
}

.tile-choice:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.tile-more {
  border-style: dashed;
}

/* R1-UI2 (README "Lists", 02-receipts, 04-payments): one toolbar row, the Filters panel, the
   chips of the filters in use, the table in a card and the line under it; cards on a phone. */
.list-filters {
  display: flex;
  flex-direction: column;
  gap: var(--lx-space-3);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--lx-space-3);
}

.toolbar-search {
  display: flex;
  flex: 1 1 280px;
  align-items: center;
  gap: var(--lx-space-2);
  min-width: 0;
  margin: 0;
  padding: 0 var(--lx-space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--card);
  color: var(--muted);
}

.toolbar-search .icon {
  width: 16px;
  height: var(--lx-icon-small);
}

.toolbar-search input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.toolbar-search input:focus-visible {
  outline: none;
}

.toolbar-search:focus-within {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.toolbar-select {
  flex: 0 1 190px;
  width: auto;
  min-width: 0;
}

.filters-toggle .icon {
  width: 16px;
  height: var(--lx-icon-small);
}

.filters-panel {
  display: flex;
  flex-direction: column;
  gap: var(--lx-space-4);
  padding: var(--lx-space-4) var(--lx-space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: var(--lx-space-4) var(--lx-space-6);
}

.filters-grid .field {
  margin: 0;
}

.filters-panel .custom-dates {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: var(--lx-space-4) var(--lx-space-6);
}

.filters-panel .custom-dates[hidden] {
  display: none;
}

.filters-panel-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--lx-space-3);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--lx-space-2);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--lx-space-2);
  min-height: var(--lx-control-table);
  padding: 2px var(--lx-space-3);
  border: 1px solid var(--primary-soft-border);
  border-radius: var(--lx-radius-round);
  background: var(--primary-soft);
  color: var(--primary);
  font-size:var(--lx-fs-label);
  font-weight: 500;
  text-decoration: none;
}

.table-card {
  padding: 0;
  overflow: hidden;
}

/* RR14 (R19, D228): every heading lines up with its column's data: text left, amounts right,
   the same side padding as the cells (16 px). */
.entries-table th {
  padding: var(--lx-space-3) var(--lx-space-4);
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.entries-table th.money-col,
.entries-table td.money-col {
  text-align: right;
}

/* B-250 (R43, D344; the Owner, 16/11 08:14 IST): the Payments, Receipts and Contra lists
   (`.en-colours`): each kind of value in its own colour, the same on the three lists and on a
   phone's cards; tones from the themes' variables only (Blue and Maroon), every text at least
   4.5:1 on its cell (the lightest cell is the table-head tint, #F9FAFB). Red only for warnings. */
.en-colours .en-date {
  color: var(--muted);
  white-space: nowrap;
}

.en-colours .en-party,
.en-colours .en-party a {
  background: transparent;
  color: var(--text);
  font-weight: 600;
}

.en-colours .en-narration {
  color: var(--text-secondary);
}

.en-colours .en-account {
  color: var(--primary);
  text-decoration: none;
}

.en-colours .en-account a {
  color: var(--primary);
}

.en-colours .en-amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.payments-table.en-colours .en-amount {
  color: var(--text);
}

.receipts-table.en-colours .en-amount {
  color: var(--money-in);
}

.transfers-table.en-colours .en-amount {
  color: var(--text);
}

/* The table (from 1093 px; cards below): every heading centred over its column, bold, on the
   table-head tint, a little taller; Date and Status centred, names and narration from the left,
   amounts from the right; a thin line between columns and rows; every other column tinted.
   B-255 (the chat's review of MC2 at 1440 px): the table fits its card. The status chip keeps one
   line and its buttons (Edit, Voucher, Print, Generate Voucher) wrap onto the next line inside the
   cell, each button whole, never past the edge (B-250 had them beside the chip on one line, and
   the 1280 px rules kept the cell and RR30's two buttons from wrapping); Paid From / Received Into
   and Narration wrap between words; amounts never break. */
@media (min-width: 1093px) {
  .en-colours th,
  .en-colours th.money-col {
    padding: var(--lx-space-3) var(--lx-space-4);
    background: var(--table-head);
    color: var(--text);
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
  }

  .en-colours td {
    border-bottom: 1px solid var(--row-line);
    vertical-align: middle;
  }

  .en-colours td + td,
  .en-colours th + th {
    border-left: 1px solid var(--row-line);
  }

  .en-colours td:nth-child(even) {
    background: var(--table-head);
  }

  .en-colours td.en-date,
  .en-colours td.en-status {
    text-align: center;
  }

  .en-colours td.en-amount {
    text-align: right;
    white-space: nowrap;
  }

  .table-card .en-colours td.en-status {
    width: auto;
    min-width: 0;
    white-space: normal;
  }

  .en-colours td.en-status .tag {
    white-space: nowrap;
  }

  .en-colours .en-status-line {
    white-space: nowrap;
  }

  .en-colours .en-status-actions,
  .en-colours .en-status-actions:has(.en-voucher) {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 8px 0 0;
  }

  .en-colours .en-status-actions .btn {
    white-space: nowrap;
  }

  .en-colours td.en-account,
  .en-colours td.en-narration {
    min-width: 0;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
  }
}

/* B-255b (the chat's review of B-255 at 390 px): on the cards (below 1093 px, so on a phone too)
   a row's buttons wrap inside the card. "Print RTGS / NEFT Form and Cheque" ran past the edge on
   one line (every .btn keeps one line); now a button never grows past the card, its words wrap at
   spaces inside it, and the row's own action (Mark Paid, a print button) takes the card's full
   width. Payments, Receipts and Contra alike. */
@media (max-width: 1092px) {
  .en-colours td.en-status {
    min-width: 0;
    white-space: normal;
  }

  .en-colours .en-status-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 100%;
  }

  .en-colours .en-status-actions .btn {
    max-width: 100%;
    min-width: 0;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    text-align: center;
  }

  .en-colours .en-status-actions .btn:not(.btn-small) {
    flex: 1 1 100%;
  }
}

/* RR14 (R16, R20; D225, D229): the "Pending: …" tags under the party's lines; the narration in
   its own column, wrapping between words; the row's "Add Number" and "Edit" side by side. */
.en-pending {
  display: block;
  margin-top: var(--lx-space-1);
}

.en-pending .tag {
  display: inline-block;
  margin: 0 var(--lx-space-1) var(--lx-space-1) 0;
  white-space: nowrap;
}

.en-narration {
  min-width: 140px;
  color: var(--text-secondary);
  overflow-wrap: normal;
}

.en-action .btn + .btn,
.en-status-more .btn + .btn {
  margin-left: var(--lx-space-2);
}

.entries-table td {
  padding: var(--lx-space-3) var(--lx-space-4);
  vertical-align: middle;
}

.entries-table td,
.entries-table th {
  overflow-wrap: normal;
}

.entries-table tbody tr:last-child td {
  border-bottom: 1px solid var(--border);
}

.en-date {
  color: var(--text-secondary);
  white-space: nowrap;
}

.en-party a {
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.en-party a:hover {
  color: var(--primary);
}

.en-reason {
  display: block;
  color: var(--text-secondary);
  font-size:var(--lx-fs-label);
}

.en-account {
  white-space: nowrap;
}

.en-mode {
  color: var(--muted);
  font-size: 0.8571rem;
}

/* R15-4 item 0 (review of R15-2b): the mode under the account stays its own line; the Mode column's
   cell is a plain cell (centred in its row, the row's line through it, the mode on one line). */
.en-account .en-mode {
  display: block;
}

td.en-mode {
  white-space: nowrap;
  vertical-align: middle;
}

.en-amount {
  color: var(--money-in);
  font-weight: 600;
  white-space: nowrap;
}

.entries-table tfoot td {
  border-bottom: 0;
  background: var(--table-head);
  color: var(--text);
  font-weight: 600;
}

.list-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--lx-space-3);
}

.list-showing {
  margin: 0;
  color: var(--text-secondary);
  font-size:var(--lx-fs-label);
}

/* R1-UI2: the other lists in the same pattern: a card with no padding of its own; its head,
   rows and table cells carry the 16-20 px. */
.list-card-head,
.table-card .card-head {
  margin: 0;
  padding: var(--lx-space-4) var(--lx-space-6);
  border-bottom: 1px solid var(--row-line);
}

.list-card-title {
  margin: 0;
  padding: var(--lx-space-4) var(--lx-space-6) 0;
  color: var(--text);
  font-size:var(--lx-fs-body);
  font-weight: 600;
}

.list-card .list-row {
  padding: var(--lx-space-3) var(--lx-space-6);
  border-bottom-color: var(--row-line);
}

.list-card .list-row:last-child {
  border-bottom: 0;
}

.list-card > .plain-list > li.text-secondary {
  padding: var(--lx-space-3) var(--lx-space-6);
}

.table-card th,
.table-card td {
  padding-right: var(--lx-space-4);
  padding-left: var(--lx-space-4);
}

@media (max-width: 1092px) {  /* RR21b (D236): cards up to 1092 px (cut at 768 px) */
  .table-card .users-table tr,
  .table-card .transfers-table tr {
    padding-right: var(--lx-space-4);
    padding-left: var(--lx-space-4);
  }
}

/* M-111 (D346): the Contra list fits its card. From 1093 px a fixed layout: Date, Amount and Edit
   their own widths, From and To a share each (wrapping between words), the narration the rest
   (wrapping), Edit always seen; a word longer than its column breaks only where it would not fit.
   Below 1093 px the cards: the date with the amount at the right on one line, From and To each on
   its own line under it, nothing past the card's edge. */
@media (min-width: 1093px) {
  .transfers-table {
    table-layout: fixed;
  }

  .table-card .transfers-table th,
  .table-card .transfers-table td {
    padding-right: var(--lx-space-3);
    padding-left: var(--lx-space-3);
  }

  .transfers-table td {
    overflow-wrap: break-word;
  }

  .transfers-table th:nth-child(1) {
    width: 7.5rem;
  }

  .transfers-table th:nth-child(2),
  .transfers-table th:nth-child(3) {
    width: 18%;
  }

  .transfers-table th:nth-child(4) {
    width: 10.5rem;
  }

  .transfers-table th:nth-child(6) {
    width: 7rem;
  }

  .transfers-table .tr-amount,
  .transfers-table .tr-edit {
    white-space: nowrap;
  }
}

@media (max-width: 1092px) {
  .transfers-table tr {
    grid-template-areas:
      "date amount"
      "from from"
      "to to"
      "note note"
      "edit edit";
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .transfers-table td {
    min-width: 0;
    overflow-wrap: break-word;
  }

  .transfers-table .tr-amount {
    white-space: nowrap;
  }
}

@media (max-width: 767px) {
  .toolbar-search {
    flex-basis: 100%;
  }

  /* RR21b (D236): on a phone the Period and Account selects stack full width ("This Financial
     Year" whole). */
  .toolbar-select {
    flex: 1 1 100%;
    width: 100%;
  }

  .en-pending .tag {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: break-word;
  }
}

.paperclip {
  display: inline-flex;
  color: var(--text-secondary);
}

@media (max-width: 999px) {  /* R15-7 item 0 (a): cards up to 999 px */
  .entries-table thead {
    display: none;
  }

  .entries-table,
  .entries-table tbody,
  .entries-table tfoot {
    display: block;
  }

  .entries-table tr {
    display: grid;
    grid-template-areas:
      "date amount"
      "party party"
      "account type";
    grid-template-columns: 1fr auto;
    gap: var(--lx-space-1) var(--lx-space-2);
    padding: var(--lx-space-3) var(--lx-space-4);
    border-bottom: 1px solid var(--row-line);
  }

  .entries-table td {
    display: block;
    padding: 0;
    border: 0;
    text-align: left;
  }

  .entries-table .en-date {
    grid-area: date;
    font-weight: 600;
  }

  .entries-table .en-amount {
    grid-area: amount;
    text-align: right;
  }

  .entries-table .en-party {
    grid-area: party;
  }

  .entries-table .en-account {
    grid-area: account;
    font-size:var(--lx-fs-label);
  }

  .entries-table .en-type {
    grid-area: type;
    text-align: right;
  }

  .entries-table .en-account {
    white-space: normal;
  }

  .entries-table .en-account .en-mode {
    display: inline;
  }

  .entries-table .en-account .en-mode::before {
    content: " · ";
  }

  .entries-table tfoot tr {
    grid-template-areas: "label amount";
  }

  .entries-table .en-total-label {
    grid-area: label;
  }
}

/* Open: the whole receipt, its files and its history. */
.entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.entry-amount {
  margin: 0;
  color: var(--money-in);
  font-size: var(--lx-fs-figure);
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

/* UI-3: money that went out (a payment's Open and Mark paid). */
/* RR14 (R14, D223): a payment made is not red; red only for a warning. */
.entry-amount-out {
  color: var(--text);
}

.entry-party {
  margin: 4px 0 0;
  font-weight: 600;
  font-size: var(--lx-fs-heading);
}

.details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: var(--lx-space-3) 24px;
  margin: 0 0 var(--lx-space-6);
}

.details div {
  min-width: 0;
}

.details dt {
  color: var(--text-secondary);
  font-size: var(--lx-fs-small);
  font-weight: 500;
}

.details dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-weight: 500;
}

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

.history {
  margin: 0 0 var(--lx-space-6);
  padding: 0;
  list-style: none;
}

.history li {
  padding: var(--lx-space-2) 0;
  border-bottom: 1px solid var(--border);
  border-bottom-color: var(--row-line);
}

.history-line,
.history-detail {
  margin: 0;
}

.history-detail {
  color: var(--text-secondary);
  font-size: var(--lx-fs-label);
  overflow-wrap: anywhere;
}

/* ---------- shown only on a computer or only on a phone (S0-007a) ---------- */

@media (max-width: 767px) {
  .computer-only {
    display: none;
  }
}

@media (min-width: 768px) {
  .phone-only {
    display: none;
  }
}

/* ---------- utilities ---------- */

/* B-L10a2: the usual pattern, so no section's rule can widen what is hidden. */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- EMI / Bills (B-006, S4 section 4, mockup 12): cards on every width ---------- */

.emi-list .card-head p {
  margin: 0;
}

.emi-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: var(--space);
}

.emi-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: var(--space);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  overflow-wrap: break-word;
}

.emi-card-missed {
  border-color: var(--waiting);
  background: var(--waiting-soft);
}

.emi-card-stopped {
  opacity: 0.85;
}

.emi-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.emi-title {
  flex: 1 1 10rem;
  min-width: 0;
}

.emi-title h3,
.emi-title p,
.emi-progress p {
  margin: 0;
}

.emi-details {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 16px;
  margin: 0;
}

.emi-details dt {
  color: var(--text-secondary);
}

.emi-details dd {
  margin: 0;
  font-weight: 600;
}

.emi-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.emi-bar {
  width: 100%;
  height: 8px;
  accent-color: var(--primary);
}

.emi-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.emi-buttons form {
  margin: 0;
}

/* The interest rate box: "% a year" inside the box at the right. */
.rate-box {
  position: relative;
}

.rate-box input {
  padding-right: calc(var(--lx-space-8) * 3);
}

.rate-box-unit {
  position: absolute;
  top: 50%;
  right: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
  transform: translateY(-50%);
}

[data-emi-form] [hidden] {
  display: none;
}

/* ---------- R1-UI3: the entry forms (03-new-receipt, 06-phone-new-receipt, README "Forms") ---------- */

.entry-form {
  display: flex;
  flex-direction: column;
  gap: var(--lx-space-6);
}

.form-section .section-title {
  margin: 0 0 var(--lx-space-4);
}

.form-section .form-grid {
  gap: var(--lx-space-4) var(--lx-space-6);
}

.field-label {
  display: block;
  min-height: var(--lx-icon);
  margin-bottom: var(--lx-space-2);
  color: var(--text-secondary);
  font-size:var(--lx-fs-label);
  font-weight: 500;
}

.field-link {
  margin-top: var(--lx-space-2);
  background: var(--card);
  color: var(--primary);
  font-size:var(--lx-fs-label);
  font-weight: 600;
  text-decoration: none;
}

/* S11-2z: Via Representative's "+ Add New" opens the people dialog: a button that looks as the link. */
button.field-link {
  border: 0;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
}

/* ONE searchable box: the matches drop down under it. */
.combo {
  position: relative;
}

.combo-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  display: inline-flex;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.combo-icon .icon {
  width: 16px;
  height: var(--lx-icon-small);
}

.combo-input {
  padding-left: calc(var(--lx-space-1) * 9);
}

.combo-list {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  z-index: 25;
  max-height: 280px;
  margin: 0;
  padding: var(--lx-space-1);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--card);
  list-style: none;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--lx-text) 10%, transparent);
}

.combo-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  overflow-wrap: anywhere;
}

.combo-option:hover,
.combo-active {
  background: var(--primary-soft);
  color: var(--primary);
}

.combo-option[aria-selected="true"] {
  font-weight: 600;
}

.combo-line {
  flex: none;
  color: var(--text-secondary);
  font-size: 0.8571rem;
}

.combo-add {
  margin-top: 4px;
  border-top: 1px solid var(--row-line);
  border-radius: 0 0 6px 6px;
  background: var(--card);
  color: var(--primary);
  font-weight: 600;
}

/* With the script, the select is what is sent but the box is what is seen. */
.js .combo-native {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The second card: the attachments beside "More options". */
.form-more {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--lx-space-6) var(--lx-space-6);
}

.drop-zone {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--lx-space-3);
  padding: var(--lx-space-4);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--table-head);
}

.drop-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--lx-control);
  height: var(--lx-control);
  flex: none;
  border-radius: var(--radius-small);
  background: var(--primary-soft);
  color: var(--primary);
}

.drop-words {
  display: flex;
  flex: 1 1 180px;
  flex-direction: column;
  min-width: 0;
}

.drop-title {
  font-weight: 600;
}

.form-more .file-list,
.form-more .file-rows {
  margin-top: var(--lx-space-3);
}

.more-options {
  display: flex;
  flex-direction: column;
  gap: var(--lx-space-1);
}

.more-title {
  margin: 0 0 var(--lx-space-1);
  color: var(--text-secondary);
  font-size:var(--lx-fs-label);
  font-weight: 600;
}

.more-options .switch-line {
  min-height: var(--lx-control);
  font-weight: 500;
  gap: var(--lx-space-3);
}

.more-options .gst-block {
  margin: var(--lx-space-1) 0 var(--lx-space-2);
  padding: var(--lx-space-3) !important;
}

.form-actions {
  margin: 0;
}

@media (min-width: 768px) {
  .form-more {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

/* The phone (06-phone-new-receipt): a back arrow and the title at the top; the save buttons in
   a bar fixed at the bottom (48 px), where the quick menu was. */
.phone-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: var(--lx-touch);
  margin-left: calc(var(--lx-space-3) * -1);
  background: var(--card);
  color: var(--text);
}

@media (max-width: 767px) {
  .form-page .bottom-bar {
    display: none;
  }

  .form-page .form-actions {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 12;
    display: grid;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    gap: var(--lx-space-3);
    padding: var(--lx-space-3) var(--lx-space-4) calc(var(--lx-space-3) + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: var(--card);
  }

  .form-page .form-actions .btn {
    min-height: var(--lx-touch);
    white-space: normal;
  }

  .form-page .form-actions .btn-plain {
    display: none;
  }
}

/* The payment form: its "Payment | Advance payment" switch at the top of its card (D101, D103),
   small; the seek-approval line above its buttons. */
.form-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--lx-space-3);
  margin-bottom: var(--lx-space-4);
}

.form-section-head .section-title {
  margin: 0;
}

.payment-kind {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.segmented-small label {
  min-height: 32px;
  padding: 0 14px;
  font-size: 0.9286rem;
}

.bill-line {
  margin: calc(var(--lx-space-2) * -1) 0 var(--lx-space-4);
}

.grid-gap {
  display: none;
}

.seek-block .field-help {
  margin: 0;
}

@media (min-width: 768px) {
  .grid-gap {
    display: block;
  }
}

@media (max-width: 767px), (pointer: coarse) {
  .segmented-small label {
    min-height: 44px;
  }
}

/* ---------- R1-UI4: Approvals (05-approvals, README "Approvals") ---------- */

.ap-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.ap-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.ap-top .ap-asked {
  font-size: var(--lx-fs-label);
}

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

.ap-head .ap-party {
  margin: 0;
  font-size: var(--lx-fs-heading);
  font-weight: 600;
}

.ap-head .ap-amount {
  font-size: var(--lx-fs-figure);
  font-variant-numeric: tabular-nums;
}

/* The details as small label-value pairs. */
.ap-buttons .btn {
  justify-content: flex-start;
}

.decided-row {
  flex-wrap: wrap;
}

.decided-who {
  flex: none;
  font-size: var(--lx-fs-label);
}

.approvals-line .icon {
  width: 16px;
  height: var(--lx-icon-small);
  margin-top: 2px;
}

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

  .ap-buttons {
    min-width: 0;
  }

  .decided-who {
    flex-basis: 100%;
    margin-left: 0;
  }
}

.decided-recently {
  padding: 0;
  overflow: hidden;
}

.decided-recently .list-card-title {
  padding-bottom: var(--lx-space-2);
}

/* R1-UI4: controls are 36 px on a computer; a phone or any coarse pointer keeps 44 px touch
   sizes (README "Type and sizes"). */
@media (max-width: 767px), (pointer: coarse) {
  .chip,
  .segmented label,
  .file-list .btn-remove,
  .file-list .remove-question .btn,
  .switch-line,
  .account-link,
  .list-link,
  .bell-item {
    min-height: var(--lx-touch);
  }

  .dialog-close {
    width: 44px;
    height: var(--lx-touch);
  }
}

/* ---------- R1-UI4: every remaining screen in the new look (README "Type and sizes") ---------- */

/* An entry's page: the amount 22 px / 700; the details as small label-value pairs; the history
   as rows under row lines. */
.entry-open .section-title {
  margin: var(--lx-space-2) 0 var(--lx-space-3);
  padding-top: var(--lx-space-4);
  border-top: 1px solid var(--row-line);
}

.history-line {
  font-size: var(--lx-fs-label);
}

/* Settings, More and the account menu's links: rows under row lines, the icon muted. */
.list-link {
  padding: 10px 20px;
  font-weight: 500;
}

.list-link .icon {
  width: 18px;
  height: var(--lx-icon);
  color: var(--text-secondary);
}

/* Accounts: each account card as the new cards; its balance 22 px / 700. */
/* "Coming soon", the error pages and "You do not have access": a quiet card. */
/* The pages of a list. */
/* The powers' list (Add user, Change powers). */

/* ---------- R1-UI5 (D163): the full width; forms three across from 1280 px ---------- */

/* The masters' and Settings' forms: their fields in the same columns; anything that is not a
   field (a tick, a group of powers, the buttons, a message) takes the whole row. */
.form-card .form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--lx-space-4) var(--lx-space-6);
}

.form-card .form > :not(.field) {
  grid-column: 1 / -1;
}

/* "More options": the ticks 16 px on a computer, in line with their words (18 px with 44 px
   touch rows on a phone, by the touch rule). */
.more-options .switch-line input {
  width: 16px;
  height: var(--lx-icon-small);
  margin: 0;
  flex: none;
}

/* The receipt and payment card. On a phone the page's own order (06-phone-new-receipt); from
   768 px the areas place the cells two across (today's order), from 1280 px three across
   (README, D163). */
@media (min-width: 768px) {
  .entry-grid > .field:has(#id_date) {
    grid-area: date;
  }

  .entry-grid > .field:has(#id_amount) {
    grid-area: amount;
  }

  .entry-grid > .field:has(#id_paid_date) {
    grid-area: paid;
  }

  .entry-grid > .cell-party {
    grid-area: party;
  }

  .entry-grid > .cell-account {
    grid-area: account;
  }

  .entry-grid > .cell-mode {
    grid-area: mode;
  }

  .entry-grid > .cell-reference {
    grid-area: reference;
  }

  .entry-grid > .cell-type {
    grid-area: type;
  }

  .entry-grid > .cell-category {
    grid-area: category;
  }

  .entry-grid > .cell-reason {
    grid-area: reason;
  }

  .entry-grid > .cell-invoice {
    grid-area: invoice;
  }

  .entry-grid {
    grid-template-areas:
      "date amount"
      "party account"
      "mode reference"
      "type category"
      "reason reason"
      "invoice .";
  }

  .entry-grid.has-paid {
    grid-template-areas:
      "date amount"
      "paid ."
      "party account"
      "mode reference"
      "type category"
      "reason reason"
      "invoice .";
  }

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

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

  .entry-grid {
    grid-template-areas:
      "date amount mode"
      "party account reference"
      "type category invoice"
      "reason reason .";
  }

  .entry-grid.has-paid {
    grid-template-areas:
      "date amount mode"
      "party account reference"
      "type category invoice"
      "reason reason paid";
  }

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

@media (max-width: 767px), (pointer: coarse) {
  .more-options .switch-line input {
    width: 18px;
    height: var(--lx-icon);
  }
}

/* ---------- R1-UI6: the red star (D161) and "+ Add New" (D162) ---------- */

/* A field the server refuses empty: a red star after its label; any other field no mark. */
.req {
  color: var(--money-out);
  font-weight: 600;
}

/* The person search with nothing found. */
.combo-none {
  padding: 6px 10px;
  color: var(--text-secondary);
  font-size: 0.9286rem;
}

/* ---------- R1-UI7: "Not Required" (D161) and the person / firm's fields (D164, D167) ---------- */

/* "Not Required" under a reference or the Invoice No.: a small tick in line with its word. */
.not-required {
  min-height: 32px;
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 0.9286rem;
  font-weight: 500;
}

.not-required input {
  width: 16px;
  height: 16px;
  margin: 0;
}

/* The quick add "Add New Person / Firm": 720 px wide on a computer, two columns from 768 px. */
#party-dialog {
  width: min(720px, 94vw);
  max-width: 720px;
}

.party-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px 24px;
}

.party-grid .field {
  margin: 0;
}

/* Party Type: the ticks two to a row on a phone, three on a computer; 16 px boxes. */
.type-ticks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 16px;
}

.type-ticks .switch-line {
  font-weight: 500;
}

.type-ticks .switch-line input {
  width: 16px;
  height: var(--lx-icon-small);
  margin: 0;
}

.party-types {
  position: relative; /* RR7 (D215): "+ Add Party Type" sits beside the legend */
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

/* RR7 (D215): "Party Type" with "+ Add Party Type" beside it; its small dialog. */
/* RR21b (D236): on its own line under the types. */
.party-types > .party-type-add {
  display: inline-block;
  margin-top: 8px;
}

/* E-608, C035 s3: a ticked type's Works under the types: its name and "+ Add Work", then ticks. */
.party-works {
  margin-top: var(--lx-space-2);
  padding-left: var(--lx-space-3);
  border-left: 2px solid var(--lx-line);
}

.party-works[hidden] {
  display: none;
}

.party-works-head {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
  margin: 0 0 4px;
  font-weight: 600;
}

.party-works-head .party-work-add {
  font-weight: 500;
}

.dialog-small {
  width: min(420px, calc(100vw - 24px));
}

.party-type-body {
  padding: 16px 20px;
}

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

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

  .type-ticks {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767px), (pointer: coarse) {
  .type-ticks .switch-line,
  .not-required {
    min-height: var(--lx-touch);
  }

  .type-ticks .switch-line input,
  .not-required input {
    width: 18px;
    height: var(--lx-icon);
  }
}

/* R1-UI8 (D165): "Print Cash Voucher" beside the saved message. */
.message-action {
  margin-left: var(--lx-space-2);
  vertical-align: middle;
}

/* ---------- R1-UI9 (D166): the settings pages across the width, and the review fixes ---------- */

/* Settings: a grid of cards, one across on a phone, two from 768 px, three from 1280 px. */
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space);
}

.settings-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}

.settings-card h2 {
  margin: 0;
}

.settings-line {
  flex: 1;
  margin: 0;
  color: var(--text-secondary);
}

/* RR21b (D236): the cards in a row of equal height (the grid stretches them), the buttons along the
   bottom. */
.settings-action,
.settings-card > .settings-form {
  margin: auto 0 0;
  padding-top: 8px;
}

.settings-form .form-buttons {
  justify-content: flex-start;
}

/* One "Actions" menu per row (a <details data-menu>: Escape and a click outside close it). */
.row-menu {
  position: relative;
  display: inline-block;
}

.row-menu-button {
  list-style: none;
  cursor: pointer;
}

.row-menu-button::-webkit-details-marker {
  display: none;
}

.row-menu-panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  /* R1-UI10: above everything (the script places it with position: fixed from its button); on a
     short screen it scrolls inside itself. */
  z-index: 30;
  display: flex;
  flex-direction: column;
  min-width: 14rem;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  padding: var(--lx-space-2) 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--lx-text) 10%, transparent);
}

.row-menu-item {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 16px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.row-menu-item:hover,
.row-menu-item:focus-visible {
  background: var(--primary-soft);
}

/* The users' table fits a computer; on a phone its rows are cards. So the open menu is not cut
   off by the table's box. */
.table-wrap:has(.users-table) {
  overflow: visible;
}

/* My Profile: the two forms side by side from 1280 px, the devices across under them. */
.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space);
  margin-bottom: var(--space);
}

.profile-grid > .card {
  margin: 0;
}

/* Accounts: a cash card starts as wide as a bank card needs for its buttons at the top right
   (27rem, the container query above); on a phone the buttons go under the name on both. */
.cash-accounts .account-cards {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 40rem), 1fr));
}

/* Transfer: the Note across both columns from 768 px. */
.transfer-note {
  grid-column: 1 / -1;
}

/* Add User and Change Powers: the role at the top under its label, the powers across the width
   as a grid of ticks, each with its line under it. */
.form-card .form > .role-choice,
.form-card .form > .powers {
  grid-column: 1 / -1;
}

.role-choice {
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: flex-start;
}

.power-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px 24px;
}

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

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

@media (min-width: 1280px) {
  .settings-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

  /* RR21b (R12, D221, D236): Date · From · To; Amount · Narration. */
  .form-card .form[data-transfer-form] {
    grid-template-areas:
      "date from to"
      "amount note note";
  }

  [data-transfer-form] > .field:has(#id_from_account) {
    grid-area: from;
  }

  [data-transfer-form] > .field:has(#id_to_account) {
    grid-area: to;
  }

  [data-transfer-form] > .field:has(#id_amount) {
    grid-area: amount;
  }

  [data-transfer-form] > .field:has(#id_date) {
    grid-area: date;
  }

  [data-transfer-form] > .transfer-note {
    grid-area: note;
  }
}

@media (max-width: 767px) {
  .row-menu-panel {
    right: auto;
    left: 0;
  }
}

/* ---------- R1-UI11 (D171): every box of a row the same height; the tick fields ---------- */

/* A label with "Not Required" at its right end: one line, the label's own height, so the box
   below lines up with the boxes beside it. */
/* RR21b (R12, D221, D236): every label row at least the same height (a plain label too), so the
   boxes in a row line up. */
.field-label-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--lx-space-2);
  min-width: 0;
  min-height: var(--lx-icon);
  margin-bottom: var(--lx-space-2);
}

.field-label-line .field-label {
  min-width: 0;
  margin-bottom: 0;
}

.field-label-line .not-required {
  flex: none;
  gap: var(--lx-space-2);
  min-height: 0;
  margin: 0;
  font-size:var(--lx-fs-label);
  line-height: 1.2;
}

.field-label-line .not-required input {
  width: 14px;
  height: var(--lx-icon-small);
}

/* "On Behalf Of" and "Adjust Against": one under the other, the normal space between fields. */
.tick-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--lx-space-4);
}

/* From 1280 px a cheque's bank takes the empty third cell beside Narration: the reference box
   lets its cells join the grid (its number and date stay the reference cell). With the paid
   date in that cell (a payment marked paid), the bank stays under the cheque's fields. */
@media (min-width: 1280px) {
  .entry-grid {
    grid-template-areas:
      "date amount mode"
      "party account reference"
      "type category invoice"
      "reason reason bank";
  }

  .entry-grid:not(.has-paid) > .reference-box:not([hidden]):has(.cell-cheque-bank) {
    display: contents;
  }

  .entry-grid:not(.has-paid) > .reference-box > .reference-pair {
    grid-area: reference;
  }

  .entry-grid:not(.has-paid) > .reference-box > .cell-cheque-bank {
    grid-area: bank;
  }
}

/* ---------- R15-1 (Release 1.5): Receipt Due and Payment Due ---------- */

/* The status tags (R15-03): red overdue, amber due today and part paid, grey pending, green
   complete; the amber "Pending: Invoice No." (#B54708 on #FFFAEB, R1.5 section 5.3). */
.tag-due-overdue,
.tag-due-rejected {
  /* E-573: "Rejected" (C014 section 3) */
  background: var(--money-out-soft);
  color: var(--money-out);
}

.tag-due-today,
.tag-due-part,
.tag-due-approval,
.tag-pending {
  /* E-573: the amber "Open for Approval" (C014 section 3) */
  background: var(--waiting-soft);
  color: var(--waiting);
}

.tag-due-pending,
.tag-due-bill {
  /* R15-6v: "Waiting for Bill" as grey as "Pending" */
  background: var(--neutral-soft);
  color: var(--text-secondary);
}

.tag-due-complete {
  background: var(--money-in-soft);
  color: var(--money-in);
}

/* The four totals: one across on a phone, two from 768 px, four from 1280 px. */
.dues-totals {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space);
  margin-bottom: var(--space);
}

.dues-totals .stat {
  margin: 0;
}

.stat-label {
  margin: 0 0 var(--lx-space-1);
  color: var(--text-secondary);
  font-size:var(--lx-fs-label);
  font-weight: 500;
}

.stat-value {
  margin: 0;
  font-size:var(--lx-fs-figure);
  font-weight: 700;
  white-space: nowrap;
}

.stat-overdue .stat-value {
  color: var(--money-out);
}

/* The chips: the kinds, the statuses and the amber "N Pending". */
.dues-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--lx-space-2) var(--lx-space-4);
  align-items: center;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--lx-space-2);
}

.dues-toolbar .chip {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.chip-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.chip-pending {
  border-color: var(--waiting-border);
  background: var(--waiting-soft);
  color: var(--waiting);
}

.dues-table .num {
  text-align: right;
}

/* "7 Days", "15 Days", "30 Days" on the Due Date's label line (D173 (4)). */
.due-chips {
  display: inline-flex;
  flex: none;
  gap: var(--lx-space-2);
}

.chip-button {
  padding: 0 var(--lx-space-2);
  border: 1px solid var(--border);
  border-radius: var(--lx-radius-round);
  background: var(--card);
  color: var(--text-secondary);
  font: inherit;
  font-size:var(--lx-fs-small);
  line-height: 1.6;
  cursor: pointer;
}

/* The "Kept Pending" / "Not Required" choice on the Invoice No.'s label line (R1.5 section 5). */
.pending-choice {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 2px;
}

.pending-select {
  width: auto;
  min-height: 0;
  padding: 0 4px;
  font-size: 0.8571rem;
}

.running-balance {
  font-weight: 600;
}

@media (min-width: 768px) {
  .dues-totals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .dues-totals {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .due-grid .cell-narration {
    grid-column: span 2;
  }
}

/* ---------- R15-1a: the dues lists' columns and cards, the names, the label lines ---------- */

/* From 1280 px the table: Person / Firm at least 200 px, an invoice number and the amounts never
   wrapped, words never broken inside, nothing cut off (CLAUDE.md rules 13 and 14). */
.dues-table td {
  overflow-wrap: normal;
  word-break: normal;
  vertical-align: top;
}

.dues-table .dues-party {
  min-width: 200px;
}

.dues-table .dues-invoice {
  white-space: nowrap;
}

/* The names as in mockup R15-03: bold dark text that opens the due's page. */
.due-name {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.due-name:hover {
  text-decoration: underline;
}

.due-name:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--lx-radius-control);
}

/* The Kind tag: blue with its dot ("● One-Time"). */
.tag-kind {
  background: var(--approved-soft);
  color: var(--approved);
}

/* Below 1280 px (and on a phone) each due is a card. */
.dues-cards {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.due-card {
  display: flex;
  flex-direction: column;
  gap: var(--lx-space-1);
  padding: var(--lx-space-4);
  border-bottom: 1px solid var(--border);
}

.due-card:last-child {
  border-bottom: 0;
}

.due-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--lx-space-2);
}

.due-card-line {
  margin: 0;
}

.due-card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--lx-space-2);
}

/* The label line keeps a plain label's height: the chips and the small dropdown fit inside it. */
.field-label-line .chip-button {
  height: var(--lx-icon);
  line-height: 16px;
  padding: 0 var(--lx-space-2);
}

.field-label-line .pending-select {
  height: var(--lx-icon);
  line-height: 16px;
  padding: 0 var(--lx-space-1);
}

/* R15-2d (the chat's review of R15-1a): the table only where it fits whole (at 1366 and 1440 px
   with the menu it did not: Status and "Pay" went out of sight); the cards below. */
@media (max-width: 1599px) {
  .dues-table-wrap {
    display: none;
  }
}

@media (min-width: 1600px) {
  .dues-cards {
    display: none;
  }
}

/* The four totals two by two on a phone. */
@media (max-width: 767px) {
  .dues-totals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dues-totals .stat-value {
    font-size:var(--lx-fs-heading);
  }
}

/* ---------- R15-2c (R15-2 item 2; mockups R15-01, R15-07): the rows of the entry forms ---------- */

/* From 768 px two across in the order of R15-01; from 1280 px three across: Date · Amount · Mode;
   Paid To · Paid From · the reference; Payment Against · the second dropdown (two cells); Category
   · Narration (two cells; a cheque's Bank takes Narration's second cell, D175 (4)). A phone keeps
   the page's own order, one column. */
/* R15-2e (the chat's review of R15-2c): "Choose who it is paid to first." has the box's height,
   so its row lines up (D171). */
.against-first {
  display: flex;
  align-items: center;
  min-height: var(--lx-control);
  margin: 0;
  padding: 0;
}

/* R15-2e: the named areas only where a template names them (from 768 px). Outside a media query
   they made extra implicit columns: three squeezed columns at 390 px. */
@media (min-width: 768px) {
  .entry-grid > .cell-against {
    grid-area: against;
  }

  /* E-540, C004: "Voucher Date" (the areas below name it "vdate"). */
  .entry-grid > .cell-voucher-date {
    grid-area: vdate;
  }

  .entry-grid > .cell-against-item {
    grid-area: item;
  }

  .entry-grid {
    grid-template-areas:
      "date amount"
      "mode party"
      "account reference"
      "against item"
      "category reason"
      "vdate .";
  }

  .entry-grid.has-paid {
    grid-template-areas:
      "date amount"
      "paid ."
      "mode party"
      "account reference"
      "against item"
      "category reason"
      "vdate .";
  }
}

@media (min-width: 1280px) {
  .entry-grid {
    grid-template-areas:
      "date amount mode"
      "party account reference"
      "against item item"
      "category reason vdate";
  }

  .entry-grid:has(.cell-cheque-bank) {
    grid-template-areas:
      "date amount mode"
      "party account reference"
      "against item item"
      "category reason bank"
      "vdate . .";
  }

  .entry-grid.has-paid {
    grid-template-areas:
      "date amount mode"
      "paid . ."
      "party account reference"
      "against item item"
      "category reason vdate";
  }
}

/* R15-4b item 0 (review of R15-3): "Split Across Invoices" gets its own row across the card, under
   "Payment Against" (which keeps its own width); the grid's columns stay minmax(0, 1fr). */
@media (min-width: 768px) {
  .entry-grid:has(.split-box) {
    grid-template-areas:
      "date amount"
      "mode party"
      "account reference"
      "against ."
      "item item"
      "category reason"
      "vdate .";
  }

  .entry-grid.has-paid:has(.split-box) {
    grid-template-areas:
      "date amount"
      "paid ."
      "mode party"
      "account reference"
      "against ."
      "item item"
      "category reason"
      "vdate .";
  }
}

@media (min-width: 1280px) {
  .entry-grid:has(.split-box) {
    grid-template-areas:
      "date amount mode"
      "party account reference"
      "against . ."
      "item item item"
      "category reason vdate";
  }

  .entry-grid:has(.cell-cheque-bank):has(.split-box) {
    grid-template-areas:
      "date amount mode"
      "party account reference"
      "against . ."
      "item item item"
      "category reason bank"
      "vdate . .";
  }

  .entry-grid.has-paid:has(.split-box) {
    grid-template-areas:
      "date amount mode"
      "paid . ."
      "party account reference"
      "against . ."
      "item item item"
      "category reason vdate";
  }
}

.split-table th,
.split-table td[data-label="Invoice"],
.split-table td[data-label="Invoice Date"] {
  white-space: nowrap;
}

.entry-grid > .cell-against-item,
.split-box,
.split-table {
  min-width: 0;
  max-width: 100%;
}

/* R15-4b item 0 (review of R15-3): on a phone nothing is wider than the screen: the split's cards
   and their "Adjust Now" box shrink with it; the excess panel's table shows each line as one row of
   words ("Against INV-2231 · Payment Complete · ₹25,000.00"). */
@media (max-width: 767px) {
  .split-table td {
    min-width: 0;
    max-width: 100%;
  }

  .split-table td[data-label="Adjust Now"] .split-money {
    flex: 0 1 12em;
    min-width: 0;
    max-width: 100%;
  }

  .split-table td[data-label="Adjust Now"] .split-money input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .split-summary div {
    min-width: 0;
    max-width: 100%;
  }

  .excess-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .excess-table,
  .excess-table tbody {
    display: block;
    width: 100%;
  }

  .excess-table tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--lx-space-1) 0;
    padding: var(--lx-space-2) 0;
    border-bottom: 1px solid var(--waiting-border);
  }

  .excess-table td {
    display: inline;
    padding: 0;
    border-bottom: 0;
  }

  .excess-table td:empty {
    display: none;
  }

  /* R15-13 item 7 (d), finished in R15-13zz: the " ·" goes after a cell, so a wrapped line
     never starts with "·". */
  .excess-table td:not(:empty):not(:last-child)::after {
    content: " ·";
  }

  .excess-table .num {
    text-align: left;
  }
}

/* R15-5 item 0 (a) (review of R15-4): Receipts and Payments from 768 to 1279 px: the Mode becomes the
   Amount's small second line and a row's numbers and buttons sit under its Status tag, so Paid To /
   Received From and Against get the room (at least 180 px); the Numbers column shows from 1280 px.
   Nothing is cut off and nothing scrolls sideways. */
@media (min-width: 1000px) and (max-width: 1279px) {
  .entries-table .en-mode,
  .entries-table .en-numbers,
  .entries-table .en-numbers-head,
  .entries-table .en-action {
    display: none;
  }

  .entries-table .en-amount-mode {
    display: block;
    color: var(--muted);
    font-size:var(--lx-fs-small);
    font-weight: 400;
  }

  .entries-table .en-status-more {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--lx-space-2);
    margin-top: var(--lx-space-2);
  }

  /* R15-7f item 1 (a): the Status column keeps the width of its widest tag or button (as after
     R15-5), so nothing is cut off at the card's edge on the Owner's 1093 px screen; Paid To /
     Received From and Against share the rest (no fixed width each). */
  .entries-table .en-status {
    width: 190px;
    min-width: 190px;
  }

  /* R15-Pf (D195 (2)): the buttons keep one line; a tag too long wraps inside itself (below). */
  .entries-table .en-status .btn {
    white-space: nowrap;
  }

  .entries-table .en-date {
    white-space: nowrap;
  }
}

.en-amount-mode,
.en-status-more {
  display: none;
}

.entries-table .en-numbers .tag,
.en-status-more .tag {
  display: inline-block;
  margin: 0 var(--lx-space-1) var(--lx-space-1) 0;
  white-space: nowrap;
}

.entries-table .add-number {
  white-space: nowrap;
}

/* On a phone (cards) the numbers and "Add Number" sit under the Status tag; the row's own button
   keeps its place. */
@media (max-width: 999px) {  /* R15-7 item 0 (a): cards up to 999 px */
  .entries-table .en-numbers,
  .entries-table .en-numbers-head {
    display: none;
  }

  .entries-table .en-status-more {
    display: flex;
    flex-wrap: wrap;
    gap: var(--lx-space-2);
    margin-top: var(--lx-space-2);
  }

  .entries-table .en-status-more .btn:not(.add-number) {
    display: none;
  }
}

/* R15-5 (mockup R15-05): "N Pending" and the banner above the list, amber (#B54708 on #FFFAEB). */
.pending-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--lx-space-2) var(--lx-space-4);
  margin: 0 0 var(--lx-space-3);
}

.pending-banner {
  flex: 1 1 280px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--waiting-border);
  border-radius: var(--radius-small);
  background: var(--waiting-soft);
  color: var(--waiting);
}

.pending-chip {
  border-color: var(--waiting-border);
  background: var(--waiting-soft);
  color: var(--waiting);
}

.pending-chip.is-on {
  border-color: var(--waiting);
  font-weight: 600;
}

/* R15-5 (mockup R15-01): once chosen, "● Kept Pending ▾" in amber on the label's line. */
.pending-choice.is-chosen::before {
  content: "●";
  margin-right: var(--lx-space-1);
  color: var(--waiting);
}

.pending-choice.is-chosen .pending-select {
  color: var(--waiting);
  background-color: var(--waiting-soft);
  border-color: var(--waiting-border);
}

.pending-choice.is-chosen .req {
  display: none;
}

/* R15-5 item 0 (b) (review of R15-4): the advance's covering table on a phone: each line is one
   row of words joined by " · " (as the excess table, R15-4b), never a heading broken inside a word. */
@media (max-width: 767px) {
  .cover-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .cover-table,
  .cover-table tbody {
    display: block;
    width: 100%;
  }

  .cover-table tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--row-line);
  }

  .cover-table td {
    display: inline;
    padding: 0;
    border: 0;
  }

  /* R15-13 item 7 (d), finished in R15-13z: the " ·" goes after a cell, so a wrapped line never
     starts with "·" (the space after it lets the line wrap there). */
  .cover-table tr {
    column-gap: var(--lx-space-1);
  }

  .cover-table td:not(:last-child)::after {
    content: " ·";
  }

  .cover-table .num {
    text-align: left;
  }
}

/* R15-13 item 7 (d), finished in R15-13z (mockup R15-06): the covering table's Amount at the right;
   space under "Convert to Payment". */
.cover-table .num {
  text-align: right;
}

.convert-card > .section-title {
  margin-bottom: var(--lx-space-4);
}

/* R15-6 item 0 (b) (mockup R15-06): "Convert to Payment": one field a row on a phone, two from
   768 px, three from 1280 px (Paid To, Invoice, Amount); Narration across two columns; the buttons
   under the card on the right. */
.convert-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px 24px;
  align-items: start;
}

.convert-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin: 12px 0 24px;
}

.file-box {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-small);
  cursor: pointer;
}

.file-box:focus-within {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

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

  .convert-grid > .convert-narration {
    grid-column: span 2;
  }
}

@media (min-width: 1280px) {
  .convert-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* R15-6 item 0 (c) (mockup R15-06): the advance's figures as a soft band, each label plain and its
   amount bold; Still to Cover red while above zero; the Cover by tag in the band. */
.advance-band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  margin: 8px 0 16px;
  padding: 12px 16px;
  border-radius: var(--radius-small);
  background: var(--table-head);
  color: var(--text-secondary);
}

.advance-band strong {
  margin-left: 4px;
  color: var(--text);
  white-space: nowrap;
}

.advance-band .still-left strong {
  color: var(--text);
}

.cover-table .cell-line {
  display: block;
}

/* R15-6 item 0 (e): the offer on a due's page in its own notice box, with space under it. */
.use-offer {
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 1px solid var(--primary-soft-border);
  border-radius: var(--radius-small);
  background: var(--primary-soft);
}

.use-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.use-row + .use-row {
  margin-top: 8px;
}

/* R15-6 item 0 (d): up to 1279 px the excess panel sits in a narrow column, so its lines show as
   rows of words (the phone rule), and the split's invoices are cards (the phone rule) until its
   columns fit; on a phone a line goes under each row of words, not under each part of it. */
@media (max-width: 1279px) {
  .excess-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .excess-table,
  .excess-table tbody {
    display: block;
    width: 100%;
  }

  .excess-table tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: var(--lx-space-2) 0;
    border-bottom: 1px solid var(--waiting-border);
  }

  .excess-table td {
    display: inline;
    padding: 0;
    border-bottom: 0;
  }

  .excess-table td:empty {
    display: none;
  }

  /* R15-13 item 7 (d), finished in R15-13zz: the " ·" goes after a cell, so a wrapped line
     never starts with "·". */
  .excess-table td:not(:empty):not(:last-child)::after {
    content: " ·";
  }

  .excess-table .num {
    text-align: left;
  }

  .split-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .split-table,
  .split-table tbody {
    display: block;
    width: 100%;
  }

  .split-table tr {
    display: block;
    margin-bottom: 12px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    background: var(--card);
  }

  .split-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    border-bottom: 0;
    text-align: right;
    min-width: 0;
  }

  .split-table td[data-label]::before {
    content: attr(data-label);
    color: var(--text-secondary);
    text-align: left;
  }

  .split-table td.split-tick {
    justify-content: flex-start;
  }
}

/* R15-6zzz (mockup R15-04): "Kind" as two radio pills in the form's card, the chosen one blue;
   "Fixed" inside the Amount box on its right; the band "Runs Till … · Next … · N More to Pay". */
.kind-field {
  margin-bottom: 16px;
}

.kind-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.kind-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  cursor: pointer;
  white-space: nowrap;
}

.kind-pill:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.kind-pill input {
  accent-color: var(--primary);
}

.money-box-choice {
  display: flex;
  align-items: center;
}

.money-box-choice input {
  flex: 1 1 auto;
  min-width: 0;
}

.money-box-choice .inline-select {
  flex: 0 0 auto;
  width: auto;
  min-height: 0;
  margin-left: auto;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
  background-color: transparent;
}

.runs-band {
  grid-column: 1 / -1;
  margin: 0;
  padding: 8px 12px;
  border-radius: var(--radius-small);
  background: var(--primary-soft);
  color: var(--primary);
}

.runs-band:has([data-runs-text]:empty) {
  display: none;
}

.recurring-grid > .span-full {
  grid-column: 1 / -1;
}

/* R15-7 item 0 (b): the entries' table fills its card; (f) a label never shrinks below its words:
   the chips or buttons on its line go under it when the line is too short, and a date box always
   shows its whole date. */
.entries-table {
  width: 100%;
  table-layout: auto;
}

/* S11-4z (a) (the chat's review of S11-4: New Receipt at 768 px ran 54 px sideways): a long label
   wraps inside its column at every width, between words, never inside one (min-content keeps
   R15-7's "never below its words"). */
.field-label-line > .field-label {
  flex-shrink: 1;
  min-width: min-content;
  max-width: 100%;
  white-space: normal;
}

.date-box input {
  min-width: 11ch;
}

/* R15-7f item 1 (c): a payment that moves no money (a conversion), as on Home: grey, "No Money
   Moved" under it. */
.entries-table .en-amount-none {
  color: var(--muted);
}

.en-none-line {
  display: block;
  font-size:var(--lx-fs-small);
  font-weight: 400;
}

/* R15-2d: the Kind and Invoice columns take no more than they need. */
.dues-table .dues-kind,
.dues-table .dues-invoice {
  width: 1%;
  white-space: nowrap;
}

/* R15-2d: the opening balance on a person's change page: a row of its own across the card. The
   amount, "They Owe You" / "You Owe Them" side by side, and "Balance as On"; on a phone one under
   the other. */
.form-card .form > .opening-fields {
  grid-column: 1 / -1;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.opening-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px 24px;
  align-items: start;
}

/* R15-3 item 0: a plain row (no fieldset box, no legend): a heading, then the three fields. The two
   choices may wrap under each other, so nothing touches: two columns from 768 px (the date under
   the amount), three from 1280 px. */
.opening-title {
  margin: 0 0 12px;
  font-size: var(--lx-fs-body);
  font-weight: 600;
}

.opening-fields .opening-side {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-self: end;
  gap: 8px 24px;
  min-height: 44px;
}

.opening-fields .opening-side .check {
  white-space: nowrap;
}

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

@media (min-width: 1280px) {
  .opening-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* R15-3 (R1.5 section 3; mockup R15-02): over the balance, the line's end in red, and the amber
   panel with "Allow Excess Payment", the heads and the table of what the entry settles. The table
   has three short columns and fits 390 px; amounts never break. */
.running-after.running-over {
  color: var(--money-out);
}

.excess-panel {
  margin-top: var(--lx-space-3);
  padding: var(--lx-space-3) var(--lx-space-4);
  border: 1px solid var(--waiting-border);
  border-radius: var(--radius-small);
  background: var(--waiting-soft);
}

.excess-body {
  margin-top: var(--lx-space-3);
}

.excess-heads {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--lx-space-2) var(--lx-space-6);
}

.excess-heads legend {
  width: 100%;
  margin-bottom: var(--lx-space-2);
}

.excess-heads .check {
  white-space: nowrap;
}

.excess-table {
  width: 100%;
  margin-top: var(--lx-space-3);
  border-collapse: collapse;
  font-size:var(--lx-fs-small);
}

.excess-table th,
.excess-table td {
  padding: var(--lx-space-2) var(--lx-space-2);
  border-bottom: 1px solid var(--waiting-border);
  text-align: left;
  vertical-align: middle;
}

.excess-table th:first-child,
.excess-table td:first-child {
  padding-left: 0;
}

.excess-table th:last-child,
.excess-table td:last-child {
  padding-right: 0;
}

.excess-table .num {
  text-align: right;
  white-space: nowrap;
}

.excess-table .excess-total td {
  border-bottom: 0;
  font-weight: 600;
}

.tag-extra {
  background: var(--waiting-soft);
  color: var(--waiting);
  border: 1px solid var(--waiting-border);
}

/* R15-3z (R1.5 section 1.7; S3 mockup 33): "Split Across Invoices": the table in place of the
   Invoice dropdown; on a phone each invoice is a card (its labels before the values), the "Adjust
   Now" box full width. Amounts never break. */
.split-box {
  grid-column: 1 / -1;
  min-width: 0;
}

.split-actions {
  margin: 8px 0 12px;
}

.split-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--lx-fs-small);
}

.split-table th,
.split-table td {
  padding: 8px;
  border-bottom: 1px solid var(--row-line);
  text-align: left;
  vertical-align: middle;
}

.split-table th {
  background: var(--table-head);
  color: var(--text-secondary);
  font-weight: 600;
}

.split-table .num {
  text-align: right;
  white-space: nowrap;
}

.split-money {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.split-money input {
  width: 9em;
  min-height: var(--lx-control-table);
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  text-align: right;
  font: inherit;
}

.split-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
  margin: 12px 0 0;
}

.split-summary div {
  display: flex;
  gap: 8px;
}

.split-summary dt {
  color: var(--text-secondary);
}

.split-summary dd {
  margin: 0;
  font-weight: 600;
}

@media (max-width: 767px) {
  .split-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .split-table,
  .split-table tbody,
  .split-table tr,
  .split-table td {
    display: block;
    width: 100%;
  }

  .split-table tr {
    margin-bottom: 12px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    background: var(--card);
  }

  .split-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    border-bottom: 0;
    text-align: right;
  }

  .split-table td[data-label]::before {
    content: attr(data-label);
    color: var(--text-secondary);
    text-align: left;
  }

  .split-table td.split-tick {
    justify-content: flex-start;
  }

  .split-money,
  .split-money input {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .split-summary {
    flex-direction: column;
  }

  .split-summary div {
    justify-content: space-between;
  }
}

/* R15-2d (R15-2 item 3): the chosen invoice's running balance under the second dropdown. */
.running-line {
  margin-top: var(--lx-space-2);
}

.running-figures,
.running-after {
  margin: 0;
}

.running-after {
  font-weight: 600;
}

/* R15-2e: below 768 px one column, every field the card's width, in the order of mockup R15-07:
   Date, Amount (the paid date), Mode of Payment, Paid To / Received From, Paid From / Received Into,
   the reference, Payment Against, the second dropdown, Category, Narration. */
@media (max-width: 767px) {
  .entry-grid > .field:has(#id_date) {
    order: 1;
  }

  .entry-grid > .field:has(#id_amount) {
    order: 2;
  }

  .entry-grid > .field:has(#id_paid_date) {
    order: 3;
  }

  .entry-grid > .cell-mode {
    order: 4;
  }

  .entry-grid > .cell-party {
    order: 5;
  }

  .entry-grid > .cell-account {
    order: 6;
  }

  .entry-grid > .cell-reference {
    order: 7;
  }

  .entry-grid > .cell-against {
    order: 8;
  }

  .entry-grid > .cell-against-item {
    order: 9;
  }

  .entry-grid > .cell-category {
    order: 10;
  }

  .entry-grid > .cell-reason {
    order: 11;
  }

  /* E-540, C004: Voucher Date after Narration on a phone. */
  .entry-grid > .cell-voucher-date {
    order: 12;
  }
}

/* R15-7 item 0 (e): Home's recent entries: a payment that moves no money (a conversion, an office
   expense) in grey with "No Money Moved", not red like money paid out. */
.recent-amount.money-none {
  color: var(--muted);
}

.recent-none {
  display: block;
  font-size:var(--lx-fs-small);
  font-weight: 400;
}

/* R15-7 item 0 (d): "Add Number"'s box at a field's usual width. */
.field-narrow {
  max-width: 360px;
}

/* R15-Pf (D195 (2)): "Out of … · <date>" wraps inside its cell and never widens it (between words
   only); on Payments a status tag too long for its column wraps inside the tag, the buttons keep
   one line. */
.en-out-of {
  display: block;
  white-space: normal;
  overflow-wrap: normal;
}

.entries-table .en-status .tag {
  height: auto;
  min-height: var(--lx-space-6);
  white-space: normal;
  text-align: left;
}

.entries-table .en-status .btn {
  white-space: nowrap;
}

@media (min-width: 1280px) and (max-width: 1599px) {  /* R15-Pf: the names keep room */
  .entries-table .en-party,
  .entries-table .en-against {
    min-width: 150px;
  }
}

@media (max-width: 999px) {  /* R15-Pf: on a phone "Out of …" is its own line across the card */
  .entries-table .en-mode-out {
    grid-column: 1 / -1;
  }
}

/* R15-Pf (D195 (4)): "Spent Out of This Payment": its own table; the title, the button and the
   totals line inside the card's padding; on a phone each line a block, "Left ₹…" labelled, no rule
   under the last line. */
.spent-card > .card-head,
.spent-card > .running-balance,
.spent-card > .empty-list {
  padding: var(--space);
}

.spent-table {
  width: 100%;
  border-collapse: collapse;
}

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

.spent-table .num {
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 999px) {  /* R15-13z: "Spent Out of This Payment" as cards below 1000 px (R15-Pf had 767) */
  .spent-table thead {
    display: none;
  }

  .spent-table tr {
    display: block;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
  }

  .spent-table tr:last-child {
    border-bottom: 0;
  }

  .spent-table td {
    display: block;
    padding: 2px 0;
    border-bottom: 0;
    text-align: left;
  }

  /* RR21b (D236): each value beside its label, as the other cards. */
  .spent-table td[data-label] {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 8px;
  }

  .spent-table td[data-label]::before {
    content: attr(data-label);
    color: var(--text-secondary);
  }
}

/* B-253 (C008 section 6; mockups C008/01 to 03): the Accountant tab's lists (a card per row on a
   phone, each value beside its label), the "Not Mapped" count beside the tabs, and Edit
   Mapping's five "Belongs To" choices in one row where they fit. */
.acct-table {
  width: 100%;
  border-collapse: collapse;
}

.acct-table th,
.acct-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--row-line);
  text-align: left;
  vertical-align: middle;
  overflow-wrap: normal;  /* B-259 (D384): a word is never broken inside */
  word-break: normal;
}

.acct-table th {
  background: var(--table-head);
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

.acct-table .acct-name {
  color: var(--text);
  font-weight: 600;
}

.acct-table .acct-act {
  text-align: right;
  white-space: nowrap;
}

.acct-count-tab {
  cursor: default;
}

.acct-section-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
}

.acct-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  font-weight: 600;
}

.acct-section:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

/* B-259 (D384, the chat's review at 768 px): below 1100 px the tables broke words inside
   ("Electr / icity") and cut "Map Now": each row is a card there (as every list below 768 px);
   from 1100 px the tables as before. */
@media (max-width: 1099px) {
  .acct-table thead {
    display: none;
  }

  .acct-table,
  .acct-table tbody,
  .acct-table tr {
    display: block;
  }

  .acct-table tr {
    padding: 12px 16px;
    border-bottom: 1px solid var(--row-line);
  }

  .acct-table td {
    display: block;
    padding: 2px 0;
    border-bottom: 0;
  }

  .acct-table td[data-label] {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 8px;
  }

  .acct-table td[data-label]::before {
    content: attr(data-label);
    color: var(--text-secondary);
  }

  .acct-table .acct-act {
    margin-top: 8px;
    text-align: left;
  }
}

@media (min-width: 1280px) {  /* R15-13 (e): the recurring form's Category and Alerts on one row (mockup R15-04) */
  .recurring-grid > .span-2 {
    grid-column: span 2;
  }
}

@media (min-width: 768px) and (max-width: 1279px) {  /* R15-13zzz (7 a): a cheque's Bank in its own cell */
  /* R15-13's item 7 (a) (R1-UI11's review; as from 1280 px, D175): the reference box lets its cells
     join the grid, so its number and date stay beside "Paid From" and the Bank takes a row of its
     own: no gap in the left column. With a paid date (a payment marked paid) the box stays whole. */
  .entry-grid:not(.has-paid) > .reference-box:not([hidden]):has(.cell-cheque-bank) {
    display: contents;
  }

  .entry-grid:not(.has-paid) > .reference-box > .reference-pair {
    grid-area: reference;
  }

  .entry-grid:not(.has-paid) > .reference-box > .cell-cheque-bank {
    grid-area: bank;
  }

  .entry-grid:not(.has-paid):has(.cell-cheque-bank) {
    grid-template-areas:
      "date amount"
      "mode party"
      "account reference"
      "bank ."
      "against item"
      "category reason"
      "vdate .";
  }

  .entry-grid:not(.has-paid):has(.cell-cheque-bank):has(.split-box) {
    grid-template-areas:
      "date amount"
      "mode party"
      "account reference"
      "bank ."
      "against ."
      "item item"
      "category reason"
      "vdate .";
  }
}

/* S11-3 item 0 (a) (D157): New Payment's three kinds and New Receipt's two as Release 1's choice
   cards: the title in bold on its own line, the help line under it in the muted text, the chosen
   card marked, no fieldset border; one row from 1280 px, stacked below. */
.entry-kinds {
  min-width: 0;
  margin: 0 0 var(--lx-space-4);
  padding: 0;
  border: 0;
}

.kind-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--lx-space-3);
}

.kind-option {
  display: block;
  position: relative;
  min-width: 0;
  padding: var(--lx-space-3) var(--lx-space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--card);
  cursor: pointer;
}

.kind-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.kind-title {
  display: block;
  font-weight: 700;
  color: var(--text);
}

.kind-option .field-help {
  display: block;
  margin-top: var(--lx-space-1);
  color: var(--muted);
}

.kind-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.kind-option:has(input:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (min-width: 1280px) {  /* S11-3: the kinds in one row */
  .kind-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .kind-options.two-kinds {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* S11-3: pills wrap their words inside the card (S11-2's review: Via Representative's Purpose ran
   24 px past the card at 390 px). */
.entry-form .choice-chips .chip-choice {
  white-space: normal;
  max-width: 100%;
  min-width: 0;
  height: auto;
}

/* S11-3 item 0 (c): the business transaction's row runs Final Beneficiary, Date of Transaction,
   Amount; the invoice box takes its own place only when it has something. */
.rep-txn-grid #against-box:empty {
  display: none;
}

/* S11-4 (S 1.1 R2): "Paid by Someone Else" directly under Received From, in its cell; ticked, the
   line "Paid By (on Behalf of …)" opens under it. */
.paid-by-box {
  margin-top: var(--lx-space-3);
  min-width: 0;
}

.paid-by-line {
  margin-top: var(--lx-space-2);
}

.paid-by-line select {
  width: 100%;
  max-width: 100%;
}

/* S11-4z (b): "Paid on Behalf of Others" on a phone: each receipt a card (rule 14, as the other
   lists), each value beside its label, never broken inside a word. */
@media (max-width: 767px) {  /* S11-4z (b) */
  .paid-for-table thead {
    display: none;
  }

  .paid-for-table,
  .paid-for-table tbody {
    display: block;
    width: 100%;
  }

  .paid-for-table tr {
    display: block;
    padding: 12px 16px;
    border-bottom: 1px solid var(--row-line);
  }

  .paid-for-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 0;
    border: 0;
    text-align: right;
    word-break: normal;
    overflow-wrap: normal;
  }

  .paid-for-table td[data-label]::before {
    content: attr(data-label);
    color: var(--text-secondary);
    text-align: left;
  }
}

/* S11-5 (S 1.1 P5): each entry's kind in the lists, under its person or firm, wrapping inside the
   cell; the tag never breaks inside. */
.en-kind {
  display: block;
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 0.8571rem;
}

.kind-tag {
  white-space: nowrap;
}

/* S11-5 (S 1.1 P2.6, P5): his running balance and the settlements on a person's page; the position
   line in the card's padding. */
.rep-position-line {
  margin: 0;
  padding: 8px 20px 0;
  font-weight: 600;
}

@media (max-width: 767px) {  /* S11-5: the statement's lines as cards */
  .rep-table thead {
    display: none;
  }

  .rep-table,
  .rep-table tbody {
    display: block;
    width: 100%;
  }

  .rep-table tr {
    display: block;
    padding: 12px 16px;
    border-bottom: 1px solid var(--row-line);
  }

  .rep-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 0;
    border: 0;
    text-align: right;
    word-break: normal;
    overflow-wrap: normal;
  }

  .rep-table td:empty {
    display: none;
  }

  .rep-table td[data-label]::before {
    content: attr(data-label);
    color: var(--text-secondary);
    text-align: left;
  }
}

/* RR12 (R12, D221): New / Change Payment and Receipt in the Owner's order: the page's own order at
   every width, three to a row from 1093 px, two on a tablet, one on a phone, no empty gaps (a hidden
   cell, such as the reference box for Cash, leaves none). The earlier named areas and phone orders
   (R1-UI3, R15-2e, R15-4b, R15-13zzz) no longer apply to this card: these rules outrank them (the
   id-weight :is(#rr12, *) matches every element). A cheque's number, date and bank stay in the
   reference cell; "Split Across Invoices" takes a row of its own inside Payment Against's cell. */
@media (max-width: 767px) {
  .form .entry-grid:is(#rr12, *) {
    grid-template-areas: none;
    grid-template-columns: minmax(0, 1fr);
  }

  .form .entry-grid.entry-grid > :is(#rr12, *) {
    grid-area: auto;
    order: 0;
  }

  .form .entry-grid > .reference-box:not([hidden]):is(#rr12, *) {
    display: grid;
  }

  .form .entry-grid > .cell-against:has(.split-box):is(#rr12, *) {
    grid-column: 1 / -1;
  }
}

@media (min-width: 768px) and (max-width: 1092px) {
  .form .entry-grid:is(#rr12, *) {
    grid-template-areas: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form .entry-grid.entry-grid > :is(#rr12, *) {
    grid-area: auto;
    order: 0;
  }

  .form .entry-grid > .reference-box:not([hidden]):is(#rr12, *) {
    display: grid;
  }

  .form .entry-grid > .cell-against:has(.split-box):is(#rr12, *) {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1093px) {
  .form .entry-grid:is(#rr12, *) {
    grid-template-areas: none;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .form .entry-grid.entry-grid > :is(#rr12, *) {
    grid-area: auto;
    order: 0;
  }

  .form .entry-grid > .reference-box:not([hidden]):is(#rr12, *) {
    display: grid;
  }

  .form .entry-grid > .cell-against:has(.split-box):is(#rr12, *) {
    grid-column: 1 / -1;
  }
}

/* C-340b (the chat's review of C-340): a receipt's Cheque mode keeps Cheque No., Cheque Date and Bank
   (until C009), each a whole field box: the reference box takes a row of its own under row 2, its
   three fields side by side from 768 px, one under the other below; no named grid area (R12 took
   them away), so nothing overlaps and nothing runs past the card. A payment's cheque (C-340) has
   only its Cheque No., and none of this. */
.form .entry-grid > .reference-box:not([hidden]):has(.cell-cheque-bank):is(#rr12, *) {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--lx-space-4) var(--lx-space-4);
}

.reference-box:has(.cell-cheque-bank) > :is(.reference-pair, .cell-cheque-bank):is(#rr12, *) {
  grid-area: auto;
  min-width: 0;
}

@media (max-width: 767px) {
  .reference-box:has(.cell-cheque-bank) > .reference-pair:is(#rr12, *) {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (min-width: 768px) {
  .form .entry-grid > .reference-box:not([hidden]):has(.cell-cheque-bank):is(#rr12, *) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .reference-box:has(.cell-cheque-bank) > .reference-pair:is(#rr12, *) {
    display: contents;
  }
}

/* RR14 (R16, R19, R20; D225, D228, D229): on a phone's card the narration is a line across the
   card; from 1000 to 1279 px the account's name may wrap; the copies of "Add Number" and "Edit"
   under Status show only from 1000 to 1279 px (the row's action cell has them elsewhere). */
@media (max-width: 999px) {
  .entries-table .en-narration {
    grid-column: 1 / -1;
    min-width: 0;
    font-size:var(--lx-fs-label);
  }

  .entries-table .en-status-more .en-mid {
    display: none;
  }
}

@media (min-width: 1000px) and (max-width: 1279px) {
  .entries-table .en-account {
    white-space: normal;
  }
}

/* RR14b (D234): the Payments and Receipts lists fit at every width. From 1280 px a table: the text
   columns get room, the Mode may wrap between its words, the amount never wraps, the status tag wraps
   between words only (two lines at most at these widths), the actions column keeps Edit on one line.
   Below 1280 px each entry is a card (as Payment Due), every value beside its label (the labels come
   from here, by the cell's class), nothing cut. The
   earlier card and 1000-1279 px rules of these lists are outranked here. */
@media (min-width: 1280px) {
  .table-card .entries-table .en-party {
    min-width: 160px;
  }

  /* RR21b2 (D236): Narration gets the room (the actions now sit with the status). */
  .table-card .entries-table .en-narration {
    min-width: 200px;
  }

  .table-card .entries-table .en-account {
    min-width: 100px;
    white-space: normal;
  }

  .table-card .entries-table td.en-mode {
    white-space: normal;
  }

  .table-card .entries-table .en-status {
    width: 1%;
    white-space: nowrap;
  }

  /* RR21b (D236): the status tag on one line ("Waiting for Approval" whole); its amount beneath. */
  .table-card .entries-table .en-status .tag {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
  }

  /* RR21b (D236): the actions inside the card with their margin ("Edit" and "Mark Paid" side by
     side). */
  .table-card .entries-table .en-action {
    width: 1%;
    padding-right: var(--lx-space-4);
    white-space: nowrap;
  }
}

/* RR21b (D234, D236): no Mode column; the mode a quiet line under Paid From / Received Into, never
   broken ("NEFT / RTGS / IMPS" on one line); a status's amount a quiet line under its tag. */
.en-account-mode,
.en-status-line {
  display: block;
  margin-top: 2px;
  color: var(--text-secondary);
  font-size:var(--lx-fs-label);
  font-weight: 400;
  white-space: nowrap;
}

@media (max-width: 1279px) {
  .table-card .entries-table.entries-table thead {
    display: none;
  }

  .table-card .entries-table.entries-table,
  .table-card .entries-table.entries-table tbody,
  .table-card .entries-table.entries-table tfoot {
    display: block;
    width: 100%;
  }

  .table-card .entries-table.entries-table tr {
    display: block;
    padding: var(--lx-space-3) var(--lx-space-4);
    border-bottom: 1px solid var(--row-line);
  }

  .table-card .entries-table.entries-table td {
    display: block;
    position: relative;
    width: auto;
    min-width: 0;
    padding: var(--lx-space-1) 0 var(--lx-space-1) calc(var(--lx-row) * 2);
    border: 0;
    text-align: left;
    white-space: normal;
    overflow-wrap: normal;
  }

  .table-card .entries-table.entries-table tbody td::before {
    position: absolute;
    top: 3px;
    left: 0;
    width: 100px;
    color: var(--text-secondary);
    font-weight: 400;
  }

  .table-card .entries-table.entries-table tbody .en-date::before {
    content: "Date";
  }

  .table-card .payments-table.entries-table tbody .en-party::before {
    content: "Paid To";
  }

  .table-card .receipts-table.entries-table tbody .en-party::before {
    content: "Received From";
  }

  .table-card .entries-table.entries-table tbody .en-narration::before {
    content: "Narration";
  }

  .table-card .payments-table.entries-table tbody .en-account::before {
    content: "Paid From";
  }

  .table-card .receipts-table.entries-table tbody .en-account::before {
    content: "Received Into";
  }

  .table-card .entries-table.entries-table tbody .en-mode::before {
    content: "Mode";
  }

  .table-card .entries-table.entries-table tbody .en-amount::before {
    content: "Amount";
  }

  .table-card .entries-table.entries-table tbody .en-status::before {
    content: "Status";
  }

  .table-card .entries-table.entries-table tfoot td,
  .table-card .entries-table.entries-table tbody .en-action {
    padding-left: 0;
  }

  .table-card .entries-table.entries-table td:empty {
    display: none;
  }

  .table-card .entries-table.entries-table .en-amount {
    white-space: nowrap;
  }

  .table-card .entries-table.entries-table .en-amount-mode {
    display: none;
  }

  .table-card .entries-table.entries-table .en-action {
    padding-top: var(--lx-space-2);
  }

  .table-card .entries-table.entries-table tfoot td {
    background: none;
    padding-left: 0;
  }

  .table-card .entries-table.entries-table tfoot tr {
    background: var(--table-head);
  }

  .table-card .entries-table.entries-table tfoot .en-amount {
    text-align: right;
  }
}

/* RR9 (R9, D218): a Why He Paid choice that does not fit (or before Paid By is chosen): greyed, not
   choosable; the payer's and the payee's types and position under their names. */
.chip-choice.is-off {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.payer-line,
.payee-line {
  margin: 0 0 8px;
}

/* RR11 (R11, D220): New Payment's four kind cards line up: one under another on a phone, two by two
   from 768 px, one row of four from 1093 px; the same height (the grid stretches them). */
@media (max-width: 767px) {
  .payment-kinds .kind-options.kind-options {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (min-width: 768px) and (max-width: 1092px) {
  .payment-kinds .kind-options.kind-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1093px) {
  .payment-kinds .kind-options.kind-options {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* RR22 (R22; D231 to D233): the voucher (docs/spec/vouchers/, D232): A5 landscape, black on white;
   a greyed-out one grey with "CANCELLED" across it; the tools are not printed. */
@page {
  size: 210mm 148mm;
  margin: 0;
}

.voucher-body {
  margin: 0;
  background: var(--card);
  color: var(--text);
}

.voucher-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 12px 16px;
}

.voucher-grey {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.voucher-cancelled-line {
  margin: 0;
  font-weight: 600;
}

/* RR22b (D238): A5 on every screen; on a phone the script scales the whole sheet to the width
   (data-voucher-fit), so it looks as printed and nothing reflows. */
.voucher-sheet {
  box-sizing: border-box;
  width: 794px;
  min-height: 559px;
  padding: 28px;
  background: var(--card);
  font-family: Inter, system-ui, sans-serif;
}

.voucher-frame {
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 503px;
  padding: 16px 24px 12px;
  border: 1.5px solid var(--text);
}

.voucher-sheet.is-cancelled .voucher-frame {
  color: var(--muted);
}

.voucher-stamp {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-18deg);
  border: 4px solid var(--muted);
  padding: 4px 24px;
  color: var(--muted);
  font-size: 56px;
  font-weight: 700;
  letter-spacing: 0.12em;
  white-space: nowrap;
  opacity: 0.6;
}

.voucher-firm {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  text-align: center;
}

.voucher-firm-name {
  font-size: 20px;
  font-weight: 700;
}

.voucher-firm-line {
  color: var(--text-secondary);
  font-size: 13px;
}

.voucher-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 17px;
  letter-spacing: 0.14em;
}

.voucher-title span {
  flex: 1;
  height: 1px;
  background: var(--text);
}

.voucher-numbers {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
}

/* MC1f (the chat's review of C001 / C003): the label column as wide as the voucher's longest label
   ("Paid To on Behalf of Loanee" ran into its value in a fixed 176px column), capped at 40% of
   the voucher's width; a label wraps onto a second line only past that cap, and only between
   words; the values keep their own column. */
.voucher-rows {
  display: grid;
  grid-template-columns: fit-content(40%) minmax(0, 1fr);
  gap: 6px 16px;
  font-size: 15px;
  line-height: 1.35;
}

.voucher-label {
  color: var(--text-secondary);
  font-weight: 600;
  white-space: normal;
  overflow-wrap: normal;
}

.voucher-amount {
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
}

.voucher-words {
  display: block;
}

.voucher-space {
  flex: 1;
}

/* RR22b (D238): every signature line on one level; the labels and "(Not Mandatory …)" beneath. */
.voucher-signs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  align-items: start;
}

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

.voucher-signs-1 .voucher-sign {
  grid-column: 3;
}

.voucher-sign {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.voucher-sign-name {
  min-height: 18px;
}

.voucher-sign-label {
  border-top: 1px solid var(--text);
  padding-top: 4px;
  font-weight: 600;
}

.voucher-sign-sub {
  display: block;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 400;
}

.voucher-stamp-box {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  border: 1px dashed var(--text);
  padding: 10px 8px;
  font-size: 11px;
}

.voucher-printed {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

/* C-334, SAL-7 (R1.5 section 7.4): the Salary Slip in the voucher's A5 frame: Earnings and
   Deductions side by side, then the Net Salary; four signatures on one level. The sheet keeps
   its A5 width on every screen (scaled whole on a phone, as the vouchers). */
.voucher-signs-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.slip-rows {
  grid-template-columns: 120px minmax(0, 1fr) 120px minmax(0, 1fr);
  gap: 3px 16px;
  font-size: 14px;
}

.slip-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

.slip-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.slip-table th,
.slip-table td {
  padding: 2px 0;
  text-align: left;
}

.slip-table .num {
  text-align: right;
}

.slip-table thead th {
  border-bottom: 1px solid var(--text);
  font-weight: 600;
}

.slip-table tfoot th,
.slip-table tfoot td {
  border-top: 1px solid var(--text);
  font-weight: 700;
}

.slip-net {
  font-size: 14px;
}

/* C-334z: a slip with more than five lines in a column: smaller type and tighter rows, so its
   print stays on one A5 sheet (a column of up to about twelve lines). */
.slip-compact .voucher-frame {
  gap: 5px;
  padding-top: 10px;
}

.slip-compact .voucher-firm-name {
  font-size: 17px;
}

.slip-compact .voucher-firm-line,
.slip-compact .slip-rows,
.slip-compact .slip-net {
  font-size: 12px;
}

.slip-compact .slip-table {
  font-size: 11px;
}

.slip-compact .slip-table th,
.slip-compact .slip-table td {
  padding: 0;
}

.slip-compact .voucher-amount {
  font-size: 15px;
}

.list-row.is-cancelled {
  color: var(--muted);
}

@media print {
  .no-print {
    display: none;
  }

  .voucher-sheet {
    width: 210mm;
    min-height: 148mm;
  }
}

/* ---------- B-L3 (S 1.2 section 2; mockup 1): the Loans page ---------- */

/* The four tiles: one across, two from 768 px wide and on a phone two to a row, four from 1280 px. */
.loans-totals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space);
  margin-bottom: var(--space);
}

.loans-totals .stat {
  margin: 0;
}

.stat-line {
  margin: 4px 0 0;
  font-size: var(--lx-fs-label);
}

.stat-pair {
  margin: 0;
  color: var(--text-secondary);
}

.stat-pair .money {
  color: var(--text);
  font-weight: 700;
}

.loans-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  margin: var(--space) 0;
}

/* Given and Taken, and the status: Running blue, Overdue red (a warning), Closed grey. */
.tag-loan-given,
.tag-loan-running {
  background: var(--approved-soft);
  color: var(--approved);
}

.tag-loan-taken {
  background: var(--neutral-soft);
  color: var(--text);
}

.tag-loan-overdue {
  background: var(--money-out-soft);
  color: var(--money-out);
}

.tag-loan-closed {
  background: var(--neutral-soft);
  color: var(--text-secondary);
}

.loans-party .cell-line {
  display: block;
}

/* Each loan a card below 1280 px (and on a phone), as the dues' cards. */
.loan-cards {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.loan-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.loan-card:last-child {
  border-bottom: 0;
}

@media (max-width: 1279px) {
  .loans-table-wrap {
    display: none;
  }
}

@media (min-width: 1280px) {
  .loan-cards {
    display: none;
  }

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

@media (max-width: 767px) {
  .loans-totals .stat-value {
    font-size:var(--lx-fs-heading);
  }
}

/* RR21b (D236): from 1093 px the page's button at the title's right, then the bell and initials. */
@media (min-width: 1093px) {
  .top {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "title buttons actions";
  }
}

/* RR24 (R24, D242 to D244): Home's tiles of work to do (counts only, each a link to its list) and
   the Receipts and Payments cards side by side from 1093 px (stacked below). */
.work-tile {
  color: var(--text);
  text-decoration: none;
}

.work-tile:hover {
  border-color: var(--primary);
}

.kpi-count {
  font-size:var(--lx-fs-figure);
  font-weight: 700;
  line-height: 1.2;
}

.kpi-due {
  background: var(--neutral-soft);
  color: var(--text-secondary);
}

.home-list-empty {
  margin: 0;
  padding: var(--lx-space-3) 0;
}

@media (min-width: 1093px) {
  .home-grid.home-lists {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

/* RR25 (R25, D245): the business first: its logo, or its initials on the brand blue; Laxmi at the
   sidebar's foot; Business Details' form (three to a row as the grid, the address and the logo
   across). */
.business-mark {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: var(--lx-control);
  border-radius: var(--radius-small);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
}

.business-logo {
  flex: none;
  width: 40px;
  height: var(--lx-control);
  border-radius: var(--radius-small);
  object-fit: contain;
}

.business-mark-small,
.business-logo-small {
  width: 32px;
  height: var(--lx-control-table);
  font-size:var(--lx-fs-small);
}

.business-mark-large, .business-logo-large {
  width: var(--lx-row);
  height: var(--lx-row);
  font-size: var(--lx-fs-figure);
}

.side-laxmi {
  display: flex;
  align-items: center;
  gap: var(--lx-space-3);
  margin-top: auto;
  padding: var(--lx-space-4) 0 0;
  border-top: 1px solid var(--border);
}

.side-laxmi-name {
  font-weight: 600;
}

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

.business-logo-field {
  display: flex;
  align-items: center;
  gap: 16px;
}

.business-logo-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--lx-space-2);
}

.logo-pick {
  cursor: pointer;
}

.more-business {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* RR21b2 (D236): the actions under the status, inside the card: Edit, and Mark Paid for the admin. */
.en-status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.en-status-actions:empty {
  display: none;
}

/* RR30 (R27, D274): "Voucher" beside Edit. Only a paid entry has it, so a row has at most Edit and
   Voucher: from 1280 px they stay on one line inside the Status column's 190 px; on a phone's card
   they sit as its other buttons. */
.en-voucher {
  white-space: nowrap;
}

@media (min-width: 1280px) {
  .en-status-actions:has(.en-voucher) {
    flex-wrap: nowrap;
  }
}

/* RR21b2 (D236, item 5): the page's buttons under the title only when they do not fit beside it
   (measured by the script: data-top-fit). */
@media (min-width: 768px) {
  .top.top-wrapped {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title actions"
      "buttons buttons";
  }
}

/* E-506 (S 1.4 S14-1; mockups S14-01, S14-02): an account's own page, its Bank Statements tab and
   Upload Statement. A table on a computer; each statement or line a card below 768 px; amounts
   never break; green only for a check that agrees, red only for a warning (R14). */
.acct-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 12px;
}

.acct-name h2,
.acct-name p {
  margin: 0;
}

.st-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 24px;
  margin: 0;
}

.st-details dt {
  color: var(--text-secondary);
  font-size: 0.8571rem;
}

.st-details dd {
  margin: 2px 0 0;
  font-weight: 500;
}

.st-saved {
  border-color: var(--money-in);
  background: var(--money-in-soft);
}

.st-saved h3 {
  margin: 0 0 6px;
  color: var(--money-in);
}

.st-saved p {
  margin: 0;
}

.st-num {
  text-align: right;
  white-space: nowrap;
}

/* D-405 statements */
/* S5 (the plan's ST-1): the Statements page, the Account statement and R5's day view. Amounts
   never break inside; red only for a balance below zero (R14). */
.statement-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.statement-choice {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.statement-custom-line {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.filter-chip.is-on {
  background: var(--primary);
  color: var(--on-primary);
}

.statement-heading {
  padding: 16px 16px 8px;
}

.statement-kind {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.8571rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.statement-no-balance {
  margin: 0 16px 12px;
}

.statement-table {
  width: 100%;
  border-collapse: collapse;
}

.statement-table th,
.statement-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  overflow-wrap: normal;
}

.statement-table .money-col {
  text-align: right;
  white-space: nowrap;
}

.st-pill-neutral {
  background: var(--neutral-soft);
  color: var(--text-secondary);
}

.st-pill-ok {
  background: var(--money-in-soft);
  color: var(--money-in);
}

.st-pill-break {
  background: var(--money-out-soft);
  color: var(--money-out);
}

.st-ok {
  color: var(--money-in);
  font-weight: 600;
}

.st-break {
  color: var(--money-out);
  font-weight: 600;
}

.st-bank {
  /* E-510zz (D278): the bank's own words in the app's font, as they are; a long word may wrap. */
  overflow-wrap: anywhere;
}

.st-file-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.st-more {
  margin: 0;
  padding: 10px 20px;
}

.st-checks {
  margin: 0;
}

.st-checks > div {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 4px 24px;
  padding: 12px 0;
  border-bottom: 1px solid var(--row-line);
}

.st-checks dd {
  margin: 0;
}

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

.st-save {
  margin-top: 16px;
}

@media (max-width: 1092px) {
  .st-details,
  .st-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .st-details,
  .st-columns,
  .st-checks > div {
    grid-template-columns: minmax(0, 1fr);
  }

  .stmt-table thead {
    display: none;
  }

  .stmt-table,
  .stmt-table tbody {
    display: block;
    width: 100%;
  }

  .stmt-table tr {
    display: block;
    padding: 12px 16px;
    border-bottom: 1px solid var(--row-line);
  }

  .stmt-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 0;
    border: 0;
    text-align: right;
    word-break: normal;
    overflow-wrap: normal;
  }

  .stmt-table td:empty {
    display: none;
  }

  .stmt-table td[data-label]::before {
    content: attr(data-label);
    color: var(--text-secondary);
    text-align: left;
  }

  .acct-balance {
    white-space: normal;
  }
}

/* E-507 (S 1.4 S14-2; mockups S14-03, S14-04): a statement's processing: the result line, four tiles
   in a row (two on a phone), the status chips and the List / One at a Time switch, the probable
   match in blue (the approved colour), forms side by side inside a cell. */
.inline-form {
  display: inline;
}

.st-head-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.st-result {
  margin: 0 0 12px;
}

.st-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.st-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
}

.st-tile span {
  color: var(--text-secondary);
}

.st-tile strong {
  font-size: 1.5rem;
}

.st-probable {
  color: var(--approved);
}

.st-pill-probable {
  background: var(--approved-soft);
  color: var(--approved);
}

.st-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px 20px;
}

.st-chips,
.st-views {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.st-one {
  padding: 12px 20px 20px;
}

.st-one-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--lx-space-2) var(--lx-space-4);
  margin-bottom: var(--lx-space-3);
}

.st-one-nav {
  display: flex;
  gap: var(--lx-space-2);
  margin-left: auto;
}

@media (max-width: 767px) {
  .st-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .st-one-nav {
    margin-left: 0;
  }
}

/* E-508 (S 1.4 S14-3; mockups S14-04, S14-05): New Payment / New Receipt opened from a statement line:
   the line, the bank's locked fields in rows of three with "From Bank", the grey party's line, and
   the date-gap alert (amber: waiting for the user's word). */
.st-from-line {
  margin-bottom: var(--lx-space-4);
  padding: var(--lx-space-4) var(--lx-space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.st-from-title {
  margin: 0 0 var(--lx-space-2);
  font-size:var(--lx-fs-heading);
}

.st-locked {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--lx-space-3) var(--lx-space-6);
  margin: 0;
}

.st-locked dt {
  color: var(--text-secondary);
  font-size:var(--lx-fs-small);
}

.st-locked dd {
  margin: 2px 0 0;
  padding: var(--lx-space-2) var(--lx-space-3);
  border-radius: var(--radius-small);
  background: var(--neutral-soft);
  overflow-wrap: anywhere;
}

.st-from-bank {
  margin-left: var(--lx-space-2);
  color: var(--text-secondary);
  font-size:var(--lx-fs-small);
  white-space: nowrap;
}

.st-grey-line {
  margin: var(--lx-space-3) 0 0;
  color: var(--text-secondary);
}

.st-gap {
  margin-top: var(--lx-space-3);
  padding: var(--lx-space-3) var(--lx-space-4);
  border: 1px solid var(--waiting-border);
  border-radius: var(--radius-small);
  background: var(--waiting-soft);
}

.st-gap h3 {
  margin: 0 0 var(--lx-space-2);
  color: var(--waiting);
}

@media (max-width: 1092px) {
  .st-locked {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

/* E-508z (S 1.4 section 6): a party's "Names in Bank Statement", each with "Remove". */
.st-name-list {
  margin: 0;
  padding: 8px 20px 16px;
  list-style: none;
}

.st-name-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--row-line);
}

/* E-509 (S 1.4 S14-4; mockup S14-06): a discrepancy's ways as choice rows (wrapping, never sideways). */
.st-ways {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
}

.st-way {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  cursor: pointer;
}

.st-way:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.st-second {
  display: block;
  color: var(--text-secondary);
  font-size: 0.9286rem;
}

.st-opening td,
.st-total td,
.st-closing td {
  font-weight: 600;
}

.money-below {
  color: var(--money-out);
}

.st-below-tag {
  margin-top: 4px;
}

.statement-now {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  font-size: 1.0714rem;
}

.print-only {
  display: none;
}

/* D-406 (R5, D211): a cash account below zero: the bell's and Home's line in red (a warning,
   R14) with its "Check"; the Accounts page's mark. */
.bell-item.is-warning,
.attention-item.is-warning {
  color: var(--money-out);
}

.item-action {
  font-weight: 600;
  text-decoration: underline;
}

.account-below {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 4px 0 8px;
}

@media (max-width: 767px) {
  .statement-table thead {
    display: none;
  }

  .statement-table,
  .statement-table tbody,
  .statement-table tfoot {
    display: block;
  }

  .statement-table tr {
    display: grid;
    grid-template-areas:
      "date balance"
      "what what"
      "entry money";
    grid-template-columns: auto 1fr;
    gap: 4px 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
  }

  .statement-table td {
    display: block;
    padding: 0;
    border: 0;
  }

  .statement-table .st-date {
    grid-area: date;
    font-weight: 600;
  }

  .statement-table .st-what {
    grid-area: what;
  }

  .statement-table .st-entry,
  .statement-table .st-by,
  .statement-table .st-at {
    grid-area: entry;
    color: var(--text-secondary);
  }

  .statement-table .st-in,
  .statement-table .st-out {
    grid-area: money;
    text-align: right;
  }

  .statement-table .st-in:empty,
  .statement-table .st-out:empty,
  .statement-table .st-entry-none,
  .statement-table .st-by,
  .statement-table .st-at:empty {
    display: none;
  }

  .statement-table .st-in::before {
    content: "In ";
    color: var(--text-secondary);
  }

  .statement-table .st-out::before {
    content: "Out ";
    color: var(--text-secondary);
  }

  .statement-table .st-balance {
    grid-area: balance;
    font-weight: 600;
    text-align: right;
  }
}

@media print {
  .side,
  .top-actions,
  .top-buttons,
  .phone-top,
  .bottom-bar,
  .statement-choice,
  .btn {
    display: none !important;
  }

  .print-only {
    display: block;
    font-weight: 700;
  }

  .statement-table thead {
    display: table-header-group;
  }

  .statement-table tr {
    break-inside: avoid;
  }
}

/* D-407 person statement */
/* S5 section 4 (the plan's ST-3): the Person / Firm statement; each row a card below 768 px
   (Q4); amounts never break; the closing box and the cards under the table. */
.statement-legend {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 0.9286rem;
}

.person-table {
  width: 100%;
  border-collapse: collapse;
}

.person-table th,
.person-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  overflow-wrap: normal;
}

.person-table .money-col {
  text-align: right;
  white-space: nowrap;
}

.pt-opening td,
.pt-total td {
  font-weight: 600;
}

.person-closing strong {
  white-space: nowrap;
}

.person-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.person-card h3 {
  margin: 0 0 6px;
}

.person-card p {
  margin: 2px 0;
}

@media (max-width: 767px) {
  .person-table thead {
    display: none;
  }

  .person-table,
  .person-table tbody,
  .person-table tfoot {
    display: block;
  }

  .person-table tr {
    display: grid;
    grid-template-areas:
      "date balance"
      "what what"
      "invoice money";
    grid-template-columns: auto 1fr;
    gap: 4px 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
  }

  .person-table td {
    display: block;
    padding: 0;
    border: 0;
  }

  .person-table .pt-date {
    grid-area: date;
    font-weight: 600;
  }

  .person-table .pt-what {
    grid-area: what;
  }

  .person-table .pt-invoice {
    grid-area: invoice;
    color: var(--text-secondary);
  }

  .person-table .pt-dr,
  .person-table .pt-cr {
    grid-area: money;
    text-align: right;
  }

  .person-table .pt-dr:empty,
  .person-table .pt-cr:empty,
  .person-table .pt-invoice:empty {
    display: none;
  }

  .person-table .pt-dr::before {
    content: "Dr ";
    color: var(--text-secondary);
  }

  .person-table .pt-cr::before {
    content: "Cr ";
    color: var(--text-secondary);
  }

  .person-table .pt-balance {
    grid-area: balance;
    font-weight: 600;
    text-align: right;
  }
}

@media print {
  .person-table thead {
    display: table-header-group;
  }

  .person-table tr {
    break-inside: avoid;
  }
}

/* SAL-1 (S6 sections 2 and 3): Employees. The list is a table from 768 px and a card per employee
   below it (S0-007a); names and amounts never break inside. */
.employees-tabs {
  margin-bottom: 16px;
}

.employees-table td,
.employees-table th {
  overflow-wrap: normal;
}

.employees-table .employee-salary,
.employees-table .employee-mobile,
.employees-table .employee-left {
  white-space: nowrap;
}

@media (max-width: 767px) {
  .employees-table thead {
    display: none;
  }

  .employees-table,
  .employees-table tbody {
    display: block;
  }

  .employees-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    grid-template-areas:
      "name salary"
      "designation mobile"
      "left left";
    gap: 4px 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
  }

  .employees-table td {
    display: block;
    padding: 0;
    border: 0;
    text-align: left;
  }

  .employees-table .employee-name {
    grid-area: name;
  }

  .employees-table .employee-salary {
    grid-area: salary;
    text-align: right;
  }

  .employees-table .employee-designation {
    grid-area: designation;
    color: var(--text-secondary);
  }

  .employees-table .employee-mobile {
    grid-area: mobile;
    text-align: right;
    color: var(--text-secondary);
  }

  .employees-table .employee-left {
    grid-area: left;
    color: var(--text-secondary);
  }

  .employees-table .employee-left::before {
    content: "Left On ";
    font-weight: 600;
  }
}

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

@media (min-width: 1280px) {
  .employee-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
  }
}

.salary-lines .salary-total {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  font-weight: 600;
}

.salary-lines dd {
  white-space: nowrap;
}

.monthly-salary {
  margin: 16px 0 0;
  font-size: 1.0625rem;
}

.monthly-salary .amount {
  margin-left: 8px;
  white-space: nowrap;
}

.deduction-field {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.deduction-field select {
  width: 100%;
}

.deduction-amount {
  margin-top: 8px;
}

.deduction-amount[hidden] {
  display: none;
}

.employee-form-card .form-section + .form-section {
  margin-top: var(--lx-space-6);
}

/* B-240zf1 / B-240zf2 (D310): the FDs list (nine columns) and "TDS Deducted by Others": a table
   from 1280 px, a card each below, as the loans' list. */
.deposit-cards,
.tds-cards {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.deposit-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.deposit-card:last-child {
  border-bottom: 0;
}

@media (max-width: 1279px) {
  .deposits-table-wrap,
  .tds-table-wrap {
    display: none;
  }
}

@media (min-width: 1280px) {
  .deposit-cards,
  .tds-cards {
    display: none;
  }
}


/* C-321 (S 1.5; mockups S15-01, S15-03): the Capital Assets page's group rows, and an asset's page in
   two columns from 1024 px (one on a phone). */
.items-table .group-row th,
.items-table .group-row td {
  background: var(--table-head);
  font-weight: 600;
}

.asset-columns {
  display: grid;
  gap: 16px;
}

@media (min-width: 1024px) {
  .asset-columns {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

/* D-426 accounting mode */
/* S 2.6 A1 (mockup S26-01): the switch on the top bar, the Gateway's columns, Go To. */
.accounting-switch {
  margin: 0;
}

.accounting-toggle.is-on {
  background: var(--primary);
  color: var(--on-primary);
}

.go-to-box {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.go-to-box input {
  flex: 1;
  min-width: 0;
}

.key-hint {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  white-space: nowrap;
}

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

.gateway-menu {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.gateway-column ul,
.go-to-results ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.gateway-column li,
.go-to-results li {
  padding: 6px 0;
}

.gateway-soon {
  color: var(--text-secondary);
}

.glance-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  margin: 0 0 16px;
}

.glance-list dd {
  margin: 0;
  text-align: right;
}

.glance-good {
  color: var(--money-in);
}

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

/* D-427 accounting books */
/* S 2.6 A2 (mockup S26-03): a voucher's Dr and Cr lines one under the other; a waiting one dimmed; cards on a phone. */
.accounting-day-book .db-line {
  display: block;
}

.accounting-day-book tr.is-waiting td {
  color: var(--text-secondary);
}

@media (max-width: 767px) {
  .accounting-day-book thead,
  .ledgers-table thead,
  .book-table thead {
    display: none;
  }
}

/* D-427z: a cancelled voucher stays in the Day Book, struck through (S 2.6 section 7). */
.accounting-day-book tr.is-cancelled td {
  color: var(--text-secondary);
  text-decoration: line-through;
}

.accounting-day-book tr.is-cancelled td[data-label="Note"] {
  text-decoration: none;
}

/* D-428 vouchers */
/* S 2.6 A5 (mockup S26-02): the voucher on the left, the panel on the right; one under the other below 768 px. */
.voucher-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18rem;
  gap: 1rem;
  align-items: start;
}

.voucher-kinds {
  margin-bottom: 1rem;
}

.voucher-panel-line {
  margin: 0 0 0.5rem;
  overflow-wrap: normal;
  word-break: normal;
}

.voucher-split {
  margin: 1rem 0;
}

.keys-table kbd {
  font-family: inherit;
  font-weight: 600;
  white-space: nowrap;
}

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

  .voucher-lines thead,
  .keys-table thead {
    display: none;
  }
}

/* D-429 outstandings */
/* S 2.6 A4 (section 7): Outstandings' two tiles, its age and bill tables, the on-account list; an age's words never break; cards on a phone. */
.outstanding-stats {
  margin-bottom: 16px;
}

.outstanding-bills td[data-label="Age"] {
  white-space: nowrap;
}

@media (max-width: 767px) {
  .outstanding-ages thead,
  .outstanding-bills thead,
  .outstanding-on-account thead {
    display: none;
  }
}

/* D-430 chart and control */
/* S 2.6 A6 (5.1, 10.1, 10.2): the Chart of Accounts folding, each balance at the right and never broken; Things to Check one line each, a warning in red; the lock's line. */
.chart-group {
  margin: 0;
  padding: 6px 0;
  border-top: 1px solid var(--row-line);
}

.chart-group summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  font-weight: 600;
}

.chart-inside {
  padding-left: 16px;
}

.chart-ledger {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 4px 0;
}

.chart-balance,
.check-value {
  white-space: nowrap;
}

.chart-edits {
  margin-top: 16px;
}

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

.check-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--row-line);
}

.check-line.is-warning .check-value {
  color: var(--money-out);
  font-weight: 600;
}

.lock-now {
  margin: 0;
}

@media (max-width: 767px) {
  .voucher-types-table thead {
    display: none;
  }
}

/* D-429z: S 2.6 9.6: an Accounting Mode report prints with the business's letterhead (logo, name, address, GSTIN) on top and "Printed by … on …" under it; the statements' one-line business name gives way to the letterhead. */
@media print {
  .print-letterhead {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin-bottom: 12px;
    font-weight: 400;
    text-align: center;
  }

  .print-letterhead strong {
    font-size: 1.25rem;
  }

  .print-letterhead .print-logo {
    max-height: 48px;
    max-width: 160px;
  }

  body:has(.print-letterhead) .statement-business {
    display: none !important;
  }

  .print-footer {
    margin-top: 12px;
    font-size: 0.8125rem;
    font-weight: 400 !important;
  }
}
/* D-408a (R29, D276): the Accounts page's "Balance as On" line: the date field and its button,
   wrapping on a phone; the "Balances as on <date>" notice under it. */
.as-on-line {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}

.as-on-notice {
  margin: 0 0 12px;
}

/* D-409 ST-5 statements */
/* Receivables, Payables, Category, Profit Taken, Loans & Advances: a table on a computer, each
   row a card below 768 px with each cell's label (Q4); amounts never break. */
.st5-table {
  width: 100%;
  border-collapse: collapse;
}

.st5-table th,
.st5-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  overflow-wrap: normal;
}

.st5-table .money-col {
  text-align: right;
  white-space: nowrap;
}

.st5-table .st-total td,
.st5-table .st-profit td {
  font-weight: 600;
}

.st5-part {
  margin: 16px 16px 4px;
}

.statement-note {
  margin: 0 16px 16px;
}

@media (max-width: 767px) {
  .st5-table thead {
    display: none;
  }

  .st5-table,
  .st5-table tbody,
  .st5-table tfoot,
  .st5-table tr {
    display: block;
  }

  .st5-table tr {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
  }

  .st5-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 0;
    border: 0;
    text-align: right;
  }

  .stmt-table td:empty {
    display: none;
  }

  .stmt-table td[data-label]::before {
    content: attr(data-label);
    flex: none;
    max-width: 45%;
    color: var(--text-secondary);
    text-align: left;
  }

  .st5-table td[data-label]::before {
    content: attr(data-label);
    color: var(--text-secondary);
    text-align: left;
  }

  .st-process th,
  .st-process .st-laxmi,
  .st-process .st-bank {
    min-width: 0;
    max-width: none;
  }

  .stmt-table .st-bank,
  .stmt-table .st-ref,
  .stmt-table .st-laxmi {
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
  }

  .stmt-table .st-file {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 8px;
  }
}

@media (max-width: 767px) {
  .st-recon {
    grid-template-columns: max-content minmax(0, 1fr);
    padding: 0 16px 8px;
  }

  .st-recon-note {
    grid-column: 1 / -1;
  }

  .st-recon-amount {
    justify-self: end;
  }
}

/* ---------- E-524 (S 1.6 sections 2 and 5; D305): the cheque leaf, CTS-2010 ---------- */
/* The leaf (about 202 x 93 mm) printed at 100 % on its own named page (the vouchers keep A5
   landscape); the places in mm from the leaf's top left, after the CTS-2010 layout (the date's 8
   boxes at the top right, the payee's line, the amount in words on two lines, the figures' box at
   the right, the crossing at the top left); the account's one adjustment moves them all
   (data-cheque-shift, the script). Never a signature; nothing on the account-number place. */
@page cheque {
  size: 202mm 93mm;
  margin: 0;
}

.cheque-sheet {
  page: cheque;
  box-sizing: border-box;
  width: 202mm;
  height: 93mm;
  overflow: hidden;
  background: var(--card);
}

.cheque-leaf {
  position: relative;
  width: 202mm;
  height: 93mm;
  font-family: Inter, system-ui, sans-serif;
  font-size: 11pt;
  color: var(--text);
}

.cheque-leaf > div {
  position: absolute;
  white-space: nowrap;
}

.cheque-crossing {
  top: 4mm;
  left: 8mm;
  width: 34mm;
  padding: 1.5mm 0;
  border-top: 0.4mm solid var(--text);
  border-bottom: 0.4mm solid var(--text);
  transform: rotate(-12deg);
  text-align: center;
  font-weight: 700;
  font-size: 9pt;
}

.cheque-date {
  top: 7mm;
  left: 152mm;
  display: flex;
}

.cheque-date span {
  width: 5.5mm;
  text-align: center;
  letter-spacing: 0;
}

.cheque-payee {
  top: 20mm;
  left: 18mm;
  width: 150mm;
}

.cheque-words {
  top: 29mm;
  left: 24mm;
  width: 125mm;
  white-space: normal;
  line-height: 8mm;
}

.cheque-figures {
  top: 37mm;
  left: 156mm;
  font-weight: 700;
}

/* The voucher's virtual cheque: the same places drawn in a cheque-shaped box, scaled into the
   voucher (A5 landscape), with the bank's name, the account number and the Cheque No. */
.voucher-cheque {
  overflow: hidden;
  height: 55mm;
}

.cheque-virtual {
  border: 0.3mm solid var(--text);
  border-radius: 1.5mm;
  transform: scale(0.58);
  transform-origin: top left;
}

.cheque-bank {
  top: 4mm;
  left: 60mm;
  font-weight: 700;
}

.cheque-account {
  top: 60mm;
  left: 18mm;
}

.cheque-number {
  top: 82mm;
  left: 70mm;
  letter-spacing: 1mm;
}

@media print {
  .cheque-sheet {
    break-before: page;
  }
}

/* ---------- E-525 (S 1.6 section 8.3; D307): the bank's form, never edited ---------- */
/* Its own page size (HDFC: Legal, 217.6 x 355.8 mm) or A4 (Fit to A4: everything scaled together);
   the form's picture fills the page; each detail black, 10 pt (7 pt when long), placed in mm from
   the page's top left by the script (data-x, data-y: its left and its baseline). */
@page bankform {
  size: 217.6mm 355.8mm;
  margin: 0;
}

@page bankform-a4 {
  size: 210mm 297mm;
  margin: 0;
}

.bank-form-page {
  page: bankform;
  position: relative;
  overflow: hidden;
  width: 217.6mm;
  height: 355.8mm;
  background: var(--card);
}

.bank-form-page.bank-form-a4 {
  page: bankform-a4;
  width: 210mm;
  height: 297mm;
}

.bank-form-inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 217.6mm;
  height: 355.8mm;
  transform-origin: top left;
}

.bank-form-picture {
  position: absolute;
  top: 0;
  left: 0;
  width: 217.6mm;
  height: 355.8mm;
}

.bank-form-piece {
  position: absolute;
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  font-size: 10pt;
  line-height: 1;
  white-space: nowrap;
}

.bank-form-small {
  font-size: 7pt;
}

.voucher-form-box {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 2px 12px;
  padding: 8px 12px;
  border: 1px solid var(--text);
}

.voucher-form-box strong {
  grid-column: 1 / -1;
}

@media print {
  .bank-form-page {
    break-before: page;
  }
}

/* ---------- E-525z (S 1.6 section 8.2; D307): a business's own bank forms ---------- */
/* Each paper its own page (Legal above; A4 and Letter here); "Place the Fields": the details'
   list beside the form's picture (under it on a phone), the picture as wide as its box. */
@page bankform-a4-paper {
  size: 210mm 297mm;
  margin: 0;
}

@page bankform-letter {
  size: 215.9mm 279.4mm;
  margin: 0;
}

.bank-form-page.bank-form-paper-a4 {
  page: bankform-a4-paper;
  width: 210mm;
  height: 297mm;
}

.bank-form-page.bank-form-paper-letter {
  page: bankform-letter;
  width: 215.9mm;
  height: 279.4mm;
}

.bank-form-paper-a4 .bank-form-inner,
.bank-form-paper-a4 .bank-form-picture {
  width: 210mm;
  height: 297mm;
}

.bank-form-paper-letter .bank-form-inner,
.bank-form-paper-letter .bank-form-picture {
  width: 215.9mm;
  height: 279.4mm;
}

.place-layout {
  display: grid;
  gap: var(--space);
}

@media (min-width: 1024px) {
  .place-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  }
}

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

.place-details li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  padding: 4px 0;
}

.place-details li.is-active .btn {
  border-color: var(--primary);
}

.place-picture-wrap {
  overflow: hidden;
}

.place-picture {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
}

@media (max-width: 767px) {
  .st5-table td:empty {
    display: none;
  }
}

.tds-table .total-row td {
  border-top: 1px solid var(--border);
}

@media print {
  .tds-report .toolbar {
    display: none;
  }
}

@media print {
  .st5-table thead {
    display: table-header-group;
  }

  .st5-table tr {
    break-inside: avoid;
  }
}


/* D-414z statements at 768 px */
/* D292 (the chat at 768 px): with the sidebar a table of five or more columns does not fit its card,
   so the statements' tables are the phone's cards up to 1023 px (every cell read whole); the
   Statements page's "Period" is no bordered box; a gap above "View Statement"; the Day Book's
   Particulars stack at full width in a card. */
.statement-periods {
  margin: 12px 0 0;
  padding: 0;
  border: 0;
}

.statements-chooser .form-actions {
  margin-top: var(--lx-space-4);
}

@media (max-width: 1023px) {
  .statement-table thead,
  .person-table thead,
  .st5-table thead {
    display: none;
  }

  .statement-table,
  .statement-table tbody,
  .statement-table tfoot,
  .person-table,
  .person-table tbody,
  .person-table tfoot,
  .st5-table,
  .st5-table tbody,
  .st5-table tfoot,
  .st5-table tr {
    display: block;
  }

  .statement-table tr,
  .person-table tr {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
  }

  .statement-table tr {
    grid-template-areas:
      "date balance"
      "what what"
      "entry money";
  }

  .person-table tr {
    grid-template-areas:
      "date balance"
      "what what"
      "invoice money";
  }

  .statement-table td,
  .person-table td {
    display: block;
    padding: 0;
    border: 0;
  }

  .statement-table .st-date,
  .person-table .pt-date {
    grid-area: date;
    font-weight: 600;
  }

  .statement-table .st-what,
  .person-table .pt-what {
    grid-area: what;
  }

  .statement-table .st-entry,
  .statement-table .st-by,
  .statement-table .st-at,
  .person-table .pt-invoice {
    grid-area: entry;
    color: var(--text-secondary);
  }

  .person-table .pt-invoice {
    grid-area: invoice;
  }

  .statement-table .st-in,
  .statement-table .st-out,
  .person-table .pt-dr,
  .person-table .pt-cr {
    grid-area: money;
    text-align: right;
  }

  .statement-table .st-in:empty,
  .statement-table .st-out:empty,
  .statement-table .st-entry-none,
  .statement-table .st-at:empty,
  .person-table .pt-dr:empty,
  .person-table .pt-cr:empty,
  .person-table .pt-invoice:empty {
    display: none;
  }

  .statement-table .st-in::before {
    content: "In ";
    color: var(--text-secondary);
  }

  .statement-table .st-out::before {
    content: "Out ";
    color: var(--text-secondary);
  }

  .person-table .pt-dr::before {
    content: "Dr ";
    color: var(--text-secondary);
  }

  .person-table .pt-cr::before {
    content: "Cr ";
    color: var(--text-secondary);
  }

  .statement-table .st-balance,
  .person-table .pt-balance {
    grid-area: balance;
    font-weight: 600;
    text-align: right;
  }

  .st5-table tr {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
  }

  .st5-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 0;
    border: 0;
    text-align: right;
  }

  .st5-table td[data-label]::before {
    content: attr(data-label);
    color: var(--text-secondary);
    text-align: left;
  }

  .st5-table td:empty {
    display: none;
  }

  .st5-table td[data-label="Particulars"] {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    text-align: left;
  }
}

/* D-414zf2 statements' totals on cards */
/* D296 (the chat at 768 and 390 px): on cards every Total row names its figures, each on a line of
   its own ("Money In" / "Money Out", "Debit" / "Credit"); a row with both sides (a Direct entry, Q6)
   keeps them apart; the closing row is its label, its figure and its words, each at full width.
   R5's day view (8 columns) is cards up to 1199 px, nothing cut off at 1093 px. */
@media (max-width: 1023px) {
  .person-table tr {
    grid-template-areas:
      "date balance"
      "what what"
      "invoice invoice"
      "dr cr";
  }

  .person-table .pt-invoice {
    grid-area: invoice;
  }

  .person-table .pt-dr {
    grid-area: dr;
    text-align: left;
  }

  .person-table .pt-cr {
    grid-area: cr;
    text-align: right;
  }

  .statement-table .st-total {
    display: block;
  }

  .person-table .pt-total {
    display: block;
  }

  .statement-table .st-total td,
  .person-table .pt-total td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    text-align: right;
  }

  .statement-table .st-total td:empty,
  .person-table .pt-total td:empty {
    display: none;
  }

  .statement-table .st-total td[data-label]::before,
  .person-table .pt-total td[data-label]::before {
    content: attr(data-label);
    color: var(--text-secondary);
  }

  .person-closing {
    display: block;
  }

  .person-closing > * {
    display: block;
  }
}

@media (max-width: 1199px) {
  .statement-day thead {
    display: none;
  }

  .statement-day,
  .statement-day tbody,
  .statement-day tfoot {
    display: block;
  }

  .statement-day tr {
    display: grid;
    grid-template-areas:
      "date balance"
      "what what"
      "entry entry"
      "by at"
      "money money";
    grid-template-columns: auto 1fr;
    gap: 4px 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
  }

  .statement-day td {
    display: block;
    padding: 0;
    border: 0;
  }

  .statement-day .st-date {
    grid-area: date;
    font-weight: 600;
  }

  .statement-day .st-what {
    grid-area: what;
  }

  .statement-day .st-entry {
    grid-area: entry;
    color: var(--text-secondary);
  }

  .statement-day .st-by {
    grid-area: by;
    color: var(--text-secondary);
  }

  .statement-day .st-at {
    grid-area: at;
    color: var(--text-secondary);
    text-align: right;
  }

  .statement-day .st-in,
  .statement-day .st-out {
    grid-area: money;
    text-align: right;
  }

  .statement-day .st-in::before {
    content: "In ";
    color: var(--text-secondary);
  }

  .statement-day .st-out::before {
    content: "Out ";
    color: var(--text-secondary);
  }

  .statement-day .st-in:empty,
  .statement-day .st-out:empty,
  .statement-day .st-entry-none,
  .statement-day .st-by:empty,
  .statement-day .st-at:empty {
    display: none;
  }

  .statement-day .st-balance {
    grid-area: balance;
    font-weight: 600;
    text-align: right;
  }

  .statement-day .st-total {
    display: block;
  }

  .statement-day .st-total td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
  }

  .statement-day .st-total td:empty {
    display: none;
  }

  .statement-day .st-total td[data-label]::before {
    content: attr(data-label);
    color: var(--text-secondary);
  }
}

/* D-415 statements' sweep */
/* An amount never breaks inside (rule 14): every figure marked "money" stays on one line. */
.money {
  white-space: nowrap;
}

/* The body breaks long text anywhere; a statement's titles break only between words. */
.statement-card-box h2,
.statement-card-box h3,
.person-card h3,
.statement-kind {
  overflow-wrap: break-word;
}
/* E-510zz (D278, the chat's review of S 1.4 at five widths): a statement's columns take the widths they
   need: the bank date, the reference and the amounts never wrap; a head never breaks inside a word;
   "In Laxmi" takes the rest and wraps between words. The date-gap alert: the found entry on the left,
   "It Is a New Entry" then "Match It Instead" together on its right (stacked on a phone). */
.st-process th {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

.st-process .st-date,
.st-process .st-ref,
.st-process .st-num {
  white-space: nowrap;
}

.st-process .st-laxmi {
  min-width: 160px;
  max-width: 260px;
  word-break: normal;
  overflow-wrap: break-word;
}

.st-process .st-bank {
  min-width: 160px;
}

.st-toolbar .tabs {
  flex: 1 1 auto;
  border-bottom: 0;
}

.st-gap-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--lx-space-2) var(--lx-space-4);
  padding: var(--lx-space-2) 0;
}

.st-gap-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--lx-space-2);
  margin-left: auto;
}

@media (max-width: 767px) {
  .st-process th,
  .st-process .st-laxmi,
  .st-process .st-bank {
    min-width: 0;
    max-width: none;
  }

  .st-gap-buttons {
    width: 100%;
    margin-left: 0;
  }

  .st-gap-buttons .btn {
    flex: 1 1 auto;
  }
}

/* E-511 (S 1.4 S14-6): the forms a statement line may open, as the app's choice cards in a row
   (wrapping, never sideways); "Same Details for All" in rows of three; the line's block across a
   contra form's grid. */
.st-forms {
  display: flex;
  flex-wrap: wrap;
  gap: var(--lx-space-2);
  margin: 0 0 var(--lx-space-3);
}

.st-form {
  padding: var(--lx-space-2) var(--lx-space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.st-form-on {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.st-same .form-actions {
  grid-column: 1 / -1;
}

.form-grid > .st-from-line {
  grid-column: 1 / -1;
}

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

  .st-form {
    white-space: normal;
  }
}

/* E-512 (S 1.4 S14-7): the words against the bank beside a balance (green or red, the red one opens the
   first line where it starts); the Reconciliation's date field and button on one line. */
.st-against-link {
  color: inherit;
}

/* E-512zz (D283): Approve / Reject of a statement's receipt or contra waiting in the trial. */
.held-decide {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.held-decide input {
  min-width: 0;
  max-width: 100%;
}

/* E-514 (D283): Approve / Reject on a held receipt's or contra's own page. */
.held-decide-box {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0;
}

/* E-514zz (D294, the chat's review of S 1.4 at 1093, 768 and 390 px): every S 1.4 table (all are
   .stmt-table) is the app's cards below 1200 px, so no cell or button is cut off at 1093 or 768;
   in the cards a long bank word (names, narrations, references, "In Laxmi") breaks inside, an
   amount never does. "Same Details for All" shows only once a New line is ticked, with the form's
   usual gap above its button. The Reconciliation in three aligned columns (what · amount · note),
   its date form wrapping (the Not Yet Cleared page never wider than the screen). */
.stmt-table .st-num {
  white-space: nowrap;
}

.st-same {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  column-gap: 16px;
  row-gap: 16px;
  padding: 12px 20px 0;
}

body:not(:has(input[form="same-form"]:checked)) #same-form {
  display: none;
}

.st-recon-head {
  flex-wrap: wrap;
  gap: 8px 16px;
}

.st-recon-date {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
}

.st-recon {
  display: grid;
  grid-template-columns: max-content max-content minmax(0, 1fr);
  padding: 0 20px 8px;
}

.st-recon-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  gap: 4px 24px;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--row-line);
}

.st-recon-what {
  font-weight: 600;
}

.st-recon-amount {
  text-align: right;
  white-space: nowrap;
  font-weight: 600;
}

.st-recon-note {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 1199px) {
  .stmt-table thead {
    display: none;
  }

  .stmt-table,
  .stmt-table tbody {
    display: block;
    width: 100%;
  }

  .stmt-table tr {
    display: block;
    padding: 12px 16px;
    border-bottom: 1px solid var(--row-line);
  }

  .stmt-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 0;
    border: 0;
    text-align: right;
  }

  .stmt-table td:empty {
    display: none;
  }

  .stmt-table td[data-label]::before {
    content: attr(data-label);
    flex: none;
    max-width: 45%;
    color: var(--text-secondary);
    text-align: left;
  }

  .st-process th,
  .st-process .st-laxmi,
  .st-process .st-bank {
    min-width: 0;
    max-width: none;
  }

  .stmt-table .st-bank,
  .stmt-table .st-ref,
  .stmt-table .st-laxmi {
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
  }

  .stmt-table .st-file {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 8px;
  }
}

@media (max-width: 767px) {
  .st-recon {
    grid-template-columns: max-content minmax(0, 1fr);
    padding: 0 16px 8px;
  }

  .st-recon-note {
    grid-column: 1 / -1;
  }

  .st-recon-amount {
    justify-self: end;
  }
}

/* E-516ze (D298, the chat's render of E-514zz and E-515): the account page's balance line wraps
   (the chip under "Balance in Laxmi …" when there is no room; the amount itself never breaks), so
   no S 1.4 page is wider than the screen; on Process Statement's cards a New line's tick sits at
   the card's top left beside "Bank Date", the date at the right. */
.acct-balance {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  white-space: normal;
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--table-head);
}

.acct-balance .money {
  white-space: nowrap;
}

.acct-balance .pill {
  max-width: 100%;
  margin-left: 0;
  white-space: normal;
}

@media (max-width: 1199px) {
  .stmt-table td.st-date {
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
  }

  .stmt-table .st-tick {
    order: -1;
    margin: 0;
  }

  .stmt-table .st-date-value {
    margin-left: auto;
  }
}

/* D-416 reminders */
/* The Reminders page (R20-3): a card per kind, its count beside the title, one line per matter. */
.reminder-group + .reminder-group {
  margin-top: 16px;
}

.reminder-count {
  display: inline-block;
  min-width: 24px;
  padding: 0 8px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  text-align: center;
}

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

.reminder-lines li + li {
  border-top: 1px solid var(--row-line);
}

/* A line wraps between words on a phone; its amount stays whole (rule 14). */
.reminder-line a {
  display: block;
  min-height: 36px;
  padding: 10px 0;
  color: var(--text);
  text-decoration: none;
  overflow-wrap: break-word;
}

.reminder-line a.is-warning {
  color: var(--money-out);
}

.reminder-nothing {
  margin: 0;
  color: var(--text-secondary);
}

/* D-417 logs */
/* Logs and My Activity (R20-4): the filters in a row, the record as a table; cards on a phone. */
.logs-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.logs-filters {
  margin-bottom: 16px;
}

.logs-table .log-when {
  white-space: nowrap;
}

.logs-table .log-detail {
  overflow-wrap: break-word;
}

/* M-111 (D346): Logs never breaks a word inside. The body's `overflow-wrap: anywhere` let the
   table shrink Who, What, About and Device to a letter's width and break words at 1440 px; from
   1093 px these cells keep words whole (each column as wide as its longest word, wrapping only
   between words), When on one line, Detail taking the rest and wrapping between words (a run too
   long for its column may still break, only where it would not fit). Below 1093 px the cards. */
@media (min-width: 1093px) {
  .logs-table th {
    white-space: nowrap;
  }

  .logs-table td {
    overflow-wrap: normal;
    word-break: normal;
  }

  .logs-table .log-when {
    white-space: nowrap;
  }

  .logs-table .log-detail {
    overflow-wrap: break-word;
  }
}

@media (max-width: 1092px) {  /* M-111 (D346): the cards below 1093 px (767 px before) */
  .logs-table td {
    overflow-wrap: break-word;
  }

  .logs-table thead {
    display: none;
  }

  .logs-table tr {
    display: block;
    padding: 10px 0;
    border-bottom: 1px solid var(--row-line);
  }

  .logs-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 0;
    border: 0;
    text-align: right;
  }

  .logs-table td:empty {
    display: none;
  }

  .logs-table td[data-label]::before {
    content: attr(data-label);
    color: var(--text-secondary);
    text-align: left;
  }
}

/* D-418 expense heads */
/* The head on a payment's row, "Mark As" under the Payments list, the head's two choices. */
.en-head .en-mark {
  margin: 0 var(--lx-space-2) 0 0;
  vertical-align: middle;
}

.mark-head-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--lx-space-2) var(--lx-space-3);
  align-items: center;
  margin-top: var(--lx-space-3);
}

.head-choice .check {
  margin-right: var(--lx-space-4);
}


/* C-304 (S 1.3 section 3): Items: a table from 1024 px, a card per item below it. */
.items-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.item-cards {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.items-table td,
.items-table th {
  overflow-wrap: normal;
  word-break: normal;
}

@media (max-width: 1023px) {
  .items-table-wrap {
    display: none;
  }
}

@media (min-width: 1024px) {
  .item-cards {
    display: none;
  }
}

/* C-305 (S 1.3 plan step 2): the import's preview: a table from 768 px, a card per row below. */
.import-preview .text-danger {
  color: var(--money-out);
}

.import-preview .field-error {
  margin: 0;
}

.import-save {
  padding: 16px;
}

@media (max-width: 767px) {
  .import-table-wrap {
    display: none;
  }
}

@media (min-width: 768px) {
  .import-cards {
    display: none;
  }
}

/* C-308 (S 1.3 section 4.1): the Sales Invoice form. Its customer part joins the grid's rows;
   each line is a row from 1024 px and a card below it; the totals at the right of the foot. */
.grid-contents {
  display: contents;
}

.sale-kind,
.invoice-options {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0 0 16px;
}

.invoice-lines-head {
  display: none;
}

.invoice-line {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.invoice-line .line-item,
.invoice-line .line-description,
.invoice-line .line-messages {
  grid-column: 1 / -1;
}

.invoice-line .line-value {
  display: block;
  padding-top: 8px;
}

#add-line {
  margin: 12px 0;
}

.invoice-foot {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.invoice-totals .invoice-total dd {
  font-size: 1.1429rem;
}

.rate-summary,
.amount-words {
  margin: 0 0 8px;
}

@media (min-width: 1024px) {
  .invoice-lines-head,
  .invoice-line {
    display: grid;
    grid-template-columns: 2fr 1.6fr 0.8fr 0.7fr 0.6fr 1fr 0.7fr 0.8fr 1fr;
    gap: 8px;
    align-items: start;
  }

  .invoice-lines.no-gst .invoice-line,
  .invoice-lines-head:has(+ .invoice-lines.no-gst) {
    grid-template-columns: 2fr 1.6fr 0.8fr 0.7fr 0.6fr 1fr 0.7fr 1fr;
  }

  .invoice-lines-head {
    color: var(--text-secondary);
    font-size: 0.8571rem;
    font-weight: 500;
  }

  .invoice-line .line-item,
  .invoice-line .line-description {
    grid-column: auto;
  }

  .invoice-line .field-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .invoice-foot {
    grid-template-columns: 2fr 1fr;
  }
}

/* C-311 (S 1.3 section 7.2): below zero in red (a warning), on the Stock Summary and the item. */
.stock-below-zero {
  color: var(--money-out);
  font-weight: 600;
}

.save-anyway {
  margin: 0 0 12px;
}

/* C-313 (D288): a cancelled invoice's or bill's due: grey, as Pending. */
.tag-due-cancelled {
  background: var(--neutral-soft); /* RC9b: the hex fallback dropped */
  color: var(--text-secondary);
}

/* C-314zz (D295): a cancelled invoice's, bill's, note's or due's state: grey, as Pending (red only
   for warnings). */
.state-box {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--neutral-soft); /* RC9b: the hex fallback dropped */
  color: var(--text-secondary);
}

/* C-315 (S 1.3 sections 2 and 8): a cancelled bill or note in a list or a register, struck
   through (shown, counted nowhere). */
.is-cancelled td,
.is-cancelled .due-card-line,
.is-cancelled .due-name {
  text-decoration: line-through;
  color: var(--text-secondary);
}

/* ---------- E-520 (Release 2.0 P4; D284 Q11): the Request for Disbursement of Profit ---------- */
/* A4 portrait (its own named page; the vouchers keep A5 landscape), black on white; the sheet as
   the voucher's (scaled to the width on a phone by data-voucher-fit, nothing reflows). */
@page pd {
  size: 210mm 297mm;
  margin: 0;
}

.pd-sheet {
  page: pd;
  min-height: 1123px;
}

.pd-frame {
  min-height: 1067px;
}

.pd-table {
  width: 100%;
  border-collapse: collapse;
}

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

.pd-table .pd-num {
  text-align: right;
}

.pd-words {
  margin: 0;
  font-weight: 600;
}

.pd-signs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px 24px;
}

.pd-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 16px;
  padding: 0 16px 12px;
}

@media print {
  .pd-sheet {
    width: 210mm;
    min-height: 297mm;
  }
}

/* D-434: S 2.6 A3, the Profit & Loss and the Balance Sheet (mockup S26-05) */
.fa-chips {
  align-items: center;
  flex-wrap: wrap;
}
.fa-provisional {
  background: var(--waiting-soft);
  border-radius: var(--radius-small);
  color: var(--waiting);
  font-weight: 600;
  margin-left: auto;
  padding: 4px 10px;
}
.fa-t {
  display: grid;
  gap: var(--space);
  grid-template-columns: 1fr 1fr;
}
.fa-v {
  display: grid;
  gap: var(--space);
}
.fa-table .fa-level-1 td:first-child {
  padding-left: 24px;
}
.fa-table .fa-level-2 td:first-child {
  padding-left: 40px;
}
.fa-table tr:target,
.fa-table tr:focus-within {
  background: var(--primary-soft);
}
.drill-back {
  margin: 0 0 8px;
}
@media (max-width: 767px) {
  .fa-t {
    grid-template-columns: 1fr;
  }
  .fa-provisional {
    margin-left: 0;
  }
}

/* B-249z (SAL-5, S6 7c): "Adjust Against the Salary of" is for a salary advance only: hidden while
   "Reimbursement Advance" is chosen (the server ignores a month sent with it). */
.employee-advance:has(input[value="reimbursement"]:checked) .salary-month {
  display: none;
}

/* E-542, C005: "Voucher Pending", amber (a state to finish, never red: R14), as Kept Pending's. */
.tag-voucher-pending {
  margin-left: var(--lx-space-2);
  background: var(--waiting-soft);
  color: var(--waiting);
  white-space: nowrap;
}

.entry-voucher-state {
  margin: 4px 0 0;
}

/* B-272 (D469, F8): the box that opens after saving sits in the page's flow under the saved
   message (a non-modal dialog is otherwise laid over the top of the page, over the message's
   text); its words wrap and its Close sits at its end, at every width. */
.voucher-box-dialog[open] {
  position: static;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--lx-space-2) var(--lx-space-3);
  width: auto;
  max-width: none;
  margin: var(--lx-space-3) 0;
}

.voucher-box-dialog .dialog-content {
  flex: 1 1 320px;
  min-width: 0;
}

.voucher-box-dialog .dialog-close {
  margin: 0;
  margin-left: auto;
  padding: 0 var(--lx-space-4) var(--lx-space-4);
}

/* B-272 (D469, F9): a line list's table never scrolls inside its own box on a computer, so each
   line's ⋯ menu is never pushed out of sight or clipped when it opens (as the Users table). Below
   1000 px each line is a card, which never scrolls sideways either. */
.table-wrap:has(.line-list) {
  overflow: visible;
}

/* B-273 (D476, the chat's geometry check: the list cut off at 1093 and 768): an open ⋯ menu's line
   is lifted above the lines and the total under it, so the menu is never hidden behind them; on
   the cards (below 1100 px) the menu opens to the right of its button, inside the card, never
   towards the side menu. */
.line-list tr:has(.row-more[open]) {
  position: relative;
  z-index: 30;
}

.row-more[open] .row-more-panel {
  z-index: 31;
}

.card:has(.line-list),
.table-card:has(.line-list) {
  overflow: visible; /* the card never clips an open menu that runs past its foot */
}

@media (max-width: 1099px) {
  .line-list .row-more-panel {
    right: auto;
    left: 0;
  }
}

/* D-443 (C008; D347's rule): the statements by Expense Head, the Category statement, the Day Book
   and the cash P&L print on A4 portrait on their own named page, never the voucher's A5 (the
   unnamed @page); a Sub-Head's line (and "Direct to <Main>") indented under its main head. */
@page statement-a4 {
  size: 210mm 297mm;
  margin: 12mm;
}

.statement-print .content {
  page: statement-a4;
}

.st5-table .st-sub td:first-child {
  padding-left: 32px;
}

@media print {
  .statement-print .content {
    width: auto;
    margin: 0;
    padding: 0;
  }
}

/* D-446 (C010 section 6): an open advance past its Expected By, in amber (R14: red only for
   warnings); the open advance's line on the statements. */
.reminder-line a.is-amber {
  color: var(--waiting);
}

.open-advance .money {
  white-space: nowrap;
}

/* E-553 (D384): C010's "This Payment Is" part takes a whole row of the form (RR12's id-weight
   rule set every entry cell to one grid cell, squeezing the Advance block into a third of the row).
   Its Advance block has rows of its own: Advance Against · Document No. · Document Date, then
   Expected By · Attach; one to a row on a phone, two from 768 px, three from 1280 px; every cell may
   shrink, so nothing runs past the card or makes the page scroll sideways. */
.form .entry-grid.entry-grid > .payment-is:is(#rr12, *) {
  grid-column: 1 / -1;
}

.form-grid > .payment-is {
  grid-column: 1 / -1;
}

.payment-is .pi-advance {
  grid-template-columns: minmax(0, 1fr);
  margin-top: var(--lx-space-3);
}

.payment-is .pi-advance > * {
  min-width: 0;
}

.payment-is .pi-advance :is(input, select) {
  max-width: 100%;
  min-width: 0;
}

/* E-553 (D384): the Advance block, two to a row */
@media (min-width: 768px) {
  .payment-is .pi-advance {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* E-553 (D384): the Advance block, three to a row */
@media (min-width: 1280px) {
  .payment-is .pi-advance {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* C-344 (D384): a payment's print button in a form cell (the payment form's row 3, the approver's
   window) takes the cell's width and its words wrap at spaces inside the button when needed, so it
   never runs past the card, at every width. */
.cell-print {
  min-width: 0;
}

.cell-print .btn {
  width: 100%;
  max-width: 100%;
  height: auto;
  padding: var(--lx-space-2) var(--lx-space-4);
  white-space: normal;
  overflow-wrap: normal;
  text-align: center;
}

/* D-448 (D384): Loans & Advances with one party (D-445's Running Balance) fits its card. Below
   1024 px the table is the phone's cards (D292); from 1024 to 1440 px its Date column folds into
   the Loan cell, above the loan's name, the cells are tighter and a money heading may wrap (a money
   value never). The A4 print and a wide screen keep the table as it was. */
.st5-date-under {
  display: none;
}

@media screen and (min-width: 1024px) and (max-width: 1440px) {
  .st5-running .st5-date-col {
    display: none;
  }

  .st5-running .st5-date-under {
    display: block;
    color: var(--text-secondary);
    white-space: nowrap;
  }

  .st5-running th,
  .st5-running td {
    padding: 8px 10px;
  }

  .st5-running th.money-col {
    white-space: normal;
  }

  .st5-running td.money-col {
    white-space: nowrap;
  }
}

/* E-562, C015 items 1, 10 and 11 (D412): the payment and receipt forms. The parts' wrappers (Payment
   For / Receipt From, its Person / Firm and Search By blocks, the Advance switch) lay their boxes
   straight into the form's rows, so the page's own order makes the rows of three: Date · Payment For
   · Search By; (Party Type ·) Person / Firm · the Advance switch; Payment Against · Invoice · Amount;
   Paid From · Mode of Payment · its reference; Voucher Date · Date in Bank Statement · Name in Bank
   Statement; Narration, one full line. A box that does not apply (hidden, or empty) takes no place,
   so the row closes up. */
.pf-contents,
.pf-contents > .pf-block:not([hidden]),
.pf-contents .pf-find-block:not([hidden]),
.pi-contents:not([hidden]) {
  display: contents;
}

.form .entry-grid > .cell-reason:is(#rr12, *) {
  grid-column: 1 / -1;
}

.form .entry-grid .pi-contents > .pi-advance:is(#rr12, *) {
  grid-column: 1 / -1;
}

.form .entry-grid > .cell-against-item:not(:has(*)):is(#rr12, *),
.pf-contents .pf-paid-as:not(:has(*)),
.pf-contents #pf-subs:not(:has(*)) {
  display: none;
}

.form .entry-grid > .cell-against-item:has(.split-box):is(#rr12, *) {
  grid-column: 1 / -1;
}

/* the Advance switch: a track and its words on the cell's box line */
.pi-switch-field {
  justify-content: flex-end;
}

.pi-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--lx-space-3);
  min-height: var(--lx-control);
  font-weight: 600;
  cursor: pointer;
}

.pi-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.pi-switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  height: var(--lx-space-6);
  border-radius: var(--lx-radius-round);
  background: var(--border);
  transition: background 0.15s;
}

.pi-switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: var(--lx-icon-small);
  border-radius: var(--lx-radius-round);
  background: var(--card);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--lx-text) 20%, transparent);
  transition: transform 0.15s;
}

.pi-switch input:checked + .pi-switch-track {
  background: var(--primary);
}

.pi-switch input:checked + .pi-switch-track::after {
  transform: translateX(18px);
}

.pi-switch input:focus-visible + .pi-switch-track {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.pi-switch.is-greyed {
  opacity: 0.5;
  cursor: not-allowed;
}

/* item 11: the mode's print button, greyed until the payment is saved, under its reference */
.print-later {
  margin-top: var(--lx-space-2);
  max-width: 100%;
  height: auto;
  white-space: normal;
}

.print-later:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* E-563, C015 item 8 (D412): Pay on a Payment Due: who and what is paid, locked, a row of its own
   across the form (its lines three to a row as an entry's page), then how it is paid. */
.form .entry-grid > .pay-due-locked:is(#rr12, *) {
  grid-column: 1 / -1;
  padding: var(--lx-space-3) var(--lx-space-4);
  border: 1px solid var(--border);
  border-radius: var(--lx-radius-control);
  background: var(--table-head);
}

.pay-due-lines {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--lx-space-2) 16px;
  margin: 0;
}

.pay-due-lines dd {
  overflow-wrap: anywhere;
}

@media (min-width: 768px) {
  .pay-due-lines {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1093px) {
  .pay-due-lines {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* E-565, C016 (D412): the narration filled from the template is grey until typed in (the muted
   text colour, 5.3:1 on white); "↺ Auto Fill" sits at the right end of its label's line. */
.form input.is-auto {
  color: var(--muted);
}

/* E-570, C020 No. 22: the Payment Slip on A5, its own page; the question a row of its own. */
@page slip {
  size: A5;
  margin: 10mm;
}

.slip-page {
  page: slip;
  max-width: 148mm;
  margin: 0 auto;
  padding: 8mm;
  background: var(--card);
  border: 1px solid var(--border);
}

.slip-lines {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.slip-lines div {
  display: grid;
  grid-template-columns: 30mm minmax(0, 1fr);
  gap: 8px;
}

.slip-signs {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-top: 18mm;
}

.slip-stamp {
  width: 25mm;
  height: 25mm;
  border: 1px dashed var(--text-secondary);
  display: grid;
  place-items: center;
  text-align: center;
}

.slip-sign {
  margin-left: auto;
  text-align: center;
}

.slip-sign-line {
  display: block;
  width: 50mm;
  border-top: 1px solid var(--text);
  margin-bottom: 4px;
}

.form .entry-grid > .pay-slip:is(#rr12, *) {
  grid-column: 1 / -1;
}

.narration-template .choice-list {
  display: grid;
  gap: 8px;
}

/* B-265, C015 item 15 (D412; mockup C015-06): the Payments and Receipts lists: one compact line
   per entry, light row lines, no column grid, no centred text; Paid To in bold with what it was for
   in grey; the mode and reference under the account; the voucher's number or an amber Voucher
   Pending; every action in one ⋯ menu; the whole line opens the entry. On a phone, a card. */
.entries-table.line-list th,
.entries-table.line-list td {
  border-right: 0;
  border-left: 0;
  text-align: left;
  vertical-align: middle;
}

.entries-table.line-list th.money-col,
.entries-table.line-list td.money-col {
  text-align: right;
}

.entries-table.line-list tbody tr[data-row-href] {
  cursor: pointer;
}

.entries-table.line-list tbody tr[data-row-href]:hover {
  background: var(--table-head);
}

.line-list .en-party-name {
  display: block;
  font-weight: 600;
}

.line-list .en-for {
  display: block;
  color: var(--text-secondary);
  font-size:var(--lx-fs-label);
}

.line-list .en-account-mode {
  display: block;
  color: var(--text-secondary);
  font-size:var(--lx-fs-label);
}

.line-list .en-vch,
.line-list .en-more {
  white-space: nowrap;
}

.line-list .en-more {
  width: 1%;
  text-align: right;
}

.row-more {
  position: relative;
  display: inline-block;
}

.row-more-button {
  min-width: 40px;
  list-style: none;
}

.row-more-button::-webkit-details-marker {
  display: none;
}

.row-more-panel {
  position: absolute;
  z-index: 5;
  top: calc(100% + 4px);
  right: 0;
  display: flex;
  flex-direction: column;
  min-width: 180px;
  padding: var(--lx-space-2) 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--card);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--lx-text) 12%, transparent);
  text-align: left;
}

.row-more-item {
  padding: var(--lx-space-3) var(--lx-space-4);
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

@media (max-width: 999px) {  /* B-265: the line as a card, as the lists' cards */
  .entries-table.line-list tr {
    grid-template-areas:
      "date amount more"
      "party party party"
      "narration narration narration"
      "account vch vch";
    grid-template-columns: 1fr auto auto;
  }

  .entries-table.line-list .en-narration {
    grid-area: narration;
  }

  .entries-table.line-list .en-vch {
    grid-area: vch;
    text-align: right;
  }

  .entries-table.line-list .en-more {
    grid-area: more;
    width: auto;
  }

  .entries-table.line-list tfoot tr {
    grid-template-areas: "label amount";
    grid-template-columns: 1fr auto;
  }
}

/* B-266 (C021, D424; mockup C021-01): the Reminders page's statement lists (a statement table:
   cards below 1200 px), their actions on one line where they fit, and an account's own setting. */
.reminders-table .en-party-name {
  display: block;
  font-weight: 600;
}

.reminders-table .en-for {
  display: block;
  color: var(--text-secondary);
  font-size:var(--lx-fs-label);
}

.reminder-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.reminder-settings-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 20px;
}

.reminder-settings-form .field {
  min-width: 140px;
}

.statement-age {
  margin-left: 8px;
  font-size: 0.8571rem;
  vertical-align: middle;
}

/* B-267 / B-268 (C017; mockup C017-01): Settings → Backup. The state line (green when good, red
   when the last backup failed, amber "not set up yet"); Laxmi's key shown once; Download Now and
   the Automatic Extra Copies side by side on a computer, one under the other below 1100 px; each
   option a row of its words and its buttons, the buttons under the words on a phone. */
.backup-state {
  background: var(--money-in-soft);
  border-color: var(--money-in);
}
.backup-state.is-failed {
  background: var(--money-out-soft);
  border-color: var(--danger-border);
}
.backup-line {
  margin: 0 0 6px;
  color: var(--money-in);
  font-weight: 600;
  overflow-wrap: break-word;
}
.backup-line:last-child {
  margin-bottom: 0;
}
.backup-line.is-warning,
.backup-option-line.is-warning {
  color: var(--money-out);
}
.backup-line.is-amber,
.backup-option-line.is-amber {
  color: var(--waiting);
}
.backup-key {
  margin-top: 12px;
  padding: 12px 16px;
  border: 1px solid var(--waiting-border);
  border-radius: var(--radius-small);
  background: var(--waiting-soft);
  color: var(--text);
}
.backup-key p {
  margin: 0 0 6px;
}
.backup-key-value {
  font-family: ui-monospace, monospace;
  overflow-wrap: anywhere; /* C023-1's run (D156): the long key wraps without breaking every word */
}
.backup-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space);
  margin-bottom: var(--space);
}
.backup-card .section-title {
  margin: 0 0 var(--lx-space-2);
}
.backup-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--row-line);
}
.backup-option:first-of-type {
  border-top: 0;
}
.backup-option-words {
  min-width: 0;
}
.backup-option-name {
  margin: 0;
  font-weight: 600;
}
.backup-option-line {
  margin: 2px 0 0;
  color: var(--text-secondary);
  overflow-wrap: break-word;
}
.backup-option-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
}
@media (max-width: 1099px) {
  .backup-options {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 767px) {
  .backup-option {
    flex-direction: column;
    align-items: stretch;
  }
  .backup-option-buttons {
    justify-content: flex-start;
  }
}

/* C-349 parts (C018 sections 1.4 to 1.6 and 2; D419): built once, on the tokens only (no colour or
   size typed here). The pages move onto them in C018's sweep (section 4.4); the old class names keep
   working until then. Template snippets: web/templates/web/parts/. */
.lx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--lx-space-2);
  min-height: var(--lx-control);
  padding: 0 var(--lx-space-4);
  border: 1px solid transparent;
  border-radius: var(--lx-radius-control);
  font-family: var(--lx-font);
  font-size: var(--lx-fs-body);
  font-weight: var(--lx-weight-semibold);
  line-height: var(--lx-line-height);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.lx-btn:focus-visible {
  outline: none;
  box-shadow: var(--lx-ring);
}

.lx-btn--main {
  background: var(--lx-brand);
  border-color: var(--lx-brand);
  color: var(--lx-on-brand);
}

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

.lx-btn--secondary {
  background: var(--lx-card);
  border-color: var(--lx-input-border);
  color: var(--lx-text);
}

.lx-btn--quiet {
  background: transparent;
  color: var(--lx-brand);
}

.lx-btn--danger {
  background: var(--lx-status-red);
  border-color: var(--lx-status-red);
  color: var(--lx-on-brand);
}

.lx-btn--small {
  min-height: var(--lx-control-table);
  padding: 0 var(--lx-space-3);
}

.lx-label {
  display: block;
  margin-bottom: var(--lx-space-1);
  color: var(--lx-text);
  font-size: var(--lx-fs-label);
  font-weight: var(--lx-weight-medium);
}

.lx-label .lx-star {
  color: var(--lx-status-red);
}

.lx-input,
.lx-select {
  width: 100%;
  min-height: var(--lx-control);
  padding: 0 var(--lx-space-3);
  border: 1px solid var(--lx-input-border);
  border-radius: var(--lx-radius-control);
  background: var(--lx-card);
  color: var(--lx-text);
  font-family: var(--lx-font);
  font-size: var(--lx-fs-body);
  font-variant-numeric: var(--lx-figures);
}

.lx-input::placeholder {
  color: var(--lx-muted);
}

.lx-input:focus,
.lx-select:focus {
  outline: none;
  border-color: var(--lx-brand);
  box-shadow: var(--lx-ring);
}

.lx-input[aria-invalid="true"],
.lx-select[aria-invalid="true"] {
  border-color: var(--lx-status-red);
}

.lx-input[readonly],
.lx-input:disabled,
.lx-select:disabled {
  background: var(--lx-locked);
  color: var(--lx-text-secondary);
}

.lx-error {
  margin-top: var(--lx-space-1);
  color: var(--lx-status-red);
  font-size: var(--lx-fs-small);
}

.lx-seg {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--lx-input-border);
  border-radius: var(--lx-radius-control);
  background: var(--lx-card);
}

.lx-seg label {
  display: inline-flex;
  align-items: center;
  min-height: var(--lx-control-table);
  padding: 0 var(--lx-space-3);
  border-radius: var(--lx-radius-control);
  color: var(--lx-text-secondary);
  font-size: var(--lx-fs-body);
  font-weight: var(--lx-weight-medium);
  cursor: pointer;
}

.lx-seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.lx-seg label:has(input:checked) {
  background: var(--lx-brand-tint);
  color: var(--lx-brand);
}

.lx-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--lx-space-2);
  min-height: var(--lx-control);
  font-size: var(--lx-fs-body);
  cursor: pointer;
}

.lx-switch input {
  appearance: none;
  position: relative;
  width: var(--lx-space-8);
  height: var(--lx-space-4);
  margin: 0;
  border-radius: var(--lx-radius-round);
  background: var(--lx-input-border);
  cursor: pointer;
}

.lx-switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: var(--lx-space-3);
  height: var(--lx-space-3);
  border-radius: var(--lx-radius-round);
  background: var(--lx-card);
}

.lx-switch input:checked {
  background: var(--lx-brand);
}

.lx-switch input:checked::after {
  left: auto;
  right: 2px;
}

.lx-tick {
  display: inline-flex;
  align-items: center;
  gap: var(--lx-space-2);
  min-height: var(--lx-control);
  font-size: var(--lx-fs-body);
}

.lx-tick input {
  width: var(--lx-space-4);
  height: var(--lx-space-4);
  accent-color: var(--lx-brand);
}

.lx-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--lx-space-1);
  padding: 2px var(--lx-space-2);
  border-radius: var(--lx-radius-round);
  font-size: var(--lx-fs-small);
  font-weight: var(--lx-weight-medium);
  white-space: nowrap;
}

.lx-tag--green {
  background: var(--lx-status-green-tint);
  color: var(--lx-status-green);
}

.lx-tag--amber {
  background: var(--lx-status-amber-tint);
  color: var(--lx-status-amber);
}

.lx-tag--red {
  background: var(--lx-status-red-tint);
  color: var(--lx-status-red);
}

.lx-tag--blue {
  background: var(--lx-status-blue-tint);
  color: var(--lx-status-blue);
}

.lx-tag--grey {
  background: var(--lx-status-grey-tint);
  color: var(--lx-status-grey);
}

.lx-tabs {
  display: flex;
  gap: var(--lx-space-6);
  border-bottom: 1px solid var(--lx-line);
}

.lx-tabs a {
  display: inline-flex;
  align-items: center;
  gap: var(--lx-space-2);
  min-height: var(--lx-control);
  border-bottom: 2px solid transparent;
  color: var(--lx-text-secondary);
  font-size: var(--lx-fs-body);
  font-weight: var(--lx-weight-medium);
  text-decoration: none;
}

.lx-tabs a[aria-current="page"] {
  border-bottom-color: var(--lx-brand);
  color: var(--lx-brand);
}

.lx-card {
  padding: var(--lx-space-6);
  border: 1px solid var(--lx-line);
  border-radius: var(--lx-radius-card);
  background: var(--lx-card);
}

.lx-card + .lx-card {
  margin-top: var(--lx-space-4);
}

.lx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--lx-fs-body);
  font-variant-numeric: var(--lx-figures);
}

.lx-table th {
  padding: var(--lx-space-2) var(--lx-space-3);
  background: var(--lx-page);
  color: var(--lx-text-secondary);
  font-size: var(--lx-fs-small);
  font-weight: var(--lx-weight-medium);
  letter-spacing: var(--lx-letter-caps);
  text-align: left;
  text-transform: uppercase;
}

.lx-table td {
  height: var(--lx-row);
  padding: 0 var(--lx-space-3);
  border-bottom: 1px solid var(--lx-line);
}

.lx-table .lx-money {
  text-align: right;
  white-space: nowrap;
}

.lx-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--lx-space-3);
  min-height: var(--lx-top-bar);
}

.lx-page-head h1 {
  flex: 1 1 auto;
  margin: 0;
  color: var(--lx-text);
  font-size: var(--lx-fs-title);
  font-weight: var(--lx-weight-semibold);
}

.lx-area-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--lx-space-8);
  height: var(--lx-space-8);
  border-radius: var(--lx-radius-control);
}

.lx-area-icon svg {
  width: var(--lx-icon);
  height: var(--lx-icon);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.lx-section + .lx-section {
  margin-top: var(--lx-space-6);
}

.lx-section > h2 {
  margin: 0 0 var(--lx-space-3);
  color: var(--lx-text-secondary);
  font-size: var(--lx-fs-small);
  font-weight: var(--lx-weight-semibold);
  letter-spacing: var(--lx-letter-caps);
  text-transform: uppercase;
}

.lx-rows {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--lx-space-4) var(--lx-space-6);
}

.lx-rows > .lx-wide {
  grid-column: 1 / -1;
}

.lx-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--lx-space-3);
  padding: var(--lx-space-3) var(--lx-space-6);
  border-top: 1px solid var(--lx-line);
  background: var(--lx-card);
}

.lx-empty {
  padding: var(--lx-space-8) var(--lx-space-6);
  color: var(--lx-text-secondary);
  font-size: var(--lx-fs-body);
  text-align: center;
}

.lx-empty strong {
  display: block;
  margin-bottom: var(--lx-space-2);
  color: var(--lx-text);
  font-size: var(--lx-fs-heading);
  font-weight: var(--lx-weight-semibold);
}

/* The Style Board's own layout (mockup 01). */
.lx-style-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--lx-space-4);
  font-family: var(--lx-font);
  color: var(--lx-text);
}

.lx-board-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--lx-space-3);
  margin: 0 0 var(--lx-space-3);
}

.lx-swatch {
  display: inline-flex;
  align-items: center;
  gap: var(--lx-space-2);
  font-size: var(--lx-fs-small);
}

.lx-swatch-chip {
  display: inline-block;
  width: var(--lx-space-6);
  height: var(--lx-space-6);
  border: 1px solid var(--lx-line);
  border-radius: var(--lx-radius-control);
}

.lx-board-type {
  margin: 0 0 var(--lx-space-2);
  font-variant-numeric: var(--lx-figures);
}

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

  .lx-btn,
  .lx-input,
  .lx-select {
    min-height: var(--lx-touch);
  }

  .lx-rows {
    grid-template-columns: minmax(0, 1fr);
  }
}
/* C-349 parts end */

/* D-457b (D414): Employees → Salary Settings' + Add forms inside the card's padding (the list
   rows' 20px), in the forms' rows of three: Name, Map to a Ledger, the + Add button at the row's
   end; two a row from 768 px (the button on its own row, at its end), one on a phone. */
.salary-settings-list .head-add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px 24px;
  align-items: end;
  margin: 0;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--row-line);
}

.salary-settings-list .head-add-form > .section-title {
  grid-column: 1 / -1;
  margin: 0;
}

.salary-settings-list .head-add-form .field {
  margin: 0;
}

.salary-settings-list .head-add-form .form-buttons {
  justify-self: end;
  margin: 0;
}

.salary-settings-list .list-card-note {
  margin: 0;
  padding: 12px 20px;
}

@media (min-width: 768px) {
  .salary-settings-list .head-add-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .salary-settings-list .head-add-form .form-buttons {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1280px) {
  .salary-settings-list .head-add-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .salary-settings-list .head-add-form .form-buttons {
    grid-column: auto;
  }
}

/* E-577 (F3; C015 item 10, D469): the payment form's lower part (Payment Against · Invoice · Amount, then
   Paid From …) always starts its own row: a break across the whole row, of no height, its row gap taken
   back, so whatever comes first (Payment Against, or with the Advance switch on its box) starts the row. */
.form .entry-grid > .grid-break:is(#rr12, *) {
  grid-column: 1 / -1;
  height: 0;
  margin-top: calc(var(--lx-space-4) * -1);
}

/* E-577 (F4; mockup C015-02): the Advance switch's document fields together in one inset panel under the
   switch: Advance Against · Document No. · Document Date, then Expected By · Attach. */
.form .entry-grid .pi-contents > .pi-advance:not([hidden]):is(#rr12, *) {
  padding: var(--lx-space-4);
  margin-top: 0;
  background: var(--table-head);
  border: 1px solid var(--border);
  border-radius: var(--lx-radius-control);
}

/* E-577 (F10; mockup C015-04): the Add Vehicle (Meter, Connection, Number) pop-up: narrower, its two
   boxes side by side from 480 px, one above the other on a phone. */
.dialog.dialog-small {
  width: min(520px, calc(100vw - 24px));
}

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

@media (min-width: 480px) {
  .dialog-pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* E-578 (D476; CLAUDE.md rule 14): Pay Together's step 1 (its pop-up and its page). Full / Part side by
   side, no box drawn round them; the table's words never break inside (the Person / Firm column has
   room); below 768 px each due is a card, its labels from the cells' own data-label. */
.pt-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
}

.pt-amount-now {
  margin-bottom: 16px;
}

.pt-lines {
  width: 100%;
}

.pt-lines th,
.pt-lines td {
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  vertical-align: top;
}

.pt-lines td:first-child {
  min-width: 10rem;
}

.pt-lines input {
  width: 100%;
  min-width: 7rem;
  max-width: 10rem;
}

@media (max-width: 767px) {
  .pt-lines thead {
    display: none;
  }

  .pt-lines,
  .pt-lines tbody,
  .pt-lines tr,
  .pt-lines td {
    display: block;
    width: 100%;
  }

  .pt-lines tr {
    margin-bottom: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
  }

  .pt-lines td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    text-align: right;
  }

  .pt-lines td::before {
    flex: none;
    color: var(--text-secondary);
    text-align: left;
    content: attr(data-label);
  }

  .pt-lines td:first-child {
    min-width: 0;
    font-weight: 600;
  }

  .pt-lines input {
    max-width: 9rem;
  }
}

/* E-579 (D478; mockup C021-01): each reminder row's actions (Upload Statement · Snooze ▾ · Cancel)
   on one line from 1024 px; the column takes the width they need. */
@media (min-width: 1024px) {
  .reminders-table td.reminder-actions {
    flex-wrap: nowrap;
    min-width: max-content;
    white-space: nowrap;
  }
}

/* E-585, C024 K1: Select Company's list; on a phone each company is a card (rule 14: no word broken
   into letters), its label beside each value and Open across the card. */
@media (max-width: 767px) {
  .company-table thead {
    display: none;
  }

  .company-table,
  .company-table tbody {
    display: block;
    width: 100%;
  }

  .company-table tr {
    display: block;
    margin-bottom: 12px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    background: var(--card);
  }

  .company-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    border-bottom: 0;
    text-align: right;
    min-width: 0;
  }

  .company-table td[data-label]::before {
    content: attr(data-label);
    color: var(--text-secondary);
    text-align: left;
  }

  .company-table td.list-actions form,
  .company-table td.list-actions .btn {
    width: 100%;
  }
}


/* E-586, C024 K2: the company's name at the head of the menu opens Switch Company. */
.company-switch {
  position: relative;
  min-width: 0;
}

.company-switch > summary {
  list-style: none;
  cursor: pointer;
}

.company-switch > summary::-webkit-details-marker {
  display: none;
}

.company-switch-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  left: 0;
  width: 260px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  /* MC12 (C018's look check, C-358): the text token's shadow, as the row menu's panel */
  box-shadow: 0 8px 24px color-mix(in srgb, var(--lx-text) 12%, transparent);
}

.company-switch-title {
  margin: 0 0 8px;
  font-weight: 600;
}

.company-switch-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.company-switch-item {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 8px;
  text-align: left;
  background: none;
  border: 0;
  border-radius: var(--radius-small);
  cursor: pointer;
}

.company-switch-item:hover,
.company-switch-item.is-current {
  background: var(--table-head);
}

.company-switch-line {
  color: var(--text-secondary);
  font-size: 13px;
}

/* E-589, C024 K8: Delete Company's counts (what goes), three across; one column on a phone. */
.delete-counts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 16px;
}

.delete-counts > div {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
}

.delete-counts dt {
  color: var(--text-secondary);
  font-size: 13px;
}

.delete-counts dd {
  margin: 4px 0 0;
  font-size: 20px;
  font-weight: 600;
}

@media (max-width: 767px) {
  .delete-counts {
    grid-template-columns: 1fr;
  }
}

/* E-591 (C018 2.5, mockup 10; D500): Settings' cards: one link each, the area icon on its tint (40),
   the name (16 semibold) and one line (14, secondary). */
.settings-tile-link {
  display: flex;
  align-items: center;
  gap: var(--lx-space-4);
  color: inherit;
  text-decoration: none;
}

.settings-tile-link:hover h2,
.settings-tile-link:focus-visible h2 {
  color: var(--lx-brand);
}

.settings-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: var(--lx-control);
  height: var(--lx-control);
  border-radius: var(--lx-radius-control);
}

.settings-icon svg {
  width: var(--lx-icon);
  height: var(--lx-icon);
}

.settings-tile-text {
  display: flex;
  flex-direction: column;
  gap: var(--lx-space-1);
  min-width: 0;
}

.settings-card .settings-tile-text h2 {
  font-size: var(--lx-fs-heading);
  font-weight: var(--lx-weight-semibold);
}

.settings-card .settings-tile-text .settings-line {
  color: var(--lx-text-secondary);
  font-size: var(--lx-fs-body);
}

.settings-icon--settings {
  color: var(--lx-area-settings);
  background: var(--lx-area-settings-tint);
}

.settings-icon--assets {
  color: var(--lx-area-assets);
  background: var(--lx-area-assets-tint);
}

.settings-icon--statements {
  color: var(--lx-area-statements);
  background: var(--lx-area-statements-tint);
}

.settings-icon--billing {
  color: var(--lx-area-billing);
  background: var(--lx-area-billing-tint);
}

.settings-icon--employees {
  color: var(--lx-area-employees);
  background: var(--lx-area-employees-tint);
}

.settings-icon--payments {
  color: var(--lx-area-payments);
  background: var(--lx-area-payments-tint);
}

/* B-274, C024 K3 (section 2): "Company", its building icon in Home's blue in the menu and on its
   page; the list of the person's companies (a table on a computer, a card each below 768 px). */
.menu-item[href="/company/"] .icon {
  color: var(--lx-area-company);
}

.company-name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.company-icon {
  background: var(--lx-area-company-tint);
  color: var(--lx-area-company);
}

.company-table tr.is-current td {
  background: var(--lx-area-company-tint);
}

.company-actions {
  text-align: right;
  white-space: nowrap;
}

.company-actions .btn + .btn,
.company-actions .inline-form + .btn {
  margin-left: 8px;
}

@media (max-width: 767px) {
  .company-actions {
    text-align: left;
    white-space: normal;
  }
}

/* B-276, C024 K9 (section 3): the company named at the top of the payment slip and of a batch's
   list of payees, as on the vouchers. */
.slip-firm, .payees-firm {
  margin: 0 0 4px;
  font-weight: 700;
  font-size: var(--lx-fs-heading);
}

/* C-358 area tints and menu groups (C018 1.1, 2.1, mockup 02): each area's icon on its tint, in the menu, beside the
   page title and on Home; the menu in groups (Money, Dues and Loans, Books; Settings at the foot). */
.lx-area--home {
  color: var(--lx-area-home);
  background: var(--lx-area-home-tint);
}

.lx-area--payments {
  color: var(--lx-area-payments);
  background: var(--lx-area-payments-tint);
}

.settings-icon--backup {
  color: var(--lx-area-backup);
  background: var(--lx-area-backup-tint);
}

.settings-icon--payment-due {
  color: var(--lx-area-payment-due);
  background: var(--lx-area-payment-due-tint);
}

.lx-area--receipts {
  color: var(--lx-area-receipts);
  background: var(--lx-area-receipts-tint);
}

.lx-area--contra {
  color: var(--lx-area-contra);
  background: var(--lx-area-contra-tint);
}

.lx-area--receipt-due {
  color: var(--lx-area-receipt-due);
  background: var(--lx-area-receipt-due-tint);
}

.lx-area--payment-due {
  color: var(--lx-area-payment-due);
  background: var(--lx-area-payment-due-tint);
}

/* E-591 (mockup 07; C022 section 3): the loan page's five tiles in one row from 1280 px. */
@media (min-width: 1280px) {
  .stat-row.loans-totals {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.lx-area--loans {
  color: var(--lx-area-loans);
  background: var(--lx-area-loans-tint);
}

.lx-area--accounts {
  color: var(--lx-area-accounts);
  background: var(--lx-area-accounts-tint);
}

.lx-area--employees {
  color: var(--lx-area-employees);
  background: var(--lx-area-employees-tint);
}

.lx-area--statements {
  color: var(--lx-area-statements);
  background: var(--lx-area-statements-tint);
}

.lx-area--reminders {
  color: var(--lx-area-reminders);
  background: var(--lx-area-reminders-tint);
}

.lx-area--accountant {
  color: var(--lx-area-accountant);
  background: var(--lx-area-accountant-tint);
}

.lx-area--settings {
  color: var(--lx-area-settings);
  background: var(--lx-area-settings-tint);
}

.lx-area--billing {
  color: var(--lx-area-billing);
  background: var(--lx-area-billing-tint);
}

.lx-area--stock {
  color: var(--lx-area-stock);
  background: var(--lx-area-stock-tint);
}

.lx-area--assets {
  color: var(--lx-area-assets);
  background: var(--lx-area-assets-tint);
}

.lx-area--backup {
  color: var(--lx-area-backup);
  background: var(--lx-area-backup-tint);
}

.menu-group {
  display: flex;
  flex-direction: column;
  gap: var(--lx-space-1);
}

.menu-group + .menu-group {
  margin-top: var(--lx-space-1); /* E-613, C037: single lines, no headings between them */
}

/* E-613, C037 section 2: the two folding groups: the name a button (as an item, ▾ / ▸ at its right),
   its items listed under it, a little in. */
.menu-group-items {
  display: flex;
  flex-direction: column;
  gap: var(--lx-space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.menu-group-items[hidden] {
  display: none;
}

/* D-507 (the Owner, 23:45 IST): the left bar's group items aligned with the other buttons; only More's
   list keeps its indent */
.more-menu .menu-group-folds .menu-group-items {
  padding-left: var(--lx-space-3);
}

/* D-507: a group's heading lit while the open page is inside its shut group; a short smooth open
   and close (none with reduced motion, below) */
.menu-fold-active,
.menu-fold-active:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.side-menu .menu-group-items:not([hidden]) {
  animation: menu-open 160ms ease-out;
}

.side-menu .menu-group-items.menu-closing {
  opacity: 0;
  transition: opacity 160ms ease-in;
}

@keyframes menu-open {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .side-menu .menu-group-items:not([hidden]),
  .side-menu .menu-group-items.menu-closing {
    animation: none;
    transition: none;
  }
}

.menu-fold-form {
  margin: 0;
}

.menu-fold {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--lx-space-3);
  width: 100%;
  min-height: var(--lx-control);
  padding: 0 var(--lx-space-3);
  border: 0;
  border-radius: var(--radius-small);
  background: var(--card);
  color: var(--text-secondary);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.menu-fold:hover,
.menu-fold:focus-visible {
  background: var(--primary-soft);
  color: var(--primary);
}

.menu-fold-mark {
  color: var(--lx-muted);
}

.menu-group-foot {
  margin-top: auto;
  padding-top: var(--lx-space-4);
}

.menu-group-head {
  margin: 0 0 var(--lx-space-1);
  padding: 0 var(--lx-space-3);
  color: var(--lx-muted);
  font-size: var(--lx-fs-small);
  font-weight: var(--lx-weight-semibold);
  letter-spacing: var(--lx-letter-caps);
  text-transform: uppercase;
}

.menu-item .lx-area-icon {
  flex: 0 0 auto;
}

.menu-item-active .lx-area-icon {
  background: var(--lx-card);
}

.top-title-row {
  display: flex;
  align-items: center;
  gap: var(--lx-space-3);
  min-width: 0;
}

.top-title-row .lx-area-icon {
  flex: 0 0 auto;
  width: var(--lx-control);
  height: var(--lx-control);
}

/* C-358 (the geometry check at 1920, 1440, 1093, 768, 390): the title never broken beside the
   buttons; Home's recent rows stacked until there is room; a due card's money line wraps between its
   amounts (each amount kept whole). */
@media (max-width: 1092px) {
  .top-title-row .lx-area-icon {
    display: none;
  }
}

@media (min-width: 1093px) {
  .top {
    grid-template-columns: max-content minmax(0, 1fr) auto;
  }

  .top-buttons {
    justify-content: flex-end;
  }
}

@media (min-width: 768px) and (max-width: 1092px) {
  .home-recent {
    display: block;
  }

  .home-recent > .recent-row {
    display: flex;
    flex-wrap: wrap;
  }

  .home-recent .recent-what {
    flex-basis: calc(100% - var(--lx-touch));
  }

  .home-recent .recent-tag {
    margin-left: var(--lx-touch);
  }

  .home-recent .recent-amount {
    margin-left: auto;
  }
}

.due-card-line.money {
  white-space: normal;
}

/* E-592 (the geometry check): a loan's title is long ("<party> · <loan name>") and it has up to eight
   buttons: from 1093 px the title and the bell / user take the first row, the buttons their own row under
   it (wrapping, the Main one last), so the title never runs under them; it wraps at its spaces only. */
@media (min-width: 1093px) {
  .loan-page-body .top {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "title actions" "buttons buttons";
  }

  .loan-page-body .top-title {
    grid-area: title;
  }

  .loan-page-body .top-actions {
    grid-area: actions;
  }

  .loan-page-body .top-buttons {
    grid-area: buttons;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

/* E-592 (mockup 07): the loan page's tabs above its sections, and its alerts in rows of three. */
.loan-tabs {
  margin: var(--lx-space-4) 0 var(--lx-space-2);
}

.loan-alert-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--lx-space-4);
  margin: 0;
}

.loan-alert-list dt {
  color: var(--lx-text-secondary);
  font-size: var(--lx-fs-label);
}

.loan-alert-list dd {
  margin: var(--lx-space-1) 0 0;
  font-weight: var(--lx-weight-semibold);
}

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

/* E-593 (C018 2.3, the list pattern): on the Loans list, the tabs with their counts and the filter row
   keep the card's inner room (the card itself has none, for its table). */
.list-card > .loans-tabs {
  padding: 0 var(--lx-space-4);
}

.list-card > .loans-toolbar {
  padding: 0 var(--lx-space-4);
}

/* E-600, C034 sections 1 and 2 (D526): the Receipt form in three columns, the rows of section 1,
   each cell in its own column so a box that does not apply leaves its place and the rows stay; the
   roomier spacing (mockup version 2): the row gap one step larger than the other forms' (24 for 16).
   On a phone the cells stack in the same order. Optional boxes: a light see-through tint (never the
   word); required labels keep the red star. The Payment form keeps its own rules (the hold, D523). */
:root {
  --field-optional-bg: color-mix(in srgb, var(--primary) 5%, transparent);
}

.c034-grid {
  gap: var(--lx-space-6);
}

.c034-stack {
  display: flex;
  flex-direction: column;
  gap: var(--lx-space-4);
  min-width: 0;
}

.c034-stack > .cell-against-item:not(:has(*)) {
  display: none;
}

.c034-grid > .cell-reason,
.c034-grid > .c034-full {
  grid-column: 1 / -1;
}

.c034-grid .cell-files .drop-title {
  display: none;
}

.c034-grid .is-tinted :is(input:not([type="checkbox"], [type="radio"], [type="hidden"]), select,
  textarea, .money-box, .drop-zone) {
  background-color: var(--field-optional-bg);
}

.c034-grid .is-tinted .money-box input {
  background-color: transparent;
}

@media (min-width: 768px) {
  .c034-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .c034-grid .c034-c1 {
    grid-column: 1;
  }

  .c034-grid .c034-c2 {
    grid-column: 2;
  }

  .c034-grid .c034-c3 {
    grid-column: 3;
  }
}

/* E-601, C034 section 5 (D529): "Paid by Someone Else" under Person / Firm; ticked, its two boxes and
   the grey line under it, in the left column. */
.paid-by-c034 {
  display: flex;
  flex-direction: column;
  gap: var(--lx-space-3);
}

.c034-paid-by-fields:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: var(--lx-space-4);
}

.c034-paid-by-line:empty {
  display: none;
}

/* E-601, C034 section 5: the receipt voucher's disclaimer (screen, print and PDF) */
.voucher-disclaimer {
  margin: var(--lx-space-3) 0 0;
  font-size: var(--lx-fs-small);
  line-height: 1.5;
}

/* P7B (D639; 7d sections 4 and 5): the Payment form's two ticks in one row above Narration (one
   above the other on a phone), and the voucher's line for each tick. */
.payment-ticks {
  display: flex;
  flex-direction: column;
  gap: var(--lx-space-4);
  min-width: 0;
}

/* PM9B (8b s1, s2): the two ticks and the toggle on one line (wrapping on a phone); one row of up
   to three boxes, a box not shown letting the next move left (one under another on a phone) */
.payment-ticks-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--lx-space-3) var(--lx-space-6);
  min-width: 0;
}

.payment-toggle {
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
}

.payment-toggle .segmented {
  max-width: 100%;
}

.payment-toggle .segmented label {
  min-width: 0;
  padding-top: var(--lx-space-2);
  padding-bottom: var(--lx-space-2);
  overflow-wrap: normal;
}

.payment-toggle .segmented label.is-off {
  background: var(--card);
  color: var(--text-secondary);
  cursor: not-allowed;
  opacity: 0.6;
}

.payment-names-row {
  display: grid;
  gap: var(--lx-space-4);
  min-width: 0;
}

.payment-ticks [hidden] {
  display: none;
}

@media (min-width: 768px) {
  .payment-names-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .payment-toggle .segmented {
    flex-direction: column;
  }

  .payment-toggle .segmented label + label {
    border-top: 1px solid var(--border);
    border-left: 0;
  }
}

/* PM9C (8b s4): On The Voucher, below Narration: Signatures and Print; the disclaimer's words
   read-only under Include Disclaimer */
.payment-on-voucher {
  display: flex;
  flex-direction: column;
  gap: var(--lx-space-4);
  min-width: 0;
}

.payment-on-voucher-title {
  margin: 0;
  font-size: var(--lx-fs-heading);
  font-weight: 600;
}

.payment-on-voucher .payment-signs,
.payment-on-voucher .payment-print {
  display: flex;
  flex-wrap: wrap;
  gap: var(--lx-space-3) var(--lx-space-6);
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.payment-on-voucher legend,
.payment-on-voucher .field-error {
  flex-basis: 100%;
  padding: 0;
}

.payment-on-voucher [hidden] {
  display: none;
}

.payment-disclaimer {
  flex-basis: 100%;
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--lx-fs-small);
  line-height: 1.5;
}

.voucher-tick-line {
  margin: var(--lx-space-3) 0 0;
  line-height: 1.5;
}

/* B-278, C025 P2 (section 2): Settings → Projects. A table on a computer, a card each on a phone
   (rule 14: the label beside each value, no word broken into letters); the form's Ledger shows only
   when "Map the whole project to one ledger?" is Yes. */
.project-description {
  display: block;
  color: var(--text-secondary);
  font-size: 0.9286rem;
}

.project-actions {
  text-align: right;
  white-space: nowrap;
}

.project-form .radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  min-height: 40px;
}

.project-form .radio-choice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.project-form fieldset.field {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.project-accounts .chip-choice {
  white-space: normal;
  overflow-wrap: anywhere;
  min-width: 0;
}

.project-form:has(input[name="maps"][value="no"]:checked) .project-ledger {
  display: none;
}

/* PM8A (8m1 Part A): the Capital Asset's sub-ledger name, only when Yes and an asset group is
   picked (the Ledger list's "new_asset:" choices) */
.project-form .project-asset-name {
  display: none;
}

.project-form:has(input[name="maps"][value="yes"]:checked):has(#id_maps_to option[value^="new_asset:"]:checked) .project-asset-name {
  display: block;
}

@media (max-width: 767px) {
  .project-table thead {
    display: none;
  }

  .project-table,
  .project-table tbody {
    display: block;
    width: 100%;
  }

  .project-table tr {
    display: block;
    margin-bottom: 12px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    background: var(--card);
  }

  .project-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    border-bottom: 0;
    text-align: right;
    min-width: 0;
    overflow-wrap: break-word;
  }

  .project-table td[data-label]::before {
    content: attr(data-label);
    flex: none;
    color: var(--text-secondary);
    text-align: left;
  }

  .project-actions {
    text-align: left;
    white-space: normal;
  }
}

/* B-278: on a phone the top bar's buttons are hidden; New Project above the list instead. */
.project-phone-new {
  margin: 0 0 12px;
}

.project-name {
  display: block;
  min-width: 0;
}

/* B-281, C025 P5 (section 4): the projects switcher under the company's name (and in the phone's
   top bar): its choice on a quiet button, the panel as Switch Company's. */
.project-switch {
  position: relative;
  min-width: 0;
  margin: 0 12px 12px;
}

/* B-282: on a phone the switcher is a full-width bar at the top of the page (the top bar has no
   room beside the title: a project's name was cut there, rule 14) */
.project-switch-row .project-switch {
  margin: 0 0 12px;
}

.project-switch-row .project-switch > summary {
  justify-content: space-between;
}

.project-switch-row .project-switch-label {
  white-space: normal;
}

.project-switch-row .project-switch-panel {
  width: 100%;
  max-width: none;
}

.project-switch > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--card);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.project-switch > summary::-webkit-details-marker {
  display: none;
}

.project-switch-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-switch-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  left: 0;
  width: 260px;
  max-width: calc(100vw - 24px);
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--lx-text) 12%, transparent);
}

.phone-top .project-switch-panel {
  right: 0;
  left: auto;
}

.project-switch-title {
  margin: 8px 0 6px;
  color: var(--text-secondary);
  font-weight: 600;
}

.project-switch-quick {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.project-switch-choice {
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius-small);
  background: none;
  text-align: left;
  cursor: pointer;
}

.project-switch-choice.is-chosen,
.project-switch-choice:hover {
  background: var(--lx-brand-tint);
}

.project-switch-choice.is-chosen {
  font-weight: 600;
}

.project-switch-pick {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  border: 0;
}

/* B-283, C025 P8: Edit · Close / Reopen side by side on a project's line */
.project-actions .btn,
.project-actions .inline-form {
  vertical-align: middle;
}

.project-actions .inline-form {
  display: inline-block;
  margin: 0;
}

/* B-283a, C033 section 1: the project's own accounts only when it keeps its own accounts */
.project-form:has(input[name="keeps"][value="no"]:checked) .project-accounts {
  display: none;
}

.project-keeps {
  margin-bottom: 12px;
}

/* B-283d (B-281's Project column): from 1280 px Party (160 px) and Narration (200 px) keep their
   room; with the Project column the list was 3 px wider than the page at 1440 (the geometry check):
   Narration gives a little, the project's name wraps between its words. */
@media (min-width: 1280px) {
  .table-card .entries-table:has(.en-project) .en-narration {
    min-width: 150px;
  }
}

.entries-table .en-project {
  min-width: 0;
  white-space: normal;
}

/* B-286, C032 H3 (sections 2, 3, 5, 8): Laxmi Help. The round button bottom right (on a phone just
   above the bottom bar, never covering it); the window a 380 px panel bottom right on a computer
   (up to 70 % of the height, the page usable beside it), full screen with a back arrow on a phone.
   C018 tokens; --primary follows the Blue / Maroon theme. */
.help-button {
  position: fixed;
  right: var(--lx-space-4);
  bottom: var(--lx-space-4);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: 600 var(--lx-fs-small) var(--lx-font);
  cursor: pointer;
}

.help-button img {
  width: 56px;
  height: 56px;
  border: 2px solid var(--card);
  border-radius: var(--lx-radius-round);
  box-shadow: 0 4px 12px rgb(16 24 40 / 18%);
  background: var(--primary-soft);
}

.help-button-label {
  padding: 0 var(--lx-space-2);
  border-radius: var(--lx-radius-round);
  background: var(--primary);
  color: var(--on-primary);
  line-height: 18px;
}

.help-button:focus-visible img {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.help-window {
  position: fixed;
  right: var(--lx-space-4);
  bottom: calc(var(--lx-space-4) + 84px);
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: 380px;
  max-width: calc(100vw - 2 * var(--lx-space-4));
  height: min(560px, 70vh);
  max-height: 70vh;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--lx-radius-card);
  background: var(--card);
  box-shadow: 0 12px 32px rgb(16 24 40 / 20%);
  color: var(--text);
  font-family: var(--lx-font);
  font-size: var(--lx-fs-body);
}

.help-window[hidden] {
  display: none;
}

.help-head {
  display: flex;
  align-items: center;
  gap: var(--lx-space-2);
  padding: var(--lx-space-3);
  border-bottom: 1px solid var(--border);
  background: var(--primary);
  color: var(--on-primary);
}

.help-face {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: var(--lx-radius-round);
  background: var(--card);
}

.help-title {
  flex: 1;
  min-width: 0;
}

.help-title p {
  margin: 0;
}

.help-name {
  font-size: var(--lx-fs-heading);
  font-weight: 600;
  overflow-wrap: normal;
}

.help-sub {
  font-size: var(--lx-fs-small);
  opacity: 0.85;
}

.help-back,
.help-close,
.help-about summary {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: var(--lx-touch);
  height: var(--lx-touch);
  padding: 0;
  border: 0;
  border-radius: var(--lx-radius-control);
  background: none;
  color: inherit;
  cursor: pointer;
  list-style: none;
}

.help-about summary::-webkit-details-marker {
  display: none;
}

.help-back {
  display: none;
}

.help-back:hover,
.help-close:hover,
.help-about summary:hover {
  background: rgb(255 255 255 / 15%);
}

.help-about {
  position: static;
}

.help-about-panel {
  position: absolute;
  top: 68px;
  right: var(--lx-space-3);
  left: var(--lx-space-3);
  z-index: 2;
  padding: var(--lx-space-3);
  border: 1px solid var(--border);
  border-radius: var(--lx-radius-control);
  background: var(--card);
  box-shadow: 0 8px 24px rgb(16 24 40 / 16%);
  color: var(--text);
}

.help-about-panel p {
  margin: 0;
}

.help-about-title {
  margin-bottom: var(--lx-space-2) !important;
  font-weight: 600;
}

.help-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--lx-space-3);
  background: var(--page);
}

.help-msg {
  display: flex;
  align-items: flex-start;
  gap: var(--lx-space-2);
  margin-bottom: var(--lx-space-3);
}

.help-msg-user {
  justify-content: flex-end;
}

.help-msg-face {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: var(--lx-radius-round);
}

.help-bubble {
  max-width: 85%;
  min-width: 0;
  padding: var(--lx-space-2) var(--lx-space-3);
  border: 1px solid var(--border);
  border-radius: var(--lx-radius-card);
  background: var(--card);
  overflow-wrap: break-word;
}

.help-msg-user .help-bubble {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--on-primary);
}

.help-bubble p,
.help-steps {
  margin: 0;
}

.help-steps {
  padding-left: 1.25em;
}

.help-steps li + li {
  margin-top: var(--lx-space-1);
}

.help-topics,
.help-lines {
  display: flex;
  flex-wrap: wrap;
  gap: var(--lx-space-2);
  margin-top: var(--lx-space-2);
}

.help-lines {
  flex-direction: column;
  align-items: stretch;
}

.help-chip,
.help-line {
  min-height: 36px;
  padding: var(--lx-space-1) var(--lx-space-3);
  border: 1px solid var(--primary-soft-border);
  border-radius: var(--lx-radius-round);
  background: var(--primary-soft);
  color: var(--primary);
  font: 500 var(--lx-fs-label) var(--lx-font);
  cursor: pointer;
}

.help-line {
  border-radius: var(--lx-radius-control);
  text-align: left;
}

.help-chip:hover,
.help-line:hover {
  border-color: var(--primary);
}

.help-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--lx-space-2);
  margin-top: var(--lx-space-3);
}

.help-go {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--on-primary);
  text-decoration: none;
}

.help-ask {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--lx-space-2);
}

.help-others-title {
  margin-top: var(--lx-space-3) !important;
  color: var(--muted);
  font-size: var(--lx-fs-small);
  font-weight: 600;
}

.help-dots {
  display: inline-flex;
  gap: 4px;
  padding: var(--lx-space-1) 0;
}

.help-dots span {
  width: 6px;
  height: 6px;
  border-radius: var(--lx-radius-round);
  background: var(--muted);
  animation: help-dot 0.9s infinite ease-in-out;
}

.help-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.help-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes help-dot {
  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .help-dots span {
    animation: none;
  }
}

.help-input {
  display: flex;
  gap: var(--lx-space-2);
  padding: var(--lx-space-3);
  border-top: 1px solid var(--border);
  background: var(--card);
}

.help-input input {
  flex: 1;
  min-width: 0;
  min-height: var(--lx-touch);
  padding: 0 var(--lx-space-3);
  border: 1px solid var(--lx-input-border);
  border-radius: var(--lx-radius-control);
  font: var(--lx-fs-body) var(--lx-font);
}

@media (max-width: 767px) {
  .help-button {
    right: var(--lx-space-3);
    bottom: calc(84px + env(safe-area-inset-bottom));
  }

  .help-button img {
    width: 48px;
    height: 48px;
  }

  .help-window {
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .help-back {
    display: inline-flex;
  }

  .help-close {
    display: none;
  }

  body.help-is-open {
    overflow: hidden;
  }

  body.help-is-open .help-button {
    display: none;
  }
}

/* B-287, C032 sections 9, 10: the Send your question box in the Help window; Settings → Laxmi Help. */
.help-send p {
  margin: 0 0 var(--lx-space-2);
}

.help-send-title {
  font-weight: 600;
}

.help-send-question {
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin-bottom: var(--lx-space-2);
  padding: var(--lx-space-2);
  border: 1px solid var(--lx-input-border);
  border-radius: var(--lx-radius-control);
  font: var(--lx-fs-body) var(--lx-font);
  resize: vertical;
}

.help-send-error {
  color: var(--money-out);
}

.help-send-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--lx-space-2);
}

.help-forward {
  margin-top: var(--lx-space-2);
}

.help-settings-version {
  margin: var(--lx-space-4) 0 0;
  color: var(--text-secondary);
}

/* C-361 (C028 section 6): the console's own frame, on the tokens: Laxmi Console and the console user, then one card. */
.console {
  background: var(--lx-page);
  color: var(--lx-text);
  font-family: var(--lx-font);
  font-size: var(--lx-fs-body);
}

.console-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--lx-space-3);
  min-height: var(--lx-top-bar);
  padding: 0 var(--lx-space-6);
  border-bottom: 1px solid var(--lx-line);
  background: var(--lx-card);
}

.console-brand {
  margin: 0;
  font-size: var(--lx-fs-heading);
  font-weight: var(--lx-weight-semibold);
}

.console-who {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--lx-space-3);
  color: var(--lx-text-secondary);
}

.console-main {
  max-width: calc(var(--lx-space-8) * 30);
  margin: 0 auto;
  padding: var(--lx-space-6) var(--lx-space-4);
}

.console-title {
  margin: 0 0 var(--lx-space-4);
  font-size: var(--lx-fs-title);
  font-weight: var(--lx-weight-semibold);
}

.console-form {
  display: flex;
  flex-direction: column;
  gap: var(--lx-space-2);
  max-width: calc(var(--lx-space-8) * 14);
}

.console-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--lx-space-3);
  margin-top: var(--lx-space-4);
}

/* C-364 (C028 SA4, section 3): the Accounts list and an account's page, on the tokens; details in rows of three,
   each list row a card below 768 px. */
.console-card {
  padding: 0;
  overflow: hidden;
}

.console-counted {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--lx-space-3);
  padding: var(--lx-space-3) var(--lx-space-6);
  border-bottom: 1px solid var(--lx-line);
  color: var(--lx-text-secondary);
}

/* C-389, C039 s7 (BM6; mockup M-11): the account's "Billing for this account": Billing always on, the POS switch
   off and greyed (disabled) with its tag; each row wraps on a phone. */
.console-billing {
  margin: var(--lx-space-4) 0 0;
}

.console-billing-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--lx-space-2) var(--lx-space-3);
  padding: var(--lx-space-3) 0;
  border-bottom: 1px solid var(--lx-line);
}

.console-billing-mark {
  color: var(--lx-status-green);
  flex: none;
}

.console-billing-name {
  font-weight: var(--lx-weight-medium);
}

.console-switch {
  appearance: none;
  flex: none;
  width: calc(var(--lx-space-8) + var(--lx-space-2));
  height: var(--lx-icon);
  margin: 0;
  border-radius: var(--lx-radius-round);
  background: var(--lx-status-grey-tint);
  position: relative;
}

.console-switch::after {
  content: "";
  position: absolute;
  top: calc(var(--lx-space-1) / 2);
  left: calc(var(--lx-space-1) / 2);
  width: calc(var(--lx-icon) - var(--lx-space-1));
  height: calc(var(--lx-icon) - var(--lx-space-1));
  border-radius: var(--lx-radius-round);
  background: var(--lx-card);
}

.console-switch:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.console-heading {
  margin: 0;
  color: var(--lx-text);
  font-size: var(--lx-fs-heading);
  font-weight: var(--lx-weight-semibold);
}

.console-crumbs {
  margin: 0 0 var(--lx-space-2);
  color: var(--lx-text-secondary);
  font-size: var(--lx-fs-label);
}

.console-details {
  margin: 0;
}

.console-details dt {
  color: var(--lx-text-secondary);
  font-size: var(--lx-fs-label);
}

.console-details dd {
  margin: var(--lx-space-1) 0 0;
}

.console-email {
  overflow-wrap: break-word;
}

/* C-365 (C028 SA6): Reset Password's form and the one-time password shown once. */
.console-form--wide {
  max-width: calc(var(--lx-space-8) * 18);
}

.console-holder {
  margin: 0 0 var(--lx-space-2);
}

/* C-368 (C028 SA12): the console's menu (only what the role may) and the authenticator key, which may wrap at
   390 px (32 characters; never one letter a line at this size). */
.console-menu {
  display: flex;
  flex-wrap: wrap;
  gap: var(--lx-space-4);
  font-weight: var(--lx-weight-medium);
}

/* C-370 (C028 SA5): the list's two buttons side by side; a line inside a card's own padding. */
.console-buttons--inline {
  margin-top: 0;
}

.console-pad {
  padding: var(--lx-space-3) var(--lx-space-6) 0;
}

.console-otp.console-key {
  white-space: normal;
  overflow-wrap: anywhere;
}

.console-otp {
  font-size: var(--lx-fs-figure);
  font-variant-numeric: var(--lx-figures);
  letter-spacing: var(--lx-letter-caps);
  white-space: nowrap;
}

.console-table td:first-child,
.console-table th:first-child {
  padding-left: var(--lx-space-6);
}

@media (max-width: 767px) {
  .console-table thead {
    display: none;
  }

  .console-table,
  .console-table tbody,
  .console-table tr {
    display: block;
  }

  .console-table tr {
    padding: var(--lx-space-3) var(--lx-space-4);
    border-bottom: 1px solid var(--lx-line);
  }

  .console-table td,
  .console-table td:first-child {
    display: grid;
    grid-template-columns: calc(var(--lx-space-8) * 4) minmax(0, 1fr);
    gap: var(--lx-space-2);
    height: auto;
    padding: var(--lx-space-1) 0;
    border-bottom: 0;
  }

  .console-table td[data-label]::before {
    content: attr(data-label);
    color: var(--lx-text-secondary);
  }

  .console-counted {
    padding: var(--lx-space-3) var(--lx-space-4);
  }
}

/* B-289, C028 SA10 (4.7): a notice from Trinetra on Home's Needs Attention and in the bell: its words
   (wrapping between words), then Snooze and Dismiss; on a phone the buttons go under the words. */
.notice-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--lx-space-2);
  padding: var(--lx-space-1) 0;
}

.notice-line-text {
  flex: 1 1 200px;
  min-width: 0;
  font-weight: 600;
  overflow-wrap: normal;
}

.notice-line-buttons {
  display: flex;
  flex: none;
  gap: var(--lx-space-2);
}

.notice-line-buttons form {
  margin: 0;
}

.bell-notice {
  padding: var(--lx-space-2) var(--lx-space-3);
}

/* B-294, C031 PR6: a Person / Firm dropdown's Edit: a small pencil at the right of each name and
   inside the box for the chosen one (only for "Add People and Firms"). */
.combo-edit,
.combo-edit-chosen {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--lx-radius-control);
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.combo-edit:hover,
.combo-edit-chosen:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.combo-edit-chosen {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
}

.combo-edit-chosen[hidden] {
  display: none;
}

.combo:has(.combo-edit-chosen:not([hidden])) .combo-input {
  /* C-383 (C018's look check, C-358): the 40px room for the pencil from the tokens */
  padding-right: calc(var(--lx-space-8) + var(--lx-space-2));
}

/* B-291, C026 P4: a partner's statement: each account's figures in a row of three (wrapping), then
   its entries (a table on a computer, a card per entry on a phone, as the other statements). */
.partner-figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--lx-space-2) var(--lx-space-4);
  margin: 0 0 var(--lx-space-3);
  padding: var(--lx-space-3) var(--lx-space-4) 0;
}

.partner-figures div {
  min-width: 0;
}

.partner-figures dt {
  color: var(--text-secondary);
  font-size: var(--lx-fs-label);
}

.partner-figures dd {
  margin: 0;
  font-weight: 600;
  white-space: nowrap;
}

.partner-statement-title {
  margin-top: var(--lx-space-6);
}

/* B-290, C028 SA15: the console's Direct Access page (the Owner's): a table on a computer, a card
   per line on a phone; a statement wraps inside its cell, never sideways. */
.console-back,
.console-links {
  margin: 0 0 var(--lx-space-4);
}

.console-links {
  margin-top: var(--lx-space-4);
}

.access-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--lx-fs-body);
}

.access-table th,
.access-table td {
  padding: var(--lx-space-2) var(--lx-space-3);
  border-bottom: 1px solid var(--lx-line);
  text-align: left;
  vertical-align: top;
}

.access-table th {
  color: var(--lx-text-secondary);
  font-size: var(--lx-fs-label);
  font-weight: 600;
  white-space: nowrap;
}

.access-table td:nth-child(-n + 4) {
  white-space: nowrap; /* a time, a kind, a name, an address never break inside */
}

.access-table td:last-child {
  width: 100%;
}

.access-what {
  overflow-wrap: anywhere;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: var(--lx-fs-label);
}

@media (max-width: 767px) {
  .access-table thead {
    display: none;
  }

  .access-table,
  .access-table tbody,
  .access-table tr,
  .access-table td {
    display: block;
    width: 100%;
  }

  .access-table tr {
    padding: var(--lx-space-2) 0;
    border-bottom: 1px solid var(--lx-line);
  }

  .access-table td {
    display: flex;
    gap: var(--lx-space-2);
    padding: var(--lx-space-1) 0;
    border: 0;
  }

  .access-table td::before {
    content: attr(data-label);
    flex: 0 0 72px;
    color: var(--lx-text-secondary);
    font-family: var(--lx-font);
  }
}

/* D-483 (C027 sections 2, 3): "What are you buying?" and "What do you have in hand?": large cards,
   each with its plain test; one column on a phone. */
.purchase-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--lx-space-3);
}

.purchase-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 88px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  overflow-wrap: break-word;
}

.purchase-card strong {
  font-size: 1.05rem;
}

.purchase-card span {
  color: var(--text-secondary);
}

.supplier-line {
  margin: 6px 0 0;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

/* D-491 (C031 section 3): Settings → Party Types: each Work a row of its own (name, Rename, Hide);
   it wraps on a phone. */
.work-list {
  list-style: none;
  margin: var(--lx-space-3) 0;
  padding: 0;
}

.work-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--lx-space-2);
  margin-bottom: var(--lx-space-2);
}

/* D-492 (C030 section 4): the party's page by role: a box per role, rows of three on a wide
   screen, one column on a phone. */
.role-boxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--lx-space-3);
}

.role-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  overflow-wrap: break-word;
}

.role-box-active {
  border-color: var(--primary);
}

.role-box-name {
  color: var(--text-secondary);
}

.role-box-line {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.role-filter {
  margin: var(--lx-space-3) 0 0;
}

/* C-381 (C030 PR8 part 2): the box's head (its role's filter), its Work lines (each a filter), the
   Overall Position (his loans counted in, D517) and a "Role not chosen" row's Set Role. */
.role-box-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text);
  text-decoration: none;
}

.role-box-work.is-on {
  color: var(--primary);
  font-weight: 600;
}

.role-overall {
  margin: 0 0 var(--lx-space-3);
}

.set-role {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
}

.set-role select {
  min-width: 0;
  max-width: 100%;
}

/* B-300 (D521): the two-step code: the key (groups of four, wrapping only between groups), the
   backup codes in rows of two, the admins' list with Reset. */
.twostep-card {
  max-width: 560px;
}

.twostep-key {
  display: block;
  font-size: 18px;
  letter-spacing: 0.04em;
  word-spacing: 0.3em;
  overflow-wrap: normal;
  word-break: keep-all;
}

.twostep-backup-codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  margin: 12px 0 16px;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono, monospace);
  white-space: nowrap;
}

.twostep-backup {
  margin-top: 16px;
}

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

.twostep-admin {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.twostep-admin-name {
  flex: 1 1 160px;
  min-width: 0;
}

.twostep-admin-state {
  color: var(--text-secondary);
}

/* E-606, C034 section 7: Project, Row 0, full width before the date (only with an Active project). */
.c034-grid > .cell-project {
  grid-column: 1 / -1;
}

/* E-606, C034 section 1 (picture M-07): simple grey line icons only on the Receipt form; the clip of
   Attach a File loses its coloured square (the calendar, search and pencil are grey already). */
.c034-grid .drop-icon {
  background: none;
  color: var(--text-secondary);
}

/* E-607b, C035 (D548): Pay on a Payment Due's locked rows across the middle and right columns. */
@media (min-width: 768px) {
  .c034-grid .c034-span2 {
    grid-column: 2 / -1;
  }
}


/* E-614, C037 section 4: All Transactions' filters in one row from 768 px; its table (and Settlements', E-610)
   a card per row on a phone. */
.all-tx-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--lx-space-3);
  align-items: flex-end;
  margin-bottom: var(--lx-space-4);
  padding: var(--lx-space-3) var(--lx-space-4);
}

.all-tx-filters .field {
  min-width: 180px;
  margin: 0;
}

.all-tx-filters select {
  width: 100%;
}

@media (max-width: 767px) {
  .all-tx-table thead,
  .settlements-table thead {
    display: none;
  }

  .all-tx-table,
  .all-tx-table tbody,
  .all-tx-table tr,
  .settlements-table,
  .settlements-table tbody,
  .settlements-table tr {
    display: block;
  }

  .all-tx-table tr,
  .settlements-table tr {
    padding: 12px 16px;
    border-bottom: 1px solid var(--row-line);
  }

  .all-tx-table td,
  .settlements-table td {
    display: grid;
    grid-template-columns: 136px minmax(0, 1fr);
    gap: 8px;
    height: auto;
    min-height: 0;
    padding: 4px 0;
    border-bottom: 0;
    line-height: var(--lx-line-height);
    text-align: left;
  }

  .all-tx-table td::before,
  .settlements-table td::before {
    content: attr(data-label);
    color: var(--text-secondary);
    white-space: nowrap; /* "Party / Accounts" on one line (a word never breaks into letters) */
  }
}

/* E-615, C038 section 1 (pictures M-08 / M-09): "Activate Help": a grey line bulb and a switch; lit (amber) when
   on. */
.help-switch-form {
  margin: 0;
}

.help-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--lx-space-2);
  min-height: var(--lx-control);
  padding: 0 var(--lx-space-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--text-secondary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.help-switch .help-bulb {
  width: 18px;
  height: 18px;
  color: var(--lx-muted);
}

.help-switch-track {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--lx-line);
}

.help-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--card);
}

.help-switch.is-on {
  border-color: var(--lx-status-amber);
  background: var(--lx-status-amber-tint);
  color: var(--lx-status-amber);
}

.help-switch.is-on .help-bulb {
  color: var(--lx-status-amber);
}

.help-switch.is-on .help-switch-track {
  background: var(--lx-status-amber);
}

.help-switch.is-on .help-switch-knob {
  left: 16px;
}

.help-switch-compact .help-switch {
  min-height: var(--lx-touch);
  padding: 0 var(--lx-space-2);
}

/* E-615, C038 section 2: a mark takes no room (nothing moves or hides); its sparkle sits just after the
   item, in the lit colour. */
.help-mark {
  position: relative;
  display: inline-block;
  width: 0;
  height: 1em;
  vertical-align: top;
}

.help-mark-glyph {
  position: absolute;
  top: -2px;
  left: 4px;
  display: inline-flex;
  width: 14px;
  height: 14px;
  color: var(--lx-status-amber);
  cursor: pointer;
}

.help-mark-glyph svg {
  width: 14px;
  height: 14px;
}

/* E-616, C038 section 3: a mark's note: small, beside its mark (over the page, moving nothing). */
.help-note {
  position: absolute;
  z-index: 60;
  padding: var(--lx-space-3) var(--lx-space-4);
  border: 1px solid var(--lx-status-amber);
  border-radius: var(--radius-small);
  background: var(--card);
  box-shadow: 0 8px 24px rgb(16 24 40 / 14%);
  color: var(--text);
}

.help-note-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--lx-space-2);
}

.help-note-name {
  margin: 0;
  font-weight: 700;
}

.help-note-close {
  display: inline-flex;
  padding: 2px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.help-note-meaning {
  margin: var(--lx-space-2) 0;
}

.help-note-example {
  margin: 0 0 var(--lx-space-2);
  padding: var(--lx-space-2) var(--lx-space-3);
  border-radius: var(--radius-small);
  background: var(--lx-status-amber-tint);
  color: var(--lx-status-amber);
}

/* D-497, C039 s2 row 1 (and s4's Paid Now · Credit later): a choice of two as two cards (the C034
   look): the chosen card in the primary colour; on a phone the two stay side by side. */
.choice-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--lx-space-4);
  max-width: 480px;
}

.choice-card {
  display: flex;
  align-items: center;
  gap: var(--lx-space-2);
  min-width: 0;
  padding: var(--lx-space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--card);
  cursor: pointer;
}

.choice-card:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.invoice-no-given {
  color: var(--text-secondary);
}

.file-line {
  display: flex;
  align-items: center;
  gap: var(--lx-space-2);
  min-width: 0;
  color: var(--text-secondary);
}

.invoice-files li {
  display: flex;
  align-items: center;
  gap: var(--lx-space-2);
}

/* D-498, C039 s2.1: the Sale Invoice's lines: Item * · Qty * · Unit · Rate (₹) * · Disc % · GST % *
   · Amount (₹) · ✕, a row from 1024 px and a card below it (as the invoice lines); Description the
   small box under Item; "In stock" grey under Qty, amber when short; the totals on the right with
   the Total large. */
.invoice-line .line-description-box {
  margin-top: var(--lx-space-1);
}

.field-sublabel {
  display: block;
  margin-top: var(--lx-space-2);
  color: var(--lx-text-secondary);
  font-size: var(--lx-fs-small);
}

.line-stock {
  color: var(--lx-text-secondary);
  font-size: var(--lx-fs-small);
}

.line-stock.is-short {
  color: var(--lx-status-amber);
}

.line-stock:empty {
  display: none;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--lx-control);
  min-height: var(--lx-control);
  padding: 0;
  border: 0;
  border-radius: var(--lx-radius-control);
  background: none;
  color: var(--lx-text-secondary);
  cursor: pointer;
}

.icon-button:hover {
  color: var(--lx-text);
}

.icon-button:focus-visible {
  outline: 2px solid var(--lx-ring);
  outline-offset: 2px;
}

#invoice-totals {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.sale-totals {
  min-width: 0;
  max-width: 420px;
}

.invoice-total.is-large dt,
.invoice-total.is-large dd {
  font-size: var(--lx-fs-figure);
  font-weight: 700;
}

@media (min-width: 1024px) {
  .sale-lines-head,
  .sale-lines .invoice-line {
    grid-template-columns: 2.4fr 0.9fr 0.6fr 1fr 0.7fr 0.8fr 1fr auto;
  }

  .sale-lines-head.no-gst,
  .sale-lines.no-gst .invoice-line {
    grid-template-columns: 2.4fr 0.9fr 0.6fr 1fr 0.7fr 1fr auto;
  }
}

/* FX7 (D617): Settings → Expense / Income Heads: a main head's Sub-Heads under it, set in, with its
   "+ Add Sub-Head"; the same at phone width (no sideways scroll). */
.head-subs {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--lx-space-2) var(--lx-space-4);
  margin-left: var(--lx-space-6);
}

.head-sub-list {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text-secondary);
}

/* S7A (7f, D639): the Settlement screen (entries/settlement_c036.html). The Payment part and the
   Receipt part, each a box with its heading and its own background colour (the Payments and
   Receipts area tints); the colour is on the box, never on the fields, whose own light tint means
   "optional". The one line under the title. */
.c036-lead {
  color: var(--lx-text-secondary);
}

.c036-part {
  margin-top: var(--lx-space-6);
  padding: var(--lx-space-4) var(--lx-space-6) var(--lx-space-6);
  border: 1px solid var(--border);
  border-radius: var(--lx-radius-card);
}

.c036-part-payment {
  background-color: var(--lx-area-payments-tint);
}

.c036-part-receipt {
  background-color: var(--lx-area-receipts-tint);
}

.c036-part-title {
  margin: 0 0 var(--lx-space-4);
}

.c036-part :is(input:not([type="checkbox"], [type="radio"], [type="hidden"]), select, textarea,
  .money-box) {
  background-color: var(--card);
}

.c036-part + .c034-grid {
  margin-top: var(--lx-space-6);
}

@media (max-width: 767px) {
  .c036-part {
    padding: var(--lx-space-3) var(--lx-space-4) var(--lx-space-4);
  }
}
