:root {
  --bg: #f3f6f4;
  --panel: #ffffff;
  --panel-soft: #f8fbf9;
  --ink: #15201b;
  --muted: #62716b;
  --line: #dbe5df;
  --green: #008f55;
  --green-dark: #006f42;
  --green-soft: #e8f6ef;
  --red: #ee2d3f;
  --red-dark: #c92131;
  --gold: #c7831f;
  --danger: #b42318;
  --shadow: 0 18px 42px rgba(18, 38, 27, 0.1);
  --soft-shadow: 0 8px 24px rgba(18, 38, 27, 0.07);
}

.topbar-actions {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.supply-alert-mailbox-wrap {
  position: relative;
}

.supply-alert-mailbox {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 7px;
  padding: 6px 8px 6px 11px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  box-shadow: 0 5px 14px rgba(127, 29, 29, 0.28);
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.supply-alert-mailbox:hover,
.supply-alert-mailbox[aria-expanded="true"] {
  background: #b91c1c;
  transform: translateY(-1px);
}

.supply-alert-mailbox:focus-visible {
  outline: 3px solid rgba(254, 202, 202, 0.7);
  outline-offset: 2px;
}

.supply-alert-mailbox svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.supply-alert-mailbox strong {
  display: grid;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  place-items: center;
  border-radius: 999px;
  background: #fff;
  color: #b91c1c;
  font-size: 11px;
  line-height: 1;
}

.supply-alert-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(440px, calc(100vw - 40px));
  overflow: hidden;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: #fff;
  color: #34201f;
  box-shadow: 0 20px 48px rgba(67, 20, 20, 0.24);
}

.supply-alert-panel::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 28px;
  width: 12px;
  height: 12px;
  border: 1px solid #fecaca;
  border-right: 0;
  border-bottom: 0;
  background: #fff1f2;
  transform: rotate(45deg);
}

.supply-alert-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid #fecaca;
  background: #fff1f2;
}

.supply-alert-panel-head div {
  display: grid;
  gap: 2px;
}

.supply-alert-panel-head span {
  color: #991b1b;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.supply-alert-panel-head strong {
  color: #7f1d1d;
  font-size: 16px;
}

.supply-alert-panel-head button {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #fee2e2;
  color: #991b1b;
  font: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.supply-alert-list {
  max-height: min(420px, calc(100vh - 190px));
  overflow-y: auto;
}

.supply-alert-mailbox-item {
  display: grid;
  gap: 5px;
  padding: 13px 16px;
  border-bottom: 1px solid #f3dfdf;
}

.supply-alert-mailbox-item:last-child {
  border-bottom: 0;
}

.supply-alert-mailbox-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.supply-alert-mailbox-item-head strong {
  color: #7f1d1d;
  font-size: 14px;
}

.supply-alert-mailbox-item-head span {
  padding: 3px 7px;
  border-radius: 999px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.topbar .supply-alert-mailbox-item p {
  margin: 0;
  color: #5f4442;
  font-size: 12px;
  line-height: 1.45;
}

.supply-alert-panel footer {
  padding: 10px 16px;
  border-top: 1px solid #fecaca;
  background: #fffafa;
  color: #7f1d1d;
  font-size: 11px;
  line-height: 1.4;
}

@media (max-width: 640px) {
  .supply-alert-mailbox > span {
    display: none;
  }

  .supply-alert-mailbox {
    gap: 5px;
    padding-left: 9px;
  }

  .supply-alert-panel {
    position: fixed;
    top: 64px;
    right: 10px;
    width: calc(100vw - 20px);
  }

  .supply-alert-panel::before {
    display: none;
  }
}

/* Listado unificado de merma */
#merma-listado .waste-history {
  max-width: none;
}

#merma-listado .waste-list-filters {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(150px, 0.8fr) minmax(190px, 1fr) minmax(260px, 2fr);
  gap: 10px;
  margin: 4px 0 12px;
}

#merma-listado .waste-list-filters label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

#merma-listado .waste-list-filters input,
#merma-listado .waste-list-filters select {
  width: 100%;
  min-width: 0;
}

#merma-listado .table-summary {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

#merma-listado .table-summary strong {
  color: var(--green-dark);
  font-size: 15px;
}

#merma-listado .waste-list-table {
  min-width: 1280px;
  table-layout: fixed;
}

#merma-listado .waste-list-table th:nth-child(1) { width: 125px; }
#merma-listado .waste-list-table th:nth-child(2) { width: 125px; }
#merma-listado .waste-list-table th:nth-child(3) { width: 150px; }
#merma-listado .waste-list-table th:nth-child(4) { width: 180px; }
#merma-listado .waste-list-table th:nth-child(5) { width: 150px; }
#merma-listado .waste-list-table th:nth-child(6) { width: 145px; }
#merma-listado .waste-list-table th:nth-child(7) { width: 210px; }
#merma-listado .waste-list-table th:nth-child(8) { width: 125px; }
#merma-listado .waste-list-table th:nth-child(9) { width: 110px; }

#merma-listado .waste-list-table td {
  vertical-align: top;
  overflow-wrap: anywhere;
}

#merma-listado .waste-list-table td > strong,
#merma-listado .waste-list-table td > small {
  display: block;
}

#merma-listado .waste-list-table td > small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

#merma-listado .waste-document-link {
  max-width: 100%;
  white-space: normal;
  text-align: left;
}

.waste-type-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid #bfe5d0;
  border-radius: 999px;
  background: #e9f8f0;
  color: #007844;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.15;
}

.waste-type-badge.adjustment {
  border-color: #d8c7ed;
  background: #f3ecfb;
  color: #663399;
}

#merma-listado .status-badge.status-synced {
  background: #e9f8ef;
  color: #007c45;
}

#merma-listado .status-badge.status-pending {
  background: #fff5dc;
  color: #8a5a00;
}

#merma-listado .status-badge.status-error {
  background: #ffe9e9;
  color: #a61f2b;
}

#merma-listado .waste-detail .panel-head > div h3 {
  margin: 8px 0 0;
}

@media (max-width: 900px) {
  #merma-listado .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  #merma-listado .panel-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #merma-listado .panel-actions button {
    min-height: 44px;
    padding-inline: 8px;
  }

  #merma-listado .waste-list-filters {
    grid-template-columns: 1fr 1fr;
  }

  #merma-listado .waste-list-filters label:last-child {
    grid-column: 1 / -1;
  }

  #merma-listado .table-wrap {
    overflow: visible;
    border: 0;
  }

  #merma-listado .waste-list-table,
  #merma-listado .waste-list-table tbody,
  #merma-listado .waste-list-table tr {
    display: grid;
    min-width: 0;
  }

  #merma-listado .waste-list-table thead {
    display: none;
  }

  #merma-listado .waste-list-table tbody {
    gap: 10px;
  }

  #merma-listado .waste-list-table tr {
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
    border: 1px solid var(--line);
    border-left: 4px solid var(--green);
    border-radius: 8px;
    background: #fff;
  }

  #merma-listado .waste-list-table td {
    display: grid;
    grid-template-columns: minmax(88px, 38%) minmax(0, 1fr);
    gap: 8px;
    min-width: 0;
    padding: 9px 10px;
    border: 0;
    border-bottom: 1px solid #edf2ef;
  }

  #merma-listado .waste-list-table td::before {
    content: attr(data-label);
    color: #547064;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
  }

  #merma-listado .pagination-bar {
    justify-content: center;
    flex-wrap: wrap;
  }
}

@media (max-width: 560px) {
  #merma-listado .waste-list-filters,
  #merma-listado .panel-actions,
  #merma-listado .waste-list-table tr {
    grid-template-columns: 1fr;
  }

  #merma-listado .waste-list-filters label:last-child {
    grid-column: auto;
  }
}

/* Merma independiente de producción */
#merma-ajuste {
  --waste-border: #d4e3dc;
  --waste-soft: #f3faf6;
  --waste-danger: #a61f2b;
}

#merma-ajuste .inventory-waste-builder,
#merma-ajuste .inventory-waste-history {
  width: 100%;
}

#merma-ajuste .inventory-waste-header,
#merma-ajuste .inventory-waste-search-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

#merma-ajuste label {
  display: grid;
  gap: 6px;
  color: #344a40;
  font-weight: 800;
}

#merma-ajuste input,
#merma-ajuste select,
#merma-ajuste textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--waste-border);
  border-radius: 6px;
  background: #fff;
  color: #15241e;
}

#merma-ajuste textarea {
  min-height: 78px;
  resize: vertical;
}

#merma-ajuste .inventory-waste-comments {
  margin-top: 12px;
}

#merma-ajuste .inventory-waste-evidence input {
  padding: 8px;
}

#merma-ajuste .inventory-waste-lines {
  margin-top: 12px;
}

#merma-ajuste .inventory-waste-table table {
  min-width: 1020px;
  table-layout: fixed;
}

#merma-ajuste .inventory-waste-table th:nth-child(1) { width: 19%; }
#merma-ajuste .inventory-waste-table th:nth-child(2) { width: 13%; }
#merma-ajuste .inventory-waste-table th:nth-child(3) { width: 15%; }
#merma-ajuste .inventory-waste-table th:nth-child(4) { width: 8%; }
#merma-ajuste .inventory-waste-table th:nth-child(5) { width: 39%; }
#merma-ajuste .inventory-waste-table th:nth-child(6) { width: 6%; }

#merma-ajuste .inventory-waste-table td {
  vertical-align: top;
}

#merma-ajuste .inventory-waste-table td > strong,
#merma-ajuste .inventory-waste-table td > small,
#merma-ajuste .inventory-waste-history td > strong,
#merma-ajuste .inventory-waste-history td > small {
  display: block;
}

#merma-ajuste .inventory-waste-table td > small,
#merma-ajuste .inventory-waste-history td > small {
  margin-top: 4px;
  color: #60756b;
}

#merma-ajuste .inventory-waste-batches {
  display: grid;
  gap: 8px;
}

#merma-ajuste .inventory-waste-batch-row {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(130px, 0.45fr) 44px;
  gap: 8px;
  align-items: start;
}

#merma-ajuste .inventory-waste-batch-row small {
  grid-column: 1 / -1;
  color: #60756b;
}

#merma-ajuste .inventory-waste-batch-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#merma-ajuste .inventory-waste-batch-footer strong {
  white-space: nowrap;
}

#merma-ajuste .inventory-waste-quantity {
  max-width: 210px;
}

#merma-ajuste .stock-ok {
  color: #007c45;
}

#merma-ajuste .stock-empty,
#merma-ajuste .status-error {
  color: var(--waste-danger);
}

#merma-ajuste .status-synced {
  color: #007c45;
  background: #e9f8ef;
}

#merma-ajuste .status-pending {
  color: #8a5a00;
  background: #fff5dc;
}

#merma-ajuste .inventory-waste-history {
  margin-top: 16px;
}

#merma-ajuste .inventory-waste-history table {
  min-width: 900px;
}

#merma-ajuste .search-results button small {
  display: block;
  color: #60756b;
}

@media (max-width: 1180px) {
  #merma-ajuste .inventory-waste-table {
    overflow: visible;
  }

  #merma-ajuste .inventory-waste-table table,
  #merma-ajuste .inventory-waste-table tbody,
  #merma-ajuste .inventory-waste-table tr,
  #merma-ajuste .inventory-waste-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  #merma-ajuste .inventory-waste-table thead {
    display: none;
  }

  #merma-ajuste .inventory-waste-table tbody {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  #merma-ajuste .inventory-waste-table tr {
    padding: 12px;
    border: 1px solid var(--waste-border);
    border-radius: 6px;
    background: #fff;
  }

  #merma-ajuste .inventory-waste-table td {
    display: grid;
    grid-template-columns: minmax(112px, 0.35fr) minmax(0, 1fr);
    gap: 8px;
    padding: 7px 0;
    border: 0;
  }

  #merma-ajuste .inventory-waste-table td::before {
    content: attr(data-label);
    color: #547064;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }

  #merma-ajuste .inventory-waste-batches,
  #merma-ajuste .inventory-waste-quantity {
    min-width: 0;
    max-width: none;
  }
}

@media (max-width: 720px) {
  #merma-ajuste .panel {
    padding: 14px;
  }

  #merma-ajuste .panel-head,
  #merma-ajuste .inventory-waste-header,
  #merma-ajuste .inventory-waste-search-row {
    grid-template-columns: 1fr;
  }

  #merma-ajuste .panel-head {
    display: grid;
    gap: 8px;
  }

  #merma-ajuste .inventory-waste-table tbody {
    grid-template-columns: 1fr;
  }

  #merma-ajuste .inventory-waste-table td {
    grid-template-columns: 1fr;
  }

  #merma-ajuste .inventory-waste-batch-row {
    grid-template-columns: minmax(0, 1fr) 44px;
  }

  #merma-ajuste .inventory-waste-batch-row input {
    grid-column: 1 / -1;
  }

  #merma-ajuste .inventory-waste-batch-row .icon-button {
    grid-column: 2;
    justify-self: end;
  }

  #merma-ajuste .inventory-waste-batch-footer,
  #merma-ajuste .transfer-selection-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  #merma-ajuste .inventory-waste-batch-footer button,
  #merma-ajuste #inventoryWasteCreateButton,
  #merma-ajuste [data-inventory-waste-refresh] {
    width: 100%;
    min-height: 46px;
  }

  #merma-ajuste .inventory-waste-history .table-wrap {
    overflow-x: auto;
  }
}

/* Inventory workflow: reliable pagination and touch actions across devices. */
#transfer-manual .transfer-inline-pagination,
#transferencias .transfer-inline-pagination,
#transfer-checkout-detail .transfer-inline-pagination,
#transfer-checkin-detail .transfer-inline-pagination {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.transfer-touch-action,
#transfer-manual button,
#transferencias button,
#transfer-checkout button,
#transfer-checkin button,
#transfer-checkout-detail button,
#transfer-checkin-detail button {
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 137, 75, 0.14);
}

.transfer-touch-action {
  min-height: 48px;
  position: relative;
  z-index: 2;
}

.transfer-primary-actions {
  position: sticky;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  width: fit-content;
  margin-top: 12px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 26px rgba(14, 63, 45, 0.16);
  backdrop-filter: blur(8px);
}

.transfer-primary-actions .transfer-touch-action {
  min-width: 190px;
}

#transfer-manual .icon-button,
#transferencias .icon-button,
#transfer-checkout-detail .icon-button,
#transfer-checkin-detail .icon-button {
  min-width: 44px;
  min-height: 44px;
}

@media (max-width: 900px) {
  #transfer-manual,
  #transferencias,
  #transfer-checkout-detail,
  #transfer-checkin-detail {
    padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  }

  #transfer-manual .transfer-inline-pagination,
  #transferencias .transfer-inline-pagination,
  #transfer-checkout-detail .transfer-inline-pagination,
  #transfer-checkin-detail .transfer-inline-pagination {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    align-items: stretch;
  }

  #transfer-manual .transfer-inline-pagination .pagination-actions,
  #transferencias .transfer-inline-pagination .pagination-actions,
  #transfer-checkout-detail .transfer-inline-pagination .pagination-actions,
  #transfer-checkin-detail .transfer-inline-pagination .pagination-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
    gap: 6px;
    align-items: center;
  }

  #transfer-manual .transfer-inline-pagination button,
  #transfer-manual .transfer-inline-pagination select,
  #transferencias .transfer-inline-pagination button,
  #transferencias .transfer-inline-pagination select,
  #transfer-checkout-detail .transfer-inline-pagination button,
  #transfer-checkout-detail .transfer-inline-pagination select,
  #transfer-checkin-detail .transfer-inline-pagination button,
  #transfer-checkin-detail .transfer-inline-pagination select {
    min-width: 0;
    min-height: 46px;
  }

  .transfer-primary-actions {
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    width: 100%;
    margin: 12px 0 0;
  }

  .transfer-primary-actions .transfer-touch-action,
  #transferCreateButton,
  #manualTransferCreateButton {
    width: 100%;
    min-height: 52px;
  }
}

@media (max-width: 520px) {
  #transfer-manual .transfer-inline-pagination .pagination-actions,
  #transferencias .transfer-inline-pagination .pagination-actions,
  #transfer-checkout-detail .transfer-inline-pagination .pagination-actions,
  #transfer-checkin-detail .transfer-inline-pagination .pagination-actions {
    grid-template-columns: 1fr 1fr;
  }

  #transfer-manual .transfer-inline-pagination .pagination-actions > span,
  #transferencias .transfer-inline-pagination .pagination-actions > span,
  #transfer-checkout-detail .transfer-inline-pagination .pagination-actions > span,
  #transfer-checkin-detail .transfer-inline-pagination .pagination-actions > span {
    text-align: center;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(0, 143, 85, 0.14), transparent 30%),
    linear-gradient(180deg, #fbfdfb 0%, var(--bg) 42%, #eef4f0 100%);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

body.menu-open {
  overflow: hidden;
}

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

button {
  border: 0;
  cursor: pointer;
}

.icon-sprite {
  display: none;
}

svg {
  display: block;
}

.hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(440px, 100%);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(219, 229, 223, 0.95);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
  position: relative;
  overflow: hidden;
}

.recovery-panel {
  width: min(440px, 100%);
}

.login-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--red), var(--green));
}

.login-brand {
  display: flex;
  justify-content: center;
  padding: 8px 0 2px;
}

.login-brand img {
  width: min(265px, 82%);
  height: auto;
  display: block;
}

.login-copy {
  text-align: center;
}

.login-version {
  margin: 8px 0 0;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.login-panel h1 {
  margin: 5px 0;
  font-size: 31px;
  line-height: 1.1;
}

.eyebrow {
  margin: 0;
  color: var(--green-dark);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12px;
}

.muted {
  color: var(--muted);
  margin: 0;
}

label {
  display: grid;
  gap: 7px;
  color: #33443b;
  font-weight: 700;
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(0, 143, 85, 0.7);
  box-shadow: 0 0 0 3px rgba(0, 143, 85, 0.12);
}

textarea {
  resize: vertical;
}

button[type="submit"],
.small-button {
  background: var(--green);
  color: #fff;
  border-radius: 6px;
  padding: 11px 14px;
  font-weight: 800;
  box-shadow: 0 8px 16px rgba(0, 143, 85, 0.18);
}

button[type="submit"]:hover,
.small-button:hover {
  background: var(--green-dark);
}

.form-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
}

.link-button {
  background: transparent;
  color: var(--green-dark);
  border-radius: 6px;
  padding: 8px 10px;
  font-weight: 800;
  text-align: center;
}

.link-button:hover {
  background: var(--green-soft);
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #33443b;
  font-size: 14px;
  font-weight: 800;
}

.remember-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.error {
  color: var(--danger);
  margin: 0;
  min-height: 18px;
}

.error.informative {
  color: var(--green-dark);
}

.form-message {
  color: var(--green-dark);
  margin: 0;
  min-height: 18px;
  line-height: 1.4;
}

.quantity-help {
  color: var(--muted);
  display: block;
  font-size: 0.86rem;
  font-weight: 700;
}

.input-with-unit {
  position: relative;
  width: 100%;
}

.input-with-unit input {
  padding-right: 78px;
}

.input-unit {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  min-width: 48px;
  max-width: 64px;
  border-radius: 999px;
  padding: 5px 8px;
  background: var(--green-soft);
  color: var(--green-dark);
  border: 1px solid #ccebdd;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px 1fr;
  position: relative;
}

.mobile-menu-button,
.sidebar-overlay {
  display: none;
}

.sidebar {
  background: rgba(255, 255, 255, 0.97);
  color: var(--ink);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 100vh;
  border-right: 1px solid var(--line);
  box-shadow: 8px 0 28px rgba(18, 38, 27, 0.05);
}

.brand {
  display: grid;
  gap: 10px;
  align-items: center;
  padding: 12px 10px 18px;
  border-bottom: 1px solid var(--line);
}

.brand-logo {
  width: 236px;
  max-width: 100%;
  height: auto;
  display: block;
}

.brand strong {
  display: block;
  margin-top: 2px;
  color: var(--green-dark);
  font-size: 17px;
}

.brand small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
  font-size: 15px;
}

.nav {
  display: grid;
  gap: 7px;
}

