:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-strong: #eef1f5;
  --text: #071a3d;
  --text-soft: #5c6470;
  --text-faint: #747d8b;
  --line: #dde3ec;
  --line-strong: #cfd6e5;
  --accent: #553bd4;
  --accent-hover: #4c34c6;
  --accent-soft: #efecfd;
  --brand-aqua: #47e1ed;
  --brand-aqua-strong: #10bed1;
  --brand-aqua-soft: #e9fbfc;
  --brand-yellow: #fff9ae;
  --nav: #553bd4;
  --nav-soft: #644bdd;
  --nav-text: #f6f6fb;
  --danger: #b4232c;
  --danger-soft: #fdebed;
  --warning: #8a5a00;
  --warning-soft: #fff4d9;
  --success: #1c6b4a;
  --success-soft: #e2f4eb;
  --shadow: 0 16px 40px rgb(71 56 146 / 8%);
  --radius-card: 14px;
  --radius-control: 10px;
  --sidebar-width: 246px;
}

* {
  box-sizing: border-box;
}

html {
  font-family: "Aptos", "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background: var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.button.is-disabled {
  pointer-events: none;
  opacity: .62;
}

button,
select,
input,
textarea {
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, transform 120ms ease, box-shadow 150ms ease;
}

button:active {
  transform: translateY(1px);
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent);
  outline-offset: 2px;
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(420px, .85fr);
  min-height: 100dvh;
}

.login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: clamp(32px, 5vw, 72px);
  color: #f7f7fc;
  background:
    radial-gradient(circle at 82% 16%, rgb(71 225 237 / 24%), transparent 28%),
    linear-gradient(145deg, #5e43df 0%, #553bd4 64%, #4c34c6 100%);
}

.login-brand::after {
  position: absolute;
  right: -18%;
  bottom: -32%;
  width: 68%;
  aspect-ratio: 1;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 50%;
  content: "";
}

.brand-lockup {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  color: var(--nav-text);
}

.brand-logo {
  display: block;
  width: 76px;
  height: auto;
  object-fit: contain;
}

.brand-name {
  font-size: 27px;
  font-weight: 800;
  line-height: .68;
  letter-spacing: -2px;
}

.brand-product {
  padding-bottom: 1px;
  color: #78d8df;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.brand-lockup-light .brand-name {
  font-size: clamp(38px, 4vw, 58px);
  letter-spacing: -4px;
}

.brand-lockup-light .brand-logo {
  width: clamp(150px, 18vw, 238px);
}

.brand-lockup-light .brand-product {
  font-size: 14px;
}

.login-copy {
  position: relative;
  z-index: 1;
  max-width: 680px;
}

.login-copy h1 {
  max-width: 620px;
  margin: 12px 0 20px;
  font-size: clamp(46px, 6vw, 82px);
  line-height: .94;
  letter-spacing: -.055em;
}

.login-copy > p:last-child {
  max-width: 520px;
  margin: 0;
  color: rgb(247 247 252 / 74%);
  font-size: clamp(17px, 1.6vw, 22px);
  line-height: 1.45;
}

.login-proof {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.login-proof span,
.demo-chip {
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 999px;
  padding: 7px 11px;
  color: rgb(255 255 255 / 78%);
  font-size: 12px;
  font-weight: 700;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: clamp(28px, 6vw, 96px);
  background: var(--surface);
}

.login-form {
  display: grid;
  width: min(420px, 100%);
  gap: 22px;
}

.login-form h2 {
  margin: 8px 0 8px;
  font-size: 34px;
  letter-spacing: -.035em;
}

.login-note {
  margin: 0;
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.app-shell {
  min-height: 100dvh;
}

.sidebar {
  position: fixed;
  z-index: 20;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  overflow-y: auto;
  padding: 28px 18px 20px;
  color: var(--nav-text);
  background: var(--nav);
}

.sidebar .brand-lockup {
  padding: 0 10px 32px;
}

.main-nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: var(--radius-control);
  padding: 0 13px;
  color: rgb(246 246 251 / 68%);
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 680;
  text-align: left;
}

.nav-item:hover {
  color: var(--nav-text);
  background: rgb(255 255 255 / 7%);
}

.nav-item.is-active {
  color: var(--nav-text);
  background: var(--nav-soft);
  box-shadow: inset 3px 0 #68d4dc;
}

.nav-count {
  display: grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  color: #162b31;
  background: #7bdbe2;
  font-size: 11px;
  font-weight: 800;
}

.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid rgb(255 255 255 / 11%);
  padding: 18px 9px 0;
}

.sidebar-foot p {
  margin: 10px 0 0;
  color: rgb(255 255 255 / 46%);
  font-size: 12px;
}

.workspace {
  min-width: 0;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 12px clamp(20px, 3vw, 44px);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(14px);
}

.topbar h2,
.topbar-context {
  margin: 0;
}

.topbar h2 {
  font-size: 19px;
  letter-spacing: -.02em;
}

.topbar-context {
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-block {
  display: grid;
  min-width: 150px;
  border-left: 1px solid var(--line);
  padding-left: 16px;
}

.user-block strong {
  font-size: 13px;
}

.user-block span {
  color: var(--text-faint);
  font-size: 11px;
}

.view {
  display: none;
  max-width: 1560px;
  margin: 0 auto;
  padding: 36px clamp(20px, 3vw, 44px) 70px;
}

.view.is-active {
  display: block;
  animation: view-in 180ms ease-out;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-heading {
  max-width: 800px;
  margin-bottom: 28px;
}

.page-heading h1 {
  margin: 7px 0 8px;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1;
  letter-spacing: -.048em;
}

.page-heading > p:last-child,
.page-heading > div > p:last-child,
.section-heading p,
.muted {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.5;
}

.heading-with-action {
  display: flex;
  max-width: none;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.kicker {
  margin: 0;
  color: var(--accent);
  font-size: 11px;
  font-weight: 830;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.button,
.icon-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  padding: 0 15px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
}

.button-primary {
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 22%, transparent);
}

.button-primary:hover {
  background: var(--accent-hover);
}

.button-soft {
  border-color: color-mix(in srgb, var(--brand-aqua-strong) 24%, var(--line));
  color: #064d57;
  background: var(--brand-aqua-soft);
}

.button-soft:hover {
  background: #d9f7f9;
}

.button-outline,
.icon-button {
  border-color: var(--line-strong);
  color: var(--text);
  background: var(--surface);
}

.button-outline:hover,
.icon-button:hover,
.button-quiet:hover {
  background: var(--surface-strong);
}

.button-quiet {
  color: var(--text-soft);
  background: transparent;
}

.button-danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.button-small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.button-wide {
  width: 100%;
}

.button:disabled {
  cursor: not-allowed;
  opacity: .48;
  box-shadow: none;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1.35fr repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  margin-bottom: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  display: grid;
  min-height: 154px;
  align-content: space-between;
  border-left: 1px solid var(--line);
  padding: 22px;
}

.metric:first-child {
  border-left: 0;
}

.metric span,
.summary-label {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 720;
}

.metric strong {
  font-family: "Aptos", "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  font-size: clamp(24px, 2.5vw, 36px);
  letter-spacing: -.05em;
}

.metric small {
  color: var(--text-faint);
}

.metric-featured {
  color: #071a3d;
  background: linear-gradient(135deg, #c9f7f9, var(--brand-aqua));
}

.metric-featured span,
.metric-featured small {
  color: rgb(7 26 61 / 68%);
}

.content-grid-wide {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 24px;
  align-items: start;
}

.surface {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.table-surface {
  overflow: hidden;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
}

.section-heading.compact {
  padding: 0 0 20px;
}

.section-heading h3 {
  margin: 0 0 4px;
  font-size: 18px;
  letter-spacing: -.025em;
}

.section-heading p {
  font-size: 13px;
}

.operations-rail {
  overflow: hidden;
  border-radius: var(--radius-card);
  color: #f7f7fb;
  background: var(--nav);
  box-shadow: var(--shadow);
}

.rail-heading {
  display: grid;
  gap: 4px;
  padding: 22px;
  background: var(--nav-soft);
}

.rail-heading span {
  color: rgb(255 255 255 / 56%);
  font-size: 11px;
  text-transform: uppercase;
}

.workflow-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 10px 22px 18px 42px;
}

.workflow-list li {
  padding: 13px 0 13px 6px;
  color: rgb(255 255 255 / 88%);
}

.workflow-list span,
.workflow-list small {
  display: block;
}

.workflow-list span {
  font-weight: 740;
}

.workflow-list small {
  margin-top: 3px;
  color: rgb(255 255 255 / 48%);
}

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

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

th,
td {
  border-top: 1px solid var(--line);
  padding: 13px 16px;
  font-size: 13px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--text-faint);
  background: var(--surface-soft);
  font-size: 10px;
  font-weight: 830;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  color: var(--text-soft);
}

td strong,
.cell-title {
  display: block;
  color: var(--text);
  font-weight: 720;
}

.cell-subtitle {
  display: block;
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 11px;
}

.money {
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--text-soft);
  background: var(--surface-strong);
  font-size: 10px;
  font-weight: 820;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-success {
  color: var(--success);
  background: var(--success-soft);
}

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

.status-demo {
  color: var(--accent);
  background: var(--accent-soft);
}

.status-danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.empty-state {
  padding: 48px 24px;
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 6px;
}

.empty-state p {
  margin: 0;
  color: var(--text-soft);
}

.document-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 24px;
  align-items: start;
}

.document-main,
.settings-grid {
  display: grid;
  gap: 18px;
}

.form-section {
  padding: 24px;
}

.document-status {
  display: grid;
  min-width: 160px;
  border-left: 1px solid var(--line);
  padding-left: 18px;
  text-align: right;
}

.document-status span {
  color: var(--text-faint);
  font-size: 11px;
  text-transform: uppercase;
}

.document-status strong {
  margin-top: 4px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 21px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  margin-bottom: 22px;
  background: var(--surface-soft);
}

.document-type-segmented {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.segmented label {
  position: relative;
  border-left: 1px solid var(--line);
  cursor: pointer;
}

.segmented label:first-child {
  border-left: 0;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  min-height: 44px;
  place-items: center;
  padding: 0 10px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 750;
  text-align: center;
}

.segmented input:checked + span {
  color: #ffffff;
  background: var(--accent);
}

.segmented input:focus-visible + span {
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}

.form-grid {
  display: grid;
  gap: 16px;
}

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

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

.field {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
}

.field > span,
.field > label,
.search-field > span,
.filter-field > span {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 730;
}

.field small {
  color: var(--text-faint);
  font-size: 10px;
  line-height: 1.35;
}

.field-input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.field-input-action .button {
  min-width: 112px;
  padding-inline: 12px;
  white-space: nowrap;
}

.document-lookup-source {
  width: fit-content;
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 720;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.document-lookup-manual-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 12px;
}

.document-lookup-manual-actions .button {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 10px;
}

.document-lookup-result {
  display: grid;
  gap: 3px;
  border: 1px solid #b8e2d1;
  border-radius: 10px;
  padding: 9px 11px;
  color: #176343;
  background: #effaf5;
  font-size: 10px;
  line-height: 1.4;
}

.document-lookup-result[hidden] {
  display: none;
}

.document-lookup-result.is-warning {
  border-color: #f0d69c;
  color: #775517;
  background: #fff9ea;
}

.document-lookup-result strong,
.document-lookup-result span {
  display: block;
}

.required-label::after,
label.field:has(input[required]) > span::after,
label.field:has(select[required]) > span::after,
label.field:has(textarea[required]) > span::after {
  content: " *";
  color: var(--danger);
  font-weight: 850;
}

.required-note {
  margin: 12px 0 0;
  color: var(--text-faint);
  font-size: 11px;
}

.required-note span {
  color: var(--danger);
  font-weight: 850;
}

.document-required-note {
  margin: -22px 0 16px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  padding: 9px 11px;
  color: var(--text);
  background: var(--surface);
}

textarea {
  resize: vertical;
}

#productName {
  min-height: 112px;
  line-height: 1.5;
}

.product-image-field > span {
  display: block;
  margin-bottom: 7px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 760;
}

.product-image-editor {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 12px;
  background: var(--surface-soft);
}

.product-image-preview,
.catalog-product-image {
  display: grid;
  overflow: hidden;
  place-items: center;
  border: 1px solid #dbe3ea;
  border-radius: 12px;
  color: var(--text-faint);
  background: #ffffff;
  font-size: 10px;
}

.product-image-preview {
  width: 116px;
  aspect-ratio: 4 / 3;
}

.catalog-product-image {
  width: 52px;
  height: 52px;
}

.product-image-preview img,
.catalog-product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-image-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.product-image-actions small {
  flex-basis: 100%;
  color: var(--text-faint);
  line-height: 1.45;
}

.product-image-url-field {
  display: grid;
  flex-basis: 100%;
  gap: 6px;
  margin-top: 2px;
}

.product-image-url-field span {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 730;
}

.product-image-picker {
  cursor: pointer;
}

.seller-photo-editor {
  grid-template-columns: 96px minmax(0, 1fr);
}

.seller-photo-preview {
  width: 96px;
  aspect-ratio: 1;
  border-radius: 22px;
  background: linear-gradient(145deg, #effcff, #f5f1ff);
}

.seller-photo-preview img {
  object-fit: cover;
}

.seller-identity {
  display: flex;
  min-width: 220px;
  align-items: center;
  gap: 11px;
}

.seller-avatar {
  display: grid;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  overflow: hidden;
  place-items: center;
  border: 2px solid #d6f8fa;
  border-radius: 15px;
  color: #33228c;
  background: linear-gradient(145deg, #e7fbfd, #eeeaff);
}

.seller-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.seller-avatar b {
  font-size: 17px;
  font-weight: 800;
}

.seller-identity > span:last-child,
.seller-identity strong,
.seller-identity small {
  display: block;
  min-width: 0;
}

.seller-identity small {
  margin-top: 3px;
  color: var(--text-faint);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
  opacity: 1;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.field-span-2 {
  grid-column: span 2;
}

.field-span-3 {
  grid-column: span 3;
}

.align-field {
  align-self: end;
  margin-bottom: 1px;
}

.whatsapp-quick-order {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid #bdeff2;
  border-radius: var(--radius-control);
  margin: -6px 0 20px;
  padding: 13px 14px;
  color: #143b42;
  background: var(--brand-aqua-soft);
}

.whatsapp-quick-order > div {
  display: grid;
  gap: 3px;
}

.whatsapp-quick-order strong {
  font-size: 13px;
}

.whatsapp-quick-order span {
  color: #53636c;
  font-size: 11px;
  line-height: 1.4;
}

.sunat-pdf-import {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: var(--radius-control);
  margin: -8px 0 14px;
  padding: 13px 14px;
  background: linear-gradient(110deg, #f8f6ff, #f0fcfd);
}

.sunat-pdf-import > div,
.pdf-import-heading > div,
.legacy-migration-result {
  display: grid;
  gap: 4px;
}

.sunat-pdf-import strong,
.pdf-import-heading strong,
.legacy-migration-result strong {
  font-size: 13px;
}

.sunat-pdf-import span,
.pdf-import-heading span,
.legacy-migration-result span {
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.45;
}

.pdf-import-panel {
  display: grid;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line));
  border-radius: var(--radius-control);
  margin: 0 0 20px;
  padding: 14px;
  background: #fbfaff;
}

.pdf-import-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.pdf-import-warnings {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.45;
}

.pdf-import-actions,
.legacy-migration-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.payment-account-field legend {
  margin-bottom: 8px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 730;
}

.payment-account-field > small {
  display: block;
  margin-top: 7px;
  color: var(--text-faint);
  font-size: 10px;
}

.payment-account-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 9px;
}

.payment-account-choice {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  padding: 12px;
  background: var(--surface);
  cursor: pointer;
}

.payment-account-choice:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: var(--accent-soft);
  box-shadow: inset 3px 0 var(--accent);
}

.payment-account-choice input {
  width: 17px;
  min-height: 17px;
  margin: 0;
  accent-color: var(--accent);
}

.payment-account-choice > span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.payment-account-choice strong,
.payment-account-choice small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payment-account-choice small {
  color: var(--text-faint);
  font-size: 10px;
}

.payment-account-choice em {
  color: var(--text-faint);
  font-size: 9px;
  font-style: normal;
  font-weight: 780;
  text-transform: uppercase;
}

.payment-account-empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-control);
  padding: 13px;
  color: var(--text-soft);
  font-size: 12px;
}

