/* Stockea compact data table — used by admin payment methods and similar screens */

.stockea-table-page {
    font-size: 13px;
}

.stockea-table-panel {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    background: #fff;
    /*box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    border: 1px solid #e5e7eb;*/
}

.stockea-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.stockea-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    table-layout: fixed;
}

.stockea-table th {
    background-color: #f8fafc;
    color: #3b82f6;
    font-weight: 600;
    text-align: left;
    padding: 8px 12px;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
    font-size: 12px;
    letter-spacing: 0.01em;
}

.stockea-table td {
    padding: 4px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: #475569;
    vertical-align: middle;
    height: 36px;
    font-size: 13px;
}

.stockea-table tbody tr:hover:not(.stockea-table__filter-row):not(.stockea-table__edit-row) {
    background-color: #f1f5f9;
}

.stockea-table__row--active-edit {
    background-color: rgba(59, 130, 246, 0.08);
}

.stockea-table__col-narrow {
    width: 52px;
}

.stockea-table__col-code {
    width: 96px;
}

.stockea-table__col-actions {
    width: 44px;
    text-align: center;
}

.stockea-table__cell-clip {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stockea-table__cell-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
}

.stockea-table__filter-row {
    background-color: #f9fafb;
}

/* Fila de búsqueda justo bajo el encabezado (antes de los datos) */
.stockea-table__filter-row--top {
    background: linear-gradient(to bottom, #f1f5f9 0%, #f8fafc 100%);
    border-bottom: 2px solid #e2e8f0;
}

.stockea-table__filter-row--top td {
    padding: 8px 10px;
    border-bottom: none;
}

.stockea-table__filter-row td {
    padding: 6px 8px;
    border-bottom: 1px solid #e5e7eb;
}

.stockea-table__edit-row {
    background-color: #ffffff;
    border-top: 2px solid #3b82f6;
}

.stockea-table__edit-row td {
    padding: 8px 6px;
    height: auto;
    vertical-align: middle;
}

.compact-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d1d5db;
    border-radius: 2px;
    padding: 4px 8px;
    font-size: 12px;
    line-height: 1.35;
    outline: none;
    color: #334155;
    background: #fff;
}

.compact-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px #3b82f6;
}

.compact-input::placeholder {
    color: #94a3b8;
}

.required-indicator {
    border-left: 3px solid #ef4444;
    padding-left: 6px;
    margin-left: -2px;
}

.required-indicator--inactive {
    border-left-color: transparent;
    padding-left: 0;
    margin-left: 0;
}

/* Autocomplete de cuenta: mismo lenguaje visual que .compact-input */
.stockea-table .stockea-account-autocomplete.mud-input-control {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.stockea-table .stockea-account-autocomplete .mud-input-root {
    border-radius: 2px !important;
    border: 1px solid #d1d5db !important;
    background: #fff !important;
    min-height: 30px !important;
    align-items: center;
}

.stockea-table .stockea-account-autocomplete .mud-input-root:hover {
    border-color: #cbd5e1 !important;
}

.stockea-table .stockea-account-autocomplete.mud-input-control:focus-within .mud-input-root {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25);
}

.stockea-table .stockea-account-autocomplete input {
    font-size: 12px !important;
    padding: 4px 6px !important;
    color: #334155 !important;
}

.stockea-table .stockea-account-autocomplete .mud-input-label {
    display: none !important;
}

.stockea-table .stockea-account-autocomplete .mud-input-outlined-border {
    display: none !important;
}

.stockea-table .stockea-account-autocomplete .mud-input-adornment .mud-icon-root {
    color: #64748b !important;
    font-size: 1.1rem !important;
}

.action-icon {
    cursor: pointer;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border: none;
    background: transparent;
    border-radius: 4px;
}

.action-icon:hover {
    color: #1e293b;
    background: #f1f5f9;
}

.stockea-save-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: #312e81;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s ease;
}

.stockea-save-btn:hover:not(:disabled) {
    background: #1e1b4b;
}

.stockea-save-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.stockea-save-btn svg {
    width: 18px;
    height: 18px;
}

.stockea-table-legend {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    font-size: 11px;
    color: #64748b;
    align-items: center;
}

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

.stockea-legend-swatch {
    width: 10px;
    height: 10px;
    background: #f3f4f6;
    border-left: 3px solid #ef4444;
}

.stockea-table .text-center {
    text-align: center;
}

.stockea-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #3b82f6;
    cursor: pointer;
}

.stockea-table__edit-row select.compact-input {
    cursor: pointer;
}

.stockea-mud-autocomplete-full {
    width: 100%;
}

/* —— Modal selector de cuenta (estilo compacto) —— */

.stockea-account-picker-dialog .mud-dialog-title {
    font-size: 14px !important;
    font-weight: 600 !important;
    padding: 10px 16px 8px !important;
    color: #1e293b !important;
}

