/* Ubicación física del stock. Capa visual aislada de la aplicación principal. */
@media screen {
  body.stock-location-opened {
    overflow: hidden;
  }

  .stock-location-filter {
    display: grid;
    grid-template-columns: auto minmax(150px, 190px);
    align-items: center;
    gap: 3px 8px;
    color: #667085;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .stock-location-filter select {
    grid-column: 2;
    grid-row: 1 / span 2;
    min-height: 40px;
    padding: 0 34px 0 11px;
    color: #253047;
    border: 1px solid #ced7e3;
    border-radius: 10px;
    background: #ffffff;
    font: 750 12px/1.2 Inter, ui-sans-serif, system-ui, sans-serif;
    text-transform: none;
  }

  .stock-location-visible-count {
    min-height: 12px;
    color: #8a94a6;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
  }

  .stock-location-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 16px;
  }

  .stock-inventory-check {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .stock-location-summary .stock-inventory-check > span {
    display: inline-flex;
    align-items: baseline;
    gap: 9px;
    padding: 8px 12px;
    border: 1px solid #dce5ef;
    border-radius: 10px;
    background: #f5f9fd;
    color: #4d596f;
    font-size: 12px;
    font-weight: 750;
    letter-spacing: normal;
    text-transform: none;
  }

  .stock-location-summary .stock-inventory-check strong {
    display: inline;
    margin: 0;
    color: #20283a;
    font-size: 16px;
    line-height: 1;
  }

  .stock-location-summary article {
    position: relative;
    min-width: 0;
    overflow: hidden;
    padding: 14px 16px 13px;
    border: 1px solid #dfe5ed;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 7px 20px rgba(31, 40, 58, 0.045);
  }

  .stock-location-summary article::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: #1472c9;
  }

  .stock-location-summary article.orange::before { background: #db7b1d; }
  .stock-location-summary article.unassigned::before { background: #8a94a6; }

  .stock-location-summary span,
  .stock-location-summary small {
    display: block;
    color: #758095;
    font-size: 11px;
    line-height: 1.3;
  }

  .stock-location-summary span {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #4d596f;
    font-weight: 850;
    letter-spacing: 0.02em;
    text-transform: uppercase;
  }

  .stock-location-summary i,
  .stock-location-badge i,
  .stock-location-inputs label > span i {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #1472c9;
    box-shadow: 0 0 0 3px rgba(20, 114, 201, 0.12);
  }

  .stock-location-summary .orange i,
  .stock-location-badge.orange i,
  .stock-location-inputs label.orange > span i {
    background: #db7b1d;
    box-shadow: 0 0 0 3px rgba(219, 123, 29, 0.13);
  }

  .stock-location-summary .unassigned i,
  .stock-location-badge.unassigned i,
  .stock-location-badge.empty i {
    background: #8a94a6;
    box-shadow: 0 0 0 3px rgba(138, 148, 166, 0.13);
  }

  .stock-location-summary strong {
    display: block;
    margin: 7px 0 4px;
    color: #20283a;
    font-size: 23px;
    line-height: 1;
  }

  .stock-location-summary-help {
    grid-column: 1 / -1;
    margin: -2px 2px 0;
    color: #737f92;
    font-size: 11px;
    line-height: 1.4;
  }

  .stock-manual-adjust-open {
    margin-left: 3px;
    padding: 0;
    color: #1769aa;
    border: 0;
    background: transparent;
    font: inherit;
    font-weight: 850;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
  }

  .stock-manual-adjust-button {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 9px;
    align-items: center;
    min-height: 46px;
    padding: 7px 14px 7px 11px;
    color: #ffffff;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #087f5b, #0f9f72);
    box-shadow: 0 8px 22px rgba(15, 138, 95, 0.22);
    cursor: pointer;
  }

  .stock-manual-adjust-button > span {
    grid-row: 1 / 3;
    display: grid;
    place-items: center;
    width: 29px;
    height: 29px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 21px;
    font-weight: 900;
  }

  .stock-manual-adjust-button strong,
  .stock-manual-adjust-button small {
    display: block;
    text-align: left;
    line-height: 1.15;
  }

  .stock-manual-adjust-button strong { font-size: 12px; }
  .stock-manual-adjust-button small { margin-top: 2px; color: #d8fff1; font-size: 9px; }
  .stock-manual-adjust-button:hover { filter: brightness(1.06); transform: translateY(-1px); }

  .stock-location-edit,
  .stock-location-readonly {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
    margin: 7px 0 0 auto;
  }

  .stock-location-edit {
    max-width: 230px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
  }

  .stock-location-edit:hover .stock-location-badge {
    border-color: #aeb9c8;
    transform: translateY(-1px);
  }

  .stock-location-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 23px;
    padding: 4px 7px;
    color: #315f8d;
    border: 1px solid #cde1f4;
    border-radius: 999px;
    background: #eef7ff;
    font-size: 9px;
    font-weight: 850;
    line-height: 1;
    white-space: nowrap;
    transition: transform 140ms ease, border-color 140ms ease;
  }

  .stock-location-badge i {
    width: 6px;
    height: 6px;
    box-shadow: none;
  }

  .stock-location-badge.orange {
    color: #925114;
    border-color: #f0d2b4;
    background: #fff6eb;
  }

  .stock-location-badge.unassigned,
  .stock-location-badge.empty {
    color: #626d80;
    border-color: #dce2ea;
    background: #f3f5f8;
  }

  .stock-location-filtered {
    display: none !important;
  }

  .stock-sale-warehouse-field {
    position: relative;
    padding: 10px 11px;
    border: 1px solid #dbe3ec;
    border-radius: 11px;
    background: #f8fafc;
  }

  .stock-sale-warehouse-field[hidden] {
    display: none !important;
  }

  .stock-sale-warehouse-field > span {
    display: block;
    margin-bottom: 7px;
    color: #4d596f;
    font-size: 11px;
    font-weight: 850;
  }

  .stock-sale-warehouse-field > span::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 50%;
    background: linear-gradient(90deg, #1472c9 0 50%, #db7b1d 50%);
  }

  .stock-sale-warehouse-field select {
    width: 100%;
  }

  .stock-sale-warehouse-field small {
    display: block;
    margin-top: 6px;
    color: #758095;
    font-size: 10px;
    line-height: 1.35;
  }

  .stock-location-backdrop {
    position: fixed;
    z-index: 14000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(19, 27, 42, 0.66);
    backdrop-filter: blur(5px);
  }

  .stock-location-dialog {
    position: relative;
    width: min(610px, 100%);
    overflow: hidden;
    color: #20283a;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 22px;
    background: #f6f8fb;
    box-shadow: 0 30px 85px rgba(12, 20, 34, 0.34);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  }

  .stock-location-dialog > header {
    padding: 26px 64px 23px 26px;
    color: #ffffff;
    background:
      radial-gradient(circle at 92% -25%, rgba(20, 114, 201, 0.46), transparent 15rem),
      linear-gradient(128deg, #20283a 0%, #33415e 100%);
  }

  .stock-location-dialog header p {
    margin: 0 0 6px;
    color: #8fc7fa;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.11em;
    text-transform: uppercase;
  }

  .stock-location-dialog header h2 {
    margin: 0;
    color: #ffffff;
    font-size: clamp(21px, 4vw, 29px);
    line-height: 1.16;
  }

  .stock-location-dialog header > span {
    display: block;
    margin-top: 8px;
    color: #d8e1ec;
    font-size: 12px;
  }

  .stock-location-dialog .stock-condition-note {
    display: block;
    margin-top: 8px;
    color: #fde68a;
    font-size: 11px;
    font-weight: 750;
  }

  .stock-location-close {
    position: absolute;
    z-index: 2;
    top: 16px;
    right: 16px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    font-size: 24px;
    cursor: pointer;
  }

  .stock-location-dialog form {
    padding: 22px 24px 24px;
  }

  .stock-total-field,
  .stock-adjustment-reason,
  .stock-picker-field {
    display: block;
    margin-bottom: 14px;
    padding: 14px 15px;
    border: 1px solid #dce3ec;
    border-radius: 14px;
    background: #ffffff;
  }

  .stock-total-field > span,
  .stock-adjustment-reason > span,
  .stock-picker-field > span {
    display: block;
    margin-bottom: 4px;
    color: #29364a;
    font-size: 12px;
    font-weight: 900;
  }

  .stock-total-field > small {
    display: block;
    margin-bottom: 9px;
    color: #758095;
    font-size: 10px;
  }

  .stock-total-field input,
  .stock-picker-field input,
  .stock-adjustment-reason textarea {
    width: 100%;
    min-height: 45px;
    padding: 9px 11px;
    color: #20283a;
    border: 1px solid #bbc8d7;
    border-radius: 10px;
    background: #ffffff;
    font: 750 13px/1.3 Inter, ui-sans-serif, system-ui, sans-serif;
  }

  .stock-total-field input {
    font-size: 18px;
    font-weight: 900;
  }

  .stock-adjustment-reason {
    margin-top: 13px;
    margin-bottom: 0;
    border-color: #f0d8aa;
    background: #fffaf0;
  }

  .stock-adjustment-reason textarea {
    min-height: 66px;
    resize: vertical;
  }

  .stock-location-inputs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .stock-location-inputs label {
    padding: 15px;
    border: 1px solid #d6e5f3;
    border-radius: 14px;
    background: #f0f7fe;
  }

  .stock-location-inputs label.orange {
    border-color: #eed8c1;
    background: #fff7ee;
  }

  .stock-location-inputs label > span {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #264d75;
    font-size: 15px;
    font-weight: 900;
  }

  .stock-location-inputs label.orange > span { color: #8c5018; }

  .stock-location-inputs label > small {
    display: block;
    margin: 4px 0 12px 16px;
    color: #748095;
    font-size: 10px;
  }

  .stock-location-inputs input {
    width: 100%;
    min-height: 47px;
    padding: 8px 11px;
    color: #20283a;
    border: 1px solid #bbc8d7;
    border-radius: 10px;
    background: #ffffff;
    font: 850 18px/1.2 Inter, ui-sans-serif, system-ui, sans-serif;
  }

  .stock-location-balance,
  .stock-location-help,
  .stock-location-message {
    margin: 13px 0 0;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.4;
  }

  .stock-location-balance {
    color: #256348;
    border: 1px solid #cfe8dc;
    background: #eef9f4;
    font-weight: 800;
  }

  .stock-location-balance.error,
  .stock-location-message {
    color: #9b2727;
    border: 1px solid #efcaca;
    background: #fff0f0;
  }

  .stock-location-help {
    padding: 0 2px;
    color: #717d91;
  }

  .stock-location-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 18px;
  }

  .stock-location-toast {
    position: fixed;
    z-index: 15000;
    right: 22px;
    bottom: 22px;
    max-width: min(420px, calc(100vw - 44px));
    padding: 13px 16px;
    color: #ffffff;
    border-radius: 11px;
    background: #0f8a5f;
    box-shadow: 0 15px 42px rgba(15, 138, 95, 0.3);
    font: 750 12px/1.4 Inter, ui-sans-serif, system-ui, sans-serif;
  }

  .stock-location-toast.error { background: #b33a3a; }
}

@media screen and (max-width: 760px) {
  .stock-location-summary { grid-template-columns: 1fr; }
  .stock-location-filter { width: 100%; grid-template-columns: 1fr; }
  .stock-manual-adjust-button { width: 100%; }
  .stock-location-filter select { grid-column: 1; grid-row: auto; width: 100%; }
  .stock-location-inputs { grid-template-columns: 1fr; }
  .stock-location-backdrop { padding: 10px; }
  .stock-location-dialog form { padding: 18px; }
  .stock-location-actions { display: grid; grid-template-columns: 1fr; }
  .stock-location-actions button { width: 100%; }
}

@media print {
  .stock-location-backdrop,
  .stock-location-toast,
  .stock-location-filter,
  .stock-manual-adjust-button,
  .stock-location-summary,
  .stock-sale-warehouse-field,
  .stock-location-edit,
  .stock-location-readonly {
    display: none !important;
  }
}