.client-picker {
  position: relative;
}

.client-picker-results {
  position: absolute;
  z-index: 7;
  inset: 68px 0 auto;
  max-height: 330px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  padding: 6px;
  background: var(--surface);
  box-shadow: 0 18px 36px rgb(71 56 146 / 16%);
}

.client-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  min-height: 52px;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.client-result:hover,
.client-result:focus-visible {
  background: var(--accent-soft);
}

.client-result span:first-child,
.client-result strong,
.client-result small {
  display: block;
}

.client-result small,
.client-result-document {
  color: var(--text-faint);
  font-size: 11px;
}

.client-result-document {
  font-family: inherit;
  white-space: nowrap;
}

.client-result-empty {
  display: grid;
  gap: 4px;
  padding: 14px;
  color: var(--text-soft);
  font-size: 12px;
}

.line-items {
  display: grid;
  gap: 12px;
}

.line-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(170px, 1.3fr) 82px 110px 118px 118px 112px 42px;
  gap: 10px;
  align-items: end;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.line-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.line-item .field > span {
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.line-secondary {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) 190px 190px;
  gap: 10px;
  margin-top: -2px;
}

.line-description-field {
  grid-column: 1 / -1;
}

.line-description {
  min-height: 72px;
  resize: vertical;
}

.line-amount {
  display: grid;
  min-height: 42px;
  align-items: center;
  border-radius: var(--radius-control);
  padding: 0 10px;
  color: var(--text);
  background: var(--surface-strong);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 700;
}

.remove-line {
  display: grid;
  width: 42px;
  min-height: 42px;
  place-items: center;
  border: 0;
  border-radius: var(--radius-control);
  color: var(--danger);
  background: var(--danger-soft);
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
}

.document-summary {
  position: sticky;
  top: 100px;
  display: grid;
  gap: 22px;
  padding: 24px;
}

.document-summary > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.document-summary > div:first-child strong {
  color: var(--accent);
  font-size: 12px;
}

.document-summary dl {
  display: grid;
  gap: 13px;
  margin: 0;
}

.document-summary dl > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.document-summary dt {
  color: var(--text-soft);
  font-size: 13px;
}

.document-summary dd {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  font-weight: 700;
}

.document-summary .summary-total {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  color: var(--text);
}

.document-summary .summary-total dt,
.document-summary .summary-total dd {
  color: var(--text);
  font-size: 19px;
  font-weight: 830;
}

.tax-note,
.info-callout {
  border-radius: var(--radius-control);
  padding: 13px;
  color: var(--accent);
  background: var(--accent-soft);
}

.tax-note p {
  margin: 5px 0 0;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.45;
}

.shipping-fields {
  display: grid;
  gap: 18px;
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 22px;
}

.info-callout {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}

.info-callout span {
  color: var(--text-soft);
}

.form-error {
  margin: 0;
  border-radius: var(--radius-control);
  padding: 10px 12px;
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 12px;
  line-height: 1.45;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
}

.search-field {
  display: grid;
  width: min(360px, 100%);
  gap: 6px;
}

.documents-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(170px, 220px) auto;
}

.documents-toolbar .search-field {
  width: 100%;
}

.filter-field {
  display: grid;
  gap: 6px;
}

.documents-toolbar .toolbar-count {
  align-self: center;
  justify-self: end;
}

.document-mode-note {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--brand-aqua-strong) 28%, var(--line));
  border-radius: var(--radius-control);
  margin: -6px 0 18px;
  padding: 12px 14px;
  color: #174b55;
  background: var(--brand-aqua-soft);
  font-size: 12px;
}

.document-mode-note span {
  color: #53636c;
}

.document-row-actions {
  justify-content: flex-start;
  min-width: 220px;
}

.toolbar-count {
  color: var(--text-faint);
  font-size: 12px;
}

.settings-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
  align-items: start;
}

.audit-panel {
  grid-column: 1 / -1;
}

.sunat-panel {
  grid-column: 1 / -1;
}

.legacy-migration-panel {
  grid-column: 1 / -1;
}

.legacy-migration-panel > p {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.55;
}

.legacy-migration-panel > small {
  color: var(--text-faint);
  font-size: 10px;
  line-height: 1.5;
}

.legacy-migration-result {
  border-left: 4px solid var(--brand-aqua-strong);
  border-radius: 8px;
  padding: 11px 12px;
  background: var(--brand-aqua-soft);
}

.sunat-flow-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.sunat-flow-list > div {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 15px;
  background: var(--surface-soft);
}

.sunat-flow-list strong {
  color: var(--text);
  font-size: 13px;
}

.sunat-flow-list span,
.sunat-panel-note {
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
}

.sunat-panel-note {
  margin: 14px 0 0;
}

.bank-list,
.audit-list {
  display: grid;
  gap: 10px;
}

.bank-row,
.audit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-radius: var(--radius-control);
  padding: 13px;
  background: var(--surface-soft);
}

.bank-row strong,
.bank-row span,
.audit-row strong,
.audit-row span {
  display: block;
}

.bank-row span,
.audit-row span {
  margin-top: 3px;
  color: var(--text-faint);
  font-size: 11px;
}

.bank-row.is-muted {
  opacity: 0.64;
}

.audit-row time {
  color: var(--text-faint);
  font-size: 11px;
  white-space: nowrap;
}

.modal {
  width: min(760px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  border: 0;
  border-radius: var(--radius-card);
  padding: 0;
  color: var(--text);
  background: transparent;
  box-shadow: 0 26px 90px rgb(10 15 24 / 30%);
}

.modal::backdrop {
  background: rgb(12 17 24 / 58%);
  backdrop-filter: blur(4px);
}

.modal-card {
  overflow: auto;
  max-height: calc(100dvh - 28px);
  border-radius: var(--radius-card);
  padding: 24px;
  background: var(--surface);
}

.modal-card-small {
  max-width: 620px;
}

.modal-card > header,
.modal-card > footer,
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.modal-card > header h2 {
  margin: 5px 0 0;
  font-size: 25px;
  letter-spacing: -.03em;
}

.modal-card > footer {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 18px;
  justify-content: flex-end;
}

.modal-document-review {
  width: min(1040px, calc(100vw - 28px));
}

.document-review-card {
  padding: 0;
}

.document-review-card > header,
.document-review-card > footer,
.document-review-card > .form-error {
  margin-right: 24px;
  margin-left: 24px;
}

.document-review-card > header {
  position: sticky;
  z-index: 2;
  top: 0;
  border-bottom: 1px solid var(--line);
  padding: 22px 0 18px;
  background: var(--surface);
}

.document-review-card > footer {
  position: sticky;
  z-index: 2;
  bottom: 0;
  margin-top: 0;
  padding: 16px 0 22px;
  background: var(--surface);
}

.document-review-body {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 20px 24px 24px;
  background: var(--surface-soft);
}

.document-review-notice,
.shipment-edit-note {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  padding: 13px 15px;
  background: var(--surface);
}

.document-review-notice strong,
.shipment-edit-note strong {
  font-size: 13px;
}

.document-review-notice span,
.shipment-edit-note span {
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
}

.document-review-notice.is-locking {
  border-color: color-mix(in srgb, var(--warning) 42%, var(--line));
  background: var(--warning-soft);
}

.document-review-notice.is-editable,
.shipment-edit-note {
  border-color: color-mix(in srgb, var(--brand-aqua-strong) 35%, var(--line));
  background: var(--brand-aqua-soft);
}

.document-review-preview {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.review-document-heading {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, .6fr);
  border-bottom: 5px solid var(--brand-aqua);
  color: #ffffff;
  background: var(--accent);
}

.review-document-heading > div {
  display: grid;
  min-width: 0;
  gap: 3px;
  padding: 17px 20px;
}

.review-document-heading > div:last-child {
  border-left: 1px solid rgb(255 255 255 / 22%);
  text-align: right;
}

.review-document-heading span,
.review-document-heading small {
  color: rgb(255 255 255 / 76%);
  font-size: 10px;
}

.review-document-heading strong {
  overflow-wrap: anywhere;
  font-size: 18px;
}

.review-information-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.review-information-grid > div {
  display: grid;
  min-width: 0;
  gap: 4px;
  padding: 14px 18px;
}

.review-information-grid > div:nth-child(even) {
  border-left: 1px solid var(--line);
}

.review-information-grid > div:nth-child(n + 3) {
  border-top: 1px solid var(--line);
}

.review-information-grid span,
.review-notes > span {
  color: var(--text-faint);
  font-size: 9px;
  font-weight: 820;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.review-information-grid strong,
.review-information-grid small {
  overflow-wrap: anywhere;
}

.review-information-grid strong {
  font-size: 13px;
}

.review-information-grid small {
  color: var(--text-soft);
  font-size: 11px;
}

.review-items-section {
  padding: 17px 18px 0;
}

.review-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 10px;
}

.review-section-title span {
  color: var(--text-faint);
  font-size: 11px;
}

.review-items-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
}

.review-item {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .55fr);
  min-width: 0;
  padding: 13px 14px;
}

.review-item + .review-item {
  border-top: 1px solid var(--line);
}

.review-item > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.review-item > div span,
.review-item > div small {
  color: var(--text-faint);
  font-size: 10px;
}

.review-item > div strong {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.review-item dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}

.review-item dl > div {
  display: grid;
  align-content: center;
  gap: 3px;
  text-align: right;
}

.review-item dt {
  color: var(--text-faint);
  font-size: 9px;
}

.review-item dd {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
}

.review-totals-and-notes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, .5fr);
  gap: 18px;
  padding: 18px;
}

.review-notes p {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.5;
}

.review-notes ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--warning);
  font-size: 11px;
  line-height: 1.45;
}

.review-totals {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  margin: 0;
}

.review-totals > div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 12px;
}

.review-totals > div + div {
  border-top: 1px solid var(--line);
}

.review-totals dt,
.review-totals dd {
  margin: 0;
  font-size: 12px;
}

.review-totals dd {
  font-weight: 820;
}

.review-totals > div:last-child {
  color: var(--accent);
  background: var(--accent-soft);
}

.review-totals > div:last-child dt,
.review-totals > div:last-child dd {
  font-size: 15px;
  font-weight: 900;
}

.shipment-edit-body {
  display: grid;
  gap: 18px;
}

.modal-body {
  margin-top: 22px;
}

.conversion-dialog-body {
  display: grid;
  gap: 18px;
}

.conversion-source-summary {
  display: grid;
  grid-template-columns: .8fr 1.5fr .8fr;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--surface-soft);
}

.conversion-source-summary > div {
  display: grid;
  min-width: 0;
  gap: 4px;
  padding: 14px 16px;
}

.conversion-source-summary > div + div {
  border-left: 1px solid var(--line);
}

.conversion-source-summary span {
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 750;
}

.conversion-source-summary strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversion-impact {
  border-left: 4px solid var(--brand-aqua-strong);
  border-radius: var(--radius-control);
  padding: 15px 16px;
  color: #173d45;
  background: var(--brand-aqua-soft);
}

.conversion-impact strong,
.conversion-impact p {
  display: block;
}

.conversion-impact p {
  margin: 6px 0 0;
  color: #426067;
  font-size: 12px;
  line-height: 1.5;
}

.conversion-type-hint {
  min-height: 18px;
  margin: -8px 0 0;
  color: var(--text-soft);
  font-size: 12px;
}

.conversion-type-hint.is-warning {
  color: var(--warning);
}

.cancellation-dialog-body {
  display: grid;
  gap: 18px;
}

.cancellation-source-summary {
  display: grid;
  grid-template-columns: .8fr 1.5fr .8fr;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--danger) 24%, var(--line));
  border-radius: var(--radius-control);
  background: #fffafa;
}

.cancellation-source-summary > div {
  display: grid;
  min-width: 0;
  gap: 4px;
  padding: 14px 16px;
}

.cancellation-source-summary > div + div {
  border-left: 1px solid var(--line);
}

.cancellation-source-summary span {
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 750;
}

.cancellation-source-summary strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cancellation-impact {
  border-left: 4px solid var(--danger);
  border-radius: var(--radius-control);
  padding: 15px 16px;
  color: #5b171d;
  background: var(--danger-soft);
}

.cancellation-impact p {
  margin: 6px 0 0;
  color: #71343a;
  font-size: 12px;
  line-height: 1.5;
}

.cancellation-payment-warning {
  margin: 0;
  border: 1px solid #e9ce8b;
  border-radius: var(--radius-control);
  padding: 12px 14px;
  color: var(--warning);
  background: var(--warning-soft);
  font-size: 12px;
  line-height: 1.5;
}

.preview-modal {
  width: min(1120px, calc(100vw - 24px));
}

.preview-shell {
  overflow: auto;
  max-height: calc(100dvh - 24px);
  border-radius: var(--radius-card);
  background: var(--bg);
}

.preview-toolbar {
  position: sticky;
  z-index: 2;
  top: 0;
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  background: var(--surface);
}

.preview-toolbar > div {
  display: flex;
  gap: 8px;
  align-items: center;
}

.preview-toolbar span {
  color: var(--text-faint);
  font-size: 12px;
}

.document-preview {
  width: min(820px, calc(100% - 32px));
  min-height: 1050px;
  margin: 24px auto;
  padding: 42px;
  color: #202b35;
  background: #ffffff;
  box-shadow: 0 14px 50px rgb(32 46 58 / 14%);
}

