/* Hallmark · v2.0.0 · custom (atelier-editorial-medica) · scope: app · signature: live Color x Talla studio matrix with real cropped lookbook portraits */
/* Critique: Avoid generic SaaS dashboards, cards-inside-cards, tracked uppercase eyebrows, and transition:all; prioritize boutique editorial restraint and 1-tap inventory speed */

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

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: clip;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.48;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

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

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

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

/* ==========================================================================
   App Shell & Header
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--container-max);
  margin-inline: auto;
  padding: 10px 16px;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
}

.brand-sub {
  font-size: 12px;
  color: var(--ink-secondary);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Desktop top navigation */
.desktop-nav {
  display: none;
  align-items: center;
  gap: 4px;
  position: relative;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px;
  box-shadow: var(--shadow-xs);
}

.desktop-nav-pill {
  position: absolute;
  top: 4px;
  left: 0;
  height: calc(100% - 8px);
  border-radius: var(--radius-pill);
  background-color: var(--ink);
  pointer-events: none;
  transition: transform var(--dur-ui) var(--ease-out);
  z-index: 0;
}

.desktop-nav-btn {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-secondary);
  white-space: nowrap;
  transition: color var(--dur-fast) ease, transform var(--dur-press) var(--ease-out);
}

.desktop-nav-btn[aria-current="page"] {
  color: var(--ink-on-dark);
}

.desktop-nav-btn:active {
  transform: scale(0.97);
}

.nav-count {
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background-color: var(--warn-bg);
  color: var(--warn);
}

.desktop-nav-btn[aria-current="page"] .nav-count {
  background-color: var(--gold);
  color: var(--ink-on-dark);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 15px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
  transition:
    transform var(--dur-press) var(--ease-out),
    background-color var(--dur-fast) ease,
    border-color var(--dur-fast) ease,
    color var(--dur-fast) ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-primary {
  background-color: var(--ink);
  color: var(--ink-on-dark);
  border: 1px solid var(--ink);
}

.btn-secondary {
  background-color: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
}

.btn-gold {
  background-color: var(--gold-soft);
  color: var(--ink);
  border: 1px solid var(--gold-border);
}

.btn-ghost {
  background-color: transparent;
  color: var(--ink-secondary);
  border: 1px solid transparent;
  padding: 0 10px;
}

.btn-danger-soft {
  background-color: var(--out-bg);
  color: var(--out);
  border: 1px solid var(--out-border);
}

.btn-sm {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
  min-height: 46px;
  font-size: 14.5px;
}

.btn-icon-only {
  width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: var(--radius-pill);
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover {
    background-color: var(--ink-secondary);
    border-color: var(--ink-secondary);
  }
  .btn-secondary:hover {
    background-color: var(--surface-tint);
    border-color: var(--ink-tertiary);
  }
  .btn-gold:hover {
    border-color: var(--gold);
  }
  .btn-ghost:hover {
    background-color: var(--bg-subtle);
    color: var(--ink);
  }
  .btn-danger-soft:hover {
    border-color: var(--out);
  }
}

/* ==========================================================================
   Main Container & View Layout
   ========================================================================== */

.app-main {
  max-width: var(--container-max);
  margin-inline: auto;
  padding: 16px 16px calc(var(--bottom-nav-h) + 28px + env(safe-area-inset-bottom, 0px));
}

.view-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ==========================================================================
   KPI Summary Ribbon (3 quiet editorial figures)
   ========================================================================== */

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.kpi-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 13px 14px;
  min-width: 0;
  text-align: left;
  position: relative;
  transition: background-color var(--dur-fast) ease, transform var(--dur-press) var(--ease-out);
}

.kpi-item + .kpi-item {
  border-left: 1px solid var(--border);
}

.kpi-item:active {
  transform: scale(0.985);
}

.kpi-label {
  font-size: 12px;
  color: var(--ink-secondary);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.kpi-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  line-height: 1.05;
  color: var(--ink);
  font-variant-numeric: lining-nums tabular-nums;
}