.nav-item,
.submenu button {
  width: 100%;
  background: transparent;
  color: #34443c;
  text-align: left;
  padding: 13px 13px;
  border-radius: 6px;
  font-weight: 850;
  font-size: 17px;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item:hover,
.nav-item.active,
.submenu button:hover,
.submenu button.active {
  background: var(--green-soft);
  color: var(--green-dark);
  border-color: rgba(0, 143, 85, 0.16);
}

.nav-item.active,
.submenu button.active {
  box-shadow: inset 4px 0 0 var(--green);
}

.nav-icon {
  width: 25px;
  height: 25px;
  color: currentColor;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.15;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.nav-label {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.nav-caret {
  margin-left: auto;
  color: currentColor;
  font-size: 15px;
}

.nav-parent {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.submenu {
  display: grid;
  gap: 4px;
  padding-left: 12px;
  border-left: 2px solid #d9ece2;
  margin-left: 8px;
}

.submenu button {
  font-size: 16px;
  padding: 11px 12px;
}

.submenu .nav-icon {
  width: 22px;
  height: 22px;
}

.session {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: grid;
  gap: 10px;
}

.session span {
  color: var(--muted);
  font-weight: 700;
}

.session button {
  background: #fce8ea;
  color: var(--red-dark);
  border-radius: 6px;
  padding: 10px;
  font-weight: 800;
}

.session .session-secondary {
  background: #eef8f3;
  color: var(--green-dark);
}

.content {
  padding: 26px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--soft-shadow);
}

.page-heading {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-icon {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.page-icon svg {
  width: 31px;
  height: 31px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topbar h2 {
  margin: 0 0 4px;
  font-size: 28px;
  line-height: 1.15;
}

.sap-pill {
  background: #fff7e8;
  color: var(--gold);
  border: 1px solid #f4d7a1;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.sap-pill svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sap-pill.connected {
  background: #e8f7ef;
  color: var(--green);
  border-color: #bfe8d1;
}

.sap-pill.offline {
  background: #fff7e8;
  color: var(--gold);
  border-color: #f4d7a1;
}

.sap-pill.error {
  background: #fff0f0;
  color: var(--red);
  border-color: #ffc9c9;
}

.sap-pill.checking {
  background: #f4f8f6;
  color: var(--muted);
  border-color: #d8e4dd;
}

.sap-pill-status {
  min-height: 38px;
}

.order-type-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 10px;
  border: 1px solid #cfe3da;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.order-type-normal {
  background: #edf8f2;
  color: var(--green);
  border-color: #bee7d0;
}

.order-type-special {
  background: #fff7e8;
  color: var(--gold);
  border-color: #f4d7a1;
}

.order-type-disassembly {
  background: #eef5ff;
  color: #2154a3;
  border-color: #c9dcff;
}

.app-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 10px;
  border: 1px solid #d8e5df;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.app-status-complete {
  background: #edf8f2;
  color: var(--green);
  border-color: #bee7d0;
}

.yield-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid #d8e5df;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.yield-good {
  background: #edf8f2;
  color: var(--green);
  border-color: #bee7d0;
}

.yield-over {
  background: #fde8e8;
  color: #9b1c1c;
  border-color: #f7caca;
}

.yield-list-over {
  background: #f2e8ff;
  color: #6b21a8;
  border-color: #d8b4fe;
}

.yield-warn {
  background: #fff7e8;
  color: #9a6400;
  border-color: #f4d7a1;
}

.yield-low {
  background: #fde8e8;
  color: #9b1c1c;
  border-color: #f7caca;
}

.app-status-pending {
  background: #fff7e8;
  color: var(--gold);
  border-color: #f4d7a1;
}

.app-status-error {
  background: #fff0f0;
  color: #b3261e;
  border-color: #f0b7b2;
}

.app-status-neutral {
  background: #f7faf8;
  color: var(--muted);
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metrics article,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
}

.metrics article {
  padding: 17px;
  position: relative;
  overflow: hidden;
}

.metrics article::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--green), var(--red));
}

.metrics span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 31px;
  color: var(--green-dark);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.executive-dashboard {
  display: grid;
  gap: 18px;
}

.dashboard-filters {
  padding: 18px;
}

.dashboard-filters .panel-head {
  align-items: flex-start;
}

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.secondary-button {
  background: #eef8f3;
  color: var(--green);
  border: 1px solid #bfe8d1;
  box-shadow: none;
}

.secondary-button:hover {
  background: #dff3e8;
  color: var(--green-dark);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.filter-grid label {
  min-width: 0;
  color: #455a52;
  font-size: 12px;
  font-weight: 900;
}

.filter-grid input,
.filter-grid select {
  min-height: 42px;
  font-size: 13px;
  font-weight: 800;
  background: #fbfdfc;
}

.dashboard-kpi-grid {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.exec-kpi {
  background: linear-gradient(180deg, #ffffff 0%, #f9fcfb 100%);
  border: 1px solid #d8e8e1;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 16px 34px rgba(33, 64, 49, 0.08);
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.exec-kpi:hover,
.viz-card:hover {
  transform: translateY(-2px);
  border-color: #b7dacb;
  box-shadow: 0 20px 38px rgba(33, 64, 49, 0.12);
}

.exec-kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #008f55;
}

.exec-kpi.warning::before,
.exec-kpi.flat.warning::before {
  background: #d58a00;
}

.exec-kpi.danger::before,
.exec-kpi.flat.danger::before {
  background: #c93636;
}

.exec-kpi span {
  display: block;
  color: #51655d;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.exec-kpi strong {
  display: block;
  margin-top: 7px;
  color: #10211a;
  font-size: 30px;
  line-height: 1.05;
}

.exec-kpi em {
  display: block;
  margin-top: 7px;
  color: #6a7a74;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.exec-kpi.flat {
  box-shadow: none;
}

.dashboard-tabs {
  display: flex;
  gap: 8px;
  padding: 7px;
  overflow-x: auto;
  border: 1px solid #d8e8e1;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--soft-shadow);
}

.dashboard-tab {
  flex: 0 0 auto;
  border: 0;
  border-radius: 6px;
  padding: 11px 14px;
  background: transparent;
  color: #496058;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.dashboard-tab:hover {
  background: #eef8f3;
  color: #006f43;
}

.dashboard-tab.active {
  background: #008f55;
  color: #fff;
  box-shadow: 0 10px 22px rgba(0, 143, 85, 0.22);
}

.dashboard-panel {
  display: none;
}

.dashboard-panel.active {
  display: grid;
  gap: 16px;
}

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

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

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

.dashboard-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.viz-card,
.inner-panel {
  background: #fff;
  border: 1px solid #d8e8e1;
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 16px 34px rgba(33, 64, 49, 0.08);
  min-width: 0;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.viz-card h3,
.inner-panel h3 {
  margin: 0 0 14px;
  color: #10211a;
  font-size: 18px;
}

.bar-stack {
  display: grid;
  gap: 12px;
}

.bar-stack.compact {
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  color: #4f635b;
  font-size: 12px;
  font-weight: 900;
}

.bar-row div,
.comparison-chart i {
  height: 10px;
  border-radius: 999px;
  background: #e8f1ed;
  overflow: hidden;
}

.bar-row i,
.comparison-chart i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #007bff, #008f55);
}

.comparison-chart {
  display: grid;
  gap: 16px;
}

.comparison-chart div {
  display: grid;
  grid-template-columns: 110px 90px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  font-weight: 900;
  color: #4f635b;
}

.dashboard-gauge,
.status-donut {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 4px auto 12px;
  background: conic-gradient(#008f55 0deg, #e8eef2 0deg);
  position: relative;
}

.dashboard-gauge::after,
.status-donut::after {
  content: "";
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  background: #fff;
}

.dashboard-gauge strong,
.status-donut strong {
  position: relative;
  z-index: 1;
  color: #10211a;
  font-size: 24px;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: #60736c;
  font-size: 12px;
  font-weight: 900;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.dot.green {
  background: #008f55;
}

.dot.amber {
  background: #d58a00;
}

.dot.red {
  background: #c93636;
}

.dashboard-kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
}

.dashboard-kpi-strip span {
  padding: 12px;
  border: 1px solid #d8e8e1;
  border-radius: 8px;
  background: #fff;
  color: #65746f;
  font-weight: 900;
}

.dashboard-kpi-strip strong {
  display: block;
  margin-top: 4px;
  color: #10211a;
  font-size: 20px;
}

.mini-bars {
  height: 140px;
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 14px;
  border-radius: 8px;
  background: linear-gradient(180deg, #f9fcfb 0%, #eef6f2 100%);
}

.mini-bars span {
  flex: 1;
  min-height: 12px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #008f55, #9cd9bf);
}

.mini-bars.blue span {
  background: linear-gradient(180deg, #2563eb, #9bbcff);
}

.line-chart {
  height: 160px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px;
  border-radius: 8px;
  background: linear-gradient(180deg, #f9fcfb, #eef6f2);
}

.line-chart span {
  flex: 1;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #2563eb, #008f55);
}

.line-chart span:nth-child(1) { height: 38%; }
.line-chart span:nth-child(2) { height: 58%; }
.line-chart span:nth-child(3) { height: 46%; }
.line-chart span:nth-child(4) { height: 72%; }
.line-chart span:nth-child(5) { height: 64%; }
.line-chart span:nth-child(6) { height: 82%; }

.line-chart.green span {
  background: linear-gradient(180deg, #008f55, #9cd9bf);
}

.line-chart.red span {
  background: linear-gradient(180deg, #c93636, #f2aaa5);
}

.line-chart.amber span {
  background: linear-gradient(180deg, #d58a00, #ffd58b);
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.heatmap-grid.large {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.heatmap-grid span {
  min-height: 54px;
  border-radius: 8px;
}

.heatmap-grid .high {
  background: #ccefe0;
}

.heatmap-grid .mid {
  background: #fff0cf;
}

.heatmap-grid .low {
  background: #ffd9d9;
}

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

.alert-list p,
.ranking-list p {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: #f8fbfa;
  border: 1px solid #d8e8e1;
  color: #52655e;
  font-weight: 900;
}

.alert-list p.success {
  border-color: #bce6d3;
  background: #effaf5;
  color: #007a49;
}

.alert-list p.warning {
  border-color: #f4d298;
  background: #fff7e8;
  color: #9b6400;
}

.alert-list p.danger {
  border-color: #f0b8b4;
  background: #fff1f1;
  color: #b3261e;
}

.funnel {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.funnel span {
  display: block;
  width: 100%;
  max-width: 430px;
  padding: 12px;
  border-radius: 8px;
  background: #e9f6f0;
  color: #006f43;
  font-weight: 900;
  text-align: center;
}

.funnel span:nth-child(2) { width: 84%; }
.funnel span:nth-child(3) { width: 68%; }
.funnel span:nth-child(4) { width: 52%; background: #dff2ff; color: #175da8; }

.executive-table th {
  background: #f7fbf9;
  color: #007a49;
}

.of-sap-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  width: 100%;
  max-width: 100%;
}

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

#of-sap .panel {
  min-width: 0;
}

#of-sap .table-wrap {
  width: 100%;
}

#of-sap table {
  min-width: 1180px;
}

#of-sap .of-detail table {
  min-width: 980px;
}

#of-sap .of-detail {
  grid-column: 1 / -1;
}

.quantity-secondary {
  display: inline-block;
  margin-top: 3px;
  line-height: 1.25;
}

.of-date-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.of-filter {
  margin-bottom: 12px;
}

.of-selected-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #ccebdd;
  border-radius: 8px;
  background: #eef9f3;
}

.of-detail {
  position: static;
}

.of-sap-selected .of-detail {
  top: auto;
}

.of-detail-yield {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}

.of-detail-yield span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #d6eadf;
  border-radius: 8px;
  background: #f6fbf8;
}

.of-ai-panel {
  display: grid;
  gap: 10px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfefc;
}

.of-ai-panel textarea {
  resize: vertical;
  min-height: 76px;
}

.compact-actions {
  margin-top: 0;
  justify-content: flex-start;
}

.of-ai-answer {
  white-space: pre-wrap;
  line-height: 1.45;
  padding: 10px;
  border-radius: 8px;
  background: #f7faf8;
  border: 1px solid #dfe8e2;
}

.ai-chat-module {
  max-width: 980px;
}

.ai-chat-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
}

.ai-robot {
  width: 58px;
  height: 58px;
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  align-content: center;
  justify-items: center;
  padding: 15px 12px 13px;
  border: 1px solid #bfe8d3;
  border-radius: 8px;
  background: linear-gradient(180deg, #f4fff9 0%, #dff8ea 100%);
  box-shadow: inset 0 -5px 0 rgba(0, 132, 75, 0.08), 0 10px 24px rgba(0, 119, 68, 0.12);
}

.ai-robot::before {
  content: "P";
  position: absolute;
  top: -12px;
  left: 50%;
  width: 22px;
  height: 18px;
  display: grid;
  place-items: center;
  transform: translateX(-50%);
  border-radius: 8px 8px 3px 3px;
  background: var(--green);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.ai-robot::after {
  content: "";
  position: absolute;
  top: -18px;
  left: 50%;
  width: 2px;
  height: 8px;
  transform: translateX(-50%);
  background: var(--green);
}

.ai-robot-eye {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #00864c;
  animation: aiBlink 4s infinite;
}

.ai-robot-mouth {
  grid-column: 1 / -1;
  width: 22px;
  height: 5px;
  border-radius: 999px;
  background: #00864c;
}

.ai-chat-module.is-thinking .ai-robot {
  animation: aiRobotPulse 1.4s ease-in-out infinite;
}

.ai-chat-grid {
  display: grid;
  grid-template-columns: minmax(180px, 260px) 1fr;
  gap: 12px;
  align-items: end;
}

.ai-chat-grid .wide {
  grid-column: 1 / -1;
}

.ai-chat-grid textarea {
  resize: vertical;
  min-height: 108px;
}

.ai-thinking {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #ccefdc;
  border-radius: 8px;
  background: #f4fff8;
}

.ai-thinking-top {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #007a45;
}

.ai-thinking-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(0, 153, 86, 0.35);
  animation: aiDotPulse 1.15s infinite;
}

.ai-progress {
  height: 8px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dceee5;
}

.ai-progress span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #00864c 0%, #22c55e 55%, #a7f3d0 100%);
  animation: aiProgress 1.35s ease-in-out infinite;
}

.ai-chat-answer {
  margin-top: 14px;
  min-height: 180px;
  padding: 14px;
  border: 1px solid #dfe8e2;
  border-radius: 8px;
  background: #fbfefc;
  white-space: pre-wrap;
  line-height: 1.5;
}

.ai-charts {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.ai-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.ai-kpi {
  padding: 12px;
  border: 1px solid #dcebe3;
  border-radius: 8px;
  background: #fbfefc;
}

.ai-kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-kpi strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 22px;
}

.ai-chart-panel {
  padding: 14px;
  border: 1px solid #dcebe3;
  border-radius: 8px;
  background: #fff;
}

.ai-chart-panel h4 {
  margin: 0 0 12px;
}

.ai-bar-list {
  display: grid;
  gap: 10px;
}

.ai-bar-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(180px, 1.5fr) auto;
  gap: 10px;
  align-items: center;
}

.ai-bar-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.ai-bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7f2ec;
}

.ai-bar-fill {
  display: block;
  height: 100%;
  min-width: 4px;
  border-radius: inherit;
  background: linear-gradient(90deg, #00864c, #22c55e);
}

.ai-bar-value {
  min-width: 72px;
  text-align: right;
  color: #007a45;
  font-weight: 900;
}

@media (max-width: 760px) {
  .ai-kpi-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .ai-bar-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .ai-bar-value {
    min-width: 0;
    text-align: left;
  }
}

@keyframes aiProgress {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(250%);
  }
}

@keyframes aiDotPulse {
  70% {
    box-shadow: 0 0 0 9px rgba(0, 153, 86, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 153, 86, 0);
  }
}

@keyframes aiRobotPulse {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes aiBlink {
  0%,
  92%,
  100% {
    transform: scaleY(1);
  }
  95% {
    transform: scaleY(0.18);
  }
}

.of-documents-title {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.of-documents {
  display: grid;
  gap: 16px;
}

.of-documents h4 {
  margin: 0 0 10px;
  color: var(--green-dark);
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover,
.selected-row {
  background: #eef9f3;
}

.panel {
  padding: 18px;
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 18px;
}

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

.panel-head h3 {
  margin: 0;
}

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

.small-button {
  padding: 8px 11px;
  font-size: 13px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
  background: #fff;
}

th,
td {
  text-align: left;
  padding: 12px 11px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  font-size: 12px;
  color: var(--green-dark);
  text-transform: uppercase;
  background: var(--panel-soft);
}

td {
  font-size: 14px;
}

tbody tr:hover {
  background: #fbfdfb;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 15px;
  max-width: 980px;
}

.form-grid h3,
.form-grid button,
.form-grid .wide {
  grid-column: 1 / -1;
}

.form-grid h3 {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

#entryPtForm,
#wasteForm {
  gap: 20px;
}

#entryPtForm h3,
#wasteForm h3 {
  font-size: 26px;
  line-height: 1.12;
  margin: 0;
  border-bottom: 1px solid rgba(219, 229, 223, 0.95);
  padding-bottom: 14px;
  font-weight: 900;
}

#entryPtForm label,
#wasteForm label {
  min-width: 0;
  gap: 9px;
  color: #2f4038;
  font-size: 14px;
  font-weight: 850;
}

#entryPtForm input,
#entryPtForm select,
#entryPtForm textarea,
#wasteForm input,
#wasteForm select,
#wasteForm textarea {
  min-height: 58px;
  font-size: 17px;
  font-weight: 800;
  border-color: rgba(208, 222, 214, 0.98);
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

#entryPtForm textarea,
#wasteForm textarea {
  line-height: 1.45;
}

#entryPtForm input:focus,
#entryPtForm select:focus,
#entryPtForm textarea:focus,
#wasteForm input:focus,
#wasteForm select:focus,
#wasteForm textarea:focus {
  border-color: rgba(0, 143, 85, 0.72);
  box-shadow:
    0 0 0 3px rgba(0, 143, 85, 0.12),
    0 10px 24px rgba(18, 38, 27, 0.08);
}

#entryPtForm input[readonly],
#wasteForm input[readonly] {
  color: #213129;
  background: linear-gradient(180deg, #fbfdfc, #f7fbf8);
}

#entryPtForm button[type="submit"],
#wasteForm button[type="submit"] {
  min-height: 60px;
  border-radius: 8px;
  font-size: 18px;
  letter-spacing: 0;
  box-shadow: 0 12px 24px rgba(0, 143, 85, 0.2);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

#entryPtForm button[type="submit"]:hover,
#wasteForm button[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(0, 111, 66, 0.22);
}

#entryPtForm .form-message,
#wasteForm .form-message {
  min-height: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
}

.issue-panel {
  width: min(1120px, 100%);
  max-width: 100%;
  display: grid;
  gap: 20px;
  overflow: visible;
  padding: 26px;
  border-color: rgba(219, 229, 223, 0.92);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.94)),
    var(--panel);
  box-shadow: 0 18px 36px rgba(18, 38, 27, 0.08);
}

.issue-panel h3 {
  font-size: 26px;
  line-height: 1.12;
  margin: 0;
  border-bottom: 1px solid rgba(219, 229, 223, 0.95);
  padding-bottom: 14px;
  font-weight: 900;
}

.issue-panel label {
  min-width: 0;
  gap: 9px;
  color: #2f4038;
  font-size: 14px;
  font-weight: 850;
}