.receipt-cancelled {
  border: 2px solid color-mix(in srgb, var(--danger) 58%, #ffffff);
}

.receipt-cancellation-banner {
  display: grid;
  gap: 4px;
  margin: -20px 0 22px;
  border: 2px solid var(--danger);
  border-radius: 12px;
  padding: 14px 18px;
  color: #6c141c;
  background: #fff1f2;
  text-align: center;
}

.receipt-cancellation-banner strong {
  font-size: 18px;
  letter-spacing: .07em;
}

.receipt-cancellation-banner span {
  font-size: 13px;
  font-weight: 700;
}

.receipt-cancellation-banner small {
  color: #8b4a50;
  font-size: 11px;
}

.receipt-head {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 28px;
  align-items: start;
  border-bottom: 4px solid #087b87;
  padding-bottom: 22px;
}

.receipt-brand {
  color: #242044;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -.05em;
}

.receipt-brand span {
  color: #087b87;
}

.receipt-company {
  display: grid;
  gap: 4px;
  margin-top: 13px;
  color: #596671;
  font-size: 12px;
}

.receipt-box {
  border: 2px solid #242044;
  border-radius: 10px;
  padding: 15px;
  text-align: center;
}

.receipt-box strong,
.receipt-box span {
  display: block;
}

.receipt-box strong {
  margin: 7px 0;
  font-size: 17px;
}

.receipt-box span {
  color: #596671;
  font-family: Arial, Helvetica, sans-serif;
}

.demo-watermark {
  margin-top: 10px;
  border-radius: 7px;
  padding: 7px;
  color: #8a5a00;
  background: #fff4d9;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.receipt-info {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 22px;
  margin: 26px 0;
}

.receipt-info dl,
.receipt-totals dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.receipt-info dl > div,
.receipt-totals dl > div {
  display: grid;
  grid-template-columns: 125px 1fr;
  gap: 10px;
}

.receipt-info dt,
.receipt-totals dt {
  color: #77828b;
  font-size: 11px;
}

.receipt-info dd,
.receipt-totals dd {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
}

.receipt-table th {
  border-color: #dfe4e8;
  color: #53616c;
  background: #f2f4f6;
}

.receipt-table td {
  border-color: #e6e9ec;
  color: #53616c;
}

.receipt-table .money {
  color: #202b35;
}

.receipt-totals {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 28px;
  margin-top: 24px;
}

.receipt-totals dl > div {
  grid-template-columns: 1fr 110px;
  border-bottom: 1px solid #e7eaed;
  padding-bottom: 8px;
}

.receipt-totals .grand-total dt,
.receipt-totals .grand-total dd {
  color: #202b35;
  font-size: 16px;
}

.receipt-notes {
  color: #66737d;
  font-size: 11px;
  line-height: 1.55;
}

.receipt-footer {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  border-top: 1px solid #dde2e6;
  margin-top: 28px;
  padding-top: 18px;
  color: #66737d;
  font-size: 10px;
  line-height: 1.5;
}

.shipment-ticket {
  margin-top: 28px;
  border: 2px dashed #087b87;
  border-radius: 10px;
  padding: 18px;
}

.shipment-ticket header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.shipment-ticket h3,
.shipment-ticket p {
  margin: 0;
}

.shipment-ticket h3 {
  font-size: 16px;
}

.shipment-ticket p {
  margin-top: 4px;
  color: #65727d;
  font-size: 11px;
}

.shipment-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.shipment-grid div {
  border-radius: 8px;
  padding: 10px;
  background: #f3f6f7;
}

.shipment-grid span,
.shipment-grid strong {
  display: block;
}

.shipment-grid span {
  color: #77828b;
  font-size: 9px;
  text-transform: uppercase;
}

.shipment-grid strong {
  margin-top: 4px;
  font-size: 11px;
}

/* NanoLoo brand refresh and non-blocking document flow */
.sidebar {
  background:
    radial-gradient(circle at 10% 0%, rgb(71 225 237 / 16%), transparent 24%),
    linear-gradient(180deg, #5e43df 0%, #553bd4 58%, #4c34c6 100%);
}

.brand-product {
  color: var(--brand-aqua);
}

.sidebar .brand-lockup {
  align-items: center;
}

.sidebar .brand-product {
  color: var(--brand-yellow);
}

.nav-item.is-active {
  color: #071a3d;
  background: var(--brand-aqua);
  box-shadow: none;
}

.nav-item:hover:not(.is-active) {
  background: rgb(255 255 255 / 12%);
}

.nav-count {
  color: #071a3d;
  background: var(--brand-yellow);
}

.section-actions,
.summary-actions,
.preview-toolbar-start,
.preview-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.document-summary {
  position: static;
  top: auto;
  display: grid;
  grid-template-columns: 130px minmax(330px, 1fr) minmax(170px, .55fr) minmax(220px, 260px);
  align-items: center;
  gap: 18px;
  padding: 18px 22px;
}

.document-summary dl {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
}

.document-summary dl > div {
  display: grid;
  gap: 4px;
  border-left: 1px solid var(--line);
  padding: 2px 18px;
}

.document-summary .summary-total {
  border-top: 0;
  padding-top: 2px;
}

.document-summary .tax-note {
  padding: 11px 13px;
}

.document-summary .form-error {
  grid-column: 1 / -1;
}

.summary-actions {
  display: grid;
}

.same-client-option {
  display: flex;
  width: fit-content;
  max-width: 100%;
  align-items: flex-start;
  gap: 11px;
  border: 1px solid #bdeff2;
  border-radius: var(--radius-control);
  padding: 12px 14px;
  color: #143b42;
  background: var(--brand-aqua-soft);
  cursor: pointer;
}

.same-client-option input {
  width: 18px;
  min-height: 18px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.same-client-option span,
.same-client-option small {
  display: block;
}

.payment-received-option {
  width: auto;
}

.payment-received-option:has(input:checked) {
  border-color: #a8ddc5;
  color: #164b36;
  background: #effaf5;
  box-shadow: inset 4px 0 #35a36f;
}

.same-client-option small {
  margin-top: 3px;
  color: #53636c;
  font-size: 11px;
  line-height: 1.4;
}

.preview-view {
  max-width: 1480px;
}

.preview-page-toolbar {
  position: sticky;
  z-index: 6;
  top: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 12px 14px;
}

.preview-toolbar-start > div {
  display: grid;
  gap: 2px;
}

.preview-toolbar-start span {
  color: var(--text-faint);
  font-size: 11px;
}

.preview-tabs {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--surface-soft);
}

.preview-tabs button {
  min-height: 38px;
  border: 0;
  border-left: 1px solid var(--line);
  padding: 0 13px;
  color: var(--text-soft);
  background: transparent;
  cursor: pointer;
  font-weight: 750;
  white-space: nowrap;
}

.preview-tabs button:first-child {
  border-left: 0;
}

.preview-tabs button.is-active {
  color: #ffffff;
  background: var(--accent);
}

.preview-stage {
  overflow: auto;
  border-radius: var(--radius-card);
  padding: clamp(14px, 3vw, 36px);
  background: #e9ecf3;
}

.preview-pane {
  width: 100%;
}

.document-preview,
.shipping-label-preview {
  width: min(900px, 100%);
  margin: 0 auto;
  color: #20242a;
  font-family: Arial, Helvetica, sans-serif;
  font-synthesis: none;
  font-variant-numeric: proportional-nums;
  font-feature-settings: "zero" 0;
  background: #ffffff;
  box-shadow: 0 18px 55px rgb(54 47 105 / 14%);
}

.document-preview,
.document-preview * {
  font-family: Arial, Helvetica, sans-serif;
}

.payment-summary-preview {
  font-family: Arial, Helvetica, sans-serif;
  font-synthesis: none;
  font-variant-numeric: proportional-nums;
  font-feature-settings: "zero" 0;
}

.document-preview {
  min-height: 1120px;
  padding: clamp(22px, 4vw, 48px);
}

.receipt-head {
  display: flex;
  min-height: 150px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin: calc(clamp(22px, 4vw, 48px) * -1) calc(clamp(22px, 4vw, 48px) * -1) 0;
  border: 0;
  border-radius: 16px 16px 0 0;
  padding: 24px clamp(22px, 4vw, 48px);
  color: #ffffff;
  background: linear-gradient(135deg, #5e43df 0%, #553bd4 65%, #4c34c6 100%);
}

.receipt-logo {
  width: 164px;
  height: auto;
}

.receipt-company {
  display: grid;
  gap: 3px;
  margin: 0;
  color: rgb(255 255 255 / 82%);
  font-size: 11px;
  line-height: 1.35;
  text-align: right;
}

.receipt-company strong {
  color: #ffffff;
  font-size: 15px;
}

.receipt-company span:nth-of-type(2) {
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.receipt-aqua-rule {
  height: 12px;
  margin: 0 calc(clamp(22px, 4vw, 48px) * -1);
  background: #47e1ed;
}

.receipt-title {
  display: grid;
  place-items: center;
  gap: 5px;
  padding: 28px 0 22px;
  text-align: center;
}

.receipt-title h2 {
  margin: 0;
  color: #2dd8e5;
  font-size: clamp(20px, 3vw, 28px);
  letter-spacing: .01em;
}

.receipt-title strong {
  color: var(--accent);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
}

.receipt-title span {
  color: #6b7280;
  font-size: 11px;
}

.receipt-draft-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #ead99f;
  border-radius: 12px;
  margin: 0 0 18px;
  padding: 11px 14px;
  color: #6f5710;
  background: #fff9e8;
  font-size: 11px;
  line-height: 1.45;
}

.receipt-draft-banner strong {
  white-space: nowrap;
}

.receipt-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 0 0 24px;
}

.receipt-info-card {
  overflow: hidden;
  border: 1px solid #d7dee8;
  border-radius: 14px;
  background: #fafbfd;
}

.receipt-info-card h3 {
  margin: 0;
  padding: 12px 15px;
  color: #334155;
  background: #eef2f6;
  font-size: 13px;
}

.receipt-info dl {
  gap: 0;
}

.receipt-info dl > div {
  grid-template-columns: 104px 1fr;
  border-top: 1px solid #e9eef4;
  padding: 10px 15px;
}

.receipt-info dl > div:first-child {
  border-top: 0;
}

.receipt-info-card dt {
  color: #53565c;
  font-weight: 750;
}

.receipt-info-card dd {
  color: #30343a;
}

.receipt-table-wrap {
  overflow-x: auto;
  border: 1px solid #d7dee8;
  border-radius: 14px;
}

.receipt-table {
  min-width: 760px;
  table-layout: fixed;
}

.receipt-table th {
  border-color: #d7dee8;
  color: #4d5662;
  background: #eef2f6;
  text-align: center;
}

.receipt-table th:nth-child(1),
.receipt-table td:nth-child(1) { width: 10%; }
.receipt-table th:nth-child(2),
.receipt-table td:nth-child(2) { width: 33%; }
.receipt-table th:nth-child(3),
.receipt-table td:nth-child(3) { width: 9%; }
.receipt-table th:nth-child(4),
.receipt-table td:nth-child(4) { width: 11%; }
.receipt-table th:nth-child(5),
.receipt-table td:nth-child(5) { width: 7%; }
.receipt-table th:nth-child(6),
.receipt-table td:nth-child(6) { width: 15%; }
.receipt-table th:nth-child(7),
.receipt-table td:nth-child(7) { width: 15%; }

.receipt-table td {
  padding: 12px 9px;
  text-align: center;
}

.receipt-table .receipt-description {
  text-align: left;
}

.receipt-product-image {
  min-height: 46px;
  background: #fbfcfe;
}

.receipt-product-image img {
  display: block;
  width: 62px;
  height: 54px;
  margin: 0 auto;
  object-fit: contain;
}

.receipt-product-image span {
  color: #9aa4b2;
  font-size: 8px;
}

.receipt-warranty,
.receipt-code,
.receipt-quantity {
  color: #4e5866;
  font-weight: 650;
}

.receipt-line-total strong {
  color: #071a3d;
  font-weight: 850;
}

.receipt-item-meta {
  display: block;
  margin-top: 4px;
  color: #687386;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
}

.receipt-summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(265px, 330px);
  gap: 14px;
  align-items: start;
  margin-top: 18px;
}

.receipt-total-card {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid #d7dee8;
  border-radius: 12px;
  margin: 0;
}

.receipt-total-card > div {
  display: grid;
  grid-template-columns: 1fr 116px;
  gap: 12px;
  border-bottom: 1px solid #d7dee8;
  padding: 10px 13px;
}

.receipt-total-card > div:last-child {
  border-bottom: 0;
  background: #f5f8ff;
}

.receipt-total-card dt,
.receipt-total-card dd {
  margin: 0;
  color: #071a3d;
  font-size: 12px;
  font-weight: 760;
  text-align: right;
}

.receipt-total-card .grand-total dt,
.receipt-total-card .grand-total dd {
  font-size: 16px;
  font-weight: 900;
}

.receipt-conditions {
  border-left: 6px solid var(--brand-aqua);
  border-radius: 12px;
  padding: 14px 16px;
  color: #46505c;
  background: #f2fbfc;
  font-size: 11px;
  line-height: 1.5;
}

.receipt-conditions strong {
  color: #071a3d;
  font-size: 12px;
}

.receipt-conditions p {
  display: inline;
  margin: 0 0 0 4px;
}

.receipt-payment {
  margin-top: 22px;
  border-left: 6px solid #8cddea;
  border-radius: 14px;
  padding: 18px;
  background: #f3f5f7;
}

.receipt-payment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.receipt-payment-head h3,
.receipt-payment-head span {
  display: block;
}

.receipt-payment-head h3 {
  margin: 0 0 3px;
  color: #071a3d;
  font-size: 20px;
}

.receipt-payment-head span {
  color: #667085;
  font-size: 11px;
}

.receipt-brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #d4dce7;
  border-radius: 999px;
  padding: 8px 13px;
  color: #071a3d;
  background: #ffffff;
  font-size: 11px;
  white-space: nowrap;
}

.receipt-brand-pill i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand-aqua);
}

.receipt-payment-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(220px, .8fr);
  gap: 14px;
}

.receipt-payment-grid.is-contact-only {
  grid-template-columns: minmax(260px, 520px);
  justify-content: end;
}

.receipt-payment-grid.is-paid {
  grid-template-columns: minmax(210px, .78fr) minmax(0, 1.22fr);
  align-items: stretch;
}

.receipt-paid-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 7px;
  border: 1px solid #a9dec8;
  border-radius: 12px;
  padding: 15px;
  color: #123d2d;
  background: #eefaf5;
}

.receipt-paid-badge {
  display: inline-flex !important;
  width: max-content;
  max-width: 100%;
  align-items: center;
  border: 1px solid #9fd6bc;
  border-radius: 999px;
  padding: 4px 9px;
  color: #176c49 !important;
  background: #dff4e9;
  font-size: 9px !important;
  font-weight: 900 !important;
  letter-spacing: .08em !important;
  line-height: 1;
}

.receipt-paid-card > div {
  min-width: 0;
}

.receipt-paid-card span,
.receipt-paid-card h4,
.receipt-paid-card p {
  display: block;
  margin: 0;
}

.receipt-paid-card span {
  color: #4d6b60;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.receipt-paid-card h4 {
  margin-top: 2px;
  font-size: 16px;
}

.receipt-paid-card p {
  margin-top: 2px;
  color: #4d6b60;
  font-size: 11px;
}

.receipt-paid-card > strong {
  overflow-wrap: anywhere;
  color: #176c49;
  font-size: 17px;
}

.receipt-payment-state {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  border: 1px solid #d6dce7;
  border-radius: 12px;
  padding: 14px;
  color: #384250;
  background: #fff;
}

.receipt-payment-state > span {
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .07em;
}

.receipt-payment-state > div {
  min-width: 0;
}

.receipt-payment-state small,
.receipt-payment-state h4,
.receipt-payment-state p {
  display: block;
  margin: 0;
}

.receipt-payment-state small {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.receipt-payment-state h4 {
  margin-top: 2px;
  font-size: 15px;
}

.receipt-payment-state p {
  margin-top: 2px;
  color: #667085;
  font-size: 10px;
}

.receipt-payment-state > strong {
  overflow-wrap: anywhere;
  font-size: 17px;
}

.receipt-payment-state.is-advance {
  border-color: #ead38e;
  color: #704d00;
  background: #fff9e9;
}

.receipt-payment-state.is-pending {
  border-color: #cfd5df;
  color: #4b5563;
  background: #f8f9fb;
}

.receipt-payment-state.is-refunded {
  border-color: #e3b4b8;
  color: #9d3038;
  background: #fff3f4;
}

.payment-summary-total.is-paid {
  background: #23865c;
}

.receipt-account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
  gap: 12px;
}

.receipt-pay-card,
.receipt-contact-card {
  min-width: 0;
  border: 1px solid #d7dee7;
  border-radius: 12px;
  padding: 15px;
  background: #ffffff;
  font-size: 11px;
  line-height: 1.55;
}

.receipt-bank-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.receipt-bank-heading h4,
.receipt-contact-card h4 {
  margin: 0;
  color: #071a3d;
  font-size: 15px;
}

.receipt-bank-badge {
  display: inline-grid;
  min-width: 42px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  padding: 0 7px;
  color: #fff16a;
  background: #3153e8;
  font-size: 9px;
  font-weight: 900;
}

.receipt-bank-badge.is-wallet {
  color: #ffffff;
  background: #6a35d2;
}

.receipt-bank-logo,
.payment-bank-logo {
  display: block;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  object-fit: contain;
}

.payment-bank-title {
  display: flex;
  gap: 11px;
  align-items: center;
}

.payment-bank-title > div {
  display: grid;
  gap: 4px;
}

.payment-bank-title span {
  color: #6b7280;
  font-size: 10px;
  font-weight: 820;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.payment-bank-title strong {
  font-size: 16px;
}

.receipt-pay-data {
  display: grid;
  gap: 6px;
  margin: 0;
}

.receipt-pay-data > div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
}

.receipt-pay-data dt,
.receipt-pay-data dd {
  margin: 0;
}

