/*
 * Sistema de diseño – Maqueta Usend Orders
 * Alineado con estilo Angular: limpio, accesible, consistente.
 * Variables CSS reutilizables para el proyecto.
 */

:root {
  /* Primarios (paleta proyecto Angular / Usend: --primary #3490dc) */
  --color-primary: #3490dc;
  --color-primary-dark: #2779bd;
  --color-primary-light: #6cb2eb;
  --color-primary-contrast: #fff;

  /* Superficie y fondo */
  --color-surface: #fafafa;
  --color-surface-card: #fff;
  --color-background: #f5f5f5;

  /* Texto */
  --color-text: #212121;
  --color-text-secondary: #616161;
  --color-text-hint: #9e9e9e;

  /* Estados (paleta Usend: success #38c172, danger #e3342f) */
  --color-success: #38c172;
  --color-success-bg: #e8f5e9;
  --color-warning: #f6993f;
  --color-warning-bg: #fff3e0;
  --color-error: #e3342f;
  --color-error-bg: #ffebee;

  /* Bordes y elevación */
  --border-radius: 8px;
  --border-color: #e0e0e0;
  --shadow-1: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-2: 0 4px 12px rgba(0,0,0,0.08);

  /* Espaciado */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  /* Tipografía */
  --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-size-base: 14px;
  --font-size-caption: 12px;
  --font-size-title: 20px;
  --font-size-headline: 24px;
  --line-height: 1.5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  color: var(--color-text);
  background: var(--color-background);
}

/* Layout: topbar con menú horizontal + contenido */
.layout-flapp {
  min-height: 100vh;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: var(--color-surface-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-lg);
  z-index: 1001;
  box-shadow: var(--shadow-1);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 0;
  list-style: none;
  padding: 0;
  margin: 0;
}

.topnav a {
  display: inline-block;
  padding: var(--space-sm) var(--space-md);
  color: var(--color-text);
  text-decoration: none;
  font-size: var(--font-size-base);
  border-radius: var(--border-radius);
  transition: background 0.15s, color 0.15s;
}

.topnav a:hover {
  background: var(--color-surface);
  color: var(--color-primary);
}

.topnav a.active {
  background: rgba(52, 144, 220, 0.12);
  color: var(--color-primary);
  font-weight: 500;
}

.main-content {
  margin-top: 48px;
  padding: var(--space-lg);
  min-height: calc(100vh - 48px);
  background: var(--color-background);
}

/* Contenedor de página dentro de main (max-width opcional) */
.maqueta-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 0;
}

.maqueta-header {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.maqueta-header h1 {
  margin: 0 0 var(--space-xs) 0;
  font-size: var(--font-size-headline);
  font-weight: 600;
  color: var(--color-text);
}

.maqueta-header p {
  margin: 0;
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
}

.maqueta-header--with-help {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-md);
}

.maqueta-help-link {
  font-size: var(--font-size-caption);
  color: var(--color-primary);
  text-decoration: none;
}

.maqueta-help-link:hover {
  text-decoration: underline;
}

.maqueta-help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: var(--border-radius);
  transition: color 0.15s, background 0.15s;
}

.maqueta-help-icon:hover {
  color: var(--color-primary);
  background: rgba(52, 144, 220, 0.08);
}

.maqueta-help-icon svg {
  display: block;
}

/* Barra superior de acciones (búsqueda + botón) */
.toolbar-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

.search-input-wrap input {
  width: 100%;
  padding: var(--space-sm) var(--space-md) var(--space-sm) 36px;
  font-size: var(--font-size-base);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

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

.settings-buttons {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

/* Cards */
.card {
  background: var(--color-surface-card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-1);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

.card-title {
  margin: 0 0 var(--space-md) 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}

/* Tarjetas de tienda (expandibles) */
.store-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

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

/* Lista de locales (estilo Flapp local.html) */
.locals {
  background: var(--color-surface-card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}

.locals-selector {
  padding: 0;
}

.locals-top-container {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-color);
}

.locals-search {
  flex: 1;
  min-width: 200px;
  max-width: 400px;
}

.locals-search .locals-search-input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: var(--font-size-base);
}

.locals-wrapper {
  display: flex;
  flex-direction: column;
}

.local-item {
  border-bottom: 1px solid var(--border-color);
}

.local-item:last-child {
  border-bottom: none;
}

.local-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}

.local-item-row:hover {
  background: var(--color-surface);
}

.local-item.expanded .local-item-row {
  border-bottom: 1px solid var(--border-color);
}

.local-item-text {
  flex: 1;
  min-width: 0;
}

.local-item-title {
  font-weight: 600;
  margin: 0 0 2px 0;
  font-size: var(--font-size-base);
}

.local-item-address {
  margin: 0;
  font-size: var(--font-size-caption);
  color: var(--color-text-secondary);
  line-height: 1.4;
}

.local-item-icon {
  flex-shrink: 0;
  color: var(--color-text-hint);
  transition: transform 0.2s;
}

.local-item.expanded .local-item-icon {
  transform: rotate(90deg);
}

/* Compatibilidad con store-card (expandible) */
.store-card-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}