.stockea-account-picker-dialog .mud-dialog-content {
    padding: 0 12px 8px !important;
    overflow: hidden !important;
}

.stockea-account-picker-dialog .mud-dialog-actions {
    padding: 4px 12px 10px !important;
    min-height: auto !important;
}

.account-picker-body {
    font-size: 12px;
    color: #334155;
}

.account-picker-search-wrap {
    position: relative;
    margin-bottom: 8px;
}

.account-picker-search {
    width: 100%;
    box-sizing: border-box;
    padding-right: 32px !important;
    height: 30px;
}

.account-picker-search-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    pointer-events: none;
    display: flex;
    align-items: center;
}

.account-picker-stack {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.1);
}

.account-picker-table-wrap {
    max-height: 240px;
    overflow: auto;
    background: #fff;
}

.account-picker-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.account-picker-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.account-picker-table th {
    background: #f1f5f9;
    color: #334155;
    font-weight: 600;
    font-size: 11px;
    text-align: left;
    padding: 6px 10px;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.account-picker-th-code {
    width: 88px;
}

.account-picker-th-cat {
    width: 120px;
    text-align: right;
}

.account-picker-table td {
    padding: 4px 10px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 12px;
    line-height: 1.3;
    vertical-align: middle;
}

.account-picker-td-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 11px;
    color: #475569;
}

.account-picker-td-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #1e293b;
}

.account-picker-td-cat {
    text-align: right;
    font-size: 11px;
    color: #64748b;
}

.account-picker-row {
    cursor: pointer;
    transition: background 0.1s ease;
}

.account-picker-row:hover,
.account-picker-row--hover {
    background: #eef2ff;
}

.account-picker-empty {
    padding: 16px !important;
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
}

.account-picker-loadmore {
    text-align: center;
    padding: 6px 8px;
    border-top: 1px solid #f1f5f9;
    background: #fafafa;
}

.account-picker-linkbtn {
    border: none;
    background: none;
    color: #2563eb;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
    padding: 4px 8px;
}

.account-picker-linkbtn:hover {
    color: #1d4ed8;
}

.account-picker-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(180deg, #7dd3fc 0%, #38bdf8 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.35);
    box-sizing: border-box;
}

.account-picker-footer-link {
    color: #fff !important;
    font-size: 12px;
    font-weight: 600;
}

.account-picker-footer-hint {
    color: rgba(255, 255, 255, 0.92);
    font-size: 11px;
}

.account-picker-close-btn {
    margin-top: -4px;
}

.product-picker-stock {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.product-picker-stock--ok {
    color: #15803d;
}

.product-picker-stock--low {
    color: #b91c1c;
}

/* Celda compacta: abre modal en lugar de MudAutocomplete */
.stockea-account-cell {
    vertical-align: middle !important;
}

.stockea-account-trigger {
    display: flex;
    align-items: stretch;
    gap: 0;
    border: 1px solid #d1d5db;
    border-radius: 2px;
    background: #fff;
    min-height: 30px;
    max-width: 100%;
}

.stockea-account-trigger:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25);
}

.stockea-account-trigger__input {
    flex: 1;
    min-width: 0;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 4px 6px !important;
    font-size: 12px !important;
    cursor: default;
    background: transparent !important;
}

.stockea-account-trigger__input:focus {
    box-shadow: none !important;
    outline: none !important;
}

.stockea-account-trigger__btn {
    flex-shrink: 0;
    width: 32px;
    border: none;
    border-left: 1px solid #e5e7eb;
    background: #f8fafc;
    color: #475569;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.12s ease, color 0.12s ease;
}

.stockea-account-trigger__btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.stockea-account-trigger__clear {
    flex-shrink: 0;
    width: 26px;
    border: none;
    border-left: 1px solid #e5e7eb;
    background: #fff;
    color: #94a3b8;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.stockea-account-trigger__clear:hover {
    color: #ef4444;
    background: #fef2f2;
}

/* Trigger aún más compacto (fila inferior POS) */
.stockea-account-trigger--compact {
    min-height: 26px;
    border-radius: 2px;
}

.stockea-account-trigger--compact .stockea-account-trigger__input {
    padding: 2px 5px !important;
    font-size: 11px !important;
    line-height: 1.25;
}

.stockea-account-trigger--compact .stockea-account-trigger__btn {
    width: 26px;
    min-height: 26px;
}

.stockea-account-trigger--compact .stockea-account-trigger__btn .mud-icon-root {
    font-size: 1rem !important;
}

.stockea-account-trigger--compact .stockea-account-trigger__clear {
    width: 22px;
    min-height: 26px;
    font-size: 14px;
}

.stockea-account-picker-dialog.mud-dialog-width-sm,
.stockea-medium-picker-dialog.mud-dialog-width-sm {
    max-width: 420px !important;
}