.kpi-value--ok {
  color: var(--ok);
}

.kpi-value--warn {
  color: var(--warn);
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--ink-tertiary);
  line-height: 1.2;
}

@media (hover: hover) and (pointer: fine) {
  button.kpi-item:hover {
    background-color: var(--surface-tint);
  }
}

/* ==========================================================================
   Quick Availability Filter & WhatsApp Copy Bar
   ========================================================================== */

.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
}

.search-wrap svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--ink-tertiary);
  pointer-events: none;
}

.search-input {
  width: 100%;
  min-height: 42px;
  padding: 0 36px 0 38px;
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  font-size: 14px;
  color: var(--ink);
  transition: border-color var(--dur-fast) ease;
}

.search-input::placeholder {
  color: var(--ink-tertiary);
}

.search-input:focus {
  border-color: var(--gold);
  outline: none;
}

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-secondary);
}

.size-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 1px;
}

.size-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  min-height: 36px;
  padding: 0 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background-color: var(--surface);
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  transition:
    transform var(--dur-press) var(--ease-out),
    background-color var(--dur-fast) ease,
    border-color var(--dur-fast) ease,
    color var(--dur-fast) ease;
}

.chip:active {
  transform: scale(0.96);
}

.chip[aria-pressed="true"] {
  background-color: var(--ink);
  border-color: var(--ink);
  color: var(--ink-on-dark);
}

.chip-gold[aria-pressed="true"] {
  background-color: var(--gold);
  border-color: var(--gold);
  color: var(--ink-on-dark);
}

/* ==========================================================================
   Model Lookbook Selector Strip
   ========================================================================== */

.model-strip-wrap {
  position: relative;
}

.model-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(126px, 138px);
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  padding: 2px 2px 6px;
}

.model-strip::-webkit-scrollbar {
  display: none;
}

.model-card {
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  background-color: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition:
    transform var(--dur-press) var(--ease-out),
    border-color var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease;
  position: relative;
}

.model-card[data-active="true"] {
  border-color: var(--gold);
  box-shadow: var(--shadow-sm);
}

.model-card-hit {
  display: flex;
  flex-direction: column;
  width: 100%;
  text-align: left;
  flex: 1;
}

.model-card-hit:active {
  transform: scale(0.985);
}

.model-photo-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  background-color: var(--bg-subtle);
  overflow: hidden;
}

.model-photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: transform 280ms var(--ease-out);
}

.model-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink-secondary);
  background-color: var(--surface-tint);
  padding: 12px;
  text-align: center;
}

.model-photo-placeholder svg {
  width: 34px;
  height: 34px;
  color: var(--gold);
}

.model-card-body {
  padding: 9px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.model-card-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.1;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.model-card-stock {
  font-size: 12px;
  font-weight: 600;
  color: var(--ok);
  font-variant-numeric: tabular-nums;
}

.model-card-stock--zero {
  color: var(--out);
}

.price-pill-btn {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 2;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background-color: var(--pill-on-photo);
  border: 1px solid var(--border);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-xs);
  transition: transform var(--dur-press) var(--ease-out), border-color var(--dur-fast) ease;
}

.price-pill-btn:active {
  transform: scale(0.95);
}

@media (hover: hover) and (pointer: fine) {
  .model-card:hover .model-photo-frame img {
    transform: scale(1.03);
  }
  .model-card:hover {
    border-color: var(--border-strong);
  }
  .model-card[data-active="true"]:hover {
    border-color: var(--gold);
  }
  .price-pill-btn:hover {
    border-color: var(--gold);
  }
}

/* ==========================================================================
   Active Model Workspace (Editorial Header + Stock Matrix)
   ========================================================================== */

.workspace-sheet {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.model-stage-head {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.model-stage-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}

.stage-thumb {
  width: 66px;
  height: 88px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: var(--bg-subtle);
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.stage-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.stage-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stage-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.stage-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  line-height: 1.05;
  color: var(--ink);
  overflow-wrap: break-word;
  min-width: 0;
}

.stage-desc {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-secondary);
}

