﻿:root {
    --bg: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-600: #1d4ed8;
    --border: #e5e7eb;
    --card: #ffffff;
    --danger: #dc2626;
    --ok: #16a34a;
}
.main-nav{
  display:flex; gap:10px; align-items:center; flex-wrap:wrap;
  padding:10px 16px; border-bottom:1px solid var(--border); background:#fff;
}
.main-nav .nav-group{ display:flex; gap:8px; flex-wrap:wrap; }
.main-nav .nav-spacer{ flex:1; }

.nav-link{
  display:inline-flex; align-items:center; gap:8px;
  padding:8px 12px; border-radius:10px; text-decoration:none;
  color:var(--text);
}
.nav-link:hover{ background:#f8fafc; }
.nav-link.active{ background:#eef2ff; color:var(--primary); font-weight:600; }

.nav-user{ color:var(--muted); margin-right:6px; }

* {
    box-sizing: border-box
}

html, body {
    height: 100%
}

body {
    margin: 0;
    font: 16px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
}

/* Contenedor global: aprovechar ancho en pantallas grandes */
.container {
    max-width: 1600px; /* antes 1100 */
    margin: 0 auto;
    padding: 6px 12px 16px 12px; /* menos aire */
}

/* En pantallas muy grandes, que casi llegue a los bordes */
@media (min-width: 1400px) {
    .container {
        max-width: 95vw; /* ocupa casi toda la pantalla */
    }
}

.page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

    .page-title h2 {
        margin: 0;
        font-size: 1.4rem
    }

.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 12px 0;
    padding: 10px;
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: 10px;
}
.main-nav {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: #fff;
}

    .main-nav .nav-group {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }

    .main-nav .nav-spacer {
        flex: 1;
    }

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text);
}

    .nav-link:hover {
        background: #f8fafc;
    }

    .nav-link.active {
        background: #eef2ff;
        color: var(--primary);
        font-weight: 600;
    }

.nav-user {
    color: var(--muted);
    margin-right: 6px;
}
/* Sidebar vertical */
.main-nav.sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 16px;
}

    .main-nav.sidebar .nav-group {
        display: flex;
        flex-direction: column; /* <-- fuerza columna */
        gap: 6px;
    }

    .main-nav.sidebar .nav-link {
        display: block; /* <-- ocupa todo el ancho, no se pone en la misma línea */
        width: 100%;
    }
.main-nav.sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 16px;
    align-items: stretch; /* <- NUEVO: estira el contenedor */
}

    .main-nav.sidebar .nav-group {
        display: flex;
        flex-direction: column;
        gap: 6px;
        width: 100%; /* <- NUEVO: grupo ocupa todo el ancho */
        margin: 0; /* <- por si acaso */
        padding: 0; /* <- por si acaso */
    }

    .main-nav.sidebar .nav-link {
        display: block;
        width: 100%;
        padding: 8px 12px; /* <- un padding uniforme ayuda a cuadrar */
    }

.main-nav.sidebar .nav-submenu {
    width: 100%;
}

.main-nav.sidebar .nav-submenu > summary {
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
    list-style-position: inside;
}

.main-nav.sidebar .nav-submenu > summary:hover {
    background: #f8fafc;
}

.main-nav.sidebar .nav-submenu-items {
    margin-top: 4px;
    padding-left: 14px;
}

.main-nav.sidebar .nav-submenu-items .nav-link {
    font-size: .94rem;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.form-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap
}

.label {
    display: block;
    font-size: .9rem;
    color: var(--muted);
    margin-bottom: 6px;
}

.input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}

input[type="checkbox"] {
    width: auto
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
}

    .btn:hover {
        background: #f8fafc
    }

    .btn.primary {
        background: var(--primary);
        color: #fff;
        border-color: var(--primary)
    }

        .btn.primary:hover {
            background: var(--primary-600)
        }

    .btn.danger {
        background: #fee2e2;
        color: #991b1b;
        border-color: #fecaca
    }

    .btn.ghost {
        background: transparent
    }

    .btn.sm {
        padding: 6px 8px;
        font-size: .9rem
    }

.btn.icon-round {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.btn.icon-round i {
    margin: 0;
}

.table-responsive {
    width: 100%;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 10px
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0
}

    .table th, .table td {
        padding: 10px 12px;
        border-bottom: 1px solid var(--border);
        white-space: nowrap
    }

    .table th {
        font-weight: 600;
        text-align: left;
        background: #fafafa
    }

    .table tr:last-child td {
        border-bottom: none
    }

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: .8rem;
    border: 1px solid var(--border);
    background: #f8fafc
}



.badge.ok {
    border-color: #bbf7d0;
    background: #ecfdf5;
    color: var(--ok)
}

    .badge.no {
        border-color: #fecaca;
        background: #fef2f2;
        color: #b91c1c
    }

