/* Agregados de Stock 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 según vencimiento */
table.data-table tbody tr.row-vencida > td:first-child { box-shadow: inset 3px 0 0 var(--brand-color); }
table.data-table tbody tr.row-vencida > td { background: rgba(200, 16, 46, 0.04); }
table.data-table tbody tr.row-por-vencer > td:first-child { box-shadow: inset 3px 0 0 #d97706; }
table.data-table tbody tr.row-por-vencer > td { background: rgba(217, 119, 6, 0.05); }
table.data-table tbody tr.row-inactiva > td { color: #8a8a86; }
.dominio {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-weight: 700; letter-spacing: 0.04em;
  background: #f4f5f7; border: 1px solid var(--border-color); border-radius: 3px; padding: 1px 6px;
}

/* Formulario de prenda 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; }
.cad-suggest { color: #b45309; cursor: pointer; text-decoration: underline; }

/* 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; }

.batch-dropzone { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 34px 20px; border: 2px dashed var(--border-color); border-radius: 6px; cursor: pointer; text-align: center; }
.batch-dropzone.drag-over, .batch-dropzone:hover { border-color: var(--brand-color); background: rgba(200, 16, 46, 0.03); }
.import-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.import-count { border: 1px solid var(--border-color); border-radius: 4px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.import-count span { font-size: 11px; color: var(--text-muted); text-transform: uppercase; font-weight: 600; }
.import-count strong { font-size: 20px; }
.import-count.warn strong { color: #b45309; }

/* 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; }
}

/* ---------- Stock ---------- */
table.data-table th.num, table.data-table td.num { text-align: right; white-space: nowrap; }
table.data-table th.num a { justify-content: flex-end; }
.codigo { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-weight: 600; font-size: 12px; }
.stock-table td { vertical-align: top; }
.range-filter { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.range-filter input { width: 110px; }
.stock-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border-color); }
.stock-totals div { display: flex; flex-direction: column; gap: 2px; }
.stock-totals span { font-size: 11px; color: var(--text-muted); text-transform: uppercase; font-weight: 600; }
.stock-totals strong { font-size: 18px; }
.stock-totals .hl strong { color: var(--brand-color); }
.upload-meta { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-top: 14px; }
.upload-meta .form-group { min-width: 220px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--border-color); border-radius: 4px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.kpi span { font-size: 11px; color: var(--text-muted); text-transform: uppercase; font-weight: 600; }
.kpi strong { font-size: 22px; }
.kpi small { color: var(--text-muted); font-size: 12px; }
.hbar { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.hbar-label { width: 38%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { flex: 1; background: #eceae3; border-radius: 3px; height: 10px; }
.hbar-fill { background: var(--brand-color); height: 100%; border-radius: 3px; }
.hbar-value { width: 150px; text-align: right; font-weight: 600; white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } .hbar-value { width: 110px; } }

/* ---------- Auditorías ---------- */
.neg { color: #b91c1c; }
.pos { color: #1d4ed8; }
.aud-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.aud-codigo { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 20px; font-weight: 700; letter-spacing: .02em; margin-right: 6px; }
.aud-codigo-link { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-weight: 700; text-decoration: underline; white-space: nowrap; }
.progress { height: 8px; background: #eceae3; border-radius: 4px; overflow: hidden; width: 110px; }
.progress span { display: block; height: 100%; background: #15803d; }
.sel-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; background: #fff; border: 1px solid var(--border-color); border-radius: 4px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px; }
tr.pick-row { cursor: pointer; }
table.data-table tbody tr.picked > td { background: rgba(21, 128, 61, 0.06); }
table.data-table tbody tr.picked > td:first-child { box-shadow: inset 3px 0 0 #15803d; }
.count-table input.fis-input { width: 90px; text-align: right; font-weight: 600; }
.count-table input.obs-input { width: 100%; min-width: 180px; }
.count-table input.invalid { border-color: #b91c1c; background: #fef2f2; }
table.data-table tbody tr.counted > td:first-child { box-shadow: inset 3px 0 0 #15803d; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--border-color); border-radius: 4px; padding: 10px 14px; box-shadow: 0 -4px 12px rgba(0,0,0,.06); }
.kpi-neg strong { color: #b91c1c; }
.kpi-pos strong { color: #1d4ed8; }
.kpi-ok strong { color: #15803d; }
.stack-bar { display: flex; height: 22px; border-radius: 4px; overflow: hidden; background: #eceae3; }
.stack-bar span { display: block; height: 100%; }
.sb-ok { background: #15803d; }
.sb-neg { background: #b91c1c; }
.sb-pos { background: #1d4ed8; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; margin: 8px 0 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table td { padding: 6px 0; border-bottom: 1px solid #efeee7; }
.mini-table td.num { text-align: right; white-space: nowrap; }
.zbar { display: grid; grid-template-columns: minmax(70px, 1fr) 1fr 1fr minmax(95px, 1fr); gap: 6px; align-items: center; padding: 5px 0; font-size: 13px; }
.zbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zbar-neg, .zbar-pos { height: 10px; background: #eceae3; border-radius: 3px; display: flex; }
.zbar-neg { justify-content: flex-end; }
.zbar-neg span { background: #b91c1c; border-radius: 3px; display: block; }
.zbar-pos span { background: #1d4ed8; border-radius: 3px; display: block; }
.zbar-val { text-align: right; font-size: 11px; line-height: 1.3; }
@media print {
  .main-sidebar, .main-header, .tabs, .sel-bar, .sticky-actions, .btn { display: none !important; }
  .content-wrapper { padding: 0 !important; }
  .count-table input { border: none; }
}
