:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  color: #241f20;
  background: #f4f2f1;
  --black: #1f1b1c;
  --orange: #fa7827;
  --line: #dfd8d5;
  --muted: #665e5e;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -.045em; line-height: 1.05; }
h2 { font-size: 1.3rem; letter-spacing: -.025em; }
h3 { font-size: 1rem; margin-top: 1rem; }
a { color: #873505; text-underline-offset: .2em; }
:focus-visible { outline: 3px solid #b74e13; outline-offset: 3px; }
.muted { color: var(--muted); }
.topbar, .hero { color: white; background: var(--black); }
.topbar { border-bottom: 3px solid var(--orange); }
.frame { width: min(100% - 2rem, 69rem); margin-inline: auto; }
.topbar-inner, .identity, .page-heading, nav, .panel-head, .filters, .pager {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
}
.topbar-inner, .page-heading, .panel-head { justify-content: space-between; }
.topbar-inner { min-height: 4.25rem; }
.topbar img { width: 8.5rem; display: block; }
.identity { font-size: .9rem; }
.page-heading { padding: 2rem 0 1.35rem; }
.page-heading p { margin-top: .4rem; }
nav { gap: 1rem; }
main.frame { padding-bottom: 2rem; }
.card {
  background: white;
  padding: clamp(1rem, 3vw, 1.65rem);
  border: 1px solid var(--line);
  border-radius: .7rem;
  overflow-wrap: anywhere;
}
button, .primary, .secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: .55rem .85rem;
  border-radius: .45rem;
  border: 1px solid #bdb4b0;
  background: white;
  color: inherit;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
button:hover, .secondary:hover { background: #f4f2f1; }
button:disabled { opacity: .6; cursor: default; }
.primary { background: var(--orange); color: #201510; border-color: transparent; }
.primary:hover { background: #ed6818; }
.outline { background: transparent; border-color: #807576; color: white; min-height: 2.35rem; }
.outline:hover { background: #3a3133; }
.filters [aria-pressed="true"] { background: #fff2e8; color: #78330d; border-color: #c97b4d; }
.panel-head { padding-bottom: .8rem; }
.record {
  display: grid;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) minmax(6rem, .4fr) minmax(5rem, .4fr) auto;
  gap: .65rem;
  padding: .9rem .55rem;
  color: inherit;
  text-decoration: none;
  border-top: 1px solid var(--line);
}
.record div { display: grid; gap: .25rem; }
.record-open { color: #873505; }
.record:hover { background: #fbf5f0; }
.empty { padding: 1rem 0; color: var(--muted); }
.pager { justify-content: end; margin-top: 1rem; }
.notice, .feedback, .state { padding: .75rem .85rem; border-radius: .45rem; margin-bottom: 1rem; }
.notice, .pendiente { background: #fff2e8; color: #78330d; }
.feedback { background: #ffede9; color: #9c2715; }
.capturada { background: #e9f4ec; color: #285c3b; }
fieldset { border: 0; min-width: 0; padding: 0; margin: 1rem 0 1.35rem; }
legend { font-weight: 700; padding: 0 0 .65rem; }
label { display: block; font-size: .9rem; font-weight: 650; }
input:not([type="checkbox"]) {
  display: block;
  width: 100%;
  min-height: 2.7rem;
  margin-top: .28rem;
  padding: .6rem .65rem;
  border: 1px solid #bdb4b0;
  border-radius: .4rem;
  color: inherit;
  background: white;
  font: inherit;
  font-weight: 450;
}
input[readonly] { background: #f4f2f1; }
.editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .55rem 1rem;
}
.editor-date {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .35rem .6rem;
}
.editor-date input[type="date"] {
  width: 10rem;
  max-width: 100%;
  min-height: 2.4rem;
  margin: 0;
  padding-block: .35rem;
}
.editor-heading + fieldset { margin-top: .65rem; }
.fields, .field-grid { display: grid; gap: .85rem; }
.fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.item {
  display: grid;
  align-items: start;
  grid-template-columns: minmax(0, 2fr) minmax(7rem, .8fr) minmax(10rem, 1fr) minmax(0, 1fr) auto;
  gap: .65rem;
  padding: .7rem 0;
  border-top: 1px solid var(--line);
}
.line-amount { display: grid; gap: .65rem; }
.line-amount span { font-size: .9rem; font-weight: 650; }
.line-amount output { padding-bottom: .6rem; }
.item > .remove { margin-top: 1.35rem; }
.item-field-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .35rem;
  min-height: 1.5rem;
}
.field-hint {
  color: var(--muted);
  font-size: .73rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
button.suggested-price {
  min-height: 1.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  font-weight: 400;
}
button.suggested-price:hover { text-decoration: underline; }
.remision-notes {
  margin: .65rem clamp(1rem, 3vw, 1.65rem) 0;
  padding-left: .9rem;
  list-style-type: "* ";
  color: var(--muted);
  font-size: .78rem;
}
.remision-notes li + li { margin-top: .2rem; }
.totals { display: grid; gap: .5rem; width: min(100%, 21rem); margin: 0 0 0 auto; }
.totals div { display: flex; gap: .55rem; justify-content: space-between; padding: .4rem 0; }
.totals .total { border-top: 1px solid var(--line); font-weight: 750; }
.action {
  display: flex;
  min-width: min(100%, 13.5rem);
  min-height: 3.15rem;
  margin: 1.35rem 0 0 auto;
}
.details { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .7rem; }
.details dt { color: var(--muted); font-size: .85rem; }
.details dd { margin: .2rem 0 0; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { border-bottom: 1px solid var(--line); padding: .65rem; }
th { background: #f4f2f1; }
.history { padding-left: 1.25rem; display: grid; gap: .4rem; }
.capture {
  display: grid;
  justify-items: start;
  gap: .7rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.checkbox { display: flex; align-items: start; gap: .45rem; cursor: pointer; }
.checkbox input { accent-color: #a94307; width: 1.15rem; height: 1.15rem; margin: 0; flex: none; }
#payment-option { margin-top: .85rem; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-shell { width: min(100%, 28rem); }
.hero { padding: 1.5rem; border-radius: .7rem .7rem 0 0; }
.hero img { width: 10rem; display: block; }
.accent { display: block; width: 2.85rem; height: 4px; margin: 1.3rem 0 .65rem; background: var(--orange); }
.login-card { border-radius: 0 0 .7rem .7rem; }
.login-card p { margin: .45rem 0 1rem; }
#login-form { display: grid; gap: .85rem; margin: .9rem 0 1.25rem; }
#login-form .feedback { margin: 0; }
@media (max-width: 43rem) {
  .item { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
  .item .product-field { grid-row: 1; grid-column: 1 / -1; }
  .item .remove { justify-self: end; grid-column: 2; }
  .record { grid-template-columns: minmax(0, 1fr) auto; }
  .record > :nth-child(2) { grid-row: 2; }
  .record-open { justify-self: end; }
}
@media (max-width: 27rem) {
  .fields { grid-template-columns: minmax(0, 1fr); }
}


.filter-form {
  display: flex;
  gap: .65rem;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.filter-form label { flex: 1 1 9.5rem; min-width: 0; }
.filter-form a { align-self: center; }
.revision { background: #fff2d6; color: #63430e; }
.anulada { background: #ffede9; color: #9c2715; }
.cancel-remision { border-top: 1px solid var(--line); margin-top: 1.35rem; padding-top: .85rem; }
.cancel-remision summary { width: fit-content; color: #9c2715; cursor: pointer; }
.cancel-remision form { display: grid; justify-items: start; gap: .65rem; margin-top: .75rem; }
.cancel-remision label { width: min(100%, 28rem); }
.cancel-remision form button { color: #9c2715; border-color: #c78478; }
.changes { padding: .25rem .5rem; background: #f4f2f1; margin-top: .35rem; }
.changes summary { cursor: pointer; }
.changes div { margin: .55rem 0; }
.field-error { display: block; margin-top: .35rem; color: #9c2715; font-weight: 500; }
input[aria-invalid="true"] { border-color: #9c2715; }


#detail-actions > a + a { margin-left: .85rem; }
.print-view .topbar, .print-view .page-heading { display: none; }
.print-view main { max-width: 52rem; padding: 1rem 0; }
.print-actions { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.save-confirmation {
  margin-bottom: 1.55rem;
  padding: 0 0 1rem;
  border-bottom: 1px solid var(--line);
  text-align: center;
}
.save-confirmation h1 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35em;
  color: #17623b;
  font-size: clamp(1.55rem, 5vw, 2.15rem);
}
.save-check {
  display: grid;
  flex: none;
  width: 1.1em;
  height: 1.1em;
  place-items: center;
  border-radius: 50%;
  background: #e4f3e9;
}
.save-check::before {
  content: "";
  width: .42em;
  height: .23em;
  border: solid currentColor;
  border-width: 0 0 .08em .08em;
  transform: translateY(-.05em) rotate(-45deg);
}
.save-confirmation p { margin-top: .4rem; color: var(--muted); }
.saved-actions { justify-content: center; margin-top: 1.35rem; }
.print-note {
  --note-ink: #252a31;
  --note-rule: #c1c5c9;
  --note-band: #f0f1f2;
  width: min(100%, 145mm);
  margin-inline: auto;
  color: #161b22;
  font: 10pt Arial, sans-serif;
}
.print-header { display: grid; justify-items: center; gap: .55rem; margin-bottom: .95rem; }
.print-header img { width: min(85%, 64mm); filter: invert(1) grayscale(1) contrast(2); }
.print-header h1, .print-header h2 { margin: 0; font: bold 16pt Arial, sans-serif; text-align: center; letter-spacing: -.015em; }
.print-fields {
  display: grid;
  grid-template-columns: minmax(0, 64fr) minmax(0, 36fr);
  margin-bottom: 12mm;
  border-top: 1px solid var(--note-rule);
}
.print-fields > div { min-height: 5.5mm; border-bottom: 1px solid var(--note-rule); }
.print-field { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); align-items: baseline; gap: .35rem; padding: .18rem .35rem; }
.print-field:last-child { grid-template-columns: 2rem minmax(0, 1fr); }
.print-field strong { color: #525a64; font-size: 8pt; text-transform: uppercase; }
.print-field span { min-width: 0; overflow-wrap: anywhere; }
.print-address { grid-column: 1 / -1; }
.print-date-heading {
  display: grid; place-items: center;
  background: var(--note-band); color: var(--note-ink); font-size: 8pt; font-weight: 750; text-transform: uppercase;
}
.print-date { display: grid; grid-template-columns: 1fr 1fr 1fr; text-align: center; }
.print-date span { padding: .18rem .05rem; }
.print-date span + span { border-left: 1px solid var(--note-rule); }
.print-note table { table-layout: fixed; }
.print-note .table-scroll { min-height: 50mm; }
.print-note th, .print-note td { border-block: 1px solid var(--note-rule); padding: .25rem .32rem; }
.print-note th {
  background: var(--note-band); color: var(--note-ink);
  font-size: 8pt; text-align: center; text-transform: uppercase;
}
.print-note th:nth-child(1) { width: 14%; }
.print-note th:nth-child(2) { width: 46%; text-align: left; }
.print-note th:nth-child(n+3) { width: 20%; text-align: right; }
.print-note td { padding-block: .36rem; }
.print-note td:first-child { text-align: center; }
.print-note td:nth-child(n+3) { text-align: right; font-variant-numeric: tabular-nums; }
.print-totals { width: 40%; margin: .5rem 0 0 auto; }
.print-totals div { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--note-rule); }
.print-totals dt {
  padding: .2rem 0;
  color: var(--note-ink); font-size: 8pt; font-weight: 750; text-transform: uppercase;
}
.print-totals dd { margin: 0; padding: .2rem .3rem; text-align: right; font-variant-numeric: tabular-nums; }
.print-totals div:last-child { border-top: 1px solid #343a44; border-bottom: 0; margin-top: .15rem; }
.print-totals div:last-child dd { font-weight: 750; }
.print-note::after { content: ""; display: block; margin-top: .65rem; border-top: 1px solid var(--note-rule); }
.print-note:has(.print-payment)::after { display: none; }
.print-payment { margin-top: .65rem; padding: .7rem 0 0 .32rem; border-top: 1px solid var(--note-rule); break-inside: avoid; }
.print-payment h3 { margin: 0 0 .25rem; font-size: 9pt; }
.print-payment .details { display: grid; gap: .18rem; margin: 0; }
.print-payment .details > div { display: grid; grid-template-columns: 4rem minmax(0, 1fr); }
.print-payment dt { font-size: inherit; }
.print-payment dd { margin: 0; }
@media screen and (max-width: 36rem) {
  .print-note { font-size: 9pt; }
  .print-note th { font-size: 7pt; }
  .print-totals { width: 55%; }
}
@media print {
  @page { size: letter; margin: 14mm; }
  :root, body { background: white; color: black; }
  body:not(.print-view) { display: none; }
  .print-view .print-actions, .save-confirmation, .saved-actions, .print-view #status, .print-view #error { display: none; }
  .print-view main.frame { width: 100%; max-width: none; padding: 0; }
  #print-view { border: 0; padding: 0; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .print-note { padding-top: 29mm; }
  #print-view .table-scroll { overflow: visible; }
  .print-note tr, .print-fields, .print-totals { break-inside: avoid; }
  .print-note thead { display: table-header-group; }
}


.product-field { position: relative; min-width: 0; }
.product-status { font-size: .82rem; }
.product-status:not(:empty) { padding-top: .35rem; }
.product-suggestions {
  position: absolute; top: calc(100% + .2rem); left: 0; right: 0; z-index: 3;
  max-height: 17rem; overflow-y: auto; background: white; border: 1px solid #bdb4b0;
  border-radius: .4rem; box-shadow: 0 .35rem 1rem #241f2022;
}
.product-option { display: flex; align-items: center; gap: .55rem; padding: .55rem; cursor: pointer; }
.product-option + .product-option { border-top: 1px solid var(--line); }
.product-option:hover, .product-option[aria-selected="true"] { background: #fff2e8; }
.product-option img { width: 2.5rem; height: 2.5rem; object-fit: contain; flex: none; }
.product-option strong, .product-option span { display: block; font-size: .85rem; }
.internal-margin { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .75rem; background: #e8f5ec; color: #1c4d33; border: 1px solid #a9cfb6; border-radius: .4rem; padding: .6rem .7rem; font-size: .86rem; }
.margin-values { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; margin-top: .3rem; }
.piece-profit {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .2rem .45rem;
}
.piece-profit strong { color: #0b6031; font-size: 1.02rem; font-weight: 800; }
.profit-percent { font-size: .78em; font-weight: 550; white-space: nowrap; }
.tax-profit { display: grid; gap: .35rem; margin: 0; padding-left: .8rem; border-left: 1px solid #a9cfb6; }
.tax-profit div { display: flex; justify-content: space-between; gap: .45rem .85rem; align-items: baseline; }
.tax-profit dd { display: flex; gap: .4rem; align-items: baseline; margin: 0; font-weight: 750; text-align: right; white-space: nowrap; }
[data-profit-tone="negative"] > :is(strong, small),
.tax-profit [data-profit-tone="negative"] > span { color: #a1241b; }
[data-profit-tone="below-target"] > :is(strong, small),
.tax-profit [data-profit-tone="below-target"] > span { color: #765000; background: #fff1bd; border-radius: .15em; }
@media (max-width: 43rem) {
  .product-suggestions { position: static; margin-top: .25rem; }
  .internal-margin { grid-template-columns: minmax(0, 1fr); gap: .55rem; }
  .tax-profit { border-left: 0; border-top: 1px solid #a9cfb6; padding: .5rem 0 0; }
}
