:root {
  --purple: #58218a;
  --orange: #ff640a;
  --ink: #24232c;
  --muted: #777681;
  --line: #e7e6ec;
  --surface: #f6f6f8;
  --green: #13785b;
  font-family: "Segoe UI", "Leelawadee UI", Arial, sans-serif;
  font-size: 14px;
  color: var(--ink);
  font-synthesis: none;
}
* {
  box-sizing: border-box;
  letter-spacing: 0;
}
body {
  margin: 0;
  background: var(--surface);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid #dcdbe2;
  border-radius: 6px;
  background: white;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
button:hover,
.button:hover {
  background: #f4f1f8;
  border-color: #c9bbd7;
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid #d7b3f3;
  outline-offset: 3px;
}
.primary {
  background: var(--purple);
  color: #fff;
  border-color: var(--purple);
  box-shadow: 0 2px 3px #58218a14;
}
.primary:hover {
  background: #6a299f;
  border-color: #6a299f;
}
.icon-btn {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 7px;
  flex-shrink: 0;
  background: transparent;
  border-color: transparent;
}
.icon-btn:hover {
  background: #eeeaf3;
}
.icon-btn svg {
  width: 17px;
  height: 17px;
}
.text-btn {
  color: var(--purple);
  border: 0;
  padding: 4px 2px;
  min-height: 28px;
  background: transparent;
  font-size: 12px;
}
.link-btn {
  border: 0;
  color: var(--purple);
  background: transparent;
  padding: 0;
  min-height: 24px;
  font-weight: 700;
}
.link-btn:hover {
  background: none;
  text-decoration: underline;
}
svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
a {
  color: var(--purple);
}
[hidden] {
  display: none !important;
}
.sidebar {
  width: 218px;
  position: fixed;
  inset: 0 auto 0 0;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 28px 16px 16px;
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  padding: 0 0 34px 4px;
}
.brand img {
  width: 43px;
  height: 43px;
}
.brand strong {
  font-size: 24px;
  font-weight: 750;
  line-height: 1.1;
}
.brand small {
  display: block;
  font-size: 9px;
  color: var(--muted);
  margin-top: 5px;
}
.nav-label {
  font-size: 10px;
  color: #99949f;
  margin: 0 12px 12px;
  font-weight: 600;
}
.sidebar nav {
  display: grid;
  gap: 5px;
}
.sidebar nav button {
  justify-content: flex-start;
  width: 100%;
  border: 0;
  min-height: 43px;
  color: #66616f;
  font-size: 12px;
  padding: 10px 12px;
}
.sidebar nav button.active {
  background: #f2eaf9;
  color: var(--purple);
  box-shadow: inset 3px 0 var(--purple);
}
.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 21px;
  height: 20px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 600;
  background: #eae5ef;
  color: #655b73;
  border-radius: 4px;
}
.sidebar .count {
  margin-left: auto;
}
.sidebar-bottom {
  margin-top: auto;
  padding-top: 70px;
}
.old-version {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11px;
  color: #80798a;
  padding: 16px 11px;
  text-decoration: none;
}
.old-version svg {
  width: 14px;
  height: 14px;
}
.local-status {
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding: 17px 6px 0;
  font-size: 10px;
  color: #777;
}
.local-status > span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #29a27f;
}
.local-status small {
  margin-left: auto;
  font-size: 9px;
  color: #aaa;
}
.main-shell {
  margin-left: 218px;
  min-width: 0;
}
.topbar {
  height: 65px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
  background: #ffffffdb;
}
.breadcrumb {
  font-size: 12px;
  color: #99939f;
}
.breadcrumb span {
  margin: 0 12px;
  color: #c5bfcb;
}
.breadcrumb strong {
  color: #56505f;
  font-weight: 500;
}
.topbar-right {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 11px;
  color: #8d8793;
}
.error {
  color: #bd3838 !important;
}
#main {
  padding: 28px 30px 40px;
  max-width: 1900px;
  margin: auto;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 26px;
}
.page-heading h1 {
  font-size: 27px;
  font-weight: 650;
  line-height: 1.3;
  margin: 0 0 9px;
}
.page-heading p {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
}
.heading-dot {
  color: #c5bdce;
}
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wrap {
  flex-wrap: wrap;
}
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  font-size: 10px;
  font-weight: 650;
  border-radius: 4px;
  line-height: 1.25;
  background: #f0edf4;
  color: #756387;
  white-space: nowrap;
}
.badge.paid {
  background: #e8f5ef;
  color: #187457;
}
.badge.partial {
  background: #fff1df;
  color: #9b6424;
}
.badge.unpaid {
  background: #fff2e9;
  color: #b56432;
}
.badge.overdue {
  background: #ffecec;
  color: #b74040;
}
.badge.quote {
  background: #ede7fa;
  color: #713da1;
}
.badge.archived {
  background: #eee;
  color: #777;
}
.editor-workspace {
  display: grid;
  grid-template-columns: minmax(350px, 430px) minmax(0, 1fr);
  align-items: start;
  gap: 24px;
}
.edit-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}
.editor-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1.3fr;
  border-bottom: 1px solid var(--line);
  height: 53px;
  padding: 0 12px;
  gap: 7px;
}
.editor-tabs button {
  font-size: 11px;
  padding: 10px 2px;
  border: 0;
  border-radius: 0;
  color: #8a828f;
  background: none;
  position: relative;
  gap: 6px;
}
.editor-tabs button svg {
  width: 15px;
  height: 15px;
}
.editor-tabs button.active {
  color: var(--purple);
}
.editor-tabs button.active:after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--purple);
}
.editor-content {
  max-height: calc(100vh - 320px);
  min-height: 400px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #d6d0dd transparent;
}
.form-section {
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.form-section:last-child {
  border-bottom: 0;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 15px;
}
.form-section h2 {
  font-size: 13px;
  font-weight: 650;
  margin: 0 0 15px;
}
.section-title h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}
label {
  display: grid;
  gap: 7px;
  font-size: 11px;
  font-weight: 550;
  color: #6a6471;
  min-width: 0;
}
input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #e1dfe7;
  border-radius: 5px;
  background: #fff;
  outline: 0;
  min-height: 36px;
  padding: 8px 10px;
  font-size: 12px;
  transition: border-color 0.15s;
}
textarea {
  line-height: 1.6;
  resize: vertical;
}
input::placeholder,
textarea::placeholder {
  color: #b3acbb;
  font-weight: 400;
}
input:focus,
select:focus,
textarea:focus {
  border-color: #9b73ba;
  box-shadow: 0 0 0 3px #a062ca12;
}
input:disabled,
select:disabled {
  background: #f6f5f7;
  color: #928b99;
}
input[type="number"] {
  font-variant-numeric: tabular-nums;
}
input[type="checkbox"] {
  width: 32px;
  height: 18px;
  min-height: 18px;
  accent-color: var(--purple);
}
.fields {
  display: grid;
  gap: 12px;
}
.fields.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.fields + label,
.form-section > label + label,
.form-section > label + .fields,
.form-section > .fields + .fields {
  margin-top: 12px;
}
.customer-picker {
  margin-bottom: 12px;
}
.item-card {
  border: 1px solid #e5e1e9;
  border-radius: 6px;
  padding: 13px;
  margin-bottom: 12px;
  background: #fff;
}
.item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.item-head > strong {
  font-size: 11px;
  color: #8a7c95;
}
.item-head > .actions {
  margin-left: auto;
  gap: 0;
}
.item-head .icon-btn {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 5px;
}
.item-head .icon-btn svg {
  width: 14px;
  height: 14px;
}
.item-index {
  height: 22px;
  width: 25px;
  display: grid;
  place-items: center;
  background: #f4eef9;
  color: var(--purple);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}