.receipt-pay-data dt {
  color: #667085;
  font-weight: 700;
}

.receipt-pay-data dd {
  overflow-wrap: anywhere;
  color: #071a3d;
  font-weight: 820;
}

.receipt-contact-card h4 {
  margin-bottom: 11px;
}

.receipt-contact-list {
  display: grid;
  gap: 10px;
}

.receipt-contact-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
}

.receipt-contact-row > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.receipt-contact-row strong,
.receipt-contact-row span {
  display: block;
}

.receipt-contact-row span {
  overflow-wrap: anywhere;
  color: #566172;
}

.receipt-contact-icon {
  display: grid !important;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  color: #5335d4 !important;
  background: #f0f3f8;
}

.receipt-contact-icon img {
  display: block;
  width: 17px;
  height: 17px;
  object-fit: contain;
}

.receipt-contact-web {
  margin-top: 10px !important;
}

.receipt-contact-card p {
  margin: 4px 0;
  color: #566172;
  overflow-wrap: anywhere;
}

.receipt-contact-card strong {
  color: #071a3d;
}

.receipt-footer {
  color: #59606d;
}

.receipt-web-footer {
  display: grid;
  justify-items: center;
  gap: 13px;
  margin-top: 28px;
  padding: 22px 12px 4px;
  color: #30343a;
  text-align: center;
}

.receipt-web-footer p {
  margin: 0;
  font-size: 13px;
}

.receipt-web-footer p a,
.receipt-terms-link {
  color: #2dd8e5;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.receipt-terms-link {
  font-size: 13px;
}

.receipt-social-links {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: center;
}

.receipt-social {
  position: relative;
  display: block;
  width: 15px;
  height: 15px;
  text-decoration: none !important;
}

.receipt-social img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.payment-summary-preview {
  width: min(760px, 100%);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid #e2e7f0;
  border-radius: 24px;
  color: #0b1c42;
  background: #f7f8fc;
  box-shadow: 0 24px 70px rgb(45 35 100 / 16%);
}

.payment-summary-head {
  display: flex;
  min-height: 156px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border-bottom: 9px solid #47e1ed;
  padding: 26px 34px;
  color: #ffffff;
  background: #553bd4;
}

.payment-summary-brand {
  display: grid;
  gap: 7px;
}

.payment-summary-brand img {
  width: 160px;
  height: auto;
}

.payment-summary-brand > span {
  color: rgb(255 255 255 / 80%);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.payment-summary-document {
  display: grid;
  gap: 5px;
  max-width: 330px;
  text-align: right;
}

.payment-summary-document > span {
  color: #7feaf1;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
}

.payment-summary-document > strong {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 27px;
  line-height: 1.1;
}

.payment-summary-document > small {
  color: rgb(255 255 255 / 78%);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.45;
}

.payment-summary-body {
  display: grid;
  gap: 20px;
  padding: 28px 30px 22px;
}

.payment-summary-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(235px, .8fr);
  gap: 18px;
  border: 1px solid #dde3ef;
  border-radius: 20px;
  padding: 22px;
  background: #ffffff;
  box-shadow: 0 12px 34px rgb(43 38 90 / 7%);
}

.payment-summary-client {
  display: grid;
  align-content: center;
  gap: 7px;
  min-width: 0;
}

.payment-summary-status {
  width: max-content;
  max-width: 100%;
  border: 1px solid #c9d0ff;
  border-radius: 999px;
  padding: 6px 10px;
  color: #4931bd;
  background: #f0edff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.payment-summary-status.is-paid {
  border-color: #b9e6ce;
  color: #176b48;
  background: #eaf8f1;
}

.payment-summary-status.has-advance {
  border-color: #f2d59d;
  color: #8a5800;
  background: #fff7e8;
}

.payment-summary-client p,
.payment-summary-client h2 {
  margin: 0;
}

.payment-summary-client p {
  color: #697386;
  font-size: 12px;
  font-weight: 700;
}

.payment-summary-client h2 {
  overflow-wrap: anywhere;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 22px;
  line-height: 1.15;
}

.payment-summary-client small {
  color: #697386;
  line-height: 1.45;
}

.payment-summary-total {
  display: grid;
  align-content: center;
  justify-items: end;
  gap: 5px;
  border-radius: 16px;
  padding: 20px;
  color: #ffffff;
  text-align: right;
  background: #553bd4;
}

.payment-summary-total.is-paid {
  background: #197552;
}

.payment-summary-total.has-advance {
  color: #ffffff;
  background: #a66500;
}

.payment-summary-total span {
  color: rgb(255 255 255 / 78%);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.payment-summary-total strong {
  font-size: 32px;
  line-height: 1.05;
}

.payment-summary-total small {
  color: rgb(255 255 255 / 76%);
  font-size: 10px;
  line-height: 1.4;
}

.payment-summary-meta {
  display: grid;
  grid-template-columns: 1fr .8fr 1fr;
  overflow: hidden;
  border: 1px solid #dde3ef;
  border-radius: 16px;
  background: #ffffff;
}

.payment-summary-meta > div {
  display: grid;
  align-content: center;
  gap: 4px;
  min-width: 0;
  padding: 14px 16px;
}

.payment-summary-meta > div + div {
  border-left: 1px solid #e6eaf1;
}

.payment-summary-meta span {
  color: #697386;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.payment-summary-meta strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.payment-summary-meta small {
  color: #7a8290;
  font-size: 10px;
}

.payment-items {
  overflow: hidden;
  border: 1px solid #dde3ef;
  border-radius: 16px;
  background: #ffffff;
}

.payment-items-head,
.payment-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px 130px;
  gap: 14px;
  align-items: center;
}

.payment-items-head {
  padding: 12px 16px;
  color: #40506c;
  background: #eaf8fa;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.payment-items-head span:nth-child(n + 2),
.payment-item > span,
.payment-item > strong {
  text-align: right;
}

.payment-item {
  border-top: 1px solid #eef1f5;
  padding: 15px 16px;
  font-size: 13px;
}

.payment-item:first-of-type {
  border-top: 0;
}

.payment-item div,
.payment-item div strong,
.payment-item div small {
  display: grid;
  gap: 3px;
}

.payment-item small {
  color: #7a8290;
}

.payment-methods {
  display: grid;
  gap: 12px;
}

.payment-methods > header {
  display: grid;
  gap: 3px;
}

.payment-methods > header span {
  color: #2d8390;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.payment-methods > header h3 {
  margin: 0;
  color: #0b1c42;
  font-size: 18px;
}

.payment-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}

.payment-bank {
  display: grid;
  gap: 12px;
  border: 1px solid #dce2ed;
  border-top: 4px solid #3153e7;
  border-radius: 16px;
  padding: 18px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgb(38 45 83 / 6%);
}

.payment-bank.is-wallet {
  border-top-color: #7042d4;
}

.payment-bank dl {
  display: grid;
  gap: 7px;
  margin: 0;
}

.payment-bank dl > div {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 12px;
}

.payment-bank dt,
.payment-bank dd {
  margin: 0;
}

.payment-bank dt {
  color: #697386;
  font-size: 11px;
}

.payment-bank dd {
  overflow-wrap: anywhere;
  color: #0b1c42;
  font-size: 12px;
  font-weight: 700;
}

.payment-bank-empty p {
  margin: 0;
  color: #667085;
  font-size: 12px;
}

.payment-bank-title {
  display: flex;
  gap: 11px;
  align-items: center;
}

.payment-bank-title > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.payment-bank-title span:not(.payment-method-mark) {
  color: #697386;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.payment-bank-title strong {
  overflow-wrap: anywhere;
  color: #0b1c42;
  font-size: 16px;
}

.payment-bank-logo,
.payment-method-mark {
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 12px;
  object-fit: contain;
}

.payment-method-mark {
  color: #274080;
  background: #edf2ff;
  font-size: 9px;
  font-weight: 700;
}

.payment-method-mark.is-wallet {
  color: #ffffff;
  background: #7042d4;
  font-size: 11px;
}

.payment-copy-hint {
  border-top: 1px solid #edf0f5;
  padding-top: 10px;
  color: #697386;
  font-size: 10px;
  font-weight: 700;
}

.payment-summary-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, .8fr);
  gap: 18px;
  border: 1px solid #bfeaf0;
  border-radius: 18px;
  padding: 18px;
  background: #eafafb;
}

.payment-proof-callout {
  display: grid;
  align-content: center;
  gap: 6px;
}

.payment-proof-callout > span {
  color: #2d8390;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.payment-proof-callout > strong {
  color: #0b1c42;
  font-size: 19px;
}

.payment-proof-callout > p {
  margin: 0;
  color: #506078;
  font-size: 12px;
  line-height: 1.5;
}

.payment-summary-foot > .receipt-contact-list {
  gap: 9px;
  min-width: 0;
  border: 1px solid #d8e6eb;
  border-radius: 14px;
  padding: 14px;
  background: #ffffff;
}

.payment-summary-foot .receipt-contact-row {
  grid-template-columns: 30px minmax(0, 1fr);
}

.payment-summary-foot .receipt-contact-icon {
  width: 28px;
  height: 28px;
}

.payment-summary-foot .receipt-contact-icon img {
  width: 15px;
  height: 15px;
}

.payment-summary-foot span {
  color: #5c687b;
  font-size: 11px;
}

.payment-summary-brand-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid #dfe4ed;
  padding: 16px 2px 2px;
}

.payment-summary-brand-footer > div {
  display: grid;
  gap: 3px;
}

.payment-summary-brand-footer > div:last-child {
  text-align: right;
}

.payment-summary-brand-footer strong {
  color: #0b1c42;
  font-size: 11px;
}

.payment-summary-brand-footer span {
  color: #718096;
  font-size: 10px;
}

.shipping-label-preview {
  min-height: 1080px;
  padding-bottom: 34px;
}

.shipping-label-head {
  display: flex;
  min-height: 160px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 24px 54px;
  color: #ffffff;
  background: linear-gradient(135deg, #5e43df 0%, #4c34c6 100%);
}

.shipping-label-head img {
  width: 185px;
  height: auto;
}

.shipping-label-head strong {
  font-size: clamp(34px, 7vw, 58px);
}

.shipping-label-content {
  display: grid;
  gap: 12px;
  padding: 30px 42px;
}

.shipping-card {
  overflow: hidden;
  border: 1px solid #cfd6e5;
  border-radius: 16px;
}

.shipping-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  color: #143b42;
  background: linear-gradient(90deg, var(--brand-aqua), #7beaf1);
  font-size: 18px;
  font-weight: 860;
}

.shipping-card-body {
  padding: 24px 28px;
}

.shipping-sender-name,
.shipping-recipient-name {
  color: #5d6068;
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 860;
  line-height: 1.1;
}

.shipping-sender-details {
  margin-top: 9px;
  color: #5c6472;
  font-size: 14px;
  line-height: 1.45;
}

.shipping-data {
  display: grid;
  margin-top: 20px;
}

.shipping-data > div {
  display: grid;
  grid-template-columns: 165px 1fr;
  gap: 18px;
  border-bottom: 1px dashed #d7dce6;
  padding: 10px 0;
}

.shipping-data > div:last-child {
  border-bottom: 0;
}

.shipping-data dt,
.shipping-data dd {
  margin: 0;
}

.shipping-data dt {
  color: var(--brand-aqua-strong);
  font-weight: 820;
}

.shipping-data dd {
  color: #4d5058;
  font-weight: 720;
}

.shipping-data .shipping-destination {
  color: var(--accent);
  font-size: 22px;
  font-weight: 880;
  text-transform: uppercase;
}

.shipping-mode-badge {
  border-radius: 14px;
  padding: 16px;
  color: #514a00;
  background: var(--brand-yellow);
  font-size: 18px;
  font-weight: 850;
  text-align: center;
}

.shipping-label-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid #e2e6ef;
  margin: 10px 42px 0;
  padding: 22px 8px 0;
  color: #59606d;
}

.shipping-label-footer strong {
  display: block;
  color: var(--accent);
  font-size: 20px;
}

.shipping-label-footer .thanks {
  color: var(--brand-aqua-strong);
  font-size: 18px;
  font-weight: 840;
  text-align: right;
}

.toast-region {
  position: fixed;
  z-index: 50;
  top: 92px;
  right: 22px;
  display: grid;
  width: min(360px, calc(100vw - 32px));
  gap: 8px;
}

.toast {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  padding: 13px 15px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: toast-in 180ms ease-out;
}

.toast.error {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
  color: var(--danger);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.mobile-only {
  display: none;
}

.dashboard-filter {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(3, minmax(130px, auto)) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
}

.dashboard-filter > div:first-child {
  display: grid;
  align-self: center;
  gap: 3px;
}

.dashboard-filter > div:first-child strong {
  font-size: 13px;
}

.dashboard-filter > div:first-child span {
  color: var(--text-soft);
  font-size: 11px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  gap: 18px;
  margin-bottom: 24px;
}

.analytics-card {
  min-width: 0;
  padding: 20px;
}

.analytics-card .section-heading {
  padding-bottom: 14px;
}

.analytics-total {
  color: var(--accent);
  font-size: 16px;
  white-space: nowrap;
}

.bar-chart {
  display: flex;
  min-height: 220px;
  gap: 8px;
  align-items: stretch;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  padding: 18px 2px 4px;
}

.chart-column {
  display: grid;
  flex: 1 0 54px;
  grid-template-rows: 28px 1fr 20px;
  min-width: 54px;
  max-width: 82px;
  gap: 5px;
  text-align: center;
}

.chart-column .chart-value {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-track {
  display: flex;
  min-height: 130px;
  align-items: end;
  overflow: hidden;
  border-radius: 8px 8px 3px 3px;
  background: var(--surface-soft);
}

.chart-track span {
  display: block;
  width: 100%;
  border-radius: 7px 7px 2px 2px;
  background: linear-gradient(180deg, var(--brand-aqua-strong), var(--accent));
}

.chart-column small {
  color: var(--text-faint);
  font-size: 9px;
}

.horizontal-chart {
  display: grid;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.horizontal-bar {
  display: grid;
  grid-template-columns: minmax(125px, .9fr) minmax(90px, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.horizontal-bar > div:first-child {
  display: grid;
  gap: 2px;
}

.horizontal-bar strong,
.horizontal-bar span,
.horizontal-bar small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.horizontal-bar strong {
  font-size: 11px;
}

.horizontal-bar span,
.horizontal-bar small {
  color: var(--text-soft);
  font-size: 9px;
}

.horizontal-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.horizontal-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand-aqua-strong);
}

.chart-empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-control);
  padding: 18px;
  color: var(--text-faint);
  font-size: 11px;
  text-align: center;
}

.whatsapp-quick-actions {
  display: flex !important;
  grid-auto-flow: column;
  gap: 8px !important;
  flex: 0 0 auto;
}

.whatsapp-import-body {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: start;
}

.whatsapp-import-option {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 16px;
  background: var(--surface-soft);
}

.whatsapp-import-option > div:first-child {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.whatsapp-import-option strong,
.whatsapp-import-option p {
  display: block;
  margin: 0;
}

.whatsapp-import-option p {
  margin-top: 3px;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.45;
}

.option-number {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
  border-radius: 50%;
  color: #073844;
  background: var(--brand-aqua);
  font-size: 11px;
  font-weight: 800;
}

.whatsapp-option-divider {
  display: grid;
  min-height: 100%;
  place-items: center;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.whatsapp-file-picker {
  display: grid;
  min-height: 112px;
  place-items: center;
  align-content: center;
  gap: 5px;
  border: 1px dashed var(--accent);
  border-radius: var(--radius-control);
  padding: 14px;
  cursor: pointer;
  text-align: center;
  background: #fbfaff;
}

.whatsapp-file-picker span,
.privacy-note {
  color: var(--text-soft);
  font-size: 10px;
  line-height: 1.45;
}

.privacy-note {
  margin: 0;
}

.ocr-progress,
.whatsapp-import-result {
  grid-column: 1 / -1;
}

.ocr-progress > div {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-strong);
}

.ocr-progress > div span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--brand-aqua-strong);
  transition: width .2s ease;
}