.stage-inline-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.editable-price-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background-color: var(--gold-soft);
  border: 1px solid var(--gold-border);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: transform var(--dur-press) var(--ease-out), border-color var(--dur-fast) ease;
}

.editable-price-btn svg {
  width: 13px;
  height: 13px;
  color: var(--gold-hover);
}

.editable-price-btn:active {
  transform: scale(0.96);
}

.combo-hint {
  font-size: 12.5px;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
}

.model-stage-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* Sliding segmented control (cuts & drawer modes) */
.segmented {
  position: relative;
  display: inline-flex;
  align-items: center;
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}

.segmented-thumb {
  position: absolute;
  top: 3px;
  left: 0;
  height: calc(100% - 6px);
  border-radius: var(--radius-pill);
  background-color: var(--surface);
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border);
  pointer-events: none;
  transition: transform var(--dur-ui) var(--ease-out);
  z-index: 0;
}

.segmented-btn {
  position: relative;
  z-index: 1;
  min-height: 32px;
  padding: 0 13px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  white-space: nowrap;
  transition: color var(--dur-fast) ease, transform var(--dur-press) var(--ease-out);
}

.segmented-btn[aria-pressed="true"],
.segmented-btn[aria-selected="true"] {
  color: var(--ink);
}

.segmented-btn:active {
  transform: scale(0.97);
}

.stage-action-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Color x Size Stock Matrix
   ========================================================================== */

.matrix-wrap {
  padding: 12px 14px 16px;
}

.matrix-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-size: 12.5px;
  color: var(--ink-secondary);
}

.legend-items {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-chip {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.legend-chip--ok {
  background-color: var(--ok-bg);
  border-color: var(--ok-border);
}

.legend-chip--warn {
  background-color: var(--warn-bg);
  border-color: var(--warn-border);
}

.legend-chip--out {
  background-color: var(--out-bg);
  border-color: var(--out-border);
}

.matrix-grid {
  display: flex;
  flex-direction: column;
}

.matrix-head-row,
.matrix-row {
  display: grid;
  grid-template-columns: minmax(106px, 1.45fr) repeat(4, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
}

.matrix-head-row {
  padding: 4px 2px 9px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.matrix-head-size {
  text-align: center;
}

.matrix-head-size[data-highlight="true"] {
  color: var(--gold-hover);
  font-weight: 700;
}

.matrix-row {
  padding: 7px 2px;
  border-bottom: 1px solid var(--bg-subtle);
}

.matrix-row:last-child {
  border-bottom: 0;
}

.color-cell {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding-right: 4px;
}

.color-swatch {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
  border: 1px solid var(--swatch-ring);
}

.color-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stock-cell {
  min-height: 48px;
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 4px 2px;
  font-variant-numeric: tabular-nums;
  transition:
    transform var(--dur-press) var(--ease-out),
    background-color var(--dur-fast) ease,
    border-color var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease;
}

.stock-cell:active {
  transform: scale(0.95);
}

.stock-cell--ok {
  background-color: var(--ok-bg);
  border-color: var(--ok-border);
  color: var(--ok);
}

.stock-cell--warn {
  background-color: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn);
}

.stock-cell--out {
  background-color: var(--out-bg);
  border-color: var(--out-border);
  color: var(--out);
  opacity: 0.78;
}

.stock-cell[data-dim="true"] {
  opacity: 0.36;
}

.stock-cell-num {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.05;
}

.stock-cell-res {
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--warn);
  white-space: nowrap;
}

.stock-cell[data-pulse="true"] {
  box-shadow: 0 0 0 2px var(--gold);
  animation: cellPulse 480ms var(--ease-out);
}

@keyframes cellPulse {
  0% {
    transform: scale(0.94);
  }
  45% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1);
  }
}

@media (hover: hover) and (pointer: fine) {
  .stock-cell:hover {
    border-color: var(--gold);
    opacity: 1;
  }
}

.matrix-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.cross-notes-strip {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background-color: var(--surface-tint);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  color: var(--ink-secondary);
}