.issue-panel input,
.issue-panel select {
  min-height: 58px;
  font-size: 17px;
  font-weight: 800;
  border-color: rgba(208, 222, 214, 0.98);
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.issue-panel input:focus,
.issue-panel select:focus {
  border-color: rgba(0, 143, 85, 0.72);
  box-shadow:
    0 0 0 3px rgba(0, 143, 85, 0.12),
    0 10px 24px rgba(18, 38, 27, 0.08);
}

.issue-panel input[readonly] {
  color: #213129;
  background: linear-gradient(180deg, #fbfdfc, #f7fbf8);
}

.issue-panel button[type="submit"] {
  min-height: 60px;
  border-radius: 8px;
  font-size: 18px;
  letter-spacing: 0;
  box-shadow: 0 12px 24px rgba(0, 143, 85, 0.2);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.issue-panel button[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(0, 111, 66, 0.22);
}

.issue-panel .form-message {
  min-height: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
}

#salida-mp .issue-summary-grid,
#salida-mp .issue-summary-card {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.issue-form-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(340px, 1.05fr);
  gap: 26px;
  align-items: start;
  max-width: 100%;
}

.issue-form-fields,
.issue-material-column {
  min-width: 0;
  display: grid;
  gap: 18px;
  align-content: start;
}

.issue-panel .form-actions {
  max-width: 100%;
  gap: 14px;
}

#salida-mp .search-combobox,
#salida-mp .field-with-action {
  min-width: 0;
  max-width: 100%;
}

#salida-mp .field-with-action {
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 10px;
}

#salida-mp .scan-button {
  min-height: 58px;
  border-radius: 8px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

#salida-mp .scan-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(18, 38, 27, 0.08);
}

#salida-mp .search-results {
  max-width: 100%;
  border-color: rgba(208, 222, 214, 0.98);
  box-shadow: 0 18px 34px rgba(18, 38, 27, 0.12);
  padding: 8px;
}

#salida-mp .search-result > span:first-child {
  min-width: 0;
}

#salida-mp .search-result {
  border: 1px solid transparent;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

#salida-mp .search-result:hover {
  border-color: #ccebdd;
  transform: translateY(-1px);
}

#salida-mp .search-result small {
  overflow-wrap: anywhere;
}

#salida-mp .result-meta {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

#issueLotStatus:not(:empty) {
  color: var(--green-dark);
  background: linear-gradient(180deg, #f8fdfb, #f3faf6);
  border-left: 3px solid var(--green);
  border-radius: 8px;
  padding: 11px 12px;
}

#issueFormError:not(:empty) {
  border-left: 3px solid var(--red);
  border-radius: 8px;
  background: #fff6f6;
  padding: 11px 12px;
}

.issue-panel.is-submitting button[type="submit"] {
  opacity: 0.82;
  cursor: wait;
}

.issue-panel.is-submitting button[type="submit"]::after {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 10px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -3px;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.search-combobox {
  position: relative;
}

.field-with-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: stretch;
}

.scan-button,
.icon-button {
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--green-dark);
  border-radius: 6px;
  cursor: pointer;
}

.scan-button {
  min-width: 44px;
}

.scan-button svg,
.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scan-button:hover,
.icon-button:hover {
  background: var(--green-soft);
  border-color: #b8e2cd;
}

.search-results {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 290px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 6px;
}

.search-result {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  border-radius: 6px;
  padding: 11px 12px;
}

.search-result:hover {
  background: var(--green-soft);
}

.search-result strong,
.search-result small {
  display: block;
}

.search-result strong {
  color: var(--green-dark);
  font-size: 15px;
}

.search-result small {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.result-meta {
  flex: 0 0 auto;
  color: var(--green-dark);
  background: #eef9f3;
  border: 1px solid #ccebdd;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.search-empty {
  color: var(--muted);
  padding: 12px;
  font-weight: 700;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
}

.check-row input {
  width: auto;
}

.note {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #bfe4d1;
  background: #edf9f3;
  color: var(--green-dark);
  border-radius: 6px;
  line-height: 1.45;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #15201b;
  color: #fff;
  border-radius: 8px;
  padding: 13px 16px;
  box-shadow: var(--shadow);
  max-width: 360px;
}

.pdf-action {
  position: fixed;
  right: 20px;
  bottom: 78px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(620px, calc(100vw - 40px));
  padding: 12px;
  background: #fff;
  border: 1px solid #cfe2d8;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.pdf-action div {
  display: grid;
  min-width: 180px;
}

.pdf-action span {
  color: var(--muted);
  font-size: 0.85rem;
}

.pdf-action .icon-button {
  min-width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 6px;
}

.app-modal,
.scanner-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 21, 15, 0.55);
}

.app-modal-panel,
.scanner-panel {
  width: min(560px, 100%);
  display: grid;
  gap: 14px;
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.app-modal-head,
.scanner-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.app-modal-head div,
.scanner-head div {
  display: grid;
  gap: 3px;
}

.app-modal-head span,
.scanner-head span,
.scanner-status {
  color: var(--muted);
  font-size: 13px;
}

.transfer-success-panel {
  width: min(460px, 100%);
  justify-items: center;
  text-align: center;
  padding: 24px;
}

.transfer-success-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-size: 32px;
  font-weight: 900;
}

.transfer-success-copy {
  display: grid;
  gap: 5px;
}

.transfer-success-copy h3,
.transfer-success-copy p {
  margin: 0;
}

.transfer-success-copy p {
  color: var(--muted);
  line-height: 1.45;
}

.transfer-success-summary {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(100px, 0.8fr) minmax(0, 1.2fr);
  gap: 8px 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  background: #f6fbf8;
  text-align: left;
}

.transfer-success-summary span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.transfer-success-summary strong {
  color: var(--green-dark);
  overflow-wrap: anywhere;
}

.transfer-success-sap {
  display: contents;
}

button[aria-busy="true"] {
  cursor: wait;
  opacity: 0.72;
  pointer-events: none;
}

#scannerVideo {
  width: 100%;
  min-height: 260px;
  max-height: 420px;
  object-fit: cover;
  background: #101a15;
  border-radius: 8px;
}

.scanner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.print-frame {
  position: fixed;
  width: 0;
  height: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.row-action {
  background: #e8f6ef;
  color: var(--green-dark);
  border-radius: 6px;
  padding: 7px 10px;
  font-weight: 800;
}

.row-action:hover {
  background: #d6f0e4;
}

.danger-action {
  background: #fde8e8;
  color: #9b1c1c;
}

.danger-action:hover {
  background: #fbd5d5;
}

.row-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-weight: 700;
}

.pagination-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.pagination-actions select {
  width: auto;
  min-width: 76px;
  padding: 7px 9px;
}

.label-qty-input {
  width: 92px;
  min-width: 92px;
  padding: 7px 8px;
}

.loading-panel {
  margin: 10px 0 14px;
  padding: 12px 14px;
  border: 1px solid #ccebdd;
  border-radius: 8px;
  background: #f3fbf7;
}

.loading-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--green-dark);
}

.loading-row span {
  color: var(--muted);
  font-weight: 700;
}

.loading-track {
  position: relative;
  overflow: hidden;
  height: 8px;
  margin-top: 10px;
  border-radius: 999px;
  background: #dceee6;
}

.loading-track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--green);
  transition: width 0.25s ease;
}

.loading-panel.is-indeterminate .loading-track span {
  width: 42%;
  animation: loadingSlide 1.05s ease-in-out infinite;
}

@keyframes loadingSlide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(260%); }
}

#etiquetas table {
  min-width: 980px;
}

.quality-layout {
  display: grid;
  grid-template-columns: minmax(520px, 1fr);
  gap: 18px;
  align-items: start;
}

.waste-layout,
.settings-layout {
  display: grid;
  grid-template-columns: minmax(460px, 1fr) minmax(440px, 0.95fr);
  gap: 18px;
  align-items: start;
}

.settings-layout {
  grid-template-columns: minmax(520px, 1fr) minmax(420px, 0.85fr);
}

.admin-table-shell {
  display: grid;
  gap: 16px;
}

.config-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.config-tabs button {
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  font-weight: 800;
}

.config-tabs button:hover,
.config-tabs button.active {
  background: var(--green-soft);
  color: var(--green-dark);
  border-color: rgba(0, 143, 85, 0.35);
}

.admin-table-panel {
  display: grid;
  gap: 14px;
}

.quality-panel,
.quality-results {
  max-width: none;
}

.quality-results {
  grid-column: 1 / -1;
}

.mini-form {
  grid-template-columns: 1fr 1fr;
  max-width: none;
  gap: 10px;
}

.mini-form button {
  grid-column: 1 / -1;
}

.questionnaire {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 12px;
}

.quality-section-title {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 13px 15px;
  border-left: 5px solid var(--green);
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(0, 143, 85, 0.11), rgba(0, 143, 85, 0.03));
}

.quality-section-title h4 {
  margin: 0;
  color: var(--green-dark);
  font-size: 17px;
}

.quality-section-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.question-card {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px;
  border: 1px solid #cfe4da;
  border-radius: 8px;
  background: #fbfdfb;
}

.question-card:has(textarea) {
  grid-column: 1 / -1;
}

.question-card legend {
  padding: 0 6px;
  color: var(--green-dark);
  font-size: 15px;
  font-weight: 900;
}

.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.choice-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #cfe4da;
  border-radius: 999px;
  background: #fff;
  font-weight: 800;
}

.choice-pill input {
  width: auto;
}

@media (max-width: 760px) {
  .questionnaire {
    grid-template-columns: 1fr;
  }
}

.question-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.question-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

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

.auth-panel {
  display: grid;
  gap: 16px;
}

.auth-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.auth-tabs button {
  background: var(--panel-soft);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 800;
}

.auth-tabs button.active {
  background: var(--green-soft);
  color: var(--green-dark);
  border-color: rgba(0, 143, 85, 0.35);
}

.auth-tab-panel {
  display: grid;
  gap: 14px;
}

.auth-create-row,
.auth-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.auth-create-row label,
.auth-selector label {
  min-width: 240px;
  flex: 1;
}

.auth-selector select[multiple] {
  min-height: 130px;
  padding: 10px;
}

.permission-tools {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.permission-tools label {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

.permission-matrix table {
  min-width: 1240px;
}

.permission-matrix td:nth-child(n+3),
.permission-matrix th:nth-child(n+3) {
  text-align: center;
}

.permission-matrix input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.permission-group-row td {
  background: var(--green-soft);
  color: var(--green-dark);
  border-top: 2px solid rgba(0, 143, 85, 0.25);
}

.permission-group-row td {
  display: table-cell;
}

.permission-group-row td > span {
  float: right;
  display: inline-flex;
  gap: 8px;
}

.permission-group-row button {
  border: 1px solid rgba(0, 143, 85, 0.28);
  background: #fff;
  color: var(--green-dark);
  border-radius: 8px;
  padding: 6px 10px;
  font-weight: 800;
  cursor: pointer;
}

.question-row span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.quality-rule,
.pending-quality {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #ccebdd;
  border-radius: 8px;
  background: #eef9f3;
  color: var(--green-dark);
  font-weight: 800;
}

.quality-rule {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
}

.quality-rule span {
  color: var(--muted);
  font-size: 13px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-weight: 900;
  background: #eef3f1;
  color: #31443b;
}

.status-badge.aprobado {
  background: #e2f7ec;
  color: #007a3d;
}

.status-badge.rechazado {
  background: #ffe9e9;
  color: #b42318;
}

.status-badge.retenido {
  background: #fff4df;
  color: #b26a00;
}

.quality-detail {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.waste-detail {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.answer-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin: 10px 0 14px;
}

.answer-list article {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.answer-list span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-weight: 800;
}

.image-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.image-preview figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.image-preview img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
}

.image-preview figcaption {
  padding: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.waste-detail-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.waste-detail-images figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.waste-detail-images img {
  width: 100%;
  height: 145px;
  object-fit: cover;
  display: block;
}

.waste-detail-images figcaption {
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 1024px) {
  .filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-kpi-grid,
  .dashboard-grid.five,
  .dashboard-grid.four,
  .dashboard-grid.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-kpi-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .issue-form-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .issue-form-layout,
  .issue-form-fields,
  .issue-material-column {
    display: contents;
  }

  .issue-of-field {
    order: 1;
  }

  .issue-material-field {
    order: 2;
  }

  .issue-lot-field {
    order: 3;
  }

  .issue-quantity-field {
    order: 4;
  }

  .issue-status-field {
    order: 5;
  }

  .issue-error-field {
    order: 6;
  }

  .issue-planned-field {
    order: 7;
  }

  .issue-warehouse-field {
    order: 8;
  }

  .issue-panel .form-actions {
    order: 9;
  }

  #salida-mp .search-results {
    position: static;
    margin-top: 8px;
    max-height: 360px;
  }
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }

  .mobile-menu-button {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 1300;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--soft-shadow);
    display: grid;
    place-items: center;
    gap: 4px;
    padding: 12px;
  }

  .mobile-menu-button span {
    width: 22px;
    height: 2px;
    border-radius: 999px;
    background: var(--green-dark);
    display: block;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 1090;
    background: rgba(13, 24, 18, 0.42);
  }

  body.menu-open .sidebar-overlay {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1200;
    width: min(340px, 88vw);
    min-height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 18px 0 42px rgba(18, 38, 27, 0.18);
    padding-top: 18px;
  }

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

  .brand {
    grid-template-columns: auto 1fr;
  }

  .brand-logo {
    width: 170px;
  }

  .metrics,
  .split,
  .filter-grid,
  .dashboard-kpi-grid,
  .dashboard-grid.two,
  .dashboard-grid.three,
  .dashboard-grid.four,
  .dashboard-grid.five,
  .dashboard-kpi-strip,
  .form-grid,
  .of-sap-layout,
  .quality-layout,
  .waste-layout,
  .settings-layout {
    grid-template-columns: 1fr;
  }

  .issue-panel {
    gap: 14px;
  }

  #entryPtForm,
  #wasteForm {
    gap: 14px;
  }

  .issue-panel h3 {
    font-size: 22px;
  }

  #entryPtForm h3,
  #wasteForm h3 {
    font-size: 22px;
  }

  .issue-panel input,
  .issue-panel select {
    min-height: 58px;
    font-size: 18px;
  }

  #entryPtForm input,
  #entryPtForm select,
  #entryPtForm textarea,
  #wasteForm input,
  #wasteForm select,
  #wasteForm textarea {
    min-height: 58px;
    font-size: 18px;
  }

  .form-actions {
    grid-template-columns: 1fr;
  }

  .issue-panel button[type="submit"] {
    min-height: 66px;
  }

  #entryPtForm button[type="submit"],
  #wasteForm button[type="submit"] {
    min-height: 66px;
  }

  .of-detail {
    position: static;
  }

  .content {
    padding-top: 76px;
  }

  .topbar {
    display: none;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 10px;
    padding-top: 62px;
    gap: 10px;
  }

  .mobile-menu-button {
    top: 10px;
    left: 10px;
    width: 44px;
    height: 44px;
    padding: 10px;
  }

  .page-heading {
    gap: 12px;
  }

  .page-icon {
    width: 46px;
    height: 46px;
  }

  .page-icon svg {
    width: 25px;
    height: 25px;
  }

  .topbar h2 {
    font-size: 24px;
  }

  .panel {
    padding: 12px;
    border-radius: 8px;
  }

  .dashboard-filters,
  .viz-card,
  .inner-panel {
    padding: 12px;
  }

  .dashboard-tabs {
    gap: 6px;
    padding: 6px;
  }

  .dashboard-tab {
    padding: 10px 12px;
    font-size: 12px;
  }

  .exec-kpi strong {
    font-size: 25px;
  }

  .comparison-chart div,
  .bar-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .dashboard-gauge,
  .status-donut {
    width: 136px;
    height: 136px;
  }

  label {
    gap: 5px;
    font-size: 13px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
    padding: 9px 10px;
    border-radius: 6px;
  }

  .form-grid {
    gap: 10px;
  }

  .form-grid h3 {
    margin: 0;
    padding-bottom: 8px;
    font-size: 20px;
  }

  .form-grid button[type="submit"] {
    min-height: 52px;
    font-size: 17px;
  }

  .issue-panel {
    width: 100%;
    gap: 10px;
    padding-bottom: 8px;
  }

  #entryPtForm,
  #wasteForm {
    gap: 10px;
    padding-bottom: 8px;
  }

  .issue-panel h3 {
    font-size: 20px;
    padding-bottom: 8px;
  }

  #entryPtForm h3,
  #wasteForm h3 {
    font-size: 20px;
    padding-bottom: 8px;
  }

  .issue-form-layout {
    gap: 10px;
  }

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

  #salida-mp .field-with-action {
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 8px;
  }

  .scan-button {
    min-height: 44px;
    border-radius: 6px;
  }

  #salida-mp .scan-button {
    min-height: 48px;
  }

  #salida-mp .search-result {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
  }

  #salida-mp .result-meta {
    align-self: flex-start;
    white-space: normal;
  }

  .issue-panel input,
  .issue-panel select {
    min-height: 48px;
    font-size: 16px;
    padding: 10px 12px;
  }

  #entryPtForm input,
  #entryPtForm select,
  #entryPtForm textarea,
  #wasteForm input,
  #wasteForm select,
  #wasteForm textarea {
    min-height: 48px;
    font-size: 16px;
    padding: 10px 12px;
  }

  .issue-panel .form-message,
  .issue-panel .error {
    min-height: 0;
    font-size: 14px;
    line-height: 1.35;
  }

  #entryPtForm .form-message,
  #entryPtForm .error,
  #wasteForm .form-message,
  #wasteForm .error {
    min-height: 0;
    font-size: 14px;
    line-height: 1.35;
  }

  .quantity-help {
    font-size: 12px;
  }

  .form-actions {
    position: sticky;
    bottom: 0;
    z-index: 60;
    margin: 4px -12px -12px;
    padding: 10px 12px 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.76), #fff 26%);
    border-top: 1px solid var(--line);
    gap: 8px;
  }

  .issue-panel button[type="submit"] {
    width: 100%;
    min-height: 54px;
    font-size: 17px;
  }

  #entryPtForm > button[type="submit"],
  #wasteForm > button[type="submit"],
  #qualityForm > button[type="submit"] {
    position: sticky;
    bottom: 0;
    z-index: 60;
    margin: 4px -12px -12px;
    border-radius: 6px;
    min-height: 54px;
  }
}

/* Transferencias de inventario: armado con lotes y control de responsables. */
.transfer-builder {
  display: grid;
  gap: 16px;
  max-width: 1320px;
}

.transfer-manual-builder {
  display: grid;
  gap: 14px;
  max-width: 1320px;
}

.transfer-manual-header {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 14px;
}

.transfer-manual-header label,
.transfer-manual-search {
  display: grid;
  gap: 7px;
  color: #2f4038;
  font-size: 13px;
  font-weight: 800;
}

.transfer-manual-header select,
.transfer-manual-search input {
  min-height: 44px;
  border-radius: 7px;
}

.transfer-manual-search {
  max-width: 760px;
}

.transfer-manual-search .search-results button {
  display: grid;
  width: 100%;
  gap: 2px;
  padding: 10px 12px;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.transfer-manual-search .search-results button:hover {
  background: var(--green-soft);
}

.transfer-manual-search .search-results button:disabled {
  opacity: 0.62;
  cursor: default;
}

.transfer-manual-search .search-results button strong {
  color: var(--green-dark);
}

.transfer-manual-search .search-results button span,
.transfer-manual-search .search-results button small {
  overflow-wrap: anywhere;
}

.transfer-manual-search .search-results button small {
  color: var(--muted);
}

.transfer-manual-lines .transfer-lines-table {
  overflow-x: auto;
}

.transfer-manual-lines .transfer-lines-table table {
  min-width: 940px;
}

@media (max-width: 1180px) {
  .transfer-manual-lines .transfer-lines-table {
    overflow: visible;
  }

  .transfer-manual-lines .transfer-lines-table table,
  .transfer-manual-lines .transfer-lines-table tbody,
  .transfer-manual-lines .transfer-lines-table tr,
  .transfer-manual-lines .transfer-lines-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .transfer-manual-lines .transfer-lines-table thead {
    display: none;
  }

  .transfer-manual-lines .transfer-lines-table tbody {
    display: grid;
    gap: 10px;
  }

  .transfer-manual-lines .transfer-lines-table tr {
    padding: 11px 12px;
    border: 1px solid #d5e5dc;
    border-left: 4px solid var(--green);
    border-radius: 7px;
    background: #fff;
  }

  .transfer-manual-lines .transfer-lines-table td {
    display: grid;
    grid-template-columns: minmax(110px, 38%) minmax(0, 1fr);
    gap: 10px;
    padding: 7px 0;
    border: 0;
    border-bottom: 1px solid #edf2ef;
  }

  .transfer-manual-lines .transfer-lines-table td::before {
    content: attr(data-label);
    color: #547064;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }

  .transfer-manual-lines .transfer-lines-table td:last-child {
    border-bottom: 0;
  }
}

.transfer-header-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.6fr) repeat(2, minmax(180px, 1fr));
  gap: 14px;
}