.locals .store-card-summary {
  padding: var(--space-md) var(--space-lg);
}

.store-card-summary:hover {
  background: var(--color-surface);
}

.store-card.expanded .store-card-summary,
.local-item.expanded .local-item-row {
  border-bottom: 1px solid var(--border-color);
}

.store-card-summary .store-info {
  flex: 1;
  min-width: 0;
}

.store-card-summary .store-info strong {
  display: block;
  margin-bottom: 2px;
}

.store-address {
  font-size: var(--font-size-caption);
  color: var(--color-text-secondary);
}

.store-card-summary .store-meta {
  font-size: var(--font-size-caption);
  color: var(--color-text-secondary);
}

.store-card-chevron {
  font-size: 12px;
  color: var(--color-text-hint);
  transition: transform 0.2s;
}

.store-card.expanded .store-card-chevron {
  transform: rotate(180deg);
}

.store-card-body {
  display: none;
  padding: var(--space-lg);
  background: var(--color-surface);
  border-top: 1px solid var(--border-color);
}

.store-card.expanded .store-card-body {
  display: block;
}

.store-card-body .card-title {
  margin-top: 0;
  font-size: 14px;
}

.store-edit-section {
  margin-bottom: var(--space-lg);
}

.store-edit-section:last-child {
  margin-bottom: 0;
}

/* Tablas */
.table-wrap {
  overflow-x: auto;
}

.table-wrap--no-overflow {
  overflow: visible;
  width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-base);
}

th, td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  font-weight: 600;
  color: var(--color-text-secondary);
  font-size: var(--font-size-caption);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tr:last-child td {
  border-bottom: none;
}

tr.CategoryTitle td {
  background: var(--color-surface);
  font-weight: 600;
  padding-top: var(--space-md);
}

/* Tabla tipo data-table (proyecto Angular / backoffice) */
.table-container {
  background: var(--color-surface-card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-2);
  padding: var(--space-lg);
}

.table-responsive {
  overflow-x: auto;
  width: 100%;
}

.table-responsive .table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table-responsive .table thead th {
  background-color: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
  font-weight: 600;
  vertical-align: middle;
  padding: var(--space-sm) var(--space-md);
  color: var(--color-text);
  font-size: 0.875rem;
  text-transform: none;
  letter-spacing: normal;
}

.table-responsive .table tbody td {
  vertical-align: middle;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.table-responsive .table.table-hover tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.table-responsive .table tbody tr:last-child td {
  border-bottom: none;
}

.data-table-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-color);
}

.data-table-footer .data-table-info {
  font-size: var(--font-size-caption);
  color: var(--color-text-secondary);
}

/* Página Productos: ancho completo, sin overflow */
.main-content--productos {
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

.maqueta-page--productos {
  max-width: none;
  width: 100%;
}

.productos-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.productos-toolbar .search-input-wrap--full {
  flex: 1;
  min-width: 200px;
}

.productos-toolbar .btn {
  flex-shrink: 0;
}

.search-input-wrap--full {
  max-width: none;
  flex: 1;
  width: 100%;
}

.search-input-wrap--full input {
  width: 100%;
}

.table-container--productos {
  width: 100%;
  overflow: visible;
}

.table-responsive--no-overflow {
  overflow: visible;
  width: 100%;
}

.table-productos {
  width: 100%;
  table-layout: auto;
}

.table-productos th:first-child,
.table-productos td:first-child {
  width: 44px;
  text-align: center;
  vertical-align: middle;
}

.table-productos th:first-child input,
.table-productos td:first-child input {
  margin: 0;
  cursor: pointer;
}

.table-productos .toggle {
  display: inline-block;
}

/* Página Vendedores: mismo estilo que Productos */
.main-content--vendedores {
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

.maqueta-page--vendedores {
  max-width: none;
  width: 100%;
}

.vendedores-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.vendedores-toolbar .search-input-wrap--full {
  flex: 1;
  min-width: 200px;
}

.vendedores-filters {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.vendedores-filter-label {
  font-size: var(--font-size-caption);
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.vendedores-toolbar .form-control-select {
  min-width: 140px;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: var(--font-size-base);
  background: var(--color-surface-card);
}

.vendedores-csv-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.table-container--vendedores {
  width: 100%;
  overflow: visible;
}

.table-vendedores {
  width: 100%;
}

.talla-resumen {
  font-size: var(--font-size-base);
  color: var(--color-text);
  white-space: nowrap;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: var(--border-radius);
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-icon:hover {
  background: var(--color-surface);
  color: var(--color-primary);
}

.btn-icon svg {
  flex-shrink: 0;
}

.table-productos th:last-child,
.table-productos td:last-child {
  width: 52px;
  text-align: center;
  vertical-align: middle;
}

.modal-box--talla .form-group {
  margin-bottom: var(--space-md);
}

.modal-box--talla .form-group label {
  display: block;
  margin-bottom: var(--space-xs);
  font-weight: 500;
}

.modal-box--talla .form-control,
.modal-box--talla .form-control-select,
.modal-box--talla input[type="number"] {
  width: 100%;
  max-width: none;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: var(--font-size-base);
}

.modal-box--talla .modal-actions {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-color);
}

.notificaciones-actions {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-color);
}

.data-table-footer .data-table-pagination {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.data-table-footer .data-table-pagination .btn {
  min-width: 32px;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-caption);
}

.data-table-footer .data-table-pagination .btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: 500;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-primary-contrast);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
}

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

.btn-secondary:hover {
  background: var(--border-color);
}

/* Toggle (switch) */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
  user-select: none;
}

