/* Área de agentes — se carga después de /styles.css */

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
  background:
    radial-gradient(900px 480px at 50% -10%, var(--navy-600) 0%, transparent 60%),
    linear-gradient(160deg, var(--navy-800) 0%, var(--navy-900) 100%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 18px;
  padding: 38px 34px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .35);
  border-top: 3px solid var(--gold-400);
}
.auth-card__logo { width: 190px; margin: 0 auto 22px; }
.auth-card h1 { font-size: 1.5rem; text-align: center; margin-bottom: 6px; }
.auth-card__sub { text-align: center; font-size: .92rem; margin-bottom: 26px; }

.auth-card label {
  display: block;
  margin-bottom: 16px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--navy-800);
}
.auth-card input {
  width: 100%;
  margin-top: 8px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.auth-card input:focus {
  outline: none;
  border-color: var(--gold-400);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, .18);
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 20px;
  font-size: .85rem;
}
.auth-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 500;
  color: var(--muted);
}
.auth-row input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--gold-500); }
.auth-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: .85rem;
  color: var(--navy-700);
  cursor: pointer;
  text-decoration: underline;
}
.auth-link:hover { color: var(--gold-500); }

.auth-status {
  margin: 16px 0 0;
  font-size: .88rem;
  text-align: center;
  min-height: 20px;
}
.auth-status.is-error { color: #c0392b; }
.auth-status.is-ok { color: #1a7f4b; }

.auth-back { display: block; text-align: center; margin-top: 22px; font-size: .85rem; }

.lang--light {
  width: max-content;
  margin: 20px auto 0;
  border-color: var(--line);
}
.lang--light .lang__btn { color: var(--muted); }
.lang--light .lang__btn.is-active { color: var(--navy-900); }

.btn[disabled] { opacity: .6; cursor: not-allowed; transform: none; }

/* ---------- Workspace ---------- */
.ws-body { background: var(--bg-alt); }

.ws { min-height: 100vh; display: flex; flex-direction: column; }
.ws[hidden] { display: none; }

.ws-top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  padding: 0 20px;
  background: var(--navy-800);
  border-bottom: 2px solid var(--gold-500);
}
.ws-top__left { display: flex; align-items: center; gap: 12px; }
.ws-top__logo { height: 36px; width: auto; }
.ws-top__right { display: flex; align-items: center; gap: 10px; }
.ws-top .lang { border-color: rgba(255, 255, 255, .2); }

.ws-icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 10px;
  color: rgba(255, 255, 255, .8);
  cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.ws-icon-btn:hover { background: rgba(255, 255, 255, .1); color: var(--gold-400); border-color: rgba(212, 175, 55, .5); }
.ws-burger { display: none; }

.ws-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--gold-400);
  color: var(--navy-900);
  font-size: .66rem;
  font-weight: 700;
}

.ws-avatar-btn {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
}
.ws-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  color: var(--navy-900);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.ws-avatar--lg { width: 46px; height: 46px; font-size: .95rem; }
.ws-avatar-btn:hover .ws-avatar { box-shadow: 0 0 0 3px rgba(212, 175, 55, .3); }

.ws-menu { position: relative; }
.ws-pop {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 250px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 22px 50px rgba(11, 31, 58, .22);
  padding: 8px;
  z-index: 40;
}
.ws-pop--wide { width: 280px; }
.ws-pop[hidden] { display: none; }
.ws-pop__head {
  padding: 10px 12px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.ws-pop__empty { margin: 0; padding: 4px 12px 14px; font-size: .88rem; }

.ws-pop__user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 14px;
  border-bottom: 1px solid var(--line);
}
.ws-pop__user strong { display: block; color: var(--navy-800); font-size: .92rem; }
.ws-pop__user span { color: var(--muted); font-size: .78rem; word-break: break-all; }

