:root {
  color-scheme: light;
  --green-950: #082d25;
  --green-900: #0d3b31;
  --green-800: #145244;
  --green-700: #1c6755;
  --green-100: #dcebe5;
  --green-50: #edf6f2;
  --gold-600: #a97819;
  --gold-500: #c49738;
  --gold-300: #dec17c;
  --cream-100: #f6f0e2;
  --cream-50: #fbf8f0;
  --ink: #1d2824;
  --muted: #66736e;
  --line: #d9dfdb;
  --surface: #ffffff;
  --danger: #a43b37;
  --danger-soft: #f9e8e6;
  --warning: #8a610e;
  --warning-soft: #fff4d7;
  --success: #1b684d;
  --success-soft: #e2f3eb;
  --info: #225f80;
  --info-soft: #e3f1f8;
  --sidebar-width: 17rem;
  --sidebar-collapsed-width: 5.25rem;
  --topbar-height: 4.25rem;
  --radius: 0.65rem;
  --shadow-sm: 0 2px 7px rgba(8, 45, 37, 0.08);
  --shadow-md: 0 12px 30px rgba(8, 45, 37, 0.12);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-synthesis: none;
  line-height: 1.5;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 20rem;
  background: var(--cream-50);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 4%, rgba(196, 151, 56, 0.09), transparent 23rem),
    var(--cream-50);
  font-size: 0.9375rem;
}

body.sidebar-open {
  overflow: hidden;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--green-700);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--green-900);
}

img,
svg {
  max-width: 100%;
}

:focus-visible {
  outline: 3px solid rgba(196, 151, 56, 0.55);
  outline-offset: 2px;
}

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

.sidebar {
  position: fixed;
  z-index: 50;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  color: #f5f8f6;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 35%),
    var(--green-950);
  border-right: 1px solid rgba(222, 193, 124, 0.25);
  box-shadow: 8px 0 30px rgba(8, 45, 37, 0.1);
  transition: width 200ms ease;
}

.sidebar-header {
  position: relative;
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
  display: flex;
  min-width: 0;
  min-height: calc(var(--topbar-height) - 1px);
  flex: 1;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 0.5rem 0.8rem 1.25rem;
  color: #fff;
  text-decoration: none;
}

.sidebar-brand img {
  width: 2.65rem;
  height: 2.65rem;
  flex: 0 0 auto;
  object-fit: contain;
  background: #fff;
  border: 2px solid var(--gold-300);
  border-radius: 50%;
}

.sidebar-brand strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  letter-spacing: 0.045em;
  line-height: 1.1;
}