.cross-notes-title {
  font-weight: 600;
  color: var(--ink);
}

/* ==========================================================================
   Extras (Piezas sueltas) View inside Inventario
   ========================================================================== */

.extras-list {
  display: flex;
  flex-direction: column;
}

.extra-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--bg-subtle);
  flex-wrap: wrap;
}

.extra-row:last-child {
  border-bottom: 0;
}

.extra-info {
  flex: 1 1 180px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.extra-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}

.extra-detail {
  font-size: 12.5px;
  color: var(--ink-secondary);
}

.extra-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stepper {
  display: inline-flex;
  align-items: center;
  background-color: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 2px;
}

.stepper-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-fast) ease;
}

.stepper-btn:active {
  transform: scale(0.92);
}

.stepper-val {
  min-width: 34px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Section Headers (Encargos, Reposición, Precios)
   ========================================================================== */

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.section-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 30px;
  line-height: 1.05;
  color: var(--ink);
  overflow-wrap: break-word;
}

.section-sub {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-secondary);
}

/* ==========================================================================
   Orders (Encargos y Pendientes)
   ========================================================================== */

.orders-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.order-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 15px 16px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.order-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.order-identity {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.order-customer {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: break-word;
}

.order-summary {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-secondary);
}

.order-note {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-tertiary);
}

.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.status-tag svg {
  width: 13px;
  height: 13px;
}

.status-tag--apartado {
  background-color: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn);
}

.status-tag--encargo {
  background-color: var(--gold-soft);
  border-color: var(--gold-border);
  color: var(--ink);
}

.status-tag--arreglo {
  background-color: var(--bg-subtle);
  border-color: var(--border-strong);
  color: var(--ink);
}

.status-tag--listo {
  background-color: var(--ok-bg);
  border-color: var(--ok-border);
  color: var(--ok);
}

.status-tag--entregado {
  background-color: var(--ok-bg);
  border-color: var(--ok-border);
  color: var(--ok);
}

.order-money-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px;
  background-color: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.money-col {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.money-col-label {
  font-size: 11.5px;
  color: var(--ink-secondary);
}

.money-col-val {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.money-col-val--debt {
  color: var(--out);
}

.money-col-val--paid {
  color: var(--ok);
}

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

.order-actions-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.status-select {
  min-height: 34px;
  padding: 0 28px 0 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background-color: var(--surface);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

/* ==========================================================================
   Replenishment (Reposición para Taller)
   ========================================================================== */

.repl-toolbar {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-xs);
}

.repl-summary-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.repl-count-big {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.repl-group {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.repl-group-head {
  padding: 12px 16px;
  background-color: var(--surface-tint);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.repl-group-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--ink);
}

.repl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--bg-subtle);
}

.repl-row:last-child {
  border-bottom: 0;
}

.repl-variant {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.repl-variant-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.repl-variant-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.repl-variant-state {
  font-size: 12px;
  font-weight: 600;
}

.repl-variant-state--out {
  color: var(--out);
}

.repl-variant-state--low {
  color: var(--warn);
}

/* ==========================================================================
   Prices & Movements View
   ========================================================================== */

.pricing-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.panel-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.panel-card-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-card-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.1;
}

.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--bg-subtle);
}

.price-row:last-child {
  border-bottom: 0;
}

.price-row-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.price-row-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.price-row-sub {
  font-size: 12px;
  color: var(--ink-secondary);
}

.price-input-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  height: 36px;
  flex-shrink: 0;
}

.price-input-group:focus-within {
  border-color: var(--gold);
  background-color: var(--surface);
}

.price-prefix {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.price-inline-input {
  width: 62px;
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
  outline: none;
}

.mov-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--bg-subtle);
}

.mov-row:last-child {
  border-bottom: 0;
}

.mov-row[data-voided="true"] {
  opacity: 0.5;
}

.mov-row[data-voided="true"] .mov-title {
  text-decoration: line-through;
}

.mov-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mov-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: break-word;
}

.mov-detail {
  font-size: 12.5px;
  color: var(--ink-secondary);
}