.ws-pop__meta { margin: 0; padding: 12px; border-bottom: 1px solid var(--line); }
.ws-pop__meta div { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.ws-pop__meta div:last-child { margin-bottom: 0; }
.ws-pop__meta dt { color: var(--muted); font-size: .78rem; }
.ws-pop__meta dd { margin: 0; color: var(--navy-800); font-size: .78rem; font-weight: 600; text-align: right; }

.ws-pop__action {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  background: none;
  border: 0;
  border-radius: 9px;
  font: inherit;
  font-size: .88rem;
  font-weight: 500;
  color: var(--navy-800);
  text-align: left;
  cursor: pointer;
  transition: background .15s ease;
}
.ws-pop__action:hover:not(:disabled) { background: var(--bg-alt); }
.ws-pop__action:disabled { color: var(--muted); opacity: .6; cursor: not-allowed; }
.ws-pop__action--danger { color: #c0392b; }
.ws-pop__action--danger:hover { background: rgba(192, 57, 43, .08); }

.ws-body-grid { flex: 1; display: grid; grid-template-columns: 250px 1fr; align-items: stretch; }

.ws-side {
  background: var(--navy-900);
  padding: 22px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
}
.ws-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.ws-nav__label {
  margin: 14px 12px 6px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .34);
}
.ws-nav__label:first-child { margin-top: 0; }
.ws-nav__item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 12px;
  background: none;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-size: .9rem;
  font-weight: 500;
  color: rgba(255, 255, 255, .72);
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.ws-nav__item svg { flex: none; opacity: .8; }
.ws-nav__item:hover:not(:disabled) { background: rgba(255, 255, 255, .07); color: #fff; }
.ws-nav__item.is-active {
  background: rgba(212, 175, 55, .14);
  color: var(--gold-400);
}
.ws-nav__item.is-active svg { opacity: 1; }
.ws-nav__item:disabled { color: rgba(255, 255, 255, .32); cursor: not-allowed; }

.ws-side__foot {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .3);
  font-size: .72rem;
  text-align: center;
}

.ws-backdrop { display: none; }

.ws-main { padding: 34px 32px 60px; min-width: 0; }

.ws-view[hidden] { display: none; }

.ws-head--row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.btn--ghost-dark {
  border-color: var(--line);
  color: var(--navy-800);
  background: #fff;
}
.btn--ghost-dark:hover:not(:disabled) {
  border-color: var(--gold-400);
  color: var(--gold-500);
}

.ws-head__actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mkt { display: flex; align-items: center; gap: 8px; }
.mkt__label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .45);
}
.mkt__select {
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 10px;
  background: rgba(255, 255, 255, .06);
  font: inherit;
  font-size: .84rem;
  color: #fff;
  cursor: pointer;
}
.mkt__select option { color: var(--navy-800); background: #fff; }
.mkt__select:hover { border-color: rgba(212, 175, 55, .5); }
.mkt__select:focus {
  outline: none;
  border-color: var(--gold-400);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, .22);
}

.fba-state { margin: 0; font-size: .92rem; }
.fba-state[hidden] { display: none; }

.fba-sandbox {
  margin: 0 0 18px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(201, 162, 39, .12);
  border: 1px solid rgba(201, 162, 39, .35);
  color: #8a6d12;
  font-size: .84rem;
  font-weight: 500;
}
.fba-sandbox[hidden] { display: none; }

.fba-table-wrap { overflow-x: auto; }
.fba-table-wrap[hidden] { display: none; }
.fba-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.fba-table th {
  text-align: left;
  padding: 0 14px 10px;
  border-bottom: 1px solid var(--line);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.fba-table td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  vertical-align: middle;
}
.fba-table tr:last-child td { border-bottom: 0; }
.fba-table tbody tr:hover td { background: var(--bg-alt); }
.fba-table__name { color: var(--navy-800) !important; font-weight: 600; }
.fba-table__id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; }
.fba-table__toggle-col { width: 44px; }