.transfer-header-grid-builder {
  grid-template-columns: minmax(320px, 1.7fr) minmax(240px, 1fr) minmax(240px, 1fr);
}

.transfer-header-grid label,
.transfer-line-edit label {
  display: grid;
  gap: 7px;
  color: #2f4038;
  font-size: 13px;
  font-weight: 800;
}

.transfer-header-grid input,
.transfer-header-grid select,
.transfer-line-edit input,
.transfer-line-edit select {
  min-height: 44px;
  border-radius: 7px;
}

.transfer-destination-note {
  display: grid;
  align-content: center;
  gap: 4px;
  min-height: 68px;
  padding: 11px 13px;
  border: 1px solid #cfe3d8;
  border-left: 4px solid var(--green);
  border-radius: 7px;
  background: #f3faf6;
}

.transfer-destination-note strong {
  color: #183d2c;
  font-size: 13px;
}

.transfer-destination-note span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.transfer-of-picker {
  position: relative;
}

.transfer-of-picker summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 36px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
  list-style: none;
}

.transfer-of-picker summary::-webkit-details-marker {
  display: none;
}

.transfer-of-picker summary::after {
  content: "▾";
  position: absolute;
  right: 13px;
  color: var(--green-dark);
}

.transfer-of-options {
  position: absolute;
  z-index: 90;
  top: calc(100% + 6px);
  left: 0;
  width: min(580px, 90vw);
  padding: 8px;
  border: 1px solid #cfe0d6;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 38px rgba(18, 38, 27, 0.18);
}

.transfer-of-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid #dce9e1;
  background: #f8fbf9;
}

.transfer-of-filters .transfer-of-search {
  grid-column: 1 / -1;
}

.transfer-of-filters label {
  gap: 4px;
  font-size: 11px;
}

.transfer-of-filters input,
.transfer-of-filters select {
  min-height: 38px;
  padding: 7px 9px;
  font-size: 13px;
}

.transfer-of-options-list {
  max-height: 300px;
  overflow: auto;
  padding-top: 4px;
}

.transfer-of-option {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
}

.transfer-of-option:hover {
  background: #f0f8f3;
}

.transfer-of-option.is-selected {
  background: #edf8f2;
}

.transfer-of-option > input {
  width: 18px;
  height: 18px;
  min-height: 0;
  margin-top: 2px;
}

.transfer-of-option > div,
.transfer-of-option span,
.transfer-of-option small {
  display: block;
  min-width: 0;
}

.transfer-of-picker-actions {
  display: flex;
  position: sticky;
  bottom: -8px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 8px 8px;
  border-top: 1px solid #dce9e1;
  background: #fff;
}

.transfer-of-picker-actions span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.transfer-of-option-head {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.transfer-of-status {
  padding: 3px 7px;
  border: 1px solid #d5e2db;
  border-radius: 999px;
  color: #53665d;
  background: #f4f7f5;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.transfer-of-status.app-status-success {
  color: #007844;
  border-color: #bce5cf;
  background: #edf8f2;
}

.transfer-of-status.app-status-warning {
  color: #8a5b00;
  border-color: #efd9a8;
  background: #fff8e8;
}

.transfer-of-status.app-status-danger {
  color: #a6202a;
  border-color: #efc3c7;
  background: #fff0f1;
}

.transfer-of-no-results {
  display: grid;
  gap: 4px;
  padding: 22px 12px;
  color: var(--muted);
  text-align: center;
}

.transfer-of-no-results strong {
  color: #29483a;
}

@media (max-width: 720px) {
  .transfer-of-filters {
    grid-template-columns: 1fr 1fr;
  }

  .transfer-of-filters label:last-child {
    grid-column: 1 / -1;
  }

  .transfer-of-picker-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .transfer-of-picker-actions button {
    width: 100%;
  }
}

.transfer-of-option small {
  margin-top: 2px;
  color: var(--muted);
  font-weight: 600;
}

.transfer-of-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.transfer-of-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border: 1px solid #bee2cc;
  border-radius: 999px;
  color: #006b3e;
  background: #edf8f2;
  font-size: 12px;
  font-weight: 800;
}

.transfer-of-chip button {
  width: 18px;
  height: 18px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  color: #006b3e;
  background: transparent;
}

.transfer-selection-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #d9e7df;
  border-radius: 8px;
  background: #f7fbf8;
}

.transfer-selection-toolbar strong,
.transfer-selection-toolbar span {
  display: block;
}

.transfer-flow-note {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-left: 4px solid #009557;
  color: #43584e;
  background: #f3faf6;
}

.transfer-operation-grid {
  display: grid;
  grid-template-columns: minmax(520px, 0.9fr) minmax(620px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.transfer-operation-detail {
  min-height: 280px;
}

.transfer-operation-list-panel,
.transfer-checkout-standalone {
  width: 100%;
}

.transfer-operation-list-table table {
  min-width: 760px;
}

.transfer-status-stack {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.transfer-dispatch-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.transfer-dispatch-badge.transfer-dispatch-pending,
.transfer-dispatch-badge.transfer-dispatch-partial {
  color: #a32028;
  border-color: #efb8bd;
  background: #fff0f1;
}

.transfer-dispatch-badge.transfer-dispatch-sent {
  color: #805400;
  border-color: #efd18e;
  background: #fff7df;
}

.transfer-dispatch-badge.transfer-dispatch-complete {
  color: #006f40;
  border-color: #a9ddc2;
  background: #e9f8f0;
}

.transfer-dispatch-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid #dce7e1;
  border-radius: 7px;
  background: #f8fbf9;
  color: #43554c;
  font-size: 12px;
}

.transfer-dispatch-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.transfer-dispatch-legend i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.transfer-dispatch-legend .is-incomplete { background: #c72c37; }
.transfer-dispatch-legend .is-complete { background: #008a4f; }

.transfer-dispatch-row.transfer-dispatch-pending,
.transfer-dispatch-row.transfer-dispatch-partial {
  background: #fff7f7;
  box-shadow: inset 4px 0 0 #c72c37;
}

.transfer-dispatch-row.transfer-dispatch-complete {
  background: #eef9f3;
  box-shadow: inset 4px 0 0 #008a4f;
}

.transfer-dispatch-balance {
  display: block;
  margin-top: 5px;
  color: #52655b;
  font-size: 10px;
  line-height: 1.35;
}

.transfer-checkout-standalone .table-wrap {
  max-width: 100%;
}

.transfer-checkout-standalone table {
  width: 100%;
}

.transfer-checkout-standalone .transfer-checkin-batches {
  min-width: 320px;
}

.transfer-exclude-line-button {
  color: #a6202a;
  border-color: #efc3c7;
  background: #fff3f4;
}

.transfer-exclude-line-button:hover {
  color: #861821;
  border-color: #e5aeb4;
  background: #ffe9eb;
}

.transfer-excluded-lines {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #efc3c7;
  border-radius: 7px;
  background: #fffafb;
}

.transfer-excluded-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.transfer-excluded-heading h4,
.transfer-excluded-heading p {
  margin: 0;
}

.transfer-excluded-heading p {
  margin-top: 3px;
  color: #75545a;
  font-size: 12px;
}

.transfer-excluded-heading > span {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 9px;
  border-radius: 999px;
  color: #9f1f29;
  background: #ffe6e9;
  font-weight: 900;
}

.transfer-excluded-list {
  display: grid;
  gap: 8px;
}

.transfer-excluded-line {
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) 80px 150px minmax(180px, 1fr) minmax(210px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid #f0d7da;
  border-left: 4px solid #cf3d48;
  border-radius: 6px;
  background: #fff;
}

.transfer-excluded-line > div,
.transfer-excluded-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.transfer-excluded-line small {
  color: #865f65;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.transfer-excluded-line span {
  overflow-wrap: anywhere;
}

.transfer-excluded-main span {
  color: var(--muted);
  font-size: 12px;
}

.transfer-no-active-lines {
  display: block;
  width: 100%;
  padding: 11px 13px;
  border-left: 4px solid #cf3d48;
  color: #8d1e27;
  background: #fff0f1;
  font-weight: 800;
}

.transfer-operation-search {
  display: grid;
  gap: 6px;
  margin: 14px 0;
  color: #30453b;
  font-size: 13px;
  font-weight: 800;
}

.transfer-operation-search input {
  min-height: 44px;
}

.transfer-mine-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #dce7e1;
}

.transfer-mine-tabs button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #cfe1d7;
  color: #365047;
  background: #fff;
}

.transfer-mine-tabs button.active {
  color: #006f40;
  border-color: #87c9a5;
  background: #eaf7f0;
}

.transfer-mine-date-filters {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(180px, 240px) auto;
  gap: 10px;
  align-items: end;
  margin: 0 0 14px;
}

.transfer-mine-date-filters label {
  display: grid;
  gap: 6px;
  color: #30453b;
  font-size: 13px;
  font-weight: 800;
}

.transfer-mine-date-filters input {
  min-height: 42px;
}

.transfer-mine-date-filters button {
  justify-self: start;
  min-height: 42px;
}

.transfer-mine-table table {
  min-width: 1320px;
}

.transfer-record-values {
  display: grid;
  gap: 8px;
  min-width: 110px;
}

.transfer-record-values > * {
  display: block;
  min-height: 20px;
}

.transfer-record-values span {
  min-width: 220px;
}

.transfer-view-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.transfer-detail-back {
  display: inline-flex;
  margin: 0 0 12px;
  color: #007844;
  font-weight: 800;
  text-decoration: none;
}

.transfer-detail-back:hover {
  text-decoration: underline;
}

.transfer-standalone-detail {
  min-height: 320px;
}

.transfer-detail-products {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.transfer-detail-products article {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border-left: 4px solid var(--green);
  background: #f3faf6;
}

.transfer-detail-products span,
.transfer-detail-products small {
  color: var(--muted);
}

.transfer-lot-search {
  min-width: 220px;
}

@media (max-width: 1180px) {
  .transfer-operation-grid {
    grid-template-columns: 1fr;
  }
}

.transfer-selection-toolbar span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.transfer-material-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  padding: 12px;
  border: 1px solid #d9e8df;
  border-radius: 7px;
  background: #fbfdfc;
}

.transfer-material-filters label {
  display: grid;
  gap: 6px;
  color: #2f4038;
  font-size: 12px;
  font-weight: 800;
}

.transfer-material-filters select {
  min-height: 42px;
  border-radius: 7px;
}

.transfer-materials {
  display: grid;
  gap: 10px;
}

.transfer-lines-table table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.transfer-lines-table {
  overflow-x: hidden;
}

.transfer-lines-table th,
.transfer-lines-table td {
  padding: 7px 8px;
  font-size: 11px;
  line-height: 1.18;
  overflow-wrap: anywhere;
  vertical-align: middle;
}

.transfer-lines-table th:nth-child(1) { width: 3%; }
.transfer-lines-table th:nth-child(2) { width: 8%; }
.transfer-lines-table th:nth-child(3) { width: 15%; }
.transfer-lines-table th:nth-child(4) { width: 11%; }
.transfer-lines-table th:nth-child(5) { width: 10%; }
.transfer-lines-table th:nth-child(6) { width: 12%; }
.transfer-lines-table th:nth-child(7) { width: 12%; }
.transfer-lines-table th:nth-child(8) { width: 12%; }
.transfer-lines-table th:nth-child(9) { width: 17%; }

.transfer-lines-table td > strong {
  font-size: 11px;
}

.transfer-lines-table td small {
  display: block;
  max-width: 300px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.15;
}

.transfer-lines-table td small.transfer-grouped-lines {
  color: #007a46;
  font-weight: 800;
}

.transfer-lines-table .transfer-check-cell {
  width: 32px;
  text-align: center;
}

.transfer-lines-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.transfer-row-selected {
  background: #edf8f2 !important;
  box-shadow: inset 4px 0 0 #008a4f;
}

.transfer-quantity-input {
  width: 100%;
  min-height: 32px;
  padding: 5px 7px;
  font-size: 11px;
  font-weight: 800;
}

.transfer-line-warehouse {
  width: 100%;
  min-height: 32px;
  padding: 5px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

.transfer-material-pagination {
  margin-top: 6px;
  padding: 0 2px;
  font-size: 11px;
}

@media (min-width: 901px) {
  body.compact-transfer-builder-view .content {
    padding: 7px 12px;
  }

  body.compact-transfer-builder-view .topbar {
    align-items: center;
    min-height: 62px;
    margin-bottom: 7px;
    padding: 6px 10px;
  }

  body.compact-transfer-builder-view .page-heading {
    gap: 8px;
  }

  body.compact-transfer-builder-view .page-icon {
    width: 34px;
    height: 34px;
  }

  body.compact-transfer-builder-view .page-icon svg {
    width: 19px;
    height: 19px;
  }

  body.compact-transfer-builder-view .topbar h2 {
    margin-bottom: 0;
    font-size: 18px;
  }

  body.compact-transfer-builder-view .topbar p {
    margin: 0;
    font-size: 10px;
  }

  body.compact-transfer-builder-view #transferencias .transfer-builder {
    max-width: none;
    gap: 5px;
    padding: 7px 9px;
  }

  body.compact-transfer-builder-view #transferencias .panel-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 0;
  }

  body.compact-transfer-builder-view #transferencias .panel-head h3 {
    flex: 0 0 auto;
    font-size: 14px;
  }

  body.compact-transfer-builder-view #transferencias .panel-head h3::after {
    width: 24px;
    height: 2px;
    margin-top: 2px;
  }

  body.compact-transfer-builder-view #transferencias .panel-head p {
    margin: 0;
    font-size: 10px;
  }

  body.compact-transfer-builder-view #transferencias .transfer-header-grid-builder {
    grid-template-columns: minmax(280px, 1.7fr) minmax(210px, 1fr) minmax(220px, 1fr);
    gap: 6px;
  }

  body.compact-transfer-builder-view #transferencias .transfer-header-grid label {
    gap: 2px;
    font-size: 10px;
  }

  body.compact-transfer-builder-view #transferencias .transfer-of-picker summary,
  body.compact-transfer-builder-view #transferencias .transfer-header-grid select {
    min-height: 29px;
    padding-top: 4px;
    padding-bottom: 4px;
    font-size: 11px;
  }

  body.compact-transfer-builder-view #transferencias .transfer-destination-note {
    min-height: 39px;
    padding: 5px 8px;
  }

  body.compact-transfer-builder-view #transferencias .transfer-destination-note strong {
    font-size: 10px;
  }

  body.compact-transfer-builder-view #transferencias .transfer-destination-note span {
    font-size: 9px;
  }

  body.compact-transfer-builder-view #transferencias .transfer-of-chips {
    gap: 3px;
    margin-top: 2px;
  }

  body.compact-transfer-builder-view #transferencias .transfer-of-chip {
    padding: 2px 6px;
    font-size: 9px;
  }

  body.compact-transfer-builder-view #transferencias .transfer-selection-toolbar {
    min-height: 32px;
    padding: 4px 7px;
  }

  body.compact-transfer-builder-view #transferencias .transfer-selection-toolbar strong {
    font-size: 11px;
  }

  body.compact-transfer-builder-view #transferencias .transfer-selection-toolbar span {
    font-size: 9px;
  }

  body.compact-transfer-builder-view #transferencias .small-button,
  body.compact-transfer-builder-view #transferencias .row-action {
    min-height: 25px;
    padding: 3px 7px;
    font-size: 10px;
  }

  body.compact-transfer-builder-view #transferencias .transfer-material-filters {
    gap: 6px;
    padding: 4px 6px;
  }

  body.compact-transfer-builder-view #transferencias .transfer-material-filters label {
    gap: 2px;
    font-size: 9px;
  }

  body.compact-transfer-builder-view #transferencias .transfer-material-filters select {
    min-height: 27px;
    padding: 3px 6px;
    font-size: 10px;
  }

  body.compact-transfer-builder-view #transferencias .transfer-materials {
    gap: 3px;
  }

  body.compact-transfer-builder-view #transferencias .transfer-lines-table th,
  body.compact-transfer-builder-view #transferencias .transfer-lines-table td {
    height: 27px;
    padding: 2px 5px;
    font-size: 9.5px;
    line-height: 1.05;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body.compact-transfer-builder-view #transferencias .transfer-lines-table th {
    font-size: 8.5px;
    line-height: 1.05;
  }

  body.compact-transfer-builder-view #transferencias .transfer-lines-table td > strong,
  body.compact-transfer-builder-view #transferencias .transfer-lines-table td > small {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.compact-transfer-builder-view #transferencias .transfer-lines-table td > strong {
    font-size: 9.5px;
  }

  body.compact-transfer-builder-view #transferencias .transfer-lines-table td > small {
    margin-top: 0;
    font-size: 8.5px;
    line-height: 1;
  }

  body.compact-transfer-builder-view #transferencias .transfer-lines-table input[type="checkbox"] {
    width: 14px;
    height: 14px;
    min-height: 14px;
    max-height: 14px;
    margin: 0;
    padding: 0;
  }

  body.compact-transfer-builder-view #transferencias .transfer-quantity-input,
  body.compact-transfer-builder-view #transferencias .transfer-line-warehouse {
    min-height: 21px;
    height: 21px;
    padding: 2px 5px;
    font-size: 9px;
  }

  body.compact-transfer-builder-view #transferencias .transfer-line-warehouse + small:not(.transfer-line-error) {
    display: none;
  }

  body.compact-transfer-builder-view #transferencias .transfer-material-pagination {
    min-height: 27px;
    margin-top: 2px;
    font-size: 9px;
  }

  body.compact-transfer-builder-view #transferencias .transfer-flow-note {
    display: none;
  }
}

.transfer-line-warehouse.is-invalid {
  border-color: #d64850;
  background: #fff5f5;
}

.transfer-line-error {
  color: #b1262e !important;
  font-weight: 800;
}

.transfer-row-invalid {
  box-shadow: inset 4px 0 0 #d64850;
}

.transfer-loading {
  color: #8a6a22;
  font-size: 12px;
}

.stock-ok {
  color: #007844;
}

.stock-empty {
  color: #b1262e;
}

.transfer-empty-state {
  display: grid;
  place-items: center;
  min-height: 170px;
  padding: 22px;
  border: 1px dashed #bfd4c8;
  border-radius: 8px;
  color: var(--muted);
  background: #fbfdfc;
  text-align: center;
}

.transfer-empty-state strong {
  color: #18372a;
  font-size: 17px;
}

.transfer-material-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fff;
}

.transfer-material-row.selected {
  border-color: #9cd9b6;
  background: #f5fbf7;
}

.transfer-select-material {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #18372a;
  cursor: pointer;
}

.transfer-select-material input {
  width: 18px;
  height: 18px;
}

.transfer-material-meta,
.transfer-empty {
  margin: 7px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.transfer-line-edit {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  max-width: 760px;
}

.transfer-batches {
  display: grid;
  gap: 8px;
}

.transfer-batch-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(140px, 180px) 38px;
  gap: 8px;
}

.transfer-batch-row .icon-button {
  min-height: 44px;
  color: #a92727;
}

.transfer-checkin-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  padding: 11px 13px;
  border-left: 4px solid #008a4f;
  background: #edf8f2;
}

.transfer-checkin-banner-copy {
  display: grid;
  gap: 3px;
}

.transfer-checkin-banner-copy span {
  color: var(--muted);
  font-size: 12px;
}

.transfer-checkin-select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  font-weight: 800;
  color: var(--green-dark);
  cursor: pointer;
}

.transfer-checkin-select-all input {
  width: 20px;
  height: 20px;
  accent-color: var(--green);
}

.transfer-checkin-select-all span {
  color: inherit;
  font-size: 13px;
}

.transfer-checkin-batches {
  display: grid;
  gap: 7px;
  min-width: 380px;
}