.ocr-progress p {
  margin: 7px 0 0;
  color: var(--text-soft);
  font-size: 11px;
}

.whatsapp-import-result {
  display: grid;
  gap: 13px;
  border: 1px solid #bdeff2;
  border-radius: var(--radius-control);
  padding: 16px;
  background: var(--brand-aqua-soft);
}

.whatsapp-result-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.whatsapp-result-heading > div {
  display: grid;
  gap: 3px;
}

.whatsapp-result-heading span,
.detected-client span,
.detected-items span {
  color: var(--text-soft);
  font-size: 10px;
}

.detected-client {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.detected-client > div {
  display: grid;
  gap: 3px;
  border-radius: 9px;
  padding: 10px;
  background: rgb(255 255 255 / 76%);
}

.detected-items {
  display: grid;
  gap: 6px;
}

.detected-items article {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgb(6 77 87 / 10%);
  padding: 8px 2px;
}

.detected-items article > div {
  display: grid;
  gap: 2px;
}

.detected-items article > div:last-child {
  text-align: right;
}

.client-address-book {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.client-address-book > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.client-address-book > div:first-child > div {
  display: grid;
  gap: 3px;
}

.client-address-book > div:first-child span {
  color: var(--text-soft);
  font-size: 10px;
}

.client-address-rows {
  display: grid;
  gap: 10px;
}

.client-address-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(130px, .7fr) minmax(240px, 1.3fr) repeat(4, minmax(100px, .7fr));
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 12px 44px 12px 12px;
  background: var(--surface-soft);
}

.remove-client-address {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 0;
  padding: 4px;
  color: var(--danger);
  background: transparent;
  font-size: 10px;
  cursor: pointer;
}

.shipping-address-choice {
  margin: 12px 0;
}

#clientQuickViewDialog {
  width: min(960px, calc(100vw - 28px));
  max-width: none;
  overflow: hidden;
}

html:has(#clientQuickViewDialog[open]),
body:has(#clientQuickViewDialog[open]) {
  overflow: hidden;
}

.client-quick-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: min(820px, calc(100dvh - 28px));
  overflow: hidden;
  box-sizing: border-box;
}

.client-quick-card > header,
.client-quick-card > header > div,
.client-quick-card > footer {
  min-width: 0;
}

.client-quick-card > header {
  align-items: flex-start;
}

.client-quick-card > header h2 {
  overflow-wrap: anywhere;
  line-height: 1.12;
}

.client-quick-body {
  display: grid;
  gap: 20px;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.client-quick-identity {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.client-quick-identity > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 12px;
  background: var(--surface-soft);
}

.client-quick-identity .quick-wide {
  grid-column: span 2;
}

.client-quick-identity span,
.client-quick-metrics span,
.client-quick-metrics small {
  color: var(--text-soft);
  font-size: 10px;
}

.client-quick-identity strong,
.client-quick-metrics strong,
.client-quick-metrics small,
.quick-address strong,
.quick-address p,
.quick-address small,
.quick-document strong,
.quick-document small {
  overflow-wrap: anywhere;
}

.client-quick-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.client-quick-metrics article {
  display: grid;
  gap: 5px;
  min-width: 0;
  border-left: 4px solid var(--brand-aqua-strong);
  border-radius: var(--radius-control);
  padding: 14px;
  background: var(--brand-aqua-soft);
}

.client-quick-metrics strong {
  font-size: 20px;
}

.client-quick-section {
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.quick-address-list,
.quick-document-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  min-width: 0;
}

.quick-address,
.quick-document {
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 12px;
  color: var(--text);
  background: var(--surface);
}

.quick-address > div,
.quick-document {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.quick-address > div > *,
.quick-document > span {
  min-width: 0;
}

.quick-address p {
  margin: 8px 0 4px;
  font-size: 12px;
  line-height: 1.45;
}

.quick-address small,
.quick-document small {
  display: block;
  margin-top: 3px;
  color: var(--text-soft);
  font-size: 9px;
}

.quick-document {
  cursor: pointer;
  text-align: left;
}

.quick-document > span:last-child {
  text-align: right;
}

.documents-toolbar {
  flex-wrap: wrap;
}

.align-filter {
  align-self: end;
}

@media (max-width: 1120px) {
  .dashboard-filter {
    grid-template-columns: 1fr repeat(2, minmax(130px, auto));
  }
  .dashboard-filter > div:first-child {
    grid-column: 1 / -1;
  }
  .analytics-grid {
    grid-template-columns: 1fr;
  }
  .client-address-row {
    grid-template-columns: repeat(3, 1fr);
  }
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .metric:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .metric:nth-child(4) {
    border-top: 1px solid var(--line);
  }
  .document-layout,
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .document-summary {
    position: static;
  }
  .audit-panel {
    grid-column: auto;
  }
  .line-item {
    grid-template-columns: minmax(190px, 1.4fr) 82px 108px 108px;
  }
  .line-item > :nth-child(5),
  .line-item > :nth-child(6) {
    grid-row: 2;
  }
  .line-item > :nth-child(7) {
    grid-column: 4;
    grid-row: 2;
  }
}

@media (min-width: 901px) and (max-height: 780px) {
  .login-brand {
    padding-block: 34px;
  }
  .login-copy h1 {
    margin-block: 8px 12px;
    font-size: clamp(46px, 5vw, 64px);
  }
  .login-copy > p:last-child {
    font-size: 17px;
  }
}

@media (max-width: 900px) {
  .login-layout {
    grid-template-columns: 1fr;
  }
  .login-brand {
    min-height: 42dvh;
    gap: 44px;
  }
  .login-panel {
    min-height: 58dvh;
  }
  .login-proof {
    display: none;
  }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }
  .sidebar.is-open {
    transform: translateX(0);
  }
  .workspace {
    margin-left: 0;
  }
  .mobile-only {
    display: inline-flex;
  }
  .topbar {
    justify-content: flex-start;
    gap: 14px;
  }
  .topbar-actions {
    margin-left: auto;
  }
  .user-block {
    display: none;
  }
  .content-grid-wide {
    grid-template-columns: 1fr;
  }
  .operations-rail {
    display: none;
  }
}

@media (max-width: 720px) {
  .sunat-pdf-import,
  .pdf-import-heading {
    display: grid;
  }

  .sunat-pdf-import .button,
  .pdf-import-actions .button,
  .legacy-migration-actions .button {
    width: 100%;
  }

  .pdf-import-actions,
  .legacy-migration-actions {
    display: grid;
  }

  .view {
    padding: 26px 14px 54px;
  }
  .topbar {
    min-height: 66px;
    padding: 10px 14px;
  }
  .topbar-context {
    display: none;
  }
  .topbar h2 {
    font-size: 16px;
  }
  .page-heading {
    margin-bottom: 22px;
  }
  .page-heading h1 {
    font-size: 34px;
  }
  .heading-with-action {
    display: grid;
    align-items: start;
  }
  .heading-with-action > .button {
    justify-self: start;
  }
  .document-status {
    border: 0;
    padding: 0;
    text-align: left;
  }
  .metric-grid {
    grid-template-columns: 1fr;
  }
  .metric,
  .metric:nth-child(3),
  .metric:nth-child(4) {
    min-height: 126px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
  .metric:first-child {
    border-top: 0;
  }
  .form-section {
    padding: 18px;
  }
  .section-heading {
    align-items: flex-start;
    padding: 18px;
  }
  .section-heading.compact {
    padding: 0 0 18px;
  }
  .section-heading .button {
    min-height: 34px;
    padding: 0 10px;
  }
  .segmented {
    grid-template-columns: repeat(2, 1fr);
  }
  .segmented label:nth-child(3) {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
  .segmented label:nth-child(4) {
    border-top: 1px solid var(--line);
  }
  .document-type-segmented label:nth-child(5) {
    border-top: 1px solid var(--line);
    border-left: 0;
    grid-column: 1 / -1;
  }
  .form-grid.two,
  .form-grid.three {
    grid-template-columns: 1fr;
  }
  .field-span-2,
  .field-span-3 {
    grid-column: auto;
  }
  .field-input-action {
    grid-template-columns: 1fr;
  }
  .field-input-action .button {
    width: 100%;
  }
  .product-image-editor {
    grid-template-columns: 88px minmax(0, 1fr);
  }
  .product-image-preview {
    width: 88px;
  }
  .line-item {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    background: var(--surface-soft);
  }
  .line-item:first-child {
    padding-top: 16px;
  }
  .line-item > :first-child,
  .line-secondary {
    grid-column: 1 / -1;
  }
  .line-item > :nth-child(5),
  .line-item > :nth-child(6),
  .line-item > :nth-child(7) {
    grid-row: auto;
  }
  .line-item > :nth-child(7) {
    grid-column: 2;
    justify-self: end;
  }
  .line-secondary {
    grid-template-columns: 1fr;
  }
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .documents-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }
  .documents-toolbar .toolbar-count {
    justify-self: start;
  }
  .search-field {
    width: 100%;
  }
  .document-mode-note {
    display: grid;
  }
  .client-picker-results {
    max-height: 270px;
  }
  th,
  td {
    padding: 12px 13px;
  }
  #view-documents .table-wrap,
  #view-sellers .table-wrap,
  #view-shipments .table-wrap {
    overflow: visible;
  }
  #view-documents table,
  #view-documents tbody,
  #view-sellers table,
  #view-sellers tbody,
  #view-shipments table,
  #view-shipments tbody {
    display: block;
    width: 100%;
  }
  #view-documents thead,
  #view-sellers thead,
  #view-shipments thead {
    display: none;
  }
  #view-documents tbody,
  #view-sellers tbody,
  #view-shipments tbody {
    padding: 0 14px 14px;
  }
  #view-documents tbody tr,
  #view-sellers tbody tr,
  #view-shipments tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 12px;
    border-top: 1px solid var(--line);
    padding: 16px 0;
  }
  #view-documents tbody td,
  #view-sellers tbody td,
  #view-shipments tbody td {
    display: grid;
    min-width: 0;
    align-content: start;
    gap: 3px;
    border: 0;
    padding: 0;
    white-space: normal;
  }
  #view-documents tbody td::before,
  #view-sellers tbody td::before,
  #view-shipments tbody td::before {
    content: attr(data-label);
    color: var(--text-faint);
    font-size: 9px;
    font-weight: 820;
    letter-spacing: .06em;
    text-transform: uppercase;
  }
  #view-documents tbody td:nth-child(8),
  #view-sellers tbody td:nth-child(7),
  #view-shipments tbody td:nth-child(7) {
    grid-column: 1 / -1;
  }
  #view-documents .document-row-actions,
  #view-shipments tbody td:nth-child(7) .button {
    width: 100%;
  }
  #view-documents .document-row-actions .button {
    flex: 1;
  }
  .modal-card {
    padding: 18px;
  }
  .preview-toolbar {
    align-items: flex-start;
  }
  .preview-toolbar > div:first-child span {
    display: none;
  }
  .document-preview {
    width: 100%;
    min-width: 760px;
    margin: 0;
    box-shadow: none;
  }
  .preview-shell {
    overflow-x: auto;
  }
  .toast-region {
    top: 76px;
    right: 16px;
  }
}

@media (max-width: 1400px) {
  .document-summary {
    grid-template-columns: 120px minmax(330px, 1fr) minmax(210px, 250px);
  }
  .document-summary .tax-note {
    display: none;
  }
}

@media (max-width: 900px) {
  .brand-lockup-light .brand-logo {
    width: 170px;
  }
  .preview-page-toolbar {
    top: 78px;
  }
  .document-summary {
    grid-template-columns: 120px minmax(300px, 1fr) minmax(210px, 250px);
  }
}

@media (max-width: 720px) {
  .section-heading.compact,
  .preview-page-toolbar,
  .preview-toolbar-actions {
    align-items: stretch;
  }
  .section-heading.compact,
  .preview-page-toolbar {
    display: grid;
  }
  .preview-page-toolbar {
    position: static;
    top: auto;
  }
  .section-actions,
  .preview-toolbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .section-actions .button,
  .preview-toolbar-actions > .button {
    width: 100%;
  }
  .preview-toolbar-actions > .button {
    grid-column: auto;
  }
  #printPreviewButton {
    grid-column: 1 / -1;
  }
  .preview-tabs {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    width: 100%;
  }
  .preview-tabs button {
    padding-inline: 8px;
    font-size: 12px;
  }
  .conversion-source-summary {
    grid-template-columns: 1fr;
  }
  .conversion-source-summary > div + div,
  .cancellation-source-summary > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
  .cancellation-source-summary {
    grid-template-columns: 1fr;
  }
  .document-summary {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 18px;
  }
  .document-summary dl {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .document-summary dl > div {
    padding: 2px 10px;
  }
  .document-summary dl > div:first-child {
    border-left: 0;
    padding-left: 0;
  }
  .document-summary .summary-total dt,
  .document-summary .summary-total dd {
    font-size: 15px;
  }
  .same-client-option {
    width: 100%;
  }
  .whatsapp-quick-order {
    display: grid;
    align-items: stretch;
  }
  .whatsapp-quick-order .button {
    width: 100%;
  }
  .payment-account-choices,
  .payment-options {
    grid-template-columns: 1fr;
  }
  .preview-stage {
    padding: 8px;
  }
  .document-preview {
    width: 100%;
    min-width: 0;
    min-height: 0;
    padding: 18px;
  }
  .receipt-head {
    display: grid;
    grid-template-columns: 1fr;
    min-height: 0;
    margin: -18px -18px 0;
    padding: 22px;
  }
  .receipt-logo {
    width: 128px;
  }
  .receipt-company {
    text-align: left;
  }
  .receipt-aqua-rule {
    margin: 0 -18px;
  }
  .receipt-info,
  .receipt-summary-row,
  .receipt-payment-grid {
    grid-template-columns: 1fr;
  }
  .receipt-payment-head {
    display: grid;
  }
  .receipt-payment-state {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .receipt-brand-pill {
    width: max-content;
    max-width: 100%;
    white-space: normal;
  }
  .receipt-draft-banner {
    display: grid;
  }
  .payment-summary-head {
    display: grid;
    min-height: 0;
    padding: 24px;
  }
  .payment-summary-brand img {
    width: 140px;
  }
  .payment-summary-document {
    max-width: none;
    text-align: left;
  }
  .payment-summary-body {
    padding: 16px;
  }
  .payment-summary-hero,
  .payment-summary-meta,
  .sunat-flow-list {
    grid-template-columns: 1fr;
  }
  .payment-summary-meta > div + div {
    border-top: 1px solid #e6eaf1;
    border-left: 0;
  }
  .payment-summary-total {
    justify-items: start;
    text-align: left;
  }
  .payment-items-head,
  .payment-item {
    grid-template-columns: minmax(0, 1fr) 48px 102px;
    gap: 8px;
  }
  .payment-summary-foot {
    grid-template-columns: 1fr;
  }
  .payment-summary-brand-footer {
    display: grid;
  }
  .payment-summary-brand-footer > div:last-child {
    text-align: left;
  }
  .receipt-info dl > div {
    grid-template-columns: 88px 1fr;
  }
  .shipping-label-preview {
    min-height: 0;
  }
  .shipping-label-head {
    min-height: 112px;
    padding: 18px 22px;
  }
  .shipping-label-head img {
    width: 118px;
  }
  .shipping-label-content {
    padding: 18px 14px;
  }
  .shipping-card-body {
    padding: 19px;
  }
  .shipping-data > div {
    grid-template-columns: 105px 1fr;
    gap: 12px;
  }
  .shipping-label-footer {
    display: grid;
    margin: 4px 14px 0;
  }
  .shipping-label-footer .thanks {
    text-align: left;
  }
}

@media (max-width: 720px) {
  .dashboard-filter {
    grid-template-columns: 1fr;
  }
  .dashboard-filter > div:first-child,
  .dashboard-filter .button {
    grid-column: auto;
  }
  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }
  .metric {
    min-height: 122px;
    border-bottom: 1px solid var(--line);
    padding: 16px;
  }
  .analytics-card {
    padding: 15px;
  }
  .horizontal-bar {
    grid-template-columns: minmax(110px, 1fr) minmax(70px, .8fr);
  }
  .horizontal-bar > small {
    grid-column: 1 / -1;
  }
  .whatsapp-quick-order,
  .whatsapp-quick-actions,
  .whatsapp-import-body,
  .client-address-book > div:first-child,
  .client-quick-card > footer {
    display: grid !important;
    grid-template-columns: 1fr;
  }
  .whatsapp-quick-actions .button,
  .client-address-book .button,
  .client-quick-card > footer .button {
    width: 100%;
  }
  .whatsapp-import-body {
    gap: 12px;
  }
  .whatsapp-option-divider {
    min-height: auto;
  }
  .detected-client,
  .client-quick-identity,
  .client-quick-metrics,
  .quick-address-list,
  .quick-document-list,
  .client-address-row {
    grid-template-columns: 1fr;
  }
  .client-quick-identity .quick-wide {
    grid-column: auto;
  }
  .client-address-row {
    padding-right: 42px;
  }
  .documents-toolbar .search-field,
  .documents-toolbar .filter-field,
  .documents-toolbar .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

.png-export-mount {
  position: fixed;
  z-index: -1;
  top: 0;
  left: -100000px;
  overflow: visible;
  pointer-events: none;
  background: #ffffff;
}

.png-export-source.document-preview {
  width: 900px !important;
  min-width: 900px !important;
  min-height: 0 !important;
  padding: 48px !important;
}

.png-export-source .receipt-head {
  display: flex !important;
  min-height: 150px !important;
  margin: -48px -48px 0 !important;
  padding: 24px 48px !important;
}

.png-export-source .receipt-logo {
  width: 164px !important;
}

.png-export-source .receipt-company {
  text-align: right !important;
}

.png-export-source .receipt-aqua-rule {
  margin: 0 -48px !important;
}

.png-export-source .receipt-info {
  grid-template-columns: 1fr 1fr !important;
}

.png-export-source .receipt-summary-row {
  grid-template-columns: minmax(0, 1fr) 340px !important;
}

.png-export-source .receipt-payment-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(220px, .8fr) !important;
}

