/* =============================================
   Steel Inox Extranet — Design System
   Complementa TailwindCSS CDN + FlyonUI CDN
   ============================================= */

/* --- Variables de marca --- */
:root {
    --si-primary: #F97316;
    --si-primary-hover: #EA580C;
    --si-primary-light: #FFF7ED;
    --si-primary-50: #FFF7ED;
    --si-primary-100: #FFEDD5;
    --si-primary-500: #F97316;
    --si-primary-600: #EA580C;
    --si-primary-700: #C2410C;
    --si-gray-50: #F9FAFB;
    --si-gray-100: #F3F4F6;
    --si-gray-200: #E5E7EB;
    --si-gray-300: #D1D5DB;
    --si-gray-400: #9CA3AF;
    --si-gray-500: #6B7280;
    --si-gray-700: #374151;
    --si-gray-800: #1F2937;
    --si-gray-900: #111827;
    --si-success: #10B981;
    --si-warning: #F59E0B;
    --si-danger: #EF4444;
    --si-info: #3B82F6;

    /* --- Tematización (Light por defecto) --- */
    --si-bg-page: #F9FAFB;
    --si-bg-card: #FFFFFF;
    --si-border-card: #E5E7EB;
    --si-text-title: #111827;
    --si-text-body: #374151;
    --si-text-muted: #9CA3AF;
}

/* --- Line Clamp Utilities (Fallback for old environments) --- */
.line-clamp-1 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    line-clamp: 1
}

.line-clamp-2 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2
}

.line-clamp-3 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

/* --- Base Styles --- */
* {
    font-family: 'Inter', sans-serif;
}

/* Selección de texto: naranja de marca + texto blanco */
::selection {
    background-color: var(--si-primary-500);
    color: #ffffff;
}

::-moz-selection {
    background-color: var(--si-primary-500);
    color: #ffffff;
}

/* --- Variables Modo Oscuro Premium (Tonos Zinc/Neutros) --- */
.dark {
    /* Fondos principales profundos y sin subtonos azules */
    --si-bg-page: #09090b;
    /* Fondo principal casi negro para máximo contraste */
    --si-bg-card: #18181b;
    /* Fondo de tarjetas ligeramente más claro para dar profundidad */
    --si-border-card: #27272a;
    /* Bordes sutiles */

    /* Textos optimizados para lectura prolongada (evitar el blanco puro #FFF que fatiga) */
    --si-text-title: #fafafa;
    --si-text-body: #d4d4d8;
    --si-text-muted: #a1a1aa;

    /* Inversión de la escala de grises para compatibilidad automática */
    --si-gray-50: #18181b;
    --si-gray-100: #27272a;
    --si-gray-200: #3f3f46;
    --si-gray-300: #52525b;
    --si-gray-400: #71717a;
    --si-gray-500: #a1a1aa;
    --si-gray-600: #d4d4d8;
    --si-gray-700: #e4e4e7;
    --si-gray-800: #f4f4f5;
    --si-gray-900: #fafafa;
}

/* --- Global Dark Mode Overrides (Prevents hardcoded white/light elements) --- */