.transfer-lot-help {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.transfer-workspace {
  display: grid;
  grid-template-columns: minmax(520px, 1.1fr) minmax(420px, 0.9fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.transfer-detail-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 8px;
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
}

.transfer-detail-info strong {
  color: var(--text);
}

.transfer-actions {
  margin-top: 14px;
  justify-content: flex-start;
}

.transfer-arrow {
  color: var(--green);
  font-weight: 900;
}

@media (max-width: 900px) {
  .transfer-header-grid,
  .transfer-workspace,
  .transfer-manual-header {
    grid-template-columns: 1fr;
  }

  .transfer-manual-builder {
    padding: 14px;
  }

  .transfer-manual-search {
    max-width: none;
  }

  .transfer-manual-lines .transfer-lines-table {
    overflow: visible;
  }

  .transfer-manual-lines .transfer-lines-table table,
  .transfer-manual-lines .transfer-lines-table tbody,
  .transfer-manual-lines .transfer-lines-table tr,
  .transfer-manual-lines .transfer-lines-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .transfer-manual-lines .transfer-lines-table thead {
    display: none;
  }

  .transfer-manual-lines .transfer-lines-table tbody {
    display: grid;
    gap: 10px;
  }

  .transfer-manual-lines .transfer-lines-table tr {
    padding: 11px 12px;
    border: 1px solid #d5e5dc;
    border-left: 4px solid var(--green);
    border-radius: 7px;
    background: #fff;
  }

  .transfer-manual-lines .transfer-lines-table td {
    display: grid;
    grid-template-columns: minmax(110px, 38%) minmax(0, 1fr);
    gap: 10px;
    padding: 7px 0;
    border: 0;
    border-bottom: 1px solid #edf2ef;
  }

  .transfer-manual-lines .transfer-lines-table td::before {
    content: attr(data-label);
    color: #547064;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }

  .transfer-manual-lines .transfer-lines-table td:last-child {
    border-bottom: 0;
  }

  .transfer-material-filters {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .transfer-builder {
    padding: 14px;
  }

  .transfer-header-grid {
    gap: 9px;
  }

  .transfer-batch-row {
    grid-template-columns: minmax(0, 1fr) 116px 38px;
  }

  .transfer-detail-info {
    grid-template-columns: 1fr;
  }

  .transfer-selection-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .transfer-selection-toolbar .panel-actions {
    justify-content: stretch;
  }

  .transfer-selection-toolbar button {
    flex: 1;
  }

  .transfer-mine-date-filters {
    grid-template-columns: 1fr 1fr;
  }

  .transfer-mine-date-filters button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .transfer-operation-list-panel,
  .transfer-checkout-standalone {
    padding: 14px;
  }

  .transfer-operation-list-panel .panel-head {
    align-items: stretch;
  }

  .transfer-operation-list-panel .panel-head button {
    width: 100%;
  }

  .transfer-operation-list-table {
    overflow: visible;
  }

  .transfer-operation-list-table table,
  .transfer-operation-list-table tbody,
  .transfer-operation-list-table tr,
  .transfer-operation-list-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .transfer-operation-list-table thead {
    display: none;
  }

  .transfer-operation-list-table tbody {
    display: grid;
    gap: 10px;
  }

  .transfer-operation-list-table tbody tr {
    padding: 11px 12px;
    border: 1px solid #d5e5dc;
    border-left: 4px solid var(--green);
    border-radius: 7px;
    background: #fff;
  }

  .transfer-operation-list-table tbody td {
    display: grid;
    grid-template-columns: minmax(110px, 38%) minmax(0, 1fr);
    gap: 10px;
    padding: 7px 0;
    border: 0;
    border-bottom: 1px solid #edf2ef;
  }

  .transfer-operation-list-table tbody td:last-child {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .transfer-operation-list-table tbody td::before {
    content: attr(data-label);
    color: #547064;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }

  .transfer-operation-list-table .transfer-view-link {
    width: 100%;
  }

  .transfer-checkout-standalone .table-wrap {
    overflow: visible;
  }

  .transfer-checkout-standalone table,
  .transfer-checkout-standalone tbody,
  .transfer-checkout-standalone tr,
  .transfer-checkout-standalone td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .transfer-checkout-standalone thead {
    display: none;
  }

  .transfer-checkout-standalone tbody {
    display: grid;
    gap: 12px;
  }

  .transfer-checkout-standalone tbody tr {
    padding: 12px;
    border: 1px solid #d5e5dc;
    border-left: 4px solid var(--green);
    border-radius: 7px;
    background: #fff;
  }

  .transfer-checkout-standalone tbody td {
    display: grid;
    grid-template-columns: minmax(110px, 38%) minmax(0, 1fr);
    gap: 10px;
    padding: 8px 0;
    border: 0;
    border-bottom: 1px solid #edf2ef;
  }

  .transfer-checkout-standalone tbody td:last-child {
    grid-template-columns: 1fr;
    padding-bottom: 0;
    border-bottom: 0;
  }

  .transfer-checkout-standalone tbody td::before {
    content: attr(data-label);
    color: #547064;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }

  .transfer-checkout-standalone tbody td:last-child::before {
    margin-bottom: 4px;
  }

  .transfer-checkout-standalone .transfer-checkin-batches,
  .transfer-checkout-standalone .transfer-lot-search {
    min-width: 0;
    width: 100%;
  }

  .transfer-checkout-standalone .transfer-batch-row {
    grid-template-columns: minmax(0, 1fr) minmax(92px, 118px) 38px;
  }

  .transfer-checkout-standalone .transfer-actions .small-button {
    width: 100%;
  }

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

  .transfer-excluded-main,
  .transfer-excluded-line > div:nth-child(4),
  .transfer-excluded-line > div:nth-child(5),
  .transfer-excluded-line .small-button {
    grid-column: 1 / -1;
  }

  .transfer-excluded-line .small-button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .transfer-checkout-standalone .transfer-batch-row {
    grid-template-columns: minmax(0, 1fr) 38px;
  }

  .transfer-checkout-standalone .transfer-lot-search {
    grid-column: 1 / -1;
  }

  .transfer-excluded-heading {
    align-items: flex-start;
  }

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

  .transfer-excluded-line > * {
    grid-column: 1;
  }
}

/* Final precedence for the visible redesign. */
@media (min-width: 901px) {
  .app { grid-template-columns: 286px minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}

.sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #ffffff 74%, #f1f8f4 100%);
  border-right-color: #cfded6;
}

.brand { position: relative; padding-bottom: 20px; }
.brand::after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: -1px;
  left: 8px;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, #008a4f 0 72%, #e4343f 72% 100%);
}
.brand strong { color: #10291c; font-size: 15px; }
.brand small { color: #008a4f; font-weight: 800; }
.nav-item.active::after,
.submenu button.active::after {
  content: "";
  position: absolute;
  right: 11px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #008a4f;
}

.content {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.36), transparent 42%), #f3f7f4;
}

.topbar {
  position: relative;
  overflow: hidden;
  min-height: 112px;
  border: 0;
  box-shadow: 0 13px 32px rgba(24, 55, 38, 0.075);
}
.topbar::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: #008a4f;
}
.topbar::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -95px;
  width: 240px;
  height: 190px;
  border: 32px solid rgba(0, 138, 79, 0.055);
  border-radius: 50%;
}
.page-heading,
.sap-pill { position: relative; z-index: 1; }
.topbar h2 { color: #10261a; font-size: 30px; font-weight: 900; }

.panel,
.metrics article,
.viz-card,
.inner-panel { border: 0; box-shadow: 0 10px 24px rgba(24, 55, 38, 0.065); }
.panel-head h3::after,
.panel > h3::after,
.issue-panel h3::after,
#entryPtForm h3::after,
#wasteForm h3::after {
  content: "";
  display: block;
  width: 38px;
  height: 3px;
  margin-top: 9px;
  border-radius: 3px;
  background: #008a4f;
}

.metrics article,
.exec-kpi { border-left: 4px solid #008a4f; background: #fff; }
.metrics article::before,
.exec-kpi::before { display: none; }
.metrics article:nth-child(2n) { border-left-color: #c7831f; }
.metrics article:nth-child(3n) { border-left-color: #e4343f; }

.dashboard-tabs { border: 0; box-shadow: 0 8px 20px rgba(24, 55, 38, 0.06); }
.dashboard-tab.active { background: #006b3e; }

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-top: 14px;
  padding-bottom: 14px;
  color: #006b3e;
  background: #edf7f1;
  box-shadow: inset 0 -1px 0 #cfe0d6;
}
tbody tr:nth-child(even) { background: #fbfdfc; }
tbody tr:hover { box-shadow: inset 3px 0 0 #008a4f; }

.issue-panel,
#entryPtForm,
#wasteForm { border-top: 5px solid #008a4f; }
.issue-panel h3,
#entryPtForm h3,
#wasteForm h3 { padding-bottom: 17px; }
.issue-panel label,
#entryPtForm label,
#wasteForm label {
  color: #395047;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.form-actions button[type="submit"],
.issue-panel button[type="submit"] { position: relative; overflow: hidden; background: #008a4f; }
.form-actions button[type="submit"]::before,
.issue-panel button[type="submit"]::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: #e4343f;
}
.row-action,
.secondary-button { border: 1px solid #c8e5d4; background: #eff8f3; }
.quality-section-title,
.quality-rule,
.pending-quality,
#issueLotStatus:not(:empty) { box-shadow: inset 4px 0 0 #008a4f; border-left: 0; }
.question-card:focus-within { border-top-color: #008a4f; box-shadow: 0 8px 20px rgba(24, 55, 38, 0.06); }
.ai-chat-module { border-top: 5px solid #008a4f; }
.ai-chat-answer { background: #f8fcfa; border-left: 4px solid #008a4f; }

@media (max-width: 900px) {
  .topbar {
    display: flex;
    min-height: auto;
    margin: 0 -18px 18px;
    padding: 16px 18px 16px 70px;
    border-radius: 0;
  }
  .topbar::after,
  .page-icon,
  .sap-pill { display: none; }
  .topbar h2 { font-size: 22px; }
}

@media (max-width: 640px) {
  .topbar { margin: 0 -10px 14px; padding-right: 12px; padding-left: 62px; }
  .panel-head h3::after,
  .panel > h3::after,
  .issue-panel h3::after,
  #entryPtForm h3::after,
  #wasteForm h3::after { margin-top: 7px; }
  .issue-panel,
  #entryPtForm,
  #wasteForm { border-top-width: 4px; }
}

/* Second visual pass: a stronger operational hierarchy, without changing behavior. */
@media (min-width: 901px) {
  .app {
    grid-template-columns: 286px minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
  }
}

.sidebar {
  background:
    linear-gradient(180deg, #ffffff 0%, #ffffff 74%, #f1f8f4 100%);
  border-right: 1px solid #cfded6;
}

.brand {
  position: relative;
  padding-bottom: 20px;
}

.brand::after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: -1px;
  left: 8px;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, #008a4f 0 72%, #e4343f 72% 100%);
}

.brand strong {
  color: #10291c;
  font-size: 15px;
}

.brand small {
  color: #008a4f;
  font-weight: 800;
}

.nav-item,
.submenu button {
  position: relative;
}

.nav-item.active,
.submenu button.active {
  color: #006b3e;
  font-weight: 900;
}

.nav-item.active::after,
.submenu button.active::after {
  content: "";
  position: absolute;
  right: 11px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #008a4f;
}

.submenu {
  border-left-color: #bee4ce;
}

.session {
  background: rgba(255, 255, 255, 0.64);
}

.content {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.36), transparent 42%),
    #f3f7f4;
}

.topbar {
  position: relative;
  overflow: hidden;
  border: 0;
  box-shadow: 0 13px 32px rgba(24, 55, 38, 0.075);
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: #008a4f;
}

.topbar::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -95px;
  width: 240px;
  height: 190px;
  border: 32px solid rgba(0, 138, 79, 0.055);
  border-radius: 50%;
  pointer-events: none;
}

.page-heading {
  position: relative;
  z-index: 1;
}

.page-icon {
  box-shadow: inset 0 0 0 1px #c4e6d1;
}

.topbar h2 {
  color: #10261a;
  font-size: 30px;
  font-weight: 900;
}

.topbar p {
  color: #5e7067;
  font-size: 15px;
}

.sap-pill {
  position: relative;
  z-index: 1;
  padding: 9px 13px;
  box-shadow: 0 4px 12px rgba(18, 62, 39, 0.07);
}

.panel,
.metrics article,
.viz-card,
.inner-panel {
  border: 0;
  box-shadow: 0 10px 24px rgba(24, 55, 38, 0.065);
}

.panel {
  position: relative;
}

.panel-head h3,
.panel > h3,
.issue-panel h3,
#entryPtForm h3,
#wasteForm h3 {
  color: #10261a;
  font-weight: 900;
}

.panel-head h3::after,
.panel > h3::after,
.issue-panel h3::after,
#entryPtForm h3::after,
#wasteForm h3::after {
  content: "";
  display: block;
  width: 38px;
  height: 3px;
  margin-top: 9px;
  border-radius: 3px;
  background: #008a4f;
}

.metrics article,
.exec-kpi {
  border-left: 4px solid #008a4f;
  background: #fff;
}

.metrics article::before,
.exec-kpi::before {
  display: none;
}

.metrics article:nth-child(2n) {
  border-left-color: #c7831f;
}

.metrics article:nth-child(3n) {
  border-left-color: #e4343f;
}

.metrics strong,
.exec-kpi strong {
  color: #10261a;
}

.dashboard-tabs {
  padding: 5px;
  border: 0;
  box-shadow: 0 8px 20px rgba(24, 55, 38, 0.06);
}

.dashboard-tab {
  min-height: 42px;
  padding: 10px 15px;
  font-size: 12px;
}

.dashboard-tab.active {
  background: #006b3e;
}

.table-wrap {
  border: 1px solid #d5e2da;
  border-radius: 6px;
  box-shadow: inset 0 1px 0 #fff;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-top: 14px;
  padding-bottom: 14px;
  color: #006b3e;
  background: #edf7f1;
  box-shadow: inset 0 -1px 0 #cfe0d6;
}

tbody tr:nth-child(even) {
  background: #fbfdfc;
}

tbody tr:hover {
  box-shadow: inset 3px 0 0 #008a4f;
}

td:first-child {
  font-weight: 750;
}

.issue-panel,
#entryPtForm,
#wasteForm {
  border-top: 5px solid #008a4f;
}

.issue-panel h3,
#entryPtForm h3,
#wasteForm h3 {
  padding-bottom: 17px;
}

.issue-panel label,
#entryPtForm label,
#wasteForm label {
  color: #395047;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.issue-panel input,
.issue-panel select,
#entryPtForm input,
#entryPtForm select,
#entryPtForm textarea,
#wasteForm input,
#wasteForm select,
#wasteForm textarea {
  border-width: 1.5px;
  font-weight: 800;
}

.issue-panel input:focus,
.issue-panel select:focus,
#entryPtForm input:focus,
#entryPtForm select:focus,
#entryPtForm textarea:focus,
#wasteForm input:focus,
#wasteForm select:focus,
#wasteForm textarea:focus {
  background: #fcfffd;
  border-color: #008a4f;
}

.form-actions button[type="submit"],
.issue-panel button[type="submit"] {
  position: relative;
  overflow: hidden;
  background: #008a4f;
}

.form-actions button[type="submit"]::before,
.issue-panel button[type="submit"]::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: #e4343f;
}

.row-action,
.secondary-button {
  border: 1px solid #c8e5d4;
  background: #eff8f3;
}

.row-action:hover,
.secondary-button:hover {
  border-color: #91cdae;
  background: #e0f3e8;
}

.danger-action {
  border-color: #f5c5c5;
}

.quality-section-title,
.quality-rule,
.pending-quality,
#issueLotStatus:not(:empty) {
  box-shadow: inset 4px 0 0 #008a4f;
  border-left: 0;
}

.quality-section-title {
  padding: 16px 18px;
}

.question-card {
  border-top: 3px solid #dcece3;
}

.question-card:focus-within {
  border-top-color: #008a4f;
  box-shadow: 0 8px 20px rgba(24, 55, 38, 0.06);
}

.choice-pill {
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.ai-chat-module {
  border-top: 5px solid #008a4f;
}

.ai-chat-answer {
  background: #f8fcfa;
  border-left: 4px solid #008a4f;
}

@media (max-width: 900px) {
  .topbar {
    display: flex;
    min-height: auto;
    margin: 0 -18px 18px;
    padding: 16px 18px 16px 70px;
    border-radius: 0;
  }

  .topbar::after {
    display: none;
  }

  .page-icon {
    display: none;
  }

  .topbar h2 {
    font-size: 22px;
  }

  .topbar p {
    font-size: 13px;
  }

  .sap-pill {
    display: none;
  }
}

@media (max-width: 640px) {
  .topbar {
    margin: 0 -10px 14px;
    padding-right: 12px;
    padding-left: 62px;
  }

  .panel-head h3::after,
  .panel > h3::after,
  .issue-panel h3::after,
  #entryPtForm h3::after,
  #wasteForm h3::after {
    margin-top: 7px;
  }

  .issue-panel,
  #entryPtForm,
  #wasteForm {
    border-top-width: 4px;
  }
}

/* Visual refinement: presentation only. It does not alter application behavior. */
:root {
  --bg: #f4f7f5;
  --panel: #ffffff;
  --panel-soft: #f7faf8;
  --ink: #17231e;
  --muted: #607169;
  --line: #d6e1db;
  --green: #008a4f;
  --green-dark: #006b3e;
  --green-soft: #e8f5ee;
  --shadow: 0 14px 34px rgba(18, 38, 27, 0.08);
  --soft-shadow: 0 5px 18px rgba(18, 38, 27, 0.055);
}

body {
  background: #f4f7f5;
  line-height: 1.35;
}

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

button {
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(0, 138, 79, 0.18);
  outline-offset: 2px;
}

input,
select,
textarea {
  min-height: 44px;
  border-color: #d4e0d9;
  background: #fff;
}

input::placeholder,
textarea::placeholder {
  color: #87958e;
  opacity: 1;
}

.sidebar {
  background: #fff;
  padding: 20px 16px;
  gap: 18px;
  box-shadow: 5px 0 20px rgba(18, 38, 27, 0.035);
}

.brand {
  gap: 8px;
  padding: 8px 8px 17px;
}

.brand-logo {
  width: 220px;
}

.brand strong {
  font-size: 16px;
  letter-spacing: 0;
}

.brand small {
  font-size: 13px;
}

.nav {
  gap: 4px;
}

.sidebar-search {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  margin: 0 2px 4px;
  padding: 0 8px 0 10px;
  color: #456456;
  background: #f7faf8;
  border: 1px solid #d5e5dc;
  border-radius: 7px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.sidebar-search:focus-within {
  background: #fff;
  border-color: #66b88f;
  box-shadow: 0 0 0 3px rgba(0, 145, 85, 0.12);
}

.sidebar-search .nav-icon {
  width: 18px;
  height: 18px;
  color: #3f6553;
}

.sidebar-search input,
.sidebar-search input:focus {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 9px 0;
  color: #243c31;
  font-size: 13px;
  font-weight: 650;
  background: transparent;
  border: 0;
  outline: 0;
  box-shadow: none;
}

.sidebar-search input::placeholder {
  color: #71847a;
  opacity: 1;
}

.sidebar-search button {
  display: none;
  place-items: center;
  width: 27px;
  height: 27px;
  padding: 0;
  color: #597267;
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  background: transparent;
  border: 0;
  border-radius: 50%;
  box-shadow: none;
}

.sidebar-search.has-value button {
  display: grid;
}

.sidebar-search button:hover {
  color: #006f42;
  background: #e4f2ea;
}

.sidebar-search-empty {
  margin: 0 2px 4px;
  padding: 10px;
  color: #6a3f28;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  background: #fff7ed;
  border: 1px solid #f2d8bb;
  border-radius: 7px;
}

.menu-filter-hidden {
  display: none !important;
}

.nav-item,
.submenu button {
  min-height: 44px;
  padding: 10px 11px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 800;
}

.nav-item:hover,
.submenu button:hover {
  background: #f0f8f4;
}

.nav-item.active,
.submenu button.active {
  background: #e5f4ec;
  box-shadow: inset 3px 0 0 var(--green);
}

.nav-icon {
  width: 21px;
  height: 21px;
}

.submenu {
  gap: 2px;
  padding-left: 10px;
  margin-left: 10px;
}

.submenu button {
  min-height: 40px;
  padding: 9px 10px;
  font-size: 14px;
}

.submenu .nav-icon {
  width: 19px;
  height: 19px;
}

.session {
  gap: 8px;
  padding: 14px 8px 0;
}

.session button {
  min-height: 40px;
  border-radius: 6px;
}

.content {
  padding: 24px 28px 36px;
}

.topbar {
  min-height: 112px;
  margin-bottom: 22px;
  padding: 22px 24px;
  background: #fff;
  border-color: #dce6e0;
  box-shadow: var(--soft-shadow);
}

.page-heading {
  gap: 15px;
}

.page-icon {
  width: 56px;
  height: 56px;
  background: #e7f5ed;
}

.topbar h2 {
  font-size: 27px;
  letter-spacing: 0;
}

.panel,
.metrics article,
.viz-card,
.inner-panel {
  border-color: #dbe5df;
  box-shadow: var(--soft-shadow);
}

.panel {
  padding: 20px;
}

.panel h3,
.viz-card h3,
.inner-panel h3 {
  color: #17231e;
  font-size: 19px;
}

.panel-head {
  margin-bottom: 16px;
}

.metrics {
  gap: 12px;
}

.metrics article {
  padding: 16px;
}

.metrics strong {
  font-size: 28px;
}

.small-button,
button[type="submit"] {
  min-height: 40px;
  border-radius: 6px;
  box-shadow: 0 7px 16px rgba(0, 138, 79, 0.16);
}

.small-button:hover,
button[type="submit"]:hover {
  transform: translateY(-1px);
}

.secondary-button,
.row-action {
  box-shadow: none;
}

.sap-pill,
.order-type-badge,
.app-status-badge,
.yield-badge,
.status-badge,
.result-meta {
  min-height: 28px;
  font-size: 12px;
  font-weight: 850;
}

.table-wrap {
  border-color: #dbe5df;
  background: #fff;
}

table {
  background: #fff;
}

th,
td {
  padding: 13px 12px;
  border-bottom-color: #e0e8e3;
}

th {
  color: #007343;
  background: #f5f9f7;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

td {
  color: #26362e;
  font-size: 14px;
}

tbody tr {
  transition: background-color 0.14s ease;
}

tbody tr:hover {
  background: #f5faf7;
}

.clickable-row:hover,
.selected-row {
  background: #eaf7f0;
}

.issue-panel {
  padding: 24px;
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.issue-panel h3,
#entryPtForm h3,
#wasteForm h3 {
  font-size: 25px;
}

.issue-panel input,
.issue-panel select,
#entryPtForm input,
#entryPtForm select,
#entryPtForm textarea,
#wasteForm input,
#wasteForm select,
#wasteForm textarea {
  background: #fff;
  border-color: #cfddd5;
}

.issue-panel input[readonly],
#entryPtForm input[readonly],
#wasteForm input[readonly] {
  background: #f7faf8;
}

.search-results {
  border-color: #cfddd5;
  box-shadow: 0 18px 34px rgba(18, 38, 27, 0.14);
}

.search-result {
  border-radius: 6px;
}

.question-card,
.question-row,
.answer-list article,
.ai-kpi,
.ai-chart-panel,
.of-detail-yield span {
  border-color: #d7e3dc;
  background: #fbfdfc;
}

.quality-section-title {
  border-left-width: 4px;
  border-radius: 6px;
  background: #eef7f2;
}

.choice-pill {
  min-height: 40px;
  border-color: #d3e0d9;
}

.choice-pill:has(input:checked) {
  color: var(--green-dark);
  border-color: #8bcfaf;
  background: #eaf7f0;
}

.config-tabs,
.auth-tabs {
  gap: 7px;
}

.config-tabs button,
.auth-tabs button {
  min-height: 40px;
  border-radius: 6px;
}

.app-modal,
.scanner-modal {
  background: rgba(10, 25, 17, 0.48);
}

.app-modal-panel,
.scanner-panel {
  padding: 20px;
  border: 1px solid #d6e1db;
  box-shadow: 0 24px 70px rgba(12, 30, 20, 0.24);
}

.toast {
  right: 24px;
  bottom: 24px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 16px 34px rgba(12, 30, 20, 0.24);
}

@media (max-width: 900px) {
  .content {
    padding: 74px 18px 26px;
  }

  .sidebar {
    padding: 18px 14px;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 62px 10px 20px;
  }

  .panel,
  .issue-panel {
    padding: 14px;
  }

  th,
  td {
    padding: 11px 10px;
  }

  .toast {
    right: 12px;
    bottom: 12px;
    max-width: calc(100vw - 24px);
  }
}

/* Final cascade: stronger visual hierarchy takes precedence over earlier refinements. */
@media (min-width: 901px) {
  .app { grid-template-columns: 286px minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}

.sidebar { background: linear-gradient(180deg, #ffffff 0%, #ffffff 74%, #f1f8f4 100%); border-right-color: #cfded6; }
.brand { position: relative; padding-bottom: 20px; }
.brand::after { content: ""; position: absolute; right: 8px; bottom: -1px; left: 8px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, #008a4f 0 72%, #e4343f 72% 100%); }
.brand strong { color: #10291c; font-size: 15px; }
.brand small { color: #008a4f; font-weight: 800; }
.nav-item.active::after, .submenu button.active::after { content: ""; position: absolute; right: 11px; width: 5px; height: 5px; border-radius: 50%; background: #008a4f; }
.content { background: linear-gradient(90deg, rgba(255, 255, 255, 0.36), transparent 42%), #f3f7f4; }
.topbar { position: relative; overflow: hidden; min-height: 112px; border: 0; box-shadow: 0 13px 32px rgba(24, 55, 38, 0.075); }
.topbar::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 7px; background: #008a4f; }
.topbar::after { content: ""; position: absolute; right: -80px; bottom: -95px; width: 240px; height: 190px; border: 32px solid rgba(0, 138, 79, 0.055); border-radius: 50%; }
.page-heading, .sap-pill { position: relative; z-index: 1; }
.topbar h2 { color: #10261a; font-size: 30px; font-weight: 900; }
.panel, .metrics article, .viz-card, .inner-panel { border: 0; box-shadow: 0 10px 24px rgba(24, 55, 38, 0.065); }
.panel-head h3::after, .panel > h3::after, .issue-panel h3::after, #entryPtForm h3::after, #wasteForm h3::after { content: ""; display: block; width: 38px; height: 3px; margin-top: 9px; border-radius: 3px; background: #008a4f; }
.metrics article, .exec-kpi { border-left: 4px solid #008a4f; background: #fff; }
.metrics article::before, .exec-kpi::before { display: none; }
.metrics article:nth-child(2n) { border-left-color: #c7831f; }
.metrics article:nth-child(3n) { border-left-color: #e4343f; }
.dashboard-tabs { border: 0; box-shadow: 0 8px 20px rgba(24, 55, 38, 0.06); }
.dashboard-tab.active { background: #006b3e; }
thead th { position: sticky; top: 0; z-index: 2; padding-top: 14px; padding-bottom: 14px; color: #006b3e; background: #edf7f1; box-shadow: inset 0 -1px 0 #cfe0d6; }
tbody tr:nth-child(even) { background: #fbfdfc; }
tbody tr:hover { box-shadow: inset 3px 0 0 #008a4f; }
.issue-panel, #entryPtForm, #wasteForm { border-top: 5px solid #008a4f; }
.issue-panel h3, #entryPtForm h3, #wasteForm h3 { padding-bottom: 17px; }
.issue-panel label, #entryPtForm label, #wasteForm label { color: #395047; font-size: 13px; text-transform: uppercase; letter-spacing: 0.02em; }
.form-actions button[type="submit"], .issue-panel button[type="submit"] { position: relative; overflow: hidden; background: #008a4f; }
.form-actions button[type="submit"]::before, .issue-panel button[type="submit"]::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: #e4343f; }
.row-action, .secondary-button { border: 1px solid #c8e5d4; background: #eff8f3; }
.quality-section-title, .quality-rule, .pending-quality, #issueLotStatus:not(:empty) { box-shadow: inset 4px 0 0 #008a4f; border-left: 0; }
.question-card:focus-within { border-top-color: #008a4f; box-shadow: 0 8px 20px rgba(24, 55, 38, 0.06); }
.ai-chat-module { border-top: 5px solid #008a4f; }
.ai-chat-answer { background: #f8fcfa; border-left: 4px solid #008a4f; }

@media (max-width: 900px) {
  .topbar { display: flex; min-height: auto; margin: 0 -18px 18px; padding: 16px 18px 16px 70px; border-radius: 0; }
  .topbar::after, .page-icon, .sap-pill { display: none; }
  .topbar h2 { font-size: 22px; }
}
@media (max-width: 640px) {
  .topbar { margin: 0 -10px 14px; padding-right: 12px; padding-left: 62px; }
  .panel-head h3::after, .panel > h3::after, .issue-panel h3::after, #entryPtForm h3::after, #wasteForm h3::after { margin-top: 7px; }
  .issue-panel, #entryPtForm, #wasteForm { border-top-width: 4px; }
}

/* Mobile navigation: keep account actions available without scrolling the menu. */
@media (max-width: 900px) {
  .sidebar .session {
    position: static;
    margin: 0;
    padding: 10px 8px 0;
    border-top: 1px solid #d8e5de;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .sidebar .session span {
    display: none;
  }

  .sidebar .session button {
    min-height: 40px;
  }

  .sidebar .session #logoutButton {
    order: -1;
  }

  .sidebar .nav {
    padding-bottom: 0;
  }
}

@media (max-width: 640px) {
  .form-actions,
  #entryPtForm > button[type="submit"],
  #wasteForm > button[type="submit"],
  #qualityForm > button[type="submit"] {
    position: static;
    margin: 18px 0 0;
  }
}

@media (max-width: 900px) {
  body.compact-mobile-form-view .topbar {
    display: none;
  }
}

.transfer-operation-pagination {
  margin-top: 12px;
}

.transfer-checkin-table {
  min-width: 1180px;
}

.transfer-received-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 800;
  white-space: nowrap;
}

.transfer-received-check input {
  width: 20px;
  height: 20px;
  accent-color: var(--green);
}

.transfer-received-quantity {
  min-width: 130px;
  width: 100%;
}

.transfer-checkin-reason {
  min-width: 190px;
  width: 100%;
  min-height: 62px;
  resize: vertical;
}

.transfer-dispatched-lots {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.4;
}

.transfer-match-value {
  color: var(--green);
}

.transfer-difference-value {
  color: #b4232c;
}

.transfer-checkin-table tr.has-discrepancy {
  background: #fff9f9;
}

.transfer-checkin-summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid #d8e7df;
  border-radius: 6px;
  background: #f7fbf9;
}

.transfer-checkin-summary span {
  color: var(--muted);
  font-size: 12px;
}

.transfer-investigation {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 2px solid #e7b459;
}

.transfer-investigation-head,
.transfer-investigation-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.transfer-investigation-head h4 {
  margin: 0 0 3px;
}

.transfer-investigation-head p,
.transfer-investigation-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.transfer-investigation-table {
  min-width: 1080px;
}

.transfer-resolution-actions,
.transfer-resolution-result {
  display: grid;
  gap: 6px;
  min-width: 190px;
}

.transfer-resolution-actions .small-button {
  width: 100%;
  white-space: normal;
}

.transfer-resolution-result span,
.transfer-resolution-result small {
  color: var(--muted);
  line-height: 1.35;
}

.app-status.app-status-success,
.app-status.app-status-ok {
  color: #007944;
  border-color: #bde5d0;
  background: #edf9f3;
}

.app-status.app-status-warning {
  color: #955b00;
  border-color: #f0d39d;
  background: #fff7e8;
}

.app-status.app-status-danger {
  color: #a32028;
  border-color: #f0c5c8;
  background: #fff0f1;
}

@media (max-width: 900px) {
  .transfer-checkin-table,
  .transfer-investigation-table {
    min-width: 0;
  }

  .transfer-checkin-summary,
  .transfer-investigation-head,
  .transfer-investigation-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .transfer-investigation-footer .small-button {
    width: 100%;
  }

  .transfer-checkin-standalone tbody td:last-child {
    grid-template-columns: minmax(110px, 38%) minmax(0, 1fr);
  }

  .transfer-checkin-standalone tbody td:last-child::before {
    margin-bottom: 0;
  }

  .transfer-checkin-reason,
  .transfer-received-quantity,
  .transfer-resolution-actions,
  .transfer-resolution-result {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 520px) {
  .transfer-checkin-standalone tbody td {
    grid-template-columns: 1fr;
  }

  .transfer-checkin-standalone tbody td::before {
    margin-bottom: 3px;
  }
}

/* Entry PT scanner controls are field actions, not full-width form actions. */
#entryPtForm .field-with-action {
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 8px;
}

#entryPtForm .field-with-action .scan-button {
  grid-column: auto;
  min-width: 48px;
  min-height: 48px;
}

@media (max-width: 640px) {
  #entryPtForm {
    gap: 8px;
    padding: 14px;
  }

  #entryPtForm h3 {
    font-size: 19px;
    padding-bottom: 8px;
  }

  #entryPtForm label {
    gap: 4px;
    font-size: 12px;
  }

  #entryPtForm input,
  #entryPtForm select {
    min-height: 44px;
    padding: 8px 10px;
  }

  #entryPtForm .field-with-action {
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 6px;
  }

  #entryPtForm .field-with-action .scan-button {
    min-width: 44px;
    min-height: 44px;
  }

  #entryPtForm > button[type="submit"] {
    min-height: 50px;
    margin-top: 10px;
  }

  #salida-mp .issue-panel {
    gap: 8px;
    padding: 14px;
  }

  #salida-mp .issue-panel h3 {
    font-size: 19px;
    padding-bottom: 8px;
  }

  #salida-mp .issue-panel label {
    gap: 4px;
    font-size: 12px;
  }

  #salida-mp .issue-panel input,
  #salida-mp .issue-panel select {
    min-height: 44px;
    padding: 8px 10px;
  }

  #salida-mp .issue-panel .form-actions {
    gap: 6px;
    margin-top: 10px;
  }

  #salida-mp .issue-panel button[type="submit"] {
    min-height: 50px;
    font-size: 16px;
  }
}

/* App shell refresh: visual-only layer shared by desktop, tablet and mobile. */
:root {
  --app-header: #123f2d;
  --app-header-deep: #0c3022;
  --app-canvas: #eef3f0;
  --app-surface: #ffffff;
  --app-surface-soft: #f6faf7;
  --app-border: #d5e0da;
  --app-ink: #17241e;
  --app-muted: #627169;
  --app-green: #008f55;
  --app-red: #dd3343;
  --app-gold: #b97819;
  --app-shadow: 0 8px 24px rgba(20, 53, 37, 0.07);
}

html {
  background: var(--app-canvas);
}

body {
  min-height: 100vh;
  background: var(--app-canvas);
  color: var(--app-ink);
}

button,
a,
summary,
select,
input[type="checkbox"],
input[type="radio"] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(0, 143, 85, 0.2);
  outline-offset: 2px;
}

.app {
  background: var(--app-canvas);
}

.sidebar {
  gap: 12px;
  padding: 14px 12px;
  background: #fff;
  border-right: 1px solid var(--app-border);
  box-shadow: 5px 0 18px rgba(18, 48, 34, 0.04);
  scrollbar-width: thin;
  scrollbar-color: #b9cec2 transparent;
}

.brand {
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 11px;
  min-height: 78px;
  padding: 8px 8px 14px;
}

.brand-logo {
  width: 92px;
}

.brand strong {
  margin: 0;
  color: #183326;
  font-size: 13px;
  line-height: 1.3;
}

.brand small {
  margin-top: 3px;
  color: var(--app-green);
  font-size: 12px;
}

.brand::after {
  right: 8px;
  left: 8px;
  height: 2px;
}

.nav {
  gap: 4px;
}

.nav-item,
.submenu button {
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #3a4c43;
  font-size: 14px;
  font-weight: 780;
  line-height: 1.25;
}

.nav-item:hover,
.submenu button:hover {
  background: #f0f7f3;
  border-color: #dcebe3;
  color: #0c6f43;
}

.nav-item.active,
.submenu button.active {
  background: #e7f5ed;
  border-color: #bfe1ce;
  color: #006f42;
  box-shadow: inset 3px 0 0 var(--app-green);
}

.nav-icon {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.submenu {
  gap: 2px;
  margin-left: 11px;
  padding-left: 9px;
  border-left: 1px solid #c8e3d5;
}

.submenu button {
  min-height: 38px;
  padding: 8px 9px;
  font-size: 13px;
}

.submenu .nav-icon {
  width: 18px;
  height: 18px;
}

.session {
  gap: 7px;
  margin-top: auto;
  padding: 11px 8px 4px;
  background: #f6faf7;
  border: 1px solid #deebe4;
  border-radius: 8px;
}

.session span {
  padding: 0 3px 3px;
  color: #30483b;
  font-size: 12px;
}

.session button {
  min-height: 37px;
  padding: 8px 10px;
  border: 1px solid #f0ccd1;
  border-radius: 6px;
  font-size: 12px;
  box-shadow: none;
}

.session .session-secondary {
  border-color: #cee5d8;
}

.content {
  min-width: 0;
  padding: 0 24px 32px;
  background: var(--app-canvas);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  align-items: center;
  min-height: 68px;
  margin: 0 -24px 18px;
  padding: 10px 24px;
  overflow: visible;
  color: #fff;
  background: var(--app-header);
  border: 0;
  border-radius: 0;
  box-shadow: 0 5px 16px rgba(12, 48, 34, 0.16);
}

.topbar::before,
.topbar::after {
  display: none;
}

.page-heading {
  gap: 11px;
}

.page-icon {
  width: 42px;
  height: 42px;
  color: #d6f4e3;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  box-shadow: none;
}

.page-icon svg {
  width: 23px;
  height: 23px;
}

.topbar h2 {
  margin: 0 0 2px;
  color: #fff;
  font-size: 21px;
  font-weight: 850;
  line-height: 1.15;
}

.topbar p {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  line-height: 1.3;
}

.sap-pill {
  min-height: 34px;
  padding: 7px 11px;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
  color: #e7f8ef;
  box-shadow: none;
  font-size: 12px;
}

.sap-pill.connected,
.sap-pill.checking {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.11);
  color: #e7f8ef;
}

.sap-pill.offline {
  border-color: rgba(255, 211, 145, 0.34);
  background: rgba(185, 120, 25, 0.22);
  color: #ffe3b5;
}

.sap-pill.error {
  border-color: rgba(255, 186, 194, 0.36);
  background: rgba(221, 51, 67, 0.23);
  color: #ffd8dd;
}

.active-view {
  animation: app-view-in 0.18s ease-out;
}

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

.panel,
.metrics article,
.viz-card,
.inner-panel,
.issue-panel,
#entryPtForm,
#wasteForm,
#qualityForm,
.approval-card,
.transfer-builder,
.transfer-detail-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  box-shadow: var(--app-shadow);
}

.panel {
  padding: 16px;
}

.panel-head {
  gap: 12px;
  margin-bottom: 13px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e0e8e3;
}

.panel-head h3,
.panel > h3,
.issue-panel h3,
#entryPtForm h3,
#wasteForm h3 {
  color: #193126;
  font-size: 18px;
  line-height: 1.2;
}

.panel-head h3::after,
.panel > h3::after,
.issue-panel h3::after,
#entryPtForm h3::after,
#wasteForm h3::after {
  width: 30px;
  height: 2px;
  margin-top: 7px;
}