.png-export-source .receipt-payment-grid.is-contact-only {
  grid-template-columns: minmax(260px, 520px) !important;
  justify-content: end !important;
}

.png-export-source .receipt-payment-grid.is-paid {
  grid-template-columns: minmax(205px, .78fr) minmax(0, 1.22fr) !important;
}

.png-export-source .receipt-account-grid {
  grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)) !important;
}

.png-export-source .receipt-table-wrap {
  overflow: hidden !important;
}

.png-export-source .receipt-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}

.png-export-source.shipping-label-preview {
  width: 760px !important;
  min-width: 760px !important;
  min-height: 0 !important;
}

@media print {
  html,
  body {
    width: 210mm !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #ffffff !important;
  }
  body {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  body > :not(#appView),
  #appView > :not(.workspace),
  .workspace > :not(#view-preview),
  #view-preview > :not(.preview-stage),
  .preview-stage > .preview-pane:not(.is-active) {
    display: none !important;
  }
  #appView,
  .workspace,
  #view-preview,
  .preview-stage,
  .preview-pane.is-active,
  .preview-pane.is-active * {
    visibility: visible !important;
  }
  #appView,
  .workspace,
  #view-preview,
  .preview-stage {
    display: block !important;
    width: 210mm !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #ffffff !important;
  }
  .preview-pane.is-active {
    position: static !important;
    width: 210mm !important;
    min-width: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }
  .document-preview,
  .payment-summary-preview,
  .shipping-label-preview {
    width: 210mm !important;
    max-width: none !important;
    min-height: 0;
    margin: 0;
    box-shadow: none !important;
  }
  .document-preview {
    padding: 7mm !important;
  }
  .receipt-cancelled {
    border: .6mm solid #b4232c !important;
  }
  .receipt-cancellation-banner {
    margin: 0 0 4mm !important;
    border: .5mm solid #b4232c !important;
    border-radius: 3mm !important;
    padding: 2.5mm 4mm !important;
    color: #6c141c !important;
    background: #fff1f2 !important;
    break-inside: avoid;
  }
  .receipt-cancellation-banner strong {
    font-size: 11pt !important;
  }
  .receipt-cancellation-banner span {
    font-size: 8pt !important;
  }
  .receipt-cancellation-banner small {
    font-size: 7pt !important;
  }
  .receipt-head {
    min-height: 31mm !important;
    margin: 0 !important;
    border-radius: 4mm 4mm 0 0 !important;
    padding: 4mm 7mm !important;
  }
  .receipt-logo {
    width: 34mm !important;
  }
  .receipt-company {
    font-size: 8.2pt !important;
  }
  .receipt-company strong {
    font-size: 10.5pt !important;
  }
  .receipt-company span:nth-of-type(2) {
    font-size: 9pt !important;
  }
  .receipt-aqua-rule {
    height: 3mm !important;
    margin: 0 !important;
  }
  .receipt-title {
    padding: 3.5mm 0 3mm !important;
  }
  .receipt-title h2 {
    font-size: 15.5pt !important;
  }
  .receipt-title strong {
    font-size: 10pt !important;
  }
  .receipt-info {
    gap: 7mm !important;
    margin-bottom: 4mm !important;
    break-inside: avoid;
  }
  .receipt-info-card {
    overflow: hidden !important;
    border: .25mm solid #d7dee8 !important;
    border-radius: 3.2mm !important;
    background: #fafbfd !important;
  }
  .receipt-info-card h3 {
    display: block !important;
    padding: 2.4mm 3.2mm !important;
    background: #eef2f6 !important;
    font-size: 8.6pt !important;
  }
  .receipt-info dl > div {
    grid-template-columns: 25mm 1fr !important;
    border-top: .2mm solid #e4e9f0 !important;
    padding: 1.35mm 1.5mm !important;
  }
  .receipt-info dl > div:first-child {
    border-top: 0 !important;
  }
  .receipt-info dt,
  .receipt-info dd {
    font-size: 8.2pt !important;
  }
  .receipt-table-wrap {
    overflow: hidden !important;
    border-color: #c9ced6 !important;
    border-radius: 3.2mm !important;
  }
  .receipt-table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
    font-size: 8.1pt !important;
  }
  .receipt-table thead {
    display: table-header-group;
  }
  .receipt-table tr {
    break-inside: avoid;
  }
  .receipt-table th,
  .receipt-table td {
    border-color: #c9ced6 !important;
    overflow-wrap: anywhere;
    white-space: normal;
  }
  .receipt-table th {
    padding: 2.2mm 1.2mm !important;
    font-size: 7.2pt !important;
  }
  .receipt-table td {
    padding: 2.4mm 1.2mm !important;
    vertical-align: top;
  }
  .receipt-table th:nth-child(1),
  .receipt-table td:nth-child(1) { width: 10%; }
  .receipt-table th:nth-child(2),
  .receipt-table td:nth-child(2) { width: 33%; }
  .receipt-table th:nth-child(3),
  .receipt-table td:nth-child(3) { width: 9%; }
  .receipt-table th:nth-child(4),
  .receipt-table td:nth-child(4) { width: 11%; }
  .receipt-table th:nth-child(5),
  .receipt-table td:nth-child(5) { width: 7%; }
  .receipt-table th:nth-child(6),
  .receipt-table td:nth-child(6) { width: 15%; }
  .receipt-table th:nth-child(7),
  .receipt-table td:nth-child(7) { width: 15%; }
  .receipt-table .money {
    white-space: nowrap !important;
    font-size: 7.8pt !important;
  }
  .receipt-item-meta {
    font-size: 6.5pt !important;
  }
  .receipt-summary-row {
    grid-template-columns: minmax(0, 1fr) 64mm !important;
    gap: 5mm !important;
    margin-top: 4mm !important;
    break-inside: avoid;
  }
  .receipt-total-card > div {
    padding: 2.1mm 3mm !important;
    font-size: 8pt !important;
  }
  .receipt-total-card dt,
  .receipt-total-card dd {
    font-size: 9pt !important;
  }
  .receipt-total-card .grand-total dt,
  .receipt-total-card .grand-total dd {
    font-size: 11pt !important;
  }
  .receipt-conditions {
    margin-top: 0 !important;
    border: 0 !important;
    border-left: 1.4mm solid var(--brand-aqua) !important;
    border-radius: 3mm !important;
    padding: 2.5mm 3mm !important;
    background: #f2fbfc !important;
    font-size: 7.5pt !important;
    break-inside: avoid;
  }
  .receipt-payment {
    margin-top: 4mm !important;
    border: 0 !important;
    border-left: 1.4mm solid #8cddea !important;
    border-radius: 3.2mm !important;
    padding: 3.2mm !important;
    background: #f3f5f7 !important;
    break-inside: avoid;
  }
  .receipt-payment-head {
    margin-bottom: 3mm !important;
  }
  .receipt-payment-head h3 {
    font-size: 12pt !important;
  }
  .receipt-payment-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(45mm, .8fr) !important;
    gap: 3mm !important;
  }
  .receipt-payment-grid.is-contact-only {
    grid-template-columns: minmax(45mm, 80mm) !important;
    justify-content: end !important;
  }
  .receipt-payment-grid.is-paid {
    grid-template-columns: minmax(42mm, .72fr) minmax(0, 1.28fr) !important;
  }
  .receipt-account-grid {
    grid-template-columns: repeat(auto-fit, minmax(42mm, 1fr)) !important;
    gap: 2.5mm !important;
  }
  .receipt-pay-card,
  .receipt-paid-card,
  .receipt-payment-state,
  .receipt-contact-card {
    border: .25mm solid #d7dee7 !important;
    border-radius: 2.8mm !important;
    padding: 2.5mm !important;
    background: #ffffff !important;
    font-size: 7.2pt !important;
  }
  .receipt-paid-badge {
    padding: 1mm 2mm !important;
    font-size: 6pt !important;
  }
  .receipt-paid-card h4,
  .receipt-paid-card > strong {
    font-size: 9pt !important;
  }
  .receipt-brand-pill {
    border: .25mm solid #d4dce7 !important;
    padding: 1.5mm 2.5mm !important;
  }
  .receipt-bank-heading h4,
  .receipt-contact-card h4 {
    font-size: 9pt !important;
  }
  .receipt-bank-badge {
    min-width: 9mm !important;
    height: 8mm !important;
    font-size: 6pt !important;
  }
  .receipt-bank-logo {
    width: 8mm !important;
    height: 8mm !important;
    border-radius: 2mm !important;
  }
  .receipt-product-image img {
    width: 13mm !important;
    height: 11mm !important;
    object-fit: contain !important;
  }
  .receipt-pay-data > div {
    grid-template-columns: 19mm 1fr !important;
  }
  .receipt-footer {
    margin-top: 4mm !important;
    padding-top: 3mm !important;
    font-size: 6.5pt !important;
    break-inside: avoid;
  }
  .receipt-payment-state {
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    gap: 2.5mm !important;
    margin-bottom: 2.5mm !important;
  }
  .receipt-payment-state h4,
  .receipt-payment-state > strong {
    font-size: 9pt !important;
  }
  .receipt-payment-state p {
    font-size: 6.5pt !important;
  }
  .receipt-web-footer {
    gap: 2.2mm !important;
    margin-top: 3mm !important;
    padding: 2.5mm 2mm 0 !important;
    break-inside: avoid;
  }
  .receipt-web-footer p,
  .receipt-terms-link {
    font-size: 7.2pt !important;
  }
  .receipt-social-links {
    gap: 4mm !important;
  }
  .receipt-social {
    width: 3mm !important;
    height: 3mm !important;
  }
  .payment-summary-preview {
    padding: 0 !important;
  }
  .payment-summary-intro,
  .payment-summary-total,
  .payment-bank,
  .payment-summary-foot,
  .shipping-card,
  .shipping-label-footer {
    break-inside: avoid;
  }
  .payment-item {
    break-inside: avoid;
  }
  .payment-summary-preview,
  .shipping-label-preview {
    box-shadow: none;
  }
  .shipping-label-preview {
    min-height: 297mm;
    padding: 0 0 10mm;
  }
  @page {
    size: 210mm 297mm;
    margin: 0;
  }
}

@media screen {
  .view,
  .surface,
  .document-main,
  .document-summary,
  .form-section,
  .preview-page-toolbar,
  .preview-toolbar-actions,
  .modal-card,
  .email-draft-body {
    min-width: 0;
  }

  .button,
  .preview-tabs button {
    white-space: nowrap;
  }

  td,
  .cell-title,
  .cell-subtitle,
  .field small,
  .receipt-contact-row span,
  .email-attachment-note span {
    overflow-wrap: anywhere;
  }

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

  .metric:nth-child(4) {
    border-left: 0;
  }

  .metric:nth-child(n + 4) {
    border-top: 1px solid var(--line);
  }

  .document-presets {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding: 14px 16px;
  }

  .document-presets > div:first-child {
    display: grid;
    gap: 3px;
  }

  .document-presets > div:first-child span {
    color: var(--text-soft);
    font-size: 12px;
  }

  .document-preset-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
  }

  .document-summary {
    grid-template-columns: 120px minmax(280px, 1fr) minmax(260px, .9fr) minmax(210px, 240px);
  }

  .document-summary .tax-note {
    display: none;
  }

  .readiness-card {
    display: grid;
    min-width: 0;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    padding: 12px;
    background: var(--surface-soft);
  }

  .readiness-card.is-blocked {
    border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
    background: var(--danger-soft);
  }

  .readiness-card.is-ready {
    border-color: color-mix(in srgb, var(--success) 32%, var(--line));
    background: var(--success-soft);
  }

  .readiness-head {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
  }

  .readiness-head > div {
    display: grid;
    min-width: 0;
    gap: 2px;
  }

  .readiness-head strong {
    font-size: 13px;
  }

  .readiness-head small {
    color: var(--text-soft);
    font-size: 10px;
  }

  .readiness-light {
    flex: 0 0 12px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--warning);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--warning) 15%, transparent);
  }

  .readiness-card.is-blocked .readiness-light {
    background: var(--danger);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--danger) 14%, transparent);
  }

  .readiness-card.is-ready .readiness-light {
    background: var(--success);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--success) 14%, transparent);
  }

  .readiness-card ul {
    display: grid;
    max-height: 108px;
    gap: 5px;
    overflow: auto;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .readiness-card li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 7px;
    color: var(--text-soft);
    font-size: 10px;
    line-height: 1.35;
  }

  .readiness-card li span {
    color: var(--warning);
    font-weight: 800;
    text-transform: uppercase;
  }

  .readiness-card li.blocker span {
    color: var(--danger);
  }

  .readiness-card li.ok span {
    color: var(--success);
  }

  .stacked-status {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
  }

  .email-draft-body {
    display: grid;
    gap: 16px;
  }

  .email-security-note,
  .email-attachment-note {
    display: grid;
    gap: 4px;
    border: 1px solid color-mix(in srgb, var(--brand-aqua-strong) 28%, var(--line));
    border-radius: var(--radius-control);
    padding: 13px 14px;
    background: var(--brand-aqua-soft);
  }

  .email-security-note span,
  .email-attachment-note span {
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.45;
  }

  .preview-toolbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

@media screen and (max-width: 1400px) {
  .document-summary {
    grid-template-columns: 110px minmax(260px, 1fr) minmax(250px, 1fr);
  }

  .document-summary .summary-actions {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }
}

@media screen and (max-width: 1120px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric:nth-child(odd) {
    border-left: 0;
  }

  .metric:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .document-presets {
    align-items: flex-start;
  }
}