.toggle.active {
  background: var(--color-primary);
}

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-1);
  transition: transform 0.2s;
}

.toggle.active::after {
  transform: translateX(20px);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: var(--font-size-caption);
  font-weight: 500;
  border-radius: 4px;
}

.badge-success {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.badge-error {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.badge-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

/* Formularios */
.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  margin-bottom: var(--space-xs);
  font-weight: 500;
  color: var(--color-text);
}

.form-group input[type="number"],
.form-group input[type="text"] {
  width: 100%;
  max-width: 200px;
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-size-base);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

/* Checkout – opción principal */
.checkout-option {
  border: 2px solid var(--color-primary);
  background: rgba(25, 118, 210, 0.04);
  border-radius: var(--border-radius);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

.checkout-option .label {
  font-size: var(--font-size-caption);
  color: var(--color-primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-xs);
}

.checkout-option .title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 var(--space-sm) 0;
}

.checkout-option .meta {
  color: var(--color-text-secondary);
  font-size: var(--font-size-base);
  margin: 0;
}

.checkout-option .price {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text);
  margin-top: var(--space-sm);
}

/* Mensaje sin disponibilidad */
.alert {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-md);
}

.alert-warning {
  background: var(--color-warning-bg);
  color: var(--color-text);
  border: 1px solid var(--color-warning);
}

.alert-warning p {
  margin: 0;
  font-weight: 500;
}

/* Grid de métodos */
.methods-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.method-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: var(--color-surface);
  border-radius: 4px;
  font-size: var(--font-size-caption);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, color 0.15s;
  border: 1px solid var(--border-color);
}

.method-chip:hover {
  border-color: var(--color-primary-light);
}

.method-chip.enabled {
  background: var(--color-success-bg);
  color: var(--color-success);
  border-color: var(--color-success);
}

/* Detalle de pedido asignado */
.pedido-asignado {
  background: var(--color-success-bg);
  border: 1px solid var(--color-success);
  color: var(--color-text);
  border-radius: var(--border-radius);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

.pedido-asignado strong {
  color: var(--color-success);
}

/* Lista de enlaces de maquetas */
.maqueta-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.maqueta-links li {
  margin-bottom: var(--space-sm);
}

.maqueta-links a {
  display: block;
  padding: var(--space-md) var(--space-lg);
  background: var(--color-surface-card);
  border-radius: var(--border-radius);
  color: var(--color-text);
  text-decoration: none;
  box-shadow: var(--shadow-1);
  transition: box-shadow 0.2s, border-color 0.2s;
  border: 1px solid transparent;
}

.maqueta-links a:hover {
  box-shadow: var(--shadow-2);
  border-color: var(--color-primary-light);
}

.maqueta-links a strong {
  display: block;
  margin-bottom: 2px;
  color: var(--color-primary);
}

.maqueta-links a span {
  font-size: var(--font-size-caption);
  color: var(--color-text-secondary);
}

code {
  font-size: 0.9em;
  padding: 2px 6px;
  background: var(--color-surface);
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

/* Config section (Tarifas / Perfil) */
.config-section {
  margin-bottom: var(--space-lg);
}

.config-section h4 {
  margin: 0 0 var(--space-md) 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.config-section .form-group {
  margin-bottom: var(--space-sm);
}

.config-section .form-group label {
  font-size: var(--font-size-caption);
}

/* Rate row (método + switch por tienda) */
.rate-block {
  margin-bottom: var(--space-lg);
}

.rate-block .local-name {
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.rate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border-color);
}

.rate-row:last-child {
  border-bottom: none;
}

.card-description {
  margin: 0 0 var(--space-md) 0;
  font-size: var(--font-size-caption);
  color: var(--color-text-secondary);
}

.tarifas-actions {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-color);
}

/* Tarifas: toolbar (mismo estilo que productos) */
.tarifas-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: center;
  margin-bottom: var(--space-lg);
}

