:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --line: #d9dee7;
  --text: #212529;
  --muted: #667085;
  --primary: #0066cc;
  --good: #067647;
  --warn: #9a3412;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}
a { color: inherit; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 238px;
  background: #f8f9fa;
  color: #333;
  border-right: 1px solid #dee2e6;
  padding: 18px 14px;
}
.brand { font-size: 18px; font-weight: 800; margin: 4px 8px 24px; color: #2d3436; }
.sidebar nav { display: grid; gap: 4px; }
.sidebar a {
  display: block;
  padding: 10px 12px;
  border-radius: 5px;
  text-decoration: none;
  color: #333;
  font-weight: 650;
}
.sidebar a:hover { background: #e9ecef; color: #0d6efd; }
.sidebar a.active { background: #0d6efd; color: #fff; }
.logout { position: absolute; left: 14px; right: 14px; bottom: 16px; }
.main { margin-left: 238px; padding: 24px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.sync-actions {
  display: flex;
  gap: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}
h1 { margin: 0; font-size: 24px; }
h2 { margin: 0 0 14px; font-size: 17px; }
p { margin: 4px 0 0; color: var(--muted); }
.segmented {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
.segmented a {
  padding: 9px 13px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 700;
  border-left: 1px solid var(--line);
}
.segmented a:first-child { border-left: 0; }
.segmented a.active { background: #0d6efd; color: #fff; }
.toolbar, .panel, .order-card, .stats > div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
button {
  height: 38px;
  border: 1px solid #0d6efd;
  background: #0d6efd;
  color: #fff;
  border-radius: 7px;
  padding: 0 14px;
  font-weight: 750;
  cursor: pointer;
}
button .button-key,
.segmented .button-key {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  margin-right: 6px;
  place-items: center;
  border: 1px solid rgba(52, 64, 84, .22);
  border-bottom-color: rgba(52, 64, 84, .35);
  border-radius: 4px;
  background: rgba(255, 255, 255, .86);
  color: #344054;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  vertical-align: middle;
}
button:not(.secondary) .button-key {
  border-color: rgba(255, 255, 255, .45);
  background: rgba(255, 255, 255, .92);
}
.segmented .button-key {
  margin-right: 5px;
  background: rgba(255, 255, 255, .78);
}
.segmented a.active .button-key {
  border-color: rgba(255, 255, 255, .5);
  background: rgba(255, 255, 255, .94);
}
button.secondary { background: #fff; color: var(--text); border-color: var(--line); }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.stats div { padding: 14px 16px; }
.stats span { display: block; color: var(--muted); font-size: 13px; }
.stats strong { display: block; font-size: 24px; margin-top: 4px; }
.orders { display: grid; gap: 9px; }
.order-card {
  overflow: visible;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  border-left-width: 4px;
}
.order-identification { border-radius: 3px 3px 0 0; }
.order-card:not(.expanded) .products-header { border-radius: 0 0 3px 3px; }
.order-card.platform-mercadolibre { border-left-color: #fff159; }
.order-card.platform-mercadolibre .order-identification { background: #fffdf0; }
.order-card.platform-blucen { border-left-color: #0d6efd; }
.order-card.platform-blucen .order-identification { background: #f5f9ff; }
.order-card.selected {
  outline: 2px solid #0d6efd;
  outline-offset: -2px;
  background: rgba(13, 110, 253, 0.025);
}
.order-identification,
.order-status,
.products-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 7px 10px;
}
.order-identification {
  background: #fcfcfc;
  border-bottom: 1px solid #f0f0f0;
}
.order-status {
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
}
.order-left,
.order-right,
.status-left,
.status-actions,
.products-summary,
.products-info {
  display: flex;
  align-items: center;
}
.order-left { min-width: 0; gap: 8px; }
.order-shortcut {
  width: 22px;
  height: 22px;
  border: 1px solid #d0d5dd;
  border-radius: 4px;
  display: inline-grid;
  place-items: center;
  color: #475467;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
  flex: 0 0 auto;
}
.order-right { justify-content: flex-end; min-width: 200px; }
.status-left { gap: 7px; flex-wrap: wrap; min-width: 0; }
.status-actions { gap: 4px; white-space: nowrap; }
.shipping-box {
  border-top: 1px solid #edf0f3;
  background: #fbfcfd;
  padding: 8px 10px;
}
.shipping-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.shipping-head > div:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.shipping-head strong {
  font-size: 12px;
  color: #1f2937;
}
.shipping-head span,
.shipping-option span {
  font-size: 11px;
  color: var(--muted);
}
.shipping-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.shipping-actions select {
  width: 126px;
  height: 32px;
  font-size: 12px;
}
.shipping-actions button,
.shipping-option button {
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
}
.shipping-options {
  display: grid;
  gap: 5px;
  margin-top: 7px;
}
.shipping-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px auto;
  align-items: center;
  gap: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  background: #fff;
  padding: 6px;
}
.shipping-option.recommended {
  border-color: #98a2b3;
  background: #f8fafc;
}
.shipping-option > div {
  display: grid;
  gap: 1px;
  min-width: 0;
}
.shipping-option > strong {
  text-align: right;
  font-size: 12px;
}
.print-state {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.print-chip {
  min-width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid #bbf7d0;
  background: #ecfdf3;
  color: #067647;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  user-select: none;
  position: relative;
}
.print-chip.done {
  border-color: #bbf7d0;
  background: #ecfdf3;
  color: #067647;
}
.print-chip.pending {
  border-color: #e5e7eb;
  background: #f8fafc;
  color: #9ca3af;
}
.print-chip b {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #067647;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 9px;
  line-height: 1;
  border: 1px solid #fff;
}
.order-title { display: grid; gap: 1px; min-width: 0; }
.order-number {
  font-weight: 700;
  font-size: 13px;
  color: #333;
  line-height: 1.2;
}
.order-date {
  font-size: 11px;
  color: #777;
  line-height: 1.15;
}
.customer-name {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-check {
  width: 16px;
  height: 16px;
  accent-color: #0d6efd;
}
.badge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  border-radius: 4px;
  padding: 2px 7px;
  background: #eef2f7;
  color: #344054;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  line-height: 1.2;
}
.badge.money { background: #d1e7ff; color: #004a99; font-weight: 800; }
.badge.status { background: #ffe9c3; color: #975d00; }
.badge.count { background: rgba(240,240,240,.75); color: #555; }
.badge.weight { background: #e9ecef; color: #495057; font-weight: 800; }
.icon-btn {
  width: 28px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: #4b5563;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 14px;
}
.products-header {
  cursor: pointer;
  background: #fff;
}
.products-summary {
  width: 100%;
  justify-content: space-between;
  min-width: 0;
}
.toggle {
  border: 0;
  background: transparent;
  color: #6c757d;
  width: 18px;
  height: 18px;
  padding: 0;
  margin-right: 4px;
  display: inline-grid;
  place-items: center;
  transition: transform .15s ease;
}
.order-card.expanded .toggle { transform: rotate(90deg); }
.products-main {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 5px;
}
.products-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: visible;
  padding-top: 4px;
  padding-right: 4px;
}
.product-token {
  width: 36px;
  height: 36px;
  border: 1px solid #eee;
  border-radius: 4px;
  background: #fafafa;
  display: grid;
  place-items: center;
  position: relative;
  color: #555;
  font-size: 10px;
  font-weight: 800;
  overflow: visible;
}
.product-token img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 1px;
  background: #fff;
  border-radius: 3px;
}
.product-token b {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 17px;
  height: 17px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #0d6efd;
  color: #fff;
  font-size: 10px;
  line-height: 13px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .18);
}
.products-info {
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: 8px;
}
.products-expanded {
  display: none;
  background: #fdfdfd;
  border-top: 1px solid #f0f0f0;
  padding: 6px 8px;
}
.order-card.expanded .products-expanded { display: block; }
.product-item {
  display: grid;
  grid-template-columns: 40px 42px minmax(0, 1fr) 140px 86px;
  gap: 8px;
  align-items: center;
  padding: 6px;
  margin-bottom: 4px;
  border: 1px solid #f0f0f0;
  border-radius: 5px;
  background: #fff;
}
.product-row-image {
  width: 38px;
  height: 38px;
  border: 1px solid #eee;
  border-radius: 4px;
  background: #fafafa;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 10px;
  font-weight: 800;
  color: #555;
}
.product-row-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 1px;
  background: #fff;
}
.product-item:last-child { margin-bottom: 0; }
.qty {
  width: 32px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 4px;
  background: #f2f4f7;
  font-weight: 800;
}
.sku { font-family: Consolas, monospace; font-size: 13px; white-space: nowrap; }
.variant { color: #475467; font-size: 13px; margin-top: 3px; }
.panel { padding: 18px; max-width: 780px; margin-bottom: 14px; }
.panel.shipping-panel { max-width: 1180px; }
.settings-form { display: grid; gap: 12px; }
.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.settings-grid.shipping-settings {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.settings-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.shortcut-list {
  display: grid;
  gap: 8px;
}
.shortcut-list > div {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid #eef0f3;
}
.shortcut-list > div:last-child { border-bottom: 0; }
.shortcut-keys {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
kbd {
  display: inline-grid;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  place-items: center;
  border: 1px solid #d0d5dd;
  border-bottom-color: #98a2b3;
  border-radius: 4px;
  background: #fff;
  color: #344054;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
}
.shortcut-list span { color: #475467; font-size: 14px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
input {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  font: inherit;
  color: var(--text);
}
select {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  font: inherit;
  color: var(--text);
  background: #fff;
}
.filters {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 210px 150px 140px;
  gap: 10px;
  margin-bottom: 14px;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 14px 0 4px;
  color: var(--muted);
  font-size: 14px;
}
.pagination[hidden] { display: none; }
.pagination button:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.badge.workflow {
  background: #eef2f7;
  color: #344054;
  text-transform: capitalize;
}
.badge.payment {
  background: #f7f7f8;
  color: #344054;
  border-color: #d0d5dd;
}
.status-select {
  width: 132px;
  height: 30px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 750;
  text-transform: capitalize;
}
.picking-list,
.catalog-results {
  display: grid;
  gap: 8px;
}
.pick-row,
.catalog-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 80px 110px;
  gap: 10px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
}
.print-only { display: none; }
.catalog-row {
  grid-template-columns: minmax(190px, 1fr) minmax(200px, 1fr) 90px 92px;
}
.catalog-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}
.label-builder { max-width: 980px; }
.label-controls {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 150px 150px;
  gap: 12px;
  align-items: end;
}
.product-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  margin: 12px 0 16px;
}
.product-results button {
  height: auto;
  min-height: 48px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  display: grid;
  gap: 2px;
  text-align: left;
  justify-items: start;
  padding: 8px 10px;
}
.product-results small { color: var(--muted); }
.manual-list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.manual-items { display: grid; gap: 8px; margin-top: 10px; }
.manual-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 86px;
  gap: 8px;
  align-items: center;
  border: 1px solid #eef1f4;
  border-radius: 6px;
  padding: 8px;
  background: #fff;
}
.manual-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}
.empty-manual {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 14px;
}
code { background: #f2f4f7; padding: 2px 5px; border-radius: 5px; }
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 18px; }
.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}
.login-card form { display: grid; gap: 12px; }
.alert { background: #fff1f3; color: #b42318; border: 1px solid #fecdca; border-radius: 7px; padding: 10px; margin-bottom: 12px; }
@media (max-width: 820px) {
  .sidebar { position: sticky; top: 0; width: auto; z-index: 10; }
  .sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .logout { position: static; margin-top: 20px; }
  .main { margin-left: 0; padding: 14px; }
  .topbar, .toolbar, .order-head, .top-actions { flex-direction: column; align-items: flex-start; }
  .sync-actions { border-left: 0; padding-left: 0; }
  .label-controls, .settings-grid { grid-template-columns: 1fr; }
  .shortcut-list > div { grid-template-columns: 1fr; gap: 6px; }
  .filters, .pick-row, .catalog-row { grid-template-columns: 1fr; }
  .manual-item { grid-template-columns: 1fr; }
  .order-identification, .order-status, .products-summary { align-items: flex-start; flex-direction: column; }
  .order-right { min-width: 0; justify-content: flex-start; }
  .product-item { grid-template-columns: 36px 40px minmax(180px, 1fr) 120px 78px; }
  .toolbar-actions { justify-content: flex-start; }
  .stats { grid-template-columns: 1fr; }
  .badges { justify-items: start; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  .print-state { justify-content: flex-start; }
  .print-chip { min-width: 34px; height: 30px; }
  .product-token { width: 32px; height: 32px; }
}
@media print {
  body { background: #fff; color: #111; font-family: Arial, sans-serif; }
  .sidebar,
  .topbar,
  .toolbar,
  .stats,
  .filters,
  .orders,
  .panel,
  .picking-list,
  .catalog-results,
  .no-print {
    display: none !important;
  }
  .main { margin: 0; padding: 0; }
  .print-only { display: block !important; }
  .prep-print {
    padding: 6mm;
  }
  .prep-print h1 {
    font-size: 16px;
    margin: 0 0 2mm;
  }
  .prep-print .meta {
    font-size: 10px;
    margin-bottom: 2mm;
    color: #333;
  }
  .prep-print table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9px;
  }
  .prep-print th,
  .prep-print td {
    border-bottom: 1px solid #bbb;
    padding: 1mm 1.2mm;
    text-align: left;
    vertical-align: top;
  }
  .prep-print th {
    font-size: 9px;
    text-transform: uppercase;
  }
  .prep-print .qty-print {
    width: 12mm;
    font-size: 16px;
    font-weight: 900;
    text-align: center;
  }
  .prep-print .product-print strong {
    display: block;
    font-size: 11px;
    line-height: 1.1;
    white-space: nowrap;
  }
  .prep-print .sku-print {
    width: 23mm;
    font-family: Consolas, monospace;
    font-size: 8px;
  }
  .prep-print .orders-print {
    width: 15mm;
    text-align: center;
  }
}