@media screen and (max-width: 900px) {
  .document-summary {
    grid-template-columns: 1fr;
  }

  .document-summary > div:first-child,
  .document-summary dl,
  .document-summary .readiness-card,
  .document-summary .summary-actions {
    grid-column: auto;
  }

  .document-presets {
    display: grid;
  }

  .document-preset-actions {
    justify-content: flex-start;
  }
}

@media screen and (max-width: 720px) {
  .preview-page-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .preview-toolbar-start,
  .preview-toolbar-actions {
    width: 100%;
  }

  .document-preset-actions,
  .document-summary .summary-actions,
  .modal-card > footer {
    display: grid;
    grid-template-columns: 1fr;
  }

  .document-preset-actions .button,
  .document-summary .summary-actions .button,
  .modal-card > footer .button {
    width: 100%;
  }

  .preview-toolbar-actions > .button {
    min-width: 0;
    white-space: normal;
  }
}

/* Cobranza operativa: acuerdos internos, crédito SUNAT e historial de pagos. */
.collection-mode-field {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.collection-mode-field > legend {
  margin-bottom: 9px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 800;
}

.collection-mode-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.collection-mode-option {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  padding: 14px;
  background: var(--surface-soft);
  cursor: pointer;
}

.collection-mode-option:has(input:checked) {
  border-color: #6edbe4;
  background: #effbfd;
  box-shadow: inset 4px 0 var(--brand-aqua);
}

.collection-mode-option.is-disabled {
  border-style: dashed;
  background: #f7f8fb;
  cursor: not-allowed;
}

.collection-mode-option.is-disabled span {
  opacity: .62;
}

.collection-mode-option input {
  width: 18px;
  min-width: 18px;
  min-height: 18px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.collection-mode-option span,
.collection-mode-option strong,
.collection-mode-option small {
  display: block;
  min-width: 0;
}

.collection-mode-option strong {
  color: var(--text);
  font-size: 14px;
}

.collection-mode-option small {
  margin-top: 4px;
  color: var(--text-soft);
  line-height: 1.45;
}

.collection-mode-option em {
  align-self: flex-start;
  margin-left: auto;
  border-radius: 999px;
  padding: 4px 7px;
  color: var(--text-faint);
  background: #eef0f5;
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.collection-mode-help {
  margin: 9px 2px 0;
  color: var(--text-faint);
  font-size: 11px;
  line-height: 1.5;
}

.advance-percentage-tools {
  display: grid;
  grid-template-columns: minmax(150px, .72fr) minmax(260px, 1.28fr);
  align-items: end;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 10px;
  background: var(--surface-soft);
}

.advance-percentage-tools > label {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.advance-percentage-tools > label > span:first-child {
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 800;
}

.percentage-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
}

.percentage-input input {
  min-width: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.percentage-input b {
  display: grid;
  place-items: center;
  border-left: 1px solid var(--line);
  color: var(--text-soft);
  background: #f4f6f9;
  font-size: 13px;
}

.advance-percentage-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.advance-percentage-actions .button {
  min-width: 0;
  padding-inline: 10px;
  white-space: nowrap;
}

.payment-status-visual {
  display: grid;
  min-width: 0;
  border: 1px solid #d6dce7;
  border-radius: var(--radius-card);
  padding: 20px;
  color: var(--text);
  background: #f8f9fb;
  transition: opacity .16s ease, border-color .16s ease, background-color .16s ease;
}

.payment-status-visual-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}

.payment-status-visual-head span,
.payment-status-visual-head em {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.payment-status-visual-head span {
  border: 1px solid #d2d7e1;
  color: #626b7a;
  background: #fff;
}

.payment-status-visual-head em {
  color: #27666d;
  background: #e9f9fb;
}

.payment-status-visual-kicker {
  margin-bottom: 5px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.payment-status-visual > strong {
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.1;
}

.payment-status-visual > p {
  max-width: 62ch;
  margin: 7px 0 16px;
  color: var(--text-soft);
  line-height: 1.45;
}

.payment-status-visual > b {
  color: inherit;
  font-size: clamp(23px, 3vw, 32px);
}

.payment-status-visual.is-advance {
  border-color: #ead38e;
  color: #704d00;
  background: #fff9e9;
}

.payment-status-visual.is-advance .payment-status-visual-head span {
  border-color: #e5c46d;
  color: #704d00;
  background: #fffdf5;
}

.payment-status-visual.is-paid {
  border-color: #a9d8c0;
  color: #236441;
  background: #effaf5;
}

.payment-status-visual.is-paid .payment-status-visual-head span {
  border-color: #9fd2b8;
  color: #236441;
  background: #f8fffb;
}

.payment-status-visual.is-refunded {
  border-color: #e3b4b8;
  color: #9d3038;
  background: #fff3f4;
}

.payment-status-visual.is-hidden-choice {
  opacity: .62;
  border-style: dashed;
}

.payment-status-visual.is-hidden-choice .payment-status-visual-head em {
  color: #6b7280;
  background: #e9ebef;
}

.collection-release-option,
.collection-visibility-option {
  width: 100%;
}

.collection-release-option:has(input:checked) {
  border-color: #e8c675;
  color: #694700;
  background: #fff9e9;
  box-shadow: inset 4px 0 #e2ab28;
}

.collection-visibility-option:has(input:checked) {
  border-color: #bdeff2;
  color: #143b42;
  background: var(--brand-aqua-soft);
  box-shadow: inset 4px 0 var(--brand-aqua);
}

.review-release-note {
  display: block;
  margin-top: 7px;
  color: #8a5a00;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.release-state {
  display: block;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.release-state.is-locked {
  color: #a16400;
}

.release-state.is-ready {
  color: #19704b;
}

.modal-payment-ledger {
  width: min(920px, calc(100vw - 32px));
  overflow: hidden;
}

.modal-payment-ledger .modal-card {
  width: 100%;
  max-width: 100%;
  max-height: calc(100dvh - 32px);
  overflow-x: hidden;
  overflow-y: auto;
}

.payment-ledger-body,
.new-payment-section,
.payment-history-section {
  display: grid;
  min-width: 0;
  gap: 18px;
}

.payment-ledger-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface-soft);
}

.payment-ledger-summary > div {
  display: grid;
  min-width: 0;
  gap: 6px;
  padding: 18px;
}

.payment-ledger-summary > div + div {
  border-left: 1px solid var(--line);
}

.payment-ledger-summary span {
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.payment-ledger-summary strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 21px;
}

.payment-ledger-summary .is-pending {
  background: #fff9e9;
}

.payment-ledger-summary .is-pending strong {
  color: #8a5a00;
}

.payment-ledger-summary .is-complete {
  background: #effaf5;
}

.payment-ledger-summary .is-complete strong {
  color: #19704b;
}

.payment-release-notice {
  display: grid;
  gap: 3px;
  border: 1px solid;
  border-radius: var(--radius-control);
  padding: 13px 15px;
}

.payment-release-notice.is-locked {
  border-color: #efd493;
  color: #704a00;
  background: #fff9e9;
}

.payment-release-notice.is-ready {
  border-color: #b8e3cf;
  color: #18563c;
  background: #effaf5;
}

.payment-release-notice span {
  font-size: 12px;
  line-height: 1.45;
}

.new-payment-section {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.new-payment-section .section-heading,
.payment-history-section .section-heading {
  margin: 0;
  padding-bottom: 0;
}

.payment-history-section {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.payment-history-list {
  display: grid;
  gap: 8px;
}

.payment-history-item {
  display: grid;
  grid-template-columns: minmax(130px, .7fr) minmax(170px, 1fr) minmax(220px, 1.4fr);
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 13px 15px;
  background: var(--surface);
}

.payment-history-item > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.payment-history-item strong,
.payment-history-item span {
  overflow-wrap: anywhere;
}

.payment-history-item strong {
  color: var(--text);
  font-size: 12px;
}

.payment-history-item span {
  color: var(--text-faint);
  font-size: 11px;
  line-height: 1.4;
}

.payment-history-empty {
  display: grid;
  gap: 4px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-control);
  padding: 18px;
  color: var(--text-soft);
  background: var(--surface-soft);
}

.payment-history-empty span {
  font-size: 12px;
}

@media screen and (max-width: 720px) {
  .collection-mode-options,
  .payment-ledger-summary,
  .payment-history-item {
    grid-template-columns: 1fr;
  }

  .payment-ledger-summary > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .modal-payment-ledger .modal-card {
    width: 100%;
    max-height: calc(100dvh - 20px);
  }

  .modal-payment-ledger {
    width: calc(100vw - 20px);
  }

  .new-payment-section .section-heading {
    display: grid;
  }

  .advance-percentage-tools {
    grid-template-columns: 1fr;
  }

  .advance-percentage-actions {
    grid-template-columns: 1fr;
  }

  .advance-percentage-tools .button {
    width: 100%;
  }

  .payment-status-visual {
    padding: 17px;
  }

  .payment-status-visual-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .new-payment-section .section-heading .button {
    width: 100%;
  }
}

@media screen and (max-width: 460px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric,
  .metric:nth-child(n) {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .metric:first-child {
    border-top: 0;
  }

  .preview-toolbar-actions {
    grid-template-columns: 1fr;
  }

  .preview-tabs,
  .preview-toolbar-actions > .button,
  #printPreviewButton {
    grid-column: 1;
  }
}

/* Registros administrativos: acciones visibles sin desplazamiento horizontal. */
.record-list {
  display: grid;
  gap: 12px;
  padding: 0 20px 20px;
}

.record-card {
  display: grid;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.record-card-head {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
  background: var(--surface-soft);
}

.record-identity {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.record-eyebrow,
.record-details span,
.shipment-actions label > span {
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 790;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.record-identity > strong {
  overflow-wrap: anywhere;
  font-size: 17px;
  line-height: 1.25;
}

.record-identity > small,
.record-details small {
  overflow-wrap: anywhere;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.4;
}

.record-statuses {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.record-details {
  display: grid;
  grid-template-columns: minmax(240px, 1.45fr) repeat(3, minmax(150px, 1fr));
  min-width: 0;
}

.record-details > div {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 4px;
  padding: 14px 18px;
}

.record-details > div + div {
  border-left: 1px solid var(--line);
}

.record-details strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
}

.record-actions {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 12px 18px;
  background: #fbfcfe;
}

.record-link {
  width: max-content;
  border: 0;
  padding: 0;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  font-weight: 800;
  text-align: left;
}

.record-link:hover {
  text-decoration: underline;
}

.client-record-details {
  grid-template-columns: 1.2fr 1.4fr .75fr .8fr;
}

.shipment-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.shipment-overview article {
  display: grid;
  min-width: 0;
  gap: 2px;
  padding: 18px 20px;
}

.shipment-overview article + article {
  border-left: 1px solid var(--line);
}

.shipment-overview span,
.shipment-overview small {
  color: var(--text-soft);
  font-size: 11px;
}

.shipment-overview strong {
  font-size: 24px;
  line-height: 1.15;
}

.shipment-overview article:nth-child(1) strong { color: var(--warning); }
.shipment-overview article:nth-child(2) strong { color: var(--accent); }
.shipment-overview article:nth-child(3) strong { color: #1164a3; }
.shipment-overview article:nth-child(4) strong { color: var(--success); }

.shipment-toolbar {
  justify-content: flex-start;
}

.shipment-toolbar .toolbar-count {
  margin-left: auto;
  align-self: center;
}

.shipment-state {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.shipment-state > span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.shipment-state.is-pending { color: var(--warning); background: var(--warning-soft); }
.shipment-state.is-preparing { color: var(--accent); background: var(--accent-soft); }
.shipment-state.is-dispatched { color: #1164a3; background: #e8f4fd; }
.shipment-state.is-delivered { color: var(--success); background: var(--success-soft); }
.shipment-state.is-cancelled { color: var(--danger); background: var(--danger-soft); }

.shipment-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  padding: 13px 18px 0;
}

.shipment-progress span {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  color: var(--text-faint);
  font-size: 9px;
  font-weight: 720;
}

.shipment-progress span::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
  content: "";
}

.shipment-progress span.is-complete {
  color: var(--success);
}

.shipment-progress span.is-complete::before {
  background: var(--success);
}

.shipment-progress span.is-cancelled {
  color: var(--danger);
}

.shipment-progress span.is-cancelled::before {
  background: var(--danger);
}

.shipment-record-details {
  grid-template-columns: 1.2fr 1.35fr 1fr 1.2fr;
}

.shipment-next-step {
  background: var(--brand-aqua-soft);
}

.shipment-actions {
  align-items: end;
  justify-content: space-between;
}

.shipment-actions label {
  display: grid;
  width: min(260px, 100%);
  gap: 6px;
}

.shipment-action-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.shipment-status {
  border-width: 1px;
  font-weight: 760;
}

.shipment-status.is-pending { border-color: #e5c46d; background: var(--warning-soft); color: var(--warning); }
.shipment-status.is-preparing { border-color: #b9aff1; background: var(--accent-soft); color: var(--accent); }
.shipment-status.is-dispatched { border-color: #a8cee8; background: #eef8ff; color: #1164a3; }
.shipment-status.is-delivered { border-color: #9fd2b8; background: var(--success-soft); color: var(--success); }
.shipment-status.is-cancelled { border-color: #e7aeb3; background: var(--danger-soft); color: var(--danger); }

.modal-email {
  width: min(1040px, calc(100vw - 28px));
}

.email-template-section {
  display: grid;
  gap: 10px;
}

.email-subject-field {
  min-height: 64px;
  resize: vertical;
}

.email-template-section > div {
  display: grid;
  gap: 3px;
}

.email-template-section > div > span {
  color: var(--text-soft);
  font-size: 12px;
}

.email-template-preview {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #f6f8fa;
}

.email-preview-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  border-bottom: 7px solid var(--brand-aqua);
  padding: 18px 26px 16px;
  color: #ffffff;
  background: var(--accent);
}

.email-preview-head img {
  width: 130px;
  height: auto;
  object-fit: contain;
}

.email-preview-head > div {
  display: grid;
  gap: 3px;
  min-width: 0;
  text-align: left;
}

.email-preview-head strong {
  font-size: 19px;
}

.email-preview-head span {
  overflow-wrap: anywhere;
  font-size: 11px;
}

.email-preview-content {
  padding: 24px 26px;
  color: #30343b;
  background: #ffffff;
}

.email-preview-content h3 {
  margin: 0 0 15px;
  color: var(--text);
  font-size: 20px;
}

.email-preview-content p {
  margin: 0 0 13px;
  font-size: 13px;
  line-height: 1.55;
}

.email-preview-summary {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, .95fr);
  overflow: hidden;
  border-radius: var(--radius-control);
  margin: 17px 0;
  background: #f3f7fb;
}

.email-preview-summary-column {
  display: grid;
  align-content: start;
  padding: 12px 14px;
}

.email-preview-summary-column > div {
  display: grid;
  grid-template-columns: minmax(116px, .8fr) minmax(0, 1.2fr);
  gap: 10px;
  padding: 7px 0;
}

.email-preview-summary-column:last-child > div {
  grid-template-columns: minmax(82px, .8fr) minmax(0, 1.2fr);
}

.email-preview-summary dt {
  color: var(--text-soft);
  font-size: 11px;
}

.email-preview-summary dd {
  min-width: 0;
  overflow-wrap: anywhere;
  margin: 0;
  font-size: 11px;
  font-weight: 760;
}

.email-preview-attachment {
  color: var(--text-soft);
}

.email-preview-attachment p {
  margin-bottom: 5px;
}

.email-preview-attachment ul {
  margin: 0 0 18px;
  padding-left: 30px;
  font-size: 12px;
  line-height: 1.55;
}

.email-preview-cta {
  display: inline-flex;
  border-radius: 8px;
  margin-bottom: 7px;
  padding: 10px 16px;
  color: #ffffff;
  background: var(--brand-aqua-strong);
  font-size: 12px;
  font-weight: 760;
}

.email-preview-cta-note {
  display: block;
  margin-bottom: 18px;
  color: var(--text-faint);
  font-size: 10px;
  line-height: 1.45;
}

.email-preview-footer {
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--line);
  padding: 15px 26px;
  color: var(--text-soft);
  background: #ffffff;
  font-size: 11px;
}

@media screen and (max-width: 1120px) {
  .record-details,
  .client-record-details,
  .shipment-record-details {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .record-details > div:nth-child(odd) {
    border-left: 0;
  }

  .record-details > div:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
}

@media screen and (max-width: 720px) {
  .record-list {
    padding: 0 12px 12px;
  }

  .record-card-head {
    display: grid;
    gap: 12px;
    padding: 14px;
  }

  .record-statuses {
    justify-content: flex-start;
  }

  .record-details,
  .client-record-details,
  .shipment-record-details,
  .shipment-overview {
    grid-template-columns: 1fr;
  }

  .record-details > div,
  .record-details > div:nth-child(n) {
    border-top: 1px solid var(--line);
    border-left: 0;
    padding: 13px 14px;
  }

  .record-details > div:first-child {
    border-top: 0;
  }

  .record-actions,
  .shipment-actions {
    display: grid;
    grid-template-columns: 1fr;
    padding: 12px 14px;
  }

  .record-actions .button,
  .shipment-actions label {
    width: 100%;
  }

  .shipment-action-buttons {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .shipment-action-buttons .button {
    width: 100%;
  }

  .shipment-overview article + article {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .shipment-progress {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    padding: 13px 14px 0;
  }

  .email-preview-head {
    align-items: flex-start;
    padding: 17px;
  }

  .email-preview-head > div {
    text-align: left;
  }

  .email-preview-content {
    padding: 19px 17px;
  }

  .email-preview-summary {
    grid-template-columns: 1fr;
  }

  .email-preview-summary-column {
    padding: 10px 12px 0;
  }

  .email-preview-summary-column:last-child {
    padding: 0 12px 10px;
  }
}

/* Vista previa: una sola barra vertical de la página y cero desbordes horizontales. */
@media screen {
  #view-preview,
  #view-preview .preview-stage,
  #view-preview .preview-pane {
    min-width: 0;
    max-width: 100%;
  }

  #view-preview .preview-stage {
    overflow: visible;
  }
}

@media screen and (max-width: 1000px) {
  #view-preview {
    overflow-x: clip;
  }

  #view-preview .preview-stage {
    padding: 7px;
  }

  #view-preview .document-preview,
  #view-preview .payment-summary-preview,
  #view-preview .shipping-label-preview {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    box-shadow: none;
  }

  #view-preview .receipt-table-wrap {
    overflow: visible;
    border: 0;
  }

  #view-preview .receipt-table,
  #view-preview .receipt-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  #view-preview .receipt-table thead {
    display: none;
  }

  #view-preview .receipt-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid #d7dee8;
    border-radius: 14px;
    margin-bottom: 10px;
    background: #ffffff;
  }

  #view-preview .receipt-table td,
  #view-preview .receipt-table td:nth-child(n) {
    display: grid;
    width: auto;
    min-width: 0;
    gap: 4px;
    border: 0;
    border-top: 1px solid #e6e9ec;
    padding: 10px 11px;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #view-preview .receipt-table td::before {
    content: attr(data-label);
    color: #7a8490;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
  }

  #view-preview .receipt-table .receipt-code,
  #view-preview .receipt-table .receipt-description,
  #view-preview .receipt-table .receipt-product-image {
    grid-column: 1 / -1;
  }

  #view-preview .receipt-table .receipt-code {
    border-top: 0;
  }

  #view-preview .receipt-product-image img {
    max-width: 84px;
  }

  #view-preview .receipt-payment-grid,
  #view-preview .receipt-account-grid,
  #view-preview .receipt-summary-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .email-preview-head {
    display: grid;
    gap: 10px;
  }

  .email-preview-head img {
    width: 116px;
  }

  .email-preview-summary-column > div,
  .email-preview-summary-column:last-child > div {
    grid-template-columns: minmax(105px, .85fr) minmax(0, 1.15fr);
  }
}

/* Ficha rápida del cliente: una sola barra vertical y cero desborde horizontal. */
@media screen and (max-width: 900px) {
  .client-quick-identity {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .client-quick-identity .quick-wide {
    grid-column: 1 / -1;
  }
}

@media screen and (max-width: 720px) {
  #clientQuickViewDialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  .client-quick-card {
    height: calc(100dvh - 16px);
    max-height: calc(100dvh - 16px);
    padding: 18px;
  }

  .client-quick-card > header h2 {
    font-size: clamp(19px, 6vw, 23px);
  }

  .client-quick-body {
    gap: 16px;
    margin-top: 16px;
    padding-right: 2px;
    scrollbar-gutter: auto;
  }

  .client-quick-identity,
  .client-quick-metrics,
  .quick-address-list,
  .quick-document-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .client-quick-identity .quick-wide {
    grid-column: auto;
  }

  .quick-document {
    align-items: flex-start;
  }
}

/* Confirmación previa y catálogo: sin desplazamiento horizontal en celular. */
@media screen and (max-width: 720px) {
  .modal-document-review {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  .document-review-card {
    max-height: calc(100dvh - 16px);
  }

  .document-review-card > header,
  .document-review-card > footer,
  .document-review-card > .form-error {
    margin-right: 16px;
    margin-left: 16px;
  }

  .document-review-card > header {
    padding-top: 16px;
  }

  .document-review-card > footer {
    display: grid;
    grid-template-columns: 1fr;
    padding-bottom: 16px;
  }

  .document-review-card > footer .button {
    width: 100%;
  }

  .document-review-body {
    padding: 16px;
  }

  .review-document-heading,
  .review-information-grid,
  .review-totals-and-notes {
    grid-template-columns: minmax(0, 1fr);
  }

  .review-document-heading > div:last-child {
    border-top: 1px solid rgb(255 255 255 / 22%);
    border-left: 0;
    text-align: left;
  }

  .review-information-grid > div:nth-child(n) {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .review-information-grid > div:first-child {
    border-top: 0;
  }

  .review-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .review-item dl > div {
    text-align: left;
  }

  #view-products .table-wrap {
    overflow: visible;
  }

  #view-products table,
  #view-products tbody {
    display: block;
    width: 100%;
  }

  #view-products thead {
    display: none;
  }

  #view-products tbody {
    padding: 0 12px 12px;
  }

  #view-products tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    border-top: 1px solid var(--line);
    padding: 15px 0;
  }

  #view-products tbody td {
    display: grid;
    min-width: 0;
    align-content: start;
    gap: 3px;
    border: 0;
    padding: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #view-products tbody td::before {
    content: attr(data-label);
    color: var(--text-faint);
    font-size: 9px;
    font-weight: 820;
    letter-spacing: .05em;
    text-transform: uppercase;
  }

  #view-products tbody td:nth-child(1),
  #view-products tbody td:nth-child(3),
  #view-products tbody td:nth-child(9) {
    grid-column: 1 / -1;
  }

  #view-products .row-actions,
  #view-products .row-actions .button {
    width: 100%;
  }

  #view-products .row-actions .button {
    flex: 1;
  }
}
/* Conexiones operativas: SUNAT, GRE y correo. */
.integration-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.integration-card {
  padding: 24px;
  min-width: 0;
}