.mov-time {
  font-size: 11.5px;
  color: var(--ink-tertiary);
}

.mov-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.mov-amount {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ok);
}

.mov-amount--neutral {
  color: var(--ink-secondary);
}

.mov-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.text-action {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--surface);
  transition: transform var(--dur-press) var(--ease-out), border-color var(--dur-fast) ease, color var(--dur-fast) ease;
}

.text-action:active {
  transform: scale(0.95);
}

.text-action--danger {
  color: var(--out);
  border-color: var(--out-border);
  background-color: var(--out-bg);
}

.demo-footer {
  padding: 14px 16px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.demo-footer-copy {
  font-size: 13px;
  color: var(--ink-secondary);
}

/* ==========================================================================
   Empty States
   ========================================================================== */

.empty-state {
  padding: 32px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--ink-secondary);
}

.empty-state-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--ink);
}

.empty-state-desc {
  margin: 0;
  max-width: 340px;
  font-size: 13.5px;
}

/* ==========================================================================
   Bottom Sheet (mobile) / Side Drawer (desktop)
   ========================================================================== */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background-color: var(--backdrop);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-ui) ease;
}

.sheet-backdrop[data-open="true"] {
  opacity: 1;
  pointer-events: auto;
}

.sheet-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  max-height: 90dvh;
  background-color: var(--surface);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow-sheet);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  pointer-events: none;
  transition: transform var(--dur-sheet) var(--ease-drawer);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.sheet-panel[data-open="true"] {
  transform: translateY(0);
  pointer-events: auto;
}

.sheet-handle-zone {
  padding: 10px 0 6px;
  display: flex;
  justify-content: center;
  cursor: grab;
  touch-action: none;
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: var(--radius-pill);
  background-color: var(--border-strong);
}

.sheet-header {
  padding: 4px 18px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sheet-title-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sheet-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.1;
  color: var(--ink);
}

.sheet-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--ink-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sheet-close {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg);
  color: var(--ink);
  flex-shrink: 0;
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-fast) ease;
}

.sheet-close:active {
  transform: scale(0.92);
}

.sheet-body {
  padding: 16px 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ==========================================================================
   Form Controls inside Sheets
   ========================================================================== */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

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

.field-row-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.field-hint {
  font-size: 12px;
  color: var(--ink-secondary);
}

.input,
.select-field {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  background-color: var(--surface-tint);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  color: var(--ink);
  transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}

.input:focus,
.select-field:focus {
  border-color: var(--gold);
  background-color: var(--surface);
  outline: none;
}

.quick-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.quick-pill {
  min-height: 32px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background-color: var(--surface);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
  transition: transform var(--dur-press) var(--ease-out), border-color var(--dur-fast) ease, background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}

.quick-pill:active {
  transform: scale(0.95);
}

.quick-pill[data-active="true"] {
  background-color: var(--gold-soft);
  border-color: var(--gold);
  color: var(--ink);
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
}

.mode-tab {
  min-height: 36px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  text-align: center;
  transition:
    transform var(--dur-press) var(--ease-out),
    background-color var(--dur-fast) ease,
    color var(--dur-fast) ease;
}

.mode-tab[aria-selected="true"] {
  background-color: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

.mode-tab:active {
  transform: scale(0.96);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
}

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

.form-error {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background-color: var(--out-bg);
  border: 1px solid var(--out-border);
  color: var(--out);
  font-size: 13px;
  font-weight: 600;
}

.calc-banner {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background-color: var(--gold-soft);
  border: 1px solid var(--gold-border);
  font-size: 13px;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ==========================================================================
   Lightbox for Official Ficha
   ========================================================================== */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background-color: var(--backdrop-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-ui) ease;
}

.lightbox[data-open="true"] {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-inner {
  position: relative;
  max-width: 520px;
  max-height: 90dvh;
  transform: scale(0.95);
  transition: transform var(--dur-ui) var(--ease-out);
}

.lightbox[data-open="true"] .lightbox-inner {
  transform: scale(1);
}

.lightbox-img {
  max-height: 86dvh;
  width: auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.lightbox-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  background-color: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   Sonner-style Toast with Undo
   ========================================================================== */

.toast-region {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--bottom-nav-h) + 12px + env(safe-area-inset-bottom, 0px));
  z-index: 95;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  max-width: 440px;
  width: 100%;
  background-color: var(--ink);
  color: var(--ink-on-dark);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  opacity: 0;
  transform: translateY(18px) scale(0.97);
  transition:
    opacity var(--dur-ui) var(--ease-out),
    transform var(--dur-ui) var(--ease-out);
}

.toast[data-visible="true"] {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast-msg {
  font-size: 13.5px;
  line-height: 1.35;
  min-width: 0;
}

.toast-undo {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background-color: var(--gold);
  color: var(--ink-on-dark);
  font-size: 12.5px;
  font-weight: 700;
  flex-shrink: 0;
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-fast) ease;
}

.toast-undo:active {
  transform: scale(0.95);
}

/* ==========================================================================
   Mobile Bottom Navigation
   ========================================================================== */

.mobile-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background-color: var(--surface);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  box-shadow: var(--shadow-nav);
}

.mobile-nav-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  border-radius: var(--radius-md);
  color: var(--ink-tertiary);
  font-size: 11.5px;
  font-weight: 600;
  transition: color var(--dur-fast) ease, transform var(--dur-press) var(--ease-out), background-color var(--dur-fast) ease;
}