.panel-head p,
.panel .muted {
  font-size: 12px;
}

.metrics {
  gap: 10px;
  margin-bottom: 14px;
}

.metrics article {
  min-height: 88px;
  padding: 14px;
}

.metrics span {
  font-size: 11px;
  text-transform: uppercase;
}

.metrics strong {
  margin-top: 4px;
  font-size: 25px;
}

input,
select,
textarea {
  min-height: 42px;
  padding: 9px 11px;
  border-color: #ccd9d2;
  border-radius: 6px;
  background: #fff;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #aebfb6;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--app-green);
  box-shadow: 0 0 0 3px rgba(0, 143, 85, 0.11);
}

label {
  gap: 5px;
  color: #3b4e44;
  font-size: 12px;
}

button[type="submit"],
.small-button,
.row-action {
  min-height: 39px;
  padding: 9px 13px;
  border-radius: 6px;
  box-shadow: none;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

button[type="submit"]:hover,
.small-button:hover,
.row-action:hover {
  transform: translateY(-1px);
}

.secondary-button,
.row-action {
  color: #007447;
  background: #edf7f1;
  border-color: #c5e1d2;
}

.danger-button {
  color: #a51f2e;
  background: #fff0f2;
  border-color: #efc8cd;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--app-border);
  border-radius: 7px;
  background: #fff;
  box-shadow: none;
}

table {
  font-size: 12px;
}

thead th {
  padding: 10px 11px;
  color: #155d3d;
  background: #edf5f0;
  box-shadow: inset 0 -1px 0 #d1dfd7;
  font-size: 10px;
  line-height: 1.2;
}

tbody td {
  padding: 10px 11px;
  border-bottom-color: #e1e8e4;
  line-height: 1.3;
}

tbody tr:nth-child(even) {
  background: #fbfcfb;
}

tbody tr:hover {
  background: #f5faf7;
  box-shadow: inset 2px 0 0 var(--app-green);
}

.app-status,
.app-status-badge,
.yield-badge,
.order-type-badge {
  min-height: 24px;
  padding: 4px 8px;
  font-size: 11px;
}

.form-actions {
  gap: 8px;
}

.toast {
  border-radius: 7px;
}

.app-modal-panel,
.scanner-panel {
  border-radius: 8px;
}

@media (min-width: 1181px) {
  .app {
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
  }

  .content > .view {
    max-width: 1800px;
    margin-right: auto;
    margin-left: auto;
  }
}

@media (max-width: 1180px) {
  .app {
    display: block;
    grid-template-columns: 1fr;
  }

  .content {
    width: 100%;
    min-width: 0;
    padding: 66px 16px 24px;
    overflow-x: hidden;
  }

  .topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 40;
    min-height: 58px;
    margin: 0;
    padding: 9px 16px 9px 68px;
    background: var(--app-header);
    box-shadow: 0 4px 14px rgba(12, 48, 34, 0.16);
  }

  .topbar .page-icon {
    display: none;
  }

  .mobile-menu-button {
    position: fixed;
    top: 11px;
    left: 12px;
    z-index: 80;
    display: grid;
    width: 44px;
    height: 44px;
    padding: 10px;
    place-items: center;
    gap: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 7px;
    background: var(--app-header);
    box-shadow: 0 5px 15px rgba(12, 48, 34, 0.2);
  }

  .mobile-menu-button span {
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 999px;
    background: #fff;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 70;
    width: min(330px, calc(100vw - 42px));
    height: 100dvh;
    min-height: 100dvh;
    max-height: 100dvh;
    padding: 13px 11px;
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 18px 0 44px rgba(12, 38, 25, 0.22);
  }

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

  .sidebar .nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }

  .sidebar .session {
    flex: 0 0 auto;
    margin-top: 0;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(8, 26, 17, 0.48);
    backdrop-filter: blur(2px);
  }

  body.menu-open .sidebar-overlay {
    display: block;
  }

  .panel {
    padding: 14px;
  }

  .split {
    grid-template-columns: 1fr;
  }

  .view,
  .panel,
  .of-sap-layout,
  .of-detail,
  .of-documents,
  .table-wrap {
    min-width: 0;
    max-width: 100%;
  }
}