.account-picker-table-wrap--compact {
    max-height: 200px;
}

/* —— Página formas de pago: pestañas planas, sin “caja” alrededor —— */

.pos-payment-page.mud-container .pos-payment-tabs {
    padding: 10px;
    border-radius: 10px;
}

.pos-payment-tabs.mud-tabs {
    background: #fff !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.pos-payment-tabs .mud-tabs-toolbar {
    background: #fff !important;
    box-shadow: none !important;
    border-bottom: 1px solid #e2e8f0;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* MudTabs Color=Primary aplica tabbar-primary con texto “primary-text” (claro).
   Forzamos fondo blanco en la barra, así que hay que redefinir colores de pestañas. */
.pos-payment-tabs .mud-tabs-toolbar.mud-tabs-tabbar-primary,
.pos-payment-tabs .mud-tabs-tabbar.mud-tabs-tabbar-primary {
    background-color: #fff !important;
    color: #334155 !important;
}

.pos-payment-tabs .mud-tabs-tabbar-primary .mud-tab {
    color: #475569 !important;
    background: transparent !important;
    border-radius: 8px;
    margin: 4px 6px 4px 0;
    min-height: 40px;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 600;
}

.pos-payment-tabs .mud-tabs-tabbar-primary .mud-tab .mud-icon-root {
    color: #64748b !important;
}

.pos-payment-tabs .mud-tabs-tabbar-primary .mud-tab:hover {
    background-color: #f1f5f9 !important;
    color: #1e293b !important;
}

.pos-payment-tabs .mud-tabs-tabbar-primary .mud-tab:hover .mud-icon-root {
    color: #475569 !important;
}

.pos-payment-tabs .mud-tabs-tabbar-primary .mud-tab.mud-tab-active {
    background-color: #483d8b !important;
    color: #fff !important;
}

.pos-payment-tabs .mud-tabs-tabbar-primary .mud-tab.mud-tab-active .mud-icon-root {
    color: #fff !important;
}

.pos-payment-tabs .mud-tabs-tabbar-primary .mud-tab.mud-tab-active:hover {
    background-color: #3d3475 !important;
    color: #fff !important;
}

.pos-payment-tabs .mud-tabs-tabbar-primary .mud-tab.mud-tab-active:hover .mud-icon-root {
    color: #fff !important;
}

/* Barra deslizante: en fondo blanco confunde; la selección va por fondo oscuro */
.pos-payment-tabs .mud-tab-slider {
    display: none !important;
}

/* Respaldo si el markup no usa mud-tabs-tabbar-primary en el toolbar */
.pos-payment-tabs .mud-tabs-toolbar .mud-tab:not(.mud-tab-active) {
    color: #475569 !important;
}

.pos-payment-tabs .mud-tabs-toolbar .mud-tab:not(.mud-tab-active) .mud-icon-root {
    color: #64748b !important;
}

.pos-payment-tabs .mud-tabs-toolbar .mud-tab.mud-tab-active {
    background-color: #483d8b !important;
    color: #fff !important;
}

.pos-payment-tabs .mud-tabs-toolbar .mud-tab.mud-tab-active .mud-icon-root {
    color: #fff !important;
}

.pos-payment-tabs .mud-tabs-toolbar-content {
    margin: 0 !important;
}

.pos-payment-tabs .mud-tabs-panels {
    background: #fff !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

.pos-payment-tabs .mud-tab-panel {
    padding: 0 !important;
    background: #fff !important;
}

.pos-payment-tab-panel {
    padding: 0 !important;
    background: #fff !important;
}

.pos-pay-tab,
.pos-em-tab {
    background: #fff;
    padding: 0;
}

/* Tabla: sin panel extra (solo la tabla sobre blanco) */
.pos-pay-tab .stockea-table-panel {
    border: none;
    box-shadow: none;
    background: #fff;
}

/* Medios electrónicos: filas planas */
.pos-em-row {
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
    padding: 10px 0;
}

.pos-em-toolbar {
    padding-bottom: 12px;
    margin-bottom: 0;
    border-bottom: 1px solid #f1f5f9;
}

.pos-em-row--new {
    margin-top: 4px;
    padding-top: 16px;
    padding-bottom: 8px;
    border-bottom: none;
    border-top: 1px solid #f1f5f9;
}

.pos-em-row-main {
    width: 100%;
}

.pos-em-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
}

.pos-em-edit {
    padding: 0;
}

/* Factura de venta: líneas con controles Mud (altura flexible) */
.stockea-table--invoice-lines {
    table-layout: auto;
}

.stockea-table--invoice-lines th,
.stockea-table--invoice-lines td {
    height: auto;
    min-height: 40px;
    vertical-align: middle;
}

.stockea-table--invoice-lines .grid-cell-input input,
.stockea-table--invoice-lines .grid-cell-input .mud-input-slot,
.stockea-table--invoice-lines .grid-cell-input .mud-input-root,
.stockea-table--invoice-lines .product-picker-wrap .mud-input-root,
.stockea-table--invoice-lines .product-variant-html-search .compact-input,
.stockea-table--invoice-lines .product-variant-html-search .stockea-account-trigger--compact,
.stockea-table--invoice-lines .invoice-line-qty-input,
.stockea-table--invoice-lines .invoice-line-price-input {
    min-height: 32px;
    font-size: 0.875rem;
}

.stockea-table--invoice-lines .invoice-line-select.compact-input {
    min-height: 32px;
    font-size: 0.875rem;
    width: 100%;
    max-width: 100%;
}

.stockea-table--invoice-lines .invoice-origin-link {
    text-decoration: none;
}

.stockea-table--invoice-lines .invoice-origin-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stockea-table--invoice-lines .invoice-origin-badge--shipment {
    background: #e0e7ff;
    color: #3730a3;
}

.stockea-table--invoice-lines .invoice-origin-badge--order {
    background: #e0f2fe;
    color: #0369a1;
}

.stockea-table--invoice-lines .invoice-line-stock {
    font-size: 0.875rem;
    font-weight: 500;
}

.stockea-table--invoice-lines .invoice-line-stock--ok {
    color: #15803d;
}

.stockea-table--invoice-lines .invoice-line-stock--low {
    color: #b91c1c;
}

.stockea-table--invoice-lines .invoice-line-delete {
    color: #94a3b8;
}

.stockea-table--invoice-lines .invoice-line-delete:hover {
    color: #b91c1c;
    background: #fef2f2;
}

.stockea-table--invoice-lines .invoice-line-price-hint {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.stockea-table--invoice-lines .stockea-table__col-origen {
    width: 96px;
    min-width: 88px;
}

.stockea-table--invoice-lines .stockea-table__col-sku {
    width: 120px;
    min-width: 100px;
}

.stockea-table--invoice-lines .stockea-table__col-producto {
    min-width: 180px;
    width: 26%;
}

.stockea-table--invoice-lines .stockea-table__col-cantidad {
    width: 100px;
    min-width: 88px;
    text-align: right;
}

.stockea-table--invoice-lines .stockea-table__col-bodega {
    width: 140px;
    min-width: 120px;
}

.stockea-table--invoice-lines .stockea-table__col-disponible {
    width: 92px;
    min-width: 80px;
    text-align: right;
}

.stockea-table--invoice-lines .stockea-table__col-precio {
    width: 120px;
    min-width: 100px;
    text-align: right;
}

.stockea-table--invoice-lines .stockea-table__col-impuesto {
    width: 110px;
    min-width: 90px;
}

.stockea-table--invoice-lines .stockea-table__col-total {
    width: 100px;
    min-width: 88px;
    text-align: right;
}

.stockea-table--invoice-lines .stockea-table__col-acciones {
    width: 48px;
    text-align: center;
}

/* Pagos registrados / borradores: celdas con pickers y Mud */
.stockea-table--invoice-payments .stockea-account-trigger--compact .mud-icon-root {
    font-size: 18px;
}

.stockea-table--invoice-lines tr.grid-row-new td {
    background: rgba(0, 0, 0, 0.02);
}

/* StockeaInlineSearch dentro de tabla: el scroll horizontal recortaba el panel; las filas siguientes lo tapaban */
.stockea-table-scroll:has(.stockea-inline-search__panel) {
    overflow: visible;
}

.stockea-table tbody tr:has(.stockea-inline-search__panel) {
    position: relative;
    z-index: 100;
}

.stockea-table td.stockea-table__cell-clip:has(.stockea-inline-search__panel),
.stockea-table td:has(.stockea-inline-search__panel) {
    overflow: visible;
}

/* Contenedor del buscador por encima de celdas vecinas en la misma fila */
.stockea-table .stockea-inline-search:has(.stockea-inline-search__panel) {
    position: relative;
    z-index: 2;
}

/*
 * Tabla del panel StockeaInlineSearch: lleva .stockea-table para heredar .stockea-table th/td.
 * Ajustes solo de panel (layout + sticky + columna código).
 */
.stockea-inline-search__table.stockea-table {
    table-layout: auto;
}

.stockea-inline-search__table.stockea-table .stockea-inline-search__thead-row th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.stockea-inline-search__table.stockea-table .stockea-inline-search__data-row {
    cursor: pointer;
}

.stockea-inline-search__table.stockea-table .stockea-inline-search__data-row:last-child td {
    border-bottom: none;
}

.stockea-inline-search__table.stockea-table .stockea-inline-search__cell-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    white-space: nowrap;
    color: #3b82f6;
}