.inv-num { text-align: right; font-variant-numeric: tabular-nums; }
.inv-num--ok { color: #1a7f4b !important; font-weight: 600; }
.inv-num--total { color: var(--navy-800) !important; font-weight: 700; }

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

.fba-toggle {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: none;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  transition: transform .18s ease, color .18s ease, border-color .18s ease;
}
.fba-toggle:hover { color: var(--gold-500); border-color: var(--gold-400); }
.fba-toggle.is-open { transform: rotate(90deg); color: var(--gold-500); border-color: var(--gold-400); }

.fba-detail[hidden] { display: none; }
.fba-detail td {
  background: var(--bg-alt);
  padding: 16px 14px 18px 58px;
  font-size: .85rem;
}

.fba-items { width: 100%; border-collapse: collapse; }
.fba-items th {
  text-align: left;
  padding: 0 12px 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.fba-items td {
  padding: 9px 12px 9px 0;
  border-bottom: 1px solid rgba(226, 231, 239, .7);
  background: transparent;
  font-size: .84rem;
}
.fba-items tr:last-child td { border-bottom: 0; }

.fba-updated {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: .76rem;
  color: var(--muted);
}
.fba-updated[hidden] { display: none; }

.fba-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.fba-tag--draft { background: rgba(90, 107, 130, .14); color: var(--muted); }
.fba-tag--transit { background: rgba(201, 162, 39, .18); color: #8a6d12; }
.fba-tag--receiving { background: rgba(27, 59, 102, .14); color: var(--navy-700); }
.fba-tag--done { background: rgba(26, 127, 75, .14); color: #1a7f4b; }
.fba-tag--warn { background: rgba(192, 57, 43, .12); color: #c0392b; }

.brand-search { display: flex; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.brand-search input {
  flex: 1;
  min-width: 200px;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
  font-size: .92rem;
  color: var(--ink);
}
.brand-search input:focus {
  outline: none;
  border-color: var(--gold-400);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, .18);
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.kpi {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-alt);
}
.kpi strong {
  display: block;
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: var(--navy-800);
  line-height: 1.1;
}
.kpi span {
  display: block;
  margin-top: 4px;
  font-size: .74rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.kpi--ok strong { color: #1a7f4b; }
.kpi--warn strong { color: #c0392b; }

.period-bar {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.period-bar label { display: grid; gap: 5px; }
.period-bar label span { color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.period-bar select, .mkt__select--light { padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); font: inherit; font-size: .86rem; }
.ws-panel__title-row { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 18px; }
.ws-panel__title-row h2, .ws-panel__title-row p { margin-bottom: 4px; }
.acc-table .text-action { margin-right: 8px; }
.text-action { border: 0; padding: 0; background: none; color: var(--navy-700); cursor: pointer; font: inherit; font-size: .78rem; }
.text-action:hover { color: var(--gold-500); }
.text-action--danger { color: #c0392b; }
.category-bars { display: grid; gap: 14px; }
.category-bar__label { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: .84rem; }
.category-bar__label strong { color: var(--navy-800); }
.category-bar__track { height: 8px; margin-top: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.category-bar__track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--navy-600), var(--gold-400)); }
.acc-report-panel { margin-top: 20px; }
.acc-kpis { margin-bottom: 20px; }
.acc-table .text-action { white-space: nowrap; }
.ws-head { margin-bottom: 26px; }
.ws-head h1 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin-bottom: 4px; }
.ws-head p { margin: 0; }

.ws-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 26px;
}
.ws-panel h2 { font-size: 1.2rem; margin-bottom: 4px; }
.ws-panel > p { margin-bottom: 22px; font-size: .92rem; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}
.tile {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.tile--link { cursor: pointer; }
.tile--link:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: rgba(201, 162, 39, .5);
}
.tile--soon { opacity: .64; }
.tile h3 { margin: 0; font-size: 1rem; }
.tile p { margin: 0; font-size: .9rem; }
.tile__icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(201, 162, 39, .12);
  color: var(--gold-500);
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  margin-bottom: 6px;
}
.tile__badge {
  align-self: flex-start;
  margin-top: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .ws-burger { display: grid; }
  .ws-body-grid { grid-template-columns: 1fr; }
  .ws-side {
    position: fixed;
    top: 64px;
    left: 0;
    width: 260px;
    z-index: 35;
    transform: translateX(-100%);
    transition: transform .22s ease;
  }
  .ws-side.is-open { transform: translateX(0); }
  .ws-backdrop {
    display: block;
    position: fixed;
    inset: 64px 0 0 0;
    background: rgba(7, 21, 40, .5);
    z-index: 34;
  }
  .ws-backdrop[hidden] { display: none; }
  .ws-main { padding: 26px 20px 48px; }
  .ws-top .lang { display: none; }
  .ws-top .mkt__label { display: none; }
}

.ws-loading {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--navy-900);
  color: rgba(255, 255, 255, .7);
  font-size: .9rem;
}
.ws-loading[hidden] { display: none; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(7, 21, 40, .55); }
.modal__box {
  position: relative;
  width: min(460px, calc(100vw - 32px));
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .35);
  border-top: 3px solid var(--gold-400);
  overflow: hidden;
}
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.modal__head h2 { margin: 0; font-size: 1.05rem; }
.modal__close {
  background: none;
  border: 0;
  padding: 4px;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
}
.modal__close:hover { color: var(--navy-800); background: var(--bg-alt); }

.modal__body { padding: 18px 20px; }
.modal__product {
  margin: 0 0 16px;
  padding: 10px 12px;
  background: var(--bg-alt);
  border-radius: 8px;
  font-size: .88rem;
  color: var(--navy-800);
  font-weight: 500;
}

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  margin-bottom: 6px;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input,
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
  font-size: .92rem;
  color: var(--ink);
  background: #fff;
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--gold-400);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, .18);
}
.field input[readonly] { background: var(--bg-alt); color: var(--muted); }
.field__hint { display: block; margin-top: 5px; font-size: .74rem; color: var(--muted); }

.modal__status { margin: 4px 0 0; min-height: 18px; font-size: .82rem; color: var(--muted); }
.modal__status.is-error { color: #c0392b; }
.modal__status.is-warn { color: #8a6d12; }

.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
}

/* ---------- Etiquetas FNSKU (58 mm) ---------- */
#labelSheet { display: none; }

.label {
  width: 54mm;
  padding: 1.5mm 0 3mm;
  text-align: center;
  page-break-after: always;
  break-after: page;
  font-family: Helvetica, Arial, sans-serif;
  color: #000;
}
.label:last-child { page-break-after: auto; break-after: auto; }
.label__barcode { display: block; margin: 0 auto; max-width: 100%; }
.label__name {
  margin-top: 1mm;
  font-size: 7.5pt;
  line-height: 1.2;
  word-break: break-word;
}
.label__cond { margin-top: 0.8mm; font-size: 8pt; font-weight: 700; }

@media print {
  @page { size: 58mm auto; margin: 0; }

  body.is-printing > *:not(#labelSheet) { display: none !important; }
  body.is-printing #labelSheet { display: block; }
  body.is-printing { background: #fff; }
}

@media (max-width: 640px) {
  .auth-card { padding: 28px 22px; }
  .ws-top { padding: 0 14px; }
  .ws-top__right { gap: 8px; }
}
