/* Agregados de Marketing (base: gestoría) sobre app.css (copiado tal cual de proveedores). */

/* .modal-overlay / .batch-dropzone tienen display propio que le gana a [hidden]. */
[hidden] { display: none !important; }

textarea {
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: 2px;
  color: var(--text-dark);
  outline: none;
  resize: vertical;
  width: 100%;
}
textarea:focus { border-color: var(--brand-color); }
input:disabled, select:disabled, textarea:disabled { background: #f8f7f2; color: var(--text-dark); }
fieldset { border: none; margin: 0; padding: 0; min-width: 0; }

.badge-danger { background: rgba(200, 16, 46, 0.12); color: var(--brand-color); }
.badge-muted { background: #eceae3; color: #57534e; }

.error-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: 4px;
  background: rgba(200, 16, 46, 0.07);
  border: 1px solid rgba(200, 16, 46, 0.3);
  color: #7f1d1d;
  font-size: 13px;
}
.error-box span { flex: 1; }

/* Encabezados ordenables y paginado como links (en proveedores eran botones) */
table.data-table th.sortable a { color: inherit; display: inline-flex; align-items: center; }
.pagination .page-item a {
  display: flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; padding: 0 8px;
  border: 1px solid var(--border-color); border-radius: 3px;
  background: #fff; color: var(--text-dark); font-size: 12px;
}
.pagination .page-item a:hover { background: #f8f7f2; }
.pagination .page-item.active a { background: var(--brand-color); border-color: var(--brand-color); color: #fff; }

.tab { text-decoration: none; }
.tab-count {
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 10px;
  background: #eceae3; color: var(--text-muted);
}
.tab.active .tab-count { background: rgba(200, 16, 46, 0.12); color: var(--brand-color); }

/* Barra de filtros de las tablas */
.list-toolbar { flex-wrap: wrap; gap: 10px; }
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search-box { position: relative; }
.search-box i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 12px; }
.search-box input { padding-left: 30px; width: 240px; }

/* Filas de pedidos */
table.data-table tbody tr.row-urgente > td:first-child { box-shadow: inset 3px 0 0 var(--brand-color); }
table.data-table tbody tr.row-inactiva > td { color: #8a8a86; }
.items-cell { font-size: 12px; color: var(--text-muted); max-width: 320px; }

/* Formularios en modal */
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid input, .form-grid select { width: 100%; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: 1 / -1; }
.checkbox-row { justify-content: flex-end; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dark); cursor: pointer; text-transform: none !important; letter-spacing: 0 !important; font-weight: 500 !important; }
.check input, .form-stack .check input, .form-grid .check input { width: auto; flex: 0 0 auto; }
.modal-footer {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border-color);
}
.btn-link { background: none; color: var(--text-muted); }
.btn-link:hover { color: var(--text-dark); }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-stack input, .form-stack select { width: 100%; }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }

/* Gráfico de barras del resumen */
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 220px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bar-value { font-size: 11px; font-weight: 700; color: var(--text-dark); margin-bottom: 4px; }
.bar { width: 100%; max-width: 38px; background: #94a3b8; border-radius: 3px 3px 0 0; transition: opacity 0.15s; }
.bar-hot { background: var(--brand-color); }
.bar-col:hover .bar { opacity: 0.8; }
.bar-label { font-size: 11px; color: var(--text-muted); margin-top: 6px; text-align: center; line-height: 1.1; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid #efeee7; font-size: 13px; }
.timeline li:last-child { border-bottom: none; }
.timeline li i { margin-top: 3px; }

.code-box {
  display: block; font-size: 11px; background: #f4f5f7; border: 1px solid var(--border-color);
  border-radius: 3px; padding: 8px; word-break: break-all;
}
.change-list { margin: 6px 0 0; padding-left: 16px; font-size: 12px; }

.nav-section-label { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin: 10px 0 6px; }
.sortable-list { list-style: none; margin: 0 0 8px; padding: 0; }
.sortable-list li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border-color); border-radius: 3px; margin-bottom: 6px; background: #fff; }

/* Nuevo pedido / ficha del pedido: contenido + columna lateral */
.pedido-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.pedido-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.pedido-main > .card, .pedido-side > .card, .pedido-layout > .card { margin-bottom: 0; }
.pedido-side { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 16px; }
.pedido-catalogo { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.pick-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.pick {
  font: inherit; font-size: 12px; padding: 5px 9px; border: 1px solid var(--border-color); border-radius: 14px;
  background: #fff; color: var(--text-dark); cursor: pointer;
}
.pick i { font-size: 10px; color: var(--brand-color); }
.pick:hover { border-color: var(--brand-color); background: rgba(200, 16, 46, 0.04); }
.pick-sin-stock { color: var(--text-muted); border-style: dashed; }
.pick small { font-size: 10px; color: #b45309; }
.stock-num { text-align: right; white-space: nowrap; font-weight: 700; font-size: 14px; }
.items-table td { vertical-align: middle; }
.items-table input { width: 100%; }
.qty { display: flex; align-items: center; gap: 6px; }
.qty input { width: 80px; flex: 0 0 auto; }
.qty span { font-size: 11px; white-space: nowrap; }

.dato-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 18px; margin: 0; }
.dato-grid dt { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 3px; }
.dato-grid dd { margin: 0; font-size: 14px; }
.obs-box { margin-top: 14px; padding: 10px 12px; background: #f8f7f2; border-left: 3px solid var(--border-color); font-size: 13px; }
.comment-text { margin-top: 6px; padding: 8px 10px; background: #f8f7f2; border-radius: 3px; font-size: 13px; }
.estado-options { display: flex; flex-direction: column; gap: 6px; }
.estado-option { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border-color); border-radius: 3px; cursor: pointer; font-size: 13px; }
.estado-option input { width: auto; }
.estado-option:has(input:checked) { border-color: var(--brand-color); background: rgba(200, 16, 46, 0.04); }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { padding: 5px 0 5px 4px; color: var(--text-muted); }
.steps li i { width: 18px; }
.steps li.done { color: #15803d; }
.steps li.current { color: var(--brand-color); font-weight: 700; }
.catalog-group { padding: 10px 16px; background: #f8f7f2; border-bottom: 1px solid var(--border-color); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

/* Diagramas de "Cómo se usa" (mismo estilo que el PS-03 de turnos) */
.flow svg { width: 100%; height: auto; max-width: 820px; display: block; margin: 0 auto; }
.flow .node rect, .flow .node path, .flow .node polygon { fill: #fff; stroke: #94a3b8; stroke-width: 1.5; }
.flow .node rect.pill { fill: #f8f7f2; }
.flow .node rect.alt { stroke-dasharray: 5 4; }
.flow .node rect.auto { fill: #f8f7f2; stroke-dasharray: 5 4; }
.flow .node path.doc { fill: #fff8f0; }
.flow .node text { font-family: Montserrat, sans-serif; font-size: 13px; font-weight: 600; fill: var(--text-dark); }
.flow .node text .sub { font-size: 11.5px; font-weight: 500; fill: var(--text-muted); }
.flow .node .count { font-size: 11px; font-weight: 700; fill: #fff; }
.flow .node .count-bg { fill: var(--brand-color); stroke: none; }
.flow a.node { cursor: pointer; }
.flow a.node:hover rect, .flow a.node:hover path, .flow a.node:hover polygon { stroke: var(--brand-color); fill: #fff5f6; }
.flow .edge { stroke: var(--brand-color); stroke-width: 1.5; fill: none; marker-end: url(#arrow); }
.flow .edge-alt { stroke: #94a3b8; stroke-dasharray: 5 4; marker-end: url(#arrowGray); }
.flow .edge-label { font-size: 12px; font-weight: 600; fill: #64748b; font-family: Montserrat, sans-serif; }
.letter { display: inline-flex; width: 24px; height: 24px; border-radius: 4px; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; background: rgba(200, 16, 46, 0.1); color: var(--brand-color); }

/* Responsive: sidebar como cajón en celular, tablas como tarjetas */
@media (max-width: 760px) {
  .main-sidebar { position: fixed; z-index: 300; height: 100vh; left: 0; top: 0; transform: translateX(-100%); transition: transform 0.18s ease; }
  .app-wrapper.sidebar-open .main-sidebar { transform: none; }
  .app-wrapper.sidebar-collapsed .main-sidebar { width: var(--sidebar-width); }
  .app-wrapper.sidebar-collapsed .brand-link span,
  .app-wrapper.sidebar-collapsed .sidebar-menu .nav-item a span,
  .app-wrapper.sidebar-collapsed .sidebar-logout span { display: inline; }
  .content-wrapper { padding: 14px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: auto; }
  .check-grid { grid-template-columns: 1fr; }
  .search-box input { width: 100%; }
  .toolbar-right, .search-box { width: 100%; }
  table.data-table thead { display: none; }
  table.data-table tr { display: block; border-bottom: 1px solid var(--border-color); padding: 6px 0; }
  table.data-table td { display: flex; gap: 10px; border: none; padding: 4px 12px; }
  table.data-table td[data-label]::before { content: attr(data-label); min-width: 90px; font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
  .bar-chart { gap: 3px; }
  .pedido-layout { grid-template-columns: 1fr; }
  .pedido-side, .pedido-catalogo { position: static; max-height: none; }
  .items-table td { display: block; }
}