.tarifas-toolbar .search-input-wrap--full {
  flex: 1;
  min-width: 200px;
}

.tarifas-toolbar .btn {
  flex-shrink: 0;
}

/* Tarifas: listado colapsable por tienda */
.tarifas-collapse-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tarifas-collapse {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-sm);
  overflow: hidden;
}

.tarifas-collapse:last-child {
  margin-bottom: 0;
}

.tarifas-collapse.tarifas-store-hidden {
  display: none;
}

.tarifas-collapse-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  background: var(--color-surface);
  border: none;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.tarifas-collapse-header:hover {
  background: var(--color-surface-hover, rgba(0,0,0,0.04));
}

.tarifas-collapse-icon {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid currentColor;
  transition: transform 0.2s ease;
}

.tarifas-collapse.open .tarifas-collapse-icon {
  transform: rotate(180deg);
}

.tarifas-collapse-body {
  padding: 0 var(--space-lg) var(--space-md);
  background: var(--color-surface-card);
  border-top: 1px solid var(--border-color);
}

.tarifas-collapse-body .rate-row {
  padding-left: 0;
  padding-right: 0;
}

/* Tiendas: mismo listado colapsable; cuerpo con padding de card */
.tiendas-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.tiendas-toolbar .search-input-wrap--full {
  flex: 1;
  min-width: 200px;
}

.tarifas-collapse-body.store-card-body {
  padding: var(--space-lg);
}

/* Mostrar cuerpo en tiendas cuando el acordeón está abierto (.store-card-body tiene display:none por defecto) */
.tarifas-collapse.open .tarifas-collapse-body.store-card-body {
  display: block;
}

.store-address {
  margin: 0 0 var(--space-md) 0;
  font-size: var(--font-size-caption);
  color: var(--color-text-secondary);
  line-height: 1.4;
}

/* Modal: cabecera con título y cerrar */
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.modal-header .card-title {
  margin: 0;
  flex: 1;
}

.modal-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-radius: var(--border-radius);
}

.modal-close:hover {
  color: var(--color-text);
  background: var(--color-surface);
}

.modal-box--config-cliente {
  max-width: 440px;
}

.modal-box--config-cliente .config-section {
  margin-bottom: var(--space-lg);
}

.modal-box--config-cliente .form-control {
  max-width: 140px;
}

.modal-actions {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-color);
}

/* Modal simple (maqueta) */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: var(--color-surface-card);
  border-radius: var(--border-radius);
  padding: var(--space-lg);
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-2);
}

.modal-box .card-title {
  margin-top: 0;
}

.modal-box .form-group input {
  max-width: 100%;
}

/* Perfil: card más amigable y formulario en grid */
.card-profile {
  padding: var(--space-xl);
  margin-bottom: var(--space-lg);
}

.card-title-profile {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.profile-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-md);
}

.profile-form-row--full {
  grid-template-columns: 1fr;
  margin-bottom: var(--space-md);
}

.profile-form .form-group {
  margin-bottom: 0;
}

.profile-form .form-group label {
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

.profile-form .form-group input[type="number"],
.profile-form .form-group input[type="text"],
.profile-form .form-group select {
  width: 100%;
  max-width: none;
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-size-base);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.profile-form .form-group input:focus,
.profile-form .form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(52, 144, 220, 0.2);
}

.form-control-select {
  min-width: 0;
  appearance: auto;
}

.profile-form-actions {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-color);
}

.profile-form-actions .btn {
  min-width: 120px;
}

@media (max-width: 640px) {
  .profile-form-row {
    grid-template-columns: 1fr;
  }
  .card-profile {
    padding: var(--space-lg);
  }
}

/* Modal de confirmación de stock */
.modal-text {
  margin: 0 0 var(--space-lg) 0;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  margin-top: var(--space-md);
}

/* Modal vendedor: listado de locales con switch */
.modal-box--vendedor .modal-text {
  margin: 0 0 var(--space-md) 0;
  color: var(--color-text-secondary);
  font-size: var(--font-size-caption);
}

.vendedor-locales-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.vendedor-local-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-color);
  gap: var(--space-md);
}

.vendedor-local-row:last-child {
  border-bottom: none;
}

.vendedor-local-name {
  font-size: var(--font-size-base);
  color: var(--color-text);
}

.vendedor-local-row .toggle {
  flex-shrink: 0;
}