.sidebar-brand small {
  display: block;
  margin-top: 0.2rem;
  color: var(--gold-300);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-collapse-toggle {
  position: relative;
  z-index: 1;
  display: none;
  width: 2rem;
  height: 2rem;
  margin-right: 0.75rem;
  padding: 0;
  flex: 0 0 auto;
  place-items: center;
  color: var(--gold-300);
  background: var(--green-900);
  border: 1px solid rgba(222, 193, 124, 0.38);
  border-radius: 0.4rem;
  cursor: pointer;
  line-height: 1;
  pointer-events: auto;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.sidebar-collapse-toggle:hover {
  color: #fff;
  background: var(--green-800);
  border-color: var(--gold-300);
}

.sidebar-toggle-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.sidebar-nav {
  display: grid;
  gap: 0.3rem;
  padding: 1.25rem 0.85rem;
}

.sidebar-nav-label {
  margin: 1rem 0.65rem 0.35rem;
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sidebar-nav a {
  display: flex;
  min-height: 2.65rem;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.8rem;
  color: rgba(255, 255, 255, 0.78);
  border: 1px solid transparent;
  border-radius: 0.45rem;
  text-decoration: none;
  transition: 160ms ease;
}

.sidebar-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.sidebar-nav a[aria-current="page"],
.sidebar-nav a.is-active {
  color: #fff;
  background: rgba(196, 151, 56, 0.16);
  border-color: rgba(222, 193, 124, 0.3);
  box-shadow: inset 3px 0 0 var(--gold-500);
}

.sidebar-nav svg,
.sidebar-nav .nav-icon {
  display: grid;
  width: 1.25rem;
  height: 1.25rem;
  flex: 0 0 auto;
  place-items: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.25rem;
  color: rgba(255, 255, 255, 0.55);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.75rem;
}

.sidebar-backdrop {
  display: none;
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  gap: 1rem;
  margin-left: var(--sidebar-width);
  padding: 0.65rem clamp(1rem, 3vw, 2.25rem);
  background: rgba(251, 248, 240, 0.94);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  transition: margin-left 200ms ease;
}

.topbar-title {
  min-width: 0;
  margin-right: auto;
}

.topbar-title strong {
  display: block;
  overflow: hidden;
  color: var(--green-950);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-title small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.6rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.user-chip-avatar {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  color: #fff;
  background: var(--green-800);
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 800;
}

.main {
  min-width: 0;
  margin-left: var(--sidebar-width);
  transition: margin-left 200ms ease;
}

.main-content,
.content {
  width: min(100%, 100rem);
  margin-inline: auto;
  padding: clamp(1.1rem, 3vw, 2.25rem);
}

.content-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.content-header h1 {
  margin: 0;
  color: var(--green-950);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.65rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.content-header p {
  max-width: 48rem;
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.content-header > div:first-child {
  position: relative;
  padding-bottom: 0.65rem;
}

.content-header > div:first-child::after {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 3.25rem;
  height: 0.2rem;
  content: "";
  background: var(--gold-500);
  border-radius: 999px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stats-grid.is-five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stat-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 1.15rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.stat-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0.25rem;
  content: "";
  background: var(--gold-500);
}

.stat-card-label {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stat-card-value {
  display: block;
  margin-top: 0.25rem;
  color: var(--green-950);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1.15;
}

.stat-card-detail {
  display: block;
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.stat-card.is-success::before {
  background: var(--success);
}

.stat-card.is-warning::before {
  background: var(--warning);
}

.stat-card.is-danger::before {
  background: var(--danger);
}

.panel {
  margin-bottom: 1.25rem;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.output-products-panel {
  overflow: visible;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem;
  background: linear-gradient(90deg, var(--green-50), #fff 55%);
  border-bottom: 1px solid var(--line);
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
  color: var(--green-950);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.12rem;
}

.panel-body {
  padding: 1.2rem;
}

.panel-footer {
  padding: 0.85rem 1.2rem;
  background: #fafbf9;
  border-top: 1px solid var(--line);
}

.opening-balance-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.copy-recipient-editor {
  margin-top: 1.25rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
}

.copy-recipient-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.copy-recipient-heading h3,
.copy-recipient-heading p {
  margin: 0;
}

.copy-recipient-heading h3 {
  color: var(--green-950);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
}

.copy-recipient-heading p {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.copy-recipient-list {
  display: grid;
  gap: 0.75rem;
}

.copy-recipient-row {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) minmax(12rem, 1.2fr) minmax(10rem, 1fr) auto;
  align-items: end;
  gap: 0.75rem;
  padding: 0.85rem;
  background: #fafbf9;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.copy-recipient-row .field {
  grid-column: auto;
}

.memo-copy-list {
  display: grid;
  gap: 0.55rem;
}

.memo-copy-list > span + span {
  padding-top: 0.55rem;
  border-top: 1px dotted #aebbb5;
}

.reconciliation-notice,
.reconciliation-valuation-note {
  padding: 0.9rem 1rem;
  color: var(--green-950);
  background: var(--warning-soft);
  border: 1px solid #ead79a;
  border-left: 0.3rem solid var(--gold-500);
  border-radius: 0.45rem;
}

.reconciliation-table {
  min-width: 92rem;
}

.reconciliation-table tr.is-difference td {
  background: #fffaf0;
}

.reconciliation-table code,
.panel code {
  overflow-wrap: anywhere;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--ink);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  padding: 0.78rem 0.85rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--green-900);
  background: var(--green-50);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table tbody tr {
  transition: background-color 120ms ease;
}

.data-table tbody tr:hover {
  background: #fcfaf4;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table .numeric,
.data-table [data-type="numeric"] {
  text-align: right;
}

.data-table .actions-cell {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

.data-table caption {
  padding: 0.75rem;
  color: var(--muted);
  caption-side: bottom;
  text-align: left;
  font-size: 0.78rem;
}

.product-code,
.data-table td[data-label="Código"],
.money-nowrap,
.product-stock-cell,
.product-status {
  white-space: nowrap;
}

.product-catalog-table {
  min-width: 62rem;
}

.product-catalog-table .product-code {
  min-width: 7rem;
}

.product-catalog-table .money-nowrap {
  min-width: 8rem;
}

.product-catalog-table .product-name {
  width: 100%;
  min-width: 16rem;
}

.product-catalog-table .product-category {
  min-width: 9rem;
  overflow-wrap: anywhere;
}

.product-stats .stat-card-value {
  white-space: nowrap;
}

.product-meta {
  display: grid;
  grid-template-columns: minmax(10rem, 12rem) minmax(0, 1fr);
  gap: 0.65rem 1.25rem;
  margin: 0;
}

.product-meta dt {
  min-width: 0;
  color: var(--green-950);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.45;
  text-transform: uppercase;
}

.product-meta dd {
  min-width: 0;
  margin: 0;
  padding-bottom: 0.45rem;
  overflow-wrap: anywhere;
  border-bottom: 1px dotted var(--line);
  line-height: 1.5;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
}

.field {
  grid-column: span 6;
  min-width: 0;
}

.field.full,
.field.is-full,
.form-grid > fieldset {
  grid-column: 1 / -1;
}

.field.third {
  grid-column: span 4;
}

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

.field label,
.field-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--green-950);
  font-size: 0.8rem;
  font-weight: 700;
}

.field label .required,
.required-marker {
  color: var(--danger);
}

.field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.field select,
.field textarea,
.form-control {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.62rem 0.72rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid #bac5c0;
  border-radius: 0.4rem;
  box-shadow: inset 0 1px 2px rgba(8, 45, 37, 0.035);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.field textarea,
textarea.form-control {
  min-height: 7rem;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.form-control:focus {
  border-color: var(--green-700);
  box-shadow: 0 0 0 3px rgba(28, 103, 85, 0.12);
  outline: 0;
}

.field input:disabled,
.field select:disabled,
.field textarea:disabled,
.form-control:disabled {
  color: #75807c;
  background: #f1f3f1;
  cursor: not-allowed;
}

.institutional-field input[readonly] {
  color: var(--green-950);
  background: #f1f3f1;
  cursor: default;
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"],
.form-control[aria-invalid="true"] {
  border-color: var(--danger);
}

.field-help,
.field-error {
  display: block;
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.field-error {
  color: var(--danger);
}

.check-field {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.check-field input {
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.17rem;
  accent-color: var(--green-700);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.btn {
  display: inline-flex;
  min-height: 2.55rem;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.58rem 0.95rem;
  color: #fff;
  background: var(--green-800);
  border: 1px solid var(--green-800);
  border-radius: 0.4rem;
  box-shadow: 0 2px 4px rgba(8, 45, 37, 0.12);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  transition: transform 100ms ease, background-color 120ms ease, border-color 120ms ease;
}

.btn:hover {
  color: #fff;
  background: var(--green-900);
  border-color: var(--green-900);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
}

form[aria-busy="true"] button[type="submit"],
form[aria-busy="true"] input[type="submit"] {
  opacity: 0.58;
  pointer-events: none;
}

.btn-secondary {
  color: var(--green-900);
  background: #fff;
  border-color: #aebbb5;
  box-shadow: none;
}

.btn-secondary:hover {
  color: var(--green-950);
  background: var(--green-50);
  border-color: var(--green-700);
}

.btn-gold {
  color: #291d07;
  background: var(--gold-500);
  border-color: var(--gold-500);
}

.btn-gold:hover {
  color: #211704;
  background: var(--gold-300);
  border-color: var(--gold-300);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #812d2a;
  border-color: #812d2a;
}

.btn-success {
  background: var(--success);
  border-color: var(--success);
}

.btn-success:hover {
  background: #14523c;
  border-color: #14523c;
}

.btn-sm {
  min-height: 2rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
}

.btn-icon {
  width: 2.55rem;
  padding-inline: 0;
}

.badge {
  display: inline-flex;
  min-height: 1.55rem;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  color: var(--green-900);
  background: var(--green-100);
  border: 1px solid rgba(28, 103, 85, 0.16);
  border-radius: 999px;
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1;
  white-space: nowrap;
}

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

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

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

.badge-info {
  color: var(--info);
  background: var(--info-soft);
}

.flash {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.85rem 2.8rem 0.85rem 1rem;
  color: var(--info);
  background: var(--info-soft);
  border: 1px solid #b8d7e7;
  border-left: 4px solid var(--info);
  border-radius: 0.45rem;
  transition: opacity 180ms ease, transform 180ms ease;
}

.flash-success {
  color: var(--success);
  background: var(--success-soft);
  border-color: #b9decf;
  border-left-color: var(--success);
}

.flash-warning {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: #ead493;
  border-left-color: var(--warning);
}

.flash-danger,
.flash-error {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #e5bbb7;
  border-left-color: var(--danger);
}

.flash.is-dismissing {
  opacity: 0;
  transform: translateY(-0.35rem);
}

.flash-dismiss {
  position: absolute;
  top: 0.48rem;
  right: 0.55rem;
  display: grid;
  width: 1.8rem;
  height: 1.8rem;
  padding: 0;
  place-items: center;
  color: currentColor;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
}

.empty {
  display: grid;
  min-height: 13rem;
  padding: 2rem;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.empty h2,
.empty h3 {
  margin: 0 0 0.35rem;
  color: var(--green-900);
  font-family: Georgia, "Times New Roman", serif;
}

.empty p {
  max-width: 31rem;
  margin: 0 auto 1rem;
}

.mobile-toggle {
  display: none;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  color: var(--green-900);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  cursor: pointer;
}

.line-items {
  display: grid;
  gap: 0.75rem;
}

.line-item {
  display: grid;
  grid-template-columns: minmax(13rem, 3fr) minmax(6rem, 0.8fr) minmax(7rem, 1fr) minmax(7rem, 1fr) auto;
  gap: 0.7rem;
  align-items: end;
  padding: 0.85rem;
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

.line-item .field {
  grid-column: auto;
}

.line-item [data-subtotal] {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.line-items-summary {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding: 0.85rem 0;
  color: var(--green-950);
  font-size: 1rem;
}

.line-items-summary [data-grand-total] {
  min-width: 7rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: right;
}

.product-picker {
  position: relative;
  min-width: 0;
}

.product-picker select {
  padding-right: 2.2rem;
}

.product-search {
  position: relative;
  margin-bottom: 0.42rem;
}

.product-search-wrap {
  position: relative;
}

.product-search-icon {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 1rem;
  width: 0.82rem;
  height: 0.82rem;
  color: var(--muted);
  pointer-events: none;
  transform: translateY(-50%);
}

.product-search-icon::before {
  position: absolute;
  width: 0.58rem;
  height: 0.58rem;
  content: "";
  border: 2px solid currentColor;
  border-radius: 50%;
}

.product-search-icon::after {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 0.38rem;
  height: 2px;
  content: "";
  background: currentColor;
  border-radius: 2px;
  transform: rotate(45deg);
  transform-origin: right center;
}

.field .product-search input[type="search"] {
  min-height: 2.75rem;
  padding: 0.62rem 0.72rem 0.62rem 3rem;
}

.product-search-results {
  position: absolute;
  z-index: 30;
  top: calc(100% + 0.2rem);
  right: 0;
  left: 0;
  max-height: 15rem;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #bac5c0;
  border-radius: 0.4rem;
  box-shadow: 0 12px 28px rgba(8, 45, 37, 0.18);
}

.product-search-results[hidden] {
  display: none;
}

.product-search-option,
.product-search-empty {
  display: block;
  width: 100%;
  padding: 0.58rem 0.7rem;
  color: var(--ink);
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--line);
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.35;
  text-align: left;
}

.product-search-option {
  cursor: pointer;
}

.product-search-option:last-child,
.product-search-empty:last-child {
  border-bottom: 0;
}

.product-search-option:hover,
.product-search-option:focus {
  color: var(--green-950);
  background: var(--green-50);
  outline: 0;
}

.product-search-empty {
  color: var(--muted);
}

.product-stock {
  display: block;
  margin-top: 0.28rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.product-stock strong,
.product-stock [data-stock] {
  color: var(--green-800);
  font-variant-numeric: tabular-nums;
}

dialog,
.modal {
  width: min(92vw, 34rem);
  max-height: min(85vh, 48rem);
  padding: 0;
  overflow: auto;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(8, 45, 37, 0.2);
  border-radius: 0.7rem;
  box-shadow: 0 24px 70px rgba(8, 45, 37, 0.25);
}

dialog::backdrop,
.modal-backdrop {
  background: rgba(5, 25, 21, 0.62);
  backdrop-filter: blur(2px);
}

.modal-header,
.modal-body,
.modal-footer {
  padding: 1rem 1.2rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--green-950);
  background: var(--green-50);
  border-bottom: 1px solid var(--line);
}

.modal-header h2,
.modal-header h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  background: #fafbf9;
  border-top: 1px solid var(--line);
}

.memo-sheet {
  position: relative;
  width: 210mm;
  min-height: 297mm;
  margin: 1.5rem auto;
  padding: 15mm 17mm;
  color: #111;
  background: #fff;
  box-shadow: 0 10px 35px rgba(8, 45, 37, 0.14);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10.5pt;
  line-height: 1.38;
}

.memo-cancelled {
  position: absolute;
  z-index: 2;
  top: 48mm;
  right: 17mm;
  padding: 2mm 5mm;
  color: #8f302d;
  border: 1.5mm double #8f302d;
  font-size: 22pt;
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1;
  opacity: 0.82;
  transform: rotate(-8deg);
}

.status-cancelled {
  border-color: #c98986;
}

.memo-header {
  display: grid;
  grid-template-columns: 27mm 1fr 27mm;
  align-items: center;
  gap: 5mm;
  padding-bottom: 4mm;
  border-bottom: 1.2pt solid #173f35;
  text-align: center;
}

.memo-header img {
  width: 25mm;
  height: 25mm;
  object-fit: contain;
}

.memo-header h1 {
  margin: 0;
  color: #111;
  font-family: "Times New Roman", Times, serif;
  font-size: 14pt;
  line-height: 1.2;
  text-transform: uppercase;
}

.memo-header p {
  margin: 1.5mm 0 0;
  font-size: 8.5pt;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.memo-title {
  margin: 8mm 0 6mm;
  text-align: center;
}

.memo-title h2 {
  margin: 0;
  font-family: "Times New Roman", Times, serif;
  font-size: 13pt;
  text-decoration: underline;
  text-transform: uppercase;
}

.memo-meta {
  display: grid;
  grid-template-columns: 26mm 1fr;
  gap: 1.5mm 4mm;
  margin-bottom: 7mm;
}

.memo-meta dt {
  font-weight: 700;
  text-transform: uppercase;
}

.memo-meta dd {
  margin: 0;
  border-bottom: 0.5pt dotted #777;
}

.memo-body {
  min-height: 80mm;
  text-align: justify;
}

.memo-table {
  width: 100%;
  margin: 5mm 0;
  border-collapse: collapse;
  font-size: 8.5pt;
}

.memo-table th,
.memo-table td {
  padding: 1.7mm 2mm;
  border: 0.6pt solid #333;
  vertical-align: top;
}

.memo-table th {
  background: #e6eee9;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

.memo-table .numeric {
  text-align: right;
}

.memo-signatures {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15mm;
  margin-top: 20mm;
  text-align: center;
}

.memo-signature {
  padding-top: 2mm;
  border-top: 0.7pt solid #222;
  font-size: 8.5pt;
}

.memo-footer {
  margin-top: 8mm;
  padding-top: 2mm;
  border-top: 0.5pt solid #777;
  font-size: 7.5pt;
}

.print-only {
  display: none !important;
}

.report-print-header,
.report-print-signature {
  display: none !important;
}

.report-print-letterhead img {
  width: 65px;
  max-width: 65px;
  height: 65px;
  object-fit: contain;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (min-width: 56.0625rem) {
  .js .sidebar-collapse-toggle {
    display: grid;
  }

  .is-sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
  }

  .is-sidebar-collapsed .sidebar-header {
    min-height: auto;
    padding: 0.65rem 0;
    flex-direction: column;
    gap: 0.4rem;
  }

  .is-sidebar-collapsed .sidebar-brand {
    min-height: auto;
    padding: 0;
    flex: 0 0 auto;
  }

  .is-sidebar-collapsed .sidebar-brand-text,
  .is-sidebar-collapsed .sidebar-nav-label,
  .is-sidebar-collapsed .sidebar-nav .nav-text,
  .is-sidebar-collapsed .sidebar-footer span {
    display: none;
  }

  .is-sidebar-collapsed .sidebar-collapse-toggle {
    margin: 0;
  }

  .is-sidebar-collapsed .sidebar-nav {
    padding-inline: 0.65rem;
  }

  .is-sidebar-collapsed .sidebar-nav a {
    justify-content: center;
    gap: 0;
    padding-inline: 0.65rem;
  }

  .is-sidebar-collapsed .sidebar-footer {
    min-height: 1px;
    padding: 0;
  }

  .is-sidebar-collapsed .topbar,
  .is-sidebar-collapsed .main {
    margin-left: var(--sidebar-collapsed-width);
  }
}

@media (max-width: 75rem) {
  .stats-grid,
  .stats-grid.is-five {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .line-item {
    grid-template-columns: minmax(12rem, 2fr) repeat(3, minmax(6rem, 1fr)) auto;
  }
}

@media (max-width: 56rem) {
  .copy-recipient-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .copy-recipient-row {
    grid-template-columns: 1fr;
  }

  .copy-recipient-row .btn-icon {
    width: 100%;
  }

  .sidebar {
    position: static;
    width: 100%;
    max-height: none;
    transform: none;
  }

  .js .sidebar {
    position: fixed;
    width: min(86vw, 19rem);
    max-height: 100vh;
    transform: translateX(-105%);
    transition: transform 200ms ease;
  }

  .js .sidebar-open .sidebar {
    transform: translateX(0);
  }

  .js .sidebar-backdrop {
    position: fixed;
    z-index: 40;
    inset: 0;
    display: block;
    visibility: hidden;
    background: rgba(5, 25, 21, 0.58);
    opacity: 0;
    transition: opacity 200ms ease, visibility 200ms ease;
  }

  .js .sidebar-open .sidebar-backdrop {
    visibility: visible;
    opacity: 1;
  }

  .topbar,
  .main {
    margin-left: 0;
  }

  .js .mobile-toggle {
    display: grid;
  }

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

  .line-item .product-picker,
  .line-item > .field:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 42rem) {
  .topbar {
    min-height: 3.75rem;
    padding-inline: 0.75rem;
  }

  .topbar-title small,
  .user-chip span:not(.user-chip-avatar) {
    display: none;
  }

  .main-content,
  .content {
    padding: 1rem 0.75rem 2rem;
  }

  .content-header {
    align-items: stretch;
    flex-direction: column;
  }

  .content-header .actions,
  .content-header > .btn {
    justify-content: stretch;
    margin-top: 0;
  }

  .content-header .actions .btn,
  .content-header > .btn {
    flex: 1 1 auto;
  }

  .stats-grid,
  .stats-grid.is-five {
    grid-template-columns: 1fr;
  }

  .product-meta {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.2rem;
  }

  .product-meta dt:not(:first-child) {
    margin-top: 0.65rem;
  }

  .product-meta dd {
    padding-bottom: 0.6rem;
  }

  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-body {
    padding: 1rem;
  }

  .field,
  .field.third,
  .field.quarter {
    grid-column: 1 / -1;
  }

  .actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .actions .btn {
    width: 100%;
  }

  .line-item {
    grid-template-columns: 1fr;
  }

  .line-item .product-picker,
  .line-item > .field:first-child {
    grid-column: auto;
  }

  .data-table.is-stacked thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .data-table.is-stacked,
  .data-table.is-stacked tbody,
  .data-table.is-stacked tr,
  .data-table.is-stacked td {
    display: block;
    width: 100%;
  }

  .data-table.is-stacked tr {
    padding: 0.65rem;
    border-bottom: 1px solid var(--line);
  }

  .data-table.is-stacked td {
    display: grid;
    grid-template-columns: minmax(7rem, 40%) 1fr;
    gap: 0.75rem;
    padding: 0.35rem;
    border: 0;
    text-align: right;
  }

  .data-table.is-stacked td::before {
    color: var(--green-900);
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 800;
    text-align: left;
    text-transform: uppercase;
  }

  .memo-sheet {
    width: 100%;
    min-height: auto;
    margin: 0;
    padding: 1rem;
    overflow-x: auto;
    box-shadow: none;
  }
}

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

@page {
  size: A4 portrait;
  margin: 0;
}

@media print {
  html,
  body {
    width: 210mm;
    min-width: 210mm;
    margin: 0 !important;
    padding: 0 !important;
    color: #000;
    background: #fff !important;
  }

  html.report-page,
  body.report-page,
  html.executive-document {
    width: auto;
    min-width: 0;
  }

  body {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .no-print,
  .sidebar,
  .sidebar-backdrop,
  .topbar,
  .mobile-toggle,
  .flash,
  .actions {
    display: none !important;
  }

  .print-only {
    display: block !important;
  }

  .report-print-sheet,
  .exec-report-sheet {
    page: report-landscape;
    overflow: visible !important;
    break-inside: auto !important;
  }

  .report-print-header {
    display: block !important;
    margin: 0 0 5mm;
    break-after: avoid;
    break-inside: avoid;
  }

  .report-print-letterhead {
    display: grid;
    grid-template-columns: 22mm 1fr 22mm;
    align-items: center;
    gap: 4mm;
    padding-bottom: 3mm;
    border-bottom: 1.2pt solid #173f35;
    text-align: center;
  }

  .report-print-letterhead img {
    width: 65px;
    max-width: 65px;
    height: 65px;
    object-fit: contain;
  }

  .report-print-letterhead h1 {
    margin: 0;
    color: #111;
    font-family: "Times New Roman", Times, serif;
    font-size: 13pt;
    line-height: 1.15;
    text-transform: uppercase;
  }

  .report-print-letterhead p {
    margin: 1mm 0 0;
    color: #111;
    font-size: 7.5pt;
    letter-spacing: 0.035em;
    text-transform: uppercase;
  }

  .report-print-title {
    margin-top: 4mm;
    text-align: center;
  }

  .report-print-title span {
    color: #51635d;
    font-size: 7pt;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }

  .report-print-title h2 {
    margin: 1mm 0;
    color: #111;
    font-family: "Times New Roman", Times, serif;
    font-size: 12pt;
    text-transform: uppercase;
  }

  .report-print-title p {
    margin: 0;
    color: #444;
    font-size: 8pt;
  }

  .report-print-signature {
    display: block !important;
    width: 72mm;
    margin: 14mm 8mm 0 auto;
    break-inside: avoid;
    page-break-inside: avoid;
    color: #111;
    text-align: center;
  }

  .report-signature-line,
  .report-print-signature strong {
    display: block;
  }

  .report-signature-line {
    width: 100%;
    margin-bottom: 2.5mm;
    border-top: 0.7pt solid #222;
  }

  .report-print-signature strong {
    font-family: "Times New Roman", Times, serif;
    font-size: 9pt;
  }

  .report-print-sheet {
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .report-page .main-content > *:not(.report-print-sheet) {
    display: none !important;
  }

  .report-print-sheet > .panel-header {
    display: none;
  }

  .report-print-sheet .table-wrap {
    overflow: visible;
  }

  .report-print-sheet .data-table {
    width: 100%;
    table-layout: auto;
    font-size: 7.2pt;
  }

  .report-print-sheet .data-table thead {
    display: table-header-group;
  }

  .report-print-sheet .data-table tr {
    break-inside: avoid;
  }

  .report-print-sheet .data-table th,
  .report-print-sheet .data-table td {
    padding: 1.5mm 1.8mm;
    overflow-wrap: anywhere;
  }

  .report-print-sheet .data-table th {
    color: #173f35;
    background: #e6eee9 !important;
    white-space: normal;
  }

  .main,
  .main-content,
  .content {
    width: auto;
    max-width: none;
    margin: 0 !important;
    padding: 0 !important;
  }

  .memo-sheet {
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    padding: 15mm 17mm;
    overflow: visible;
    box-shadow: none;
    break-after: page;
  }

  .memo-sheet:last-child {
    break-after: auto;
  }

  .memo-table thead {
    display: table-header-group;
  }

  .memo-table tr,
  .memo-meta,
  .memo-signatures,
  .panel:not(.report-print-sheet),
  .stat-card {
    break-inside: avoid;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}

@page report-landscape {
  size: A4 landscape;
  margin: 10mm 12mm 12mm;
}
/* Portal institucional de acceso */
body.login-body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: #292724;
  background: #faf9f5;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}

.login-body *, .login-body *::before, .login-body *::after { box-sizing: border-box; }
.login-body svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.login-ambient, .login-grid { position: fixed; inset: 0; pointer-events: none; }
.login-ambient { z-index: 0; overflow: hidden; background: radial-gradient(circle at 42% 10%, rgba(231, 191, 82, .17), transparent 33%), radial-gradient(circle at 18% 88%, rgba(18, 92, 68, .12), transparent 39%), radial-gradient(circle at 88% 72%, rgba(112, 32, 37, .07), transparent 34%); }
.login-grid { opacity: .55; background-size: 44px 44px; background-image: linear-gradient(to right, rgba(15, 45, 35, .045) 1px, transparent 1px), linear-gradient(to bottom, rgba(15, 45, 35, .045) 1px, transparent 1px); }
.login-watermark { position: absolute; width: min(44vw, 650px); left: -5%; top: 47%; opacity: .035; filter: grayscale(1) contrast(1.3); transform: translateY(-50%); }
.login-wave { position: absolute; left: -8%; width: 116%; height: 38vh; min-height: 280px; overflow: visible; }
.login-wave path { fill: none; stroke-width: 2; }
.login-wave-one { bottom: 2%; color: rgba(21, 88, 68, .1); animation: loginWaveDrift 18s ease-in-out infinite alternate; }
.login-wave-two { top: 18%; color: rgba(193, 143, 42, .1); animation: loginWaveDrift 23s ease-in-out -7s infinite alternate-reverse; }
.login-shell { position: relative; z-index: 1; display: flex; min-height: 100vh; min-height: 100dvh; flex-direction: column; }

.login-topbar { background: rgba(255,255,255,.8); border-bottom: 1px solid rgba(219, 216, 207, .9); backdrop-filter: blur(14px); }
.login-topbar-inner { width: min(100% - 3rem, 1360px); min-height: 68px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.login-identity, .login-system-meta, .login-wordmark, .login-card-title, .login-session-row, .login-footer, .login-footer > div { display: flex; align-items: center; }
.login-identity { gap: .9rem; }
.login-logo-wrap { position: relative; width: 46px; height: 46px; padding: 4px; display: grid; place-items: center; border: 1px solid #e8e3d8; border-radius: 13px; background: #fff; box-shadow: 0 4px 14px rgba(22, 35, 29, .06); }
.login-logo-wrap img { max-width: 100%; max-height: 100%; }
.login-logo-wrap i { position: absolute; right: -2px; bottom: -2px; width: 13px; height: 13px; border: 3px solid #fff; border-radius: 50%; background: #0ca678; }
.login-wordmark { gap: .7rem; }
.login-wordmark strong { color: #092c24; font: 800 1.12rem Georgia, serif; letter-spacing: .1em; }
.login-wordmark span { padding: .25rem .65rem; color: #a87517; border: 1px solid #ecd795; border-radius: 6px; background: #fffaf0; font-size: .7rem; font-weight: 800; letter-spacing: .12em; }
.login-identity p { margin: .15rem 0 0; color: #736f69; font-size: .78rem; font-weight: 600; }
.login-system-meta { gap: 1.25rem; color: #6d6964; font-size: .76rem; font-weight: 650; }
.login-period { display: inline-flex; align-items: center; gap: .45rem; padding-left: 1.2rem; border-left: 1px solid #ddd9d0; }
.login-period svg { width: 18px; }
.login-network { display: inline-flex; align-items: center; gap: .55rem; padding: .55rem 1.1rem; color: #08664e; border: 1px solid #9ce8ce; border-radius: 999px; background: rgba(236, 253, 247, .9); }
.login-network i, .login-system-badge i, .login-modules footer b i, .login-session-row i { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: currentColor; }
.login-network i { animation: loginPulse 2.6s ease-in-out infinite; }

.login-main { width: min(100% - 3rem, 1360px); margin: auto; padding: clamp(1.8rem, 3vw, 3.2rem) 0; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(350px, .78fr); align-items: center; gap: clamp(2.5rem, 5vw, 4.5rem); }
.login-hero { min-width: 0; }
.login-badges { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.25rem; }
.login-system-badge, .login-secure-badge { display: inline-flex; align-items: center; gap: .45rem; min-height: 30px; padding: .35rem .8rem; border-radius: 999px; font-size: .7rem; font-weight: 750; }
.login-system-badge { color: #f7f3e8; background: #22211f; }
.login-system-badge i { color: #d2a43e; }
.login-secure-badge { color: #087057; border: 1px solid #9ce8ce; background: #eefcf7; }
.login-secure-badge svg { width: 16px; }
.login-hero h1 { max-width: 780px; margin: 0; color: #1f1d1a; font-size: clamp(2.5rem, 3.65vw, 4rem); font-weight: 850; letter-spacing: -.05em; line-height: 1.02; }
.login-hero h1 span { color: #0a392d; font: italic 500 1.03em Georgia, serif; letter-spacing: -.045em; }
.login-hero h1 em { color: #6d2027; font-style: normal; }
.login-hero-copy { max-width: 760px; margin: 1.25rem 0 1.7rem; color: #625e59; font-size: clamp(.9rem, 1vw, 1.05rem); line-height: 1.6; }
.login-modules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.login-modules article { min-width: 0; padding: 1rem; display: flex; min-height: 172px; flex-direction: column; border: 1px solid rgba(222, 218, 209, .95); border-radius: 16px; background: rgba(255,255,255,.83); box-shadow: 0 8px 25px rgba(32, 37, 34, .045); backdrop-filter: blur(8px); transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
.login-modules article:hover { transform: translateY(-3px); border-color: #d3b366; box-shadow: 0 14px 30px rgba(32, 37, 34, .08); }
.login-module-icon { width: 35px; height: 35px; display: grid; place-items: center; border: 1px solid; border-radius: 11px; }
.login-module-icon svg { width: 18px; }
.login-module-icon.is-gold { color: #af7b16; border-color: #f0d78a; background: #fff9e8; }
.login-module-icon.is-red { color: #862e35; border-color: #f0c8cc; background: #fff1f2; }
.login-module-icon.is-green { color: #087158; border-color: #a4e8d1; background: #ecfcf6; }
.login-modules h2 { margin: .75rem 0 .35rem; color: #2a2723; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; }
.login-modules p { margin: 0 0 .7rem; flex: 1; color: #77716a; font-size: .7rem; line-height: 1.5; }
.login-modules footer { padding-top: .75rem; display: flex; justify-content: space-between; gap: .5rem; border-top: 1px solid #eeeae2; color: #aaa49d; font-size: .64rem; font-weight: 700; }
.login-modules footer b { display: inline-flex; align-items: center; gap: .35rem; color: #087158; }
.login-modules article:nth-child(2) footer b { color: #862e35; }
.login-motto { margin-top: 1.15rem; display: flex; align-items: center; gap: 1rem; color: #8c8780; }
.login-motto strong { font: 700 .63rem Georgia, serif; letter-spacing: .15em; }
.login-motto i { width: 38px; height: 1px; background: #cbc5bb; }
.login-motto span { font: italic .9rem Georgia, serif; }

.login-access { display: flex; justify-content: flex-end; }
.login-form-card { position: relative; width: 100%; max-width: 430px; padding: clamp(1.4rem, 2.2vw, 1.9rem); overflow: hidden; border: 1px solid #ded9cf; border-radius: 24px; background: rgba(255,255,255,.94); box-shadow: 0 24px 58px -22px rgba(18, 35, 28, .3), 0 0 0 1px rgba(192, 145, 46, .08); backdrop-filter: blur(15px); }
.login-card-accent { position: absolute; inset: 0 0 auto; height: 6px; background: linear-gradient(90deg, #c7942b, #f0bd39, #7c2229); }
.login-card-header { padding-bottom: 1.05rem; margin-bottom: 1.15rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid #eeeae3; }
.login-card-title { gap: .9rem; }
.login-card-logo { width: 47px; height: 47px; padding: 4px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid #ecd483; border-radius: 13px; background: #fffcf3; }
.login-card-logo img { max-width: 100%; max-height: 100%; }
.login-card-title small { color: #b57f1c; font-size: .66rem; font-weight: 850; letter-spacing: .12em; }
.login-card-title h2 { margin: .05rem 0; color: #24211e; font-size: 1.4rem; letter-spacing: -.035em; line-height: 1.1; }
.login-card-title p { margin: 0; color: #77716b; font-size: .75rem; font-weight: 600; }
.login-lock { width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 auto; color: #55514c; border: 1px solid #e2ded7; border-radius: 13px; background: #faf9f7; }
.login-lock svg { width: 21px; }
.login-form { display: grid; gap: .9rem; }
.login-field label { margin-bottom: .48rem; display: flex; justify-content: space-between; gap: 1rem; color: #504b46; font-size: .68rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.login-field label small { color: #aaa49d; font-weight: 500; letter-spacing: 0; text-transform: none; }
.login-input { position: relative; display: flex; align-items: center; color: #aaa49d; }
.login-input > svg { position: absolute; left: .95rem; width: 20px; pointer-events: none; }
.login-input input { width: 100%; height: 46px; padding: 0 3rem 0 2.85rem; color: #332f2b; border: 1px solid #d7d2cb; border-radius: 12px; outline: none; background: #fcfbfa; font-family: inherit; font-size: .84rem; font-weight: 600; transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; }
.login-input input::placeholder { color: #aaa49d; font-weight: 500; }
.login-input input:hover { background: #fff; }
.login-input input:focus { border-color: #17614f; background: #fff; box-shadow: 0 0 0 3px rgba(23, 97, 79, .11); }
.login-password-toggle { position: absolute; right: .35rem; width: 42px; height: 42px; padding: 0; display: grid; place-items: center; color: #aaa49d; border: 0; background: transparent; cursor: pointer; }
.login-password-toggle:hover, .login-password-toggle:focus-visible { color: #0d493a; outline: none; }
.login-password-toggle svg { width: 20px; }
.login-session-row { justify-content: space-between; color: #635e58; font-size: .72rem; font-weight: 650; }
.login-session-row span { display: inline-flex; align-items: center; gap: .45rem; }
.login-session-row i { color: #15936f; }
.login-session-row small { color: #aaa49d; }
.btn-ingresar { width: 100%; min-height: 50px; margin-top: .15rem; padding: 0 1.5rem; display: flex; align-items: center; justify-content: center; gap: .8rem; color: #fff; border: 0; border-radius: 12px; background: linear-gradient(100deg, #082d25, #0d493a, #082d25); box-shadow: 0 8px 18px rgba(8, 45, 37, .19); cursor: pointer; font-size: .76rem; font-weight: 850; letter-spacing: .08em; transition: transform .15s ease, box-shadow .15s ease, background-position .3s ease; background-size: 180% 100%; }
.btn-ingresar:hover { background-position: 100% 0; box-shadow: 0 11px 25px rgba(8, 45, 37, .25); transform: translateY(-1px); }
.btn-ingresar:active { transform: translateY(0); }
.btn-ingresar b { color: #f0bd39; font-size: 1.25rem; transition: transform .18s ease; }
.btn-ingresar:hover b { transform: translateX(4px); }
.login-tip { margin: -.15rem 0 0; color: #aaa49d; font-size: .68rem; font-weight: 600; text-align: center; }
.login-resolution { margin-top: 1rem; padding: .8rem; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: .7rem; color: #433a2a; border: 1px solid #efd481; border-radius: 14px; background: rgba(255, 250, 234, .75); text-decoration: none; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.login-resolution:hover, .login-resolution:focus-visible { color: #433a2a; border-color: #d7ac3e; box-shadow: 0 8px 20px rgba(166, 121, 26, .1); outline: none; transform: translateY(-2px); }
.login-resolution-icon { width: 34px; height: 34px; display: grid; place-items: center; color: #a86e0c; border: 1px solid #eed17a; border-radius: 10px; background: #fff7d9; }
.login-resolution-icon svg { width: 20px; }
.login-resolution-copy { min-width: 0; display: grid; gap: .1rem; }
.login-resolution-copy small { color: #a75e19; font-size: .6rem; font-weight: 850; letter-spacing: .09em; }
.login-resolution-copy strong { color: #342e26; font-size: .78rem; }
.login-resolution-copy span { color: #7b756d; font-size: .67rem; line-height: 1.35; }
.login-resolution-arrow { color: #b46e17; font-size: 1rem; }
.login-trust { margin-top: .85rem; display: flex; align-items: center; justify-content: center; gap: .5rem; color: #aaa49d; font-size: .55rem; font-weight: 800; letter-spacing: .13em; }
.login-trust svg { width: 15px; }
.login-form-card .flash { margin: 0 0 1rem; padding: .75rem .9rem; border-radius: 10px; font-size: .76rem; font-weight: 650; }
.login-form-card .flash-error { color: var(--danger); border: 1px solid rgba(164,59,55,.2); background: var(--danger-soft); }
.login-footer { width: min(100% - 3rem, 1360px); min-height: 58px; margin: auto; justify-content: space-between; gap: 2rem; color: #77716b; border-top: 1px solid rgba(220,216,207,.8); font-size: .68rem; }
.login-footer > div { gap: .7rem; }
.login-footer img { width: 27px; height: 27px; object-fit: contain; }
.login-footer strong { display: inline-flex; align-items: center; gap: .4rem; color: #5c5751; }
.login-footer svg { width: 17px; }

@keyframes loginWaveDrift { from { transform: translate3d(-2%, 0, 0) scaleY(.92); } to { transform: translate3d(2%, -18px, 0) scaleY(1.08); } }
@keyframes loginPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(12,166,120,.3); } 50% { box-shadow: 0 0 0 6px rgba(12,166,120,0); } }

@media (max-width: 1100px) {
  .login-main { grid-template-columns: 1fr minmax(350px, .8fr); gap: 2.5rem; }
  .login-modules { grid-template-columns: 1fr; }
  .login-modules article { min-height: 0; }
  .login-motto { display: none; }
}

@media (max-width: 820px) {
  .login-topbar-inner { width: min(100% - 2rem, 680px); min-height: 72px; }
  .login-period, .login-identity p { display: none; }
  .login-network { padding: .45rem .75rem; font-size: .68rem; }
  .login-main { width: min(100% - 2rem, 680px); padding: 1.4rem 0 2.5rem; display: flex; flex-direction: column; gap: 2.4rem; }
  .login-access { width: 100%; order: -1; justify-content: center; }
  .login-form-card { max-width: 560px; }
  .login-hero { width: 100%; }
  .login-hero h1 { font-size: clamp(2.4rem, 10vw, 4rem); }
  .login-modules { grid-template-columns: repeat(3, 1fr); }
  .login-footer { width: min(100% - 2rem, 680px); }
}

@media (max-width: 620px) {
  .login-wordmark span, .login-system-meta { display: none; }
  .login-topbar-inner { justify-content: center; }
  .login-logo-wrap { width: 47px; height: 47px; }
  .login-main { width: min(100% - 1.2rem, 560px); padding-top: .7rem; }
  .login-form-card { padding: 1.4rem 1.1rem; border-radius: 21px; }
  .login-card-header { margin-bottom: 1.25rem; padding-bottom: 1.2rem; }
  .login-card-logo { width: 48px; height: 48px; }
  .login-card-title h2 { font-size: 1.4rem; }
  .login-lock { width: 40px; height: 40px; }
  .login-field label small, .login-session-row small { display: none; }
  .login-modules { grid-template-columns: 1fr; }
  .login-badges { margin-bottom: 1.3rem; }
  .login-hero-copy { margin: 1.3rem 0 1.8rem; }
  .login-footer { width: min(100% - 1.2rem, 560px); padding: 1rem 0; flex-direction: column; text-align: center; }
  .login-footer > div { flex-direction: column; }
  .login-watermark { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .login-wave, .login-network i { animation: none; }
  .login-modules article, .login-resolution, .btn-ingresar, .btn-ingresar b { transition: none; }
}

/* Expediente documental de salidas y memorándums */
.document-help {
    margin-top: 0;
}

.document-files {
    display: grid;
    gap: .75rem;
}

.document-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 0;
    border-bottom: 1px solid var(--border, #d9dfdb);
}

.document-file small,
.document-upload-form small {
    color: var(--text-muted, #6b7280);
}

.document-actions {
    margin: .75rem 0 0;
    justify-content: flex-start;
}

.document-upload-form {
    display: flex;
    align-items: flex-end;
    gap: .75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border, #d9dfdb);
}

.document-upload-form label {
    display: grid;
    gap: .35rem;
    flex: 1;
    font-weight: 600;
}

.document-upload-form input[type="file"] {
    width: 100%;
}

.document-history {
    margin-top: 1rem;
}

.document-history ul {
    margin: .75rem 0 0;
    padding-left: 1.25rem;
}

.document-history li {
    margin-bottom: .4rem;
}

@media (max-width: 760px) {
    .document-file { align-items: flex-start; flex-direction: column; }
    .document-upload-form { align-items: stretch; flex-direction: column; }
}

.ai-drop-zone {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1rem;
    border: 1px dashed var(--border, #cbd5ce);
    border-radius: 10px;
    background: var(--cream-50, #fbfaf5);
    transition: border-color .15s, background .15s;
}

.ai-drop-zone.is-dragging {
    border-color: var(--green-900);
    background: var(--green-50, #edf5f1);
}

.ai-drop-zone small {
    margin-left: auto;
    color: var(--text-muted, #6b7280);
}

.ai-analysis-status,
.ai-analysis-summary {
    margin-top: .85rem;
    padding: .8rem 1rem;
    border-radius: 8px;
    background: #f3f4f6;
}

.ai-analysis-status.is-loading { color: var(--green-900); }
.ai-analysis-status.is-success { background: #eaf6ee; color: #176236; }
.ai-analysis-status.is-error,
.ai-summary-warning,
.ai-line-warning { color: var(--danger, #a43b37); }
.ai-analysis-status.is-error { background: var(--danger-soft, #fcebea); }
.ai-analysis-summary { display: grid; gap: .3rem; }
.ai-summary-warning { margin: .35rem 0 0; font-weight: 600; }
.ai-line-warning { grid-column: 1 / -1; font-weight: 600; }

@media (max-width: 760px) {
    .ai-drop-zone { align-items: stretch; flex-direction: column; }
    .ai-drop-zone small { margin-left: 0; }
}

.opening-balance-input {
    width: 9rem;
    max-width: 100%;
    padding: .65rem .75rem;
    border: 1px solid var(--border, #cbd5ce);
    border-radius: 8px;
    font: inherit;
    text-align: right;
}

.validation-summary {
    display: block;
    padding: .85rem 1rem;
}

.validation-summary strong {
    display: block;
    margin-bottom: .3rem;
}

.validation-summary ul {
    margin: 0;
    padding-left: 1.15rem;
}

.validation-summary li {
    margin: .15rem 0;
}

.validation-summary-link {
    padding: 0;
    border: 0;
    color: inherit;
    background: none;
    font: inherit;
    font-weight: 650;
    text-align: left;
    text-decoration: underline;
    cursor: pointer;
}
