#editInvoiceBack[hidden], .invoice-wizard [hidden] { display: none !important; }
#editModal.invoice-wizard {
  --wizard-blue: #0963ce;
  --wizard-ink: #15273e;
  --wizard-muted: #4e647c;
  --wizard-border: #d8e5f1;
  align-items: flex-start;
  overflow: auto;
  padding: clamp(12px, 4vw, 56px);
  background: #eef4fa;
  color: var(--wizard-ink);
}
.invoice-wizard .edit-backdrop { display: none; }
.invoice-wizard .edit-panel {
  width: min(1080px, 100%);
  max-height: none;
  min-height: min(540px, 85vh);
  margin: 0 auto;
  padding: clamp(16px, 3.5vw, 36px);
  border: 1px solid var(--wizard-border);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 15px 50px #14314e12;
  display: flex;
  flex-direction: column;
}
.invoice-wizard .edit-head { margin-bottom: 18px; }
.invoice-wizard .edit-head .pill { display: none; }
.invoice-wizard .edit-head h2 { margin: 0; color: var(--wizard-ink); font-size: clamp(1.55rem, 3vw, 2.1rem); }
.invoice-wizard .edit-form { display: block; flex: 1; min-width: 0; }
.invoice-wizard .invoice-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 25px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--wizard-border);
  list-style: none;
}
.invoice-wizard .invoice-steps li { display: flex; gap: 9px; align-items: center; color: var(--wizard-muted); font-weight: 650; line-height: 1.3; }
.invoice-wizard .invoice-steps span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  color: #365774;
  background: #edf4fa;
  font-variant-numeric: tabular-nums;
}
.invoice-wizard .invoice-steps [aria-current="step"] { color: var(--wizard-blue); }
.invoice-wizard .invoice-steps [aria-current="step"] span { background: var(--wizard-blue); color: #fff; }
.invoice-wizard .invoice-steps .complete span { background: #dcedff; color: #084c9a; }
.invoice-wizard h3 { margin: 0 0 14px; font-size: 1.3rem; color: var(--wizard-ink); }
.invoice-wizard label { display: grid; gap: 5px; min-width: 0; color: var(--wizard-ink); font-size: .91rem; font-weight: 650; }
.invoice-wizard input, .invoice-wizard select, .invoice-wizard textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid #aec5dc;
  border-radius: 9px;
  background: #fff;
  color: var(--wizard-ink);
  padding: 8px 10px;
  font: inherit;
  font-size: 1rem;
}
.invoice-wizard :is(input, select, button, summary):focus-visible { outline: 2px solid var(--wizard-blue); outline-offset: 2px; }
.invoice-wizard .wizard-customer-fields { display: grid; grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)); gap: 14px; }
.invoice-wizard .wizard-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.invoice-wizard .wizard-section-head h3 { margin: 0; }
.invoice-wizard .wizard-items { display: grid; gap: 10px; }
.invoice-wizard .invoice-wizard-line {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) 76px minmax(90px, 1fr) minmax(90px, 1fr) 36px;
  align-items: end;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--wizard-border);
  border-radius: 12px;
  background: #f8fbff;
}
.invoice-wizard .wizard-line-amount { display: grid; padding: 7px 9px; border-radius: 9px; background: #e5f1ff; color: #084c9a; line-height: 1.25; overflow-wrap: anywhere; }
.invoice-wizard .wizard-line-amount span { font-size: .82rem; font-weight: 650; }
.invoice-wizard .wizard-line-amount strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.invoice-wizard button.wizard-remove { min-height: 44px; padding: 0; background: #fbe9e9; color: #912e30; font-size: 1.15rem; }
.invoice-wizard .wizard-tax { max-width: 120px; margin-top: 16px; }
.invoice-wizard .wizard-review-client {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
  margin: 0;
  padding: 14px;
  border-radius: 12px;
  background: #eaf4ff;
}
.invoice-wizard dt, .invoice-wizard .wizard-review-items span { color: var(--wizard-muted); font-size: .88rem; }
.invoice-wizard dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.invoice-wizard .wizard-review-items { list-style: none; margin: 12px 0; padding: 0; }
.invoice-wizard .wizard-review-items li, .invoice-wizard .wizard-review-totals div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; }
.invoice-wizard .wizard-review-items li { border-bottom: 1px solid var(--wizard-border); }
.invoice-wizard .wizard-review-items span { display: block; }
.invoice-wizard .wizard-review-totals { width: min(100%, 310px); margin: 0 0 0 auto; }
.invoice-wizard .wizard-review-totals div:last-child { border-top: 1px solid var(--wizard-border); }
.invoice-wizard .wizard-review-totals div:last-child :is(dt, dd) { font-size: 1.3rem; font-weight: 800; color: #084c9a; }
.invoice-wizard .wizard-notes summary { cursor: pointer; font-weight: 650; color: #084c9a; }
.invoice-wizard .wizard-notes label { margin-top: 10px; }
.invoice-wizard .wizard-error { margin: 14px 0 0; padding: 10px 12px; background: #fff0ed; color: #922822; border-radius: 9px; font-weight: 650; }
.invoice-wizard .edit-actions { margin-top: 20px; align-items: center; }
.invoice-wizard #editInvoiceBack { margin-right: auto; }
.invoice-wizard #editSave { background: var(--wizard-blue); color: #fff; min-height: 44px; }
@media (max-width: 800px) {
  .invoice-wizard .wizard-customer-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invoice-wizard .wizard-customer { grid-column: 1 / -1; }
  .invoice-wizard .invoice-wizard-line { grid-template-columns: repeat(3, minmax(0, 1fr)) 36px; }
  .invoice-wizard .wizard-description { grid-column: 1 / 3; }
  .invoice-wizard .wizard-description + label { grid-column: 3 / -1; }
}
@media (max-width: 520px) {
  .invoice-wizard .invoice-steps li { flex-direction: column; align-items: flex-start; font-size: .82rem; }
  .invoice-wizard .wizard-review-client { grid-template-columns: minmax(0, 1fr); }
  .invoice-wizard .wizard-description, .invoice-wizard .wizard-description + label { grid-column: 1 / -1; }
}

.payment-wizard-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.payment-wizard-panel .wide { grid-column: 1 / -1; }
.payment-wizard-review dl { margin: 0; display: grid; gap: 8px; }
.payment-wizard-review dl div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--wizard-border); }
.payment-wizard-review dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.payment-wizard-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.supplier-reconcile { margin: 10px 0; }
#appShell #reports .report-dashboard .report-center-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.report-dashboard .report-center-tools label { display: grid; gap: 5px; align-content: start; }
#appShell #reports .report-dashboard .report-center-tools select { width: 100%; height: 44px; }
@media (max-width: 600px) {
  .payment-wizard-panel { grid-template-columns: minmax(0, 1fr); }
}

.payment-dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: clamp(12px, 4vw, 56px);
  border: 0;
  overflow: auto;
  background: #eef4fa;
  color: #15273e;
  --wizard-blue: #0963ce;
  --wizard-ink: #15273e;
  --wizard-muted: #4e647c;
  --wizard-border: #d8e5f1;
}
.payment-dialog .edit-panel { overflow: visible; }
.payment-dialog .payment-wizard {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.payment-dialog .invoice-steps { margin-bottom: 25px; }
.payment-dialog .payment-wizard-panel h3 { margin: 0; }
.payment-dialog .payment-wizard-actions { position: static; margin-top: auto; background: transparent; }
.payment-dialog .payment-wizard-panel,
.payment-dialog .payment-wizard-review { margin-bottom: 24px; }
.payment-dialog .payment-wizard-actions button { min-height: 44px; }
.payment-dialog .payment-wizard-actions .primary { margin-left: 0; background: #0963ce; color: #fff; }
.payment-dialog [data-payment-action="back"] { margin-right: auto; }

#appShell #reports .report-dashboard .report-center-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.report-insights {
  padding: clamp(14px, 3vw, 25px);
  border-radius: 16px;
  background: #0e2d53;
  color: #fff;
}
.report-insights header { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 14px; }
.report-insights h2 { margin: 0; color: inherit; }
.report-insights p, .report-net span { color: #d0e1f4; }
.report-net { display: grid; align-content: center; }
.report-net strong { font-size: clamp(1.35rem, 3vw, 2.2rem); line-height: 1.2; }
.report-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
#appShell #reports .report-metrics button {
  display: grid;
  gap: 5px;
  padding: 12px;
  text-align: left;
  background: #f5f9ff;
  color: #102d52;
  border: 2px solid transparent;
  border-radius: 12px;
}
#appShell #reports .report-metrics button[aria-pressed="true"] { background: #ddebff; border-color: #69aaff; }
.report-metrics strong { font-size: clamp(1.05rem, 2.5vw, 1.5rem); }
.report-metrics small { color: #425a75; }
.report-analysis { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 12px; margin: 14px 0 24px; }
.report-analysis section { min-width: 0; border: 1px solid #d8e5f1; border-radius: 14px; padding: 14px; background: #fff; }
.report-analysis h3 { margin: 0 0 12px; }
.report-chart-content, .report-breakdown-scroll { max-height: 290px; overflow: auto; }
.report-month { padding: 8px 0; border-bottom: 1px solid #d8e5f1; }
.report-bar-row { display: grid; grid-template-columns: auto minmax(28px, 1fr) auto; align-items: center; gap: 8px; font-size: .85rem; margin-top: 7px; }
.report-track { background: #eef4fa; border-radius: 10px; }
.report-track i { display: block; height: 9px; border-radius: 10px; background: #0963ce; }
.report-track i.out { background: #ae5b24; }
.report-breakdown table { width: 100%; border-collapse: collapse; }
.report-breakdown :is(th,td) { padding: 8px; border-bottom: 1px solid #e5edf5; text-align: left; }
.report-breakdown :is(th,td):last-child { text-align: right; white-space: nowrap; }
.report-breakdown td:first-child { white-space: nowrap; }
@media (max-width: 780px) {
  .report-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .report-analysis { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 520px) {
  #appShell #reports .report-dashboard .report-center-tools { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #appShell #reports .report-dashboard .report-center-tools label:first-child { grid-column: 1/-1; }
  .report-metrics { gap: 6px; }
}

.invoice-wizard :is(.wizard-customer-fields,.payment-wizard-panel,.guided-record-grid) {
  column-gap: 18px;
  row-gap: 14px;
  align-items: start;
}
.invoice-wizard :is(.wizard-customer-fields,.payment-wizard-panel,.guided-record-grid) > * {
  min-inline-size: 0;
}
#appShell .invoice-wizard :is(input,select,textarea),
.invoice-wizard :is(input,select,textarea) {
  box-sizing: border-box;
  inline-size: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
}
.invoice-wizard input[type="date"] {
  display: block;
  -webkit-appearance: none;
  appearance: none;
  line-height: normal;
}
.invoice-wizard input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
  min-width: 0;
}
.payment-dialog .guided-record-form {
  display: flex !important;
  flex: 1;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  gap: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.guided-record-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
}
.guided-record-grid > .wide,
.guided-record-grid > .full { grid-column: 1/-1; }
.guided-record-grid .form-actions:empty { display: none; }
.guided-record-step { margin-bottom: 22px; }
.guided-record-form > .edit-actions {
  position: static;
  margin-top: auto;
  background: transparent;
}
.guided-record-form > .edit-actions button { min-height: 44px; }
.guided-record-form [data-guide-back] { margin-right: auto; }
.guided-record-form > .edit-actions .primary { background: #0963ce; color: #fff; }
.guided-summary {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 14px;
  margin: 0;
  padding: 14px;
  background: #eaf4ff;
  border-radius: 12px;
}
.guided-summary dd { white-space: pre-wrap; }
@media (max-width: 700px) {
  .guided-record-grid,
  .guided-summary,
  .invoice-wizard .payment-wizard-panel { grid-template-columns: minmax(0,1fr); }
}

.report-detail-toolbar { margin: 14px 0; }
.report-detail-buttons, .report-download-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
#appShell #reports .report-detail-buttons button {
  min-height: 44px;
  background: #fff;
  border: 1px solid #ccdcee;
  color: #173454;
}
#appShell #reports .report-detail-buttons button[aria-pressed="true"] {
  border-color: #0963ce;
  background: #e6f0ff;
  color: #0b519d;
}
.report-download-actions {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #edf4ff;
}
.report-download-actions strong { margin-right: auto; }
#appShell #reports .report-download-actions button { min-height: 44px; padding-inline: 16px; }
#appShell #reports .report-download-actions button:disabled { opacity: .55; cursor: default; }
.report-breakdown .doc-table { table-layout: auto; }
.report-breakdown :is(th,td):last-child { white-space: normal; }