@media (max-width: 900px) {
  .content {
    padding: 66px 14px 24px;
  }

  .mobile-menu-button {
    top: 11px;
    left: 12px;
    z-index: 80;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 7px;
    background: var(--app-header);
    box-shadow: 0 5px 15px rgba(12, 48, 34, 0.2);
  }

  .mobile-menu-button span {
    background: #fff;
  }

  .sidebar {
    z-index: 70;
    width: min(330px, calc(100vw - 42px));
    padding: 13px 11px;
    box-shadow: 18px 0 44px rgba(12, 38, 25, 0.22);
  }

  .sidebar-search {
    position: sticky;
    top: 0;
    z-index: 3;
    min-height: 46px;
    margin-bottom: 7px;
    background: #fff;
    box-shadow: 0 6px 12px rgba(19, 61, 40, 0.08);
  }

  .sidebar-search input,
  .sidebar-search input:focus {
    min-height: 44px;
    font-size: 14px;
  }

  .brand {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .brand-logo {
    width: 88px;
  }

  .sidebar-overlay {
    z-index: 60;
    background: rgba(8, 26, 17, 0.48);
    backdrop-filter: blur(2px);
  }

  .topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 40;
    min-height: 58px;
    margin: 0;
    padding: 9px 12px 9px 68px;
    background: var(--app-header);
    box-shadow: 0 4px 14px rgba(12, 48, 34, 0.16);
  }

  .topbar .page-icon,
  .topbar .sap-pill {
    display: none;
  }

  .topbar h2 {
    font-size: 18px;
  }

  .topbar p {
    max-width: 62vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.compact-mobile-form-view .content {
    padding-top: 66px;
  }

  body.compact-mobile-form-view .topbar {
    display: none;
  }

  body.compact-mobile-form-view::before {
    content: "";
    position: fixed;
    inset: 0 0 auto;
    z-index: 35;
    height: 58px;
    background: var(--app-header);
    box-shadow: 0 4px 14px rgba(12, 48, 34, 0.16);
  }

  .panel-head {
    align-items: flex-start;
  }

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

  .session {
    margin-top: 8px;
  }

  .sidebar .session #logoutButton {
    order: initial;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 64px 8px 18px;
  }

  .topbar {
    min-height: 56px;
    padding-left: 64px;
  }

  .mobile-menu-button {
    top: 10px;
    left: 10px;
    width: 42px;
    height: 42px;
  }

  .panel,
  .issue-panel,
  #entryPtForm,
  #wasteForm,
  #qualityForm {
    padding: 12px;
    border-radius: 7px;
    box-shadow: 0 5px 16px rgba(20, 53, 37, 0.06);
  }

  .panel-head {
    margin-bottom: 10px;
    padding-bottom: 10px;
  }

  .panel-head h3,
  .panel > h3,
  .issue-panel h3,
  #entryPtForm h3,
  #wasteForm h3 {
    font-size: 17px;
  }

  .metrics {
    gap: 7px;
  }

  .metrics article {
    min-height: 78px;
    padding: 11px;
  }

  .metrics strong {
    font-size: 21px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px;
  }

  button[type="submit"],
  .small-button,
  .row-action {
    min-height: 44px;
  }

  .form-actions {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    border-radius: 6px;
  }

  .transfer-checkin-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .transfer-checkin-select-all {
    min-height: 44px;
  }

  .toast {
    right: 8px;
    bottom: 8px;
    max-width: calc(100vw - 16px);
  }
}

/* Salida MP Multiple */
.multiple-issue-panel {
  display: grid;
  gap: 14px;
  max-width: none;
}

.multiple-issue-head {
  margin-bottom: 0;
}

.multiple-issue-order-row {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(280px, 1fr);
  gap: 14px;
  align-items: end;
}

.multiple-issue-order-summary {
  display: grid;
  min-height: 66px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--green);
  background: var(--soft);
}

.multiple-issue-order-summary strong {
  font-size: 17px;
}

.multiple-issue-order-summary span,
.multiple-issue-order-summary small {
  color: var(--muted);
}

.multiple-issue-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--border);
  background: var(--soft);
}

.multiple-issue-toolbar > div:first-child {
  display: grid;
  gap: 2px;
}

.multiple-issue-toolbar span {
  color: var(--muted);
  font-size: 13px;
}

.multiple-issue-toolbar-actions {
  display: flex;
  gap: 8px;
}

.multiple-issue-table-wrap {
  overflow-x: auto;
  overflow-y: visible;
}

.multiple-issue-table {
  table-layout: fixed;
  min-width: 1040px;
}

.multiple-issue-table th:nth-child(1) { width: 56px; }
.multiple-issue-table th:nth-child(2) { width: 174px; }
.multiple-issue-table th:nth-child(3),
.multiple-issue-table th:nth-child(4),
.multiple-issue-table th:nth-child(5) { width: 96px; }
.multiple-issue-table th:nth-child(6) { width: 92px; }
.multiple-issue-table th:nth-child(7) { width: 365px; }
.multiple-issue-table th:nth-child(8) { width: 72px; }

.multiple-issue-table td {
  vertical-align: top;
}

.multiple-issue-table td > small,
.multiple-issue-table td > strong + small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.25;
}

.multiple-issue-table select,
.multiple-issue-table input {
  min-height: 40px;
}

.multiple-issue-lots-cell {
  overflow: visible;
}

.multiple-lot-allocation {
  position: relative;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 128px 40px;
  gap: 7px;
  margin-bottom: 7px;
}

.multiple-lot-allocation > small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.multiple-lot-results {
  z-index: 80;
  min-width: 360px;
}

.multiple-add-lot {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--border-strong);
  background: var(--soft);
  color: var(--green);
}

.multiple-issue-excluded {
  background: #f7f8f7;
  opacity: 0.8;
}

.multiple-issue-footer {
  position: sticky;
  bottom: 0;
  z-index: 15;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 10px 0 2px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.8), #fff 35%);
}

.multiple-issue-footer .form-message {
  margin: 0;
}

.multiple-issue-footer button {
  min-width: 220px;
}

@media (max-width: 1024px) {
  .multiple-issue-order-row {
    grid-template-columns: 1fr;
  }

  .multiple-issue-table-wrap {
    overflow-x: auto;
  }
}

@media (max-width: 720px) {
  .multiple-issue-panel {
    gap: 10px;
  }

  .multiple-issue-head .app-status {
    display: none;
  }

  .multiple-issue-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .multiple-issue-toolbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .multiple-issue-table-wrap {
    overflow: visible;
    border: 0;
  }

  .multiple-issue-table {
    display: block;
    min-width: 0;
  }

  .multiple-issue-table thead {
    display: none;
  }

  .multiple-issue-table tbody {
    display: grid;
    gap: 10px;
  }

  .multiple-issue-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--green);
    background: #fff;
  }

  .multiple-issue-table td {
    display: grid;
    gap: 3px;
    padding: 0;
    border: 0;
  }

  .multiple-issue-table td::before {
    content: attr(data-label);
    color: var(--green-dark);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
  }

  .multiple-issue-table td:nth-child(2),
  .multiple-issue-table td:nth-child(6),
  .multiple-issue-table td:nth-child(7) {
    grid-column: 1 / -1;
  }

  .multiple-lot-allocation {
    grid-template-columns: minmax(0, 1fr) 110px 40px;
  }

  .multiple-lot-results {
    min-width: min(350px, calc(100vw - 58px));
  }

  .multiple-issue-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .multiple-issue-footer button {
    width: 100%;
  }
}

/* Inventory transfer workflow: mobile-only composition. Desktop and tablet stay unchanged. */
@media (max-width: 640px) {
  #transfer-manual,
  #transferencias,
  #transfer-checkout,
  #transfer-checkout-detail,
  #transfer-checkin,
  #transfer-checkin-detail,
  #transfer-mis,
  #transfer-detalle {
    width: 100%;
    min-width: 0;
  }

  #transfer-manual .panel,
  #transferencias .panel,
  #transfer-checkout .panel,
  #transfer-checkout-detail .panel,
  #transfer-checkin .panel,
  #transfer-checkin-detail .panel,
  #transfer-mis .panel,
  #transfer-detalle .panel {
    width: 100%;
    min-width: 0;
    padding: 11px;
  }

  #transfer-manual .panel-head,
  #transferencias .panel-head,
  #transfer-checkout .panel-head,
  #transfer-checkin .panel-head,
  #transfer-mis .panel-head {
    gap: 8px;
  }

  #transfer-manual .panel-head .app-status,
  #transferencias .panel-head .app-status {
    display: none;
  }

  #transfer-manual .transfer-manual-header,
  #transferencias .transfer-header-grid-builder,
  #transferencias .transfer-material-filters,
  #transfer-mis .transfer-mine-date-filters {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  #transfer-manual .transfer-manual-builder,
  #transferencias .transfer-builder {
    gap: 10px;
  }

  #transfer-manual .transfer-manual-search,
  #transfer-checkout .transfer-operation-search,
  #transfer-checkin .transfer-operation-search {
    max-width: none;
  }

  #transfer-manual .search-results,
  #transfer-checkout .search-results,
  #transfer-checkin .search-results {
    max-width: calc(100vw - 38px);
  }

  #transferencias .transfer-of-options {
    position: fixed;
    z-index: 110;
    inset: 66px 8px auto;
    width: auto;
    max-height: calc(100dvh - 78px);
    padding: 7px;
    overflow: hidden;
  }

  #transferencias .transfer-of-filters {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 6px;
  }

  #transferencias .transfer-of-filters .transfer-of-search,
  #transferencias .transfer-of-filters label:last-child {
    grid-column: 1 / -1;
  }

  #transferencias .transfer-of-options-list {
    max-height: calc(100dvh - 365px);
    overscroll-behavior: contain;
  }

  #transferencias .transfer-of-picker-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 7px;
  }

  #transferencias .transfer-of-picker-actions button {
    width: 100%;
  }

  #transferencias .transfer-destination-note {
    min-height: 0;
    padding: 9px 11px;
  }

  #transfer-manual .transfer-selection-toolbar,
  #transferencias .transfer-selection-toolbar {
    gap: 8px;
    padding: 9px;
  }

  #transfer-manual .transfer-selection-toolbar > button,
  #transferencias .transfer-selection-toolbar .panel-actions,
  #transferencias .transfer-selection-toolbar .panel-actions button {
    width: 100%;
  }

  #transferencias .transfer-selection-toolbar .panel-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  #transferencias .transfer-selection-toolbar .panel-actions #transferCreateButton {
    grid-column: 1 / -1;
  }

  #transfer-manual .transfer-lines-table tbody,
  #transferencias .transfer-lines-table tbody,
  #transfer-checkout .transfer-operation-list-table tbody,
  #transfer-checkin .transfer-operation-list-table tbody,
  #transfer-checkout-detail .transfer-checkout-standalone tbody,
  #transfer-checkin-detail .transfer-checkout-standalone tbody {
    gap: 8px;
  }

  #transferencias .transfer-lines-table {
    overflow: visible;
  }

  #transferencias .transfer-lines-table table,
  #transferencias .transfer-lines-table tbody,
  #transferencias .transfer-lines-table tr,
  #transferencias .transfer-lines-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  #transferencias .transfer-lines-table thead {
    display: none;
  }

  #transferencias .transfer-lines-table tbody {
    display: grid;
  }

  #transfer-manual .transfer-lines-table tr,
  #transferencias .transfer-lines-table tr,
  #transfer-checkout .transfer-operation-list-table tbody tr,
  #transfer-checkin .transfer-operation-list-table tbody tr,
  #transfer-checkout-detail .transfer-checkout-standalone tbody tr,
  #transfer-checkin-detail .transfer-checkout-standalone tbody tr {
    padding: 10px;
  }

  #transferencias .transfer-lines-table tr {
    border: 1px solid #d5e5dc;
    border-left: 4px solid var(--green);
    border-radius: 7px;
    background: #fff;
  }

  #transfer-manual .transfer-lines-table td,
  #transferencias .transfer-lines-table td,
  #transfer-checkout .transfer-operation-list-table tbody td,
  #transfer-checkin .transfer-operation-list-table tbody td,
  #transfer-checkout-detail .transfer-checkout-standalone tbody td,
  #transfer-checkin-detail .transfer-checkout-standalone tbody td {
    grid-template-columns: minmax(94px, 34%) minmax(0, 1fr);
    gap: 8px;
    padding: 7px 0;
  }

  #transferencias .transfer-lines-table td {
    display: grid;
    border: 0;
    border-bottom: 1px solid #edf2ef;
  }

  #transferencias .transfer-lines-table td:last-child {
    border-bottom: 0;
  }

  #transferencias .transfer-lines-table td::before {
    content: attr(data-label);
    color: #547064;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }

  #transferencias .transfer-lines-table .transfer-check-cell {
    width: 100%;
    text-align: left;
  }

  #transfer-manual .transfer-lines-table td > *,
  #transferencias .transfer-lines-table td > *,
  #transfer-checkout .transfer-operation-list-table tbody td > *,
  #transfer-checkin .transfer-operation-list-table tbody td > *,
  #transfer-checkout-detail .transfer-checkout-standalone tbody td > *,
  #transfer-checkin-detail .transfer-checkout-standalone tbody td > * {
    min-width: 0;
  }

  #transfer-manual .transfer-line-warehouse,
  #transfer-manual .transfer-quantity-input,
  #transferencias .transfer-line-warehouse,
  #transferencias .transfer-quantity-input {
    width: 100%;
  }

  #transfer-checkout-detail .transfer-batch-row {
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 6px;
  }

  #transfer-checkout-detail .transfer-batch-row .transfer-lot-search,
  #transfer-checkout-detail .transfer-batch-row input[inputmode="decimal"] {
    grid-column: 1 / -1;
    width: 100%;
  }

  #transfer-checkout-detail .transfer-batch-row input[type="number"] {
    grid-column: 1;
    width: 100%;
  }

  #transfer-checkout-detail .transfer-batch-row .icon-button {
    grid-column: 2;
    justify-self: end;
  }

  #transfer-checkout-detail [data-add-checkin-batch],
  #transfer-checkout-detail .transfer-actions .small-button,
  #transfer-checkin-detail .transfer-actions .small-button,
  #transfer-checkin-detail .transfer-investigation-footer .small-button {
    width: 100%;
  }

  #transfer-checkin-detail .transfer-checkin-standalone tbody td,
  #transfer-checkin-detail .transfer-checkin-standalone tbody td:last-child {
    grid-template-columns: 1fr;
  }

  #transfer-checkin-detail .transfer-received-check {
    min-height: 44px;
  }

  #transfer-checkin-detail .transfer-checkin-reason {
    min-height: 76px;
  }

  #transfer-checkout .transfer-operation-pagination,
  #transfer-checkin .transfer-operation-pagination,
  #transfer-mis .pagination-bar {
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
  }

  #transfer-checkout .transfer-operation-list-panel .panel-head button,
  #transfer-checkin .transfer-operation-list-panel .panel-head button,
  #transfer-mis .panel-head button {
    width: 100%;
  }

  #transfer-checkout-detail .transfer-detail-back,
  #transfer-checkin-detail .transfer-detail-back,
  #transfer-detalle .transfer-detail-back {
    display: flex;
    min-height: 44px;
    align-items: center;
    margin-bottom: 8px;
  }

  #transfer-checkout-detail .transfer-detail-info,
  #transfer-checkin-detail .transfer-detail-info,
  #transfer-detalle .transfer-detail-info {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  #transfer-mis .transfer-mine-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  #transfer-mis .transfer-mine-tabs button {
    min-width: 0;
    min-height: 44px;
    white-space: normal;
  }

  #transfer-manual .transfer-flow-note,
  #transferencias .transfer-flow-note {
    margin-top: 9px;
    padding: 10px;
    font-size: 12px;
  }
}
/* Planificador MRP: modulo de solo lectura hasta aprobar el piloto. */
.planning-shell {
  display: grid;
  gap: 14px;
}

.planning-command-bar,
.planning-panel-heading,
.planning-actions,
.planning-kpis,
.planning-grid,
.planning-scenario-row {
  display: flex;
  align-items: center;
}

.planning-command-bar {
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
}

.planning-command-bar h2,
.planning-panel-heading h3,
.planning-alert-panel h3,
.planning-history-panel h3 {
  margin: 0;
}