.integration-card > header,
.integration-card > header > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.integration-card > header > div {
  justify-content: flex-start;
}

.integration-card h2,
.integration-card p {
  margin: 0;
}

.integration-card header p {
  margin-top: 4px;
  color: var(--muted);
}

.integration-symbol {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 14px;
  color: #fff;
  background: #553bd4;
  font-weight: 800;
  font-size: 20px;
}

.integration-symbol.is-email {
  color: #062b38;
  background: #47e1ed;
}

.integration-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 22px 0;
  overflow: hidden;
  border: 1px solid #dfe5ef;
  border-radius: 14px;
  background: #dfe5ef;
}

.integration-summary > div {
  min-width: 0;
  padding: 14px;
  background: #f8fafc;
}

.integration-summary span,
.integration-summary strong {
  display: block;
  overflow-wrap: anywhere;
}

.integration-summary span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.integration-wide {
  grid-column: 1 / -1;
}

.integration-checklist {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.integration-checklist li {
  display: grid;
  grid-template-columns: minmax(160px, .8fr) minmax(0, 1.2fr);
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid #e7ebf2;
}

.integration-checklist li:last-child {
  border-bottom: 0;
}

.integration-checklist span {
  color: var(--muted);
}

.integration-callout {
  display: grid;
  gap: 4px;
  margin-top: 20px;
  padding: 14px 16px;
  border-left: 4px solid #47e1ed;
  border-radius: 0 12px 12px 0;
  background: #eefcff;
}

.email-security-note.is-ready {
  border-color: #9fd8bd;
  background: #eefaf4;
  color: #174d36;
}

.shipment-action-buttons {
  flex-wrap: wrap;
}

@media (max-width: 980px) {
  .integration-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .integration-card {
    padding: 18px;
  }

  .integration-card > header {
    align-items: flex-start;
    flex-direction: column;
  }

  .integration-summary,
  .integration-checklist li {
    grid-template-columns: 1fr;
  }

  .integration-checklist li {
    gap: 4px;
  }

  .shipment-action-buttons,
  .shipment-action-buttons .button {
    width: 100%;
  }
}
/* September workflow: searchable catalog, clear actions and one scroll surface. */
#view-document .line-item { grid-template-columns: repeat(5,minmax(0,1fr)) 40px; border: 1px solid var(--line); border-radius: 16px; padding: 18px; background: #fbfcff; }
#view-document .line-item > .line-product-picker { grid-column: 1 / -1; min-width: 0; position: relative; }
.line-product-search-control { display: flex; gap: 10px; align-items: stretch; min-width: 0; }
.line-product-search-control input { flex: 1; min-width: 0; width: 0; }
.line-product-search-control button { flex: none; }
.line-product-results { position: absolute; top: 100%; left: 0; right: 0; z-index: 25; max-height: 300px; overflow-y: auto; background: #fff; border: 1px solid #d7dbea; border-radius: 12px; box-shadow: 0 12px 30px #16294b20; padding: 5px; }
.line-product-results button { display: grid; grid-template-columns: 90px minmax(0,1fr); gap: 4px 10px; width: 100%; text-align: left; padding: 12px; border: 0; background: #fff; border-radius: 8px; color: #152346; cursor: pointer; }
.line-product-results button small { grid-column: 2; color: #5c6575; }
.line-product-results button span { overflow-wrap: anywhere; }
.line-product-results button:hover,.line-product-results button:focus { background: #edf9fb; outline: 2px solid #70cfdd; outline-offset: -2px; }
.line-product-results .create-product-result { display: block; color: #553bd4; font-weight: 700; }
#view-document .line-secondary { grid-template-columns: repeat(4,minmax(0,1fr)); }
#view-document .line-secondary .line-description-field { grid-column: 1 / -1; }
#view-document .line-item.needs-product { border-left: 4px solid #d79a28; }
.required-star { color: #b63838; }
.new-client-control { align-self: start; }
.new-client-control > .button { margin: 0; min-height: 46px; width: 100%; }
.sunat-pdf-import,.pdf-import-bar,.pdf-import-callout { align-items: center; }
label.button[for="sunatPdfFile"] { flex: none; align-self: center; margin: 0; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; min-height: 46px; }
.delivery-completion-control { display: flex; align-items: center; gap: 18px; margin-top: 18px; background: #f0faf5; border-radius: 12px; padding: 12px 16px; border: 1px solid #c5e3d3; }
.delivery-completion-control > .same-client-option { flex: 1; margin: 0; border: 0; background: transparent; padding: 0; }
.delivery-completion-control > .field { max-width: 210px; }
#view-dashboard .metric-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
#view-dashboard .metric:nth-child(2) { border-top: 3px solid #8b74dc; }
#view-dashboard .metric:nth-child(3) { border-top: 3px solid #dfad4b; }
#view-dashboard .metric:nth-child(4) { border-top: 3px solid #52a887; }
.dashboard-shortcuts { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0; }
.dashboard-details { padding: 14px 18px; margin-bottom: 20px; }
.dashboard-details summary { cursor: pointer; color: #5b6579; }
.dashboard-details > div { display: flex; flex-wrap: wrap; gap: 25px; padding-top: 16px; }
.document-preset-actions .button { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; }
.document-preset-actions small { font-size: 11px; font-weight: 400; white-space: normal; }
.document-preset-actions [data-document-preset="business-quote"] { background: #f1edfc; border-color: #dad0ef; color: #573aad; }
.document-preset-actions [data-document-preset="technical-service"] { background: #fff6e9; border-color: #ecdbb9; color: #795019; }
.whatsapp-review-item { display: grid !important; grid-template-columns: minmax(0,1fr) 150px; gap: 16px; padding: 14px; border-bottom: 1px solid var(--line); }
.import-include { display: flex; align-items: flex-start; gap: 12px; }
.import-include input { flex: none; width: 18px; height: 18px; margin-top: 3px; }
.import-include span { display: grid; gap: 5px; }
.import-include small { color: #697386; }
.whatsapp-review-item.is-unmatched { background: #fff9ed; }
.preview-toolbar-actions { gap: 8px; }
.preview-toolbar-actions .button { min-height: 40px; padding: 9px 13px; font-size: 13px; }
@media (max-width: 1100px) {
  #view-document .line-item { grid-template-columns: repeat(3,minmax(0,1fr)); }
  #view-document .line-item > :nth-child(n) { grid-column: auto; grid-row: auto; }
  #view-document .line-item > .line-product-picker,#view-document .line-item > .line-secondary { grid-column: 1 / -1; }
  #view-document .line-secondary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #view-dashboard .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 640px) {
  #view-document .line-item { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 12px; }
  .line-product-search-control { flex-wrap: wrap; }
  .line-product-search-control input { width: 100%; flex-basis: 100%; }
  .line-product-search-control button { padding: 8px 12px; min-height: 36px; }
  .line-product-results button { grid-template-columns: 65px minmax(0,1fr); font-size: 12px; }
  .delivery-completion-control { align-items: stretch; flex-direction: column; }
  .delivery-completion-control > .field { max-width: none; width: 100%; }
  .whatsapp-review-item { grid-template-columns: minmax(0,1fr); }
  .document-preset-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .preview-toolbar-actions .button { flex: 1 1 140px; }
  #view-dashboard .metric { padding: 16px; }
  #view-dashboard .metric strong { font-size: 24px; }
  #view-dashboard .analytics-grid { grid-template-columns: minmax(0,1fr); }
}

.preview-view .preview-toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; }
.preview-view .preview-export-actions,.preview-view .preview-share-actions { display: flex; gap: 8px; }
.preview-more-actions { position: relative; }
.preview-more-actions summary { padding: 12px; cursor: pointer; border: 1px solid #d9dcea; border-radius: 10px; font-weight: 700; font-size: 13px; }
.preview-more-actions > div { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0; }
.preview-more-actions[open] { flex-basis: 100%; }
.download-retry { display: block; margin: 8px 24px; overflow-wrap: anywhere; font-size: 12px; }
.download-retry[hidden] { display: none; }
.png-export-source .receipt-table th { white-space: normal !important; overflow: visible !important; text-overflow: clip; padding: 10px 5px; font-size: 10px; letter-spacing: .4px; }
@media (max-width:1000px) {
  .preview-view .preview-page-toolbar { flex-direction: column; align-items: stretch; }
  .preview-view .preview-toolbar-start { width: 100%; flex: none; }
  .preview-view .preview-toolbar-start > div { min-width: 0; }
  .preview-view .preview-toolbar-actions { width: 100%; justify-content: flex-start; }
}
@media (max-width:640px) {
  .preview-view .preview-toolbar-actions { display: grid; grid-template-columns: minmax(0,1fr); }
  .preview-view .preview-tabs { grid-column: 1 / -1; }
  .preview-view .preview-export-actions,.preview-view .preview-share-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .preview-view .preview-toolbar-actions .button { min-width: 0; width: 100%; font-size: 12px; }
  .preview-more-actions > div { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
}
