/* Invoicing stays inside the existing portal palette; printed documents use paper colours. */
.iv-workspace,
.iv-dialog {
  --iv-bg: var(--panel-c, #181b20);
  --iv-text: var(--text-c, #e9e7e2);
  --iv-muted: var(--muted-c, #aba9a1);
  --iv-line: var(--line-c, #35383d);
  --iv-accent: var(--accent-c, #d4b989);
  color: var(--iv-text);
  font: 400 14px/1.5 var(--font-body, Arial, sans-serif);
}
.iv-workspace {
  padding: 4px 0 28px;
  min-width: 0;
}
.iv-workspace *,
.iv-dialog * {
  box-sizing: border-box;
}
.iv-workspace h2,
.iv-dialog h2 {
  font: 500 24px/1.3 var(--font-body, Arial, sans-serif);
  letter-spacing: 0;
  margin: 0;
}
.iv-workspace h3,
.iv-dialog h3 {
  font: 500 16px/1.4 var(--font-body, Arial, sans-serif);
  letter-spacing: 0;
  margin: 22px 0 12px;
}
.iv-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--iv-line);
  padding: 0 0 14px;
  margin: 0 0 24px;
  overflow: auto;
}
.iv-tabs .iv-btn {
  background: transparent;
  border-color: transparent;
  white-space: nowrap;
}
.iv-tabs .iv-btn[aria-current="page"] {
  background: var(--app-tint, rgba(212, 185, 137, 0.12));
  border-color: var(--iv-line);
  color: var(--iv-accent);
}
.iv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--iv-line);
  border-radius: 7px;
  background: var(--iv-bg);
  color: var(--iv-text);
  font: 500 13px/1.3 var(--font-body, Arial, sans-serif);
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none;
  cursor: pointer;
  white-space: normal;
}
.iv-btn:hover {
  border-color: var(--iv-accent);
  color: var(--iv-accent);
}
.iv-btn--primary {
  background: var(--iv-accent);
  color: #17191d;
  border-color: var(--iv-accent);
}
.iv-btn--primary:hover {
  background: #e5cda5;
  color: #17191d;
}
.iv-btn--link {
  border: 0;
  padding: 3px 0;
  min-height: 30px;
  background: transparent;
  color: var(--iv-accent);
  text-align: left;
  justify-content: flex-start;
}
.iv-btn--quiet {
  background: transparent;
  color: var(--iv-muted);
}
.iv-btn:disabled {
  opacity: 0.45;
  cursor: wait;
}
.iv-btn:focus-visible,
.iv-workspace input:focus-visible,
.iv-workspace select:focus-visible,
.iv-workspace textarea:focus-visible,
.iv-dialog input:focus-visible,
.iv-dialog select:focus-visible,
.iv-dialog textarea:focus-visible,
.iv-audit summary:focus-visible {
  outline: 2px solid var(--iv-accent);
  outline-offset: 3px;
}
.iv-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 22px;
}
.iv-heading h3 {
  margin: 0;
}
.iv-heading > .iv-actions {
  flex-shrink: 0;
}
.iv-heading .iv-help {
  margin: 7px 0 0;
  max-width: 700px;
}
.iv-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}
.iv-help {
  font-size: 12px;
  line-height: 1.6;
  color: var(--iv-muted);
  margin: 5px 0;
  letter-spacing: 0;
}
.iv-message {
  font-size: 13px;
  line-height: 1.6;
  color: var(--iv-accent);
  white-space: pre-wrap;
  margin: 12px 0;
}
.iv-message:empty {
  display: none;
}
.iv-message--error {
  color: #f1a6a6;
  padding: 12px 14px;
  border: 1px solid #75464a;
  border-radius: 7px;
  background: #7d282b22;
}
.iv-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 12px;
  margin: 20px 0 24px;
}
.iv-metric {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--iv-line);
  background: var(--iv-bg);
  border-radius: 10px;
}
.iv-metric > span {
  font-size: 12px;
  color: var(--iv-muted);
}
.iv-metric > strong {
  font: 500 27px/1.2 var(--font-body, Arial, sans-serif);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.iv-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
  margin: 0 0 16px;
}
.iv-field > label {
  font: 500 12px/1.4 var(--font-body, Arial, sans-serif);
  color: var(--iv-muted);
  text-transform: none;
  letter-spacing: 0;
}
.iv-field > input,
.iv-field > select,
.iv-field > textarea {
  width: 100%;
  min-width: 0;
  min-height: 43px;
  border: 1px solid var(--iv-line);
  border-radius: 7px;
  padding: 10px 12px;
  color: var(--iv-text);
  background: var(--bg-c, #121519);
  font: 400 14px/1.4 var(--font-body, Arial, sans-serif);
  letter-spacing: 0;
  box-shadow: none;
  resize: vertical;
  color-scheme: dark;
}
.iv-field > textarea {
  min-height: 75px;
  line-height: 1.5;
}
.iv-field > select {
  padding-right: 28px;
}
.iv-field > input:disabled,
.iv-field > select:disabled {
  opacity: 0.6;
}
.iv-field .iv-help {
  margin: 0;
}
.iv-field .iv-btn--link {
  align-self: flex-start;
}
.iv-field input[type="file"] {
  padding: 9px;
}
.iv-filters {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0 4px;
}
.iv-filters > .iv-field:first-child {
  flex: 1;
}
.iv-filters > .iv-field {
  min-width: 160px;
}
.iv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
}
.iv-form {
  display: block;
  margin: 0;
}
.iv-fieldset {
  padding: 0;
  margin: 0;
  border: 0;
  min-width: 0;
}
.iv-fieldset:disabled .iv-btn {
  opacity: 0.5;
  cursor: wait;
}
.iv-table-wrap {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  margin: 16px 0 22px;
  border: 1px solid var(--iv-line);
  border-radius: 9px;
}
.iv-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  text-align: left;
}
.iv-table th {
  padding: 12px 15px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--iv-muted);
  background: var(--iv-bg);
  border-bottom: 1px solid var(--iv-line);
  text-transform: none;
  white-space: nowrap;
}
.iv-table td {
  padding: 13px 15px;
  vertical-align: middle;
  border-bottom: 1px solid var(--iv-line);
  font-variant-numeric: tabular-nums;
}
.iv-table tr:last-child td {
  border-bottom: 0;
}
.iv-table td > strong {
  font-weight: 500;
}
.iv-table td > .iv-btn {
  min-width: max-content;
}
.iv-table .iv-help {
  margin: 3px 0 0;
}
.iv-table td:has(.iv-pill) {
  white-space: nowrap;
}
.iv-empty {
  padding: 42px 20px;
  color: var(--iv-muted);
  text-align: center;
  border: 1px dashed var(--iv-line);
  border-radius: 9px;
  margin: 20px 0;
  font-size: 14px;
}
.iv-pill {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 30px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
  background: #343944;
  color: #d3d6e0;
  border: 1px solid #454b58;
}
.iv-pill--paid {
  background: #183d32;
  color: #a0dec4;
  border-color: #305e4e;
}
.iv-pill--refunded {
  background: #29384b;
  color: #bbd5f1;
  border-color: #456380;
}
.iv-pill--partial {
  background: #3c331d;
  color: #e4c884;
  border-color: #5e4c2b;
}
.iv-pill--unpaid {
  background: #29374a;
  color: #b4c9e6;
  border-color: #465b76;
}
.iv-pill--overdue {
  background: #46262a;
  color: #efb0b6;
  border-color: #74424a;
}
.iv-pill--void {
  background: #302e32;
  color: #b6acb3;
  border-color: #4a454b;
}
.iv-dialog {
  position: fixed;
  width: min(680px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--iv-line);
  border-radius: 13px;
  background: var(--bg-c, #121519);
  box-shadow: 0 25px 100px #0008;
  overflow: auto;
  overscroll-behavior: contain;
}
.iv-dialog--wide {
  width: min(1080px, calc(100vw - 32px));
}
.iv-dialog::backdrop {
  background: #000a;
  backdrop-filter: blur(3px);
}
.iv-dialog__head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--iv-line);
  background: var(--bg-c, #121519);
}
.iv-dialog__head h2 {
  font-size: 20px;
}
.iv-dialog__body {
  padding: 24px;
}
.iv-dialog__body > .iv-actions:first-child {
  margin-top: 0;
}
.iv-line-items {
  margin: 0 0 22px;
}
.iv-line-item {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 85px 115px 80px 100px;
  gap: 12px;
  align-items: start;
  border-bottom: 1px solid var(--iv-line);
  padding: 15px 0;
}
.iv-line-item:first-child {
  padding-top: 0;
}
.iv-line-item textarea {
  min-height: 78px;
  resize: vertical;
}
.iv-line-item .iv-field {
  margin: 0;
}
.iv-line-summary {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  padding-top: 24px;
}
.iv-line-amount {
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.iv-line-summary .iv-btn {
  padding: 5px 8px;
  font-size: 11px;
  min-height: 32px;
}
.iv-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
  margin: 12px 0;
  color: var(--iv-text);
  cursor: pointer;
}
.iv-check > input {
  width: 18px;
  height: 18px;
  min-width: 18px;
  accent-color: var(--iv-accent);
}
.iv-deposits {
  border: 1px solid var(--iv-line);
  border-radius: 9px;
  padding: 4px 16px 12px;
  margin: 6px 0 18px;
}
.iv-deposits h3 {
  margin: 12px 0 5px;
}
.iv-deposits > .iv-help:first-child {
  margin-top: 10px;
}
.iv-deposit-policy,
.iv-deposit-terms {
  border: 1px solid var(--iv-line, #d7dce0);
  border-radius: 9px;
  padding: 16px;
  margin: 18px 0;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.iv-deposit-policy[hidden],
.iv-deposit-policy [hidden] {
  display: none;
}
.iv-deposit-policy h3,
.iv-deposit-terms h3 {
  margin-top: 0;
}
.iv-deposit-terms p:last-child {
  margin-bottom: 0;
}
.iv-deposit-terms__status {
  font-weight: 600;
}
.iv-paper .iv-deposit-terms {
  border-color: #d7dce0;
  background: #f7f8fa;
  color: #192027;
  break-inside: avoid;
}
.iv-totals {
  width: min(100%, 350px);
  margin: 20px 0 24px auto;
  line-height: 1.4;
}
.iv-totals > div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 6px 0;
}
.iv-totals dt {
  font-weight: 400;
}
.iv-totals dd {
  margin: 0;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.iv-totals__strong {
  font-weight: 500;
  border-top: 1px solid var(--iv-line);
  margin-top: 4px;
}
.iv-totals__strong dt {
  font-weight: 500;
}
.iv-totals__balance {
  font-weight: 500;
  font-size: 19px;
  border-top: 2px solid var(--iv-line);
  margin-top: 8px;
  padding-top: 12px !important;
}
.iv-totals__balance dt {
  font-weight: 500;
}
.iv-live-total {
  display: flex;
  justify-content: flex-end;
  flex-direction: column;
}
.iv-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.iv-lines {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.iv-contact-address {
  margin: 20px 0;
}
.iv-contact-address p {
  margin: 6px 0;
  line-height: 1.7;
}
.iv-audit {
  margin: 24px 0 0;
}
.iv-audit summary {
  padding: 12px 0;
  cursor: pointer;
  color: var(--iv-muted);
}
.iv-report-filters {
  display: grid;
  grid-template-columns: 1fr 1fr 1.5fr auto;
  align-items: end;
  gap: 14px;
}
.iv-report-filters > .iv-btn {
  margin-bottom: 16px;
  height: 43px;
}
.iv-settings {
  max-width: 900px;
}
.iv-settings h3 {
  border-bottom: 1px solid var(--iv-line);
  padding-bottom: 12px;
  margin-top: 28px;
}
.iv-settings h3:first-child {
  margin-top: 0;
}
.iv-logo-preview {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 70px;
  margin: 16px 0;
  background: #fff;
  border-radius: 7px;
  padding: 14px;
  width: fit-content;
  min-width: 160px;
  max-width: 100%;
}
.iv-logo-preview img {
  max-width: 210px;
  max-height: 105px;
  object-fit: contain;
}
.iv-logo-preview .iv-help {
  color: #555;
}
.iv-paper {
  --iv-line: #d8dde0;
  --iv-bg: #f4f5f6;
  --iv-text: #202b34;
  --iv-muted: #606c74;
  --iv-accent: #4c6054;
  background: #fff;
  color: #202b34;
  padding: 42px;
  margin: 24px auto;
  max-width: 860px;
  box-shadow: 0 5px 20px #0002;
  border-radius: 3px;
  font:
    400 13px/1.55 Arial,
    sans-serif;
}
.iv-paper h2 {
  font:
    600 24px/1.3 Arial,
    sans-serif;
  margin: 0 0 8px;
  color: #202b34;
}
.iv-paper h3 {
  font:
    600 14px/1.4 Arial,
    sans-serif;
  margin: 16px 0 7px;
  color: #202b34;
}
.iv-paper p {
  margin: 5px 0 10px;
}
.iv-paper__head,
.iv-paper__meta {
  display: flex;
  justify-content: space-between;
  gap: 35px;
  margin-bottom: 32px;
}
.iv-paper__head > div {
  max-width: 60%;
}
.iv-paper__logo {
  max-width: 155px;
  max-height: 100px;
  object-fit: contain;
  object-position: left;
  margin-bottom: 16px;
}
.iv-paper__reference {
  text-align: right;
}
.iv-paper__meta > div {
  max-width: 55%;
}
.iv-paper__dates {
  display: grid;
  grid-template-columns: auto auto;
  gap: 6px 18px;
  margin: 0;
  align-content: start;
}
.iv-paper__dates dt {
  color: #606c74;
}
.iv-paper__dates dd {
  margin: 0;
}
.iv-paper__void {
  color: #a32932;
  font-weight: bold;
  font-size: 25px;
}
.iv-paper .iv-table-wrap {
  border: 0;
  border-radius: 0;
  margin-top: 24px;
}
.iv-paper .iv-table {
  font:
    400 12px/1.55 Arial,
    sans-serif;
}
.iv-paper .iv-table th {
  padding: 10px 7px;
}
.iv-paper .iv-table td {
  padding: 13px 7px;
  vertical-align: top;
}
.iv-paper .iv-table td:first-child {
  width: 42%;
  min-width: 140px;
}
.iv-paper .iv-table td:not(:first-child) {
  white-space: nowrap;
}
.iv-paper .iv-totals {
  font-size: 13px;
}
.iv-paper .iv-totals__balance {
  font-size: 21px;
}
.iv-paper__bank {
  border-top: 1px solid #d8dde0;
  padding-top: 10px;
  break-inside: avoid;
}
.iv-paper__notes {
  padding-bottom: 16px;
}
.iv-paper__footer {
  font-size: 10px;
  color: #606c74;
  border-top: 1px solid #e1e4e6;
  padding-top: 15px;
  margin-top: 24px;
}
.iv-paper p.iv-paper__footer {
  border: 0;
  margin-top: 8px;
  padding-top: 0;
}
.iv-paper .iv-help {
  color: #606c74;
}
.iv-print-frame {
  position: fixed;
  width: 1px;
  height: 1px;
  left: -10000px;
  top: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
.iv-paper__logo--default {
  background: #171a1d;
  padding: 10px;
  border-radius: 5px;
}
@media (max-width: 800px) {
  .iv-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .iv-dialog__body {
    padding: 18px;
  }
  .iv-line-item {
    grid-template-columns: minmax(75px, 1fr) minmax(105px, 1fr) minmax(
        75px,
        1fr
      ) 90px;
    gap: 10px;
  }
  .iv-line-item > .iv-field:first-child {
    grid-column: 1/-1;
  }
  .iv-line-summary {
    padding-top: 24px;
  }
  .iv-report-filters {
    grid-template-columns: 1fr 1fr;
  }
  .iv-paper {
    padding: 28px;
  }
  .iv-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 520px) {
  .iv-dialog,
  .iv-dialog--wide {
    width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
    border-radius: 10px;
  }
  .iv-dialog__head {
    padding: 14px;
  }
  .iv-dialog__head h2 {
    font-size: 18px;
  }
  .iv-dialog__body {
    padding: 14px;
  }
  .iv-tabs {
    gap: 2px;
  }
  .iv-tabs .iv-btn {
    padding: 9px 11px;
  }
  .iv-heading h2 {
    font-size: 21px;
  }
  .iv-grid {
    grid-template-columns: 1fr;
  }
  .iv-filters {
    align-items: stretch;
    flex-direction: column;
    gap: 0;
  }
  .iv-filters > .iv-field {
    width: 100%;
  }
  .iv-metric {
    padding: 14px;
  }
  .iv-metric > strong {
    font-size: 23px;
  }
  .iv-line-item {
    grid-template-columns: 1fr 1.2fr 1fr;
  }
  .iv-line-summary {
    grid-column: 1/-1;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding-top: 2px;
  }
  .iv-report-filters {
    gap: 0 12px;
  }
  .iv-report-filters > .iv-field:nth-child(3) {
    grid-column: 1/-1;
  }
  .iv-report-filters > .iv-btn {
    grid-column: 1/-1;
  }
  .iv-paper {
    padding: 18px;
    margin: 18px -3px;
  }
  .iv-paper__head,
  .iv-paper__meta {
    gap: 20px;
    flex-direction: column;
  }
  .iv-paper__head > div,
  .iv-paper__meta > div {
    max-width: none;
  }
  .iv-paper__reference {
    text-align: left;
  }
  .iv-paper__dates {
    grid-template-columns: 110px 1fr;
  }
  .iv-paper h2 {
    font-size: 21px;
  }
  .iv-table th,
  .iv-table td {
    padding: 11px 10px;
  }
  .iv-field > input,
  .iv-field > select,
  .iv-field > textarea {
    font-size: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .iv-workspace *,
  .iv-dialog * {
    scroll-behavior: auto !important;
  }
}