/* Fondos Claros -> Oscuros */
.dark .bg-white,
.dark .bg-gray-50,
.dark .bg-gray-100,
.dark .bg-slate-50,
.dark .bg-zinc-50,
.dark .bg-neutral-50,
.dark .bg-orange-50,
.dark .bg-amber-50,
.dark .bg-blue-50,
.dark .bg-indigo-50,
.dark .bg-emerald-50,
.dark .bg-\[\#f8faff\],
.dark .bg-\[\#f8f9fa\],
.dark .bg-\[\#FAFAFA\],
.dark .bg-\[\#fdf2d0\],
.dark .bg-\[\#fef9eb\],
.dark .bg-\[\#f0efff\],
.dark .bg-\[\#fcfaff\],
.dark .bg-\[\#fff9eb\] {
    background-color: var(--si-bg-card) !important;
}

/* Fondos Semi-transparentes */
.dark .bg-gray-50\/20,
.dark .bg-gray-50\/30,
.dark .bg-gray-50\/50,
.dark .bg-gray-100\/50,
.dark .bg-white\/50,
.dark .bg-white\/80 {
    background-color: rgba(39, 39, 42, 0.4) !important;
    /* Zinc-800 aprox */
}

/* Bordes Claros -> Oscuros */
.dark .border-gray-50,
.dark .border-gray-100,
.dark .border-gray-200,
.dark .border-slate-100,
.dark .border-slate-200,
.dark .border-orange-100,
.dark .border-orange-200,
.dark .border-\[\#e0e7ff\],
.dark .border-\[\#c7d2fe\],
.dark .border-\[\#f3ebff\],
.dark .border-white {
    border-color: var(--si-border-card) !important;
}

/* Textos Oscuros -> Claros */
.dark .text-gray-900,
.dark .text-gray-800,
.dark .text-slate-800,
.dark .text-zinc-950,
.dark .text-\[\#000000\],
.dark .text-\[\#1e1b4b\],
.dark .text-\[\#111827\],
.dark .text-\[\#a17a22\],
.dark .text-\[\#cb8e24\],
.dark .text-\[\#6e56cf\] {
    color: var(--si-text-title) !important;
}

/* Textos Secundarios */
.dark .text-gray-700,
.dark .text-gray-600,
.dark .text-slate-700,
.dark .text-slate-600,
.dark .text-zinc-600 {
    color: var(--si-text-body) !important;
}

/* Textos Muted */
.dark .text-gray-500,
.dark .text-gray-400,
.dark .text-slate-500,
.dark .text-slate-400,
.dark .text-zinc-500 {
    color: var(--si-text-body-muted) !important;
}

/* Mejora de Contraste para Badges (Gray-100 fallback) */
.dark span.bg-gray-100,
.dark .bg-gray-100 {
    background-color: rgba(39, 39, 42, 0.8) !important;
    color: #a1a1aa !important;
    /* Zinc-400 */
}

/* KPI Cards & Tabs (Centralizado) */
.dark .kpi-card,
.dark .si-kpi-card,
.dark .tab-filter,
.dark .tab-client,
.dark .settings-card {
    background-color: var(--si-bg-card) !important;
    border-color: var(--si-border-card) !important;
    color: var(--si-text-body) !important;
}

.dark .tab-filter.active,
.dark .tab-client.active {
    background-color: var(--si-primary) !important;
    color: #fff !important;
}

/* Shadows Premium */
.dark .shadow-sm,
.dark .shadow-md,
.dark .shadow-lg,
.dark .shadow-xl,
.dark .shadow-2xl {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.2) !important;
}

/* Forms & Inputs (Fuerza máxima) */
.dark input:not([type="checkbox"]):not([type="radio"]),
.dark textarea,
.dark select {
    background-color: var(--si-bg-page) !important;
    border-color: var(--si-border-card) !important;
    color: var(--si-text-title) !important;
}

.dark input::placeholder {
    color: #52525b !important;
}

/* zinc-500 */

/* Overrides para Facturación y Colores Específicos */
.dark .bg-\[\#fcfaff\] {
    background-color: rgba(138, 92, 245, 0.05) !important;
}

.dark .border-\[\#f3ebff\] {
    border-color: rgba(138, 92, 245, 0.1) !important;
}

.dark .text-\[\#8a5cf5\] {
    color: #a78bfa !important;
}

/* morado claro */

/* --- Utils de Rendimiento --- */
.no-transitions *,
.no-transitions *::before,
.no-transitions *::after {
    transition: none !important;
    animation: none !important;
}


/* Prevención de White Flashes en Hovers de Acción */
.dark .hover\:bg-orange-50:hover {
    background-color: rgba(249, 115, 22, 0.1) !important;
}

.dark .hover\:bg-blue-50:hover {
    background-color: rgba(59, 130, 246, 0.1) !important;
}

.dark .hover\:bg-red-50:hover {
    background-color: rgba(239, 68, 68, 0.1) !important;
}

.dark .hover\:bg-emerald-50:hover {
    background-color: rgba(16, 185, 129, 0.1) !important;
}

.dark .hover\:bg-gray-100:hover,
.dark .hover\:bg-gray-50:hover,
.dark .hover\:bg-orange-50:hover,
.dark .hover\:bg-blue-50:hover,
.dark .hover\:bg-red-50:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Table Overrides */
.dark .bg-gray-50\/30,
.dark .bg-gray-50\/50,
.dark .bg-gray-50\/80 {
    background-color: var(--si-bg-page) !important;
}

.dark tr.bg-gray-50,
.dark .si-table thead tr {
    background-color: rgba(24, 24, 27, 0.8) !important;
    /* Zinc-900 */
}

/* Scrollbars Dark */
.dark ::-webkit-scrollbar-track {
    background: var(--si-bg-page);
}

.dark ::-webkit-scrollbar-thumb {
    background: var(--si-border-card);
    border-radius: 10px;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #3f3f46;
}

/* Breadcrumbs, Dividers & Tables */
.dark .text-gray-300 {
    color: #3f3f46 !important;
}

.dark table thead tr {
    background-color: rgba(39, 39, 42, 0.5) !important;
}

.dark table tbody tr:hover {
    background-color: rgba(39, 39, 42, 0.3) !important;
}

/* Modales Globales */
.dark #si-confirm-modal>div,
.dark [id*="modal"]>div.bg-white,
.dark .modal-content {
    background-color: var(--si-bg-card) !important;
    border: 1px solid var(--si-border-card) !important;
}


.dark svg.audit-icon {
    color: #ffffff !important;
}

body {
    background-color: var(--si-bg-page) !important;
    color: var(--si-text-body);
}

/* --- Premium Effects --- */
.dark header {
    background-color: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-color: rgba(0, 0, 0, 0.5) !important;
}

.dark aside,
.dark footer {
    background-color: var(--si-bg-card) !important;
    border-color: var(--si-border-card) !important;
}

.dark .sidebar-item.active {
    background-color: rgba(249, 115, 22, 0.1);
    color: var(--si-primary);
}

.dark .si-table-wrapper {
    background-color: var(--si-bg-card);
    border: 1px solid var(--si-border-card);
}

/* --- Layout Responsive Global --- */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
    position: relative;
}

#main-content {
    width: 100%;
    padding: 1rem;
    max-width: 100vw;
}

@media (min-width: 640px) {
    #main-content {
        padding: 1.5rem;
    }
}

@media (min-width: 1024px) {
    #main-content {
        padding: 2rem;
    }
}

/* Helper para secciones con scroll horizontal (como los tabs) */
.hide-scrollbar {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.hide-scrollbar::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

/* Ajuste extremo para móviles pequeños */
@media (max-width: 400px) {
    .text-3xl {
        font-size: 1.5rem !important;
    }

    .kpi-card {
        padding: 1rem !important;
    }
}

/* --- Scrollbar personalizado --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--si-gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--si-gray-300);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--si-gray-400);
}

/* --- Transiciones globales --- */
*,
*::before,
*::after {
    transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform;
    transition-duration: 150ms;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Botón primario Steel Inox --- */
.btn-si-primary {
    background-color: var(--si-primary) !important;
    border-color: var(--si-primary) !important;
    color: white !important;
}

.btn-si-primary:hover {
    background-color: var(--si-primary-hover) !important;
    border-color: var(--si-primary-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.35);
}

.btn-si-primary:active {
    transform: scale(0.98);
}

.btn-si-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* --- Sidebar --- */
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--si-gray-500);
    cursor: pointer;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.sidebar-item.active {
    background-color: var(--si-primary-light);
    color: var(--si-primary);
    border-left-color: var(--si-primary);
    font-weight: 600;
}

.sidebar-item:hover:not(.active) {
    background-color: var(--si-gray-50);
    color: var(--si-gray-700);
}

.sidebar-nav-group {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.sidebar-item-child {
    padding: 0.5rem 0.75rem 0.5rem 1.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    gap: 0.5rem;
    min-width: 0;
    max-width: 100%;
    border-left-width: 2px;
}

.sidebar-item-child-indicator {
    flex-shrink: 0;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: currentColor;
    opacity: 0.45;
}

.sidebar-item-child-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-item.active-parent {
    background-color: rgba(249, 115, 22, 0.06);
    color: var(--si-primary);
    border-left-color: rgba(249, 115, 22, 0.35);
    font-weight: 600;
}

.dark .sidebar-item.active-parent {
    background-color: rgba(249, 115, 22, 0.08);
}

.dark .sidebar-item-child.active {
    background-color: rgba(249, 115, 22, 0.12);
}

/* --- Badges de estado Premium --- */
.si-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.65rem;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid transparent;
    white-space: nowrap;
}

/* Colores con bordes sutiles (Alineados con dropdown dots) */
.badge-propuesta {
    background-color: #fffbeb;
    /* amber-50 */
    color: #b45309;
    /* amber-700 */
    border-color: #fde68a;
    /* amber-200 */
}

.badge-aprobado {
    background-color: #eff6ff;
    /* blue-50 */
    color: #1d4ed8;
    /* blue-700 */
    border-color: #bfdbfe;
    /* blue-200 */
}

.badge-ejecucion {
    background-color: #ecfdf5;
    /* emerald-50 */
    color: #047857;
    /* emerald-700 */
    border-color: #a7f3d0;
    /* emerald-200 */
}

.badge-cerrado {
    background-color: #fef2f2;
    /* red-50 */
    color: #b91c1c;
    /* red-700 */
    border-color: #fecaca;
    /* red-200 */
}

.badge-activo {
    background-color: #D1FAE5;
    color: #065F46;
    border-color: #A7F3D0;
}

.badge-inactivo {
    background-color: #FEE2E2;
    color: #991B1B;
    border-color: #FECACA;
}

/* Animación de pulso para proyectos en curso */
.animate-si-pulse {
    animation: si-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes si-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: .4;
    }
}

/* --- Cards con hover --- */
.card-hover {
    transition: all 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

/* --- KPI Cards --- */
.kpi-card {
    background: white;
    border: 1px solid var(--si-gray-200);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.kpi-card:hover {
    border-color: var(--si-primary);
    box-shadow: 0 0 0 1px var(--si-primary-100);
}

/* --- Tabla --- */
.si-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Scroll suave en iOS */
    border-radius: 0.75rem;
}

.si-table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--si-gray-500);
    border-bottom: 2px solid var(--si-gray-200);
}

.si-table tbody tr {
    border-bottom: 0;
}

.si-table tbody tr:hover {
    background-color: var(--si-gray-50);
}

.si-table td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--si-gray-700);
}

/* --- Loader / Spinner --- */
.si-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--si-gray-200);
    border-top-color: var(--si-primary);
    border-radius: 50%;
    animation: si-spin 0.7s linear infinite;
}

@keyframes si-spin {
    to {
        transform: rotate(360deg);
    }
}


/* --- Login page background --- */
.login-bg {
    background: linear-gradient(rgba(17, 24, 39, 0.4), rgba(17, 24, 39, 0.4)),
        url('../img/steel-inox-nosotros-v3.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    min-height: 100vh;
}

/* --- Animación de fade in --- */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Page transition --- */
.page-enter {
    animation: pageEnter 0.25s ease-out;
}

@keyframes pageEnter {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* --- Avatar con iniciales --- */
.avatar-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--si-primary-100);
    color: var(--si-primary);
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* --- Progress bar --- */
.si-progress {
    width: 100%;
    height: 6px;
    background-color: var(--si-gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.si-progress-fill {
    height: 100%;
    background-color: var(--si-primary);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* --- Tab filters --- */
.tab-filter {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.5rem;
    cursor: pointer;
    border: 1px solid var(--si-gray-200);
    background: white;
    color: var(--si-gray-600);
}

.tab-filter:hover:not(.active) {
    background: var(--si-gray-50);
}

.tab-filter.active {
    background-color: var(--si-primary);
    color: white;
    border-color: var(--si-primary);
}

/* --- Tab filters (Client style) --- */
.tab-client {
    cursor: pointer;
    background-color: var(--si-gray-50);
    color: var(--si-gray-500);
    border: none;
    transition: all 0.2s;
}

/* Evitar hover pegajoso en móviles (solo en dispositivos con ratón) */
@media (hover: hover) and (pointer: fine) {
    .tab-client:hover:not(.active) {
        background-color: var(--si-gray-100);
        color: var(--si-gray-900);
    }
}

.tab-client.active {
    background-color: var(--si-primary);
    /* Naranja Steel Inox */
    color: white;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.35);
}

/* --- Empty state --- */
.si-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
    color: var(--si-gray-400);
}

.si-empty svg {
    width: 4rem;
    height: 4rem;
    margin-bottom: 1rem;
    color: var(--si-gray-300);
}

/* --- Responsive sidebar --- */
@media (max-width: 1023px) {
    .sidebar-desktop {
        display: none !important;
    }

    .sidebar-mobile-overlay {
        transition: opacity 0.3s ease, visibility 0.3s ease;
        visibility: hidden;
        opacity: 0;
        display: block !important;
        /* Sobrescribir el hidden inicial de HTML */
    }

    .sidebar-mobile-overlay.active {
        visibility: visible;
        opacity: 1;
    }
}

@media (min-width: 1024px) {

    .sidebar-mobile-overlay,
    .sidebar-mobile {
        display: none !important;
    }
}

/* --- Settings Components --- */
.settings-card {
    background: var(--si-bg-card);
    border: 1px solid var(--si-border-card);
    border-radius: 1.5rem;
    padding: 1.5rem;
}

.dark .settings-card:hover {
    border-color: var(--si-primary);
}

.dark input:not([type="checkbox"]):not([type="radio"]),
.dark textarea,
.dark select {
    background-color: #040505 !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

.dark .si-pwd-requirements {
    background: rgba(15, 23, 42, 0.5);
    padding: 0.5rem;
    border-radius: 0.75rem;
}

/* --- Animated Theme Switcher --- */
.theme-switcher-btn {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: var(--si-gray-50);
    border: 1px solid var(--si-gray-200);
    color: var(--si-gray-500);
}

.dark .theme-switcher-btn {
    background: var(--si-bg-card);
    border-color: var(--si-border-card);
    color: var(--si-primary);
}

.theme-switcher-btn:hover {
    transform: scale(1.05) rotate(5deg);
    border-color: var(--si-primary);
    color: var(--si-primary);
}

.theme-switcher-btn svg {
    position: absolute;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-switcher-btn .sun {
    transform: translateY(0) rotate(0);
    opacity: 1;
}

.theme-switcher-btn .moon {
    transform: translateY(20px) rotate(45deg);
    opacity: 0;
}

.dark .theme-switcher-btn .sun {
    transform: translateY(-20px) rotate(-45deg);
    opacity: 0;
}

.dark .theme-switcher-btn .moon {
    transform: translateY(0) rotate(0);
    opacity: 1;
}

/* --- Restructured Settings --- */
.settings-section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--si-gray-100);
}

.dark .settings-section-header {
    border-bottom-color: var(--si-border-card);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

/* Pantalla selección de empresa: todo centrado, sin sidebar */
body.si-select-company-layout .sidebar-desktop,
body.si-select-company-layout #sidebar-mobile,
body.si-select-company-layout #sidebar-overlay,
body.si-select-company-layout #breadcrumb,
body.si-select-company-layout footer {
    display: none !important;
}

body.si-select-company-layout #main-content {
    margin: 0 !important;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 1.5rem 12vh;
    box-sizing: border-box;
}

body.si-select-company-layout #main-content > * {
    transform: translateY(-4vh);
}

/* Popover "Varias empresas" — por encima de tablas y modales */
.si-companies-popover {
    z-index: 99999;
    pointer-events: auto;
}

/* Selector empresa activa — drawer móvil */
#sidebar-mobile .company-context-switcher {
    position: relative;
}

/* Puente invisible trigger ↔ lista (el popover está en body) */
.si-companies-popover::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: -14px;
    height: 14px;
}

.si-companies-popover-wrap {
    position: relative;
}

/* Barra de acciones del expediente (admin/comercial) */
.prj-admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    width: 100%;
    padding: 0.375rem;
    border-radius: 1rem;
    background: linear-gradient(180deg, #fafafa 0%, #f3f4f6 100%);
    border: 1px solid rgba(229, 231, 235, 0.95);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

@media (min-width: 640px) {
    .prj-admin-toolbar {
        width: auto;
    }
}

.prj-admin-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex: 1 1 8rem;
    min-height: 2.75rem;
    padding: 0.375rem 0.875rem 0.375rem 0.375rem;
    font-size: 0.6875rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--si-gray-700);
    background: #fff;
    border: 1px solid var(--si-gray-200);
    border-radius: 0.75rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
    cursor: pointer;
}

@media (min-width: 640px) {
    .prj-admin-action {
        flex: 0 0 auto;
    }
}

.prj-admin-action:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.prj-admin-action:active:not(:disabled) {
    transform: translateY(0);
}

.prj-admin-action:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.prj-admin-action__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    flex-shrink: 0;
}

.prj-admin-action__icon svg {
    width: 1rem;
    height: 1rem;
}

.prj-admin-action--amber:hover:not(:disabled) {
    border-color: #fcd34d;
    color: #b45309;
    background: #fffbeb;
}

.prj-admin-action--amber .prj-admin-action__icon {
    background: #fef3c7;
    color: #d97706;
}

.prj-admin-action--danger:hover:not(:disabled) {
    border-color: #fca5a5;
    color: #b91c1c;
    background: #fef2f2;
}

.prj-admin-action--danger .prj-admin-action__icon {
    background: #fee2e2;
    color: #dc2626;
}

.prj-admin-action--edit:hover:not(:disabled) {
    border-color: #c7d2fe;
    color: #4338ca;
    background: #eef2ff;
}

.prj-admin-action--edit .prj-admin-action__icon {
    background: #e0e7ff;
    color: #4f46e5;
}