/* Data-first review workspace polish.  This comes last so it can refine the
   legacy-inspired shell without changing any of the application behaviour. */
:root {
  --ink: #1f2933;
  --link: #1f5f82;
  --line: #d8e0e5;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #245a70;
}
.engine-frame { width: min(1240px, calc(100% - 32px)); }
.engine-body { grid-template-columns: 196px minmax(0, 1fr); }
.engine-content { padding: 38px 42px 58px; }
.content-title h1 { font-size: 31px; margin-bottom: 7px; }
.content-title > div > p:last-child { font-size: 14px; }
.content-rule { margin: 23px 0 26px; }

/* Keep the train as a small brand accent, not the main event. */
.engine-masthead { height: 118px; }
.masthead-copy { width: 44%; min-width: 310px; padding: 18px 34px; }
.masthead-copy strong { font-size: 39px; }
.masthead-subtitle { font-size: 10px; }
.masthead-tags { margin-top: 10px; }
.masthead-art { width: min(65%, 760px); }

.customer-list-card,
.customer-detail-card {
  border: 1px solid #d5dfe4;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 6px #2237470d;
  overflow: hidden;
}
.customer-search { padding: 20px 24px; background: #f7fafb; border-bottom: 1px solid #e0e7ea; }
.customer-search label { font-size: 12px; color: #334e60; font-weight: 700; margin-bottom: 8px; }
.customer-search div { gap: 9px; }
.customer-search input,
.customer-search select {
  height: 39px;
  border: 1px solid #bac8d0;
  border-radius: 5px;
  padding: 8px 10px;
  font-size: 13px;
  background: #fff;
  color: #263d4c;
}
.customer-search input { width: min(510px, 100%); }
.customer-search select { min-width: 126px; }
.customer-search button {
  height: 39px;
  border: 1px solid #173c51;
  border-radius: 5px;
  background: #295b71;
  color: #fff;
  padding: 0 16px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  box-shadow: inset 0 1px #6f93a2;
}
.customer-search button:hover { background: #204b5f; }
.customer-search a,
.back-link a { color: #1f5f82; font-size: 13px; font-weight: 600; text-decoration: none; }
.customer-search a:hover,
.back-link a:hover { text-decoration: underline; }
.list-summary { font-size: 13px; color: #52636e; margin: 16px 24px; }
.customer-table { min-width: 720px; font-size: 14px; }
.customer-table th {
  background: #eff4f6;
  color: #405362;
  padding: 12px 14px;
  font-size: 11px;
  letter-spacing: .055em;
  text-transform: uppercase;
  border-bottom: 1px solid #d7e1e5;
}
.customer-table td { padding: 14px; border-bottom: 1px solid #e4eaed; color: #33444f; line-height: 1.35; vertical-align: top; }
.customer-table tbody tr { transition: background .12s; }
.customer-table tbody tr:hover,
.customer-table tbody tr:nth-child(even):hover { background: #f5fafb; }
.customer-table tbody tr:nth-child(even) { background: #fbfcfd; }
.customer-table a { color: #125d88; font-weight: 650; }
.customer-table td:first-child { font-weight: 600; }
.amount { font-variant-numeric: tabular-nums; }
.pagination { padding: 17px 24px; font-size: 13px; border-top: 1px solid #e1e8eb; }
.pagination a { color: #1f5f82; font-weight: 650; }
.customer-detail-card { padding: 26px; }
.customer-detail-card dl { gap: 0 32px; }
.customer-detail-card dl > div { padding: 15px 0; border-bottom-color: #e6ecee; }
.customer-detail-card dt { font-weight: 700; margin-bottom: 6px; }
.customer-detail-card dd { color: #263d4c; font-size: 14px; }
.invoice-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 22px 24px; border-bottom: 1px solid #e1e8eb; background: #fbfcfd; }
.invoice-meta div { min-width: 0; }
.invoice-meta dt { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: #70808a; font-weight: 700; margin-bottom: 5px; }
.invoice-meta dd { margin: 0; color: #273e4d; font-size: 14px; line-height: 1.4; }
.invoice-meta a { color: #125d88; font-weight: 650; text-decoration: none; }
.status-badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.status-badge.is-sent { background: #e8f1f5; color: #245a70; }
.status-badge.is-open { background: #fff5d7; color: #755608; }
@media (max-width: 760px) {
  .engine-content { padding: 26px 18px 42px; }
  .content-title h1 { font-size: 27px; }
  .engine-masthead { height: 112px; }
  .masthead-copy { width: 64%; min-width: 0; padding: 18px; }
  .masthead-copy strong { font-size: 35px; }
  .masthead-art { width: 79%; }
  .customer-search div { align-items: stretch; flex-wrap: wrap; }
  .customer-search input { min-width: 100%; }
  .customer-search select { flex: 1; }
  .invoice-meta { grid-template-columns: 1fr 1fr; }
}

/* Billy v1 invoice parity — source reviewed on dev2 at
   /mnt/billy/srv/www/billy.co.za/templates/invoice_content_table_list_ex.tpl,
   Invoiceview.class.php and billy.css.  These rules intentionally retain the
   compact, information-dense v1 list and document treatment. */
.legacy-invoice-register, .legacy-invoice-detail { max-width: none; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px; color: #30343f; }
.legacy-list-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 10px; }
.legacy-list-heading h1, .legacy-document-heading h1 { margin: 0; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11pt; font-weight: bold; color: #000; }
.legacy-list-heading .subheading { font-size: 10px; color: #666; }
.legacy-invoice-search { display: flex; align-items: center; justify-content: end; gap: 4px; margin: 0; white-space: nowrap; }
.legacy-invoice-search label { font-size: 11px; font-weight: normal; }
.legacy-invoice-search input, .legacy-invoice-search select, .legacy-invoice-search button { height: auto; min-height: 0; border-radius: 0; padding: 2px 4px; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px; color: #3b4b6b; }
.legacy-invoice-search input { width: 190px; border: 1px solid #999; }
.legacy-invoice-search select { min-width: 58px; border: 1px solid #999; }
.legacy-invoice-search button { border: 1px outset #ccc; background: #efefef; color: #000; font-weight: normal; cursor: pointer; box-shadow: none; }
.legacy-invoice-search a, .legacy-back a { color: #003366; text-decoration: none; }
.legacy-table-wrap { overflow-x: auto; }
.legacy-invoice-table, .legacy-invoice-lines { width: 100%; border-collapse: separate; border-spacing: 1px; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px; }
.legacy-invoice-table th, .legacy-invoice-lines th { padding: 0 2px 5px; background: transparent; color: #34383f; font-size: 9pt; font-weight: bold; letter-spacing: 1px; line-height: 90%; text-align: left; text-transform: none; border: 0; border-bottom: 1px solid grey; }
.legacy-invoice-table td, .legacy-invoice-lines td { padding: 4px 5px; color: #30343f; border: 0; vertical-align: top; line-height: normal; }
.legacy-invoice-table .row_light, .legacy-invoice-lines .row_light { background: #f9f9f9; }
.legacy-invoice-table .row_dark, .legacy-invoice-lines .row_dark { background: #f0f0f0; }
.legacy-invoice-table tr:hover { background: #e3e6f0; }
.legacy-invoice-table a, .legacy-invoice-lines a { color: #003366; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: normal; text-decoration: none; }
.legacy-invoice-table a:hover, .legacy-invoice-lines a:hover, .legacy-back a:hover { color: #990000; text-decoration: underline; }
.legacy-actions { width: 72px; text-align: center !important; white-space: nowrap; }
.legacy-view { margin-right: 5px; }
.legacy-edit-unavailable { color: #777; font-size: 10px; }
.legacy-sent { color: #333; }
.legacy-open { color: #003366; font-weight: bold; }
.legacy-pagination { margin-top: 8px; display: flex; gap: 12px; align-items: center; font-size: 11px; }
.legacy-pagination a { color: #003366; text-decoration: none; }
.legacy-back { margin: 0 0 8px; font-size: 11px; }
.legacy-document-heading { display: flex; align-items: baseline; gap: 12px; margin: 0 0 8px; }
.legacy-document-heading strong { color: #333; font-size: 11px; }
.legacy-document-meta { width: 100%; margin: 0 0 12px; border-collapse: collapse; font-size: 11px; }
.legacy-document-meta td { padding: 3px 8px 3px 0; vertical-align: top; }
.legacy-document-meta td:nth-child(1), .legacy-document-meta td:nth-child(3) { width: 110px; color: #34383f; }
.legacy-invoice-lines .amount, .legacy-invoice-table .amount { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.legacy-invoice-lines .row_footer td { background: #ddd; border-top: 1px solid #000; border-bottom: 1px solid #000; }
.legacy-lock-note { color: #555; font-size: 10px; margin-top: 8px; }
@media (max-width: 760px) { .legacy-list-heading { display: block; } .legacy-invoice-search { justify-content: start; flex-wrap: wrap; margin-top: 10px; } .legacy-invoice-search input { width: 160px; } }

/* Invoice document: faithful HTML port of Invoiceview.class.php's template 3
   ("Twilight Memories") A4 PDF branch, plus invoice_content_row_email.tpl. */
.invoice-toolbar { max-width: 794px; margin: 0 auto 12px; display: flex; align-items: center; gap: 16px; font-size: 12px; }
.invoice-toolbar a { color: #003366; text-decoration: none; }
.invoice-toolbar span { flex: 1; color: #52616a; }
.invoice-toolbar button { border: 1px outset #ccc; border-radius: 0; padding: 4px 12px; background: #efefef; color: #000; font: 11px Verdana, sans-serif; }
.v1-invoice-sheet { box-sizing: border-box; position: relative; width: 794px; min-height: 1123px; margin: 0 auto; padding: 36px 47px 88px; background: #fff; color: #111; box-shadow: 0 2px 18px rgba(22, 42, 53, .17); font: 12px/1.32 Helvetica, Arial, sans-serif; }
.v1-invoice-header { min-height: 154px; display: grid; grid-template-columns: minmax(0, 1fr) max-content; gap: 28px; align-items: start; }
.v1-invoice-brand { min-width: 0; }
.v1-company-logo { display: block; width: 340px; max-width: 100%; height: auto; }
.v1-invoice-company { max-width: 330px; padding-top: 2px; font-size: 10px; line-height: 1.36; text-align: right; }
.v1-invoice-company > * { display: block; margin: 0; white-space: nowrap; }
.v1-invoice-company-name { margin-bottom: 5px !important; font-size: 11px; }
.v1-invoice-company address { margin-bottom: 5px; font: inherit; font-style: normal; }
.v1-customer-block address { margin: 2px 0 0; font-style: normal; font-size: 10px; }
.v1-invoice-parties { display: grid; grid-template-columns: 1fr 190px; gap: 35px; min-height: 155px; }
.v1-customer-block { display: grid; grid-template-columns: 32px 1fr; gap: 4px; padding-left: 8px; }
.v1-customer-block > span { font-size: 11px; }
.v1-customer-block strong { font-size: 13px; }
.v1-document-meta h1 { margin: 0 0 8px; font-size: 16px; font-weight: normal; }
.v1-document-meta p { margin: 2px 0; font-size: 12px; }
.v1-invoice-items { width: 100%; border: 1px solid #4d4d4d; border-collapse: collapse; font-size: 11px; }
.v1-invoice-items th { padding: 5px 7px; background: #fff; border-bottom: 1px solid #4d4d4d; text-align: left; }
.v1-invoice-items th:nth-child(n+2), .v1-invoice-items td:nth-child(n+2) { text-align: right; white-space: nowrap; }
.v1-invoice-items th:nth-child(1) { width: 59%; }.v1-invoice-items th:nth-child(2) { width: 8%; }.v1-invoice-items th:nth-child(3) { width: 15%; }
.v1-invoice-items td { padding: 6px 7px; border: 0; vertical-align: top; }
.v1-invoice-items tbody tr:nth-child(even) { background: #ededed; }
.v1-invoice-items small { display: block; color: #555; margin-top: 2px; }
.v1-invoice-summary { width: 250px; margin: 12px 0 0 auto; border-collapse: collapse; font-size: 11px; }
.v1-invoice-summary th, .v1-invoice-summary td { padding: 5px 7px; border: 0; }
.v1-invoice-summary th { width: 60%; text-align: left; }.v1-invoice-summary td { text-align: right; white-space: nowrap; }
.v1-invoice-summary tr:nth-child(odd) { background: #ededed; }.v1-invoice-summary tr:last-child { font-weight: bold; }
.v1-invoice-note, .v1-invoice-terms, .v1-bank-details { margin-top: 20px; font-size: 10px; white-space: normal; }
.v1-bank-details { font-size: 9px; }
.v1-invoice-footer { position: absolute; left: 47px; right: 47px; bottom: 30px; min-height: 42px; padding: 8px 10px; border: 1px solid #808080; display: flex; justify-content: space-between; align-items: flex-start; font-size: 9px; }
.v1-invoice-footer span:last-child { text-align: right; }
@media (max-width: 900px) { .v1-invoice-sheet { width: 100%; min-height: auto; padding: 28px 24px 84px; } .invoice-toolbar { max-width: none; } .v1-invoice-header { grid-template-columns: minmax(180px, 1fr) max-content; gap: 18px; } .v1-company-logo { width: min(340px, 100%); } .v1-invoice-company { max-width: 300px; font-size: clamp(8px, 1.45vw, 10px); } .v1-invoice-company-name { font-size: clamp(9px, 1.55vw, 11px); } .v1-invoice-parties { grid-template-columns: 1fr 180px; } .v1-invoice-footer { left: 24px; right: 24px; } }
@media print {
  @page { size: A4 portrait; margin: 0; }
  .invoice-document-page .engine-masthead, .invoice-document-page .engine-strip, .invoice-document-page .engine-nav, .invoice-document-page .engine-footer, .invoice-toolbar { display: none !important; }
  .invoice-document-page .engine-frame, .invoice-document-page .engine-body, .invoice-document-page .engine-content { display: block; width: auto; min-height: 0; margin: 0; padding: 0; background: #fff; }
  .v1-invoice-sheet { width: 210mm; min-height: 297mm; margin: 0; padding: 10mm 12.5mm 23mm; box-shadow: none; page-break-after: always; }
  .v1-invoice-footer { left: 12.5mm; right: 12.5mm; bottom: 8mm; }
}
.statement-review-notice{margin:0 0 15px;padding:10px 12px;border:1px solid #d9c56a;background:#fffbe7;color:#5d542e;font:11px/1.5 Verdana,Tahoma,Arial,sans-serif}