/* Responsive */
@media (min-width:768px) {
    .form-grid {
        grid-template-columns: repeat(2,1fr)
    }

    .form-row.cols-3 {
        grid-template-columns: repeat(3,1fr)
    }
}
@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: #fff;
    }
    /* Solo en páginas con el layout de impresión */
    .print-host .container {
        padding: 0 !important;
    }
}
/* Contenedor de acciones en tablas */
/* Celda de acciones: misma línea en desktop, puede partirse en móvil */
.table .actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap; /* <- clave: no partir en escritorio */
}

/* (Opcional) reservar ancho a la columna de acciones si el texto de otras columnas empuja demasiado */
.table .col-actions {
    width: clamp(220px, 28vw, 360px);
}

/* En móvil permitimos que se parta y se apilen si hace falta */
@media (max-width: 640px) {
    .table .actions {
        flex-wrap: wrap;
        gap: 6px;
    }
}




/* Botones “outline” suaves + variantes de color */
.btn.outline {
    background: #fff;
    border: 1px solid var(--border);
}

    .btn.outline.blue {
        color: #2563eb;
        border-color: #bfdbfe;
    }

    .btn.outline.green {
        color: #059669;
        border-color: #bbf7d0;
    }

    .btn.outline.orange {
        color: #fd7e14;
        border-color: #fed7aa;
    }

    .btn.outline.blue:hover {
        background: #eff6ff;
    }

    .btn.outline.green:hover {
        background: #ecfdf5;
    }
    .btn.outline.orange:hover {
        background: #fff7ed;
    }
    .btn.outline.purple {
        color: #7c3aed;
        border-color: #ddd6fe;
    }
    .btn.outline.purple:hover {
        background: #f5f3ff;
    }

/* Danger ya lo tienes; suavizamos un poco */
.btn.danger {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fecaca;
}

    .btn.danger:hover {
        background: #fecaca;
    }

/* Tamaño pequeño redondeado */
.btn.sm {
    padding: 4px 10px;
    font-size: .9rem;
    border-radius: 999px;
}
@media (max-width: 480px) {
    .table .actions {
        flex-direction: column;
        align-items: flex-start;
    }
}
.input:focus, input:focus, select:focus, textarea:focus, .btn:focus {
    outline: 2px solid #bfdbfe; /* azul clarito */
    outline-offset: 2px;
}
.two-col {
    display: grid;
    grid-template-columns: 1fr; /* móvil */
    gap: 16px;
}

@media (min-width: 1024px) {
    .two-col:not(.closed) {
        grid-template-columns: 1fr 420px; /* lista | editor */
    }
}

