/* Estilos de Cuentas: base de los portales (stock.css) + lo propio al final. */

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

/* ---------- Pesos / dólares BNA ---------- */
.fx-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; background: #fff; border: 1px solid var(--border-color); border-radius: 4px; padding: 8px 12px; margin-bottom: 14px; font-size: 12px; }
.fx-bar label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-weight: 600; }
.fx-bar select, .fx-bar input[type=date] { font-size: 12px; padding: 4px 6px; }
.fx-switch { display: inline-flex; border: 1px solid var(--border-color); border-radius: 4px; overflow: hidden; }
.fx-switch a { padding: 5px 12px; font-weight: 600; color: var(--text-muted); text-decoration: none; }
.fx-switch a.active { background: var(--brand-color); color: #fff; }
.fx-rate { font-size: 13px; }
.fx-error { color: #b91c1c; }
.count-table .group-row th { border-bottom: none; padding-bottom: 0; }
.count-table th.grp { text-align: center; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); border-bottom: 2px solid var(--border-color); }
.count-table .grp-start { border-left: 2px solid var(--border-color); }
.count-table tfoot td { background: #f8f7f2; border-top: 2px solid var(--border-color); white-space: nowrap; }
@media (max-width: 760px) { .count-table tfoot { display: none; } .count-table .grp-start { border-left: none; } }
.count-table .calc { font-size: 10px; color: var(--text-muted); font-weight: 400; white-space: nowrap; }
.save-state { margin-left: 10px; font-size: 12px; color: var(--text-muted); }
.save-state.saving { color: #b45309; }
.save-state.saved { color: #15803d; }
.save-state.error { color: #b91c1c; }
.btn.is-disabled { pointer-events: none; opacity: .5; }

/* ---------- Asistente de ayuda (botón flotante con el logo) ---------- */
.ayuda-fab { position: fixed; right: 20px; bottom: 20px; z-index: 400; width: 58px; height: 58px; border-radius: 50%; border: 2px solid #C12032; background: #fff; box-shadow: 0 6px 18px rgba(0,0,0,.18); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; transition: transform .15s; }
.ayuda-fab:hover { transform: scale(1.06); }
.ayuda-fab img { width: 30px; height: 30px; }
.ayuda-fab-q { position: absolute; top: -4px; right: -4px; width: 20px; height: 20px; border-radius: 50%; background: #C12032; color: #fff; font: 700 12px/20px Montserrat, sans-serif; }
.ayuda-fab.open .ayuda-fab-q { display: none; }
.ayuda-panel { position: fixed; right: 20px; bottom: 90px; z-index: 400; width: 370px; max-width: calc(100vw - 32px); height: 520px; max-height: calc(100vh - 120px); background: #fff; border: 1px solid var(--border-color); border-radius: 10px; box-shadow: 0 12px 36px rgba(0,0,0,.22); display: flex; flex-direction: column; overflow: hidden; }
.ayuda-panel[hidden] { display: none !important; }
.ayuda-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 3px solid #C12032; background: #fff; }
.ayuda-logo { height: 26px; width: auto; }
.ayuda-head div { flex: 1; display: flex; flex-direction: column; line-height: 1.2; font-size: 13px; padding-left: 8px; border-left: 1px solid var(--border-color); }
.ayuda-head span { font-size: 11px; color: var(--text-muted); }
.ayuda-x { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 6px; font-size: 14px; }
.ayuda-x:hover { color: var(--text-dark); }
.ayuda-msgs { flex: 1; overflow-y: auto; padding: 12px; background: #f8f7f2; display: flex; flex-direction: column; gap: 8px; }
.ayuda-msg { display: flex; gap: 8px; align-items: flex-end; }
.ayuda-msg.yo { justify-content: flex-end; }
.ayuda-av { width: 24px; height: 24px; flex: 0 0 24px; background: #fff; border-radius: 50%; padding: 3px; border: 1px solid var(--border-color); }
.ayuda-bubble { max-width: 86%; padding: 8px 11px; border-radius: 10px; font-size: 13px; line-height: 1.45; }
.ayuda-msg.bot .ayuda-bubble { background: #fff; border: 1px solid var(--border-color); border-bottom-left-radius: 2px; }
.ayuda-msg.yo .ayuda-bubble { background: #C12032; color: #fff; border-bottom-right-radius: 2px; }
.ayuda-links { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.ayuda-links a { font-size: 12px; font-weight: 600; color: #C12032; text-decoration: none; border: 1px solid rgba(193,32,50,.35); border-radius: 12px; padding: 3px 10px; }
.ayuda-links a:hover { background: rgba(193,32,50,.06); }
.ayuda-chips { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 32px; }
.ayuda-chips button { font: 600 12px Montserrat, sans-serif; background: #fff; border: 1px solid var(--border-color); border-radius: 14px; padding: 5px 11px; cursor: pointer; color: var(--text-dark); }
.ayuda-chips button:hover { border-color: #C12032; color: #C12032; }
.ayuda-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border-color); }
.ayuda-form input { flex: 1; font-size: 13px; }
.ayuda-form button { background: #C12032; color: #fff; border: none; border-radius: 4px; width: 38px; cursor: pointer; }
/* que el botón flotante no tape "Guardar definitiva" */
.sticky-actions { padding-right: 90px; }
@media print { .ayuda-fab, .ayuda-panel { display: none !important; } }
@media (max-width: 760px) { .ayuda-panel { right: 16px; bottom: 84px; height: calc(100vh - 110px); } .ayuda-fab { right: 16px; bottom: 16px; } }

/* Aviso de cierre de sesión por inactividad */
.idle-warn { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 500; display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid #d97706; border-left: 4px solid #d97706; border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 10px 14px; font-size: 13px; max-width: calc(100vw - 32px); }
.idle-warn > i { color: #d97706; font-size: 18px; }
.idle-warn span { font-size: 12px; color: var(--text-muted); }
.notice-text { margin: 0; font-size: 13px; color: #92400e; background: rgba(217,119,6,.08); border: 1px solid rgba(217,119,6,.3); border-radius: 4px; padding: 8px 10px; }

/* ---------- Cuentas ---------- */
.brand-iso { width: 30px; height: 30px; background: #fff; border-radius: 6px; padding: 3px; }
.login-logo { display: block; height: 44px; margin: 0 auto 6px; }
.login-sub { text-align: center; color: var(--text-muted); font-size: 13px; margin: -6px 0 18px; }
.login-help { text-align: center; color: var(--text-muted); font-size: 12px; margin: 16px 0 0; }
tr.clickable { cursor: pointer; }
.portal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.portal-tile { display: flex; flex-direction: column; gap: 6px; background: #fff; border: 1px solid var(--border-color); border-top: 4px solid #C12032; border-radius: 6px; padding: 18px; text-decoration: none; color: var(--text-dark); transition: box-shadow .15s, transform .15s; }
.portal-tile:hover { box-shadow: 0 8px 22px rgba(0,0,0,.1); transform: translateY(-2px); }
.portal-icon { width: 42px; height: 42px; border-radius: 8px; background: rgba(193,32,50,.08); color: #C12032; display: flex; align-items: center; justify-content: center; font-size: 19px; }
.portal-name { font-weight: 700; font-size: 15px; }
.portal-desc { font-size: 12px; color: var(--text-muted); flex: 1; }
.portal-url { font-size: 12px; font-weight: 600; color: #C12032; }