.planning-command-bar p,
.planning-panel-heading p {
  margin: 4px 0 0;
  color: var(--muted, #62716b);
}

.planning-actions {
  gap: 10px;
}

.planning-actions label,
.planning-filter label {
  display: grid;
  gap: 4px;
  color: #34483f;
  font-size: 0.82rem;
  font-weight: 700;
}

.planning-actions select {
  min-width: 130px;
}

.planning-source-notice {
  border-left: 4px solid #008c50;
  background: #eef8f3;
  padding: 11px 14px;
  color: #40564c;
}

.planning-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
}

.planning-kpi {
  min-height: 88px;
  border: 1px solid #d4e4dc;
  border-radius: 7px;
  background: #fff;
  padding: 14px 16px;
  display: grid;
  align-content: center;
  gap: 5px;
}

.planning-kpi span {
  color: #62716b;
  font-size: 0.86rem;
  font-weight: 700;
}

.planning-kpi strong {
  color: #006c3d;
  font-size: 1.75rem;
}

.planning-kpi-alert strong {
  color: #b42828;
}

.planning-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(280px, 1fr);
  align-items: start;
  gap: 14px;
}

.planning-main-panel,
.planning-alert-panel,
.planning-history-panel {
  min-width: 0;
  padding: 16px;
}

.planning-panel-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.planning-filter-grid {
  display: grid;
  grid-template-columns: minmax(190px, 1.2fr) minmax(170px, 1fr) minmax(190px, 1fr);
  gap: 8px;
  width: min(760px, 58vw);
}

.planning-filter-grid label {
  display: grid;
  gap: 4px;
  color: #34483f;
  font-size: 0.78rem;
  font-weight: 800;
}

.planning-table {
  min-width: 1220px;
}

.planning-table th,
.planning-table td {
  padding: 9px;
  vertical-align: top;
}

.planning-table th[title] {
  cursor: help;
  text-decoration: underline dotted #6f8b7d;
  text-underline-offset: 3px;
}

.planning-quantity-field {
  display: grid;
  grid-template-columns: minmax(88px, 1fr) auto;
  align-items: center;
  gap: 3px 6px;
  min-width: 145px;
}

.planning-quantity-field input {
  width: 100%;
  min-height: 36px;
  border: 1px solid #a9cabb;
  border-radius: 5px;
  padding: 6px 8px;
  font: inherit;
  font-weight: 800;
  color: #006c3d;
}

.planning-quantity-field span {
  font-weight: 800;
}

.planning-quantity-field small {
  grid-column: 1 / -1;
  color: #6b7b74;
  font-size: 0.7rem;
}

.planning-product-link,
.planning-number-link {
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.planning-product-link {
  display: grid;
  gap: 2px;
  min-width: 190px;
}

.planning-product-link strong,
.planning-number-link {
  color: #007744;
}

.planning-product-link small {
  color: #273b32;
}

.planning-product-link em {
  color: #6b7b74;
  font-size: 0.72rem;
  font-style: normal;
}

.planning-product-link:hover strong,
.planning-number-link:hover {
  text-decoration: underline;
}

.planning-detail-modal {
  position: fixed;
  z-index: 1100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(14, 30, 23, 0.58);
}

.planning-detail-dialog {
  width: min(1180px, 96vw);
  max-height: 92vh;
  overflow: auto;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
}

.planning-detail-head {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #cfe0d7;
  background: #0d4d35;
  padding: 15px 18px;
  color: #fff;
}

.planning-detail-head span {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.planning-detail-head h3 {
  margin: 3px 0 0;
}

.planning-detail-head .icon-button {
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
  font-size: 1.4rem;
}

.planning-detail-body {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.planning-detail-body h4 {
  margin: 0 0 8px;
  color: #0c6f43;
}

.planning-detail-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  border: 1px solid #d3e3db;
}

.planning-detail-kpis > div {
  display: grid;
  gap: 5px;
  border-right: 1px solid #d3e3db;
  padding: 12px;
}

.planning-detail-kpis > div:last-child {
  border-right: 0;
}

.planning-detail-kpis span {
  color: #61736a;
  font-size: 0.76rem;
  font-weight: 800;
}

.planning-detail-kpis strong {
  color: #006f40;
  font-size: 1.05rem;
}

.planning-formulas {
  border-left: 4px solid #009252;
  background: #eef8f3;
  padding: 12px 14px;
}

.planning-formulas p {
  margin: 5px 0;
  color: #34483f;
}

.planning-detail-table {
  min-width: 760px;
}

.planning-detail-table th,
.planning-detail-table td {
  padding: 8px;
}

.planning-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid #cbdcd4;
  border-radius: 999px;
  background: #f4f8f6;
  padding: 2px 9px;
  color: #40564c;
  font-size: 0.78rem;
  font-weight: 800;
}

.planning-status.propuesto,
.planning-status.calculado {
  border-color: #f0d49f;
  background: #fff7e8;
  color: #8a5700;
}

.planning-status.cubierto,
.planning-status.aprobado {
  border-color: #b9e1cd;
  background: #ecf8f2;
  color: #007744;
}

.planning-of-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 7px 0 0;
  border: 1px solid #efcf93;
  border-radius: 4px;
  background: #fff8e9;
  padding: 4px 9px;
  color: #7d5100;
  font-size: 0.8rem;
  font-weight: 800;
}

.planning-alert-list,
.planning-scenario-list {
  display: grid;
  gap: 8px;
}

.planning-alert {
  border: 1px solid #dde8e2;
  border-left-width: 4px;
  border-radius: 5px;
  padding: 10px;
}

.planning-alert > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.planning-alert p {
  margin: 6px 0;
}

.planning-alert.critical,
.planning-alert.high {
  border-left-color: #c62c2c;
  background: #fff4f4;
}

.planning-alert.medium {
  border-left-color: #d58a00;
  background: #fffaf0;
}

.planning-scenario-row {
  width: 100%;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #d7e3dd;
  border-radius: 6px;
  background: #fff;
  padding: 11px 13px;
  color: inherit;
  text-align: left;
}

.planning-scenario-row:hover,
.planning-scenario-row.active {
  border-color: #62b98f;
  background: #eef8f3;
}

.planning-scenario-row > span:first-child {
  display: grid;
  gap: 3px;
}

@media (max-width: 1050px) {
  .planning-grid {
    grid-template-columns: 1fr;
  }

  .planning-kpis {
    grid-template-columns: repeat(2, 1fr);
  }

  .planning-filter-grid {
    width: 100%;
  }

  .planning-detail-kpis {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 700px) {
  .planning-command-bar,
  .planning-panel-heading,
  .planning-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .planning-kpis {
    grid-template-columns: 1fr 1fr;
  }

  .planning-kpi {
    min-height: 78px;
    padding: 10px;
  }

  .planning-kpi strong {
    font-size: 1.45rem;
  }

  .planning-filter-grid {
    grid-template-columns: 1fr;
  }

  .planning-detail-modal {
    align-items: end;
    padding: 0;
  }

  .planning-detail-dialog {
    width: 100%;
    max-height: 94vh;
    border-radius: 7px 7px 0 0;
  }

  .planning-detail-body {
    padding: 12px;
  }

  .planning-detail-kpis {
    grid-template-columns: 1fr 1fr;
  }

  .planning-detail-kpis > div {
    border-bottom: 1px solid #d3e3db;
  }

  .planning-scenario-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Estado visible mientras SAP consulta lotes para Salida MP y Check-Out. */
.lot-loading-status {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  margin: 10px 0 14px;
  padding: 10px 13px;
  overflow: hidden;
  border: 1px solid #b9dfcb;
  border-radius: 9px;
  background: #f2faf6;
  color: #086d42;
  font-size: 13px;
}

.lot-loading-status::before {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.lot-loading-status.is-loading {
  border-color: #efb850;
  background: #fff8e9;
  color: #7a4c00;
  cursor: wait;
}

.lot-loading-status.is-loading::before {
  content: "";
  box-sizing: border-box;
  border: 3px solid #f2d293;
  border-top-color: #d88400;
  border-radius: 50%;
  animation: lot-status-spin 0.8s linear infinite;
}

.lot-loading-status.is-refreshing {
  border-color: #9dcdb5;
  background: #f1faf5;
  color: #086d42;
}

.lot-loading-status.is-refreshing::before {
  content: "";
  box-sizing: border-box;
  border: 3px solid #c9e5d6;
  border-top-color: #138354;
  border-radius: 50%;
  animation: lot-status-spin 0.8s linear infinite;
}

.lot-loading-status.is-loading::after {
  content: "";
  position: absolute;
  left: -35%;
  bottom: 0;
  width: 35%;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f5b233, #dc7b00);
  animation: lot-status-progress 1.15s ease-in-out infinite;
}

.lot-loading-status.is-refreshing::after {
  content: "";
  position: absolute;
  left: -35%;
  bottom: 0;
  width: 35%;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #54b987, #138354);
  animation: lot-status-progress 1.15s ease-in-out infinite;
}

.lot-loading-status.is-ready::before {
  content: "\2713";
  border-radius: 50%;
  background: #138354;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

#issueLotStatus.lot-loading-status {
  box-shadow: none;
  border-left: 1px solid #efb850;
}

.lot-loading-status + .table-wrap {
  transition: opacity 0.18s ease;
}

.lot-loading-status.is-loading + .table-wrap {
  opacity: 0.72;
}

@keyframes lot-status-spin {
  to { transform: rotate(360deg); }
}

@keyframes lot-status-progress {
  0% { left: -35%; }
  100% { left: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .lot-loading-status.is-loading::before,
  .lot-loading-status.is-loading::after,
  .lot-loading-status.is-refreshing::before,
  .lot-loading-status.is-refreshing::after {
    animation-duration: 2.4s;
  }
}

.automatic-receipt-panel {
  display: grid;
  gap: 16px;
}

.automatic-receipt-heading,
.automatic-receipt-actions {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.automatic-receipt-heading h3,
.automatic-receipt-heading p {
  margin: 0;
}

.automatic-receipt-heading p {
  color: var(--muted);
  margin-top: 4px;
}

.automatic-receipt-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.quantity-with-unit {
  align-items: center;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.quantity-with-unit strong {
  min-width: 48px;
}

.automatic-receipt-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid #cfe2d8;
  background: #f2faf6;
}

.automatic-receipt-summary > div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-right: 1px solid #d8e7df;
}

.automatic-receipt-summary > div:last-child {
  border-right: 0;
}

.automatic-receipt-summary span,
.automatic-receipt-table td small,
.automatic-lot small {
  color: var(--muted);
  display: block;
}

.automatic-receipt-summary .warning {
  background: #fff7e8;
  color: #965d00;
}

.automatic-receipt-table-wrap {
  max-height: 52vh;
}

.automatic-receipt-table {
  min-width: 1120px;
}

.automatic-transfer-stock {
  min-width: 145px;
}

.automatic-lot-list {
  display: grid;
  gap: 5px;
}

.automatic-lot {
  border-left: 3px solid #aebdb5;
  padding-left: 8px;
}

.automatic-lot.priority {
  border-left-color: var(--green);
  background: #eff9f4;
  padding: 6px 8px;
}

.automatic-shortage {
  background: #fff5f5;
}

.automatic-consumption-input {
  align-items: center;
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto;
  gap: 8px;
}

.automatic-consumption-input input {
  min-width: 110px;
}

.automatic-availability {
  display: grid;
  justify-items: start;
  gap: 6px;
}

.automatic-availability small {
  color: var(--muted);
  line-height: 1.25;
}

.automatic-adjustment-field {
  border-left: 4px solid #d28a00;
  background: #fff8e9;
  padding: 12px;
}

.investigation-heading {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.investigation-heading p {
  color: var(--muted);
  margin: 4px 0 0;
}

.investigation-filters {
  display: grid;
  grid-template-columns: minmax(180px, .35fr) minmax(280px, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.investigations-table small,
.investigation-lines-table small {
  color: var(--muted);
  display: block;
  margin-top: 3px;
}

.investigation-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: #f2faf6;
  border: 1px solid #d4e6dd;
  margin: 14px 0;
}

.investigation-kpis > div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-right: 1px solid #d4e6dd;
}

.investigation-kpis span {
  color: var(--muted);
}

.investigation-difference {
  color: #b62020;
}

.investigation-action-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
  background: #f4f8f6;
  border: 1px solid #d4e2db;
}

.investigation-action-base,
.investigation-action-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.investigation-action-fields {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.investigation-action-fields:empty {
  display: none;
}

.investigation-action-help {
  grid-column: 1 / -1;
  margin: 0;
  padding: 10px 12px;
  color: #315346;
  background: #eaf6f0;
  border-left: 3px solid var(--green);
}

.investigation-action-comment {
  display: grid;
  gap: 6px;
}

.investigation-action-footer {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.investigation-action-footer .error {
  flex: 1;
  margin: 0;
}

.investigation-history {
  display: grid;
  gap: 8px;
}

.investigation-history > div {
  border-left: 3px solid var(--green);
  background: #f5faf7;
  padding: 10px 12px;
}

.investigation-history span {
  color: var(--muted);
  margin-left: 8px;
}

.investigation-history small {
  display: block;
  margin-top: 6px;
  color: #315346;
  font-weight: 700;
}

.status-pill.danger {
  background: #ffe8e8;
  color: #b62020;
}

.status-pill.success {
  background: #eaf8f1;
  color: #087a49;
}

.status-pill.neutral {
  background: #eef2f0;
  color: #4d5f56;
}

@media (max-width: 980px) {
  .automatic-receipt-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .automatic-receipt-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .investigation-kpis,
  .investigation-action-base,
  .investigation-action-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .automatic-receipt-heading,
  .automatic-receipt-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .automatic-receipt-fields,
  .automatic-receipt-summary {
    grid-template-columns: 1fr;
  }

  .automatic-receipt-summary > div {
    border-right: 0;
    border-bottom: 1px solid #d8e7df;
  }

  .automatic-receipt-actions button {
    width: 100%;
  }

  .investigation-heading {
    flex-direction: column;
  }

  .investigation-filters,
  .investigation-kpis,
  .investigation-action-base,
  .investigation-action-fields {
    grid-template-columns: 1fr;
  }

  .investigation-action-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .investigation-action-footer button {
    width: 100%;
  }
}

/* Login corporativo Proluxsa */
.login-shell {
  min-height: 100vh;
  min-height: 100svh;
  grid-template-columns: minmax(0, 1fr) 500px;
  place-items: stretch;
  padding: 0;
  overflow: hidden;
  background: #fff;
}

.login-visual {
  position: relative;
  isolation: isolate;
  display: flex;
  min-height: 100%;
  overflow: hidden;
  flex-direction: column;
  justify-content: center;
  padding: clamp(48px, 7vw, 112px);
  background:
    radial-gradient(circle at 85% 15%, rgba(255, 255, 255, 0.16), transparent 25%),
    linear-gradient(138deg, #005f3b 0%, #008f55 58%, #0aa968 100%);
  color: #fff;
}

.login-visual::before {
  content: "";
  position: absolute;
  z-index: -1;
  right: -15%;
  bottom: -36%;
  width: 68%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.055);
}

.login-visual::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: 0.28;
  background-image: linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(120deg, transparent 5%, #000 100%);
}

.login-visual-orbit {
  position: absolute;
  z-index: -1;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
}

.login-visual-orbit-one {
  top: -180px;
  right: -110px;
  width: 520px;
  height: 520px;
}

.login-visual-orbit-two {
  top: -82px;
  right: -22px;
  width: 320px;
  height: 320px;
}

.login-visual-content {
  width: min(690px, 100%);
}

.login-status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: clamp(42px, 8vh, 76px);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  padding: 8px 13px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.94);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.login-status span {
  width: 8px;
  height: 8px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background: #87f3b8;
  box-shadow: 0 0 0 4px rgba(135, 243, 184, 0.14);
}

.login-visual-kicker {
  margin: 0 0 14px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.login-visual h2 {
  max-width: 720px;
  margin: 0;
  color: #fff;
  font-size: clamp(42px, 5.2vw, 74px);
  line-height: 0.99;
  letter-spacing: -0.045em;
}

.login-visual-content > p:not(.login-visual-kicker) {
  max-width: 600px;
  margin: 26px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(16px, 1.5vw, 20px);
  line-height: 1.6;
}

.login-feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 38px;
}

.login-feature-list span {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 10px 13px;
  background: rgba(0, 65, 39, 0.2);
  color: rgba(255, 255, 255, 0.94);
  font-size: 12px;
  font-weight: 800;
}

.login-visual-footer {
  position: absolute;
  bottom: clamp(30px, 5vh, 54px);
  left: clamp(48px, 7vw, 112px);
  margin: 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 700;
}

.login-panel,
.recovery-panel {
  align-self: center;
  justify-self: center;
  width: min(406px, calc(100% - 64px));
  max-height: 100vh;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  padding: 24px 0;
  background: #fff;
  box-shadow: none;
  gap: 16px;
}

.login-panel::before {
  display: none;
}

.login-brand {
  justify-content: flex-start;
  padding: 0 0 7px;
}

.login-brand img {
  width: min(174px, 58%);
}

.login-copy {
  text-align: left;
}

.login-panel .eyebrow {
  margin-bottom: 9px;
  color: var(--green-dark);
  letter-spacing: 0.08em;
}

.login-panel h1 {
  margin: 0 0 10px;
  color: #15251d;
  font-size: 31px;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.login-panel .muted {
  font-size: 14px;
  line-height: 1.55;
}

.login-panel label:not(.remember-row) {
  gap: 8px;
  color: #253b31;
  font-size: 13px;
}

.login-panel input[type="email"],
.login-panel input[type="password"] {
  min-height: 49px;
  border: 1px solid #d6e1db;
  border-radius: 10px;
  padding: 13px 15px;
  background: #f8faf9;
  font-size: 14px;
}

.login-panel input::placeholder {
  color: #93a19a;
}

.login-panel input[type="email"]:focus,
.login-panel input[type="password"]:focus {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0, 143, 85, 0.1);
}

.login-panel .remember-row {
  color: #40534a;
  font-size: 13px;
  font-weight: 700;
}

.login-panel .remember-row input {
  width: 18px;
  height: 18px;
}

.login-panel button[type="submit"] {
  min-height: 49px;
  border-radius: 10px;
  background: linear-gradient(135deg, #008f55, #007344);
  box-shadow: 0 10px 22px rgba(0, 111, 66, 0.22);
  font-size: 14px;
  letter-spacing: 0.01em;
}

.login-panel button[type="submit"]:hover {
  background: linear-gradient(135deg, #007d4a, #005f39);
  transform: translateY(-1px);
}

.login-panel .link-button {
  justify-self: center;
  padding: 7px 12px;
  color: #32634c;
  font-size: 13px;
}

.login-version {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 2px 0 0;
  color: #87948e;
  font-size: 11px;
}

.login-version strong {
  border-radius: 999px;
  padding: 4px 8px;
  background: #e9f5ee;
  color: #087747;
  font-size: 10px;
  letter-spacing: 0.04em;
}

.login-version span {
  padding-left: 9px;
  border-left: 1px solid #dbe5df;
}

@media (max-width: 880px) {
  .login-shell {
    grid-template-columns: 1fr;
    place-items: center;
    overflow-y: auto;
    padding: 24px;
    background:
      radial-gradient(circle at 15% 10%, rgba(0, 143, 85, 0.16), transparent 30%),
      linear-gradient(160deg, #f8fcfa, #edf5f0);
  }

  .login-visual {
    display: none;
  }

  .login-panel,
  .recovery-panel {
    width: min(460px, 100%);
    max-height: none;
    border: 1px solid rgba(215, 228, 221, 0.9);
    border-radius: 18px;
    padding: 30px;
    box-shadow: 0 24px 60px rgba(18, 56, 36, 0.12);
  }

  .login-panel::before {
    display: block;
    height: 4px;
  }

  .login-brand {
    justify-content: center;
    padding-bottom: 10px;
  }

  .login-copy {
    text-align: center;
  }
}

@media (max-width: 480px) {
  .login-shell {
    padding: 14px;
  }

  .login-panel,
  .recovery-panel {
    gap: 17px;
    border-radius: 15px;
    padding: 25px 22px;
  }

  .login-brand img {
    width: min(190px, 66%);
  }

  .login-panel h1 {
    font-size: 28px;
  }
}