.right-pane {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.facturas-proveedor-layout:not(.closed) {
    grid-template-columns: minmax(0, 1fr) !important;
}

.facturas-proveedor-layout:not(.closed) .right-pane {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
}

.facturas-proveedor-layout:not(.closed) .left-pane {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    min-width: 0;
}

/* En Facturas de proveedor, el formulario de alta/edición se muestra antes
   de los filtros y de la relación, siguiendo la distribución de Facturas. */
.facturas-proveedor-page {
    display: flex;
    flex-direction: column;
}

.facturas-proveedor-page > .page-title {
    order: 1;
}

.facturas-proveedor-page > .card {
    order: 2;
}

.facturas-proveedor-page > .facturas-proveedor-layout {
    display: contents;
}

.facturas-proveedor-page .facturas-proveedor-layout > .right-pane {
    order: 3;
    margin-bottom: 16px;
}

.facturas-proveedor-page > .facturas-proveedor-toolbar {
    order: 4;
}

.facturas-proveedor-page > .facturas-proveedor-error-fechas {
    order: 5;
}

.facturas-proveedor-page .facturas-proveedor-layout > .left-pane {
    order: 6;
}

.left-pane .card {
    margin: 0;
}
/* Dropdown sugerencias artículos */
.suggest {
    padding: 6px;
}

.suggest-item:hover {
    background: #f8fafc;
}

/* Ajuste opcional de celda para móviles (mantiene scroll horizontal de la tabla) */
@media (max-width: 640px) {
    .table td:first-child {
        min-width: 280px;
    }
}
/* Dropdown sugerencias artículos (hereda card y colores del tema) */
.suggest {
    padding: 6px;
}

.suggest-item:hover {
    background: #f8fafc;
}
.sug-row {
    padding: 8px;
    cursor: pointer;
}

    .sug-row:hover, .sug-row.active {
        background: #f3f4f6;
    }

@media (max-width: 640px) {
    .table-responsive {
        overflow-x: auto;
    }

    textarea.input {
        min-height: 80px;
    }
}
/* Overlay de fondo para el modal */
.modal-overlay {
    position: fixed;
    inset: 0; /* top:0; right:0; bottom:0; left:0 */
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
}

/* Caja del diálogo */
.modal-dialog {
    background: #ffffff;
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 400px;
    width: 90%; /* responsive en móvil */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

    .modal-dialog h5 {
        margin-top: 0;
        margin-bottom: 0.75rem;
    }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}
.xml-preview {
    max-height: 300px;
    overflow: auto;
    background: #f8f9fa;
    border-radius: 4px;
    padding: 0.5rem;
    font-family: Consolas, monospace;
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-all;
}
.xml-preview {
    max-height: 250px;
    overflow: auto;
    background: #f8f9fa;
    border-radius: 4px;
    padding: 0.5rem;
    font-family: Consolas, monospace;
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.small-text {
    font-size: 0.75rem;
    word-break: break-all;
}
.badge {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    font-size: 0.75rem;
    border-radius: 0.5rem;
}

.badge-success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.badge-warning {
    background-color: #fff3cd;
    color: #664d03;
}

.badge-danger {
    background-color: #f8d7da;
    color: #842029;
}

.badge-muted {
    background-color: #e9ecef;
    color: #495057;
}
/* 🔥 FORZAR tabla compacta (prueba) */
/* ===== Tablas compactas (global) ===== */
.table-responsive .table th,
.table-responsive .table td {
    font-size: 12px !important;
    padding: 6px 6px !important; /* más compacto horizontal */
    line-height: 1.1 !important;
}

    /* Acciones más juntas dentro de tablas */
    .table-responsive .table .actions,
    .table-responsive .table td .d-flex {
        gap: 4px !important;
    }
/* ===== Forzar columnas a encoger aunque haya min-width inline ===== */
.table-responsive .table th,
.table-responsive .table td {
    min-width: 0 !important;
}

    /* Si aún así alguna columna se resiste, aplica a cualquier th con style inline */
    .table-responsive .table th[style] {
        min-width: 0 !important;
    }
/* Botón ajuste stock más pequeño */
.stock-adjust-btn {
    padding: 2px 6px !important;
    border-radius: 999px;
    font-size: 11px !important;
    line-height: 1 !important;
}

    .stock-adjust-btn i {
        font-size: 12px !important;
    }
/* ===== Layout 2 columnas: dar más ancho al panel derecho ===== */
@media (min-width: 1024px) {
    .two-col:not(.closed) {
        grid-template-columns: minmax(520px, 1fr) 520px !important; /* antes 1fr 420px */
    }
}
.two-col {
    gap: 12px !important; /* antes 16px */
}
.two-col {
    gap: 12px !important; /* antes 16px */
}
.validation-message {
    color: #dc3545 !important;
    font-size: 0.90rem;
    margin-top: 4px;
    display: block;
}

/* ===== Toasts XionERP ===== */

.toast-xion-container {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(420px, calc(100vw - 36px));
}

.toast-xion {
    position: relative;
    padding: 14px 44px 14px 18px;
    border-radius: 12px;
    color: #ffffff;
    background: #1f3b5c;
    box-shadow: 0 8px 20px rgba(59,130,246,.20), 0 16px 40px rgba(37,99,235,.18);
    border-left: 5px solid;
    animation: toast-xion-entrada 0.22s ease-out;
}

.toast-xion-titulo {
    font-weight: 700;
    font-size: 0.98rem;
    margin-bottom: 3px;
}

.toast-xion-mensaje {
    font-size: 0.93rem;
    line-height: 1.35;
}

.toast-xion-cerrar {
    position: absolute;
    top: 7px;
    right: 10px;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.8;
}

    .toast-xion-cerrar:hover {
        opacity: 1;
    }

.toast-xion-exito {
    border-left-color: #22c55e;
}

.toast-xion-error {
    border-left-color: #ef4444;
}

.toast-xion-advertencia {
    border-left-color: #f59e0b;
}

.toast-xion-informacion {
    border-left-color: #3b82f6;
}

@keyframes toast-xion-entrada {
    from {
        opacity: 0;
        transform: translateX(24px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== Diálogo global XionERP ===== */

.dialog-xion-overlay {
    position: fixed;
    inset: 0;
    z-index: 2900;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
}

.dialog-xion {
    width: min(520px, 95vw);
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #dbe4f0;
    border-radius: 14px;
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.22), 0 24px 55px rgba(15, 23, 42, 0.22);
    animation: dialog-xion-entrada 0.18s ease-out;
}

.dialog-xion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}

    .dialog-xion-header h5 {
        margin: 0;
        font-size: 1.05rem;
        color: var(--text);
    }

.dialog-xion-cerrar {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

    .dialog-xion-cerrar:hover {
        color: var(--text);
    }

.dialog-xion-body {
    padding: 18px;
    color: var(--text);
}

    .dialog-xion-body p {
        margin: 0 0 10px;
    }

.dialog-xion-aviso {
    color: var(--muted);
    font-size: 0.9rem;
}

.dialog-xion-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid var(--border);
    background: #f8fafc;
}

.historial-recepciones-dialog {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 40px);
}

.historial-recepciones-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.historial-recepciones-body .table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
}

@keyframes dialog-xion-entrada {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== badges del estado y numero de albaran que sale en la relacion de presupuestos ===== */
.gris-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    background-color: #eef2f7;
    color: #344054;
    border: 1px solid #d7dee8;
    font-weight: 600;
}

.verde-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    background-color: #e8f8ef;
    color: #198754;
    border: 1px solid #a8e0c0;
    font-weight: 600;
}
.azul-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    background-color: #dbeafe;
    color: #1d4ed8;
    border: 1px solid #a8e0c0;
    font-weight: 600;
}
.rojo-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    background-color: #fee2e2;
    color: #dc2626;
    border: 1px solid #a8e0c0;
    font-weight: 600;
}
.naranja-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    background-color: #ffedd5;
    color: #c2410c;
    border: 1px solid #fdba74;
    font-weight: 600;
}
/* ===== Columnas de las líneas de artículos del presupuesto ===== */