.item-card > label + label,
.item-card > label + .fields {
  margin-top: 10px;
}
.item-card textarea {
  font-size: 11px;
  min-height: 79px;
}
.item-pricing {
  grid-template-columns: 0.7fr 0.8fr 1.3fr 0.8fr;
  gap: 8px;
}
.item-pricing input {
  padding: 8px 6px;
}
.item-extra {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #f0edf4;
}
.item-extra summary {
  font-size: 10px;
  cursor: pointer;
  color: #7d7189;
}
.item-extra summary span {
  float: right;
  font-size: 9px;
  color: #aca4b4;
}
.item-extra .fields {
  margin-top: 12px;
}
.add-item {
  width: 100%;
  border-style: dashed;
  color: var(--purple);
  background: #fcfaff;
}
.editor-total {
  border-top: 1px solid var(--line);
  background: #fcfbfd;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.editor-total > div {
  display: grid;
  gap: 6px;
}
.editor-total > div:last-child {
  text-align: right;
}
.editor-total span {
  font-size: 10px;
  color: var(--muted);
}
.editor-total strong {
  font-size: 20px;
  font-weight: 650;
}
.editor-total > div:last-child strong {
  color: var(--purple);
  font-size: 17px;
}
.preview-panel {
  min-width: 0;
}
.preview-toolbar {
  height: 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 11px;
}
.preview-toolbar > div {
  display: flex;
  gap: 9px;
  align-items: center;
}
.preview-toolbar strong {
  font-size: 11px;
  font-weight: 550;
  color: #665c72;
}
.preview-toolbar .subtle {
  font-size: 10px;
  color: #a098aa;
}
.preview-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
}
.preview-viewport {
  background: #eae9ef;
  border: 1px solid #e1dfe8;
  border-radius: 7px;
  overflow: auto;
  padding: 16px;
  min-width: 0;
  max-height: calc(100vh - 260px);
  scrollbar-width: thin;
  scrollbar-color: #cbc4d4 transparent;
}
#paperStack {
  width: 794px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.invoice-page {
  width: 794px;
  height: 1123px;
  flex-shrink: 0;
  background: #fff;
  color: #28212f;
  padding: 40px 40px 60px;
  position: relative;
  box-shadow: 0 3px 12px #3d2a5620;
  font-family: "Segoe UI", "Leelawadee UI", Arial, sans-serif;
  font-size: 13px;
  overflow: hidden;
  border-top: 6px solid #58218a;
}
.page-content {
  height: 1013px;
  overflow: hidden;
}
.paper-block {
  margin: 0;
  padding: 0;
  display: flow-root;
}
.paper-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  border-bottom: 2px solid #ff640a;
  padding: 0 0 25px;
  margin-bottom: 23px;
}
.paper-brand {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  min-width: 0;
  flex: 1;
}
.paper-brand img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  flex-shrink: 0;
}
.paper-brand > div {
  min-width: 0;
  max-width: 375px;
}
.paper-brand h2 {
  font-size: 21px;
  color: #58218a;
  line-height: 1.45;
  font-weight: 700;
  margin: 0 0 6px;
  overflow-wrap: anywhere;
}
.paper-brand p {
  font-size: 12.5px;
  line-height: 1.5;
  color: #72697a;
  white-space: pre-line;
  margin: 0;
  overflow-wrap: anywhere;
}
.paper-title {
  text-align: right;
  flex-shrink: 0;
}
.paper-title h1 {
  font-size: 31px;
  font-weight: 750;
  color: #58218a;
  margin: 1px 0 10px;
}
.paper-title .badge {
  font-size: 11px;
  padding: 5px 11px;
}
.paper-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 280px);
  gap: 28px;
  margin-bottom: 27px;
}
.paper-label {
  font-size: 12px;
  color: #58218a;
  text-transform: none;
  font-weight: 650;
}
.paper-customer {
  align-self: center;
  border-left: 3px solid #ff640a;
  padding: 4px 0 4px 14px;
  min-width: 0;
}
.paper-customer p:empty { display: none; }
.paper-intro h3 {
  font-size: 22px;
  font-weight: 700;
  margin: 5px 0 6px;
  line-height: 1.3;
  color: #292331;
  overflow-wrap: anywhere;
}
.paper-intro p {
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-line;
  color: #6f6677;
  margin: 0;
  overflow-wrap: anywhere;
}
.paper-intro dl {
  margin: 0;
  padding: 13px 16px;
  background: #f7f4fa;
  border-radius: 5px;
}
.paper-intro dl > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 11px;
  padding: 4px 0;
}
.paper-intro dt {
  color: #84738f;
  flex-shrink: 0;
}
.paper-intro dt small[lang="km"] {
  display: block;
  font-family: "Leelawadee UI", "Khmer UI", "Segoe UI", sans-serif;
  font-size: 9px;
  font-weight: 400;
  line-height: 1.6;
  margin-top: 2px;
}
.paper-intro dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}
.paper-table-wrap {
  margin-bottom: 0;
}
.paper-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 12px;
}
.paper-table th {
  background: #58218a;
  color: #fff;
  font-size: 13px;
  text-align: left;
  font-weight: 700;
  padding: 11px 8px;
}
.paper-table td {
  padding: 13px 8px;
  border-bottom: 1px solid #eae5ef;
  vertical-align: top;
  overflow-wrap: anywhere;
  line-height: 1.45;
}
.paper-table .header-label {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  text-align: center;
  vertical-align: top;
}
.paper-table .header-khmer {
  display: block;
  max-width: 100%;
  margin-top: 4px;
  font-family: "Leelawadee UI", "Khmer UI", "Segoe UI", sans-serif;
  font-size: 9px;
  font-weight: 400;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
.numeric {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}
.paper-table .row-number {
  color: #aaa0b3;
  font-size: 10px;
}
.paper-table strong {
  font-size: 13px;
  font-weight: 650;
}
.paper-spec {
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.6;
  margin: 5px 0 0;
  color: #665c70;
  overflow-wrap: anywhere;
}
.paper-warranty {
  font-size: 10px;
  color: #785694;
  margin: 8px 0 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.line-amount {
  font-weight: 650;
}
.continued {
  font-size: 10px;
  font-weight: 400;
  color: #9984a9;
}
.paper-payment-totals {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 256px;
  gap: 24px;
  padding-top: 26px;
}
.paper-payment {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding-top: 2px;
  min-width: 0;
}
.payment-qr {
  width: 94px;
  height: 114px;
  object-fit: contain;
  flex-shrink: 0;
}
.paper-payment > div {
  min-width: 0;
}
.paper-payment h4,
.paper-notes h4 {
  font-size: 12px;
  font-weight: 650;
  margin: 2px 0 8px;
  color: #4e355f;
}
.paper-payment strong {
  font-size: 13px;
  display: block;
  margin-bottom: 5px;
}
.paper-payment p {
  font-size: 10.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  margin: 0;
  color: #766a7e;
  overflow-wrap: anywhere;
}
.paper-totals {
  margin: 0;
  background: #f7f3fb;
  border-radius: 5px;
  padding: 16px;
}
.paper-totals > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  font-size: 12px;
}
.paper-totals dt {
  color: #7b6a89;
}
.paper-totals dd {
  font-weight: 600;
  margin: 0;
  font-variant-numeric: tabular-nums;
  text-align: right;
  overflow-wrap: anywhere;
}
.paper-totals .total-main {
  padding-top: 12px;
  border-top: 1px solid #e4d9ed;
  margin-top: 10px;
  font-size: 16px;
}
.total-main dt,
.total-main dd {
  color: #58218a;
  font-weight: 750;
}
.paper-totals .total-balance {
  padding-top: 10px;
  border-top: 1px solid #ded1e8;
  margin-top: 10px;
}
.total-balance dd {
  color: #58218a;
  font-weight: 750;
}
.paper-totals .total-paid {
  color: #147152;
  font-size: 12px;
}
.total-paid dt,
.total-paid dd {
  color: #147152;
}
.paper-totals .paper-secondary {
  display: block;
  text-align: right;
  margin: 13px 0 0;
  color: #95859f;
  font-size: 9px;
}
.paper-notes {
  padding-top: 25px;
}
.paper-notes p {
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 11px;
  color: #7b6e84;
  margin: 0;
  overflow-wrap: anywhere;
}
.paper-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 85px;
  row-gap: 0;
  padding-top: 49px;
  margin-bottom: 20px;
  text-align: center;
  color: #9a8ba4;
  font-size: 10px;
}
.paper-signatures span {
  display: block;
  border-top: 1px solid #d9cce2;
  margin-bottom: 9px;
}
.invoice-page.compact-spacing .paper-header {
  padding-bottom: 16px;
  margin-bottom: 16px;
}
.invoice-page.compact-spacing .paper-intro {
  margin-bottom: 18px;
}
.invoice-page.compact-spacing .paper-payment-totals {
  padding-top: 16px;
}
.invoice-page.compact-spacing .paper-notes {
  padding-top: 16px;
}
.invoice-page.compact-spacing .paper-signatures {
  padding-top: 28px;
  margin-bottom: 0;
}
.invoice-page.compact-spacing .paper-signatures.has-seller-mark {
  padding-top: 12px;
}
.paper-signatures:not(.has-seller-mark) .signature-art {
  display: none;
}
.invoice-page.tight-spacing .paper-header {
  padding-bottom: 10px;
  margin-bottom: 12px;
}
.invoice-page.tight-spacing .paper-intro {
  margin-bottom: 12px;
}
.invoice-page.tight-spacing .paper-table td {
  padding-top: 6px;
  padding-bottom: 6px;
}
.invoice-page.tight-spacing .paper-spec {
  line-height: 1.4;
}
.invoice-page.tight-spacing .paper-payment-totals,
.invoice-page.tight-spacing .paper-notes {
  padding-top: 10px;
}
.invoice-page.tight-spacing .paper-notes p {
  line-height: 1.4;
}
.invoice-page.tight-spacing .paper-signatures {
  padding-top: 20px;
}
.invoice-page.tight-spacing .paper-signatures.has-seller-mark {
  padding-top: 8px;
}
.paper-footer {
  position: absolute;
  bottom: 28px;
  left: 40px;
  right: 40px;
  display: flex;
  justify-content: space-between;
  gap: 15px;
  color: #a495ae;
  font-size: 9px;
  border-top: 1px solid #eee8f2;
  padding-top: 12px;
}
.paper-footer > span:first-child {
  max-width: 80%;
  overflow-wrap: anywhere;
}
.preview-expanded {
  overflow: hidden;
}
.preview-expanded .preview-panel {
  position: fixed;
  inset: 0;
  background: #eae9ef;
  z-index: 50;
  padding: 18px 28px;
  display: flex;
  flex-direction: column;
  animation: preview-fade-in 180ms ease-out;
}
.preview-expanded .preview-viewport {
  max-height: none;
  min-height: 0;
  flex: 1;
  border: 0;
  animation: preview-rise-in 220ms ease-out;
}
@keyframes preview-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes preview-rise-in {
  from { transform: translateY(12px); }
  to { transform: translateY(0); }
}
.data-table tr[data-document-row] {
  cursor: pointer;
}
.data-table tr[data-document-row]:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: -2px;
  background: #f4eef9;
}
@media (prefers-reduced-motion: reduce) {
  .preview-expanded .preview-panel,
  .preview-expanded .preview-viewport {
    animation: none;
  }
}
.preview-expanded .preview-toolbar {
  width: 100%;
  max-width: 900px;
  margin: 0 auto 10px;
  height: auto;
  min-height: 44px;
  flex-wrap: wrap;
}
.preview-expanded .preview-toolbar .actions {
  flex-wrap: wrap;
}
.preview-expanded .preview-toolbar strong {
  overflow-wrap: anywhere;
}
.payment-summary {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin: 20px 0 24px;
}
.payment-summary > span {
  font-size: 10px;
  color: var(--muted);
}
.payment-summary strong {
  display: block;
  font-size: 18px;
  font-weight: 650;
  color: var(--ink);
  margin-top: 8px;
  overflow-wrap: anywhere;
}
.green {
  color: var(--green) !important;
}
.payment-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.payment-entry {
  display: flex;
  gap: 11px;
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}
.payment-entry:last-child {
  border: 0;
}
.payment-entry > div:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.payment-entry strong {
  display: block;
  font-size: 13px;
}
.payment-entry span,
.payment-entry small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  overflow-wrap: anywhere;
}
.payment-icon {
  width: 32px;
  height: 32px;
  border-radius: 5px;
  background: #eaf7f0;
  color: var(--green);
  display: grid;
  place-items: center;
}
.payment-entry.voided {
  opacity: 0.55;
}
.payment-entry.voided strong {
  text-decoration: line-through;
}
.notice {
  padding: 15px;
  background: #fff6e9;
  color: #8c6738;
  font-size: 12px;
  line-height: 1.6;
  margin-bottom: 15px;
  border-left: 3px solid #ee9a42;
}
.toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  gap: 15px;
  font-size: 12px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 28px;
  padding: 22px 0;
}
.stats > div {
  padding: 0 25px;
  border-right: 1px solid var(--line);
}
.stats > div:last-child {
  border: 0;
}
.stats span {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  color: #887993;
  margin-bottom: 15px;
}
.stats span svg {
  width: 16px;
  height: 16px;
}
.stats strong {
  display: block;
  font-size: 25px;
  font-weight: 650;
  margin-bottom: 5px;
  overflow-wrap: anywhere;
}
.stats small {
  font-size: 11px;
  color: #a69bad;
}
.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 17px;
}
.list-toolbar select {
  width: 120px;
  font-size: 11px;
}
.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  width: 330px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  padding: 0 12px;
  color: #a294ac;
}
.search-field svg {
  width: 16px;
  height: 16px;
}
.search-field input {
  border: 0;
  box-shadow: none;
  padding: 10px 0;
  background: transparent;
  font-size: 12px;
  min-width: 0;
}
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.data-table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
  min-width: 720px;
  font-size: 12px;
}
.data-table th {
  padding: 14px 18px;
  font-size: 10px;
  font-weight: 600;
  color: #9a8ca5;
  background: #fcfbfd;
  border-bottom: 1px solid var(--line);
}
.data-table td {
  padding: 19px 18px;
  border-bottom: 1px solid #f0ecf3;
  max-width: 300px;
  overflow-wrap: anywhere;
}
.data-table tr:last-child td {
  border-bottom: 0;
}
.data-table tbody tr:hover {
  background: #fdfaff;
}
.data-table strong {
  font-weight: 550;
  font-size: 12px;
}
.data-table small {
  display: block;
  font-size: 10px;
  margin-top: 5px;
  color: #aaa0b1;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.data-table .numeric {
  white-space: nowrap;
}
.list-footer {
  padding: 15px 2px;
  font-size: 11px;
  color: #998da3;
}
.empty {
  padding: 70px 24px;
  text-align: center;
  border-top: 1px solid var(--line);
}
.empty > svg {
  width: 36px;
  height: 36px;
  color: #b2a2bf;
  margin-bottom: 12px;
}
.empty h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 8px 0;
  color: #6a5679;
}
.empty p {
  font-size: 12px;
  color: #a291ae;
  margin-bottom: 22px;
}
.empty.compact {
  padding: 30px 10px;
  border: 0;
}
.empty.compact h3 {
  font-size: 13px;
}
.settings-layout {
  display: grid;
  grid-template-columns: minmax(360px, 680px) minmax(230px, 340px);
  gap: 26px;
}
.settings-layout > div {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.settings-layout > aside {
  background: #fff;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.settings-brand {
  text-align: center;
  padding: 26px;
  border-bottom: 1px solid var(--line);
}
.settings-brand > img {
  width: 96px;
  height: 96px;
}
.settings-brand h2 {
  font-size: 15px;
  margin: 12px 0 7px;
}
.settings-brand p {
  margin: 0;
  color: var(--purple);
}
.brand-swatches {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin-top: 18px;
}
.brand-swatches span {
  width: 23px;
  height: 23px;
  border-radius: 50%;
}
.help {
  font-size: 12px;
  line-height: 1.75;
  color: #8b7a97;
}
.stack-actions {
  display: grid;
  gap: 9px;
  margin-top: 18px;
}
dialog {
  border: 1px solid #e7dfee;
  border-radius: 8px;
  padding: 0;
  width: 460px;
  max-width: calc(100vw - 32px);
  max-height: 90vh;
  box-shadow: 0 24px 80px #1e0b3a40;
  color: var(--ink);
}
dialog::backdrop {
  background: #23183155;
  backdrop-filter: blur(3px);
}
dialog header {
  padding: 18px 23px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
dialog h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
}
#modalBody {
  padding: 22px;
  max-height: 65vh;
  overflow-y: auto;
}
#modalBody > label + label,
#modalBody > .fields + label,
#modalBody > label + .fields {
  margin-top: 14px;
}
dialog footer {
  padding: 16px 22px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  background: #faf8fc;
}
.modal-amount {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  background: #f5effa;
  border-radius: 5px;
  padding: 16px;
  font-size: 12px;
  color: #806190;
}
.modal-amount strong {
  font-size: 22px;
  color: var(--purple);
}
.catalog-row {
  display: flex;
  text-align: left;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 18px 0;
  white-space: normal;
}
.catalog-row > span {
  flex: 1;
  min-width: 0;
}
.catalog-row strong {
  display: block;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.catalog-row small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 5px;
}
.catalog-row b {
  font-size: 12px;
  color: var(--purple);
}
#modalBody > .search-field {
  width: 100%;
  margin-bottom: 10px;
}
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 30px);
  width: max-content;
  background: #302139;
  color: #fff;
  border: 1px solid #594263;
  border-radius: 6px;
  box-shadow: 0 6px 22px #23123026;
  padding: 14px 20px;
  font-size: 12px;
  line-height: 1.6;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 18px;
}
.toast button {
  font-size: 11px;
  min-height: 27px;
  padding: 4px 9px;
  color: white;
  background: #5e4472;
  border: 0;
}
@media (min-width: 1700px) {
  .editor-workspace {
    grid-template-columns: 450px minmax(0, 1fr);
  }
  .preview-viewport {
    padding: 24px;
  }
}
@media (max-width: 1250px) {
  .sidebar {
    width: 185px;
    padding: 24px 10px 14px;
  }
  .brand strong {
    font-size: 22px;
  }
  .brand small {
    font-size: 8px;
  }
  .main-shell {
    margin-left: 185px;
  }
  #main {
    padding: 23px 20px;
  }
  .topbar {
    padding: 0 20px;
  }
  .editor-workspace {
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 16px;
  }
  .page-heading h1 {
    font-size: 24px;
  }
  .page-heading .actions {
    gap: 5px;
  }
  .stats > div {
    padding: 0 17px;
  }
  .stats strong {
    font-size: 23px;
  }
  .form-section {
    padding: 17px;
  }
}
@media (max-width: 1020px) {
  .sidebar {
    width: 68px;
    align-items: center;
    padding: 18px 8px;
  }
  .brand {
    padding: 0 0 28px;
  }
  .brand > span,
  .nav-label,
  .sidebar nav button .count,
  .old-version,
  .local-status {
    display: none;
  }
  .sidebar nav button {
    width: 45px;
    height: 44px;
    font-size: 0;
    gap: 0;
    justify-content: center;
    padding: 10px;
  }
  .sidebar nav button svg {
    width: 20px;
    height: 20px;
  }
  .sidebar-bottom {
    width: 100%;
  }
  .main-shell {
    margin-left: 68px;
  }
  .settings-layout {
    grid-template-columns: minmax(0, 1fr) 280px;
  }
  .editor-workspace {
    grid-template-columns: 350px minmax(0, 1fr);
  }
  .topbar-right {
    gap: 5px;
  }
  .preview-toolbar .subtle {
    display: none;
  }
}
@media (max-width: 800px) {
  .editor-workspace {
    grid-template-columns: 1fr;
  }
  .editor-content {
    max-height: 550px;
  }
  .preview-viewport {
    max-height: none;
  }
  .preview-toolbar .subtle {
    display: block;
  }
  .page-heading h1 {
    font-size: 23px;
  }
  .page-heading {
    align-items: flex-start;
  }
  .page-heading > .actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 230px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
    row-gap: 25px;
  }
  .stats > div:nth-child(2) {
    border: 0;
  }
  .settings-layout {
    grid-template-columns: 1fr;
  }
  .settings-layout > aside {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .settings-brand {
    display: none;
  }
  .data-table {
    min-width: 660px;
  }
  .list-toolbar {
    flex-wrap: wrap;
  }
  .search-field {
    width: 100%;
  }
}
@media (max-width: 520px) {
  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    height: 57px;
    padding: 0 12px;
    flex-direction: row;
    justify-content: space-between;
    border: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand {
    padding: 0;
  }
  .brand img {
    width: 34px;
    height: 34px;
  }
  .sidebar nav {
    display: flex;
    gap: 2px;
  }
  .sidebar nav button {
    width: 42px;
    height: 42px;
    min-height: 42px;
  }
  .sidebar nav button.active {
    box-shadow: inset 0 -2px var(--purple);
    border-radius: 4px;
  }
  .sidebar-bottom {
    padding: 0;
    margin: 0;
    width: auto;
  }
  .main-shell {
    margin: 0;
  }
  .topbar {
    height: 45px;
    padding: 0 15px;
  }
  .breadcrumb {
    font-size: 10px;
  }
  .topbar-right #saveStatus {
    font-size: 9px;
  }
  .topbar-right .icon-btn {
    display: none;
  }
  #main {
    padding: 20px 14px;
  }
  .page-heading {
    display: block;
    margin-bottom: 20px;
  }
  .page-heading h1 {
    font-size: 24px;
  }
  .page-heading > .actions {
    max-width: none;
    justify-content: flex-start;
    margin-top: 16px;
  }
  .editor-tabs {
    padding: 0 7px;
  }
  .editor-content {
    max-height: 540px;
  }
  .form-section {
    padding: 17px;
  }
  .preview-viewport {
    padding: 8px;
    border-radius: 4px;
  }
  .stats {
    padding: 20px 0;
  }
  .stats > div {
    padding: 0 15px;
  }
  .stats strong {
    font-size: 21px;
  }
  .settings-layout > aside {
    display: block;
  }
  .list-toolbar .actions {
    width: 100%;
  }
  .list-toolbar select {
    flex: 1;
  }
  .payment-summary strong {
    font-size: 17px;
  }
  .editor-total strong {
    font-size: 18px;
  }
  .toast {
    font-size: 11px;
    padding: 12px 15px;
  }
  .preview-expanded .preview-panel {
    padding: 10px;
  }
  .item-head > .actions {
    gap: 0;
  }
  .item-extra summary span {
    display: none;
  }
}
.paper-continuation {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  border-bottom: 1px solid #e4d8ed;
  color: #7c5a94;
  font-size: 11px;
  margin-bottom: 19px;
  padding: 0 0 14px;
}
.paper-continuation > span {
  max-width: 45%;
  overflow-wrap: anywhere;
}
.paper-continuation > strong {
  max-width: 52%;
  overflow-wrap: anywhere;
}
@page {
  size: A4;
  margin: 0;
}
@media print {
  .preview-expanded .preview-panel,
  .preview-expanded .preview-viewport {
    animation: none !important;
    transform: none !important;
  }
  body.preview-expanded {
    overflow: visible;
  }
  html,
  body {
    background: #fff;
    margin: 0;
    padding: 0;
    width: auto;
    height: auto;
  }
  .sidebar,
  .topbar,
  .page-heading,
  .edit-panel,
  .preview-toolbar,
  .toast,
  dialog {
    display: none !important;
  }
  .main-shell {
    margin: 0;
  }
  #main {
    padding: 0;
    margin: 0;
    max-width: none;
  }
  .editor-workspace,
  .preview-panel,
  .preview-viewport {
    display: block !important;
    position: static !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    background: white !important;
  }
  #paperStack {
    zoom: 1 !important;
    display: block;
    gap: 0;
    width: 210mm;
    margin: 0;
  }
  .invoice-page {
    width: 794px;
    height: 1123px;
    margin: 0;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
    zoom: 0.999;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  .invoice-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }
}