.mobile-nav-btn svg {
  width: 20px;
  height: 20px;
}

.mobile-nav-btn[aria-current="page"] {
  color: var(--ink);
  background-color: var(--bg);
}

.mobile-nav-btn:active {
  transform: scale(0.95);
}

.mobile-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 25px);
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background-color: var(--warn);
  color: var(--ink-on-dark);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: lining-nums tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   Responsive Breakpoints (Tablet & Desktop >= 840px)
   ========================================================================== */

@media (min-width: 640px) {
  .kpi-item {
    padding: 15px 20px;
  }
  .kpi-value {
    font-size: 32px;
  }
  .filter-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .search-wrap {
    flex: 1 1 240px;
    width: auto;
  }
  .orders-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .matrix-head-row,
  .matrix-row {
    grid-template-columns: minmax(150px, 1.55fr) repeat(4, minmax(0, 1fr));
    gap: 10px;
  }
  .stock-cell {
    min-height: 52px;
  }
}

@media (min-width: 840px) {
  .header-inner {
    padding: 12px 24px;
  }
  .desktop-nav {
    display: inline-flex;
  }
  .mobile-nav {
    display: none;
  }
  .app-main {
    padding: 22px 24px 48px;
  }
  .toast-region {
    bottom: 24px;
  }
  .model-strip {
    grid-auto-flow: row;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-auto-columns: initial;
    overflow-x: visible;
    gap: 12px;
  }
  .model-stage-head {
    padding: 20px 22px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .stage-thumb {
    width: 74px;
    height: 98px;
  }
  .matrix-wrap {
    padding: 16px 22px 22px;
  }
  .pricing-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    align-items: start;
  }

  /* Side drawer on desktop */
  .sheet-panel {
    left: auto;
    top: 0;
    bottom: 0;
    width: 440px;
    max-width: 92vw;
    max-height: 100dvh;
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: 0;
    border-bottom-left-radius: var(--radius-xl);
    border-top: 0;
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-drawer);
    transform: translateX(100%);
  }
  .sheet-panel[data-open="true"] {
    transform: translateX(0);
  }
  .sheet-handle-zone {
    display: none;
  }
  .sheet-header {
    padding: 20px 22px 16px;
  }
  .sheet-body {
    padding: 18px 22px 24px;
  }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .sheet-panel {
    transform: none;
    opacity: 0;
    transition: opacity 150ms ease !important;
  }
  .sheet-panel[data-open="true"] {
    opacity: 1;
  }
  .toast {
    transform: none;
    transition: opacity 150ms ease !important;
  }
}