.col-descripcion {
    width: 360px;
    min-width: 360px;
}

.factura-edicion-card {
    width: calc(100vw - 285px);
    max-width: 1100px;
    box-sizing: border-box;
}

.factura-edicion-cabecera {
    width: calc(100vw - 285px) !important;
    max-width: 1100px;
    box-sizing: border-box;
}

.factura-edicion-card .col-descripcion {
    max-width: 360px;
}

@media (max-width: 900px) {
    .factura-edicion-card,
    .factura-edicion-cabecera {
        width: calc(100vw - 24px) !important;
        max-width: none;
    }
}

.col-cantidad {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
}

.col-precio {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
}

.col-porcentaje {
    width: 95px;
    min-width: 95px;
    max-width: 95px;
}
/* ===== tenemos una variable base de css para cb el ancho de las columnas de importe
    así si queremos cambiar el ancho con cb el  valor de la vble es suficiente 
    y no hay que ir columna  a columna ===== */
 
:root {
    --ancho-columna-importe: 105px;
}

.col-importe {
    width: var(--ancho-columna-importe);
    min-width: var(--ancho-columna-importe);
    text-align: center;
    white-space: nowrap;
    vertical-align: top;
}

.col-acciones {
    width: 48px;
    min-width: 48px;
    max-width: 48px;
}

.input-numero {
    width: 100%;
    min-width: 0;
    padding-left: 6px;
    padding-right: 6px;
}

.valor-importe-linea {
    width: 100%;
    text-align: center;
    padding-top: 10px;
}
.col-cobrada {
    width: 75px !important;
    min-width: 75px !important;
    max-width: 75px !important;
    padding: 0 !important;
    text-align: center !important;
}

.col-fcobro {
    width: 90px !important;
    min-width: 90px !important;
    max-width: 90px !important;
    padding: 0 !important;
    white-space: nowrap;
    text-align: center !important;
}

.col-origen {
    width: 60px !important;
    min-width: 60px !important;
    max-width: 60px !important;
    padding: 0 !important;
    text-align: center !important;
}
.titulo-cobrada {
    display: inline-block;
    transform: translateX(0px);
}
.titulo-fcobro {
    display: inline-block;
    transform: none;
}
.titulo-origen {
    display: inline-block;
    transform: none;
}
.titulo-vf {
    display: inline-block;
    transform: translateX(10px);
}
.col-abono {
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    padding-left: 2px !important;
    padding-right: 0 !important;
}

/* ===== Totales de documentos ===== */

.totales-documento {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 8px;
    margin-top: 28px;
    margin-bottom: 12px;
}

.total-documento {
    width: var(--ancho-columna-importe); /* Igual que .col-importe */
    text-align: center;
}

.total-documento .label {
    display: block;
    margin-bottom: 8px;
}

.total-documento .badge {
    display: block;
    text-align: center;
}

.retencion-total-input {
    width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 5px 12px !important;
    border-radius: 999px !important;
    font-size: .75rem !important;
    font-weight: 600;
    line-height: normal;
    text-align: center;
}

/* ===== Deshabilita Icono boton de Delete (en Facturas) */
.icon-btn.disabled {
    opacity: .5;
    cursor: default;
    pointer-events: auto; /* permite que aparezca el title */
}

    .icon-btn.disabled:hover {
        background: inherit;
        color: inherit;
        transform: none;
        box-shadow: none;
    }

 
 
 

